From patchwork Mon Feb 12 12:44:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128067 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3201868ljc; Mon, 12 Feb 2018 05:18:56 -0800 (PST) X-Google-Smtp-Source: AH8x227Gw4rUZCLOmsv3K/jzWKp8izW9FqCJL90IdyLWkaanHW6cviXER+an7Y2L82F8uD8n+3aP X-Received: by 10.28.53.130 with SMTP id c124mr3198463wma.110.1518441536707; Mon, 12 Feb 2018 05:18:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441536; cv=none; d=google.com; s=arc-20160816; b=yCkgc86wIwNLwMU+odEH4L/iSZh8tkhjeUju1lRotXhajMeXWUcFTT8ZKSusFYjSSZ zK5uE/mRPHtogMUA4FXddvkT01ipRHRykwlw5V1rTqm05GwpmXC6PXLiVhM1weh4i9o2 r0AScDmCn76OHOiW0WciU1WI2eZgR7/FUttgreQh8WtRjOiYE9aQiuWPtZp+SGRwGCCH 1VFlNwuQ6HYhsZNLACjfH9Vj7p6hdB5umG1nav6CgvUv4mkuJPCtKR0N0KtNcC/uPxgH k4d1b66vajHVYsOf71atL4VSrNrKdf7NnQ71Mt0aib+T5RsI4nBt8/gi5dK8loG4kxtl WyaA== 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=8y2xriDFaw7MC+cO5R+WHZlqLJH5bFVxIEU6S+dNCQo=; b=JwbD7rPINZYVQlUUAL8fIDCSPKBoeW0FazyzPkLzJ+tDhz/1Q+E8GOFpsnkf9xmQbW hrUjerqoa2wIpLZYxRgYotVbpf8sjm2eRWgcyCbCQfbUEoUrTLLBpu+GOKUR+JwrqPT/ oHzMAFq+sQaa7bus+ZSkG3hKCUKM7NNxS1P4njdSw3DBl06Xi1Ib2d3ESjLKGPyFfls8 HBmZz4teXHBPyXcHhsuD0pLnISsN6Rd9Q858QYBoZfjMojan7qjcSJ1tnA4uBCUcQQqG 6eVvqb29DEYaPp//tVE6eeOWjhXQ3gZTsUhf+zTDKSZVOjcVsE3KzhgaybaskyMLRAdp P3jg== 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=oEVU5pax; 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 a20si3578409wmd.195.2018.02.12.05.18.56; Mon, 12 Feb 2018 05:18:56 -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=oEVU5pax; 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 EDBC726869F; Mon, 12 Feb 2018 14:17:04 +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 96DBC267A11; Mon, 12 Feb 2018 14:17:03 +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 DAE6B267A14 for ; Mon, 12 Feb 2018 13:44:11 +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=i3V0jAIcoIr1nNrF99++W8vx4bhesXLYF8C67SZOnVM=; b=oEVU5paxT4m9 W6soZWv0V2JxzFXqZcm0tOypHg3lzJwGdfJmgRa63KDfcttpsFc2P+OKuhlGSdRGhySpQRg7sTn1p SQKi4rYOuILdq3y3bRjHWf5ORftlz6PCmBo+PtIWULj0v2mbUGZ836pYigEbtSUgn0OPakfYVjXOU L2UYA=; 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 1elDSr-0002Ol-VC; Mon, 12 Feb 2018 12:44:10 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDSr-000583-Gv; Mon, 12 Feb 2018 12:44:09 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87fu6p1frg.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:44:09 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: cs35l35: 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: cs35l35: 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 86c2eddfba351824cffccdd5182954c1cf0b9a8a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:55:56 +0000 Subject: [PATCH] ASoC: cs35l35: 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/cs35l35.c | 104 +++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 56 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/cs35l35.c b/sound/soc/codecs/cs35l35.c index 129978d1243e..a4a2cb171bdf 100644 --- a/sound/soc/codecs/cs35l35.c +++ b/sound/soc/codecs/cs35l35.c @@ -194,8 +194,8 @@ static int cs35l35_wait_for_pdn(struct cs35l35_private *cs35l35) static int cs35l35_sdin_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); int ret = 0; switch (event) { @@ -231,7 +231,7 @@ static int cs35l35_sdin_event(struct snd_soc_dapm_widget *w, 1 << CS35L35_AMP_DIGSFT_SHIFT); break; default: - dev_err(codec->dev, "Invalid event = 0x%x\n", event); + dev_err(component->dev, "Invalid event = 0x%x\n", event); ret = -EINVAL; } return ret; @@ -240,8 +240,8 @@ static int cs35l35_sdin_event(struct snd_soc_dapm_widget *w, static int cs35l35_main_amp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); unsigned int reg[4]; int i; @@ -301,7 +301,7 @@ static int cs35l35_main_amp_event(struct snd_soc_dapm_widget *w, break; default: - dev_err(codec->dev, "Invalid event = 0x%x\n", event); + dev_err(component->dev, "Invalid event = 0x%x\n", event); } return 0; } @@ -369,8 +369,8 @@ static const struct snd_soc_dapm_route cs35l35_audio_map[] = { static int cs35l35_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: @@ -470,8 +470,8 @@ static int cs35l35_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 cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); struct classh_cfg *classh = &cs35l35->pdata.classh_algo; int srate = params_rate(params); int ret = 0; @@ -482,7 +482,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream, int clk_ctl = cs35l35_get_clk_config(cs35l35->sysclk, srate); if (clk_ctl < 0) { - dev_err(codec->dev, "Invalid CLK:Rate %d:%d\n", + dev_err(component->dev, "Invalid CLK:Rate %d:%d\n", cs35l35->sysclk, srate); return -EINVAL; } @@ -490,7 +490,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream, ret = regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL2, CS35L35_CLK_CTL2_MASK, clk_ctl); if (ret != 0) { - dev_err(codec->dev, "Failed to set port config %d\n", ret); + dev_err(component->dev, "Failed to set port config %d\n", ret); return ret; } @@ -509,7 +509,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream, CS35L35_CH_WKFET_DEL_MASK, 0 << CS35L35_CH_WKFET_DEL_SHIFT); if (ret != 0) { - dev_err(codec->dev, "Failed to set fet config %d\n", + dev_err(component->dev, "Failed to set fet config %d\n", ret); return ret; } @@ -531,7 +531,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream, audin_format = CS35L35_SDIN_DEPTH_24; break; default: - dev_err(codec->dev, "Unsupported Width %d\n", + dev_err(component->dev, "Unsupported Width %d\n", params_width(params)); return -EINVAL; } @@ -554,7 +554,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream, * to configure the CLOCK_CTL3 register correctly */ if ((cs35l35->sclk / srate) % 4) { - dev_err(codec->dev, "Unsupported sclk/fs ratio %d:%d\n", + dev_err(component->dev, "Unsupported sclk/fs ratio %d:%d\n", cs35l35->sclk, srate); return -EINVAL; } @@ -568,7 +568,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream, case CS35L35_SP_SCLKS_64FS: break; default: - dev_err(codec->dev, "ratio not supported\n"); + dev_err(component->dev, "ratio not supported\n"); return -EINVAL; } } else { @@ -578,7 +578,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream, case CS35L35_SP_SCLKS_64FS: break; default: - dev_err(codec->dev, "ratio not supported\n"); + dev_err(component->dev, "ratio not supported\n"); return -EINVAL; } } @@ -587,7 +587,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream, CS35L35_SP_SCLKS_MASK, sp_sclks << CS35L35_SP_SCLKS_SHIFT); if (ret != 0) { - dev_err(codec->dev, "Failed to set fsclk %d\n", ret); + dev_err(component->dev, "Failed to set fsclk %d\n", ret); return ret; } } @@ -607,8 +607,8 @@ static const struct snd_pcm_hw_constraint_list cs35l35_constraints = { static int cs35l35_pcm_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); if (!substream->runtime) return 0; @@ -635,8 +635,8 @@ static const struct snd_pcm_hw_constraint_list cs35l35_pdm_constraints = { static int cs35l35_pdm_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); if (!substream->runtime) return 0; @@ -655,8 +655,8 @@ static int cs35l35_pdm_startup(struct snd_pcm_substream *substream, static int cs35l35_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = dai->codec; - struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); /* Need the SCLK Frequency regardless of sysclk source for I2S */ cs35l35->sclk = freq; @@ -712,11 +712,11 @@ static struct snd_soc_dai_driver cs35l35_dai[] = { }, }; -static int cs35l35_codec_set_sysclk(struct snd_soc_codec *codec, +static int cs35l35_component_set_sysclk(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir) { - struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); int clksrc; int ret = 0; @@ -731,7 +731,7 @@ static int cs35l35_codec_set_sysclk(struct snd_soc_codec *codec, clksrc = CS35L35_CLK_SOURCE_PDM; break; default: - dev_err(codec->dev, "Invalid CLK Source\n"); + dev_err(component->dev, "Invalid CLK Source\n"); return -EINVAL; } @@ -749,7 +749,7 @@ static int cs35l35_codec_set_sysclk(struct snd_soc_codec *codec, cs35l35->sysclk = freq; break; default: - dev_err(codec->dev, "Invalid CLK Frequency Input : %d\n", freq); + dev_err(component->dev, "Invalid CLK Frequency Input : %d\n", freq); return -EINVAL; } @@ -757,7 +757,7 @@ static int cs35l35_codec_set_sysclk(struct snd_soc_codec *codec, CS35L35_CLK_SOURCE_MASK, clksrc << CS35L35_CLK_SOURCE_SHIFT); if (ret != 0) { - dev_err(codec->dev, "Failed to set sysclk %d\n", ret); + dev_err(component->dev, "Failed to set sysclk %d\n", ret); return ret; } @@ -834,9 +834,9 @@ static int cs35l35_boost_inductor(struct cs35l35_private *cs35l35, return 0; } -static int cs35l35_codec_probe(struct snd_soc_codec *codec) +static int cs35l35_component_probe(struct snd_soc_component *component) { - struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec); + struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component); struct classh_cfg *classh = &cs35l35->pdata.classh_algo; struct monitor_cfg *monitor_config = &cs35l35->pdata.mon_cfg; int ret; @@ -880,7 +880,7 @@ static int cs35l35_codec_probe(struct snd_soc_codec *codec) regmap_update_bits(cs35l35->regmap, CS35L35_CLASS_H_CTL, CS35L35_CH_STEREO_MASK, 1 << CS35L35_CH_STEREO_SHIFT); - ret = snd_soc_add_codec_controls(codec, cs35l35_adv_controls, + ret = snd_soc_add_component_controls(component, cs35l35_adv_controls, ARRAY_SIZE(cs35l35_adv_controls)); if (ret) return ret; @@ -1079,20 +1079,19 @@ static int cs35l35_codec_probe(struct snd_soc_codec *codec) return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_cs35l35 = { - .probe = cs35l35_codec_probe, - .set_sysclk = cs35l35_codec_set_sysclk, - .component_driver = { - .dapm_widgets = cs35l35_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs35l35_dapm_widgets), - - .dapm_routes = cs35l35_audio_map, - .num_dapm_routes = ARRAY_SIZE(cs35l35_audio_map), - - .controls = cs35l35_aud_controls, - .num_controls = ARRAY_SIZE(cs35l35_aud_controls), - }, - +static const struct snd_soc_component_driver soc_component_dev_cs35l35 = { + .probe = cs35l35_component_probe, + .set_sysclk = cs35l35_component_set_sysclk, + .dapm_widgets = cs35l35_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs35l35_dapm_widgets), + .dapm_routes = cs35l35_audio_map, + .num_dapm_routes = ARRAY_SIZE(cs35l35_audio_map), + .controls = cs35l35_aud_controls, + .num_controls = ARRAY_SIZE(cs35l35_aud_controls), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static struct regmap_config cs35l35_regmap = { @@ -1617,10 +1616,10 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client, regmap_update_bits(cs35l35->regmap, CS35L35_PROTECT_CTL, CS35L35_AMP_MUTE_MASK, 1 << CS35L35_AMP_MUTE_SHIFT); - ret = snd_soc_register_codec(dev, &soc_codec_dev_cs35l35, cs35l35_dai, - ARRAY_SIZE(cs35l35_dai)); + ret = devm_snd_soc_register_component(dev, &soc_component_dev_cs35l35, + cs35l35_dai, ARRAY_SIZE(cs35l35_dai)); if (ret < 0) { - dev_err(dev, "Failed to register codec: %d\n", ret); + dev_err(dev, "Failed to register component: %d\n", ret); goto err; } @@ -1634,12 +1633,6 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client, return ret; } -static int cs35l35_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct of_device_id cs35l35_of_match[] = { {.compatible = "cirrus,cs35l35"}, {}, @@ -1660,7 +1653,6 @@ static struct i2c_driver cs35l35_i2c_driver = { }, .id_table = cs35l35_id, .probe = cs35l35_i2c_probe, - .remove = cs35l35_i2c_remove, }; module_i2c_driver(cs35l35_i2c_driver);