From patchwork Mon Feb 12 12:50:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128113 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3215013ljc; Mon, 12 Feb 2018 05:34:22 -0800 (PST) X-Google-Smtp-Source: AH8x226s9+gnOHu5WSRf3mvlz2ydun4F9niAXPwnbKOIp2Sc5SavdWuX5GKPfDdFSoURfSvH/+PS X-Received: by 10.223.201.133 with SMTP id f5mr8874668wrh.99.1518442462126; Mon, 12 Feb 2018 05:34:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518442462; cv=none; d=google.com; s=arc-20160816; b=XzfwINsNMyBv97MzVhv0mTrOYDN5ibLVQrSKQhgEf3+Z23eynucoss9uQCVTWqPfT1 VYzuDvrdIEbJECdjICPuvDYJkuavWKrOqEzSFhwNdYyZ8p2yGajOivjplkO73F5MGNV8 1Q9zLLw+v5mf2Lb636az03z06tde7oiDfNnemX5WcSnq9s5kYSV/LyIW7S5V5HZX75Ry ZHfpl7VxeuZyaniNaXqtpy8eHG3Y9bAC1sD0RrboyqY1lZyqzHR4jBGXtqh+3o+RSF0W dG8t5I0hXQpCLE8fmE3T19lv4wXMlm+Mtnow3z6X/G8w4XEjLBy1vHY51Rut/6XcBEK8 E4pg== 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=clLB1I9OB/2tBBv/hTbtzhO7az9YQFwLUrxDVTozXtk=; b=rHdqY+MXTOrXMuhhmAZSPF3XeQJu9SoySnvdJ06rsHXcaJMozkT8MuWpXvxY7VYtD1 /escaLpCEL2z/UpcTPenPC2mEyyP0wHtQEg/amQdYYjHp6m1McWHv5VPXg3D1A3EZEcJ s+O7nWqe8fOVBUZ8R1Ego7BDntFvzGikBgr+xKzuHL7fTMjs5S2wRdVzndJCOZ6SC4Y6 +sRYV3T3uFvDCOuhLV8RtcXl8ToSi9rKQDvs/b32J1TV/LAud+B5N5RWE2IJKwxykazz a+Ix4J7mQF5ihd1e0Q/4rc+itD0sEhYj7VAz8Kuu1W33CW01nF5AiCF+QjkCMXEJjD7g R2pA== 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=iibedGiJ; 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 r11si6426833wrr.238.2018.02.12.05.34.21; Mon, 12 Feb 2018 05:34: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=iibedGiJ; 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 83E68268CA4; Mon, 12 Feb 2018 14:32:46 +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 3AE7A268063; Mon, 12 Feb 2018 14:32:44 +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 19D56268066 for ; Mon, 12 Feb 2018 13:50:56 +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=j0uGxD8pnQfGOO1AU1Auxc/X27npXnxYQ5a53LFm3PI=; b=iibedGiJyDwJ WJOmYz00aRnOhjZ2h4XdEKffaxuTh9IZQvZykUK4zJp6WBaJNJUTDHcZvWwxm4eGC9VMleqBFWPbH bUufa6MDdxOqdRfmuzbbXCrSy22ySj8gq5K5LeaM/lGZh8hXSEYCxuH3LV2mV9wN+mdxvD/YTuOPa t5pNg=; 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 1elDZP-0002XG-18; Mon, 12 Feb 2018 12:50:55 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDZO-0006JA-J2; Mon, 12 Feb 2018 12:50:54 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <871si95q00.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:50:54 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: wm8523: 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: wm8523: 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 4bf8ae8356c982847ef5bd5f613b87311f9024ec Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:01:09 +0000 Subject: [PATCH] ASoC: wm8523: 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/wm8523.c | 98 ++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 52 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/wm8523.c b/sound/soc/codecs/wm8523.c index c7c33e98fbcb..f4a9e25fb334 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c @@ -125,14 +125,14 @@ static const struct { static int wm8523_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component); /* The set of sample rates that can be supported depends on the * MCLK supplied to the CODEC - enforce this. */ if (!wm8523->sysclk) { - dev_err(codec->dev, + dev_err(component->dev, "No MCLK configured, call set_sysclk() on init\n"); return -EINVAL; } @@ -148,11 +148,11 @@ static int wm8523_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 wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component); int i; - u16 aifctrl1 = snd_soc_read(codec, WM8523_AIF_CTRL1); - u16 aifctrl2 = snd_soc_read(codec, WM8523_AIF_CTRL2); + u16 aifctrl1 = snd_soc_component_read32(component, WM8523_AIF_CTRL1); + u16 aifctrl2 = snd_soc_component_read32(component, WM8523_AIF_CTRL2); /* Find a supported LRCLK ratio */ for (i = 0; i < ARRAY_SIZE(lrclk_ratios); i++) { @@ -163,7 +163,7 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream, /* Should never happen, should be handled by constraints */ if (i == ARRAY_SIZE(lrclk_ratios)) { - dev_err(codec->dev, "MCLK/fs ratio %d unsupported\n", + dev_err(component->dev, "MCLK/fs ratio %d unsupported\n", wm8523->sysclk / params_rate(params)); return -EINVAL; } @@ -178,7 +178,7 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream, break; if (i == ARRAY_SIZE(bclk_ratios)) { - dev_err(codec->dev, + dev_err(component->dev, "No matching BCLK/fs ratio for word length %d\n", params_width(params)); return -EINVAL; @@ -203,8 +203,8 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream, break; } - snd_soc_write(codec, WM8523_AIF_CTRL1, aifctrl1); - snd_soc_write(codec, WM8523_AIF_CTRL2, aifctrl2); + snd_soc_component_write(component, WM8523_AIF_CTRL1, aifctrl1); + snd_soc_component_write(component, WM8523_AIF_CTRL2, aifctrl2); return 0; } @@ -212,8 +212,8 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream, static int wm8523_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 wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component); unsigned int val; int i; @@ -239,13 +239,13 @@ static int wm8523_set_dai_sysclk(struct snd_soc_dai *codec_dai, case 96000: case 176400: case 192000: - dev_dbg(codec->dev, "Supported sample rate: %dHz\n", + dev_dbg(component->dev, "Supported sample rate: %dHz\n", val); wm8523->rate_constraint_list[i] = val; wm8523->rate_constraint.count++; break; default: - dev_dbg(codec->dev, "Skipping sample rate: %dHz\n", + dev_dbg(component->dev, "Skipping sample rate: %dHz\n", val); } } @@ -261,8 +261,8 @@ static int wm8523_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int wm8523_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - u16 aifctrl1 = snd_soc_read(codec, WM8523_AIF_CTRL1); + struct snd_soc_component *component = codec_dai->component; + u16 aifctrl1 = snd_soc_component_read32(component, WM8523_AIF_CTRL1); aifctrl1 &= ~(WM8523_BCLK_INV_MASK | WM8523_LRCLK_INV_MASK | WM8523_FMT_MASK | WM8523_AIF_MSTR_MASK); @@ -312,15 +312,15 @@ static int wm8523_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - snd_soc_write(codec, WM8523_AIF_CTRL1, aifctrl1); + snd_soc_component_write(component, WM8523_AIF_CTRL1, aifctrl1); return 0; } -static int wm8523_set_bias_level(struct snd_soc_codec *codec, +static int wm8523_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); + struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component); int ret; switch (level) { @@ -329,16 +329,16 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_PREPARE: /* Full power on */ - snd_soc_update_bits(codec, WM8523_PSCTRL1, + snd_soc_component_update_bits(component, WM8523_PSCTRL1, WM8523_SYS_ENA_MASK, 3); 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(wm8523->supplies), wm8523->supplies); if (ret != 0) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to enable supplies: %d\n", ret); return ret; @@ -348,21 +348,21 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, regcache_sync(wm8523->regmap); /* Initial power up */ - snd_soc_update_bits(codec, WM8523_PSCTRL1, + snd_soc_component_update_bits(component, WM8523_PSCTRL1, WM8523_SYS_ENA_MASK, 1); msleep(100); } /* Power up to mute */ - snd_soc_update_bits(codec, WM8523_PSCTRL1, + snd_soc_component_update_bits(component, WM8523_PSCTRL1, WM8523_SYS_ENA_MASK, 2); break; case SND_SOC_BIAS_OFF: /* The chip runs through the power down sequence for us. */ - snd_soc_update_bits(codec, WM8523_PSCTRL1, + snd_soc_component_update_bits(component, WM8523_PSCTRL1, WM8523_SYS_ENA_MASK, 0); msleep(100); @@ -397,35 +397,36 @@ static struct snd_soc_dai_driver wm8523_dai = { .ops = &wm8523_dai_ops, }; -static int wm8523_probe(struct snd_soc_codec *codec) +static int wm8523_probe(struct snd_soc_component *component) { - struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); + struct wm8523_priv *wm8523 = snd_soc_component_get_drvdata(component); wm8523->rate_constraint.list = &wm8523->rate_constraint_list[0]; wm8523->rate_constraint.count = ARRAY_SIZE(wm8523->rate_constraint_list); /* Change some default settings - latch VU and enable ZC */ - snd_soc_update_bits(codec, WM8523_DAC_GAINR, + snd_soc_component_update_bits(component, WM8523_DAC_GAINR, WM8523_DACR_VU, WM8523_DACR_VU); - snd_soc_update_bits(codec, WM8523_DAC_CTRL3, WM8523_ZC, WM8523_ZC); + snd_soc_component_update_bits(component, WM8523_DAC_CTRL3, WM8523_ZC, WM8523_ZC); return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8523 = { - .probe = wm8523_probe, - .set_bias_level = wm8523_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8523_controls, - .num_controls = ARRAY_SIZE(wm8523_controls), - .dapm_widgets = wm8523_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8523_dapm_widgets), - .dapm_routes = wm8523_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8523_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8523 = { + .probe = wm8523_probe, + .set_bias_level = wm8523_set_bias_level, + .controls = wm8523_controls, + .num_controls = ARRAY_SIZE(wm8523_controls), + .dapm_widgets = wm8523_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8523_dapm_widgets), + .dapm_routes = wm8523_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8523_dapm_routes), + .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 wm8523_of_match[] = { @@ -511,8 +512,8 @@ static int wm8523_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8523); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm8523, &wm8523_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_wm8523, &wm8523_dai, 1); return ret; @@ -521,12 +522,6 @@ static int wm8523_i2c_probe(struct i2c_client *i2c, return ret; } -static int wm8523_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id wm8523_i2c_id[] = { { "wm8523", 0 }, { } @@ -539,7 +534,6 @@ static struct i2c_driver wm8523_i2c_driver = { .of_match_table = wm8523_of_match, }, .probe = wm8523_i2c_probe, - .remove = wm8523_i2c_remove, .id_table = wm8523_i2c_id, };