From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH v2 093/186] ASoC: max98371: replace codec to component Date: Mon, 29 Jan 2018 04:05:15 +0000 Message-ID: <87r2q9z4yk.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 DC0CC26784B for ; Mon, 29 Jan 2018 05:05:18 +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/max98371.c | 43 +++++++++++++++++++------------------------ sound/soc/codecs/max98371.h | 1 - 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/sound/soc/codecs/max98371.c b/sound/soc/codecs/max98371.c index 7bc2a17..d4ba139 100644 --- a/sound/soc/codecs/max98371.c +++ b/sound/soc/codecs/max98371.c @@ -187,15 +187,15 @@ static const DECLARE_TLV_DB_RANGE(max98371_noload_gain_tlv, static int max98371_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - struct max98371_priv *max98371 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct max98371_priv *max98371 = snd_soc_component_get_drvdata(component); unsigned int val = 0; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: break; default: - dev_err(codec->dev, "DAI clock mode unsupported"); + dev_err(component->dev, "DAI clock mode unsupported"); return -EINVAL; } @@ -210,7 +210,7 @@ static int max98371_dai_set_fmt(struct snd_soc_dai *codec_dai, val |= MAX98371_DAI_LEFT; break; default: - dev_err(codec->dev, "DAI wrong mode unsupported"); + dev_err(component->dev, "DAI wrong mode unsupported"); return -EINVAL; } regmap_update_bits(max98371->regmap, MAX98371_FMT, @@ -222,8 +222,8 @@ static int max98371_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 max98371_priv *max98371 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct max98371_priv *max98371 = snd_soc_component_get_drvdata(component); int blr_clk_ratio, ch_size, channels = params_channels(params); int rate = params_rate(params); @@ -348,15 +348,17 @@ static int max98371_dai_hw_params(struct snd_pcm_substream *substream, } }; -static const struct snd_soc_codec_driver max98371_codec = { - .component_driver = { - .controls = max98371_snd_controls, - .num_controls = ARRAY_SIZE(max98371_snd_controls), - .dapm_routes = max98371_audio_map, - .num_dapm_routes = ARRAY_SIZE(max98371_audio_map), - .dapm_widgets = max98371_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(max98371_dapm_widgets), - }, +static const struct snd_soc_component_driver max98371_component = { + .controls = max98371_snd_controls, + .num_controls = ARRAY_SIZE(max98371_snd_controls), + .dapm_routes = max98371_audio_map, + .num_dapm_routes = ARRAY_SIZE(max98371_audio_map), + .dapm_widgets = max98371_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(max98371_dapm_widgets), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config max98371_regmap = { @@ -397,21 +399,15 @@ static int max98371_i2c_probe(struct i2c_client *i2c, } dev_info(&i2c->dev, "device version %x\n", reg); - ret = snd_soc_register_codec(&i2c->dev, &max98371_codec, + ret = devm_snd_soc_register_component(&i2c->dev, &max98371_component, max98371_dai, ARRAY_SIZE(max98371_dai)); if (ret < 0) { - dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); + dev_err(&i2c->dev, "Failed to register component: %d\n", ret); return ret; } return ret; } -static int max98371_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id max98371_i2c_id[] = { { "max98371", 0 }, { } @@ -432,7 +428,6 @@ static int max98371_i2c_remove(struct i2c_client *client) .of_match_table = of_match_ptr(max98371_of_match), }, .probe = max98371_i2c_probe, - .remove = max98371_i2c_remove, .id_table = max98371_i2c_id, }; diff --git a/sound/soc/codecs/max98371.h b/sound/soc/codecs/max98371.h index 9f63309..06e9ba7 100644 --- a/sound/soc/codecs/max98371.h +++ b/sound/soc/codecs/max98371.h @@ -62,6 +62,5 @@ struct max98371_priv { struct regmap *regmap; - struct snd_soc_codec *codec; }; #endif -- 1.9.1