ASoC: tegra-alt: support dynamic prod settings

Add driver support for DSPK/DMIC/I2S for dynamic prod
settings.

Bug 200388806

Change-Id: I0c7d77a36a7c5d213b707321605cbe41d5b182d9
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1691746
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Mohan Kumar
2018-04-10 09:44:22 +05:30
committed by Sameer Pujar
parent 6451c05c89
commit e0b1e0193b
6 changed files with 40 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
/*
* tegra186_dspk_alt.h - Definitions for Tegra186 DSPK driver
*
* Copyright (c) 2015-2017 NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2015-2018 NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -186,6 +186,7 @@ struct tegra186_dspk {
struct pinctrl *pinctrl;
struct pinctrl_state *pin_active_state;
struct pinctrl_state *pin_idle_state;
const char *prod_name;
unsigned int rx_fifo_th; /* threshold in terms of frames */
unsigned int osr_val; /* osr value */
bool is_shutdown;

View File

@@ -129,6 +129,7 @@ struct tegra210_dmic {
struct pinctrl *pinctrl;
struct pinctrl_state *pin_active_state;
struct pinctrl_state *pin_idle_state;
const char *prod_name;
int boost_gain; /* with 100x factor */
int ch_select;
int tx_mono_to_stereo;

View File

@@ -218,6 +218,7 @@ struct tegra210_i2s {
struct pinctrl *pinctrl;
struct pinctrl_state *pin_default_state;
struct pinctrl_state *pin_idle_state;
const char *prod_name;
struct regulator_bulk_data *supplies;
struct notifier_block slgc_notifier;
int num_supplies;

View File

@@ -118,6 +118,13 @@ static int tegra186_dspk_runtime_resume(struct device *dev)
struct tegra186_dspk *dspk = dev_get_drvdata(dev);
int ret;
if (dspk->prod_name) {
ret = tegra_pinctrl_config_prod(dev, dspk->prod_name);
if (ret < 0)
dev_warn(dev, "Failed to set %s setting\n",
dspk->prod_name);
}
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
if (!IS_ERR(dspk->pin_active_state) && dspk->is_pinctrl) {
ret = pinctrl_select_state(dspk->pinctrl,
@@ -461,7 +468,6 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
int ret = 0;
const struct of_device_id *match;
struct tegra186_dspk_soc_data *soc_data;
const char *prod_name;
match = of_match_device(tegra186_dspk_of_match, &pdev->dev);
if (!match) {
@@ -481,6 +487,7 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
dspk->soc_data = soc_data;
dspk->is_shutdown = false;
dspk->prod_name = NULL;
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
dspk->clk_dspk = devm_clk_get(&pdev->dev, NULL);
@@ -558,11 +565,11 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
goto err_suspend;
}
if (of_property_read_string(np, "prod-name", &prod_name) == 0) {
ret = tegra_pinctrl_config_prod(&pdev->dev, prod_name);
if (of_property_read_string(np, "prod-name", &dspk->prod_name) == 0) {
ret = tegra_pinctrl_config_prod(&pdev->dev, dspk->prod_name);
if (ret < 0)
dev_warn(&pdev->dev, "Failed to set %s setting\n",
prod_name);
dspk->prod_name);
}
if (of_property_read_u32(np, "nvidia,is-pinctrl",

View File

@@ -100,6 +100,13 @@ static int tegra210_dmic_runtime_resume(struct device *dev)
struct tegra210_dmic *dmic = dev_get_drvdata(dev);
int ret;
if (dmic->prod_name) {
ret = tegra_pinctrl_config_prod(dev, dmic->prod_name);
if (ret < 0)
dev_warn(dev, "Failed to set %s setting\n",
dmic->prod_name);
}
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
if (!IS_ERR(dmic->pin_active_state) && dmic->is_pinctrl) {
ret = pinctrl_select_state(dmic->pinctrl,
@@ -116,6 +123,7 @@ static int tegra210_dmic_runtime_resume(struct device *dev)
}
}
regcache_cache_only(dmic->regmap, false);
if (!dmic->is_shutdown)
@@ -654,7 +662,6 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
int ret = 0;
const struct of_device_id *match;
struct tegra210_dmic_soc_data *soc_data;
const char *prod_name;
match = of_match_device(tegra210_dmic_of_match, &pdev->dev);
if (!match) {
@@ -673,6 +680,7 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
dmic->soc_data = soc_data;
dmic->is_shutdown = false;
dmic->prod_name = NULL;
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
dmic->clk_dmic = devm_clk_get(&pdev->dev, NULL);
@@ -756,11 +764,11 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
goto err_suspend;
}
if (of_property_read_string(np, "prod-name", &prod_name) == 0) {
ret = tegra_pinctrl_config_prod(&pdev->dev, prod_name);
if (of_property_read_string(np, "prod-name", &dmic->prod_name) == 0) {
ret = tegra_pinctrl_config_prod(&pdev->dev, dmic->prod_name);
if (ret < 0)
dev_warn(&pdev->dev, "Failed to set %s setting\n",
prod_name);
dmic->prod_name);
}
if (of_property_read_u32(np, "nvidia,is-pinctrl",

View File

@@ -260,6 +260,13 @@ static int tegra210_i2s_runtime_resume(struct device *dev)
int ret;
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
if (i2s->prod_name) {
ret = tegra_pinctrl_config_prod(dev, i2s->prod_name);
if (ret < 0)
dev_warn(dev, "Failed to set %s setting\n",
i2s->prod_name);
}
if (!IS_ERR(i2s->pin_default_state)) {
ret = pinctrl_select_state(i2s->pinctrl,
i2s->pin_default_state);
@@ -281,8 +288,8 @@ static int tegra210_i2s_runtime_resume(struct device *dev)
}
}
regcache_cache_only(i2s->regmap, false);
regcache_cache_only(i2s->regmap, false);
if (!i2s->is_shutdown)
regcache_sync(i2s->regmap);
@@ -1074,7 +1081,7 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
struct property *prop;
void __iomem *regs;
int ret = 0, count = 0, num_supplies;
const char *supply, *prod_name;
const char *supply;
int partition_id = 0;
match = of_match_device(tegra210_i2s_of_match, &pdev->dev);
@@ -1098,6 +1105,7 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
i2s->enable_cya = false;
i2s->loopback = 0;
i2s->is_shutdown = false;
i2s->prod_name = NULL;
if (i2s->soc_data->is_soc_t210) {
#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
@@ -1201,8 +1209,9 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
"enable-cya");
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
if (of_property_read_string(np, "prod-name", &prod_name) == 0)
tegra_pinctrl_config_prod(&pdev->dev, prod_name);
if (of_property_read_string(np, "prod-name",
&i2s->prod_name) == 0)
tegra_pinctrl_config_prod(&pdev->dev, i2s->prod_name);
num_supplies =
of_property_count_strings(np, "regulator-supplies");