diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 42cc83a699ed..b1654909582f 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -401,7 +401,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 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; } 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), 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), diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index a5fb4d404c99..2d9709104ec5 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3195,7 +3195,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); @@ -3322,7 +3322,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)