From patchwork Mon Feb 12 12:34:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10212481 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 F2C3F60467 for ; Mon, 12 Feb 2018 12:41:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA44B28A4B for ; Mon, 12 Feb 2018 12:41:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF17228B92; Mon, 12 Feb 2018 12:41:35 +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 B25FB28A4B for ; Mon, 12 Feb 2018 12:41:34 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 772C3267BE9; Mon, 12 Feb 2018 13:41:10 +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 53CE9267BE9; Mon, 12 Feb 2018 13:41:09 +0100 (CET) Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 082A0267572 for ; Mon, 12 Feb 2018 13:34:19 +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=zR4Lrr+L6xnuoCIv9d1zPDW2S8ogsUVWG8TMiYc7Uvo=; b=gdwP6H5gcmpP mCoZGfOTsRJ3Tv4yWl6Rs+g2HBH90xON4mIPIasd+qHxta+7gg2svfZrVwRQv0HHqN3QJfH2xYDag jbbYC7PnOOjLz5I/tANRYxOx6dHf6i367VRYgqKEaGb3kI8p0+oGQvWJ6vwzvAboGFBqxXcz59c6R LWWz0=; 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 1elDJJ-000244-Bm; Mon, 12 Feb 2018 12:34:17 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDJI-0003gf-Tl; Mon, 12 Feb 2018 12:34:16 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87bmhduvfo.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:34:16 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: ml26124: 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: ml26124: 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 a9886cd02af5df2a93af178123194bf638cead03 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 04:44:35 +0000 Subject: [PATCH] ASoC: ml26124: 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/ml26124.c | 103 +++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c index 5cc960d8211e..a5fa490dc145 100644 --- a/sound/soc/codecs/ml26124.c +++ b/sound/soc/codecs/ml26124.c @@ -338,8 +338,8 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); int i = get_coeff(priv->mclk, params_rate(hw_params)); int srate; @@ -351,23 +351,23 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, if (priv->clk_in) { switch (priv->mclk / params_rate(hw_params)) { case 256: - snd_soc_update_bits(codec, ML26124_CLK_CTL, + snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 1); break; case 512: - snd_soc_update_bits(codec, ML26124_CLK_CTL, + snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 2); break; case 1024: - snd_soc_update_bits(codec, ML26124_CLK_CTL, + snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 3); break; default: - dev_err(codec->dev, "Unsupported MCLKI\n"); + dev_err(component->dev, "Unsupported MCLKI\n"); break; } } else { - snd_soc_update_bits(codec, ML26124_CLK_CTL, + snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 0); } @@ -375,35 +375,35 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, if (srate < 0) return srate; - snd_soc_update_bits(codec, ML26124_SMPLING_RATE, 0xf, srate); - snd_soc_update_bits(codec, ML26124_PLLNL, 0xff, coeff_div[i].pllnl); - snd_soc_update_bits(codec, ML26124_PLLNH, 0x1, coeff_div[i].pllnh); - snd_soc_update_bits(codec, ML26124_PLLML, 0xff, coeff_div[i].pllml); - snd_soc_update_bits(codec, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh); - snd_soc_update_bits(codec, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv); + snd_soc_component_update_bits(component, ML26124_SMPLING_RATE, 0xf, srate); + snd_soc_component_update_bits(component, ML26124_PLLNL, 0xff, coeff_div[i].pllnl); + snd_soc_component_update_bits(component, ML26124_PLLNH, 0x1, coeff_div[i].pllnh); + snd_soc_component_update_bits(component, ML26124_PLLML, 0xff, coeff_div[i].pllml); + snd_soc_component_update_bits(component, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh); + snd_soc_component_update_bits(component, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv); return 0; } static int ml26124_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (priv->substream->stream) { case SNDRV_PCM_STREAM_CAPTURE: - snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, BIT(0), 1); + snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(0), 1); break; case SNDRV_PCM_STREAM_PLAYBACK: - snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, BIT(1), 2); + snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(1), 2); break; } if (mute) - snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4), + snd_soc_component_update_bits(component, ML26124_DVOL_CTL, BIT(4), DVOL_CTL_DVMUTE_ON); else - snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4), + snd_soc_component_update_bits(component, ML26124_DVOL_CTL, BIT(4), DVOL_CTL_DVMUTE_OFF); return 0; @@ -413,7 +413,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { unsigned char mode; - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -426,7 +426,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, default: return -EINVAL; } - snd_soc_update_bits(codec, ML26124_SAI_MODE_SEL, BIT(0), mode); + snd_soc_component_update_bits(component, ML26124_SAI_MODE_SEL, BIT(0), mode); /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -450,8 +450,8 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ml26124_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 ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (clk_id) { case ML26124_USE_PLLOUT: @@ -469,17 +469,17 @@ static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai, return 0; } -static int ml26124_set_bias_level(struct snd_soc_codec *codec, +static int ml26124_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); + struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (level) { case SND_SOC_BIAS_ON: - snd_soc_update_bits(codec, ML26124_PW_SPAMP_PW_MNG, + snd_soc_component_update_bits(component, ML26124_PW_SPAMP_PW_MNG, ML26124_R26_MASK, ML26124_BLT_PREAMP_ON); msleep(100); - snd_soc_update_bits(codec, ML26124_PW_SPAMP_PW_MNG, + snd_soc_component_update_bits(component, ML26124_PW_SPAMP_PW_MNG, ML26124_R26_MASK, ML26124_MICBEN_ON | ML26124_BLT_ALL_ON); break; @@ -487,8 +487,8 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* VMID ON */ - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { - snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { + snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG, ML26124_VMID, ML26124_VMID); msleep(500); regcache_sync(priv->regmap); @@ -496,7 +496,7 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_OFF: /* VMID OFF */ - snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, + snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG, ML26124_VMID, 0); break; } @@ -528,27 +528,29 @@ static struct snd_soc_dai_driver ml26124_dai = { .symmetric_rates = 1, }; -static int ml26124_probe(struct snd_soc_codec *codec) +static int ml26124_probe(struct snd_soc_component *component) { /* Software Reset */ - snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 1); - snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 0); + snd_soc_component_update_bits(component, ML26124_SW_RST, 0x01, 1); + snd_soc_component_update_bits(component, ML26124_SW_RST, 0x01, 0); return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_ml26124 = { - .probe = ml26124_probe, - .set_bias_level = ml26124_set_bias_level, - .suspend_bias_off = true, - .component_driver = { - .controls = ml26124_snd_controls, - .num_controls = ARRAY_SIZE(ml26124_snd_controls), - .dapm_widgets = ml26124_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ml26124_dapm_widgets), - .dapm_routes = ml26124_intercon, - .num_dapm_routes = ARRAY_SIZE(ml26124_intercon), - }, +static const struct snd_soc_component_driver soc_component_dev_ml26124 = { + .probe = ml26124_probe, + .set_bias_level = ml26124_set_bias_level, + .controls = ml26124_snd_controls, + .num_controls = ARRAY_SIZE(ml26124_snd_controls), + .dapm_widgets = ml26124_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ml26124_dapm_widgets), + .dapm_routes = ml26124_intercon, + .num_dapm_routes = ARRAY_SIZE(ml26124_intercon), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config ml26124_i2c_regmap = { @@ -580,14 +582,8 @@ static int ml26124_i2c_probe(struct i2c_client *i2c, return ret; } - return snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_ml26124, &ml26124_dai, 1); -} - -static int ml26124_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; + return devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_ml26124, &ml26124_dai, 1); } static const struct i2c_device_id ml26124_i2c_id[] = { @@ -601,7 +597,6 @@ static struct i2c_driver ml26124_i2c_driver = { .name = "ml26124", }, .probe = ml26124_i2c_probe, - .remove = ml26124_i2c_remove, .id_table = ml26124_i2c_id, };