From patchwork Mon Feb 19 12:18:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10227637 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 5AE61602DC for ; Mon, 19 Feb 2018 12:19:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49BF728421 for ; Mon, 19 Feb 2018 12:19:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E85F28A46; Mon, 19 Feb 2018 12:19:56 +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 3C35028421 for ; Mon, 19 Feb 2018 12:19:55 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 185C62674D2; Mon, 19 Feb 2018 13:19:54 +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 7915B2674CE; Mon, 19 Feb 2018 13:19:52 +0100 (CET) Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 8456B267475 for ; Mon, 19 Feb 2018 13:19:31 +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=QjRoyn1lViy97xKEVMcLJunnr3k9FwpS0z2Jsr61MIM=; b=cjSrChNVSEIz mhIHEWSUhwgl0npbpfUxsvPZa/IDFV0nonymHKS9389id9RoZx+3FWKrl2IPKuFH6GizQUM+oA1F6 tRtjF9gAyxKblKassPZwjJ88aZB0l+t5cI4r7DNWIAzVpoB/MWLJxJRnzhPyTqqnGoIMR6rcTVAt4 Mwf8o=; 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 1enkPH-0003Tp-La; Mon, 19 Feb 2018 12:18:55 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1enkPH-0002nD-6F; Mon, 19 Feb 2018 12:18:55 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87o9klobs9.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 19 Feb 2018 12:18:55 +0000 Cc: alsa-devel@alsa-project.org, Liam Girdwood , Harsha Priya , Shengjiu Wang , Takashi Iwai , linux-kernel@vger.kernel.org, Junichi Wakasugi , Pierre-Louis Bossart , Cosmin-Gabriel Samoila , Mark Brown , Sathyanarayana Nujella , Mihai Serban , Naveen Manohar , Dylan Reid , Akshu Agrawal , Daniel Baluta , Fabio Estevam , Alex Deucher Subject: [alsa-devel] Applied "ASoC: ak5558: 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: ak5558: 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 3f15aa198fb88a6a0db8c7ba136637d566effb55 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 19 Feb 2018 04:17:16 +0000 Subject: [PATCH] ASoC: ak5558: 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/ak5558.c | 67 +++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c index 225173ff4efa..f2248315677e 100644 --- a/sound/soc/codecs/ak5558.c +++ b/sound/soc/codecs/ak5558.c @@ -25,7 +25,7 @@ /* AK5558 Codec Private Data */ struct ak5558_priv { - struct snd_soc_codec codec; + struct snd_soc_component component; struct regmap *regmap; struct i2c_client *i2c; struct gpio_desc *reset_gpiod; /* Reset & Power down GPIO */ @@ -116,9 +116,9 @@ static const struct snd_soc_dapm_route ak5558_intercon[] = { {"SDTO", NULL, "ADC Ch8"}, }; -static int ak5558_set_mcki(struct snd_soc_codec *codec) +static int ak5558_set_mcki(struct snd_soc_component *component) { - return snd_soc_update_bits(codec, AK5558_02_CONTROL1, AK5558_CKS, + return snd_soc_component_update_bits(component, AK5558_02_CONTROL1, AK5558_CKS, AK5558_CKS_AUTO); } @@ -126,13 +126,13 @@ static int ak5558_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 ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component); u8 bits; int pcm_width = max(params_physical_width(params), ak5558->slot_width); /* set master/slave audio interface */ - bits = snd_soc_read(codec, AK5558_02_CONTROL1); + bits = snd_soc_component_read32(component, AK5558_02_CONTROL1); bits &= ~AK5558_BITS; switch (pcm_width) { @@ -146,14 +146,14 @@ static int ak5558_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - snd_soc_update_bits(codec, AK5558_02_CONTROL1, AK5558_BITS, bits); + snd_soc_component_update_bits(component, AK5558_02_CONTROL1, AK5558_BITS, bits); return 0; } static int ak5558_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; u8 format; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -169,7 +169,7 @@ static int ak5558_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) } /* set master/slave audio interface */ - format = snd_soc_read(codec, AK5558_02_CONTROL1); + format = snd_soc_component_read32(component, AK5558_02_CONTROL1); format &= ~AK5558_DIF; switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -186,7 +186,7 @@ static int ak5558_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EINVAL; } - snd_soc_update_bits(codec, AK5558_02_CONTROL1, AK5558_DIF, format); + snd_soc_component_update_bits(component, AK5558_02_CONTROL1, AK5558_DIF, format); return 0; } @@ -195,8 +195,8 @@ static int ak5558_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) { - struct snd_soc_codec *codec = dai->codec; - struct ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component); int tdm_mode; ak5558->slots = slots; @@ -217,7 +217,7 @@ static int ak5558_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, break; } - snd_soc_update_bits(codec, AK5558_03_CONTROL2, AK5558_MODE_BITS, + snd_soc_component_update_bits(component, AK5558_03_CONTROL2, AK5558_MODE_BITS, tdm_mode); return 0; } @@ -285,21 +285,19 @@ static void ak5558_power_on(struct ak5558_priv *ak5558) usleep_range(1000, 2000); } -static int ak5558_probe(struct snd_soc_codec *codec) +static int ak5558_probe(struct snd_soc_component *component) { - struct ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec); + struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component); ak5558_power_on(ak5558); - return ak5558_set_mcki(codec); + return ak5558_set_mcki(component); } -static int ak5558_remove(struct snd_soc_codec *codec) +static void ak5558_remove(struct snd_soc_component *component) { - struct ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec); + struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component); ak5558_power_off(ak5558); - - return 0; } static int __maybe_unused ak5558_runtime_suspend(struct device *dev) @@ -331,18 +329,19 @@ const struct dev_pm_ops ak5558_pm = { pm_runtime_force_resume) }; -struct snd_soc_codec_driver soc_codec_dev_ak5558 = { - .probe = ak5558_probe, - .remove = ak5558_remove, - - .component_driver = { - .controls = ak5558_snd_controls, - .num_controls = ARRAY_SIZE(ak5558_snd_controls), - .dapm_widgets = ak5558_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ak5558_dapm_widgets), - .dapm_routes = ak5558_intercon, - .num_dapm_routes = ARRAY_SIZE(ak5558_intercon), - }, +struct snd_soc_component_driver soc_codec_dev_ak5558 = { + .probe = ak5558_probe, + .remove = ak5558_remove, + .controls = ak5558_snd_controls, + .num_controls = ARRAY_SIZE(ak5558_snd_controls), + .dapm_widgets = ak5558_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak5558_dapm_widgets), + .dapm_routes = ak5558_intercon, + .num_dapm_routes = ARRAY_SIZE(ak5558_intercon), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config ak5558_regmap = { @@ -376,7 +375,8 @@ static int ak5558_i2c_probe(struct i2c_client *i2c) if (IS_ERR(ak5558->reset_gpiod)) return PTR_ERR(ak5558->reset_gpiod); - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak5558, + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_codec_dev_ak5558, &ak5558_dai, 1); if (ret) return ret; @@ -388,7 +388,6 @@ static int ak5558_i2c_probe(struct i2c_client *i2c) static int ak5558_i2c_remove(struct i2c_client *i2c) { - snd_soc_unregister_codec(&i2c->dev); pm_runtime_disable(&i2c->dev); return 0;