diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-29 04:56:58 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 10:47:10 +0100 |
commit | 99a9f452093e40f82e51a2f49d95ee3c04ad298b (patch) | |
tree | 4048d29a07c2e54b8e76cb5194f6b2fda78d7764 | |
parent | Linux 4.16-rc1 (diff) | |
download | linux-99a9f452093e40f82e51a2f49d95ee3c04ad298b.tar.xz linux-99a9f452093e40f82e51a2f49d95ee3c04ad298b.zip |
ASoC: cs42xx8: 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 = 1 -> .idle_bias_on = 0
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/cs42xx8-i2c.c | 1 | ||||
-rw-r--r-- | sound/soc/codecs/cs42xx8.c | 57 |
2 files changed, 28 insertions, 30 deletions
diff --git a/sound/soc/codecs/cs42xx8-i2c.c b/sound/soc/codecs/cs42xx8-i2c.c index 800c1d549347..0214e3ab9da0 100644 --- a/sound/soc/codecs/cs42xx8-i2c.c +++ b/sound/soc/codecs/cs42xx8-i2c.c @@ -33,7 +33,6 @@ static int cs42xx8_i2c_probe(struct i2c_client *i2c, static int cs42xx8_i2c_remove(struct i2c_client *i2c) { - snd_soc_unregister_codec(&i2c->dev); pm_runtime_disable(&i2c->dev); return 0; diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c index c1785bd4ff19..ebb9e0cf8364 100644 --- a/sound/soc/codecs/cs42xx8.c +++ b/sound/soc/codecs/cs42xx8.c @@ -194,8 +194,8 @@ static const struct cs42xx8_ratios cs42xx8_ratios[] = { static int cs42xx8_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); cs42xx8->sysclk = freq; @@ -205,8 +205,8 @@ static int cs42xx8_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int cs42xx8_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); u32 val; /* Set DAI format */ @@ -224,7 +224,7 @@ static int cs42xx8_set_dai_fmt(struct snd_soc_dai *codec_dai, val = CS42XX8_INTF_DAC_DIF_TDM | CS42XX8_INTF_ADC_DIF_TDM; break; default: - dev_err(codec->dev, "unsupported dai format\n"); + dev_err(component->dev, "unsupported dai format\n"); return -EINVAL; } @@ -241,7 +241,7 @@ static int cs42xx8_set_dai_fmt(struct snd_soc_dai *codec_dai, cs42xx8->slave_mode = false; break; default: - dev_err(codec->dev, "unsupported master/slave mode\n"); + dev_err(component->dev, "unsupported master/slave mode\n"); return -EINVAL; } @@ -252,8 +252,8 @@ static int cs42xx8_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; u32 ratio = cs42xx8->sysclk / params_rate(params); u32 i, fm, val, mask; @@ -267,7 +267,7 @@ static int cs42xx8_hw_params(struct snd_pcm_substream *substream, } if (i == ARRAY_SIZE(cs42xx8_ratios)) { - dev_err(codec->dev, "unsupported sysclk ratio\n"); + dev_err(component->dev, "unsupported sysclk ratio\n"); return -EINVAL; } @@ -285,8 +285,8 @@ static int cs42xx8_hw_params(struct snd_pcm_substream *substream, static int cs42xx8_digital_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); u8 dac_unmute = cs42xx8->tx_channels ? ~((0x1 << cs42xx8->tx_channels) - 1) : 0; @@ -382,14 +382,14 @@ const struct regmap_config cs42xx8_regmap_config = { }; EXPORT_SYMBOL_GPL(cs42xx8_regmap_config); -static int cs42xx8_codec_probe(struct snd_soc_codec *codec) +static int cs42xx8_component_probe(struct snd_soc_component *component) { - struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); switch (cs42xx8->drvdata->num_adcs) { case 3: - snd_soc_add_codec_controls(codec, cs42xx8_adc3_snd_controls, + snd_soc_add_component_controls(component, cs42xx8_adc3_snd_controls, ARRAY_SIZE(cs42xx8_adc3_snd_controls)); snd_soc_dapm_new_controls(dapm, cs42xx8_adc3_dapm_widgets, ARRAY_SIZE(cs42xx8_adc3_dapm_widgets)); @@ -406,18 +406,17 @@ static int cs42xx8_codec_probe(struct snd_soc_codec *codec) return 0; } -static const struct snd_soc_codec_driver cs42xx8_driver = { - .probe = cs42xx8_codec_probe, - .idle_bias_off = true, - - .component_driver = { - .controls = cs42xx8_snd_controls, - .num_controls = ARRAY_SIZE(cs42xx8_snd_controls), - .dapm_widgets = cs42xx8_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs42xx8_dapm_widgets), - .dapm_routes = cs42xx8_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(cs42xx8_dapm_routes), - }, +static const struct snd_soc_component_driver cs42xx8_driver = { + .probe = cs42xx8_component_probe, + .controls = cs42xx8_snd_controls, + .num_controls = ARRAY_SIZE(cs42xx8_snd_controls), + .dapm_widgets = cs42xx8_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs42xx8_dapm_widgets), + .dapm_routes = cs42xx8_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(cs42xx8_dapm_routes), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; const struct cs42xx8_driver_data cs42448_data = { @@ -520,9 +519,9 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap) /* Each adc supports stereo input */ cs42xx8_dai.capture.channels_max = cs42xx8->drvdata->num_adcs * 2; - ret = snd_soc_register_codec(dev, &cs42xx8_driver, &cs42xx8_dai, 1); + ret = devm_snd_soc_register_component(dev, &cs42xx8_driver, &cs42xx8_dai, 1); if (ret) { - dev_err(dev, "failed to register codec:%d\n", ret); + dev_err(dev, "failed to register component:%d\n", ret); goto err_enable; } |