From b4955d4ea686bfe48e2d3c113d6ee84604330bcd Mon Sep 17 00:00:00 2001 From: Sameer Pujar Date: Sun, 21 Jul 2019 14:20:07 +0530 Subject: [PATCH] ASoC: tegra-alt: remove shutdown handling commit b4bc1cf56020("ASoC: tegra-alt: Avoid reg access after shutdown") avoided device register access after shutdown() has been called. This otherwise resulted in occasional SError and resulted in crash. The reason for this was runtime PM does not work after shutdown and it was seen on vK4.4 Looks like the issue has been fixed from vK4.5 onwards, where PM domain detach is avoided during shutdown. Following is the upstream commmit. "platform: Do not detach from PM domains on shutdown" Bug 200503387 Change-Id: I5f3d18f05e434d5a1ed5b597362a39ec9a9f010b Signed-off-by: Sameer Pujar Reviewed-on: https://git-master.nvidia.com/r/2161809 Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../soc/tegra-alt/include/tegra186_asrc_alt.h | 1 - .../soc/tegra-alt/include/tegra186_dspk_alt.h | 1 - .../tegra-alt/include/tegra210_admaif_alt.h | 1 - .../soc/tegra-alt/include/tegra210_adx_alt.h | 1 - .../soc/tegra-alt/include/tegra210_afc_alt.h | 1 - .../soc/tegra-alt/include/tegra210_amx_alt.h | 1 - .../soc/tegra-alt/include/tegra210_dmic_alt.h | 1 - .../soc/tegra-alt/include/tegra210_i2s_alt.h | 1 - .../tegra-alt/include/tegra210_mixer_alt.h | 1 - .../soc/tegra-alt/include/tegra210_mvc_alt.h | 1 - .../soc/tegra-alt/include/tegra210_ope_alt.h | 1 - .../soc/tegra-alt/include/tegra210_sfc_alt.h | 1 - .../tegra-alt/include/tegra210_spdif_alt.h | 1 - .../soc/tegra-alt/include/tegra210_xbar_alt.h | 1 - sound/soc/tegra-alt/tegra186_asrc_alt.c | 13 ---------- sound/soc/tegra-alt/tegra186_dspk_alt.c | 12 +--------- sound/soc/tegra-alt/tegra210_admaif_alt.c | 24 +------------------ sound/soc/tegra-alt/tegra210_adsp_alt.c | 23 ++++-------------- sound/soc/tegra-alt/tegra210_adx_alt.c | 21 ++++------------ sound/soc/tegra-alt/tegra210_afc_alt.c | 13 +--------- sound/soc/tegra-alt/tegra210_amx_alt.c | 24 ++++--------------- sound/soc/tegra-alt/tegra210_dmic_alt.c | 13 +--------- sound/soc/tegra-alt/tegra210_i2s_alt.c | 12 +--------- sound/soc/tegra-alt/tegra210_mixer_alt.c | 13 +--------- sound/soc/tegra-alt/tegra210_mvc_alt.c | 21 ++++------------ sound/soc/tegra-alt/tegra210_ope_alt.c | 22 ++++------------- sound/soc/tegra-alt/tegra210_sfc_alt.c | 14 +---------- sound/soc/tegra-alt/tegra210_spdif_alt.c | 13 +--------- sound/soc/tegra-alt/tegra210_xbar_alt.c | 1 - .../tegra-alt/utils/tegra210_xbar_utils_alt.c | 12 +--------- 30 files changed, 30 insertions(+), 235 deletions(-) diff --git a/sound/soc/tegra-alt/include/tegra186_asrc_alt.h b/sound/soc/tegra-alt/include/tegra186_asrc_alt.h index e95a3f8f..057a298c 100644 --- a/sound/soc/tegra-alt/include/tegra186_asrc_alt.h +++ b/sound/soc/tegra-alt/include/tegra186_asrc_alt.h @@ -173,7 +173,6 @@ struct tegra186_asrc { struct tasklet_struct tasklet; struct list_head task_desc; int active_dai_count; - bool is_shutdown; }; int tegra186_asrc_set_source(int id, int source); int tegra186_asrc_event(int id, enum asrc_task_event event, int status); diff --git a/sound/soc/tegra-alt/include/tegra186_dspk_alt.h b/sound/soc/tegra-alt/include/tegra186_dspk_alt.h index c80ee5e5..509fb0a6 100644 --- a/sound/soc/tegra-alt/include/tegra186_dspk_alt.h +++ b/sound/soc/tegra-alt/include/tegra186_dspk_alt.h @@ -178,7 +178,6 @@ struct tegra186_dspk { const char *prod_name; unsigned int rx_fifo_th; /* threshold in terms of frames */ unsigned int osr_val; /* osr value */ - bool is_shutdown; }; #endif diff --git a/sound/soc/tegra-alt/include/tegra210_admaif_alt.h b/sound/soc/tegra-alt/include/tegra210_admaif_alt.h index 775df6d1..5cb5b94f 100644 --- a/sound/soc/tegra-alt/include/tegra210_admaif_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_admaif_alt.h @@ -177,7 +177,6 @@ struct tegra_admaif { int *override_channels; int *tx_mono_to_stereo; int *rx_stereo_to_mono; - bool is_shutdown; int reg_dump_flag; void __iomem *base_addr; }; diff --git a/sound/soc/tegra-alt/include/tegra210_adx_alt.h b/sound/soc/tegra-alt/include/tegra210_adx_alt.h index 475e92a1..ef644d6b 100644 --- a/sound/soc/tegra-alt/include/tegra210_adx_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_adx_alt.h @@ -166,7 +166,6 @@ struct tegra210_adx { unsigned int byte_mask[2]; int input_channels; int output_channels[TEGRA210_ADX_NUM_OUTPUTS]; - bool is_shutdown; }; #endif diff --git a/sound/soc/tegra-alt/include/tegra210_afc_alt.h b/sound/soc/tegra-alt/include/tegra210_afc_alt.h index 329b455d..7b2b0af3 100644 --- a/sound/soc/tegra-alt/include/tegra210_afc_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_afc_alt.h @@ -100,7 +100,6 @@ enum tegra210_afc_threshold_type { struct tegra210_afc { struct regmap *regmap; const struct tegra210_afc_soc_data *soc_data; - bool is_shutdown; /* mandatory control to be set */ unsigned int dest_module_num; diff --git a/sound/soc/tegra-alt/include/tegra210_amx_alt.h b/sound/soc/tegra-alt/include/tegra210_amx_alt.h index 0b039ffd..cfc2f2e0 100644 --- a/sound/soc/tegra-alt/include/tegra210_amx_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_amx_alt.h @@ -190,7 +190,6 @@ struct tegra210_amx { int input_channels[TEGRA210_AMX_NUM_INPUTS]; int output_channels; const struct tegra210_amx_soc_data *soc_data; - bool is_shutdown; }; #endif diff --git a/sound/soc/tegra-alt/include/tegra210_dmic_alt.h b/sound/soc/tegra-alt/include/tegra210_dmic_alt.h index 986e5cf6..a03da70c 100644 --- a/sound/soc/tegra-alt/include/tegra210_dmic_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_dmic_alt.h @@ -100,7 +100,6 @@ struct tegra210_dmic { unsigned int channels_via_control; unsigned int osr_val; /* osr value */ int lrsel; - bool is_shutdown; int format_out; }; diff --git a/sound/soc/tegra-alt/include/tegra210_i2s_alt.h b/sound/soc/tegra-alt/include/tegra210_i2s_alt.h index f6ae8d72..f1eaa1a9 100644 --- a/sound/soc/tegra-alt/include/tegra210_i2s_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_i2s_alt.h @@ -221,7 +221,6 @@ struct tegra210_i2s { unsigned int format; bool enable_cya; unsigned int rx_fifo_th; /* should be programmed interms of frames */ - bool is_shutdown; }; #endif diff --git a/sound/soc/tegra-alt/include/tegra210_mixer_alt.h b/sound/soc/tegra-alt/include/tegra210_mixer_alt.h index b8b54f92..4223411e 100644 --- a/sound/soc/tegra-alt/include/tegra210_mixer_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_mixer_alt.h @@ -125,7 +125,6 @@ struct tegra210_mixer { int gain_coeff[14]; int gain_value[TEGRA210_MIXER_AXBAR_RX_MAX]; unsigned int channels_via_control[TEGRA210_MIXER_TOTAL_PATH]; - bool is_shutdown; }; #endif diff --git a/sound/soc/tegra-alt/include/tegra210_mvc_alt.h b/sound/soc/tegra-alt/include/tegra210_mvc_alt.h index be7df72a..d17bbf52 100644 --- a/sound/soc/tegra-alt/include/tegra210_mvc_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_mvc_alt.h @@ -139,7 +139,6 @@ struct tegra210_mvc { unsigned int cif_channels; unsigned int audio_bits; unsigned int format_in; - bool is_shutdown; }; #endif diff --git a/sound/soc/tegra-alt/include/tegra210_ope_alt.h b/sound/soc/tegra-alt/include/tegra210_ope_alt.h index 3be5a64b..0a00b057 100644 --- a/sound/soc/tegra-alt/include/tegra210_ope_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_ope_alt.h @@ -76,7 +76,6 @@ struct tegra210_ope { struct regmap *mbdrc_regmap; u32 peq_biquad_gains[TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH]; u32 peq_biquad_shifts[TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH]; - bool is_shutdown; }; extern int tegra210_peq_init(struct platform_device *pdev, int id); diff --git a/sound/soc/tegra-alt/include/tegra210_sfc_alt.h b/sound/soc/tegra-alt/include/tegra210_sfc_alt.h index 51b95f2d..c67d4dda 100644 --- a/sound/soc/tegra-alt/include/tegra210_sfc_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_sfc_alt.h @@ -92,7 +92,6 @@ struct tegra210_sfc { int stereo_conv_input; int mono_conv_output; unsigned int channels_via_control; - bool is_shutdown; }; #endif diff --git a/sound/soc/tegra-alt/include/tegra210_spdif_alt.h b/sound/soc/tegra-alt/include/tegra210_spdif_alt.h index 0a8b9dc2..a927cacc 100644 --- a/sound/soc/tegra-alt/include/tegra210_spdif_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_spdif_alt.h @@ -252,7 +252,6 @@ struct tegra210_spdif { struct clk *clk_pll_p_out0; struct regmap *regmap; unsigned int loopback; - bool is_shutdown; }; #endif diff --git a/sound/soc/tegra-alt/include/tegra210_xbar_alt.h b/sound/soc/tegra-alt/include/tegra210_xbar_alt.h index fb609eaf..a9c7590d 100644 --- a/sound/soc/tegra-alt/include/tegra210_xbar_alt.h +++ b/sound/soc/tegra-alt/include/tegra210_xbar_alt.h @@ -196,7 +196,6 @@ struct tegra_xbar { struct clk *clk_apb2ape; struct regmap *regmap; const struct tegra_xbar_soc_data *soc_data; - bool is_shutdown; }; /* Extension of soc_bytes structure defined in sound/soc.h */ diff --git a/sound/soc/tegra-alt/tegra186_asrc_alt.c b/sound/soc/tegra-alt/tegra186_asrc_alt.c index 1cc3a0bc..c7304842 100644 --- a/sound/soc/tegra-alt/tegra186_asrc_alt.c +++ b/sound/soc/tegra-alt/tegra186_asrc_alt.c @@ -173,10 +173,6 @@ static int tegra186_asrc_runtime_resume(struct device *dev) int lane_id; regcache_cache_only(asrc->regmap, false); - - if (asrc->is_shutdown) - return 0; - regcache_sync(asrc->regmap); /* HW needs sw reset to make sure previous @@ -1098,7 +1094,6 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev) if (!asrc) return -ENOMEM; - asrc->is_shutdown = false; dev_set_drvdata(&pdev->dev, asrc); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -1155,13 +1150,6 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev) return 0; } -static void tegra186_asrc_platform_shutdown(struct platform_device *pdev) -{ - struct tegra186_asrc *asrc = dev_get_drvdata(&pdev->dev); - - asrc->is_shutdown = true; -} - static int tegra186_asrc_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -1189,7 +1177,6 @@ static struct platform_driver tegra186_asrc_driver = { }, .probe = tegra186_asrc_platform_probe, .remove = tegra186_asrc_platform_remove, - .shutdown = tegra186_asrc_platform_shutdown, }; module_platform_driver(tegra186_asrc_driver) diff --git a/sound/soc/tegra-alt/tegra186_dspk_alt.c b/sound/soc/tegra-alt/tegra186_dspk_alt.c index a90397f0..4a864308 100644 --- a/sound/soc/tegra-alt/tegra186_dspk_alt.c +++ b/sound/soc/tegra-alt/tegra186_dspk_alt.c @@ -114,9 +114,8 @@ static int tegra186_dspk_runtime_resume(struct device *dev) } regcache_cache_only(dspk->regmap, false); + regcache_sync(dspk->regmap); - if (!dspk->is_shutdown) - regcache_sync(dspk->regmap); return 0; } @@ -426,7 +425,6 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev) if (!dspk) return -ENOMEM; - dspk->is_shutdown = false; dspk->prod_name = NULL; dspk->rx_fifo_th = 0; dspk->osr_val = TEGRA186_DSPK_OSR_64; @@ -491,13 +489,6 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev) return 0; } -static void tegra186_dspk_platform_shutdown(struct platform_device *pdev) -{ - struct tegra186_dspk *dspk = dev_get_drvdata(&pdev->dev); - - dspk->is_shutdown = true; -} - static int tegra186_dspk_platform_remove(struct platform_device *pdev) { struct tegra186_dspk *dspk; @@ -528,7 +519,6 @@ static struct platform_driver tegra186_dspk_driver = { }, .probe = tegra186_dspk_platform_probe, .remove = tegra186_dspk_platform_remove, - .shutdown = tegra186_dspk_platform_shutdown, }; module_platform_driver(tegra186_dspk_driver); diff --git a/sound/soc/tegra-alt/tegra210_admaif_alt.c b/sound/soc/tegra-alt/tegra210_admaif_alt.c index 8dadd30b..14edc1c7 100644 --- a/sound/soc/tegra-alt/tegra210_admaif_alt.c +++ b/sound/soc/tegra-alt/tegra210_admaif_alt.c @@ -292,8 +292,7 @@ static int tegra_admaif_runtime_resume(struct device *dev) struct tegra_admaif *admaif = dev_get_drvdata(dev); regcache_cache_only(admaif->regmap, false); - if (!admaif->is_shutdown) - regcache_sync(admaif->regmap); + regcache_sync(admaif->regmap); return 0; } @@ -344,17 +343,6 @@ static int tegra_admaif_prepare(struct snd_pcm_substream *substream, return 0; } -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; -} - static void tegra_admaif_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -552,7 +540,6 @@ static int tegra_admaif_trigger(struct snd_pcm_substream *substream, int cmd, static struct snd_soc_dai_ops tegra_admaif_dai_ops = { .hw_params = tegra_admaif_hw_params, .trigger = tegra_admaif_trigger, - .startup = tegra_admaif_startup, .shutdown = tegra_admaif_shutdown, .prepare = tegra_admaif_prepare, }; @@ -1147,7 +1134,6 @@ static int tegra_admaif_probe(struct platform_device *pdev) admaif->dev = &pdev->dev; admaif->soc_data = (struct tegra_admaif_soc_data *)match->data; - admaif->is_shutdown = false; dev_set_drvdata(&pdev->dev, admaif); admaif->capture_dma_data = devm_kzalloc(&pdev->dev, @@ -1289,13 +1275,6 @@ pm_disable: 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); @@ -1326,7 +1305,6 @@ 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_adsp_alt.c b/sound/soc/tegra-alt/tegra210_adsp_alt.c index c2d772d6..7d810626 100644 --- a/sound/soc/tegra-alt/tegra210_adsp_alt.c +++ b/sound/soc/tegra-alt/tegra210_adsp_alt.c @@ -176,7 +176,6 @@ struct tegra210_adsp { struct mutex mutex; int init_done; int adsp_started; - bool is_shutdown; uint32_t adma_ch_page; uint32_t adma_ch_start; uint32_t adma_ch_cnt; @@ -1398,7 +1397,7 @@ static int tegra210_adsp_compr_open(struct snd_compr_stream *cstream) dev_vdbg(adsp->dev, "%s : DAI ID %d", __func__, rtd->codec_dai->id); - if (!adsp->init_done || adsp->is_shutdown) + if (!adsp->init_done) return -ENODEV; if (!adsp->pcm_path[fe_reg][cstream->direction].fe_reg || @@ -1726,9 +1725,6 @@ static int tegra210_adsp_pcm_open(struct snd_pcm_substream *substream) dev_vdbg(adsp->dev, "%s", __func__); - if (adsp->is_shutdown) - return -ENODEV; - if (!adsp->pcm_path[fe_reg][substream->stream].fe_reg || !adsp->pcm_path[fe_reg][substream->stream].be_reg) { dev_err(adsp->dev, "Broken Path%d - FE not linked to BE", fe_reg); @@ -3895,7 +3891,7 @@ static int tegra210_adsp_set_param(struct snd_kcontrol *kcontrol, apm_msg_t apm_msg; int ret; - if (!adsp->init_done || adsp->is_shutdown) { + if (!adsp->init_done) { dev_warn(adsp->dev, "ADSP is not booted yet\n"); return -EPERM; } @@ -3996,7 +3992,7 @@ static int tegra210_adsp_tlv_callback(struct snd_kcontrol *kcontrol, unsigned int *tlv_data; int ret = 0; - if (!adsp->init_done || adsp->is_shutdown) { + if (!adsp->init_done) { dev_warn(adsp->dev, "ADSP is not booted yet\n"); return 0; } @@ -4155,7 +4151,7 @@ static int tegra210_adsp_apm_put(struct snd_kcontrol *kcontrol, else if (strstr(kcontrol->id.name, "Input Mode")) app->input_mode = ucontrol->value.integer.value[0]; - if (!adsp->init_done || adsp->is_shutdown || !app->plugin) + if (!adsp->init_done || !app->plugin) return 0; ret = pm_runtime_get_sync(adsp->dev); @@ -4512,7 +4508,6 @@ static int tegra210_adsp_audio_platform_probe(struct platform_device *pdev) } dev_set_drvdata(&pdev->dev, adsp); adsp->dev = &pdev->dev; - adsp->is_shutdown = false; adsp->soc_data = (struct adsp_soc_data *)match->data; @@ -4788,15 +4783,6 @@ static int tegra210_adsp_audio_platform_remove(struct platform_device *pdev) return 0; } -static void tegra210_adsp_audio_platform_shutdown( - struct platform_device *pdev) -{ - struct tegra210_adsp *adsp = dev_get_drvdata(&pdev->dev); - - tegra210_adsp_deinit(adsp); - adsp->is_shutdown = true; -} - static const struct dev_pm_ops tegra210_adsp_pm_ops = { SET_RUNTIME_PM_OPS(tegra210_adsp_runtime_suspend, tegra210_adsp_runtime_resume, NULL) @@ -4814,7 +4800,6 @@ static struct platform_driver tegra210_adsp_audio_driver = { .suppress_bind_attrs = true, }, .probe = tegra210_adsp_audio_platform_probe, - .shutdown = tegra210_adsp_audio_platform_shutdown, .remove = tegra210_adsp_audio_platform_remove, }; module_platform_driver(tegra210_adsp_audio_driver); diff --git a/sound/soc/tegra-alt/tegra210_adx_alt.c b/sound/soc/tegra-alt/tegra210_adx_alt.c index 62bebdee..3d4cadb1 100644 --- a/sound/soc/tegra-alt/tegra210_adx_alt.c +++ b/sound/soc/tegra-alt/tegra210_adx_alt.c @@ -256,14 +256,10 @@ static int tegra210_adx_runtime_resume(struct device *dev) struct tegra210_adx *adx = dev_get_drvdata(dev); regcache_cache_only(adx->regmap, false); - - 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); - } + regcache_sync(adx->regmap); + /* update the map ram */ + tegra210_adx_update_map_ram(adx); + tegra210_adx_set_in_byte_mask(adx); return 0; } @@ -811,7 +807,6 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) if (!adx) return -ENOMEM; - adx->is_shutdown = false; dev_set_drvdata(&pdev->dev, adx); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -847,13 +842,6 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) return 0; } -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); @@ -881,7 +869,6 @@ 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 6f032b1c..ed23fc1d 100644 --- a/sound/soc/tegra-alt/tegra210_afc_alt.c +++ b/sound/soc/tegra-alt/tegra210_afc_alt.c @@ -57,7 +57,6 @@ static const struct reg_default tegra210_afc_reg_defaults[] = { static void tegra210_afc_init(struct tegra210_afc *afc) { - afc->is_shutdown = false; afc->ppm_diff = AFC_CLK_PPM_DIFF; afc->threshold_type = TH_DEFAULT; afc->src_burst = 0; @@ -80,9 +79,7 @@ static int tegra210_afc_runtime_resume(struct device *dev) struct tegra210_afc *afc = dev_get_drvdata(dev); regcache_cache_only(afc->regmap, false); - - if (!afc->is_shutdown) - regcache_sync(afc->regmap); + regcache_sync(afc->regmap); return 0; } @@ -568,13 +565,6 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev) return 0; } -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); @@ -602,7 +592,6 @@ 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 c8c7e47b..6acb949d 100644 --- a/sound/soc/tegra-alt/tegra210_amx_alt.c +++ b/sound/soc/tegra-alt/tegra210_amx_alt.c @@ -281,16 +281,11 @@ static int tegra210_amx_runtime_resume(struct device *dev) struct tegra210_amx *amx = dev_get_drvdata(dev); regcache_cache_only(amx->regmap, false); - - 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); - } + 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; } @@ -894,7 +889,6 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) return -ENOMEM; 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)); dev_set_drvdata(&pdev->dev, amx); @@ -938,13 +932,6 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) return 0; } -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); @@ -972,7 +959,6 @@ 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 345128f6..6866ff7a 100644 --- a/sound/soc/tegra-alt/tegra210_dmic_alt.c +++ b/sound/soc/tegra-alt/tegra210_dmic_alt.c @@ -94,9 +94,7 @@ static int tegra210_dmic_runtime_resume(struct device *dev) } regcache_cache_only(dmic->regmap, false); - - if (!dmic->is_shutdown) - regcache_sync(dmic->regmap); + regcache_sync(dmic->regmap); return 0; } @@ -543,7 +541,6 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev) if (!dmic) return -ENOMEM; - dmic->is_shutdown = false; dmic->prod_name = NULL; dmic->osr_val = DMIC_OSR_64; dmic->ch_select = DMIC_CH_SELECT_STEREO; @@ -612,13 +609,6 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev) return 0; } -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; @@ -649,7 +639,6 @@ 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 7c3f9f6d..7f2c97eb 100644 --- a/sound/soc/tegra-alt/tegra210_i2s_alt.c +++ b/sound/soc/tegra-alt/tegra210_i2s_alt.c @@ -241,8 +241,7 @@ static int tegra210_i2s_runtime_resume(struct device *dev) } regcache_cache_only(i2s->regmap, false); - if (!i2s->is_shutdown) - regcache_sync(i2s->regmap); + regcache_sync(i2s->regmap); return 0; } @@ -1056,7 +1055,6 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev) i2s->tx_mask = i2s->rx_mask = 0xFFFF; i2s->enable_cya = false; i2s->loopback = 0; - i2s->is_shutdown = false; i2s->prod_name = NULL; /* default threshold settings */ i2s->rx_fifo_th = 3; @@ -1168,13 +1166,6 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev) return 0; } -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) { snd_soc_unregister_codec(&pdev->dev); @@ -1202,7 +1193,6 @@ 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 d2a60e14..cc339238 100644 --- a/sound/soc/tegra-alt/tegra210_mixer_alt.c +++ b/sound/soc/tegra-alt/tegra210_mixer_alt.c @@ -89,9 +89,7 @@ static int tegra210_mixer_runtime_resume(struct device *dev) struct tegra210_mixer *mixer = dev_get_drvdata(dev); regcache_cache_only(mixer->regmap, false); - - if (!mixer->is_shutdown) - regcache_sync(mixer->regmap); + regcache_sync(mixer->regmap); return 0; } @@ -694,7 +692,6 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) if (!mixer) return -ENOMEM; - mixer->is_shutdown = false; mixer->gain_coeff[0] = 0; mixer->gain_coeff[1] = 0; mixer->gain_coeff[2] = 0; @@ -747,13 +744,6 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) return 0; } -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); @@ -781,7 +771,6 @@ 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 6fd52f61..3b9c0ce1 100644 --- a/sound/soc/tegra-alt/tegra210_mvc_alt.c +++ b/sound/soc/tegra-alt/tegra210_mvc_alt.c @@ -67,14 +67,10 @@ static int tegra210_mvc_runtime_resume(struct device *dev) struct tegra210_mvc *mvc = dev_get_drvdata(dev); regcache_cache_only(mvc->regmap, false); - - 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); - } + 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; } @@ -632,7 +628,6 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) if (!mvc) return -ENOMEM; - mvc->is_shutdown = false; dev_set_drvdata(&pdev->dev, mvc); mvc->poly_n1 = 16; @@ -684,13 +679,6 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) return 0; } -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); @@ -718,7 +706,6 @@ 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 81f12cae..63056ece 100644 --- a/sound/soc/tegra-alt/tegra210_ope_alt.c +++ b/sound/soc/tegra-alt/tegra210_ope_alt.c @@ -66,14 +66,10 @@ 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); - - if (!ope->is_shutdown) { - regcache_sync(ope->regmap); - regcache_sync(ope->peq_regmap); - regcache_sync(ope->mbdrc_regmap); - - tegra210_peq_restore(ope); - } + regcache_sync(ope->regmap); + regcache_sync(ope->peq_regmap); + regcache_sync(ope->mbdrc_regmap); + tegra210_peq_restore(ope); return 0; } @@ -331,8 +327,6 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) if (!ope) return -ENOMEM; - ope->is_shutdown = false; - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(&pdev->dev, mem); if (IS_ERR(regs)) @@ -384,13 +378,6 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) return 0; } -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); @@ -418,7 +405,6 @@ 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 d3e1452f..dbb5bfb3 100644 --- a/sound/soc/tegra-alt/tegra210_sfc_alt.c +++ b/sound/soc/tegra-alt/tegra210_sfc_alt.c @@ -2928,9 +2928,7 @@ static int tegra210_sfc_runtime_resume(struct device *dev) struct tegra210_sfc *sfc = dev_get_drvdata(dev); regcache_cache_only(sfc->regmap, false); - - if (!sfc->is_shutdown) - regcache_sync(sfc->regmap); + regcache_sync(sfc->regmap); return 0; } @@ -3541,8 +3539,6 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) if (!sfc) return -ENOMEM; - sfc->is_shutdown = false; - dev_set_drvdata(&pdev->dev, sfc); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -3578,13 +3574,6 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) return 0; } -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); @@ -3612,7 +3601,6 @@ 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 ea50c6a2..a8489426 100644 --- a/sound/soc/tegra-alt/tegra210_spdif_alt.c +++ b/sound/soc/tegra-alt/tegra210_spdif_alt.c @@ -90,9 +90,7 @@ static int tegra210_spdif_runtime_resume(struct device *dev) } regcache_cache_only(spdif->regmap, false); - - if (!spdif->is_shutdown) - regcache_sync(spdif->regmap); + regcache_sync(spdif->regmap); return 0; } @@ -413,7 +411,6 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev) if (!spdif) return -ENOMEM; - spdif->is_shutdown = false; dev_set_drvdata(&pdev->dev, spdif); if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) { @@ -481,13 +478,6 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev) return 0; } -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) { snd_soc_unregister_codec(&pdev->dev); @@ -515,7 +505,6 @@ 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 6d01aff3..c3d250b7 100644 --- a/sound/soc/tegra-alt/tegra210_xbar_alt.c +++ b/sound/soc/tegra-alt/tegra210_xbar_alt.c @@ -1401,7 +1401,6 @@ static const struct dev_pm_ops tegra_xbar_pm_ops = { static struct platform_driver tegra_xbar_driver = { .probe = tegra_dev_xbar_probe, .remove = tegra_xbar_remove, - .shutdown = tegra_xbar_shutdown, .driver = { .name = DRV_NAME, .owner = THIS_MODULE, diff --git a/sound/soc/tegra-alt/utils/tegra210_xbar_utils_alt.c b/sound/soc/tegra-alt/utils/tegra210_xbar_utils_alt.c index 66da7570..e6352e2c 100644 --- a/sound/soc/tegra-alt/utils/tegra210_xbar_utils_alt.c +++ b/sound/soc/tegra-alt/utils/tegra210_xbar_utils_alt.c @@ -265,20 +265,12 @@ int tegra_xbar_runtime_resume(struct device *dev) tegra186_setup_ahc_interrupts(); #endif regcache_cache_only(xbar->regmap, false); - - if (!xbar->is_shutdown) - regcache_sync(xbar->regmap); + regcache_sync(xbar->regmap); return 0; } EXPORT_SYMBOL_GPL(tegra_xbar_runtime_resume); -void tegra_xbar_shutdown(struct platform_device *pdev) -{ - xbar->is_shutdown = true; -} -EXPORT_SYMBOL_GPL(tegra_xbar_shutdown); - int tegra_xbar_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); @@ -304,8 +296,6 @@ int tegra_xbar_probe(struct platform_device *pdev, return -ENOMEM; xbar->soc_data = soc_data; - xbar->is_shutdown = false; - platform_set_drvdata(pdev, xbar); if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {