From patchwork Mon Feb 12 12:51:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10212983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1113F60329 for ; Mon, 12 Feb 2018 13:36:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F382F28844 for ; Mon, 12 Feb 2018 13:36:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E884E28C72; Mon, 12 Feb 2018 13:36:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D38C828844 for ; Mon, 12 Feb 2018 13:36:34 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C5051268D5A; Mon, 12 Feb 2018 14:35:00 +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 9E1F8268D55; Mon, 12 Feb 2018 14:34:58 +0100 (CET) Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 08C35267B38 for ; Mon, 12 Feb 2018 13:51:50 +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=ozcfOzeVmV35f7V93hXXX77TCHiwmn0mL+Hlptpj39M=; b=WHPbbQkAfa8C CU2QmXE230j40ncvzcBhzPSqiS2KWQtSMBnyO70zI4TnPlVGMaauuGEPc16mlx8frQ2VRlOpm63s8 gRDZV6+hePTmE72YTeeO61PKiMf46xVfHb/2uXjoVj+Vn0zrQrXJYQx8c1qgNDbB5UycdSTsnoX8v xlOTs=; 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 1elDaG-0002aP-3M; Mon, 12 Feb 2018 12:51:48 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDaF-0006RI-Lu; Mon, 12 Feb 2018 12:51:47 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87po5t1g0i.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:51:47 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: cs4271: 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 X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: cs4271: 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 cac308fcd767a077e1119901d8bdd69e31189f67 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:50:28 +0000 Subject: [PATCH] ASoC: cs4271: 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/cs4271-i2c.c | 7 --- sound/soc/codecs/cs4271-spi.c | 7 --- sound/soc/codecs/cs4271.c | 105 +++++++++++++++++++++--------------------- 3 files changed, 52 insertions(+), 67 deletions(-) diff --git a/sound/soc/codecs/cs4271-i2c.c b/sound/soc/codecs/cs4271-i2c.c index dcb3223d7d8f..ff737304d50b 100644 --- a/sound/soc/codecs/cs4271-i2c.c +++ b/sound/soc/codecs/cs4271-i2c.c @@ -33,12 +33,6 @@ static int cs4271_i2c_probe(struct i2c_client *client, devm_regmap_init_i2c(client, &config)); } -static int cs4271_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id cs4271_i2c_id[] = { { "cs4271", 0 }, { } @@ -51,7 +45,6 @@ static struct i2c_driver cs4271_i2c_driver = { .of_match_table = of_match_ptr(cs4271_dt_ids), }, .probe = cs4271_i2c_probe, - .remove = cs4271_i2c_remove, .id_table = cs4271_i2c_id, }; module_i2c_driver(cs4271_i2c_driver); diff --git a/sound/soc/codecs/cs4271-spi.c b/sound/soc/codecs/cs4271-spi.c index 1ff5f520196a..217f6dc869e5 100644 --- a/sound/soc/codecs/cs4271-spi.c +++ b/sound/soc/codecs/cs4271-spi.c @@ -33,19 +33,12 @@ static int cs4271_spi_probe(struct spi_device *spi) return cs4271_probe(&spi->dev, devm_regmap_init_spi(spi, &config)); } -static int cs4271_spi_remove(struct spi_device *spi) -{ - snd_soc_unregister_codec(&spi->dev); - return 0; -} - static struct spi_driver cs4271_spi_driver = { .driver = { .name = "cs4271", .of_match_table = of_match_ptr(cs4271_dt_ids), }, .probe = cs4271_spi_probe, - .remove = cs4271_spi_remove, }; module_spi_driver(cs4271_spi_driver); diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 49a80627af12..849fdb2cb260 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c @@ -206,8 +206,8 @@ static const struct snd_soc_dapm_route cs4271_dapm_routes[] = { static int cs4271_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 cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); cs4271->mclk = freq; return 0; @@ -216,8 +216,8 @@ static int cs4271_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); unsigned int val = 0; int ret; @@ -230,7 +230,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, val |= CS4271_MODE1_MASTER; break; default: - dev_err(codec->dev, "Invalid DAI format\n"); + dev_err(component->dev, "Invalid DAI format\n"); return -EINVAL; } @@ -250,7 +250,7 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, return ret; break; default: - dev_err(codec->dev, "Invalid DAI format\n"); + dev_err(component->dev, "Invalid DAI format\n"); return -EINVAL; } @@ -263,9 +263,9 @@ static int cs4271_set_dai_fmt(struct snd_soc_dai *codec_dai, static int cs4271_deemph[] = {0, 44100, 48000, 32000}; -static int cs4271_set_deemph(struct snd_soc_codec *codec) +static int cs4271_set_deemph(struct snd_soc_component *component) { - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); int i, ret; int val = CS4271_DACCTL_DEM_DIS; @@ -289,8 +289,8 @@ static int cs4271_set_deemph(struct snd_soc_codec *codec) static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); ucontrol->value.integer.value[0] = cs4271->deemph; return 0; @@ -299,11 +299,11 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, static int cs4271_put_deemph(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); cs4271->deemph = ucontrol->value.integer.value[0]; - return cs4271_set_deemph(codec); + return cs4271_set_deemph(component); } struct cs4271_clk_cfg { @@ -349,8 +349,8 @@ static int cs4271_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 cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); int i, ret; unsigned int ratio, val; @@ -399,7 +399,7 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, break; if (i == CS4171_NR_RATIOS) { - dev_err(codec->dev, "Invalid sample rate\n"); + dev_err(component->dev, "Invalid sample rate\n"); return -EINVAL; } @@ -410,13 +410,13 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, if (ret < 0) return ret; - return cs4271_set_deemph(codec); + return cs4271_set_deemph(component); } static int cs4271_mute_stream(struct snd_soc_dai *dai, int mute, int stream) { - struct snd_soc_codec *codec = dai->codec; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); int ret; int val_a = 0; int val_b = 0; @@ -493,9 +493,9 @@ static struct snd_soc_dai_driver cs4271_dai = { .symmetric_rates = 1, }; -static int cs4271_reset(struct snd_soc_codec *codec) +static int cs4271_reset(struct snd_soc_component *component) { - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); if (gpio_is_valid(cs4271->gpio_nreset)) { gpio_direction_output(cs4271->gpio_nreset, 0); @@ -508,10 +508,10 @@ static int cs4271_reset(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int cs4271_soc_suspend(struct snd_soc_codec *codec) +static int cs4271_soc_suspend(struct snd_soc_component *component) { int ret; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); /* Set power-down bit */ ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, @@ -525,20 +525,20 @@ static int cs4271_soc_suspend(struct snd_soc_codec *codec) return 0; } -static int cs4271_soc_resume(struct snd_soc_codec *codec) +static int cs4271_soc_resume(struct snd_soc_component *component) { int ret; - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); if (ret < 0) { - dev_err(codec->dev, "Failed to enable regulators: %d\n", ret); + dev_err(component->dev, "Failed to enable regulators: %d\n", ret); return ret; } /* Do a proper reset after power up */ - cs4271_reset(codec); + cs4271_reset(component); /* Restore codec state */ ret = regcache_sync(cs4271->regmap); @@ -567,20 +567,20 @@ MODULE_DEVICE_TABLE(of, cs4271_dt_ids); EXPORT_SYMBOL_GPL(cs4271_dt_ids); #endif -static int cs4271_codec_probe(struct snd_soc_codec *codec) +static int cs4271_component_probe(struct snd_soc_component *component) { - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); - struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); + struct cs4271_platform_data *cs4271plat = component->dev->platform_data; int ret; bool amutec_eq_bmutec = false; #ifdef CONFIG_OF - if (of_match_device(cs4271_dt_ids, codec->dev)) { - if (of_get_property(codec->dev->of_node, + if (of_match_device(cs4271_dt_ids, component->dev)) { + if (of_get_property(component->dev->of_node, "cirrus,amutec-eq-bmutec", NULL)) amutec_eq_bmutec = true; - if (of_get_property(codec->dev->of_node, + if (of_get_property(component->dev->of_node, "cirrus,enable-soft-reset", NULL)) cs4271->enable_soft_reset = true; } @@ -589,7 +589,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); if (ret < 0) { - dev_err(codec->dev, "Failed to enable regulators: %d\n", ret); + dev_err(component->dev, "Failed to enable regulators: %d\n", ret); return ret; } @@ -599,7 +599,7 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) } /* Reset codec */ - cs4271_reset(codec); + cs4271_reset(component); ret = regcache_sync(cs4271->regmap); if (ret < 0) @@ -625,9 +625,9 @@ static int cs4271_codec_probe(struct snd_soc_codec *codec) return 0; } -static int cs4271_codec_remove(struct snd_soc_codec *codec) +static void cs4271_component_remove(struct snd_soc_component *component) { - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); if (gpio_is_valid(cs4271->gpio_nreset)) /* Set codec to the reset state */ @@ -635,24 +635,23 @@ static int cs4271_codec_remove(struct snd_soc_codec *codec) regcache_mark_dirty(cs4271->regmap); regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); - - return 0; }; -static const struct snd_soc_codec_driver soc_codec_dev_cs4271 = { - .probe = cs4271_codec_probe, - .remove = cs4271_codec_remove, +static const struct snd_soc_component_driver soc_component_dev_cs4271 = { + .probe = cs4271_component_probe, + .remove = cs4271_component_remove, .suspend = cs4271_soc_suspend, .resume = cs4271_soc_resume, - - .component_driver = { - .controls = cs4271_snd_controls, - .num_controls = ARRAY_SIZE(cs4271_snd_controls), - .dapm_widgets = cs4271_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs4271_dapm_widgets), - .dapm_routes = cs4271_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes), - }, + .controls = cs4271_snd_controls, + .num_controls = ARRAY_SIZE(cs4271_snd_controls), + .dapm_widgets = cs4271_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs4271_dapm_widgets), + .dapm_routes = cs4271_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int cs4271_common_probe(struct device *dev, @@ -721,8 +720,8 @@ int cs4271_probe(struct device *dev, struct regmap *regmap) dev_set_drvdata(dev, cs4271); cs4271->regmap = regmap; - return snd_soc_register_codec(dev, &soc_codec_dev_cs4271, &cs4271_dai, - 1); + return devm_snd_soc_register_component(dev, &soc_component_dev_cs4271, + &cs4271_dai, 1); } EXPORT_SYMBOL_GPL(cs4271_probe);