From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH v2 159/186] ASoC: zx_aud96p22: replace codec to component Date: Mon, 29 Jan 2018 04:35:34 +0000 Message-ID: <874ln5waf6.wl%kuninori.morimoto.gx@renesas.com> References: <87607l8k9i.wl%kuninori.morimoto.gx@renesas.com> <87inbl5q6q.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 6BCC5267CE7 for ; Mon, 29 Jan 2018 05:35:37 +0100 (CET) In-Reply-To: <87inbl5q6q.wl%kuninori.morimoto.gx@renesas.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: Linux-ALSA List-Id: alsa-devel@alsa-project.org From: Kuninori Morimoto 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 --- sound/soc/codecs/zx_aud96p22.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/sound/soc/codecs/zx_aud96p22.c b/sound/soc/codecs/zx_aud96p22.c index ca1932d..7a2d6ea 100644 --- a/sound/soc/codecs/zx_aud96p22.c +++ b/sound/soc/codecs/zx_aud96p22.c @@ -57,8 +57,8 @@ struct aud96p22_priv { static int aud96p22_adc_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct aud96p22_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct aud96p22_priv *priv = snd_soc_component_get_drvdata(component); struct regmap *regmap = priv->regmap; if (event != SND_SOC_DAPM_POST_PMU) @@ -74,8 +74,8 @@ static int aud96p22_adc_event(struct snd_soc_dapm_widget *w, static int aud96p22_dac_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct aud96p22_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct aud96p22_priv *priv = snd_soc_component_get_drvdata(component); struct regmap *regmap = priv->regmap; if (event != SND_SOC_DAPM_POST_PMU) @@ -261,20 +261,22 @@ static SOC_VALUE_ENUM_SINGLE_DECL(ainr_mux_enum, AUD96P22_PGA1SEL_1, { "LINEOUTMN", NULL, "LD2" }, }; -static const struct snd_soc_codec_driver aud96p22_driver = { - .component_driver = { - .controls = aud96p22_snd_controls, - .num_controls = ARRAY_SIZE(aud96p22_snd_controls), - .dapm_widgets = aud96p22_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(aud96p22_dapm_widgets), - .dapm_routes = aud96p22_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(aud96p22_dapm_routes), - }, +static const struct snd_soc_component_driver aud96p22_driver = { + .controls = aud96p22_snd_controls, + .num_controls = ARRAY_SIZE(aud96p22_snd_controls), + .dapm_widgets = aud96p22_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(aud96p22_dapm_widgets), + .dapm_routes = aud96p22_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(aud96p22_dapm_routes), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int aud96p22_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct aud96p22_priv *priv = snd_soc_codec_get_drvdata(dai->codec); + struct aud96p22_priv *priv = snd_soc_component_get_drvdata(dai->component); struct regmap *regmap = priv->regmap; unsigned int val; @@ -367,9 +369,9 @@ static int aud96p22_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, priv); - ret = snd_soc_register_codec(dev, &aud96p22_driver, &aud96p22_dai, 1); + ret = devm_snd_soc_register_component(dev, &aud96p22_driver, &aud96p22_dai, 1); if (ret) { - dev_err(dev, "failed to register codec: %d\n", ret); + dev_err(dev, "failed to register component: %d\n", ret); return ret; } @@ -378,7 +380,6 @@ static int aud96p22_i2c_probe(struct i2c_client *i2c, static int aud96p22_i2c_remove(struct i2c_client *i2c) { - snd_soc_unregister_codec(&i2c->dev); return 0; } -- 1.9.1