From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH 053/187] ASoC: ak5386: replace codec to component Date: Fri, 12 Jan 2018 01:23:15 +0000 Message-ID: <878td3c1mp.wl%kuninori.morimoto.gx@renesas.com> References: <87bmhzevk9.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 relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id D9F69267AE8 for ; Fri, 12 Jan 2018 02:23:20 +0100 (CET) In-Reply-To: <87bmhzevk9.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 , Simon 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 -> .pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/ak5386.c | 62 +++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/sound/soc/codecs/ak5386.c b/sound/soc/codecs/ak5386.c index d0e16c0..e6f4ae5 100644 --- a/sound/soc/codecs/ak5386.c +++ b/sound/soc/codecs/ak5386.c @@ -38,30 +38,29 @@ struct ak5386_priv { { "Capture", NULL, "AINR" }, }; -static int ak5386_soc_probe(struct snd_soc_codec *codec) +static int ak5386_soc_probe(struct snd_soc_component *component) { - struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); + struct ak5386_priv *priv = snd_soc_component_get_drvdata(component); return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); } -static int ak5386_soc_remove(struct snd_soc_codec *codec) +static void ak5386_soc_remove(struct snd_soc_component *component) { - struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); + struct ak5386_priv *priv = snd_soc_component_get_drvdata(component); regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies); - return 0; } #ifdef CONFIG_PM -static int ak5386_soc_suspend(struct snd_soc_codec *codec) +static int ak5386_soc_suspend(struct snd_soc_component *component) { - struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); + struct ak5386_priv *priv = snd_soc_component_get_drvdata(component); regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies); return 0; } -static int ak5386_soc_resume(struct snd_soc_codec *codec) +static int ak5386_soc_resume(struct snd_soc_component *component) { - struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); + struct ak5386_priv *priv = snd_soc_component_get_drvdata(component); return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); } #else @@ -69,28 +68,30 @@ static int ak5386_soc_resume(struct snd_soc_codec *codec) #define ak5386_soc_resume NULL #endif /* CONFIG_PM */ -static const struct snd_soc_codec_driver soc_codec_ak5386 = { - .probe = ak5386_soc_probe, - .remove = ak5386_soc_remove, - .suspend = ak5386_soc_suspend, - .resume = ak5386_soc_resume, - .component_driver = { - .dapm_widgets = ak5386_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ak5386_dapm_widgets), - .dapm_routes = ak5386_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(ak5386_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_ak5386 = { + .probe = ak5386_soc_probe, + .remove = ak5386_soc_remove, + .suspend = ak5386_soc_suspend, + .resume = ak5386_soc_resume, + .dapm_widgets = ak5386_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak5386_dapm_widgets), + .dapm_routes = ak5386_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(ak5386_dapm_routes), + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int ak5386_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; format &= SND_SOC_DAIFMT_FORMAT_MASK; if (format != SND_SOC_DAIFMT_LEFT_J && format != SND_SOC_DAIFMT_I2S) { - dev_err(codec->dev, "Invalid DAI format\n"); + dev_err(component->dev, "Invalid DAI format\n"); return -EINVAL; } @@ -101,8 +102,8 @@ static int ak5386_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 ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak5386_priv *priv = snd_soc_component_get_drvdata(component); /* * From the datasheet: @@ -123,8 +124,8 @@ static int ak5386_hw_params(struct snd_pcm_substream *substream, static int ak5386_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak5386_priv *priv = snd_soc_component_get_drvdata(component); if (gpio_is_valid(priv->reset_gpio)) gpio_set_value(priv->reset_gpio, 0); @@ -192,19 +193,12 @@ static int ak5386_probe(struct platform_device *pdev) "AK5386 Reset")) priv->reset_gpio = -EINVAL; - return snd_soc_register_codec(dev, &soc_codec_ak5386, + return devm_snd_soc_register_component(dev, &soc_component_ak5386, &ak5386_dai, 1); } -static int ak5386_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - return 0; -} - static struct platform_driver ak5386_driver = { .probe = ak5386_probe, - .remove = ak5386_remove, .driver = { .name = "ak5386", .of_match_table = of_match_ptr(ak5386_dt_ids), -- 1.9.1