diff --git a/sound/soc/tegra-alt/tegra210_admaif_alt.c b/sound/soc/tegra-alt/tegra210_admaif_alt.c index d98f1756..fb1e20b2 100644 --- a/sound/soc/tegra-alt/tegra210_admaif_alt.c +++ b/sound/soc/tegra-alt/tegra210_admaif_alt.c @@ -258,7 +258,8 @@ static int tegra_admaif_runtime_resume(struct device *dev) } regcache_cache_only(admaif->regmap, false); - regcache_sync(admaif->regmap); + if (!admaif->is_shutdown) + regcache_sync(admaif->regmap); return 0; } @@ -319,6 +320,11 @@ static int tegra_admaif_prepare(struct snd_pcm_substream *substream, static int tegra_admaif_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai); + + if (admaif->is_shutdown) + return -ENODEV; + return 0; } @@ -1048,6 +1054,7 @@ static int tegra_admaif_probe(struct platform_device *pdev) admaif->refcnt = 0; admaif->soc_data = (struct tegra_admaif_soc_data *)match->data; + admaif->is_shutdown = false; admaif->capture_dma_data = devm_kzalloc(&pdev->dev, sizeof(struct tegra_alt_pcm_dma_params) * @@ -1230,6 +1237,13 @@ err: return ret; } +static void tegra_admaif_platform_shutdown(struct platform_device *pdev) +{ + struct tegra_admaif *admaif = dev_get_drvdata(&pdev->dev); + + admaif->is_shutdown = true; +} + static int tegra_admaif_remove(struct platform_device *pdev) { struct tegra_admaif *admaif = dev_get_drvdata(&pdev->dev); @@ -1259,6 +1273,7 @@ static const struct dev_pm_ops tegra_admaif_pm_ops = { static struct platform_driver tegra_admaif_driver = { .probe = tegra_admaif_probe, .remove = tegra_admaif_remove, + .shutdown = tegra_admaif_platform_shutdown, .driver = { .name = DRV_NAME, .owner = THIS_MODULE, diff --git a/sound/soc/tegra-alt/tegra210_adx_alt.c b/sound/soc/tegra-alt/tegra210_adx_alt.c index 83e37123..71e8a8e6 100644 --- a/sound/soc/tegra-alt/tegra210_adx_alt.c +++ b/sound/soc/tegra-alt/tegra210_adx_alt.c @@ -1,7 +1,7 @@ /* * tegra210_adx_alt.c - Tegra210 ADX driver * - * Copyright (c) 2014-2016 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017 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, @@ -266,11 +266,14 @@ static int tegra210_adx_runtime_resume(struct device *dev) } regcache_cache_only(adx->regmap, false); - regcache_sync(adx->regmap); - /* update the map ram */ - tegra210_adx_update_map_ram(adx); - tegra210_adx_set_in_byte_mask(adx); + if (!adx->is_shutdown) { + regcache_sync(adx->regmap); + + /* update the map ram */ + tegra210_adx_update_map_ram(adx); + tegra210_adx_set_in_byte_mask(adx); + } return 0; } @@ -645,6 +648,7 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) } adx->soc_data = soc_data; + adx->is_shutdown = false; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { @@ -714,6 +718,13 @@ err: return ret; } +static void tegra210_adx_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_adx *adx = dev_get_drvdata(&pdev->dev); + + adx->is_shutdown = true; +} + static int tegra210_adx_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -740,6 +751,7 @@ static struct platform_driver tegra210_adx_driver = { }, .probe = tegra210_adx_platform_probe, .remove = tegra210_adx_platform_remove, + .shutdown = tegra210_adx_platform_shutdown, }; module_platform_driver(tegra210_adx_driver); diff --git a/sound/soc/tegra-alt/tegra210_afc_alt.c b/sound/soc/tegra-alt/tegra210_afc_alt.c index 8a8345db..1d901245 100644 --- a/sound/soc/tegra-alt/tegra210_afc_alt.c +++ b/sound/soc/tegra-alt/tegra210_afc_alt.c @@ -90,7 +90,9 @@ static int tegra210_afc_runtime_resume(struct device *dev) } regcache_cache_only(afc->regmap, false); - regcache_sync(afc->regmap); + + if (!afc->is_shutdown) + regcache_sync(afc->regmap); return 0; } @@ -559,6 +561,7 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev) } afc->soc_data = soc_data; + afc->is_shutdown = false; dev_set_drvdata(&pdev->dev, afc); @@ -631,6 +634,13 @@ err: return ret; } +static void tegra210_afc_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_afc *afc = dev_get_drvdata(&pdev->dev); + + afc->is_shutdown = true; +} + static int tegra210_afc_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -657,6 +667,7 @@ static struct platform_driver tegra210_afc_driver = { }, .probe = tegra210_afc_platform_probe, .remove = tegra210_afc_platform_remove, + .shutdown = tegra210_afc_platform_shutdown, }; module_platform_driver(tegra210_afc_driver) diff --git a/sound/soc/tegra-alt/tegra210_amx_alt.c b/sound/soc/tegra-alt/tegra210_amx_alt.c index eaf14b38..bb686842 100644 --- a/sound/soc/tegra-alt/tegra210_amx_alt.c +++ b/sound/soc/tegra-alt/tegra210_amx_alt.c @@ -1,7 +1,7 @@ /* * tegra210_amx_alt.c - Tegra210 AMX driver * - * Copyright (c) 2014-2016 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017 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, @@ -291,13 +291,16 @@ static int tegra210_amx_runtime_resume(struct device *dev) } regcache_cache_only(amx->regmap, false); - regcache_sync(amx->regmap); - /* update map ram */ - tegra210_amx_set_master_stream(amx, 0, - TEGRA210_AMX_WAIT_ON_ANY); - tegra210_amx_update_map_ram(amx); - tegra210_amx_set_out_byte_mask(amx); + if (!amx->is_shutdown) { + regcache_sync(amx->regmap); + + /* update map ram */ + tegra210_amx_set_master_stream(amx, 0, + TEGRA210_AMX_WAIT_ON_ANY); + tegra210_amx_update_map_ram(amx); + tegra210_amx_set_out_byte_mask(amx); + } return 0; } @@ -872,6 +875,7 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) } amx->soc_data = soc_data; + amx->is_shutdown = false; memset(amx->map, 0, sizeof(amx->map)); memset(amx->byte_mask, 0, sizeof(amx->byte_mask)); @@ -943,6 +947,13 @@ err: return ret; } +static void tegra210_amx_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_amx *amx = dev_get_drvdata(&pdev->dev); + + amx->is_shutdown = true; +} + static int tegra210_amx_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -969,6 +980,7 @@ static struct platform_driver tegra210_amx_driver = { }, .probe = tegra210_amx_platform_probe, .remove = tegra210_amx_platform_remove, + .shutdown = tegra210_amx_platform_shutdown, }; module_platform_driver(tegra210_amx_driver); diff --git a/sound/soc/tegra-alt/tegra210_dmic_alt.c b/sound/soc/tegra-alt/tegra210_dmic_alt.c index 9d3aca61..c323e05f 100644 --- a/sound/soc/tegra-alt/tegra210_dmic_alt.c +++ b/sound/soc/tegra-alt/tegra210_dmic_alt.c @@ -1,7 +1,7 @@ /* * tegra210_dmic_alt.c - Tegra210 DMIC driver * - * Copyright (c) 2014-2016 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017 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, @@ -123,7 +123,9 @@ static int tegra210_dmic_runtime_resume(struct device *dev) } regcache_cache_only(dmic->regmap, false); - regcache_sync(dmic->regmap); + + if (!dmic->is_shutdown) + regcache_sync(dmic->regmap); return 0; } @@ -512,6 +514,7 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev) } dmic->soc_data = soc_data; + dmic->is_shutdown = false; if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) { dmic->clk_dmic = devm_clk_get(&pdev->dev, NULL); @@ -651,6 +654,13 @@ err: return ret; } +static void tegra210_dmic_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_dmic *dmic = dev_get_drvdata(&pdev->dev); + + dmic->is_shutdown = true; +} + static int tegra210_dmic_platform_remove(struct platform_device *pdev) { struct tegra210_dmic *dmic; @@ -682,6 +692,7 @@ static struct platform_driver tegra210_dmic_driver = { }, .probe = tegra210_dmic_platform_probe, .remove = tegra210_dmic_platform_remove, + .shutdown = tegra210_dmic_platform_shutdown, }; module_platform_driver(tegra210_dmic_driver) diff --git a/sound/soc/tegra-alt/tegra210_i2s_alt.c b/sound/soc/tegra-alt/tegra210_i2s_alt.c index 95b3b824..a2312ed4 100644 --- a/sound/soc/tegra-alt/tegra210_i2s_alt.c +++ b/sound/soc/tegra-alt/tegra210_i2s_alt.c @@ -290,7 +290,9 @@ static int tegra210_i2s_runtime_resume(struct device *dev) } regcache_cache_only(i2s->regmap, false); - regcache_sync(i2s->regmap); + + if (!i2s->is_shutdown) + regcache_sync(i2s->regmap); return 0; } @@ -1027,6 +1029,7 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev) i2s->bclk_ratio = 2; i2s->enable_cya = false; i2s->loopback = 0; + i2s->is_shutdown = false; if (i2s->soc_data->is_soc_t210) { #ifdef CONFIG_PM_GENERIC_DOMAINS_OF @@ -1221,6 +1224,13 @@ err: return ret; } +static void tegra210_i2s_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_i2s *i2s = dev_get_drvdata(&pdev->dev); + + i2s->is_shutdown = true; +} + static int tegra210_i2s_platform_remove(struct platform_device *pdev) { struct tegra210_i2s *i2s = dev_get_drvdata(&pdev->dev); @@ -1256,6 +1266,7 @@ static struct platform_driver tegra210_i2s_driver = { }, .probe = tegra210_i2s_platform_probe, .remove = tegra210_i2s_platform_remove, + .shutdown = tegra210_i2s_platform_shutdown, }; module_platform_driver(tegra210_i2s_driver) diff --git a/sound/soc/tegra-alt/tegra210_mixer_alt.c b/sound/soc/tegra-alt/tegra210_mixer_alt.c index 291efd7f..7ed3d36d 100644 --- a/sound/soc/tegra-alt/tegra210_mixer_alt.c +++ b/sound/soc/tegra-alt/tegra210_mixer_alt.c @@ -1,7 +1,7 @@ /* * tegra210_mixer_alt.c - Tegra210 MIXER driver * - * Copyright (c) 2014-2016 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017 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, @@ -99,7 +99,9 @@ static int tegra210_mixer_runtime_resume(struct device *dev) } regcache_cache_only(mixer->regmap, false); - regcache_sync(mixer->regmap); + + if (!mixer->is_shutdown) + regcache_sync(mixer->regmap); return 0; } @@ -718,6 +720,7 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) } mixer->soc_data = soc_data; + mixer->is_shutdown = false; mixer->gain_coeff[0] = 0; mixer->gain_coeff[1] = 0; mixer->gain_coeff[2] = 0; @@ -804,6 +807,13 @@ err: return ret; } +static void tegra210_mixer_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_mixer *mixer = dev_get_drvdata(&pdev->dev); + + mixer->is_shutdown = true; +} + static int tegra210_mixer_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -830,6 +840,7 @@ static struct platform_driver tegra210_mixer_driver = { }, .probe = tegra210_mixer_platform_probe, .remove = tegra210_mixer_platform_remove, + .shutdown = tegra210_mixer_platform_shutdown, }; module_platform_driver(tegra210_mixer_driver); diff --git a/sound/soc/tegra-alt/tegra210_mvc_alt.c b/sound/soc/tegra-alt/tegra210_mvc_alt.c index 75c891c4..176c19bf 100644 --- a/sound/soc/tegra-alt/tegra210_mvc_alt.c +++ b/sound/soc/tegra-alt/tegra210_mvc_alt.c @@ -1,7 +1,7 @@ /* * tegra210_mvc_alt.c - Tegra210 MVC driver * - * Copyright (c) 2014-2016 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017 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, @@ -77,11 +77,14 @@ static int tegra210_mvc_runtime_resume(struct device *dev) } regcache_cache_only(mvc->regmap, false); - regcache_sync(mvc->regmap); - regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL, - TEGRA210_MVC_CURVE_TYPE_MASK, - mvc->curve_type << TEGRA210_MVC_CURVE_TYPE_SHIFT); + if (!mvc->is_shutdown) { + regcache_sync(mvc->regmap); + + regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL, + TEGRA210_MVC_CURVE_TYPE_MASK, + mvc->curve_type << TEGRA210_MVC_CURVE_TYPE_SHIFT); + } return 0; } @@ -639,6 +642,7 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) } mvc->soc_data = soc_data; + mvc->is_shutdown = false; mvc->poly_n1 = 16; mvc->poly_n2 = 63; @@ -724,6 +728,13 @@ err: return ret; } +static void tegra210_mvc_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_mvc *mvc = dev_get_drvdata(&pdev->dev); + + mvc->is_shutdown = true; +} + static int tegra210_mvc_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -750,6 +761,7 @@ static struct platform_driver tegra210_mvc_driver = { }, .probe = tegra210_mvc_platform_probe, .remove = tegra210_mvc_platform_remove, + .shutdown = tegra210_mvc_platform_shutdown, }; module_platform_driver(tegra210_mvc_driver) diff --git a/sound/soc/tegra-alt/tegra210_ope_alt.c b/sound/soc/tegra-alt/tegra210_ope_alt.c index 57ec66d3..95fbc797 100644 --- a/sound/soc/tegra-alt/tegra210_ope_alt.c +++ b/sound/soc/tegra-alt/tegra210_ope_alt.c @@ -75,9 +75,12 @@ static int tegra210_ope_runtime_resume(struct device *dev) regcache_cache_only(ope->regmap, false); regcache_cache_only(ope->peq_regmap, false); regcache_cache_only(ope->mbdrc_regmap, false); - regcache_sync(ope->regmap); - regcache_sync(ope->peq_regmap); - regcache_sync(ope->mbdrc_regmap); + + if (!ope->is_shutdown) { + regcache_sync(ope->regmap); + regcache_sync(ope->peq_regmap); + regcache_sync(ope->mbdrc_regmap); + } return 0; } @@ -361,6 +364,7 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) } ope->soc_data = soc_data; + ope->is_shutdown = false; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { @@ -448,6 +452,13 @@ err: return ret; } +static void tegra210_ope_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_ope *ope = dev_get_drvdata(&pdev->dev); + + ope->is_shutdown = true; +} + static int tegra210_ope_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -474,6 +485,7 @@ static struct platform_driver tegra210_ope_driver = { }, .probe = tegra210_ope_platform_probe, .remove = tegra210_ope_platform_remove, + .shutdown = tegra210_ope_platform_shutdown, }; module_platform_driver(tegra210_ope_driver) diff --git a/sound/soc/tegra-alt/tegra210_sfc_alt.c b/sound/soc/tegra-alt/tegra210_sfc_alt.c index 4fb448a8..31cf971c 100644 --- a/sound/soc/tegra-alt/tegra210_sfc_alt.c +++ b/sound/soc/tegra-alt/tegra210_sfc_alt.c @@ -1,7 +1,7 @@ /* * tegra210_sfc_alt.c - Tegra210 SFC driver * - * Copyright (c) 2014-2016 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017 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, @@ -86,7 +86,9 @@ static int tegra210_sfc_runtime_resume(struct device *dev) } regcache_cache_only(sfc->regmap, false); - regcache_sync(sfc->regmap); + + if (!sfc->is_shutdown) + regcache_sync(sfc->regmap); return 0; } @@ -888,6 +890,7 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) } sfc->soc_data = soc_data; + sfc->is_shutdown = false; /* initialize default output srate */ sfc->srate_out = TEGRA210_SFC_FS48; @@ -960,6 +963,13 @@ err: return ret; } +static void tegra210_sfc_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_sfc *sfc = dev_get_drvdata(&pdev->dev); + + sfc->is_shutdown = true; +} + static int tegra210_sfc_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -986,6 +996,7 @@ static struct platform_driver tegra210_sfc_driver = { }, .probe = tegra210_sfc_platform_probe, .remove = tegra210_sfc_platform_remove, + .shutdown = tegra210_sfc_platform_shutdown, }; module_platform_driver(tegra210_sfc_driver) diff --git a/sound/soc/tegra-alt/tegra210_spdif_alt.c b/sound/soc/tegra-alt/tegra210_spdif_alt.c index d6d3b1ed..b4009bfa 100644 --- a/sound/soc/tegra-alt/tegra210_spdif_alt.c +++ b/sound/soc/tegra-alt/tegra210_spdif_alt.c @@ -1,7 +1,7 @@ /* * tegra210_spdif_alt.c - Tegra210 SPDIF driver * - * Copyright (c) 2014-2016 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017 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, @@ -116,7 +116,9 @@ static int tegra210_spdif_runtime_resume(struct device *dev) } regcache_cache_only(spdif->regmap, false); - regcache_sync(spdif->regmap); + + if (!spdif->is_shutdown) + regcache_sync(spdif->regmap); return 0; } @@ -471,6 +473,7 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev) } spdif->soc_data = soc_data; + spdif->is_shutdown = false; if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) { spdif->clk_pll_a_out0 = devm_clk_get(&pdev->dev, "pll_a_out0"); if (IS_ERR(spdif->clk_pll_a_out0)) { @@ -621,6 +624,13 @@ err: return ret; } +static void tegra210_spdif_platform_shutdown(struct platform_device *pdev) +{ + struct tegra210_spdif *spdif = dev_get_drvdata(&pdev->dev); + + spdif->is_shutdown = true; +} + static int tegra210_spdif_platform_remove(struct platform_device *pdev) { struct tegra210_spdif *spdif = dev_get_drvdata(&pdev->dev); @@ -654,6 +664,7 @@ static struct platform_driver tegra210_spdif_driver = { }, .probe = tegra210_spdif_platform_probe, .remove = tegra210_spdif_platform_remove, + .shutdown = tegra210_spdif_platform_shutdown, }; module_platform_driver(tegra210_spdif_driver); diff --git a/sound/soc/tegra-alt/tegra210_xbar_alt.c b/sound/soc/tegra-alt/tegra210_xbar_alt.c index de7fac8e..3d437da0 100644 --- a/sound/soc/tegra-alt/tegra210_xbar_alt.c +++ b/sound/soc/tegra-alt/tegra210_xbar_alt.c @@ -602,7 +602,6 @@ int tegra210_xbar_probe(struct platform_device *pdev) soc_data = (struct tegra_xbar_soc_data *)match->data; ret = tegra_xbar_probe(pdev, soc_data); - err: return ret; } @@ -616,6 +615,7 @@ static const struct dev_pm_ops tegra210_xbar_pm_ops = { static struct platform_driver tegra210_xbar_driver = { .probe = tegra210_xbar_probe, .remove = tegra_xbar_remove, + .shutdown = tegra_xbar_shutdown, .driver = { .name = DRV_NAME, .owner = THIS_MODULE,