From patchwork Mon Jan 29 04:11:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10189087 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 1417260375 for ; Mon, 29 Jan 2018 04:39:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00A0828742 for ; Mon, 29 Jan 2018 04:39:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8BDF28786; Mon, 29 Jan 2018 04:39:33 +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=BAD_ENC_HEADER,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 CED3C28742 for ; Mon, 29 Jan 2018 04:39:32 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B841A267BBE; Mon, 29 Jan 2018 05:26:19 +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 C7779267BB4; Mon, 29 Jan 2018 05:26:16 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 6C9C32678A6 for ; Mon, 29 Jan 2018 05:11:59 +0100 (CET) Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 29 Jan 2018 13:11:58 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 8A8A352F09; Mon, 29 Jan 2018 13:11:58 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,429,1511794800"; d="scan'208";a="269594646" Received: from mail-hk2apc01lp0207.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.207]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Jan 2018 13:11:58 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=cGPxPb4r6hxt1f2KaZkwJTdq3VOQwELZXtf2GfB5UPY=; b=iaIndbXpCJZxtCoPZSB3r1830+qNzwOYhidmtE/R4xyeVXTXzGf8cTvdeWRlN6+cdVRBz/UiY9eEpytIaR83oFQNUepqn6wQgrz9N7xSEneW4VlNuo9C1eSlSj58HQSliB5ZpfM+lo+KwlmwHojn9i3kAxdIlnIEs5zdl6l3xdY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.138) by HK2PR0601MB1876.apcprd06.prod.outlook.com (2603:1096:202:a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 04:11:56 +0000 Message-ID: <878tchz4ng.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown In-Reply-To: <87inbl5q6q.wl%kuninori.morimoto.gx@renesas.com> References: <87607l8k9i.wl%kuninori.morimoto.gx@renesas.com> <87inbl5q6q.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Mon, 29 Jan 2018 04:11:56 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OS2PR01CA0071.jpnprd01.prod.outlook.com (2603:1096:600:2::31) To HK2PR0601MB1876.apcprd06.prod.outlook.com (2603:1096:202:a::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b75457dc-082c-4edd-34fc-08d566ce6fe0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:HK2PR0601MB1876; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1876; 3:kjbw9TY2NRu8JDCm4Ujj1x/yTsgjMoFhKe9Gt+bmO2TsrgOeuzyfdXD6oNNt8f1cufrFkeGf3yb5dlrfx2V8OqzTFuv5EMN/QZWkS42/Xqe5YlveDEcFZudd2L8rZpip67/bVM72TNefqNx3NU8WRRoJnqa6y4YNzuPGmu+9KIfKo/wVw9AmDcTvKb9RfaUleerhOa4UM6u+nZ17VRE3xP9kFXppTAbqRcCICaKwg0su1NZYsTZEmhYRTDNMG6P+; 25:P5LlkA7goQtnfE3TMe2+XZuLtAnPbCfEaVGPXbCuoqDfz6zTvC08bLUBiP7EPR9jLNE74CGUquvU1wvvFOTc3CcKu2TNqzGEKWrls3OPtZlp0Dxkrd0wXpwjaut0zPmEAnFYjdazVgShSPml2VUWIvZPx1NO+jpuX61jvmAerFd2IjbGNTUCsq3O4ehVYYoQrM6TwVBg+eX+RvPMDxSMaGpgGSoSoZoER7PSlUkORZNA/bBJ7Guq3FQjVYUPhhaIN/M7hQU+WxDMocTosDOeFU7j/s0qeFGAJh70Kt9nopfyKiqHi9rrKkqKnncsCKtWo7vDvuiffvnZFDDm1m2gRg==; 31:KFhgZWUh6aKQqEL7FOvsmv6D47Hwbq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JB98KXLR55EIp+lGZVx4Eby9LKBkFPrewHUt6u X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231101)(944501161)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:HK2PR0601MB1876; BCL:0; PCL:0; RULEID:; SRVR:HK2PR0601MB1876; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(346002)(39860400002)(366004)(39380400002)(376002)(199004)(189003)(3846002)(386003)(68736007)(59450400001)(4326008)(16586007)(6116002)(36756003)(478600001)(106356001)(53936002)(2950100002)(6486002)(6916009)(50466002)(26005)(23726003)(53416004)(8936002)(105586002)(47776003)(66066001)(5660300001)(58126008)(97736004)(316002)(186003)(305945005)(83506002)(76176011)(86362001)(8676002)(16526019)(5890100001)(25786009)(81166006)(81156014)(2906002)(52116002)(7696005)(7736002)(69596002)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR0601MB1876; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR0601MB1876; 23:qzXacumKEvPDeGKWokqcgYjj4eAoRwOEQHVl5L/?= =?us-ascii?Q?zJqV2z09/JKp/KjY0hlI4V2CJcuLDeC2Fj85AJvYSUk86cKQO6SpATFz2VHb?= =?us-ascii?Q?ASM9y8ZmcWw1vUSWWLrAeo+qjHAi5L6WagRqkXF4Qv8eTawKjG5L7O4K0wQK?= =?us-ascii?Q?ruufwmsXYAnPvPi+mn5rE/VTViQuzh7yTyS4pN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a1kDEvHEIKUftVeSdFZ8LXyPHhdCi3t+srs9m57AUsmaXhgQB00BrNWOK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1876; 20:6AXR02dezb2tGSH6wV/teHO1Bjg9v007XVPgSMbe9T66UZf8QNHVLXghfVhfO5gnLTC1yiGuYTzjwl8CWphROrMrV5eSA/uIhXM/zVMrFvbK/WwdeqgDmBEMmtdN3sv0mm2pm21th31NGCKY0NkZsgLKUUWnty+E+KASuj6V/x8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 04:11:56.5772 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b75457dc-082c-4edd-34fc-08d566ce6fe0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0601MB1876 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 106/186] ASoC: adau1701: replace codec to component 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/adau1701.c | 101 ++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 55 deletions(-) diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index 805afac..b5a6174 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -298,10 +298,10 @@ static int adau1701_safeload(struct sigmadsp *sigmadsp, unsigned int addr, .safeload = adau1701_safeload, }; -static int adau1701_reset(struct snd_soc_codec *codec, unsigned int clkdiv, +static int adau1701_reset(struct snd_soc_component *component, unsigned int clkdiv, unsigned int rate) { - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); int ret; sigmadsp_reset(adau1701->sigmadsp); @@ -348,7 +348,7 @@ static int adau1701_reset(struct snd_soc_codec *codec, unsigned int clkdiv, if (clkdiv != ADAU1707_CLKDIV_UNSET) { ret = sigmadsp_setup(adau1701->sigmadsp, rate); if (ret) { - dev_warn(codec->dev, "Failed to load firmware\n"); + dev_warn(component->dev, "Failed to load firmware\n"); return ret; } } @@ -362,10 +362,10 @@ static int adau1701_reset(struct snd_soc_codec *codec, unsigned int clkdiv, return 0; } -static int adau1701_set_capture_pcm_format(struct snd_soc_codec *codec, +static int adau1701_set_capture_pcm_format(struct snd_soc_component *component, struct snd_pcm_hw_params *params) { - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); unsigned int mask = ADAU1701_SEROCTL_WORD_LEN_MASK; unsigned int val; @@ -403,10 +403,10 @@ static int adau1701_set_capture_pcm_format(struct snd_soc_codec *codec, return 0; } -static int adau1701_set_playback_pcm_format(struct snd_soc_codec *codec, +static int adau1701_set_playback_pcm_format(struct snd_soc_component *component, struct snd_pcm_hw_params *params) { - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); unsigned int val; if (adau1701->dai_fmt != SND_SOC_DAIFMT_RIGHT_J) @@ -435,8 +435,8 @@ static int adau1701_set_playback_pcm_format(struct snd_soc_codec *codec, static int adau1701_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 adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); unsigned int clkdiv = adau1701->sysclk / params_rate(params); unsigned int val; int ret; @@ -447,7 +447,7 @@ static int adau1701_hw_params(struct snd_pcm_substream *substream, * firmware upload. */ if (clkdiv != adau1701->pll_clkdiv) { - ret = adau1701_reset(codec, clkdiv, params_rate(params)); + ret = adau1701_reset(component, clkdiv, params_rate(params)); if (ret < 0) return ret; } @@ -470,16 +470,16 @@ static int adau1701_hw_params(struct snd_pcm_substream *substream, ADAU1701_DSPCTRL_SR_MASK, val); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - return adau1701_set_playback_pcm_format(codec, params); + return adau1701_set_playback_pcm_format(component, params); else - return adau1701_set_capture_pcm_format(codec, params); + return adau1701_set_capture_pcm_format(component, params); } static int adau1701_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); unsigned int serictl = 0x00, seroctl = 0x00; bool invert_lrclk; @@ -548,11 +548,11 @@ static int adau1701_set_dai_fmt(struct snd_soc_dai *codec_dai, return 0; } -static int adau1701_set_bias_level(struct snd_soc_codec *codec, +static int adau1701_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { unsigned int mask = ADAU1701_AUXNPOW_VBPD | ADAU1701_AUXNPOW_VRPD; - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); switch (level) { case SND_SOC_BIAS_ON: @@ -576,9 +576,9 @@ static int adau1701_set_bias_level(struct snd_soc_codec *codec, static int adau1701_digital_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; unsigned int mask = ADAU1701_DSPCTRL_DAM; - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); unsigned int val; if (mute) @@ -591,11 +591,11 @@ static int adau1701_digital_mute(struct snd_soc_dai *dai, int mute) return 0; } -static int adau1701_set_sysclk(struct snd_soc_codec *codec, int clk_id, +static int adau1701_set_sysclk(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir) { unsigned int val; - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); switch (clk_id) { case ADAU1701_CLK_SRC_OSC: @@ -618,7 +618,7 @@ static int adau1701_set_sysclk(struct snd_soc_codec *codec, int clk_id, static int adau1701_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(dai->codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(dai->component); return sigmadsp_restrict_params(adau1701->sigmadsp, substream); } @@ -664,20 +664,20 @@ static int adau1701_startup(struct snd_pcm_substream *substream, MODULE_DEVICE_TABLE(of, adau1701_dt_ids); #endif -static int adau1701_probe(struct snd_soc_codec *codec) +static int adau1701_probe(struct snd_soc_component *component) { int i, ret; unsigned int val; - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); - ret = sigmadsp_attach(adau1701->sigmadsp, &codec->component); + ret = sigmadsp_attach(adau1701->sigmadsp, component); if (ret) return ret; ret = regulator_bulk_enable(ARRAY_SIZE(adau1701->supplies), adau1701->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; } @@ -690,7 +690,7 @@ static int adau1701_probe(struct snd_soc_codec *codec) adau1701->pll_clkdiv = ADAU1707_CLKDIV_UNSET; /* initalize with pre-configured pll mode settings */ - ret = adau1701_reset(codec, adau1701->pll_clkdiv, 0); + ret = adau1701_reset(component, adau1701->pll_clkdiv, 0); if (ret < 0) goto exit_regulators_disable; @@ -715,22 +715,20 @@ static int adau1701_probe(struct snd_soc_codec *codec) return ret; } -static int adau1701_remove(struct snd_soc_codec *codec) +static void adau1701_remove(struct snd_soc_component *component) { - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); if (gpio_is_valid(adau1701->gpio_nreset)) gpio_set_value_cansleep(adau1701->gpio_nreset, 0); regulator_bulk_disable(ARRAY_SIZE(adau1701->supplies), adau1701->supplies); - - return 0; } #ifdef CONFIG_PM -static int adau1701_suspend(struct snd_soc_codec *codec) +static int adau1701_suspend(struct snd_soc_component *component) { - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); regulator_bulk_disable(ARRAY_SIZE(adau1701->supplies), adau1701->supplies); @@ -738,42 +736,41 @@ static int adau1701_suspend(struct snd_soc_codec *codec) return 0; } -static int adau1701_resume(struct snd_soc_codec *codec) +static int adau1701_resume(struct snd_soc_component *component) { - struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); + struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component); int ret; ret = regulator_bulk_enable(ARRAY_SIZE(adau1701->supplies), adau1701->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; } - return adau1701_reset(codec, adau1701->pll_clkdiv, 0); + return adau1701_reset(component, adau1701->pll_clkdiv, 0); } #else #define adau1701_resume NULL #define adau1701_suspend NULL #endif /* CONFIG_PM */ -static const struct snd_soc_codec_driver adau1701_codec_drv = { +static const struct snd_soc_component_driver adau1701_component_drv = { .probe = adau1701_probe, .remove = adau1701_remove, .resume = adau1701_resume, .suspend = adau1701_suspend, .set_bias_level = adau1701_set_bias_level, - .idle_bias_off = true, - - .component_driver = { - .controls = adau1701_controls, - .num_controls = ARRAY_SIZE(adau1701_controls), - .dapm_widgets = adau1701_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(adau1701_dapm_widgets), - .dapm_routes = adau1701_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(adau1701_dapm_routes), - }, + .controls = adau1701_controls, + .num_controls = ARRAY_SIZE(adau1701_controls), + .dapm_widgets = adau1701_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(adau1701_dapm_widgets), + .dapm_routes = adau1701_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(adau1701_dapm_routes), .set_sysclk = adau1701_set_sysclk, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config adau1701_regmap = { @@ -889,7 +886,8 @@ static int adau1701_i2c_probe(struct i2c_client *client, goto exit_regulators_disable; } - ret = snd_soc_register_codec(&client->dev, &adau1701_codec_drv, + ret = devm_snd_soc_register_component(&client->dev, + &adau1701_component_drv, &adau1701_dai, 1); exit_regulators_disable: @@ -898,12 +896,6 @@ static int adau1701_i2c_probe(struct i2c_client *client, return ret; } -static int adau1701_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id adau1701_i2c_id[] = { { "adau1401", 0 }, { "adau1401a", 0 }, @@ -919,7 +911,6 @@ static int adau1701_i2c_remove(struct i2c_client *client) .of_match_table = of_match_ptr(adau1701_dt_ids), }, .probe = adau1701_i2c_probe, - .remove = adau1701_i2c_remove, .id_table = adau1701_i2c_id, };