From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Brown Subject: Applied "ASoC: cs42l51: replace codec to component" to the asoc tree Date: Mon, 12 Feb 2018 12:43:16 +0000 Message-ID: References: <877es11fm8.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 909D4267864 for ; Mon, 12 Feb 2018 13:43:18 +0100 (CET) In-Reply-To: <877es11fm8.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: Kuninori Morimoto Cc: alsa-devel@alsa-project.org, Mark Brown List-Id: alsa-devel@alsa-project.org The patch ASoC: cs42l51: replace codec to component has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >>From 1fa49856cbc8f4ada62f62f30c3c96038d08f24c Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:59:02 +0000 Subject: [PATCH] ASoC: cs42l51: replace codec to component 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 Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l51-i2c.c | 8 ----- sound/soc/codecs/cs42l51.c | 81 +++++++++++++++++++++--------------------- 2 files changed, 41 insertions(+), 48 deletions(-) diff --git a/sound/soc/codecs/cs42l51-i2c.c b/sound/soc/codecs/cs42l51-i2c.c index 9bad478474fa..4b5731a41876 100644 --- a/sound/soc/codecs/cs42l51-i2c.c +++ b/sound/soc/codecs/cs42l51-i2c.c @@ -35,20 +35,12 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c, return cs42l51_probe(&i2c->dev, devm_regmap_init_i2c(i2c, &config)); } -static int cs42l51_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_codec(&i2c->dev); - - return 0; -} - static struct i2c_driver cs42l51_i2c_driver = { .driver = { .name = "cs42l51", .of_match_table = cs42l51_of_match, }, .probe = cs42l51_i2c_probe, - .remove = cs42l51_i2c_remove, .id_table = cs42l51_i2c_id, }; diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index f8072f1897d4..5080d7a3c279 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -54,8 +54,8 @@ struct cs42l51_private { static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - unsigned long value = snd_soc_read(codec, CS42L51_PCM_MIXER)&3; + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + unsigned long value = snd_soc_component_read32(component, CS42L51_PCM_MIXER)&3; switch (value) { default: @@ -82,7 +82,7 @@ static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); unsigned char val; switch (ucontrol->value.enumerated.item[0]) { @@ -98,7 +98,7 @@ static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, break; } - snd_soc_write(codec, CS42L51_PCM_MIXER, val); + snd_soc_component_write(component, CS42L51_PCM_MIXER, val); return 1; } @@ -153,17 +153,17 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = { static int cs42l51_pdn_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 snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); switch (event) { case SND_SOC_DAPM_PRE_PMD: - snd_soc_update_bits(codec, CS42L51_POWER_CTL1, + snd_soc_component_update_bits(component, CS42L51_POWER_CTL1, CS42L51_POWER_CTL1_PDN, CS42L51_POWER_CTL1_PDN); break; default: case SND_SOC_DAPM_POST_PMD: - snd_soc_update_bits(codec, CS42L51_POWER_CTL1, + snd_soc_component_update_bits(component, CS42L51_POWER_CTL1, CS42L51_POWER_CTL1_PDN, 0); break; } @@ -263,8 +263,8 @@ static const struct snd_soc_dapm_route cs42l51_routes[] = { static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: @@ -273,7 +273,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, cs42l51->audio_mode = format & SND_SOC_DAIFMT_FORMAT_MASK; break; default: - dev_err(codec->dev, "invalid DAI format\n"); + dev_err(component->dev, "invalid DAI format\n"); return -EINVAL; } @@ -285,7 +285,7 @@ static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai, cs42l51->func = MODE_SLAVE_AUTO; break; default: - dev_err(codec->dev, "Unknown master/slave configuration\n"); + dev_err(component->dev, "Unknown master/slave configuration\n"); return -EINVAL; } @@ -326,8 +326,8 @@ static struct cs42l51_ratios slave_auto_ratios[] = { static int cs42l51_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); cs42l51->mclk = freq; return 0; @@ -337,8 +337,8 @@ static int cs42l51_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 cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(component); int ret; unsigned int i; unsigned int rate; @@ -370,12 +370,12 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, if (i == nr_ratios) { /* We did not find a matching ratio */ - dev_err(codec->dev, "could not find matching ratio\n"); + dev_err(component->dev, "could not find matching ratio\n"); return -EINVAL; } - intf_ctl = snd_soc_read(codec, CS42L51_INTF_CTL); - power_ctl = snd_soc_read(codec, CS42L51_MIC_POWER_CTL); + intf_ctl = snd_soc_component_read32(component, CS42L51_INTF_CTL); + power_ctl = snd_soc_component_read32(component, CS42L51_MIC_POWER_CTL); intf_ctl &= ~(CS42L51_INTF_CTL_MASTER | CS42L51_INTF_CTL_ADC_I2S | CS42L51_INTF_CTL_DAC_FORMAT(7)); @@ -418,24 +418,24 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, fmt = CS42L51_DAC_DIF_RJ24; break; default: - dev_err(codec->dev, "unknown format\n"); + dev_err(component->dev, "unknown format\n"); return -EINVAL; } intf_ctl |= CS42L51_INTF_CTL_DAC_FORMAT(fmt); break; default: - dev_err(codec->dev, "unknown format\n"); + dev_err(component->dev, "unknown format\n"); return -EINVAL; } if (ratios[i].mclk) power_ctl |= CS42L51_MIC_POWER_CTL_MCLK_DIV2; - ret = snd_soc_write(codec, CS42L51_INTF_CTL, intf_ctl); + ret = snd_soc_component_write(component, CS42L51_INTF_CTL, intf_ctl); if (ret < 0) return ret; - ret = snd_soc_write(codec, CS42L51_MIC_POWER_CTL, power_ctl); + ret = snd_soc_component_write(component, CS42L51_MIC_POWER_CTL, power_ctl); if (ret < 0) return ret; @@ -444,18 +444,18 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream, static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; int reg; int mask = CS42L51_DAC_OUT_CTL_DACA_MUTE|CS42L51_DAC_OUT_CTL_DACB_MUTE; - reg = snd_soc_read(codec, CS42L51_DAC_OUT_CTL); + reg = snd_soc_component_read32(component, CS42L51_DAC_OUT_CTL); if (mute) reg |= mask; else reg &= ~mask; - return snd_soc_write(codec, CS42L51_DAC_OUT_CTL, reg); + return snd_soc_component_write(component, CS42L51_DAC_OUT_CTL, reg); } static const struct snd_soc_dai_ops cs42l51_dai_ops = { @@ -484,7 +484,7 @@ static struct snd_soc_dai_driver cs42l51_dai = { .ops = &cs42l51_dai_ops, }; -static int cs42l51_codec_probe(struct snd_soc_codec *codec) +static int cs42l51_component_probe(struct snd_soc_component *component) { int ret, reg; @@ -497,24 +497,25 @@ static int cs42l51_codec_probe(struct snd_soc_codec *codec) */ reg = CS42L51_DAC_CTL_DATA_SEL(1) | CS42L51_DAC_CTL_AMUTE | CS42L51_DAC_CTL_DACSZ(0); - ret = snd_soc_write(codec, CS42L51_DAC_CTL, reg); + ret = snd_soc_component_write(component, CS42L51_DAC_CTL, reg); if (ret < 0) return ret; return 0; } -static const struct snd_soc_codec_driver soc_codec_device_cs42l51 = { - .probe = cs42l51_codec_probe, - - .component_driver = { - .controls = cs42l51_snd_controls, - .num_controls = ARRAY_SIZE(cs42l51_snd_controls), - .dapm_widgets = cs42l51_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets), - .dapm_routes = cs42l51_routes, - .num_dapm_routes = ARRAY_SIZE(cs42l51_routes), - }, +static const struct snd_soc_component_driver soc_component_device_cs42l51 = { + .probe = cs42l51_component_probe, + .controls = cs42l51_snd_controls, + .num_controls = ARRAY_SIZE(cs42l51_snd_controls), + .dapm_widgets = cs42l51_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets), + .dapm_routes = cs42l51_routes, + .num_dapm_routes = ARRAY_SIZE(cs42l51_routes), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; const struct regmap_config cs42l51_regmap = { @@ -555,8 +556,8 @@ int cs42l51_probe(struct device *dev, struct regmap *regmap) dev_info(dev, "Cirrus Logic CS42L51, Revision: %02X\n", val & CS42L51_CHIP_REV_MASK); - ret = snd_soc_register_codec(dev, - &soc_codec_device_cs42l51, &cs42l51_dai, 1); + ret = devm_snd_soc_register_component(dev, + &soc_component_device_cs42l51, &cs42l51_dai, 1); error: return ret; } -- 2.16.1