From patchwork Mon Feb 12 12:51:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128114 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3215251ljc; Mon, 12 Feb 2018 05:34:36 -0800 (PST) X-Google-Smtp-Source: AH8x226PxJ6yI3Yo4xYwznTC/F+zuXKwFANos4NQuvHzfI7mIz+/ekocVkryoCO6JVHy/oAAEJRJ X-Received: by 10.28.63.81 with SMTP id m78mr3845125wma.102.1518442476346; Mon, 12 Feb 2018 05:34:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518442476; cv=none; d=google.com; s=arc-20160816; b=Gu2osmK5sBVzpVHQK/dWZR2ZllzhFjqpiVVWI5X1Q/frvfL4VO00Mlyba18qjkYgkQ FGuW/xGwbUP+DB9cFswXcsHY7Np6f4I2I77lfkK4QW2N/n6SqfVfYiwz3U9hgX0sGe8+ g3mV34jxLN7V6zIk58jp9jrQ8zImYKWHtEkQyN+qpI+pWtNczUNbByymgIoKwhHjXuCi x/NpgSPeuBKzeWjxZjAXL3/SVLzSgjx5Bzr5IgaLHaiaPIEv64/9rGLuydG6pOmJqEca jSEORpogBL3csOj7mSjRg+ctdYMjYMSSrtsZoZBkzahqPUKZMXT+fS7BHfMsneQmYUUy wk7A== 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=fHEe4A5TyLzzatgwJdBNvFhv92ALvEoUGcToKB0VihA=; b=0jcWgEIC1k9ya34nikuCESp30CuGGDh8SmSqy/9m0vG/TWo+6vhFyvyMesvC8dAXSO 7pLVbJvUtZYZmthEiyDNATL5eb/9FMK7eRLpRazb+6ZogYCA2U4SjfdC5fa2CU4Yg5Qk oq4e/43R/KOTcSyGutUffz7mELUF98pIxgQubg1H3LsMAesLT84qx8qS2Oiaixf1b+2n DITOu5kGyrtr71C7NxYzN0H0IW4SEM+4629NDcStDcxloHWAjfMZl7VX7wQ3ob6Q1toP vccC1cX1+d0b4FHnYPjAyMxDhLK9SYumqOzuE8r9qNfU8nYqWWq0QETZimhQMO5Id9sw DKZg== 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=Rssopvov; 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 y187si3566983wmy.213.2018.02.12.05.34.36; Mon, 12 Feb 2018 05:34:36 -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=Rssopvov; 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 84247268C89; Mon, 12 Feb 2018 14:33:10 +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 E26FC268AD8; Mon, 12 Feb 2018 14:33:09 +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 8244E267B2B for ; Mon, 12 Feb 2018 13:51:05 +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=xXqN4gU8v7ypN54i/jvaVPCb1+jTmjxi//KZEpSgbu0=; b=RssopvovzDjv iKFPu6Exkr2ZzQZ+uAbcBTOPtEqxmpwcoy84R/3tbEFxm2dgNOfQ57KuAE8pbxL2+psdC1E7x+Zrn /wnDTRN5S7siqu/EfjAXMwoAUNToAVJO+qCJ3pCWdV5J+X2UXon+VWzrLJOTJPDZol0EP41OWoegw SzqOM=; 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 1elDZX-0002Xb-BE; Mon, 12 Feb 2018 12:51:03 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDZW-0006K5-Sx; Mon, 12 Feb 2018 12:51:02 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87372p5q0f.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:51:02 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: wm8510: 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: wm8510: 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 51bf02cc505fb4bc0c5913e64db12c6b7e464f23 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:00:54 +0000 Subject: [PATCH] ASoC: wm8510: 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/wm8510.c | 149 +++++++++++++++++++++------------------------- 1 file changed, 68 insertions(+), 81 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/wm8510.c b/sound/soc/codecs/wm8510.c index 119ceac684ae..1a2412d73e35 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -106,7 +106,7 @@ static bool wm8510_volatile(struct device *dev, unsigned int reg) #define WM8510_POWER1_BIASEN 0x08 #define WM8510_POWER1_BUFIOEN 0x10 -#define wm8510_reset(c) snd_soc_write(c, WM8510_RESET, 0) +#define wm8510_reset(c) snd_soc_component_write(c, WM8510_RESET, 0) /* codec private data */ struct wm8510_priv { @@ -316,32 +316,32 @@ static void pll_factors(unsigned int target, unsigned int source) static int wm8510_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; u16 reg; if (freq_in == 0 || freq_out == 0) { /* Clock CODEC directly from MCLK */ - reg = snd_soc_read(codec, WM8510_CLOCK); - snd_soc_write(codec, WM8510_CLOCK, reg & 0x0ff); + reg = snd_soc_component_read32(component, WM8510_CLOCK); + snd_soc_component_write(component, WM8510_CLOCK, reg & 0x0ff); /* Turn off PLL */ - reg = snd_soc_read(codec, WM8510_POWER1); - snd_soc_write(codec, WM8510_POWER1, reg & 0x1df); + reg = snd_soc_component_read32(component, WM8510_POWER1); + snd_soc_component_write(component, WM8510_POWER1, reg & 0x1df); return 0; } pll_factors(freq_out*4, freq_in); - snd_soc_write(codec, WM8510_PLLN, (pll_div.pre_div << 4) | pll_div.n); - snd_soc_write(codec, WM8510_PLLK1, pll_div.k >> 18); - snd_soc_write(codec, WM8510_PLLK2, (pll_div.k >> 9) & 0x1ff); - snd_soc_write(codec, WM8510_PLLK3, pll_div.k & 0x1ff); - reg = snd_soc_read(codec, WM8510_POWER1); - snd_soc_write(codec, WM8510_POWER1, reg | 0x020); + snd_soc_component_write(component, WM8510_PLLN, (pll_div.pre_div << 4) | pll_div.n); + snd_soc_component_write(component, WM8510_PLLK1, pll_div.k >> 18); + snd_soc_component_write(component, WM8510_PLLK2, (pll_div.k >> 9) & 0x1ff); + snd_soc_component_write(component, WM8510_PLLK3, pll_div.k & 0x1ff); + reg = snd_soc_component_read32(component, WM8510_POWER1); + snd_soc_component_write(component, WM8510_POWER1, reg | 0x020); /* Run CODEC from PLL instead of MCLK */ - reg = snd_soc_read(codec, WM8510_CLOCK); - snd_soc_write(codec, WM8510_CLOCK, reg | 0x100); + reg = snd_soc_component_read32(component, WM8510_CLOCK); + snd_soc_component_write(component, WM8510_CLOCK, reg | 0x100); return 0; } @@ -352,29 +352,29 @@ static int wm8510_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, static int wm8510_set_dai_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; u16 reg; switch (div_id) { case WM8510_OPCLKDIV: - reg = snd_soc_read(codec, WM8510_GPIO) & 0x1cf; - snd_soc_write(codec, WM8510_GPIO, reg | div); + reg = snd_soc_component_read32(component, WM8510_GPIO) & 0x1cf; + snd_soc_component_write(component, WM8510_GPIO, reg | div); break; case WM8510_MCLKDIV: - reg = snd_soc_read(codec, WM8510_CLOCK) & 0x11f; - snd_soc_write(codec, WM8510_CLOCK, reg | div); + reg = snd_soc_component_read32(component, WM8510_CLOCK) & 0x11f; + snd_soc_component_write(component, WM8510_CLOCK, reg | div); break; case WM8510_ADCCLK: - reg = snd_soc_read(codec, WM8510_ADC) & 0x1f7; - snd_soc_write(codec, WM8510_ADC, reg | div); + reg = snd_soc_component_read32(component, WM8510_ADC) & 0x1f7; + snd_soc_component_write(component, WM8510_ADC, reg | div); break; case WM8510_DACCLK: - reg = snd_soc_read(codec, WM8510_DAC) & 0x1f7; - snd_soc_write(codec, WM8510_DAC, reg | div); + reg = snd_soc_component_read32(component, WM8510_DAC) & 0x1f7; + snd_soc_component_write(component, WM8510_DAC, reg | div); break; case WM8510_BCLKDIV: - reg = snd_soc_read(codec, WM8510_CLOCK) & 0x1e3; - snd_soc_write(codec, WM8510_CLOCK, reg | div); + reg = snd_soc_component_read32(component, WM8510_CLOCK) & 0x1e3; + snd_soc_component_write(component, WM8510_CLOCK, reg | div); break; default: return -EINVAL; @@ -386,9 +386,9 @@ static int wm8510_set_dai_clkdiv(struct snd_soc_dai *codec_dai, static int wm8510_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; - u16 clk = snd_soc_read(codec, WM8510_CLOCK) & 0x1fe; + u16 clk = snd_soc_component_read32(component, WM8510_CLOCK) & 0x1fe; /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -435,8 +435,8 @@ static int wm8510_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - snd_soc_write(codec, WM8510_IFACE, iface); - snd_soc_write(codec, WM8510_CLOCK, clk); + snd_soc_component_write(component, WM8510_IFACE, iface); + snd_soc_component_write(component, WM8510_CLOCK, clk); return 0; } @@ -444,9 +444,9 @@ static int wm8510_pcm_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; - u16 iface = snd_soc_read(codec, WM8510_IFACE) & 0x19f; - u16 adn = snd_soc_read(codec, WM8510_ADD) & 0x1f1; + struct snd_soc_component *component = dai->component; + u16 iface = snd_soc_component_read32(component, WM8510_IFACE) & 0x19f; + u16 adn = snd_soc_component_read32(component, WM8510_ADD) & 0x1f1; /* bit size */ switch (params_width(params)) { @@ -485,56 +485,56 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream, break; } - snd_soc_write(codec, WM8510_IFACE, iface); - snd_soc_write(codec, WM8510_ADD, adn); + snd_soc_component_write(component, WM8510_IFACE, iface); + snd_soc_component_write(component, WM8510_ADD, adn); return 0; } static int wm8510_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - u16 mute_reg = snd_soc_read(codec, WM8510_DAC) & 0xffbf; + struct snd_soc_component *component = dai->component; + u16 mute_reg = snd_soc_component_read32(component, WM8510_DAC) & 0xffbf; if (mute) - snd_soc_write(codec, WM8510_DAC, mute_reg | 0x40); + snd_soc_component_write(component, WM8510_DAC, mute_reg | 0x40); else - snd_soc_write(codec, WM8510_DAC, mute_reg); + snd_soc_component_write(component, WM8510_DAC, mute_reg); return 0; } /* liam need to make this lower power with dapm */ -static int wm8510_set_bias_level(struct snd_soc_codec *codec, +static int wm8510_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct wm8510_priv *wm8510 = snd_soc_codec_get_drvdata(codec); - u16 power1 = snd_soc_read(codec, WM8510_POWER1) & ~0x3; + struct wm8510_priv *wm8510 = snd_soc_component_get_drvdata(component); + u16 power1 = snd_soc_component_read32(component, WM8510_POWER1) & ~0x3; switch (level) { case SND_SOC_BIAS_ON: case SND_SOC_BIAS_PREPARE: power1 |= 0x1; /* VMID 50k */ - snd_soc_write(codec, WM8510_POWER1, power1); + snd_soc_component_write(component, WM8510_POWER1, power1); break; case SND_SOC_BIAS_STANDBY: power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN; - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { regcache_sync(wm8510->regmap); /* Initial cap charge at VMID 5k */ - snd_soc_write(codec, WM8510_POWER1, power1 | 0x3); + snd_soc_component_write(component, WM8510_POWER1, power1 | 0x3); mdelay(100); } power1 |= 0x2; /* VMID 500k */ - snd_soc_write(codec, WM8510_POWER1, power1); + snd_soc_component_write(component, WM8510_POWER1, power1); break; case SND_SOC_BIAS_OFF: - snd_soc_write(codec, WM8510_POWER1, 0); - snd_soc_write(codec, WM8510_POWER2, 0); - snd_soc_write(codec, WM8510_POWER3, 0); + snd_soc_component_write(component, WM8510_POWER1, 0); + snd_soc_component_write(component, WM8510_POWER2, 0); + snd_soc_component_write(component, WM8510_POWER3, 0); break; } @@ -574,26 +574,27 @@ static struct snd_soc_dai_driver wm8510_dai = { .symmetric_rates = 1, }; -static int wm8510_probe(struct snd_soc_codec *codec) +static int wm8510_probe(struct snd_soc_component *component) { - wm8510_reset(codec); + wm8510_reset(component); return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8510 = { - .probe = wm8510_probe, - .set_bias_level = wm8510_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8510_snd_controls, - .num_controls = ARRAY_SIZE(wm8510_snd_controls), - .dapm_widgets = wm8510_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8510_dapm_widgets), - .dapm_routes = wm8510_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8510_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8510 = { + .probe = wm8510_probe, + .set_bias_level = wm8510_set_bias_level, + .controls = wm8510_snd_controls, + .num_controls = ARRAY_SIZE(wm8510_snd_controls), + .dapm_widgets = wm8510_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8510_dapm_widgets), + .dapm_routes = wm8510_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8510_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 wm8510_of_match[] = { @@ -631,25 +632,18 @@ static int wm8510_spi_probe(struct spi_device *spi) spi_set_drvdata(spi, wm8510); - ret = snd_soc_register_codec(&spi->dev, - &soc_codec_dev_wm8510, &wm8510_dai, 1); + ret = devm_snd_soc_register_component(&spi->dev, + &soc_component_dev_wm8510, &wm8510_dai, 1); return ret; } -static int wm8510_spi_remove(struct spi_device *spi) -{ - snd_soc_unregister_codec(&spi->dev); - return 0; -} - static struct spi_driver wm8510_spi_driver = { .driver = { .name = "wm8510", .of_match_table = wm8510_of_match, }, .probe = wm8510_spi_probe, - .remove = wm8510_spi_remove, }; #endif /* CONFIG_SPI_MASTER */ @@ -671,18 +665,12 @@ static int wm8510_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8510); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm8510, &wm8510_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_wm8510, &wm8510_dai, 1); return ret; } -static int wm8510_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id wm8510_i2c_id[] = { { "wm8510", 0 }, { } @@ -695,7 +683,6 @@ static struct i2c_driver wm8510_i2c_driver = { .of_match_table = wm8510_of_match, }, .probe = wm8510_i2c_probe, - .remove = wm8510_i2c_remove, .id_table = wm8510_i2c_id, }; #endif