qxr-stdalonevwr: changes for oracle mic bias
Adding Oracle MIC Bias Voltage regulator and enabling it. Change-Id: I3b5b9e59777d7722dc39d16386f597e1a1a87b4c Signed-off-by: Rajesh Bharathwaj <rajeshbharathwaj@codeaurora.org>
This commit is contained in:
parent
6639890b6a
commit
1d92154966
1 changed files with 17 additions and 25 deletions
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
@ -15,7 +15,8 @@
|
||||||
struct qxr_stdalonevwr {
|
struct qxr_stdalonevwr {
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
struct regulator *reg_imu;
|
struct regulator *reg_imu;
|
||||||
int ndi_5v_en;
|
struct regulator *reg_dmic;
|
||||||
|
/*int ndi_5v_en;*/
|
||||||
bool initDone;
|
bool initDone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,7 +25,6 @@ static struct qxr_stdalonevwr *pdata;
|
||||||
static int qxr_stdalonevwr_allocate_res(void)
|
static int qxr_stdalonevwr_allocate_res(void)
|
||||||
{
|
{
|
||||||
int rc = -EINVAL;
|
int rc = -EINVAL;
|
||||||
bool gpioEnabled = false;
|
|
||||||
|
|
||||||
if (pdata->initDone) {
|
if (pdata->initDone) {
|
||||||
pr_debug("%s init is done already\n", __func__);
|
pr_debug("%s init is done already\n", __func__);
|
||||||
|
@ -35,27 +35,20 @@ static int qxr_stdalonevwr_allocate_res(void)
|
||||||
if (!IS_ERR(pdata->reg_imu)) {
|
if (!IS_ERR(pdata->reg_imu)) {
|
||||||
regulator_set_load(pdata->reg_imu, 600000);
|
regulator_set_load(pdata->reg_imu, 600000);
|
||||||
rc = regulator_enable(pdata->reg_imu);
|
rc = regulator_enable(pdata->reg_imu);
|
||||||
if (rc < 0) {
|
if (rc < 0)
|
||||||
pr_err("%s IMU rail pm8150a_l11 failed\n", __func__);
|
pr_err("%s IMU rail pm8150a_l11 failed\n", __func__);
|
||||||
devm_regulator_put(pdata->reg_imu);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpio_is_valid(pdata->ndi_5v_en)) {
|
/* Oracle MIC BIAS Voltage regulator */
|
||||||
rc = gpio_request(pdata->ndi_5v_en, "ndi_5v_en");
|
pdata->reg_dmic = devm_regulator_get(&pdata->pdev->dev, "pm8150_l10");
|
||||||
if (!rc) {
|
if (!IS_ERR(pdata->reg_dmic)) {
|
||||||
rc = gpio_direction_output(pdata->ndi_5v_en, 0);
|
regulator_set_load(pdata->reg_dmic, 600000);
|
||||||
if (!rc) {
|
rc = regulator_enable(pdata->reg_dmic);
|
||||||
gpio_set_value(pdata->ndi_5v_en, 1);
|
if (rc < 0)
|
||||||
gpioEnabled = true;
|
pr_err("%s Oracle MIC BIAS reg pm8150_l10 failed\n",
|
||||||
msleep(20);
|
__func__);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!gpioEnabled) {
|
|
||||||
pr_err("%s NDI_5V_EN gpio failed to allocate\n", __func__);
|
|
||||||
gpio_free(pdata->ndi_5v_en);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata->initDone = true;
|
pdata->initDone = true;
|
||||||
pr_debug("%s rc:%d\n", __func__, rc);
|
pr_debug("%s rc:%d\n", __func__, rc);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -64,11 +57,10 @@ static int qxr_stdalonevwr_allocate_res(void)
|
||||||
static void qxr_stdalonevwr_free_res(void)
|
static void qxr_stdalonevwr_free_res(void)
|
||||||
{
|
{
|
||||||
if (pdata->initDone) {
|
if (pdata->initDone) {
|
||||||
if (pdata->reg_imu) {
|
if (pdata->reg_imu)
|
||||||
regulator_disable(pdata->reg_imu);
|
regulator_disable(pdata->reg_imu);
|
||||||
devm_regulator_put(pdata->reg_imu);
|
if (pdata->reg_dmic)
|
||||||
}
|
regulator_disable(pdata->reg_dmic);
|
||||||
gpio_free(pdata->ndi_5v_en);
|
|
||||||
pdata->initDone = false;
|
pdata->initDone = false;
|
||||||
}
|
}
|
||||||
pr_debug("%s initDone:%d\n", __func__, pdata->initDone);
|
pr_debug("%s initDone:%d\n", __func__, pdata->initDone);
|
||||||
|
@ -82,7 +74,7 @@ static int qxr_stdalonevwr_probe(struct platform_device *pdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
pdata->pdev = pdev;
|
pdata->pdev = pdev;
|
||||||
pdata->ndi_5v_en = 1237;
|
/*pdata->ndi_5v_en = 1237;*/
|
||||||
pdata->initDone = false;
|
pdata->initDone = false;
|
||||||
qxr_stdalonevwr_allocate_res();
|
qxr_stdalonevwr_allocate_res();
|
||||||
pr_info("%s done\n", __func__);
|
pr_info("%s done\n", __func__);
|
||||||
|
|
Loading…
Reference in a new issue