From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
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 -> .pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/codecs/ak4613.c | 67 ++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 33 deletions(-)
diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index b95bb8b5..3ea0136 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c @@ -239,9 +239,9 @@ struct ak4613_priv { static void ak4613_dai_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); - struct device *dev = codec->dev; + struct snd_soc_component *component = dai->component; + struct ak4613_priv *priv = snd_soc_component_get_drvdata(component); + struct device *dev = component->dev;
mutex_lock(&priv->lock); priv->cnt--; @@ -301,8 +301,8 @@ static void ak4613_hw_constraints(struct ak4613_priv *priv, static int ak4613_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
priv->cnt++;
@@ -314,8 +314,8 @@ static int ak4613_dai_startup(struct snd_pcm_substream *substream, static int ak4613_dai_set_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = codec_dai->codec; - struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
priv->sysclk = freq;
@@ -324,8 +324,8 @@ static int ak4613_dai_set_sysclk(struct snd_soc_dai *codec_dai,
static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; - struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
fmt &= SND_SOC_DAIFMT_FORMAT_MASK;
@@ -362,10 +362,10 @@ static int ak4613_dai_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 ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4613_priv *priv = snd_soc_component_get_drvdata(component); const struct ak4613_interface *iface; - struct device *dev = codec->dev; + struct device *dev = component->dev; unsigned int width = params_width(params); unsigned int fmt = priv->fmt; unsigned int rate; @@ -429,11 +429,11 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
fmt_ctrl = AUDIO_IFACE_TO_VAL(iface);
- snd_soc_update_bits(codec, CTRL1, FMT_MASK, fmt_ctrl); - snd_soc_update_bits(codec, CTRL2, DFS_MASK, ctrl2); + snd_soc_component_update_bits(component, CTRL1, FMT_MASK, fmt_ctrl); + snd_soc_component_update_bits(component, CTRL2, DFS_MASK, ctrl2);
- snd_soc_update_bits(codec, ICTRL, ICTRL_MASK, priv->ic); - snd_soc_update_bits(codec, OCTRL, OCTRL_MASK, priv->oc); + snd_soc_component_update_bits(component, ICTRL, ICTRL_MASK, priv->ic); + snd_soc_component_update_bits(component, OCTRL, OCTRL_MASK, priv->oc);
hw_params_end: if (ret < 0) @@ -442,7 +442,7 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream, return ret; }
-static int ak4613_set_bias_level(struct snd_soc_codec *codec, +static int ak4613_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { u8 mgmt1 = 0; @@ -462,7 +462,7 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec, break; }
- snd_soc_write(codec, PW_MGMT1, mgmt1); + snd_soc_component_write(component, PW_MGMT1, mgmt1);
return 0; } @@ -505,35 +505,37 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec, .symmetric_rates = 1, };
-static int ak4613_suspend(struct snd_soc_codec *codec) +static int ak4613_suspend(struct snd_soc_component *component) { - struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + struct regmap *regmap = dev_get_regmap(component->dev, NULL);
regcache_cache_only(regmap, true); regcache_mark_dirty(regmap); return 0; }
-static int ak4613_resume(struct snd_soc_codec *codec) +static int ak4613_resume(struct snd_soc_component *component) { - struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + struct regmap *regmap = dev_get_regmap(component->dev, NULL);
regcache_cache_only(regmap, false); return regcache_sync(regmap); }
-static const struct snd_soc_codec_driver soc_codec_dev_ak4613 = { +static const struct snd_soc_component_driver soc_component_dev_ak4613 = { .suspend = ak4613_suspend, .resume = ak4613_resume, .set_bias_level = ak4613_set_bias_level, - .component_driver = { - .controls = ak4613_snd_controls, - .num_controls = ARRAY_SIZE(ak4613_snd_controls), - .dapm_widgets = ak4613_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ak4613_dapm_widgets), - .dapm_routes = ak4613_intercon, - .num_dapm_routes = ARRAY_SIZE(ak4613_intercon), - }, + .controls = ak4613_snd_controls, + .num_controls = ARRAY_SIZE(ak4613_snd_controls), + .dapm_widgets = ak4613_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak4613_dapm_widgets), + .dapm_routes = ak4613_intercon, + .num_dapm_routes = ARRAY_SIZE(ak4613_intercon), + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, };
static void ak4613_parse_of(struct ak4613_priv *priv, @@ -599,13 +601,12 @@ static int ak4613_i2c_probe(struct i2c_client *i2c, if (IS_ERR(regmap)) return PTR_ERR(regmap);
- return snd_soc_register_codec(dev, &soc_codec_dev_ak4613, + return devm_snd_soc_register_component(dev, &soc_component_dev_ak4613, &ak4613_dai, 1); }
static int ak4613_i2c_remove(struct i2c_client *client) { - snd_soc_unregister_codec(&client->dev); return 0; }