From patchwork Mon Feb 12 12:45:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128089 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3205169ljc; Mon, 12 Feb 2018 05:23:02 -0800 (PST) X-Google-Smtp-Source: AH8x225bI8K+4uwrmB8m4P9qeJYMAmRbUxcdmncQzQsYCK8bakQdqiSjKwxGYm2rwLGfLrDJG+0+ X-Received: by 10.223.153.23 with SMTP id x23mr1157785wrb.134.1518441782258; Mon, 12 Feb 2018 05:23:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441782; cv=none; d=google.com; s=arc-20160816; b=VO0uf3qXLHEmwDpBKysAYMSRgNjGpSYUXLD5H3aLKvN0A4UI0enSzFq1CXtjvjhc8S QVkSsDiyLrMCp2QtcuQE3I3nOvVqs90XbqBfoAbpSa4ZG4LBl/CrwjvC/po9I/FgflhY c0GeZIEjkw2pMxKnpSEplkrpA+UIjesnvK0wP6ZDsxZT2SvJCrRuHRo12dBauJrOsPdO UZF/lf5qIPyg9nKGJI5Fn1rThVkaMTh1WruPFY+BV+oDwVG5CHiuKeEdP32GGP16jFpu nDkfMl9ZFABKBkGiJf7AEeIKxirUPiwIeDFMQmCUGTL5iw9muuxrmUW/mDOguLU/6bFV B7pA== 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=bKteyWTkRZo9LkWEu0hYefTM5haJ3r8qjxc6cl8JycE=; b=x8W9ofxXH22ZDiGF2pp4rTwHbQ8K6Ht7NlDraM8wqynLhNUAjGBNHffA1RXoDbS9qi NsBds9Fw8bo8Jo05LmEEolJXYlbiF/24/HljX84VZLd0lvkD5ncv8wt44EGfCxxufXTC MgBTcLlB3BPFvmrgsI99OqBpTW2iLgg7YuUNLZmisaNDdtMj9waX245r6Z3Dad5A/K+2 0ZZBxRXr2wav2BpnqVgS1T8x6cgwICeUIgYdTuNlP2nOdK7ToMNEKkCAMxqRBtrQjkHF KAOhYLKD4QAV7pApiWhj3dONM/VfLJYH2PC6kRK0dkQhjUEWICYDULpmPVHZ00A+B9KZ JVFw== 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=WPXfC0OC; 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 t26si4013300wmh.231.2018.02.12.05.23.02; Mon, 12 Feb 2018 05:23:02 -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=WPXfC0OC; 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 4C80A267D2B; Mon, 12 Feb 2018 14:20:14 +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 D03CB267D24; Mon, 12 Feb 2018 14:20:13 +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 5C55E267D31 for ; Mon, 12 Feb 2018 13:45:52 +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=rgHUzF3JBXqir0AAuIPqCYMOKS7NINenQA+8UVES8LI=; b=WPXfC0OCoRqU nHEk0gx+S2QajmV2bYye/qreroR4Wt2FU+OYp7G+0aO1QkRyLk/qa6tnQApkttzGlOXCZUTdKrfgT b54Ti+ARXXWME3c1JQoiDxhYbnEcacBMHplD+tDZfzVzSLMX5fXSU7qoKJ2L9dbqgTL4f+W4YFA0v ln5v8=; 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 1elDUU-0002Qy-HU; Mon, 12 Feb 2018 12:45:50 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDUU-0005Oe-3V; Mon, 12 Feb 2018 12:45:50 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <878tch2w8u.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:45:50 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: ak4641: 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: ak4641: 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 2b5c3e43cb0c5d9f6ab66baabb3dc08ee9f23e7b Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:14:32 +0000 Subject: [PATCH] ASoC: ak4641: 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/ak4641.c | 91 ++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 45 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/ak4641.c b/sound/soc/codecs/ak4641.c index 60142ff32d4f..05869beff26e 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c @@ -70,9 +70,9 @@ static const struct reg_default ak4641_reg_defaults[] = { static const int deemph_settings[] = {44100, 0, 48000, 32000}; -static int ak4641_set_deemph(struct snd_soc_codec *codec) +static int ak4641_set_deemph(struct snd_soc_component *component) { - struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); + struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); int i, best = 0; for (i = 0 ; i < ARRAY_SIZE(deemph_settings); i++) { @@ -86,16 +86,16 @@ static int ak4641_set_deemph(struct snd_soc_codec *codec) best = i; } - dev_dbg(codec->dev, "Set deemphasis %d\n", best); + dev_dbg(component->dev, "Set deemphasis %d\n", best); - return snd_soc_update_bits(codec, AK4641_DAC, 0x3, best); + return snd_soc_component_update_bits(component, AK4641_DAC, 0x3, best); } static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); int deemph = ucontrol->value.integer.value[0]; if (deemph > 1) @@ -103,14 +103,14 @@ static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, ak4641->deemph = deemph; - return ak4641_set_deemph(codec); + return ak4641_set_deemph(component); } static int ak4641_get_deemph(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); ucontrol->value.integer.value[0] = ak4641->deemph; return 0; @@ -307,8 +307,8 @@ static const struct snd_soc_dapm_route ak4641_audio_map[] = { static int ak4641_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 ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); ak4641->sysclk = freq; return 0; @@ -318,8 +318,8 @@ static int ak4641_i2s_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 ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); int rate = params_rate(params), fs = 256; u8 mode2; @@ -340,16 +340,16 @@ static int ak4641_i2s_hw_params(struct snd_pcm_substream *substream, mode2 = (0x0 << 5); break; default: - dev_err(codec->dev, "Error: unsupported fs=%d\n", fs); + dev_err(component->dev, "Error: unsupported fs=%d\n", fs); return -EINVAL; } - snd_soc_update_bits(codec, AK4641_MODE2, (0x3 << 5), mode2); + snd_soc_component_update_bits(component, AK4641_MODE2, (0x3 << 5), mode2); /* Update de-emphasis filter for the new rate */ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ak4641->playback_fs = rate; - ak4641_set_deemph(codec); + ak4641_set_deemph(component); } return 0; @@ -358,7 +358,7 @@ static int ak4641_i2s_hw_params(struct snd_pcm_substream *substream, static int ak4641_pcm_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; u8 btif; int ret; @@ -380,7 +380,7 @@ static int ak4641_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - ret = snd_soc_update_bits(codec, AK4641_BTIF, (0x3 << 5), btif); + ret = snd_soc_component_update_bits(component, AK4641_BTIF, (0x3 << 5), btif); if (ret < 0) return ret; @@ -390,7 +390,7 @@ static int ak4641_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ak4641_i2s_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; u8 mode1 = 0; /* interface format */ @@ -405,34 +405,34 @@ static int ak4641_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - return snd_soc_write(codec, AK4641_MODE1, mode1); + return snd_soc_component_write(component, AK4641_MODE1, mode1); } static int ak4641_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; - return snd_soc_update_bits(codec, AK4641_DAC, 0x20, mute ? 0x20 : 0); + return snd_soc_component_update_bits(component, AK4641_DAC, 0x20, mute ? 0x20 : 0); } -static int ak4641_set_bias_level(struct snd_soc_codec *codec, +static int ak4641_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); - struct ak4641_platform_data *pdata = codec->dev->platform_data; + struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); + struct ak4641_platform_data *pdata = component->dev->platform_data; int ret; switch (level) { case SND_SOC_BIAS_ON: /* unmute */ - snd_soc_update_bits(codec, AK4641_DAC, 0x20, 0); + snd_soc_component_update_bits(component, AK4641_DAC, 0x20, 0); break; case SND_SOC_BIAS_PREPARE: /* mute */ - snd_soc_update_bits(codec, AK4641_DAC, 0x20, 0x20); + snd_soc_component_update_bits(component, AK4641_DAC, 0x20, 0x20); 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) { if (pdata && gpio_is_valid(pdata->gpio_power)) gpio_set_value(pdata->gpio_power, 1); mdelay(1); @@ -442,16 +442,16 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec, ret = regcache_sync(ak4641->regmap); if (ret) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to sync cache: %d\n", ret); return ret; } } - snd_soc_update_bits(codec, AK4641_PM1, 0x80, 0x80); - snd_soc_update_bits(codec, AK4641_PM2, 0x80, 0); + snd_soc_component_update_bits(component, AK4641_PM1, 0x80, 0x80); + snd_soc_component_update_bits(component, AK4641_PM2, 0x80, 0); break; case SND_SOC_BIAS_OFF: - snd_soc_update_bits(codec, AK4641_PM1, 0x80, 0); + snd_soc_component_update_bits(component, AK4641_PM1, 0x80, 0); if (pdata && gpio_is_valid(pdata->gpio_npdn)) gpio_set_value(pdata->gpio_npdn, 0); if (pdata && gpio_is_valid(pdata->gpio_power)) @@ -524,17 +524,19 @@ static struct snd_soc_dai_driver ak4641_dai[] = { }, }; -static const struct snd_soc_codec_driver soc_codec_dev_ak4641 = { - .component_driver = { - .controls = ak4641_snd_controls, - .num_controls = ARRAY_SIZE(ak4641_snd_controls), - .dapm_widgets = ak4641_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ak4641_dapm_widgets), - .dapm_routes = ak4641_audio_map, - .num_dapm_routes = ARRAY_SIZE(ak4641_audio_map), - }, +static const struct snd_soc_component_driver soc_component_dev_ak4641 = { + .controls = ak4641_snd_controls, + .num_controls = ARRAY_SIZE(ak4641_snd_controls), + .dapm_widgets = ak4641_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak4641_dapm_widgets), + .dapm_routes = ak4641_audio_map, + .num_dapm_routes = ARRAY_SIZE(ak4641_audio_map), .set_bias_level = ak4641_set_bias_level, - .suspend_bias_off = true, + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config ak4641_regmap = { @@ -583,7 +585,8 @@ static int ak4641_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, ak4641); - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak4641, + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_ak4641, ak4641_dai, ARRAY_SIZE(ak4641_dai)); if (ret != 0) goto err_gpio2; @@ -608,8 +611,6 @@ static int ak4641_i2c_remove(struct i2c_client *i2c) { struct ak4641_platform_data *pdata = i2c->dev.platform_data; - snd_soc_unregister_codec(&i2c->dev); - if (pdata) { if (gpio_is_valid(pdata->gpio_power)) { gpio_set_value(pdata->gpio_power, 0);