From patchwork Mon Feb 12 12:50:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128112 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3214732ljc; Mon, 12 Feb 2018 05:34:04 -0800 (PST) X-Google-Smtp-Source: AH8x227MGSwTaM8CsJ5wiSRzNFLIfA3gXfg4TN/pwFrsv91guHmwhF30YJQq1L7qkL5fmVz5H2aO X-Received: by 10.28.26.144 with SMTP id a138mr3850050wma.61.1518442444782; Mon, 12 Feb 2018 05:34:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518442444; cv=none; d=google.com; s=arc-20160816; b=Lc4UjheTnMOD8ABZWU8SS2fY3HviI8DRZrd0cNXC3hkL7/We+dCCzOe7trXEQF8ah1 oR70CYfzE0063Ar2GIs91VhQTvJsoQC4a0/L78kqyfovsJYV1uZppaVnt6ZtNFpL5UNZ FS1BlVYitUpBbiywhK10IPyOv/4U5fDxCabE5ITvBjbhXdKnB/GfTG5DpQCGkTfJO+jc oA413wfkDn5YRd4nw2OfaD5Rrzc/GA8T8pYcA7pA/43sj3sbDET4cENUBsQSml6dzy+x +Dgkwzv52XyRKeOilo42ahFjeGSk3L1nfv2THDnO9DkXW0HGwMjjqFp+R6xYskiqHNm4 sHzg== 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=XdOIktcxsJYWpzDx7sxYzWEiJxTaOsotwO0CUHNvXUw=; b=KfKoMyQhbkDJnvlhKXxcnGGO4erryF6xT0bw1O79RuHLghviedI0WfjHslMKSefDG5 lUfbPUaky6A4F4hJSpWRGNzTgsUXLLoGToC/OtCxWbQ8PHhbOxdO5E184Cbb4H6nXIA8 eHCZjwfw/oijmbCZJdTCOYh4aXobRVq1i3YS+LzNK6FwwPz7Vo+qzPpErL5zhLFmFBSB os2sDEe/BmczX53N9amiKe6T0XPoVeOy1XnHRi5v/oynBhs2r9AzZX4RvuWsmhSgClEE AthHS+xOEeQw/xAr/EHY6GYS02FnaM9t2gerdUiPbgD5MG3mWzWoNnIiGVYvMUtRuHA9 HMCA== 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=J7vlca7Q; 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 x3si3582777wma.0.2018.02.12.05.34.04; Mon, 12 Feb 2018 05:34: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=J7vlca7Q; 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 ED9BD268C97; Mon, 12 Feb 2018 14:32:35 +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 F0A3D268053; Mon, 12 Feb 2018 14:32:34 +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 DC9D5267B2C for ; Mon, 12 Feb 2018 13:50:53 +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=fAxQyOWwLYDapqNQyG3dE45HTkn4CTAcxBaXsVu9zYI=; b=J7vlca7QzTzm kI3/1hY56O21lU5TSV5Ph3KW56w3hQI4jUacFjSpmrT2SmT4+4J9D/P8BIxf+gKiZkqoV1akf68Dj YW8kZEyA+sZrearrLScCiEOzk+BG054q9god0ocNKpooDd8PY8GB/HTDIjTVhQBmQWlQBngMxEr73 AexJM=; 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 1elDZL-0002X5-RT; Mon, 12 Feb 2018 12:50:52 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDZL-0006Hp-DM; Mon, 12 Feb 2018 12:50:51 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87zi4x4bf5.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:50:51 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: wm8711: 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: wm8711: 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 56fc4d2a2a26c39900aca01673f47e06a847e26d Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:01:25 +0000 Subject: [PATCH] ASoC: wm8711: 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/wm8711.c | 116 ++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 65 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/wm8711.c b/sound/soc/codecs/wm8711.c index 2b376c9c99af..1da08d281ae7 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c @@ -58,7 +58,7 @@ static bool wm8711_volatile(struct device *dev, unsigned int reg) } } -#define wm8711_reset(c) snd_soc_write(c, WM8711_RESET, 0) +#define wm8711_reset(c) snd_soc_component_write(c, WM8711_RESET, 0) static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); @@ -159,14 +159,14 @@ static int wm8711_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 wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec); - u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfff3; + struct snd_soc_component *component = dai->component; + struct wm8711_priv *wm8711 = snd_soc_component_get_drvdata(component); + u16 iface = snd_soc_component_read32(component, WM8711_IFACE) & 0xfff3; int i = get_coeff(wm8711->sysclk, params_rate(params)); u16 srate = (coeff_div[i].sr << 2) | (coeff_div[i].bosr << 1) | coeff_div[i].usb; - snd_soc_write(codec, WM8711_SRATE, srate); + snd_soc_component_write(component, WM8711_SRATE, srate); /* bit size */ switch (params_width(params)) { @@ -180,17 +180,17 @@ static int wm8711_hw_params(struct snd_pcm_substream *substream, break; } - snd_soc_write(codec, WM8711_IFACE, iface); + snd_soc_component_write(component, WM8711_IFACE, iface); return 0; } static int wm8711_pcm_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; /* set active */ - snd_soc_write(codec, WM8711_ACTIVE, 0x0001); + snd_soc_component_write(component, WM8711_ACTIVE, 0x0001); return 0; } @@ -198,24 +198,24 @@ static int wm8711_pcm_prepare(struct snd_pcm_substream *substream, static void wm8711_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; /* deactivate */ - if (!snd_soc_codec_is_active(codec)) { + if (!snd_soc_component_is_active(component)) { udelay(50); - snd_soc_write(codec, WM8711_ACTIVE, 0x0); + snd_soc_component_write(component, WM8711_ACTIVE, 0x0); } } static int wm8711_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - u16 mute_reg = snd_soc_read(codec, WM8711_APDIGI) & 0xfff7; + struct snd_soc_component *component = dai->component; + u16 mute_reg = snd_soc_component_read32(component, WM8711_APDIGI) & 0xfff7; if (mute) - snd_soc_write(codec, WM8711_APDIGI, mute_reg | 0x8); + snd_soc_component_write(component, WM8711_APDIGI, mute_reg | 0x8); else - snd_soc_write(codec, WM8711_APDIGI, mute_reg); + snd_soc_component_write(component, WM8711_APDIGI, mute_reg); return 0; } @@ -223,8 +223,8 @@ static int wm8711_mute(struct snd_soc_dai *dai, int mute) static int wm8711_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 wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct wm8711_priv *wm8711 = snd_soc_component_get_drvdata(component); switch (freq) { case 11289600: @@ -241,8 +241,8 @@ static int wm8711_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int wm8711_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0x000c; + struct snd_soc_component *component = codec_dai->component; + u16 iface = snd_soc_component_read32(component, WM8711_IFACE) & 0x000c; /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -293,31 +293,31 @@ static int wm8711_set_dai_fmt(struct snd_soc_dai *codec_dai, } /* set iface */ - snd_soc_write(codec, WM8711_IFACE, iface); + snd_soc_component_write(component, WM8711_IFACE, iface); return 0; } -static int wm8711_set_bias_level(struct snd_soc_codec *codec, +static int wm8711_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec); - u16 reg = snd_soc_read(codec, WM8711_PWR) & 0xff7f; + struct wm8711_priv *wm8711 = snd_soc_component_get_drvdata(component); + u16 reg = snd_soc_component_read32(component, WM8711_PWR) & 0xff7f; switch (level) { case SND_SOC_BIAS_ON: - snd_soc_write(codec, WM8711_PWR, reg); + snd_soc_component_write(component, WM8711_PWR, reg); break; 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) regcache_sync(wm8711->regmap); - snd_soc_write(codec, WM8711_PWR, reg | 0x0040); + snd_soc_component_write(component, WM8711_PWR, reg | 0x0040); break; case SND_SOC_BIAS_OFF: - snd_soc_write(codec, WM8711_ACTIVE, 0x0); - snd_soc_write(codec, WM8711_PWR, 0xffff); + snd_soc_component_write(component, WM8711_ACTIVE, 0x0); + snd_soc_component_write(component, WM8711_PWR, 0xffff); break; } return 0; @@ -349,37 +349,38 @@ static struct snd_soc_dai_driver wm8711_dai = { .ops = &wm8711_ops, }; -static int wm8711_probe(struct snd_soc_codec *codec) +static int wm8711_probe(struct snd_soc_component *component) { int ret; - ret = wm8711_reset(codec); + ret = wm8711_reset(component); if (ret < 0) { - dev_err(codec->dev, "Failed to issue reset\n"); + dev_err(component->dev, "Failed to issue reset\n"); return ret; } /* Latch the update bits */ - snd_soc_update_bits(codec, WM8711_LOUT1V, 0x0100, 0x0100); - snd_soc_update_bits(codec, WM8711_ROUT1V, 0x0100, 0x0100); + snd_soc_component_update_bits(component, WM8711_LOUT1V, 0x0100, 0x0100); + snd_soc_component_update_bits(component, WM8711_ROUT1V, 0x0100, 0x0100); return ret; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8711 = { - .probe = wm8711_probe, - .set_bias_level = wm8711_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8711_snd_controls, - .num_controls = ARRAY_SIZE(wm8711_snd_controls), - .dapm_widgets = wm8711_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8711_dapm_widgets), - .dapm_routes = wm8711_intercon, - .num_dapm_routes = ARRAY_SIZE(wm8711_intercon), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8711 = { + .probe = wm8711_probe, + .set_bias_level = wm8711_set_bias_level, + .controls = wm8711_snd_controls, + .num_controls = ARRAY_SIZE(wm8711_snd_controls), + .dapm_widgets = wm8711_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8711_dapm_widgets), + .dapm_routes = wm8711_intercon, + .num_dapm_routes = ARRAY_SIZE(wm8711_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 wm8711_of_match[] = { @@ -417,26 +418,18 @@ static int wm8711_spi_probe(struct spi_device *spi) spi_set_drvdata(spi, wm8711); - ret = snd_soc_register_codec(&spi->dev, - &soc_codec_dev_wm8711, &wm8711_dai, 1); + ret = devm_snd_soc_register_component(&spi->dev, + &soc_component_dev_wm8711, &wm8711_dai, 1); return ret; } -static int wm8711_spi_remove(struct spi_device *spi) -{ - snd_soc_unregister_codec(&spi->dev); - - return 0; -} - static struct spi_driver wm8711_spi_driver = { .driver = { .name = "wm8711", .of_match_table = wm8711_of_match, }, .probe = wm8711_spi_probe, - .remove = wm8711_spi_remove, }; #endif /* CONFIG_SPI_MASTER */ @@ -458,18 +451,12 @@ static int wm8711_i2c_probe(struct i2c_client *client, i2c_set_clientdata(client, wm8711); - ret = snd_soc_register_codec(&client->dev, - &soc_codec_dev_wm8711, &wm8711_dai, 1); + ret = devm_snd_soc_register_component(&client->dev, + &soc_component_dev_wm8711, &wm8711_dai, 1); return ret; } -static int wm8711_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id wm8711_i2c_id[] = { { "wm8711", 0 }, { } @@ -482,7 +469,6 @@ static struct i2c_driver wm8711_i2c_driver = { .of_match_table = wm8711_of_match, }, .probe = wm8711_i2c_probe, - .remove = wm8711_i2c_remove, .id_table = wm8711_i2c_id, }; #endif