From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH v2 177/186] ASoC: jz4740: replace codec to component Date: Mon, 29 Jan 2018 04:43:36 +0000 Message-ID: <87efm9uvha.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 relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 93FC6267DF1 for ; Mon, 29 Jan 2018 05:43:39 +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/jz4740.c | 50 +++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index 6324ccd..9395b58 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c @@ -157,7 +157,7 @@ static const DECLARE_TLV_DB_RANGE(jz4740_mic_tlv, static int jz4740_codec_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(dai->codec); + struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(dai->component); uint32_t val; switch (params_rate(params)) { @@ -236,10 +236,10 @@ static void jz4740_codec_wakeup(struct regmap *regmap) regcache_sync(regmap); } -static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, +static int jz4740_codec_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec); + struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component); struct regmap *regmap = jz4740_codec->regmap; unsigned int mask; unsigned int value; @@ -257,7 +257,7 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* The only way to clear the suspend flag is to reset the codec */ - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) jz4740_codec_wakeup(regmap); mask = JZ4740_CODEC_1_VREF_DISABLE | @@ -283,9 +283,9 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) +static int jz4740_codec_dev_probe(struct snd_soc_component *component) { - struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec); + struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component); regmap_update_bits(jz4740_codec->regmap, JZ4740_REG_CODEC_1, JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); @@ -293,19 +293,21 @@ static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = { - .probe = jz4740_codec_dev_probe, - .set_bias_level = jz4740_codec_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = jz4740_codec_controls, - .num_controls = ARRAY_SIZE(jz4740_codec_controls), - .dapm_widgets = jz4740_codec_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(jz4740_codec_dapm_widgets), - .dapm_routes = jz4740_codec_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes), - }, +static const struct snd_soc_component_driver soc_codec_dev_jz4740_codec = { + .probe = jz4740_codec_dev_probe, + .set_bias_level = jz4740_codec_set_bias_level, + .controls = jz4740_codec_controls, + .num_controls = ARRAY_SIZE(jz4740_codec_controls), + .dapm_widgets = jz4740_codec_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(jz4740_codec_dapm_widgets), + .dapm_routes = jz4740_codec_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, + }; static const struct regmap_config jz4740_codec_regmap_config = { @@ -343,7 +345,7 @@ static int jz4740_codec_probe(struct platform_device *pdev) platform_set_drvdata(pdev, jz4740_codec); - ret = snd_soc_register_codec(&pdev->dev, + ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_jz4740_codec, &jz4740_codec_dai, 1); if (ret) dev_err(&pdev->dev, "Failed to register codec\n"); @@ -351,16 +353,8 @@ static int jz4740_codec_probe(struct platform_device *pdev) return ret; } -static int jz4740_codec_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - - return 0; -} - static struct platform_driver jz4740_codec_driver = { .probe = jz4740_codec_probe, - .remove = jz4740_codec_remove, .driver = { .name = "jz4740-codec", }, -- 1.9.1