From patchwork Mon Feb 12 12:50:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10212949 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 E34DD60329 for ; Mon, 12 Feb 2018 13:32:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D12531FE8A for ; Mon, 12 Feb 2018 13:32:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C40B1223C7; Mon, 12 Feb 2018 13:32:53 +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 81D4A1FE8A for ; Mon, 12 Feb 2018 13:32:52 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 99F92268C2E; Mon, 12 Feb 2018 14:31:09 +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 F30C1268C2E; Mon, 12 Feb 2018 14:31:07 +0100 (CET) Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 32B1B267FE1 for ; Mon, 12 Feb 2018 13:50:22 +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=TUXWRyhZSyton9LB0u0jA2rlztLUYMwYn2lwKyQ6WFg=; b=VekjSb/8dDPB 3TkkIrL/J0ezRuDllFCj0MFTdZB5xbwu9jM2JjbtXGnFKH9SvhSIL4ONig6IcV35L6uEYm9L3jUz2 pm+wnAXG44/rtFETJ8/GECgT9NJNdj/h/0E+CZ5hXGThXmK8GUJGCZjuSOWYoGfjKE/22Fyxa2ii9 LC1/w=; 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 1elDYq-0002Vr-96; Mon, 12 Feb 2018 12:50:20 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDYp-0006DD-Qw; Mon, 12 Feb 2018 12:50:19 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87tvv54bdc.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:50:19 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: wm8770: 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: wm8770: 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 502cb3a293be22f95737480902ed3450c06b276a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:02:29 +0000 Subject: [PATCH] ASoC: wm8770: 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 = 1 -> .idle_bias_on = 0 .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/wm8770.c | 131 ++++++++++++++++++++++------------------------ 1 file changed, 64 insertions(+), 67 deletions(-) diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index d6edcbbdec12..806245c70f8b 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -84,7 +84,7 @@ struct wm8770_priv { struct regmap *regmap; struct regulator_bulk_data supplies[WM8770_NUM_SUPPLIES]; struct notifier_block disable_nb[WM8770_NUM_SUPPLIES]; - struct snd_soc_codec *codec; + struct snd_soc_component *component; int sysclk; }; @@ -308,14 +308,14 @@ static const struct snd_soc_dapm_route wm8770_intercon[] = { static int vout12supply_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_PMU: - snd_soc_update_bits(codec, WM8770_OUTMUX1, 0x180, 0); + snd_soc_component_update_bits(component, WM8770_OUTMUX1, 0x180, 0); break; case SND_SOC_DAPM_POST_PMD: - snd_soc_update_bits(codec, WM8770_OUTMUX1, 0x180, 0x180); + snd_soc_component_update_bits(component, WM8770_OUTMUX1, 0x180, 0x180); break; } @@ -325,31 +325,31 @@ static int vout12supply_event(struct snd_soc_dapm_widget *w, static int vout34supply_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_PMU: - snd_soc_update_bits(codec, WM8770_OUTMUX2, 0x180, 0); + snd_soc_component_update_bits(component, WM8770_OUTMUX2, 0x180, 0); break; case SND_SOC_DAPM_POST_PMD: - snd_soc_update_bits(codec, WM8770_OUTMUX2, 0x180, 0x180); + snd_soc_component_update_bits(component, WM8770_OUTMUX2, 0x180, 0x180); break; } return 0; } -static int wm8770_reset(struct snd_soc_codec *codec) +static int wm8770_reset(struct snd_soc_component *component) { - return snd_soc_write(codec, WM8770_RESET, 0); + return snd_soc_component_write(component, WM8770_RESET, 0); } static int wm8770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec; + struct snd_soc_component *component; int iface, master; - codec = dai->codec; + component = dai->component; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: @@ -392,8 +392,8 @@ static int wm8770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EINVAL; } - snd_soc_update_bits(codec, WM8770_IFACECTRL, 0xf, iface); - snd_soc_update_bits(codec, WM8770_MSTRCTRL, 0x100, master); + snd_soc_component_update_bits(component, WM8770_IFACECTRL, 0xf, iface); + snd_soc_component_update_bits(component, WM8770_MSTRCTRL, 0x100, master); return 0; } @@ -411,15 +411,15 @@ static int wm8770_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec; + struct snd_soc_component *component; struct wm8770_priv *wm8770; int i; int iface; int shift; int ratio; - codec = dai->codec; - wm8770 = snd_soc_codec_get_drvdata(codec); + component = dai->component; + wm8770 = snd_soc_component_get_drvdata(component); iface = 0; switch (params_width(params)) { @@ -450,7 +450,7 @@ static int wm8770_hw_params(struct snd_pcm_substream *substream, } /* Only need to set MCLK/LRCLK ratio if we're master */ - if (snd_soc_read(codec, WM8770_MSTRCTRL) & 0x100) { + if (snd_soc_component_read32(component, WM8770_MSTRCTRL) & 0x100) { for (; i < ARRAY_SIZE(mclk_ratios); ++i) { ratio = wm8770->sysclk / params_rate(params); if (ratio == mclk_ratios[i]) @@ -458,51 +458,51 @@ static int wm8770_hw_params(struct snd_pcm_substream *substream, } if (i == ARRAY_SIZE(mclk_ratios)) { - dev_err(codec->dev, + dev_err(component->dev, "Unable to configure MCLK ratio %d/%d\n", wm8770->sysclk, params_rate(params)); return -EINVAL; } - dev_dbg(codec->dev, "MCLK is %dfs\n", mclk_ratios[i]); + dev_dbg(component->dev, "MCLK is %dfs\n", mclk_ratios[i]); - snd_soc_update_bits(codec, WM8770_MSTRCTRL, 0x7 << shift, + snd_soc_component_update_bits(component, WM8770_MSTRCTRL, 0x7 << shift, i << shift); } - snd_soc_update_bits(codec, WM8770_IFACECTRL, 0x30, iface); + snd_soc_component_update_bits(component, WM8770_IFACECTRL, 0x30, iface); return 0; } static int wm8770_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec; + struct snd_soc_component *component; - codec = dai->codec; - return snd_soc_update_bits(codec, WM8770_DACMUTE, 0x10, + component = dai->component; + return snd_soc_component_update_bits(component, WM8770_DACMUTE, 0x10, !!mute << 4); } static int wm8770_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec; + struct snd_soc_component *component; struct wm8770_priv *wm8770; - codec = dai->codec; - wm8770 = snd_soc_codec_get_drvdata(codec); + component = dai->component; + wm8770 = snd_soc_component_get_drvdata(component); wm8770->sysclk = freq; return 0; } -static int wm8770_set_bias_level(struct snd_soc_codec *codec, +static int wm8770_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { int ret; struct wm8770_priv *wm8770; - wm8770 = snd_soc_codec_get_drvdata(codec); + wm8770 = snd_soc_component_get_drvdata(component); switch (level) { case SND_SOC_BIAS_ON: @@ -510,11 +510,11 @@ static int wm8770_set_bias_level(struct snd_soc_codec *codec, 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) { ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); if (ret) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to enable supplies: %d\n", ret); return ret; @@ -523,12 +523,12 @@ static int wm8770_set_bias_level(struct snd_soc_codec *codec, regcache_sync(wm8770->regmap); /* global powerup */ - snd_soc_write(codec, WM8770_PWDNCTRL, 0); + snd_soc_component_write(component, WM8770_PWDNCTRL, 0); } break; case SND_SOC_BIAS_OFF: /* global powerdown */ - snd_soc_write(codec, WM8770_PWDNCTRL, 1); + snd_soc_component_write(component, WM8770_PWDNCTRL, 1); regulator_bulk_disable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); break; @@ -567,60 +567,59 @@ static struct snd_soc_dai_driver wm8770_dai = { .symmetric_rates = 1 }; -static int wm8770_probe(struct snd_soc_codec *codec) +static int wm8770_probe(struct snd_soc_component *component) { struct wm8770_priv *wm8770; int ret; - wm8770 = snd_soc_codec_get_drvdata(codec); - wm8770->codec = codec; + wm8770 = snd_soc_component_get_drvdata(component); + wm8770->component = component; ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); if (ret) { - dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); + dev_err(component->dev, "Failed to enable supplies: %d\n", ret); return ret; } - ret = wm8770_reset(codec); + ret = wm8770_reset(component); if (ret < 0) { - dev_err(codec->dev, "Failed to issue reset: %d\n", ret); + dev_err(component->dev, "Failed to issue reset: %d\n", ret); goto err_reg_enable; } /* latch the volume update bits */ - snd_soc_update_bits(codec, WM8770_MSDIGVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_MSALGVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_VOUT1RVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_VOUT2RVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_VOUT3RVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_VOUT4RVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_DAC1RVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_DAC2RVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_DAC3RVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8770_DAC4RVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_MSDIGVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_MSALGVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_VOUT1RVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_VOUT2RVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_VOUT3RVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_VOUT4RVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_DAC1RVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_DAC2RVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_DAC3RVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8770_DAC4RVOL, 0x100, 0x100); /* mute all DACs */ - snd_soc_update_bits(codec, WM8770_DACMUTE, 0x10, 0x10); + snd_soc_component_update_bits(component, WM8770_DACMUTE, 0x10, 0x10); err_reg_enable: regulator_bulk_disable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); return ret; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8770 = { - .probe = wm8770_probe, - .set_bias_level = wm8770_set_bias_level, - .idle_bias_off = true, - - .component_driver = { - .controls = wm8770_snd_controls, - .num_controls = ARRAY_SIZE(wm8770_snd_controls), - .dapm_widgets = wm8770_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8770_dapm_widgets), - .dapm_routes = wm8770_intercon, - .num_dapm_routes = ARRAY_SIZE(wm8770_intercon), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8770 = { + .probe = wm8770_probe, + .set_bias_level = wm8770_set_bias_level, + .controls = wm8770_snd_controls, + .num_controls = ARRAY_SIZE(wm8770_snd_controls), + .dapm_widgets = wm8770_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8770_dapm_widgets), + .dapm_routes = wm8770_intercon, + .num_dapm_routes = ARRAY_SIZE(wm8770_intercon), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct of_device_id wm8770_of_match[] = { @@ -682,8 +681,8 @@ static int wm8770_spi_probe(struct spi_device *spi) spi_set_drvdata(spi, wm8770); - ret = snd_soc_register_codec(&spi->dev, - &soc_codec_dev_wm8770, &wm8770_dai, 1); + ret = devm_snd_soc_register_component(&spi->dev, + &soc_component_dev_wm8770, &wm8770_dai, 1); return ret; } @@ -697,8 +696,6 @@ static int wm8770_spi_remove(struct spi_device *spi) regulator_unregister_notifier(wm8770->supplies[i].consumer, &wm8770->disable_nb[i]); - snd_soc_unregister_codec(&spi->dev); - return 0; }