From patchwork Mon Feb 12 12:46: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: 128094 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3206791ljc; Mon, 12 Feb 2018 05:25:10 -0800 (PST) X-Google-Smtp-Source: AH8x224YShuElRa9+TqCxkcxD5C4gZpXif6Wf0a41i1+WZD9JIwJDfZFQr3KMIrStnDrekSp9iXP X-Received: by 10.223.170.205 with SMTP id i13mr9925747wrc.38.1518441910148; Mon, 12 Feb 2018 05:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441910; cv=none; d=google.com; s=arc-20160816; b=DTmTQogJwfrsruSBbJUEe7Qv5AwYPdA5UjV3IB82EGxdGUJmgutzgJzIBVdQvQqFx/ PabClmkd0S0G+VKXs98z+dzaqEeuoSKym3n9ttjmqyMS6tnJTEDlSZMts3PrJIyTbMWL JV2t8Ivxw14KTDAqJ23AaZko/m5rkNx53KUcd15ary9jj3RG5hWMea59bzrKouVEqAOc xXG/YYI1z29MNEKJQvKIOHSnVe511JSZmvLR9i6hP+7SlgPademdTmlgg6D+Z9/e/POE ew6W/2cvTPHOVtAxVLZELIWigu894VhGxbDV5bL3Mlho/rwljdcinXa8RumGhJvUuWb7 T+Lg== 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=Pf5j4j/4ZzFpvAnHkYoBIam+pcUr0hObIW5rqkIYy00=; b=USZLxj5ZUVOnUXhRlk8CT+wDVye/1J2Ah0Isq+qzikW1I4g95ehrSZlbukALArvRDk OMy8kT4wonqVPANz64RVGom6KrzrNx5T88I0rBuihuriVn8aiof0X5XwrNkXXHE5Vuap xZhcCErDDI0jFX1h0UpJKEM46RHoNSQoeGoM4VTOnAOsNK9DRgXNByqDFO4h2af+Ec/B e9TLp/zaj3akFMWJvcuXPrJN527ChyGYJpqloJXQMd99tl+3tOgwXgc1luL666eeqY3q QXxbF2soOZy3nt+lSrWLis8Z8R8+JYtKqcBSsmGZqu587cedeSreUGosy7/iQVnhfa8r 4StQ== 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=YSBDA8I0; 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 o15si6291453wra.477.2018.02.12.05.25.09; Mon, 12 Feb 2018 05:25:10 -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=YSBDA8I0; 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 462702688C4; Mon, 12 Feb 2018 14:22:28 +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 0F1022688BF; Mon, 12 Feb 2018 14:22:27 +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 A3BBC267DD7 for ; Mon, 12 Feb 2018 13:46:44 +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=SNEqlocSp96TZ16kf1+5AYF08qveAjSQMh9egvUMYAQ=; b=YSBDA8I0yIY/ iYgWJeaW8+o6TnEiXATXtxMAF7xnKYy1Q9xB++pIVuYOeg7oTbOuCwgiG2Oxi1YwBoFjuAydArW0j 63YqBh8LP4QtPnkD3C3jQKINmT377v83+rh80/EW5znlG09xRhuG4+DnwFZBGZN1lhba+79hPuHIG Ky6PI=; 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 1elDVK-0002Rw-P0; Mon, 12 Feb 2018 12:46:42 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDVK-0005XB-BD; Mon, 12 Feb 2018 12:46:42 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87o9ld2wf5.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:46:42 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: wm9712: 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: wm9712: 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 164c976a9493991ebe7e838931ff895e6e04d7c2 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:10:45 +0000 Subject: [PATCH] ASoC: wm9712: 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/wm9712.c | 109 ++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 58 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/wm9712.c b/sound/soc/codecs/wm9712.c index 4f6d1a442bc4..7aeeeec8adbd 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -220,8 +220,8 @@ static int wm9712_hp_mixer_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); - struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); + struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component); unsigned int val = ucontrol->value.integer.value[0]; struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; @@ -264,8 +264,8 @@ static int wm9712_hp_mixer_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); - struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); + struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; unsigned int shift, mixer; @@ -527,33 +527,33 @@ static const struct snd_soc_dapm_route wm9712_audio_map[] = { static int ac97_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; int reg; struct snd_pcm_runtime *runtime = substream->runtime; - snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1); + snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) reg = AC97_PCM_FRONT_DAC_RATE; else reg = AC97_PCM_LR_ADC_RATE; - return snd_soc_write(codec, reg, runtime->rate); + return snd_soc_component_write(component, reg, runtime->rate); } static int ac97_aux_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; struct snd_pcm_runtime *runtime = substream->runtime; - snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1); - snd_soc_update_bits(codec, AC97_PCI_SID, 0x8000, 0x8000); + snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1); + snd_soc_component_update_bits(component, AC97_PCI_SID, 0x8000, 0x8000); if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) return -ENODEV; - return snd_soc_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate); + return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate); } #define WM9712_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ @@ -597,7 +597,7 @@ static struct snd_soc_dai_driver wm9712_dai[] = { } }; -static int wm9712_set_bias_level(struct snd_soc_codec *codec, +static int wm9712_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { switch (level) { @@ -605,20 +605,20 @@ static int wm9712_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: - snd_soc_write(codec, AC97_POWERDOWN, 0x0000); + snd_soc_component_write(component, AC97_POWERDOWN, 0x0000); break; case SND_SOC_BIAS_OFF: /* disable everything including AC link */ - snd_soc_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); - snd_soc_write(codec, AC97_POWERDOWN, 0xffff); + snd_soc_component_write(component, AC97_EXTENDED_MSTATUS, 0xffff); + snd_soc_component_write(component, AC97_POWERDOWN, 0xffff); break; } return 0; } -static int wm9712_soc_resume(struct snd_soc_codec *codec) +static int wm9712_soc_resume(struct snd_soc_component *component) { - struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); + struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component); int ret; ret = snd_ac97_reset(wm9712->ac97, true, WM9712_VENDOR_ID, @@ -626,17 +626,17 @@ static int wm9712_soc_resume(struct snd_soc_codec *codec) if (ret < 0) return ret; - snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); + snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); if (ret == 0) - regcache_sync(codec->component.regmap); + snd_soc_component_cache_sync(component); return ret; } -static int wm9712_soc_probe(struct snd_soc_codec *codec) +static int wm9712_soc_probe(struct snd_soc_component *component) { - struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); + struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component); struct regmap *regmap; int ret; @@ -645,59 +645,59 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) regmap = wm9712->mfd_pdata->regmap; } else { #ifdef CONFIG_SND_SOC_AC97_BUS - wm9712->ac97 = snd_soc_new_ac97_codec(codec, WM9712_VENDOR_ID, + wm9712->ac97 = snd_soc_new_ac97_component(component, WM9712_VENDOR_ID, WM9712_VENDOR_ID_MASK); if (IS_ERR(wm9712->ac97)) { ret = PTR_ERR(wm9712->ac97); - dev_err(codec->dev, + dev_err(component->dev, "Failed to register AC97 codec: %d\n", ret); return ret; } regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); if (IS_ERR(regmap)) { - snd_soc_free_ac97_codec(wm9712->ac97); + snd_soc_free_ac97_component(wm9712->ac97); return PTR_ERR(regmap); } #endif } - snd_soc_codec_init_regmap(codec, regmap); + snd_soc_component_init_regmap(component, regmap); /* set alc mux to none */ - snd_soc_update_bits(codec, AC97_VIDEO, 0x3000, 0x3000); + snd_soc_component_update_bits(component, AC97_VIDEO, 0x3000, 0x3000); return 0; } -static int wm9712_soc_remove(struct snd_soc_codec *codec) +static void wm9712_soc_remove(struct snd_soc_component *component) { #ifdef CONFIG_SND_SOC_AC97_BUS - struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); + struct wm9712_priv *wm9712 = snd_soc_component_get_drvdata(component); if (!wm9712->mfd_pdata) { - snd_soc_codec_exit_regmap(codec); - snd_soc_free_ac97_codec(wm9712->ac97); + snd_soc_component_exit_regmap(component); + snd_soc_free_ac97_component(wm9712->ac97); } #endif - return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm9712 = { - .probe = wm9712_soc_probe, - .remove = wm9712_soc_remove, - .resume = wm9712_soc_resume, - .set_bias_level = wm9712_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm9712_snd_ac97_controls, - .num_controls = ARRAY_SIZE(wm9712_snd_ac97_controls), - .dapm_widgets = wm9712_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm9712_dapm_widgets), - .dapm_routes = wm9712_audio_map, - .num_dapm_routes = ARRAY_SIZE(wm9712_audio_map), - }, +static const struct snd_soc_component_driver soc_component_dev_wm9712 = { + .probe = wm9712_soc_probe, + .remove = wm9712_soc_remove, + .resume = wm9712_soc_resume, + .set_bias_level = wm9712_set_bias_level, + .controls = wm9712_snd_ac97_controls, + .num_controls = ARRAY_SIZE(wm9712_snd_ac97_controls), + .dapm_widgets = wm9712_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm9712_dapm_widgets), + .dapm_routes = wm9712_audio_map, + .num_dapm_routes = ARRAY_SIZE(wm9712_audio_map), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int wm9712_probe(struct platform_device *pdev) @@ -713,26 +713,19 @@ static int wm9712_probe(struct platform_device *pdev) wm9712->mfd_pdata = dev_get_platdata(&pdev->dev); platform_set_drvdata(pdev, wm9712); - return snd_soc_register_codec(&pdev->dev, - &soc_codec_dev_wm9712, wm9712_dai, ARRAY_SIZE(wm9712_dai)); -} - -static int wm9712_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - return 0; + return devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_wm9712, wm9712_dai, ARRAY_SIZE(wm9712_dai)); } -static struct platform_driver wm9712_codec_driver = { +static struct platform_driver wm9712_component_driver = { .driver = { - .name = "wm9712-codec", + .name = "wm9712-component", }, .probe = wm9712_probe, - .remove = wm9712_remove, }; -module_platform_driver(wm9712_codec_driver); +module_platform_driver(wm9712_component_driver); MODULE_DESCRIPTION("ASoC WM9711/WM9712 driver"); MODULE_AUTHOR("Liam Girdwood");