From patchwork Mon Feb 12 12:46:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128091 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3205974ljc; Mon, 12 Feb 2018 05:24:04 -0800 (PST) X-Google-Smtp-Source: AH8x226eATPMQKlFHz/Kgr388SXnyIGvIugGaL7xH7p4ij7vz42o98dm7CrW4ACKO5d58mMMdmRl X-Received: by 10.223.182.3 with SMTP id f3mr10117232wre.92.1518441844076; Mon, 12 Feb 2018 05:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441844; cv=none; d=google.com; s=arc-20160816; b=Umrgi+PwH52snJjYorAQRspmmZKCvJmAkwbdJmBDhskoJZ9RiR7URWCzgnSF7i0dmx HdjJY51TLjhSNw2NSBi+223RHYzz2Hi48FYrJdeDUD/7zq0RWPMhBsgCoD4NgQM9cL5H Lr7rAyrCoEANolLwFOLyNe8cOea9xiQuUcdIiJ4yvlRkaMvFvKrfMH6QR67vW4PPXSV8 KxZo8PsXlAam29qozE/osg3zGVfRvMprGUcWAMI4wqiv66aQyegjTtFx16EjZgpZ1jj0 g0jYSr4D1W3aYe/O6gI3I/N9u7q70/d/erJ+kd2aQOprP3dfHELNlQZrQBEc2L8flU61 rbzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=0ulRIe6inVYJPUWLrDjJHC7MC7OOQ1f1pwMHepqv/tk=; b=pa4Hx7B2FjHZ7V0xJkUW5E5/lglOYLMo2C/KobI12MRyyrIwZwmZ1EtIpwtSOVUnGM 0nJMcyJl58mZjV/mFg0VgMTDqczc5CBlj43km3nQKr6wPBxZqjC9cRhGVfPK+iBQomMm 1N0Ed8OE7sVKrh0kkRXlqmxJEx8c6uPpXy3jcif6cHIfL/M98b+tbqSFgQ346XNzGXV3 jKSAdz1zhnvDMvzELJzxwS02yzrSei9/OMGVZaIkNfCgtHuGYZB58SPXBnSk6qKmB2ez X7VJCHvAkIFdmRPNLWPqryYRnm/N33zgh4O3EORRKFfPwn8zWstA7Ep3R85oy+f4T77Z Dc2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=ux2AhY3W; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id 132si3762549wmg.109.2018.02.12.05.24.03; Mon, 12 Feb 2018 05:24:04 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=ux2AhY3W; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0492E26883C; Mon, 12 Feb 2018 14:21:06 +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 D875626883D; Mon, 12 Feb 2018 14:21:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 6D0F72675E7 for ; Mon, 12 Feb 2018 13:46:10 +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=RXRBtWH2jRKiANYISfU94Idc+eHKa+TgIguTQGpNb2A=; b=ux2AhY3Wa3MG gxQstdy082Yv1HKqhGFPaU1JyZmzHWa2BsTLzqbyqolTW8CZddIbslyH2K2Lm2UO017hBDhRh/WvE LN9GyOvacObMlk3owkl2/7+M1TNP284K/K2CLkwNahQY9nLmJJgcwkip1xaZOCYjjpiAa7cmVdhnb FpOKU=; 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 1elDUm-0002RS-NY; Mon, 12 Feb 2018 12:46:08 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDUm-0005Sn-90; Mon, 12 Feb 2018 12:46:08 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87fu6p2wb6.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:46:08 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: ak4642: 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 The patch ASoC: ak4642: 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 43c5d0f05ec55aa71680744ffcaa1aa6fd8a9bab Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:13:07 +0000 Subject: [PATCH] ASoC: ak4642: 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/ak4642.c | 105 ++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 55 deletions(-) -- 2.16.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 29530c567bd9..9c35e91d412d 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -178,19 +178,19 @@ static const struct snd_kcontrol_new ak4642_lout_mixer_controls[] = { static int ak4642_lout_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: case SND_SOC_DAPM_PRE_PMU: /* Power save mode ON */ - snd_soc_update_bits(codec, SG_SL2, LOPS, LOPS); + snd_soc_component_update_bits(component, SG_SL2, LOPS, LOPS); break; case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMD: /* Power save mode OFF */ msleep(300); - snd_soc_update_bits(codec, SG_SL2, LOPS, 0); + snd_soc_component_update_bits(component, SG_SL2, LOPS, 0); break; } @@ -282,7 +282,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; if (is_play) { /* @@ -295,8 +295,8 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, * This operation came from example code of * "ASAHI KASEI AK4642" (japanese) manual p97. */ - snd_soc_write(codec, L_IVC, 0x91); /* volume */ - snd_soc_write(codec, R_IVC, 0x91); /* volume */ + snd_soc_component_write(component, L_IVC, 0x91); /* volume */ + snd_soc_component_write(component, R_IVC, 0x91); /* volume */ } else { /* * start stereo input @@ -311,11 +311,11 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, * This operation came from example code of * "ASAHI KASEI AK4642" (japanese) manual p94. */ - snd_soc_update_bits(codec, SG_SL1, PMMP | MGAIN0, PMMP | MGAIN0); - snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); - snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); - snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL); - snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR); + snd_soc_component_update_bits(component, SG_SL1, PMMP | MGAIN0, PMMP | MGAIN0); + snd_soc_component_write(component, TIMER, ZTM(0x3) | WTM(0x3)); + snd_soc_component_write(component, ALC_CTL1, ALC | LMTH0); + snd_soc_component_update_bits(component, PW_MGMT1, PMADL, PMADL); + snd_soc_component_update_bits(component, PW_MGMT3, PMADR, PMADR); } return 0; @@ -325,22 +325,22 @@ static void ak4642_dai_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; if (is_play) { } else { /* stop stereo input */ - snd_soc_update_bits(codec, PW_MGMT1, PMADL, 0); - snd_soc_update_bits(codec, PW_MGMT3, PMADR, 0); - snd_soc_update_bits(codec, ALC_CTL1, ALC, 0); + snd_soc_component_update_bits(component, PW_MGMT1, PMADL, 0); + snd_soc_component_update_bits(component, PW_MGMT3, PMADR, 0); + snd_soc_component_update_bits(component, ALC_CTL1, ALC, 0); } } static int ak4642_dai_set_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = codec_dai->codec; - struct ak4642_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct ak4642_priv *priv = snd_soc_component_get_drvdata(component); u8 pll; int extended_freq = 0; @@ -382,14 +382,14 @@ static int ak4642_dai_set_sysclk(struct snd_soc_dai *codec_dai, if (extended_freq && !priv->drvdata->extended_frequencies) return -EINVAL; - snd_soc_update_bits(codec, MD_CTL1, PLL_MASK, pll); + snd_soc_component_update_bits(component, MD_CTL1, PLL_MASK, pll); return 0; } static int ak4642_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; u8 data; u8 bcko; @@ -407,8 +407,8 @@ static int ak4642_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) default: return -EINVAL; } - snd_soc_update_bits(codec, PW_MGMT2, MS | MCKO | PMPLL, data); - snd_soc_update_bits(codec, MD_CTL1, BCKO_MASK, bcko); + snd_soc_component_update_bits(component, PW_MGMT2, MS | MCKO | PMPLL, data); + snd_soc_component_update_bits(component, MD_CTL1, BCKO_MASK, bcko); /* format type */ data = 0; @@ -425,12 +425,12 @@ static int ak4642_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) default: return -EINVAL; } - snd_soc_update_bits(codec, MD_CTL1, DIF_MASK, data); + snd_soc_component_update_bits(component, MD_CTL1, DIF_MASK, data); return 0; } -static int ak4642_set_mcko(struct snd_soc_codec *codec, +static int ak4642_set_mcko(struct snd_soc_component *component, u32 frequency) { static const u32 fs_list[] = { @@ -458,7 +458,7 @@ static int ak4642_set_mcko(struct snd_soc_codec *codec, for (ps = 0; ps < ARRAY_SIZE(ps_list); ps++) { for (fs = 0; fs < ARRAY_SIZE(fs_list); fs++) { if (frequency == ps_list[ps] * fs_list[fs]) { - snd_soc_write(codec, MD_CTL2, + snd_soc_component_write(component, MD_CTL2, PSs(ps) | FSs(fs)); return 0; } @@ -472,25 +472,25 @@ static int ak4642_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 ak4642_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4642_priv *priv = snd_soc_component_get_drvdata(component); u32 rate = clk_get_rate(priv->mcko); if (!rate) rate = params_rate(params) * 256; - return ak4642_set_mcko(codec, rate); + return ak4642_set_mcko(component, rate); } -static int ak4642_set_bias_level(struct snd_soc_codec *codec, +static int ak4642_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { switch (level) { case SND_SOC_BIAS_OFF: - snd_soc_write(codec, PW_MGMT1, 0x00); + snd_soc_component_write(component, PW_MGMT1, 0x00); break; default: - snd_soc_update_bits(codec, PW_MGMT1, PMVCM, PMVCM); + snd_soc_component_update_bits(component, PW_MGMT1, PMVCM, PMVCM); break; } @@ -523,46 +523,48 @@ static struct snd_soc_dai_driver ak4642_dai = { .symmetric_rates = 1, }; -static int ak4642_suspend(struct snd_soc_codec *codec) +static int ak4642_suspend(struct snd_soc_component *component) { - struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + struct regmap *regmap = dev_get_regmap(component->dev, NULL); regcache_cache_only(regmap, true); regcache_mark_dirty(regmap); return 0; } -static int ak4642_resume(struct snd_soc_codec *codec) +static int ak4642_resume(struct snd_soc_component *component) { - struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + struct regmap *regmap = dev_get_regmap(component->dev, NULL); regcache_cache_only(regmap, false); regcache_sync(regmap); return 0; } -static int ak4642_probe(struct snd_soc_codec *codec) +static int ak4642_probe(struct snd_soc_component *component) { - struct ak4642_priv *priv = snd_soc_codec_get_drvdata(codec); + struct ak4642_priv *priv = snd_soc_component_get_drvdata(component); if (priv->mcko) - ak4642_set_mcko(codec, clk_get_rate(priv->mcko)); + ak4642_set_mcko(component, clk_get_rate(priv->mcko)); return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_ak4642 = { +static const struct snd_soc_component_driver soc_component_dev_ak4642 = { .probe = ak4642_probe, .suspend = ak4642_suspend, .resume = ak4642_resume, .set_bias_level = ak4642_set_bias_level, - .component_driver = { - .controls = ak4642_snd_controls, - .num_controls = ARRAY_SIZE(ak4642_snd_controls), - .dapm_widgets = ak4642_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ak4642_dapm_widgets), - .dapm_routes = ak4642_intercon, - .num_dapm_routes = ARRAY_SIZE(ak4642_intercon), - }, + .controls = ak4642_snd_controls, + .num_controls = ARRAY_SIZE(ak4642_snd_controls), + .dapm_widgets = ak4642_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak4642_dapm_widgets), + .dapm_routes = ak4642_intercon, + .num_dapm_routes = ARRAY_SIZE(ak4642_intercon), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config ak4642_regmap = { @@ -675,14 +677,8 @@ static int ak4642_i2c_probe(struct i2c_client *i2c, if (IS_ERR(regmap)) return PTR_ERR(regmap); - return snd_soc_register_codec(dev, - &soc_codec_dev_ak4642, &ak4642_dai, 1); -} - -static int ak4642_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; + return devm_snd_soc_register_component(dev, + &soc_component_dev_ak4642, &ak4642_dai, 1); } static const struct of_device_id ak4642_of_match[] = { @@ -707,7 +703,6 @@ static struct i2c_driver ak4642_i2c_driver = { .of_match_table = ak4642_of_match, }, .probe = ak4642_i2c_probe, - .remove = ak4642_i2c_remove, .id_table = ak4642_i2c_id, };