From 3860978c5bf48720d1bab68ffa49e153fb9c01e8 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 04:21:55 +0000 Subject: [PATCH 1/5] ASoC: spdif_transmitter: replace codec to component Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/spdif_transmitter.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/sound/soc/codecs/spdif_transmitter.c b/sound/soc/codecs/spdif_transmitter.c index 037aa1d45559..b4f7fc4acb39 100644 --- a/sound/soc/codecs/spdif_transmitter.c +++ b/sound/soc/codecs/spdif_transmitter.c @@ -38,13 +38,15 @@ static const struct snd_soc_dapm_route dit_routes[] = { { "spdif-out", NULL, "Playback" }, }; -static struct snd_soc_codec_driver soc_codec_spdif_dit = { - .component_driver = { - .dapm_widgets = dit_widgets, - .num_dapm_widgets = ARRAY_SIZE(dit_widgets), - .dapm_routes = dit_routes, - .num_dapm_routes = ARRAY_SIZE(dit_routes), - }, +static struct snd_soc_component_driver soc_codec_spdif_dit = { + .dapm_widgets = dit_widgets, + .num_dapm_widgets = ARRAY_SIZE(dit_widgets), + .dapm_routes = dit_routes, + .num_dapm_routes = ARRAY_SIZE(dit_routes), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static struct snd_soc_dai_driver dit_stub_dai = { @@ -60,16 +62,11 @@ static struct snd_soc_dai_driver dit_stub_dai = { static int spdif_dit_probe(struct platform_device *pdev) { - return snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dit, + return devm_snd_soc_register_component(&pdev->dev, + &soc_codec_spdif_dit, &dit_stub_dai, 1); } -static int spdif_dit_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - return 0; -} - #ifdef CONFIG_OF static const struct of_device_id spdif_dit_dt_ids[] = { { .compatible = "linux,spdif-dit", }, @@ -80,7 +77,6 @@ MODULE_DEVICE_TABLE(of, spdif_dit_dt_ids); static struct platform_driver spdif_dit_driver = { .probe = spdif_dit_probe, - .remove = spdif_dit_remove, .driver = { .name = DRV_NAME, .of_match_table = of_match_ptr(spdif_dit_dt_ids), From 8c6086b8b5e7e50519b6d439ec51ac06a956c656 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 04:22:25 +0000 Subject: [PATCH 2/5] ASoC: spdif_receiver: replace codec to component Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/spdif_receiver.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/sound/soc/codecs/spdif_receiver.c b/sound/soc/codecs/spdif_receiver.c index c8fd6367f6c0..ac69d495d121 100644 --- a/sound/soc/codecs/spdif_receiver.c +++ b/sound/soc/codecs/spdif_receiver.c @@ -38,13 +38,15 @@ static const struct snd_soc_dapm_route dir_routes[] = { SNDRV_PCM_FMTBIT_S32_LE | \ SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE) -static struct snd_soc_codec_driver soc_codec_spdif_dir = { - .component_driver = { - .dapm_widgets = dir_widgets, - .num_dapm_widgets = ARRAY_SIZE(dir_widgets), - .dapm_routes = dir_routes, - .num_dapm_routes = ARRAY_SIZE(dir_routes), - }, +static struct snd_soc_component_driver soc_codec_spdif_dir = { + .dapm_widgets = dir_widgets, + .num_dapm_widgets = ARRAY_SIZE(dir_widgets), + .dapm_routes = dir_routes, + .num_dapm_routes = ARRAY_SIZE(dir_routes), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static struct snd_soc_dai_driver dir_stub_dai = { @@ -60,16 +62,11 @@ static struct snd_soc_dai_driver dir_stub_dai = { static int spdif_dir_probe(struct platform_device *pdev) { - return snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dir, + return devm_snd_soc_register_component(&pdev->dev, + &soc_codec_spdif_dir, &dir_stub_dai, 1); } -static int spdif_dir_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - return 0; -} - #ifdef CONFIG_OF static const struct of_device_id spdif_dir_dt_ids[] = { { .compatible = "linux,spdif-dir", }, @@ -80,7 +77,6 @@ MODULE_DEVICE_TABLE(of, spdif_dir_dt_ids); static struct platform_driver spdif_dir_driver = { .probe = spdif_dir_probe, - .remove = spdif_dir_remove, .driver = { .name = "spdif-dir", .of_match_table = of_match_ptr(spdif_dir_dt_ids), From 4218bcf3e7572891eebed3389e2a9f004ff6d2b6 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 04:38:39 +0000 Subject: [PATCH 3/5] ASoC: sirf-audio: replace codec to component Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/sirf-audio-codec.c | 58 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/sound/soc/codecs/sirf-audio-codec.c b/sound/soc/codecs/sirf-audio-codec.c index 7ae8c181d1a4..e424499a8450 100644 --- a/sound/soc/codecs/sirf-audio-codec.c +++ b/sound/soc/codecs/sirf-audio-codec.c @@ -120,8 +120,8 @@ static int atlas6_codec_enable_and_reset_event(struct snd_soc_dapm_widget *w, { #define ATLAS6_CODEC_ENABLE_BITS (1 << 29) #define ATLAS6_CODEC_RESET_BITS (1 << 28) - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct sirf_audio_codec *sirf_audio_codec = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct sirf_audio_codec *sirf_audio_codec = snd_soc_component_get_drvdata(component); switch (event) { case SND_SOC_DAPM_PRE_PMU: enable_and_reset_codec(sirf_audio_codec->regmap, @@ -143,8 +143,8 @@ static int prima2_codec_enable_and_reset_event(struct snd_soc_dapm_widget *w, { #define PRIMA2_CODEC_ENABLE_BITS (1 << 27) #define PRIMA2_CODEC_RESET_BITS (1 << 26) - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct sirf_audio_codec *sirf_audio_codec = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct sirf_audio_codec *sirf_audio_codec = snd_soc_component_get_drvdata(component); switch (event) { case SND_SOC_DAPM_POST_PMU: enable_and_reset_codec(sirf_audio_codec->regmap, @@ -333,8 +333,8 @@ static int sirf_audio_codec_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct sirf_audio_codec *sirf_audio_codec = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct sirf_audio_codec *sirf_audio_codec = snd_soc_component_get_drvdata(component); int playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; /* @@ -346,7 +346,7 @@ static int sirf_audio_codec_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (playback) { - snd_soc_update_bits(codec, AUDIO_IC_CODEC_CTRL0, + snd_soc_component_update_bits(component, AUDIO_IC_CODEC_CTRL0, IC_HSLEN | IC_HSREN, 0); sirf_audio_codec_tx_disable(sirf_audio_codec); } else @@ -357,7 +357,7 @@ static int sirf_audio_codec_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: if (playback) { sirf_audio_codec_tx_enable(sirf_audio_codec); - snd_soc_update_bits(codec, AUDIO_IC_CODEC_CTRL0, + snd_soc_component_update_bits(component, AUDIO_IC_CODEC_CTRL0, IC_HSLEN | IC_HSREN, IC_HSLEN | IC_HSREN); } else sirf_audio_codec_rx_enable(sirf_audio_codec, @@ -393,29 +393,29 @@ static struct snd_soc_dai_driver sirf_audio_codec_dai = { .ops = &sirf_audio_codec_dai_ops, }; -static int sirf_audio_codec_probe(struct snd_soc_codec *codec) +static int sirf_audio_codec_probe(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); - pm_runtime_enable(codec->dev); + pm_runtime_enable(component->dev); - if (of_device_is_compatible(codec->dev->of_node, "sirf,prima2-audio-codec")) { + if (of_device_is_compatible(component->dev->of_node, "sirf,prima2-audio-codec")) { snd_soc_dapm_new_controls(dapm, prima2_output_driver_dapm_widgets, ARRAY_SIZE(prima2_output_driver_dapm_widgets)); snd_soc_dapm_new_controls(dapm, &prima2_codec_clock_dapm_widget, 1); - return snd_soc_add_codec_controls(codec, + return snd_soc_add_component_controls(component, volume_controls_prima2, ARRAY_SIZE(volume_controls_prima2)); } - if (of_device_is_compatible(codec->dev->of_node, "sirf,atlas6-audio-codec")) { + if (of_device_is_compatible(component->dev->of_node, "sirf,atlas6-audio-codec")) { snd_soc_dapm_new_controls(dapm, atlas6_output_driver_dapm_widgets, ARRAY_SIZE(atlas6_output_driver_dapm_widgets)); snd_soc_dapm_new_controls(dapm, &atlas6_codec_clock_dapm_widget, 1); - return snd_soc_add_codec_controls(codec, + return snd_soc_add_component_controls(component, volume_controls_atlas6, ARRAY_SIZE(volume_controls_atlas6)); } @@ -423,22 +423,21 @@ static int sirf_audio_codec_probe(struct snd_soc_codec *codec) return -EINVAL; } -static int sirf_audio_codec_remove(struct snd_soc_codec *codec) +static void sirf_audio_codec_remove(struct snd_soc_component *component) { - pm_runtime_disable(codec->dev); - return 0; + pm_runtime_disable(component->dev); } -static const struct snd_soc_codec_driver soc_codec_device_sirf_audio_codec = { - .probe = sirf_audio_codec_probe, - .remove = sirf_audio_codec_remove, - .component_driver = { - .dapm_widgets = sirf_audio_codec_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(sirf_audio_codec_dapm_widgets), - .dapm_routes = sirf_audio_codec_map, - .num_dapm_routes = ARRAY_SIZE(sirf_audio_codec_map), - }, - .idle_bias_off = true, +static const struct snd_soc_component_driver soc_codec_device_sirf_audio_codec = { + .probe = sirf_audio_codec_probe, + .remove = sirf_audio_codec_remove, + .dapm_widgets = sirf_audio_codec_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(sirf_audio_codec_dapm_widgets), + .dapm_routes = sirf_audio_codec_map, + .num_dapm_routes = ARRAY_SIZE(sirf_audio_codec_map), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct of_device_id sirf_audio_codec_of_match[] = { @@ -495,7 +494,7 @@ static int sirf_audio_codec_driver_probe(struct platform_device *pdev) return ret; } - ret = snd_soc_register_codec(&(pdev->dev), + ret = devm_snd_soc_register_component(&(pdev->dev), &soc_codec_device_sirf_audio_codec, &sirf_audio_codec_dai, 1); if (ret) { @@ -525,7 +524,6 @@ static int sirf_audio_codec_driver_remove(struct platform_device *pdev) struct sirf_audio_codec *sirf_audio_codec = platform_get_drvdata(pdev); clk_disable_unprepare(sirf_audio_codec->clk); - snd_soc_unregister_codec(&(pdev->dev)); return 0; } From e0b9f3aa45fcfce1873503e5ff85d919697427cb Mon Sep 17 00:00:00 2001 From: Corentin Labbe Date: Mon, 29 Jan 2018 12:28:54 +0000 Subject: [PATCH 4/5] ASoC: sn95031: remove dead makefile about sn95031 All sn95031 stuff was removed in commit 987da3fe1759 ("ASoC: sn95031: remove this code") Since SND_SOC_SN95031 was gone, remove makefile about it. Signed-off-by: Corentin Labbe Signed-off-by: Mark Brown --- sound/soc/codecs/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index da1571336f1e..4053c72d852b 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -387,7 +387,6 @@ obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o obj-$(CONFIG_SND_SOC_SIGMADSP_I2C) += snd-soc-sigmadsp-i2c.o obj-$(CONFIG_SND_SOC_SIGMADSP_REGMAP) += snd-soc-sigmadsp-regmap.o obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o -obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o obj-$(CONFIG_SND_SOC_SIRF_AUDIO_CODEC) += sirf-audio-codec.o obj-$(CONFIG_SND_SOC_SSM2518) += snd-soc-ssm2518.o From 33d9245c6092336420c67f761b3bdcdd6c7c1d5d Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 14 Feb 2018 13:39:05 -0200 Subject: [PATCH 5/5] ASoC: soc-dapm: Use empty struct initializer { NULL } only clears the first member of the structure. Even though the first member of the snd_soc_dapm_update struct is a pointer,it is more robust to use the empty struct initializer that clears all the struct members. Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 92894d9cac19..2f34590bcb72 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3165,7 +3165,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, unsigned int invert = mc->invert; unsigned int val, rval = 0; int connect, rconnect = -1, change, reg_change = 0; - struct snd_soc_dapm_update update = { NULL }; + struct snd_soc_dapm_update update = {}; int ret = 0; val = (ucontrol->value.integer.value[0] & mask); @@ -3292,7 +3292,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, unsigned int *item = ucontrol->value.enumerated.item; unsigned int val, change, reg_change = 0; unsigned int mask; - struct snd_soc_dapm_update update = { NULL }; + struct snd_soc_dapm_update update = {}; int ret = 0; if (item[0] >= e->items)