mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
ASoC: tegra-alt: probe() cleanup for AHUB modules
Cleanup probe() functions for AHUB module drivers and following is the summary of changes. This helps later in upstream too. * avoid unnecessary goto labels by updating return paths * removed following unused header files wherever applicable. linux/pinctrl/consumer.h linux/version.h linux/debugfs.h linux/slab.h * redundant pm_runtime_get/put removed in tegra186_xbar_registration() * Redundant error print during memory allocation failure is removed * runtime PM is enabled as late as possible and before the codec registration is done. * explicit calls to runtime_resume/suspend is avoided in probe(). For upstream, PM is enforced and the same can be done in downstream too. Hence no need to handle !PM case in driver probe() Ref: http://patchwork.ozlabs.org/patch/1048746/ * IS_ERR() check is sufficient for error handling in case of devm_clk_get(). Bug 200520821 Bug 200503387 Change-Id: Ie4192036e72db161fa7d8ff4c6c0b28c17635793 Signed-off-by: Sameer Pujar <spujar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2153956 Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/version.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/jack.h>
|
||||
#include <sound/pcm.h>
|
||||
|
||||
@@ -24,15 +24,12 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/tegra186_ahc.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "tegra186_asrc_alt.h"
|
||||
#include "tegra186_arad_alt.h"
|
||||
@@ -753,17 +750,12 @@ static int tegra186_arad_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra186_arad_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
arad = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct tegra186_arad), GFP_KERNEL);
|
||||
if (!arad) {
|
||||
dev_err(&pdev->dev, "Can't allocate tegra210_arad\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
arad = devm_kzalloc(&pdev->dev, sizeof(*arad), GFP_KERNEL);
|
||||
if (!arad)
|
||||
return -ENOMEM;
|
||||
|
||||
arad_dev = &pdev->dev;
|
||||
dev_set_drvdata(&pdev->dev, arad);
|
||||
@@ -780,13 +772,11 @@ static int tegra186_arad_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(arad->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-arad-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-arad-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
ret = of_property_read_u32(pdev->dev.of_node, "nvidia,ahub-arad-id",
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-arad-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
@@ -796,7 +786,8 @@ static int tegra186_arad_platform_probe(struct platform_device *pdev)
|
||||
ARRAY_SIZE(tegra186_arad_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SND_SOC_TEGRA186_ARAD_WAR
|
||||
@@ -808,14 +799,8 @@ static int tegra186_arad_platform_probe(struct platform_device *pdev)
|
||||
TEGRA186_AHC_ARAD1_CB, &pdev->dev);
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra186_arad_runtime_suspend(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra186_arad_platform_remove(struct platform_device *pdev)
|
||||
|
||||
@@ -23,16 +23,13 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/tegra186_ahc.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "tegra210_xbar_alt.h"
|
||||
#include "tegra186_asrc_alt.h"
|
||||
@@ -1094,17 +1091,12 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra186_asrc_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
asrc_dev = &pdev->dev;
|
||||
asrc = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct tegra186_asrc), GFP_KERNEL);
|
||||
if (!asrc) {
|
||||
dev_err(&pdev->dev, "Can't allocate asrc\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
asrc = devm_kzalloc(&pdev->dev, sizeof(*asrc), GFP_KERNEL);
|
||||
if (!asrc)
|
||||
return -ENOMEM;
|
||||
|
||||
asrc->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, asrc);
|
||||
@@ -1121,27 +1113,18 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(asrc->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-asrc-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-asrc-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
ret = of_property_read_u32(pdev->dev.of_node, "nvidia,ahub-asrc-id",
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-asrc-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TEGRA186_AHC
|
||||
tegra186_ahc_register_cb(tegra186_asrc_ahc_cb,
|
||||
TEGRA186_AHC_ASRC1_CB, &pdev->dev);
|
||||
tegra186_ahc_register_cb(tegra186_asrc_ahc_cb, TEGRA186_AHC_ASRC1_CB,
|
||||
&pdev->dev);
|
||||
#endif
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra186_asrc_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
regmap_write(asrc->regmap, TEGRA186_ASRC_GLOBAL_CONFIG,
|
||||
TEGRA186_ASRC_GLOBAL_CONFIG_FRAC_32BIT_PRECISION);
|
||||
|
||||
@@ -1159,23 +1142,17 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
|
||||
ASRC_STREAM_REG(TEGRA186_ASRC_STREAM1_CONFIG, i), 1, 1);
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra186_asrc_codec,
|
||||
tegra186_asrc_dais,
|
||||
ARRAY_SIZE(tegra186_asrc_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra186_asrc_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra186_asrc_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -23,16 +23,13 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <soc/tegra/chip-id.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/pinctrl/pinconf-tegra.h>
|
||||
|
||||
#include "tegra210_xbar_alt.h"
|
||||
@@ -455,42 +452,36 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra186_dspk_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
dspk = devm_kzalloc(&pdev->dev, sizeof(struct tegra186_dspk),
|
||||
GFP_KERNEL);
|
||||
if (!dspk) {
|
||||
dev_err(&pdev->dev, "Can't allocate dspk\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
dspk = devm_kzalloc(&pdev->dev, sizeof(*dspk), GFP_KERNEL);
|
||||
if (!dspk)
|
||||
return -ENOMEM;
|
||||
|
||||
dspk->is_shutdown = false;
|
||||
dspk->prod_name = NULL;
|
||||
dspk->rx_fifo_th = 0;
|
||||
dspk->osr_val = TEGRA186_DSPK_OSR_64;
|
||||
dev_set_drvdata(&pdev->dev, dspk);
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
dspk->clk_dspk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(dspk->clk_dspk)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve dspk clock\n");
|
||||
ret = PTR_ERR(dspk->clk_dspk);
|
||||
goto err;
|
||||
return PTR_ERR(dspk->clk_dspk);
|
||||
}
|
||||
|
||||
dspk->clk_pll_a_out0 = devm_clk_get(&pdev->dev, "pll_a_out0");
|
||||
if (IS_ERR_OR_NULL(dspk->clk_pll_a_out0)) {
|
||||
if (IS_ERR(dspk->clk_pll_a_out0)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve pll_a_out0 clock\n");
|
||||
ret = -ENOENT;
|
||||
goto err;
|
||||
return PTR_ERR(dspk->clk_pll_a_out0);
|
||||
}
|
||||
|
||||
ret = clk_set_parent(dspk->clk_dspk, dspk->clk_pll_a_out0);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Can't set parent of dspk clock\n");
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,27 +497,21 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(dspk->regmap, true);
|
||||
|
||||
if (of_property_read_u32(np, "nvidia,ahub-dspk-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-dspk-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
ret = of_property_read_u32(np, "nvidia,ahub-dspk-id",
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-dspk-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra186_dspk_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra186_dspk_codec,
|
||||
tegra186_dspk_dais,
|
||||
ARRAY_SIZE(tegra186_dspk_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (of_property_read_string(np, "prod-name", &dspk->prod_name) == 0) {
|
||||
@@ -551,23 +536,11 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
|
||||
|
||||
dspk->pin_idle_state = pinctrl_lookup_state(dspk->pinctrl,
|
||||
"dap_inactive");
|
||||
if (IS_ERR(dspk->pin_idle_state)) {
|
||||
if (IS_ERR(dspk->pin_idle_state))
|
||||
dev_dbg(&pdev->dev, "Missing dap-inactive state\n");
|
||||
goto err_dap;
|
||||
}
|
||||
|
||||
err_dap:
|
||||
dev_set_drvdata(&pdev->dev, dspk);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra186_dspk_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra186_dspk_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/clk/tegra.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/pcm_params.h>
|
||||
@@ -33,7 +32,6 @@
|
||||
#include "tegra_pcm_alt.h"
|
||||
#include "tegra210_xbar_alt.h"
|
||||
#include "tegra_isomgr_bw_alt.h"
|
||||
|
||||
#include "tegra210_admaif_alt.h"
|
||||
|
||||
#define DRV_NAME "tegra210-ape-admaif"
|
||||
@@ -1130,9 +1128,7 @@ static const struct of_device_id tegra_admaif_of_match[] = {
|
||||
|
||||
static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
{
|
||||
int i;
|
||||
|
||||
int ret;
|
||||
int ret, i;
|
||||
struct tegra_admaif *admaif;
|
||||
void __iomem *regs;
|
||||
struct resource *res;
|
||||
@@ -1146,11 +1142,8 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
admaif = devm_kzalloc(&pdev->dev, sizeof(*admaif), GFP_KERNEL);
|
||||
if (!admaif) {
|
||||
dev_err(&pdev->dev, "Can't allocate tegra_admaif\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
if (!admaif)
|
||||
return -ENOMEM;
|
||||
|
||||
admaif->dev = &pdev->dev;
|
||||
admaif->soc_data = (struct tegra_admaif_soc_data *)match->data;
|
||||
@@ -1161,48 +1154,33 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
sizeof(struct tegra_alt_pcm_dma_params) *
|
||||
admaif->soc_data->num_ch,
|
||||
GFP_KERNEL);
|
||||
if (!admaif->capture_dma_data) {
|
||||
dev_err(&pdev->dev, "Can't allocate capture_dma_data\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
if (!admaif->capture_dma_data)
|
||||
return -ENOMEM;
|
||||
|
||||
admaif->playback_dma_data = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct tegra_alt_pcm_dma_params) *
|
||||
admaif->soc_data->num_ch,
|
||||
GFP_KERNEL);
|
||||
if (!admaif->playback_dma_data) {
|
||||
dev_err(&pdev->dev, "Can't allocate playback_dma_data\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
if (!admaif->playback_dma_data)
|
||||
return -ENOMEM;
|
||||
|
||||
admaif->override_channels = devm_kzalloc(&pdev->dev,
|
||||
sizeof(int) * admaif->soc_data->num_ch,
|
||||
GFP_KERNEL);
|
||||
if (!admaif->override_channels) {
|
||||
dev_err(&pdev->dev, "Can't allocate override channel memory\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
if (!admaif->override_channels)
|
||||
return -ENOMEM;
|
||||
|
||||
admaif->tx_mono_to_stereo = devm_kzalloc(&pdev->dev,
|
||||
sizeof(int) * admaif->soc_data->num_ch,
|
||||
GFP_KERNEL);
|
||||
if (!admaif->tx_mono_to_stereo) {
|
||||
dev_err(&pdev->dev, "Can't allocate override channel memory\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
if (!admaif->tx_mono_to_stereo)
|
||||
return -ENOMEM;
|
||||
|
||||
admaif->rx_stereo_to_mono = devm_kzalloc(&pdev->dev,
|
||||
sizeof(int) * admaif->soc_data->num_ch,
|
||||
GFP_KERNEL);
|
||||
if (!admaif->rx_stereo_to_mono) {
|
||||
dev_err(&pdev->dev, "Can't allocate override channel memory\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
if (!admaif->rx_stereo_to_mono)
|
||||
return -ENOMEM;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
@@ -1217,13 +1195,6 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(admaif->regmap, true);
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra_admaif_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
if (admaif->soc_data->is_isomgr_client)
|
||||
tegra_isomgr_adma_register();
|
||||
|
||||
@@ -1239,14 +1210,14 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
|
||||
admaif->playback_dma_data[i].width = 32;
|
||||
admaif->playback_dma_data[i].req_sel = i + 1;
|
||||
if (of_property_read_string_index(pdev->dev.of_node,
|
||||
ret = of_property_read_string_index(pdev->dev.of_node,
|
||||
"dma-names",
|
||||
(i * 2) + 1,
|
||||
&admaif->playback_dma_data[i].chan_name) < 0) {
|
||||
&admaif->playback_dma_data[i].chan_name);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,dma-names\n");
|
||||
ret = -ENODEV;
|
||||
goto err_suspend;
|
||||
return ret;
|
||||
}
|
||||
buffer_size = 0;
|
||||
if (of_property_read_u32_index(pdev->dev.of_node,
|
||||
@@ -1260,14 +1231,14 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
|
||||
admaif->capture_dma_data[i].width = 32;
|
||||
admaif->capture_dma_data[i].req_sel = i + 1;
|
||||
if (of_property_read_string_index(pdev->dev.of_node,
|
||||
ret = of_property_read_string_index(pdev->dev.of_node,
|
||||
"dma-names",
|
||||
(i * 2),
|
||||
&admaif->capture_dma_data[i].chan_name) < 0) {
|
||||
&admaif->capture_dma_data[i].chan_name);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,dma-names\n");
|
||||
ret = -ENODEV;
|
||||
goto err_suspend;
|
||||
return ret;
|
||||
}
|
||||
buffer_size = 0;
|
||||
if (of_property_read_u32_index(pdev->dev.of_node,
|
||||
@@ -1280,46 +1251,41 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
admaif->capture_dma_data[i].buffer_size = buffer_size;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_component(&pdev->dev,
|
||||
regmap_update_bits(admaif->regmap, admaif->soc_data->global_base +
|
||||
TEGRA_ADMAIF_GLOBAL_ENABLE, 1, 1);
|
||||
|
||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||
&tegra_admaif_dai_driver,
|
||||
tegra_admaif_dais,
|
||||
admaif->soc_data->num_ch);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Could not register DAIs %d: %d\n",
|
||||
i, ret);
|
||||
ret = -ENOMEM;
|
||||
goto err_suspend;
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
ret = snd_soc_register_codec(&pdev->dev, admaif->soc_data->admaif_codec,
|
||||
admaif->soc_data->codec_dais,
|
||||
admaif->soc_data->num_ch * 2);
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_unregister_dais;
|
||||
goto pm_disable;
|
||||
}
|
||||
|
||||
ret = tegra_alt_pcm_platform_register(&pdev->dev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
|
||||
goto err_unregister_codec;
|
||||
goto unregister_codec;
|
||||
}
|
||||
|
||||
regmap_update_bits(admaif->regmap, admaif->soc_data->global_base +
|
||||
TEGRA_ADMAIF_GLOBAL_ENABLE, 1, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
err_unregister_codec:
|
||||
unregister_codec:
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
err_unregister_dais:
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra_admaif_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <soc/tegra/chip-id.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
@@ -805,16 +804,12 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_adx_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
adx = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_adx), GFP_KERNEL);
|
||||
if (!adx) {
|
||||
dev_err(&pdev->dev, "Can't allocate tegra210_adx\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
adx = devm_kzalloc(&pdev->dev, sizeof(*adx), GFP_KERNEL);
|
||||
if (!adx)
|
||||
return -ENOMEM;
|
||||
|
||||
adx->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, adx);
|
||||
@@ -831,39 +826,25 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(adx->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-adx-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-adx-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-adx-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_adx_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_adx_codec,
|
||||
tegra210_adx_dais,
|
||||
ARRAY_SIZE(tegra210_adx_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_adx_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra210_adx_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -24,12 +24,10 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
|
||||
#include "tegra210_xbar_alt.h"
|
||||
@@ -521,17 +519,13 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_afc_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
soc_data = (struct tegra210_afc_soc_data *)match->data;
|
||||
|
||||
afc = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_afc), GFP_KERNEL);
|
||||
if (!afc) {
|
||||
dev_err(&pdev->dev, "Can't allocate afc\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
afc = devm_kzalloc(&pdev->dev, sizeof(*afc), GFP_KERNEL);
|
||||
if (!afc)
|
||||
return -ENOMEM;
|
||||
|
||||
afc->soc_data = soc_data;
|
||||
tegra210_afc_init(afc);
|
||||
@@ -550,42 +544,28 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(afc->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-afc-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-afc-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_afc_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-afc-id\n");
|
||||
return -ret;
|
||||
}
|
||||
|
||||
/* Disable SLGC */
|
||||
regmap_write(afc->regmap, TEGRA210_AFC_CG, 0);
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
ret = snd_soc_register_codec(&pdev->dev, afc->soc_data->afc_codec,
|
||||
tegra210_afc_dais,
|
||||
ARRAY_SIZE(tegra210_afc_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_afc_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra210_afc_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <soc/tegra/chip-id.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
@@ -886,17 +885,13 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_amx_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
soc_data = (struct tegra210_amx_soc_data *)match->data;
|
||||
|
||||
amx = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_amx), GFP_KERNEL);
|
||||
if (!amx) {
|
||||
dev_err(&pdev->dev, "Can't allocate tegra210_amx\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
amx = devm_kzalloc(&pdev->dev, sizeof(*amx), GFP_KERNEL);
|
||||
if (!amx)
|
||||
return -ENOMEM;
|
||||
|
||||
amx->soc_data = soc_data;
|
||||
amx->is_shutdown = false;
|
||||
@@ -916,46 +911,31 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(amx->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-amx-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-amx-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-amx-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* following is necessary to have the required codec-dai-name */
|
||||
if (dev_set_name(&pdev->dev, "%s.%d", DRV_NAME, pdev->dev.id)) {
|
||||
dev_err(&pdev->dev, "error in setting AMX dev name\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_amx_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_amx_codec,
|
||||
tegra210_amx_dais,
|
||||
ARRAY_SIZE(tegra210_amx_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_amx_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra210_amx_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -568,16 +568,12 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_dmic_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
dmic = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_dmic), GFP_KERNEL);
|
||||
if (!dmic) {
|
||||
dev_err(&pdev->dev, "Can't allocate dmic\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
dmic = devm_kzalloc(&pdev->dev, sizeof(*dmic), GFP_KERNEL);
|
||||
if (!dmic)
|
||||
return -ENOMEM;
|
||||
|
||||
dmic->is_shutdown = false;
|
||||
dmic->prod_name = NULL;
|
||||
@@ -587,23 +583,21 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
dmic->clk_dmic = devm_clk_get(&pdev->dev, "dmic");
|
||||
if (IS_ERR_OR_NULL(dmic->clk_dmic)) {
|
||||
if (IS_ERR(dmic->clk_dmic)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve dmic clock\n");
|
||||
ret = PTR_ERR(dmic->clk_dmic);
|
||||
goto err;
|
||||
return PTR_ERR(dmic->clk_dmic);
|
||||
}
|
||||
|
||||
dmic->clk_parent = devm_clk_get(&pdev->dev, "parent");
|
||||
if (IS_ERR_OR_NULL(dmic->clk_parent)) {
|
||||
if (IS_ERR(dmic->clk_parent)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve parent clock\n");
|
||||
ret = PTR_ERR(dmic->clk_parent);
|
||||
goto err;
|
||||
return PTR_ERR(dmic->clk_parent);
|
||||
}
|
||||
|
||||
ret = clk_set_parent(dmic->clk_dmic, dmic->clk_parent);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Can't set parent of dmic clock\n");
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,27 +617,21 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
|
||||
regmap_write(dmic->regmap, TEGRA210_DMIC_DCR_BIQUAD_0_COEF_4,
|
||||
0x00000000);
|
||||
|
||||
if (of_property_read_u32(np, "nvidia,ahub-dmic-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-dmic-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
ret = of_property_read_u32(np, "nvidia,ahub-dmic-id",
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-dmic-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_dmic_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_dmic_codec,
|
||||
tegra210_dmic_dais,
|
||||
ARRAY_SIZE(tegra210_dmic_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (of_property_read_string(np, "prod-name", &dmic->prod_name) == 0) {
|
||||
@@ -674,15 +662,8 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
err_dap:
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_dmic_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tegra210_dmic_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
@@ -35,7 +34,6 @@
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/tegra-powergate.h>
|
||||
#include <soc/tegra/chip-id.h>
|
||||
#include <linux/pm_domain.h>
|
||||
@@ -1068,16 +1066,12 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_i2s_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_i2s), GFP_KERNEL);
|
||||
if (!i2s) {
|
||||
dev_err(&pdev->dev, "Can't allocate i2s\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
|
||||
if (!i2s)
|
||||
return -ENOMEM;
|
||||
|
||||
i2s->tx_mask = i2s->rx_mask = 0xFFFF;
|
||||
i2s->enable_cya = false;
|
||||
@@ -1092,8 +1086,7 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||
i2s->clk_i2s = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(i2s->clk_i2s)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve i2s clock\n");
|
||||
ret = PTR_ERR(i2s->clk_i2s);
|
||||
goto err;
|
||||
return PTR_ERR(i2s->clk_i2s);
|
||||
}
|
||||
|
||||
i2s->clk_i2s_sync = devm_clk_get(&pdev->dev, "ext_audio_sync");
|
||||
@@ -1107,8 +1100,7 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||
i2s->clk_i2s_source = devm_clk_get(&pdev->dev, "i2s_clk_parent");
|
||||
if (IS_ERR(i2s->clk_i2s_source)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve pll_a_out0 clock\n");
|
||||
ret = PTR_ERR(i2s->clk_i2s_source);
|
||||
goto err;
|
||||
return PTR_ERR(i2s->clk_i2s_source);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1124,12 +1116,11 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(i2s->regmap, true);
|
||||
|
||||
if (of_property_read_u32(np, "nvidia,ahub-i2s-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-i2s-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
ret = of_property_read_u32(np, "nvidia,ahub-i2s-id",
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-i2s-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node, "bclk-ratio",
|
||||
@@ -1152,8 +1143,7 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||
i2s->fsync_width = 31;
|
||||
}
|
||||
|
||||
i2s->enable_cya =
|
||||
of_property_read_bool(pdev->dev.of_node,
|
||||
i2s->enable_cya = of_property_read_bool(pdev->dev.of_node,
|
||||
"enable-cya");
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
@@ -1161,22 +1151,22 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||
&i2s->prod_name) == 0)
|
||||
tegra_pinctrl_config_prod(&pdev->dev, i2s->prod_name);
|
||||
|
||||
num_supplies =
|
||||
of_property_count_strings(np, "regulator-supplies");
|
||||
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;
|
||||
}
|
||||
of_property_for_each_string(np,
|
||||
"regulator-supplies", prop, supply)
|
||||
sizeof(*i2s->supplies),
|
||||
GFP_KERNEL);
|
||||
if (!i2s->supplies)
|
||||
return -ENOMEM;
|
||||
|
||||
of_property_for_each_string(np, "regulator-supplies",
|
||||
prop, supply)
|
||||
i2s->supplies[count++].supply = supply;
|
||||
|
||||
ret = devm_regulator_bulk_get(
|
||||
&pdev->dev, i2s->num_supplies,
|
||||
ret = devm_regulator_bulk_get(&pdev->dev,
|
||||
i2s->num_supplies,
|
||||
i2s->supplies);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
@@ -1206,31 +1196,19 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
err_dap:
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_i2s_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_i2s_codec,
|
||||
tegra210_i2s_dais,
|
||||
ARRAY_SIZE(tegra210_i2s_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_i2s_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra210_i2s_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -23,14 +23,11 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/tegra-soc.h>
|
||||
|
||||
#include "tegra210_xbar_alt.h"
|
||||
@@ -300,16 +297,12 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_iqc_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
iqc = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_iqc), GFP_KERNEL);
|
||||
if (!iqc) {
|
||||
dev_err(&pdev->dev, "Can't allocate iqc\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
iqc = devm_kzalloc(&pdev->dev, sizeof(*iqc), GFP_KERNEL);
|
||||
if (!iqc)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_set_drvdata(&pdev->dev, iqc);
|
||||
|
||||
@@ -317,8 +310,7 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
||||
iqc->clk_iqc = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(iqc->clk_iqc)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve iqc clock\n");
|
||||
ret = PTR_ERR(iqc->clk_iqc);
|
||||
goto err;
|
||||
return PTR_ERR(iqc->clk_iqc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,19 +326,18 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(iqc->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-iqc-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-iqc-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-iqc-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
"timestamp-enable",
|
||||
&iqc->timestamp_enable) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
dev_dbg(&pdev->dev,
|
||||
"Missing property timestamp-enable for IQC\n");
|
||||
iqc->timestamp_enable = 1;
|
||||
}
|
||||
@@ -354,35 +345,22 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
"data-offset",
|
||||
&iqc->data_offset) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
dev_dbg(&pdev->dev,
|
||||
"Missing property data-offset for IQC\n");
|
||||
iqc->data_offset = 0;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_iqc_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_iqc_codec,
|
||||
tegra210_iqc_dais,
|
||||
ARRAY_SIZE(tegra210_iqc_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_iqc_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int tegra210_iqc_platform_remove(struct platform_device *pdev)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
@@ -688,17 +687,12 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_mixer_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
mixer = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct tegra210_mixer), GFP_KERNEL);
|
||||
if (!mixer) {
|
||||
dev_err(&pdev->dev, "Can't allocate tegra210_mixer\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
mixer = devm_kzalloc(&pdev->dev, sizeof(*mixer), GFP_KERNEL);
|
||||
if (!mixer)
|
||||
return -ENOMEM;
|
||||
|
||||
mixer->is_shutdown = false;
|
||||
mixer->gain_coeff[0] = 0;
|
||||
@@ -732,39 +726,25 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(mixer->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-amixer-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-amixer-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-amixer-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_mixer_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_mixer_codec,
|
||||
tegra210_mixer_dais,
|
||||
ARRAY_SIZE(tegra210_mixer_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_mixer_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra210_mixer_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -23,12 +23,10 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
@@ -627,16 +625,12 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_mvc_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
mvc = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_mvc), GFP_KERNEL);
|
||||
if (!mvc) {
|
||||
dev_err(&pdev->dev, "Can't allocate mvc\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
mvc = devm_kzalloc(&pdev->dev, sizeof(*mvc), GFP_KERNEL);
|
||||
if (!mvc)
|
||||
return -ENOMEM;
|
||||
|
||||
mvc->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, mvc);
|
||||
@@ -669,39 +663,25 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(mvc->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-mvc-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-mvc-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-mvc-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_mvc_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_mvc_codec,
|
||||
tegra210_mvc_dais,
|
||||
ARRAY_SIZE(tegra210_mvc_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_mvc_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra210_mvc_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -24,12 +24,10 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
|
||||
#include "tegra210_xbar_alt.h"
|
||||
@@ -326,16 +324,12 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_ope_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ope = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_ope), GFP_KERNEL);
|
||||
if (!ope) {
|
||||
dev_err(&pdev->dev, "Can't allocate ope\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
ope = devm_kzalloc(&pdev->dev, sizeof(*ope), GFP_KERNEL);
|
||||
if (!ope)
|
||||
return -ENOMEM;
|
||||
|
||||
ope->is_shutdown = false;
|
||||
|
||||
@@ -356,52 +350,38 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev)
|
||||
ret = tegra210_peq_init(pdev, TEGRA210_PEQ_IORESOURCE_MEM);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "peq init failed\n");
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
regcache_cache_only(ope->peq_regmap, true);
|
||||
|
||||
ret = tegra210_mbdrc_init(pdev, TEGRA210_MBDRC_IORESOURCE_MEM);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "mbdrc init failed\n");
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
regcache_cache_only(ope->mbdrc_regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-ope-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-ope-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-ope-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_ope_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_ope_codec,
|
||||
tegra210_ope_dais,
|
||||
ARRAY_SIZE(tegra210_ope_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pr_info("OPE platform probe successful\n");
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_ope_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra210_ope_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -24,12 +24,10 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
|
||||
#include "tegra210_xbar_alt.h"
|
||||
|
||||
@@ -23,12 +23,10 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
@@ -3555,16 +3553,12 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_sfc_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
sfc = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_sfc), GFP_KERNEL);
|
||||
if (!sfc) {
|
||||
dev_err(&pdev->dev, "Can't allocate sfc\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
sfc = devm_kzalloc(&pdev->dev, sizeof(*sfc), GFP_KERNEL);
|
||||
if (!sfc)
|
||||
return -ENOMEM;
|
||||
|
||||
sfc->is_shutdown = false;
|
||||
|
||||
@@ -3585,39 +3579,25 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(sfc->regmap, true);
|
||||
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
"nvidia,ahub-sfc-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-sfc-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-sfc-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_sfc_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_sfc_codec,
|
||||
tegra210_sfc_dais,
|
||||
ARRAY_SIZE(tegra210_sfc_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_sfc_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra210_sfc_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <soc/tegra/chip-id.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
@@ -424,17 +423,12 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra210_spdif_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
spdif = devm_kzalloc(&pdev->dev, sizeof(struct tegra210_spdif),
|
||||
GFP_KERNEL);
|
||||
if (!spdif) {
|
||||
dev_err(&pdev->dev, "Can't allocate tegra210_spdif\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
spdif = devm_kzalloc(&pdev->dev, sizeof(*spdif), GFP_KERNEL);
|
||||
if (!spdif)
|
||||
return -ENOMEM;
|
||||
|
||||
spdif->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, spdif);
|
||||
@@ -443,29 +437,25 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev)
|
||||
spdif->clk_pll_a_out0 = devm_clk_get(&pdev->dev, "pll_a_out0");
|
||||
if (IS_ERR(spdif->clk_pll_a_out0)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve pll_a_out0 clock\n");
|
||||
ret = PTR_ERR(spdif->clk_pll_a_out0);
|
||||
goto err;
|
||||
return PTR_ERR(spdif->clk_pll_a_out0);
|
||||
}
|
||||
|
||||
spdif->clk_pll_p_out0 = devm_clk_get(&pdev->dev, "pll_p_out0");
|
||||
if (IS_ERR(spdif->clk_pll_p_out0)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve pll_p_out0 clock\n");
|
||||
ret = PTR_ERR(spdif->clk_pll_p_out0);
|
||||
goto err;
|
||||
return PTR_ERR(spdif->clk_pll_p_out0);
|
||||
}
|
||||
|
||||
spdif->clk_spdif_out = devm_clk_get(&pdev->dev, "spdif_out");
|
||||
if (IS_ERR(spdif->clk_spdif_out)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve spdif clock\n");
|
||||
ret = PTR_ERR(spdif->clk_spdif_out);
|
||||
goto err;
|
||||
return PTR_ERR(spdif->clk_spdif_out);
|
||||
}
|
||||
|
||||
spdif->clk_spdif_in = devm_clk_get(&pdev->dev, "spdif_in");
|
||||
if (IS_ERR(spdif->clk_spdif_in)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve spdif clock\n");
|
||||
ret = PTR_ERR(spdif->clk_spdif_in);
|
||||
goto err;
|
||||
return PTR_ERR(spdif->clk_spdif_in);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,27 +471,21 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
regcache_cache_only(spdif->regmap, true);
|
||||
|
||||
if (of_property_read_u32(np, "nvidia,ahub-spdif-id",
|
||||
&pdev->dev.id) < 0) {
|
||||
dev_err(&pdev->dev,
|
||||
"Missing property nvidia,ahub-spdif-id\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
ret = of_property_read_u32(np, "nvidia,ahub-spdif-id",
|
||||
&pdev->dev.id);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Missing property nvidia,ahub-spdif-id\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra210_spdif_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_spdif_codec,
|
||||
tegra210_spdif_dais,
|
||||
ARRAY_SIZE(tegra210_spdif_dais));
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "Could not register CODEC: %d\n", ret);
|
||||
goto err_suspend;
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (of_property_read_string(np, "prod-name", &prod_name) == 0) {
|
||||
@@ -519,41 +503,32 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev)
|
||||
spdif->pinctrl = devm_pinctrl_get(&pdev->dev);
|
||||
if (IS_ERR(spdif->pinctrl)) {
|
||||
dev_warn(&pdev->dev, "Missing pinctrl device\n");
|
||||
goto err_dap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
spdif->pin_active_state = pinctrl_lookup_state(spdif->pinctrl,
|
||||
"dap_active");
|
||||
if (IS_ERR(spdif->pin_active_state)) {
|
||||
dev_dbg(&pdev->dev, "Missing dap-active state\n");
|
||||
goto err_dap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
spdif->pin_idle_state = pinctrl_lookup_state(spdif->pinctrl,
|
||||
"dap_inactive");
|
||||
if (IS_ERR(spdif->pin_idle_state)) {
|
||||
dev_dbg(&pdev->dev, "Missing dap-inactive state\n");
|
||||
goto err_dap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = pinctrl_select_state(spdif->pinctrl,
|
||||
spdif->pin_idle_state);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "setting state failed\n");
|
||||
goto err_dap;
|
||||
}
|
||||
}
|
||||
|
||||
err_dap:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra210_spdif_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tegra210_spdif_platform_shutdown(struct platform_device *pdev)
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/tegra_pm_domains.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <soc/tegra/chip-id.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/clk/tegra.h>
|
||||
@@ -1338,21 +1336,9 @@ static int tegra186_xbar_registration(struct platform_device *pdev)
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
ret = pm_runtime_get_sync(&pdev->dev);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "pm_runtime_get failed. ret: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
of_platform_populate(pdev->dev.of_node, NULL, tegra186_xbar_auxdata,
|
||||
&pdev->dev);
|
||||
|
||||
ret = pm_runtime_put_sync(&pdev->dev);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "pm_runtime_put failed. ret: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1388,26 +1374,21 @@ static int tegra_dev_xbar_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct of_device_id *match;
|
||||
struct tegra_xbar_soc_data *soc_data;
|
||||
int ret;
|
||||
|
||||
/* required to register the xbar codec with generic name */
|
||||
if (dev_set_name(&pdev->dev, "%s", DRV_NAME) < 0) {
|
||||
dev_err(&pdev->dev, "error in setting xbar device name\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
match = of_match_device(tegra_xbar_of_match, &pdev->dev);
|
||||
if (!match) {
|
||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
return -ENODEV;
|
||||
}
|
||||
soc_data = (struct tegra_xbar_soc_data *)match->data;
|
||||
|
||||
ret = tegra_xbar_probe(pdev, soc_data);
|
||||
err:
|
||||
return ret;
|
||||
return tegra_xbar_probe(pdev, soc_data);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops tegra_xbar_pm_ops = {
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/tegra_pm_domains.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <soc/tegra/chip-id.h>
|
||||
#include <sound/soc.h>
|
||||
#include <linux/clk/tegra.h>
|
||||
@@ -305,8 +303,6 @@ int tegra_xbar_remove(struct platform_device *pdev)
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra_xbar_runtime_suspend(&pdev->dev);
|
||||
|
||||
tegra_pd_remove_device(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_xbar_remove);
|
||||
@@ -320,11 +316,8 @@ int tegra_xbar_probe(struct platform_device *pdev,
|
||||
int ret;
|
||||
|
||||
xbar = devm_kzalloc(&pdev->dev, sizeof(*xbar), GFP_KERNEL);
|
||||
if (!xbar) {
|
||||
dev_err(&pdev->dev, "Can't allocate xbar\n");
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
if (!xbar)
|
||||
return -ENOMEM;
|
||||
|
||||
xbar->soc_data = soc_data;
|
||||
xbar->is_shutdown = false;
|
||||
@@ -335,44 +328,39 @@ int tegra_xbar_probe(struct platform_device *pdev,
|
||||
xbar->clk = devm_clk_get(&pdev->dev, "ahub");
|
||||
if (IS_ERR(xbar->clk)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve ahub clock\n");
|
||||
ret = PTR_ERR(xbar->clk);
|
||||
goto err;
|
||||
return PTR_ERR(xbar->clk);
|
||||
}
|
||||
|
||||
xbar->clk_parent = devm_clk_get(&pdev->dev, "pll_a_out0");
|
||||
if (IS_ERR(xbar->clk_parent)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve pll_a_out0 clock\n");
|
||||
ret = PTR_ERR(xbar->clk_parent);
|
||||
goto err;
|
||||
return PTR_ERR(xbar->clk_parent);
|
||||
}
|
||||
|
||||
xbar->clk_apb2ape = devm_clk_get(&pdev->dev, "apb2ape");
|
||||
if (IS_ERR(xbar->clk_apb2ape)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve apb2ape clock\n");
|
||||
ret = PTR_ERR(xbar->clk_apb2ape);
|
||||
goto err;
|
||||
return PTR_ERR(xbar->clk_apb2ape);
|
||||
}
|
||||
|
||||
xbar->clk_ape = devm_clk_get(&pdev->dev, "xbar.ape");
|
||||
if (IS_ERR(xbar->clk_ape)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve ape clock\n");
|
||||
ret = PTR_ERR(xbar->clk_ape);
|
||||
goto err;
|
||||
return PTR_ERR(xbar->clk_ape);
|
||||
}
|
||||
}
|
||||
|
||||
parent_clk = clk_get_parent(xbar->clk);
|
||||
if (IS_ERR(parent_clk)) {
|
||||
dev_err(&pdev->dev, "Can't get parent clock for xbar\n");
|
||||
ret = PTR_ERR(parent_clk);
|
||||
goto err;
|
||||
return PTR_ERR(parent_clk);
|
||||
}
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
ret = clk_set_parent(xbar->clk, xbar->clk_parent);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to set parent clock with pll_a_out0\n");
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,29 +376,14 @@ int tegra_xbar_probe(struct platform_device *pdev,
|
||||
}
|
||||
regcache_cache_only(xbar->regmap, true);
|
||||
|
||||
tegra_pd_add_device(&pdev->dev);
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
ret = tegra_xbar_runtime_resume(&pdev->dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
ret = soc_data->xbar_registration(pdev);
|
||||
if (ret) {
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = soc_data->xbar_registration(pdev);
|
||||
if (ret == -EBUSY)
|
||||
goto err_suspend;
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
tegra_xbar_runtime_suspend(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
tegra_pd_remove_device(&pdev->dev);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_xbar_probe);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
Reference in New Issue
Block a user