From patchwork Mon Feb 12 12:43:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10212783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB1CD60467 for ; Mon, 12 Feb 2018 13:17:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEE0C2863B for ; Mon, 12 Feb 2018 13:17:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1D3E28882; Mon, 12 Feb 2018 13:17:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 836322863B for ; Mon, 12 Feb 2018 13:17:47 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 48B70268654; Mon, 12 Feb 2018 14:16:39 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5144F268649; Mon, 12 Feb 2018 14:16:37 +0100 (CET) Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 0D289267896 for ; Mon, 12 Feb 2018 13:43:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=ERZrPnKoLu9lML2diV4DRKgsLnxmP/Jz6hSY57mrrdo=; b=ErbYOIOFoedw GG95nCygYdCLynk/PE05R14keqyFsk0I8+14pklOb/60/C8KhEk+F6iXarAdELQs7flB97kIZBsnq zUga1EDP36Hk9nSxnLeN8BM/5cA5bKwZQDkEn460/GnIgV39AGu3Sp7uTJl9XfC7MT8sie3JiB0Pu 3ZM2c=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1elDSY-0002Nb-3B; Mon, 12 Feb 2018 12:43:50 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDSX-00055Q-LX; Mon, 12 Feb 2018 12:43:49 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87bmhd1foy.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:43:49 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: cs42l73: replace codec to component" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: cs42l73: 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 092631bf863d6c632afc1ec935c3acb7b45a8622 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:57:25 +0000 Subject: [PATCH] ASoC: cs42l73: 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/cs42l73.c | 122 +++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 64 deletions(-) diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index aebaa97490b6..36b57ee00a30 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -490,8 +490,8 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = { static int cs42l73_spklo_spk_amp_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 cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct cs42l73_private *priv = snd_soc_component_get_drvdata(component); switch (event) { case SND_SOC_DAPM_POST_PMD: /* 150 ms delay between setting PDN and MCLKDIS */ @@ -506,8 +506,8 @@ static int cs42l73_spklo_spk_amp_event(struct snd_soc_dapm_widget *w, static int cs42l73_ear_amp_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 cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct cs42l73_private *priv = snd_soc_component_get_drvdata(component); switch (event) { case SND_SOC_DAPM_POST_PMD: /* 50 ms delay between setting PDN and MCLKDIS */ @@ -524,8 +524,8 @@ static int cs42l73_ear_amp_event(struct snd_soc_dapm_widget *w, static int cs42l73_hp_amp_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 cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct cs42l73_private *priv = snd_soc_component_get_drvdata(component); switch (event) { case SND_SOC_DAPM_POST_PMD: /* 30 ms delay between setting PDN and MCLKDIS */ @@ -884,8 +884,8 @@ static int cs42l73_get_mclk_coeff(int mclk, int srate) static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq) { - struct snd_soc_codec *codec = dai->codec; - struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs42l73_private *priv = snd_soc_component_get_drvdata(component); int mclkx_coeff; u32 mclk = 0; @@ -899,14 +899,14 @@ static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq) mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx / cs42l73_mclkx_coeffs[mclkx_coeff].ratio; - dev_dbg(codec->dev, "MCLK%u %u <-> internal MCLK %u\n", + dev_dbg(component->dev, "MCLK%u %u <-> internal MCLK %u\n", priv->mclksel + 1, cs42l73_mclkx_coeffs[mclkx_coeff].mclkx, mclk); dmmcc = (priv->mclksel << 4) | (cs42l73_mclkx_coeffs[mclkx_coeff].mclkdiv << 1); - snd_soc_write(codec, CS42L73_DMMCC, dmmcc); + snd_soc_component_write(component, CS42L73_DMMCC, dmmcc); priv->sysclk = mclkx_coeff; priv->mclk = mclk; @@ -917,8 +917,8 @@ static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq) static int cs42l73_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = dai->codec; - struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs42l73_private *priv = snd_soc_component_get_drvdata(component); switch (clk_id) { case CS42L73_CLKID_MCLK1: @@ -930,7 +930,7 @@ static int cs42l73_set_sysclk(struct snd_soc_dai *dai, } if ((cs42l73_set_mclk(dai, freq)) < 0) { - dev_err(codec->dev, "Unable to set MCLK for dai %s\n", + dev_err(component->dev, "Unable to set MCLK for dai %s\n", dai->name); return -EINVAL; } @@ -942,14 +942,14 @@ static int cs42l73_set_sysclk(struct snd_soc_dai *dai, static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs42l73_private *priv = snd_soc_component_get_drvdata(component); u8 id = codec_dai->id; unsigned int inv, format; u8 spc, mmcc; - spc = snd_soc_read(codec, CS42L73_SPC(id)); - mmcc = snd_soc_read(codec, CS42L73_MMCC(id)); + spc = snd_soc_component_read32(component, CS42L73_SPC(id)); + mmcc = snd_soc_component_read32(component, CS42L73_MMCC(id)); switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: @@ -974,12 +974,12 @@ static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) case SND_SOC_DAIFMT_DSP_A: case SND_SOC_DAIFMT_DSP_B: if (mmcc & CS42L73_MS_MASTER) { - dev_err(codec->dev, + dev_err(component->dev, "PCM format in slave mode only\n"); return -EINVAL; } if (id == CS42L73_ASP) { - dev_err(codec->dev, + dev_err(component->dev, "PCM format is not supported on ASP port\n"); return -EINVAL; } @@ -1029,7 +1029,7 @@ static unsigned int cs42l73_get_xspfs_coeff(u32 rate) return 0; /* 0 = Don't know */ } -static void cs42l73_update_asrc(struct snd_soc_codec *codec, int id, int srate) +static void cs42l73_update_asrc(struct snd_soc_component *component, int id, int srate) { u8 spfs = 0; @@ -1038,13 +1038,13 @@ static void cs42l73_update_asrc(struct snd_soc_codec *codec, int id, int srate) switch (id) { case CS42L73_XSP: - snd_soc_update_bits(codec, CS42L73_VXSPFS, 0x0f, spfs); + snd_soc_component_update_bits(component, CS42L73_VXSPFS, 0x0f, spfs); break; case CS42L73_ASP: - snd_soc_update_bits(codec, CS42L73_ASPC, 0x3c, spfs << 2); + snd_soc_component_update_bits(component, CS42L73_ASPC, 0x3c, spfs << 2); break; case CS42L73_VSP: - snd_soc_update_bits(codec, CS42L73_VXSPFS, 0xf0, spfs << 4); + snd_soc_component_update_bits(component, CS42L73_VXSPFS, 0xf0, spfs << 4); break; default: break; @@ -1055,8 +1055,8 @@ static int cs42l73_pcm_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 cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs42l73_private *priv = snd_soc_component_get_drvdata(component); int id = dai->id; int mclk_coeff; int srate = params_rate(params); @@ -1070,7 +1070,7 @@ static int cs42l73_pcm_hw_params(struct snd_pcm_substream *substream, if (mclk_coeff < 0) return -EINVAL; - dev_dbg(codec->dev, + dev_dbg(component->dev, "DAI[%d]: MCLK %u, srate %u, MMCC[5:0] = %x\n", id, priv->mclk, srate, cs42l73_mclk_coeffs[mclk_coeff].mmcc); @@ -1091,38 +1091,38 @@ static int cs42l73_pcm_hw_params(struct snd_pcm_substream *substream, /* Update ASRCs */ priv->config[id].srate = srate; - snd_soc_write(codec, CS42L73_SPC(id), priv->config[id].spc); - snd_soc_write(codec, CS42L73_MMCC(id), priv->config[id].mmcc); + snd_soc_component_write(component, CS42L73_SPC(id), priv->config[id].spc); + snd_soc_component_write(component, CS42L73_MMCC(id), priv->config[id].mmcc); - cs42l73_update_asrc(codec, id, srate); + cs42l73_update_asrc(component, id, srate); return 0; } -static int cs42l73_set_bias_level(struct snd_soc_codec *codec, +static int cs42l73_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec); + struct cs42l73_private *cs42l73 = snd_soc_component_get_drvdata(component); switch (level) { case SND_SOC_BIAS_ON: - snd_soc_update_bits(codec, CS42L73_DMMCC, CS42L73_MCLKDIS, 0); - snd_soc_update_bits(codec, CS42L73_PWRCTL1, CS42L73_PDN, 0); + snd_soc_component_update_bits(component, CS42L73_DMMCC, CS42L73_MCLKDIS, 0); + snd_soc_component_update_bits(component, CS42L73_PWRCTL1, CS42L73_PDN, 0); break; case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { regcache_cache_only(cs42l73->regmap, false); regcache_sync(cs42l73->regmap); } - snd_soc_update_bits(codec, CS42L73_PWRCTL1, CS42L73_PDN, 1); + snd_soc_component_update_bits(component, CS42L73_PWRCTL1, CS42L73_PDN, 1); break; case SND_SOC_BIAS_OFF: - snd_soc_update_bits(codec, CS42L73_PWRCTL1, CS42L73_PDN, 1); + snd_soc_component_update_bits(component, CS42L73_PWRCTL1, CS42L73_PDN, 1); if (cs42l73->shutdwn_delay > 0) { mdelay(cs42l73->shutdwn_delay); cs42l73->shutdwn_delay = 0; @@ -1131,7 +1131,7 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec, * down. */ } - snd_soc_update_bits(codec, CS42L73_DMMCC, CS42L73_MCLKDIS, 1); + snd_soc_component_update_bits(component, CS42L73_DMMCC, CS42L73_MCLKDIS, 1); break; } return 0; @@ -1139,10 +1139,10 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec, static int cs42l73_set_tristate(struct snd_soc_dai *dai, int tristate) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; int id = dai->id; - return snd_soc_update_bits(codec, CS42L73_SPC(id), CS42L73_SP_3ST, + return snd_soc_component_update_bits(component, CS42L73_SPC(id), CS42L73_SP_3ST, tristate << 7); } @@ -1235,13 +1235,13 @@ static struct snd_soc_dai_driver cs42l73_dai[] = { } }; -static int cs42l73_probe(struct snd_soc_codec *codec) +static int cs42l73_probe(struct snd_soc_component *component) { - struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec); + struct cs42l73_private *cs42l73 = snd_soc_component_get_drvdata(component); /* Set Charge Pump Frequency */ if (cs42l73->pdata.chgfreq) - snd_soc_update_bits(codec, CS42L73_CPFCHC, + snd_soc_component_update_bits(component, CS42L73_CPFCHC, CS42L73_CHARGEPUMP_MASK, cs42l73->pdata.chgfreq << 4); @@ -1252,19 +1252,20 @@ static int cs42l73_probe(struct snd_soc_codec *codec) return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_cs42l73 = { - .probe = cs42l73_probe, - .set_bias_level = cs42l73_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = cs42l73_snd_controls, - .num_controls = ARRAY_SIZE(cs42l73_snd_controls), - .dapm_widgets = cs42l73_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs42l73_dapm_widgets), - .dapm_routes = cs42l73_audio_map, - .num_dapm_routes = ARRAY_SIZE(cs42l73_audio_map), - }, +static const struct snd_soc_component_driver soc_component_dev_cs42l73 = { + .probe = cs42l73_probe, + .set_bias_level = cs42l73_set_bias_level, + .controls = cs42l73_snd_controls, + .num_controls = ARRAY_SIZE(cs42l73_snd_controls), + .dapm_widgets = cs42l73_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs42l73_dapm_widgets), + .dapm_routes = cs42l73_audio_map, + .num_dapm_routes = ARRAY_SIZE(cs42l73_audio_map), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config cs42l73_regmap = { @@ -1361,20 +1362,14 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client, dev_info(&i2c_client->dev, "Cirrus Logic CS42L73, Revision: %02X\n", reg & 0xFF); - ret = snd_soc_register_codec(&i2c_client->dev, - &soc_codec_dev_cs42l73, cs42l73_dai, + ret = devm_snd_soc_register_component(&i2c_client->dev, + &soc_component_dev_cs42l73, cs42l73_dai, ARRAY_SIZE(cs42l73_dai)); if (ret < 0) return ret; return 0; } -static int cs42l73_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct of_device_id cs42l73_of_match[] = { { .compatible = "cirrus,cs42l73", }, {}, @@ -1395,7 +1390,6 @@ static struct i2c_driver cs42l73_i2c_driver = { }, .id_table = cs42l73_id, .probe = cs42l73_i2c_probe, - .remove = cs42l73_i2c_remove, };