From patchwork Mon Feb 12 12:49:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128109 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3213166ljc; Mon, 12 Feb 2018 05:32:22 -0800 (PST) X-Google-Smtp-Source: AH8x226U+jECX1k/5jilQw1veosiRdkDKQ5UcqZp5iMexnDoPnCPw6tMdepap14g9zU73FmlcG4x X-Received: by 10.223.190.18 with SMTP id n18mr9139262wrh.102.1518442342490; Mon, 12 Feb 2018 05:32:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518442342; cv=none; d=google.com; s=arc-20160816; b=iMAiFI2Ut3xfg3U8GlWEcRt7aljisRcpsMcyKXchJ+nK18pwG15LjXeDuEVFS3dJUQ bwLgplMKCCfBTqpLZUmvmT5xF/InFf3LKd4/etxd/ZTAmHpnxVG+VBNiodPY5sONJHtB 8jx5ifALzlPdyO66pzMszMLi86qbQcxhgunPpeYYBtxkCay1VreovP3xKfvxmNAbjbSJ 9C6KnyLEYyE/+Rx9V1I6FfD+CBHmSJYmIjvDN8HN1xE6divaCLjRAbktblDgUQhTcpCn 6xq+UxpJ55RoMja3dRoUZxfwCJWNsh09HEEYPK7U5shCa/CGsRTomRHTXdb4lMG5Pr1s +13g== 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=ucr0okucEg4CLMdXHJRITjBkfnpC4s+yhVEkp0ClCMI=; b=MPi7Syk201mI+9THd6TKEjJKYuo8ig4TkMap5EMkUNOFAiHxUrfiuP3xivQyNHzj68 hFsNWVdL81505E5yl3l1NxOCz0ZpxMylnEEsF+5yiU3wF837y//BxWsOtYLBvNIqJ2Vm K5h4k4aycTbb1iNcMEruRgHjaHkrSBzZhk6iEkYQtH4cBoPPvt3qKFuuT15XOZuw7dhS rrpbpKFBNZIUZz2nxomXsce3Za+9t+chyCmq7KBxkkpD2OluvoE1URsdfJKnDT71av1H fIt69xFhMDIU/dTP7Wn0DAFi/fEjqTH/SduI3UhSHUbV689TEw011gJd5jH4cPu0idTH NE4w== 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=A0bWG53X; 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 i2si3836080wmc.119.2018.02.12.05.32.21; Mon, 12 Feb 2018 05:32:22 -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=A0bWG53X; 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 645AD268BA7; Mon, 12 Feb 2018 14:29:41 +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 E8875268BA8; Mon, 12 Feb 2018 14:29:39 +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 4DC20267F87 for ; Mon, 12 Feb 2018 13:49:45 +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=mc5Ng4ICWUQ7mmazjqFk6e4TOmwUjcAKJAWBv/NB3L8=; b=A0bWG53XZlRi kb4YR2WpX6Ouw5Ew+soNU7qK8hjyb8LVvjX8rZbMB2e3h7vwwfPdFOLUluqJyvbOtrAtwgMnYYvsY XwRbK8G+VvkLvw/0MTjbfAE/pzi+jiPgFhrdIJ7+rHXK4mgeccW1SHq9cT+8IIlewUIvMBKUgOo1/ lUmrg=; 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 1elDYF-0002Uf-DV; Mon, 12 Feb 2018 12:49:43 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDYE-00068x-Vl; Mon, 12 Feb 2018 12:49:42 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87r2q94bch.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:49:42 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: wm8731: 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: wm8731: 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 cde596c7c07343789e3e0f1c09fc7d3c756c88d0 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:03:01 +0000 Subject: [PATCH] ASoC: wm8731: 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/wm8731.c | 101 +++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 51 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/wm8731.c b/sound/soc/codecs/wm8731.c index 4f9a1eb28120..7c8fad865d6b 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -88,9 +88,9 @@ static SOC_ENUM_SINGLE_DECL(wm8731_insel_enum, static int wm8731_deemph[] = { 0, 32000, 44100, 48000 }; -static int wm8731_set_deemph(struct snd_soc_codec *codec) +static int wm8731_set_deemph(struct snd_soc_component *component) { - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); + struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); int val, i, best; /* If we're using deemphasis select the nearest available sample @@ -110,17 +110,17 @@ static int wm8731_set_deemph(struct snd_soc_codec *codec) val = 0; } - dev_dbg(codec->dev, "Set deemphasis %d (%dHz)\n", + dev_dbg(component->dev, "Set deemphasis %d (%dHz)\n", best, wm8731_deemph[best]); - return snd_soc_update_bits(codec, WM8731_APDIGI, 0x6, val); + return snd_soc_component_update_bits(component, WM8731_APDIGI, 0x6, val); } static int wm8731_get_deemph(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); ucontrol->value.integer.value[0] = wm8731->deemph; @@ -130,8 +130,8 @@ static int wm8731_get_deemph(struct snd_kcontrol *kcontrol, static int wm8731_put_deemph(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); unsigned int deemph = ucontrol->value.integer.value[0]; int ret = 0; @@ -142,7 +142,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol, if (wm8731->deemph != deemph) { wm8731->deemph = deemph; - wm8731_set_deemph(codec); + wm8731_set_deemph(component); ret = 1; } @@ -214,8 +214,8 @@ SND_SOC_DAPM_INPUT("LLINEIN"), static int wm8731_check_osc(struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); + struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); return wm8731->sysclk_type == WM8731_SYSCLK_XTAL; } @@ -337,16 +337,16 @@ static int wm8731_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 wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); - u16 iface = snd_soc_read(codec, WM8731_IFACE) & 0xfff3; + struct snd_soc_component *component = dai->component; + struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); + u16 iface = snd_soc_component_read32(component, WM8731_IFACE) & 0xfff3; int i = get_coeff(wm8731->sysclk, params_rate(params)); u16 srate = (coeff_div[i].sr << 2) | (coeff_div[i].bosr << 1) | coeff_div[i].usb; wm8731->playback_fs = params_rate(params); - snd_soc_write(codec, WM8731_SRATE, srate); + snd_soc_component_write(component, WM8731_SRATE, srate); /* bit size */ switch (params_width(params)) { @@ -363,30 +363,30 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream, break; } - wm8731_set_deemph(codec); + wm8731_set_deemph(component); - snd_soc_write(codec, WM8731_IFACE, iface); + snd_soc_component_write(component, WM8731_IFACE, iface); return 0; } static int wm8731_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - u16 mute_reg = snd_soc_read(codec, WM8731_APDIGI) & 0xfff7; + struct snd_soc_component *component = dai->component; + u16 mute_reg = snd_soc_component_read32(component, WM8731_APDIGI) & 0xfff7; if (mute) - snd_soc_write(codec, WM8731_APDIGI, mute_reg | 0x8); + snd_soc_component_write(component, WM8731_APDIGI, mute_reg | 0x8); else - snd_soc_write(codec, WM8731_APDIGI, mute_reg); + snd_soc_component_write(component, WM8731_APDIGI, mute_reg); return 0; } static int wm8731_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 snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); switch (clk_id) { case WM8731_SYSCLK_XTAL: @@ -429,7 +429,7 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int wm8731_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; u16 iface = 0; /* set master/slave audio interface */ @@ -481,14 +481,14 @@ static int wm8731_set_dai_fmt(struct snd_soc_dai *codec_dai, } /* set iface */ - snd_soc_write(codec, WM8731_IFACE, iface); + snd_soc_component_write(component, WM8731_IFACE, iface); return 0; } -static int wm8731_set_bias_level(struct snd_soc_codec *codec, +static int wm8731_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); + struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); int ret; u16 reg; @@ -503,7 +503,7 @@ static int wm8731_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(wm8731->supplies), wm8731->supplies); if (ret != 0) @@ -513,13 +513,13 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, } /* Clear PWROFF, gate CLKOUT, everything else as-is */ - reg = snd_soc_read(codec, WM8731_PWR) & 0xff7f; - snd_soc_write(codec, WM8731_PWR, reg | 0x0040); + reg = snd_soc_component_read32(component, WM8731_PWR) & 0xff7f; + snd_soc_component_write(component, WM8731_PWR, reg | 0x0040); break; case SND_SOC_BIAS_OFF: if (wm8731->mclk) clk_disable_unprepare(wm8731->mclk); - snd_soc_write(codec, WM8731_PWR, 0xffff); + snd_soc_component_write(component, WM8731_PWR, 0xffff); regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); regcache_mark_dirty(wm8731->regmap); @@ -531,7 +531,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, static int wm8731_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(dai->codec); + struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(dai->component); if (wm8731->constraints) snd_pcm_hw_constraint_list(substream->runtime, 0, @@ -628,18 +628,19 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731) return ret; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8731 = { - .set_bias_level = wm8731_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8731_snd_controls, - .num_controls = ARRAY_SIZE(wm8731_snd_controls), - .dapm_widgets = wm8731_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), - .dapm_routes = wm8731_intercon, - .num_dapm_routes = ARRAY_SIZE(wm8731_intercon), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8731 = { + .set_bias_level = wm8731_set_bias_level, + .controls = wm8731_snd_controls, + .num_controls = ARRAY_SIZE(wm8731_snd_controls), + .dapm_widgets = wm8731_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), + .dapm_routes = wm8731_intercon, + .num_dapm_routes = ARRAY_SIZE(wm8731_intercon), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct of_device_id wm8731_of_match[] = { @@ -704,8 +705,8 @@ static int wm8731_spi_probe(struct spi_device *spi) if (ret != 0) return ret; - ret = snd_soc_register_codec(&spi->dev, - &soc_codec_dev_wm8731, &wm8731_dai, 1); + ret = devm_snd_soc_register_component(&spi->dev, + &soc_component_dev_wm8731, &wm8731_dai, 1); if (ret != 0) { dev_err(&spi->dev, "Failed to register CODEC: %d\n", ret); return ret; @@ -716,7 +717,6 @@ static int wm8731_spi_probe(struct spi_device *spi) static int wm8731_spi_remove(struct spi_device *spi) { - snd_soc_unregister_codec(&spi->dev); return 0; } @@ -775,8 +775,8 @@ static int wm8731_i2c_probe(struct i2c_client *i2c, if (ret != 0) return ret; - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm8731, &wm8731_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_wm8731, &wm8731_dai, 1); if (ret != 0) { dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); return ret; @@ -787,7 +787,6 @@ static int wm8731_i2c_probe(struct i2c_client *i2c, static int wm8731_i2c_remove(struct i2c_client *client) { - snd_soc_unregister_codec(&client->dev); return 0; }