mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
asoc: tegra-alt:t210: add dap-io regulator support
This change is for adding dap-io regulator support for i2s devices through device tree. Change-Id: Ie34a61459c3ff282835a9ae3b1d49e13194da33a Signed-off-by: Dara Ramesh <dramesh@nvidia.com> Reviewed-on: http://git-master/r/448787 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
This commit is contained in:
committed by
Sameer Pujar
parent
4f1f08d562
commit
62ef54a3a3
@@ -29,6 +29,7 @@
|
|||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/pinctrl/consumer.h>
|
#include <linux/pinctrl/consumer.h>
|
||||||
|
#include <linux/regulator/consumer.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
|
|
||||||
@@ -90,6 +91,13 @@ static int tegra210_i2s_runtime_suspend(struct device *dev)
|
|||||||
dev_err(dev, "setting dap pinctrl idle state failed\n");
|
dev_err(dev, "setting dap pinctrl idle state failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i2s->num_supplies > 0) {
|
||||||
|
ret = regulator_bulk_disable(i2s->num_supplies,
|
||||||
|
i2s->supplies);
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(dev, "failed to disable i2s io regulator\n");
|
||||||
|
}
|
||||||
|
|
||||||
regcache_cache_only(i2s->regmap, true);
|
regcache_cache_only(i2s->regmap, true);
|
||||||
clk_disable_unprepare(i2s->clk_i2s);
|
clk_disable_unprepare(i2s->clk_i2s);
|
||||||
|
|
||||||
@@ -108,6 +116,13 @@ static int tegra210_i2s_runtime_resume(struct device *dev)
|
|||||||
dev_err(dev, "setting dap pinctrl default state failed\n");
|
dev_err(dev, "setting dap pinctrl default state failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i2s->num_supplies > 0) {
|
||||||
|
ret = regulator_bulk_enable(i2s->num_supplies,
|
||||||
|
i2s->supplies);
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(dev, "failed to enable i2s io regulator\n");
|
||||||
|
}
|
||||||
|
|
||||||
ret = clk_prepare_enable(i2s->clk_i2s);
|
ret = clk_prepare_enable(i2s->clk_i2s);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "clk_enable failed: %d\n", ret);
|
dev_err(dev, "clk_enable failed: %d\n", ret);
|
||||||
@@ -528,12 +543,15 @@ static const struct of_device_id tegra210_i2s_of_match[] = {
|
|||||||
|
|
||||||
static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
const struct of_device_id *match;
|
||||||
|
struct device_node *np = pdev->dev.of_node;
|
||||||
|
struct tegra210_i2s_soc_data *soc_data;
|
||||||
struct tegra210_i2s *i2s;
|
struct tegra210_i2s *i2s;
|
||||||
struct resource *mem, *memregion;
|
struct resource *mem, *memregion;
|
||||||
|
struct property *prop;
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
int ret = 0;
|
int ret = 0, count = 0, num_supplies;
|
||||||
const struct of_device_id *match;
|
const char *supply;
|
||||||
struct tegra210_i2s_soc_data *soc_data;
|
|
||||||
|
|
||||||
match = of_match_device(tegra210_i2s_of_match, &pdev->dev);
|
match = of_match_device(tegra210_i2s_of_match, &pdev->dev);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
@@ -609,8 +627,7 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
regcache_cache_only(i2s->regmap, true);
|
regcache_cache_only(i2s->regmap, true);
|
||||||
|
|
||||||
if (of_property_read_u32(pdev->dev.of_node,
|
if (of_property_read_u32(np, "nvidia,ahub-i2s-id",
|
||||||
"nvidia,ahub-i2s-id",
|
|
||||||
&pdev->dev.id) < 0) {
|
&pdev->dev.id) < 0) {
|
||||||
dev_err(&pdev->dev,
|
dev_err(&pdev->dev,
|
||||||
"Missing property nvidia,ahub-i2s-id\n");
|
"Missing property nvidia,ahub-i2s-id\n");
|
||||||
@@ -618,6 +635,21 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
|||||||
goto err_pll_a_out0_clk_put;
|
goto err_pll_a_out0_clk_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
num_supplies = of_property_count_strings(np, "regulator-supplies");
|
||||||
|
if (num_supplies > 0) {
|
||||||
|
i2s->num_supplies = num_supplies;
|
||||||
|
i2s->supplies = devm_kzalloc(&pdev->dev, num_supplies *
|
||||||
|
sizeof(*i2s->supplies), GFP_KERNEL);
|
||||||
|
if (!i2s->supplies) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto err_pll_a_out0_clk_put;
|
||||||
|
}
|
||||||
|
of_property_for_each_string(np, "regulator-supplies",
|
||||||
|
prop, supply)
|
||||||
|
i2s->supplies[count++].supply = supply;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
i2s->pinctrl = devm_pinctrl_get(&pdev->dev);
|
i2s->pinctrl = devm_pinctrl_get(&pdev->dev);
|
||||||
if (IS_ERR(i2s->pinctrl)) {
|
if (IS_ERR(i2s->pinctrl)) {
|
||||||
dev_warn(&pdev->dev, "Missing pinctrl device\n");
|
dev_warn(&pdev->dev, "Missing pinctrl device\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user