From patchwork Fri Jan 12 01:39:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10159381 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 F0F4D601A1 for ; Fri, 12 Jan 2018 02:34:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D896328957 for ; Fri, 12 Jan 2018 02:34:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD17A28975; Fri, 12 Jan 2018 02:34:28 +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 3A76F28957 for ; Fri, 12 Jan 2018 02:34:27 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E4EB7267D03; Fri, 12 Jan 2018 03:34:25 +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 77177267CF6; Fri, 12 Jan 2018 03:34:24 +0100 (CET) Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id 5F6AD267D03 for ; Fri, 12 Jan 2018 02:39:28 +0100 (CET) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 12 Jan 2018 10:39:27 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 9D10A6B30F; Fri, 12 Jan 2018 10:39:27 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,346,1511794800"; d="scan'208";a="268010047" Received: from mail-pu1apc01lp0019.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.19]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-GCM-SHA384; 12 Jan 2018 10:39:26 +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=hc6iLPq3LTjniqtFCCboxZNoW9EyCyfWiJN8ntTyo4A=; b=j2NdI7jrF2TmXLbuI+ToGmweHRIUTmTS/jON+VUQ01/ZCjpXbczhUxPXfdzoYKd4yDE89vJS/u8SlJJZsQB//hypFSdFkN2gz+rsvK9qhUxaqj+b6R3IYagr6kWJi2257p+3TbO/81TCsNRWI0u6OU0Gkr7S9JLqi3e3GSHEGh4= 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 KL1PR0601MB1879.apcprd06.prod.outlook.com (2603:1096:802:8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Fri, 12 Jan 2018 01:39:24 +0000 Message-ID: <87373b97qv.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: <87bmhzevk9.wl%kuninori.morimoto.gx@renesas.com> References: <87bmhzevk9.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 12 Jan 2018 01:39:24 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: TY1PR01CA0138.jpnprd01.prod.outlook.com (2603:1096:402:1::14) To KL1PR0601MB1879.apcprd06.prod.outlook.com (2603:1096:802:8::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ca89cc56-9599-4f98-90cb-08d5595d5001 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020074)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:KL1PR0601MB1879; X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1879; 3:OOcfo5zPbMNce9FGkrY7J3r8zqznnBzDBazl+d4lOB9jTdsYaEcWFP2rgd+0pNUkJNjYe8AZF6Pia/jGWrOsDTzDeyvoSjFNJmD9DQtsS030Fi3cV4zy8Rvs3X8aEEAaWZnlm3rjveq3dejmvr7owysoNrqGn2pyPrF36HEtWqW3O/wkDnblwAZMrCc/02/q4wMlEUIrR2phnb+HRC4cAnwe5fjLgtHaexKnB5gNYmrZaCSKTZzLxuTifx6kRS9H; 25:JYD0etMtBQ+IaEbyt+qV+/eoec6dEklIizlLpagBZV1+5WMGDIeYa120jHlSDQ4ae4bQfoK8n3lv4z/eql6fSQxaaWOF8Yq2zsApOR1+KjwefN5l0iJZkkdzs/ZEkd6JQH5lWzfIRTRw1tyYej0QxweQKPiDcC/f3FatTEecMg1K9qD80cZ3USGWhuYtjLcEcG4XuT6VqHEHNperuIcji2huIcP76tYaPBQEbtCakj26Hy4rP014yiQc14grGohXJO7p6BIVOtmDj8gkBwJeWHtxgCkzMZ1ufpsfsYLyPvPiWczFutyj7z0YeV6S224J20zOBNlfPbMI2eSWOaWixA==; 31:rzBX0nxYhmT/W2gr+E3w+kZ5aG5ZLpYVjBYNiY7JwQ/YynZgT3O+9EIiDO7LHHzZ3sJzZE9gmXeEKzgAmm22czcsIuw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ange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231023)(944501138)(10201501046)(6055026)(6041268)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:KL1PR0601MB1879; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:KL1PR0601MB1879; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(39860400002)(346002)(366004)(396003)(39380400002)(189003)(199004)(6116002)(386003)(6486002)(106356001)(23726003)(83506002)(59450400001)(305945005)(2950100002)(53416004)(3846002)(66066001)(5660300001)(25786009)(47776003)(105586002)(478600001)(6916009)(69596002)(54906003)(36756003)(53936002)(8676002)(4326008)(81156014)(16586007)(8936002)(7696005)(76176011)(5890100001)(7736002)(50466002)(97736004)(58126008)(68736007)(52116002)(16526018)(2906002)(86362001)(81166006)(316002)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR0601MB1879; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; KL1PR0601MB1879; 23:6km+mPk/fp2+O3laVTZS237pTP4AwuBnZDJ+oeV?= =?us-ascii?Q?3hCXhYnDzpF88rODHLZwMgAY7DdrKKZqZfqRvxh5A/v6uhXZmIM7iMWN0MgL?= =?us-ascii?Q?Lo6h3+3g/4afOmf7QfUBy56btIHvlPf35tLjnCTtEPUlema1FyTVtqJn/VCe?= =?us-ascii?Q?zYXJXRv0cydqEDVRGijM5jbW2WMbhfu7PRHzRuEu033wle+Ne6OTSrfIPbYX?= =?us-ascii?Q?IMQK3+aoPeM1qWHhqqIdBD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 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1879; 20:Y6RN7NpPB+g2UBS+UxHDXtK3Z8fghS33TBtJ4F0AFE6WDc+uZM4tlA/jlfYqcX2wSvPEfd2L8s7jV2uAPsmM/uE3j0Z8AKKRpFXo0S5V7UR+uEF0ZrtqGKBNEc/IwLFTFeBW8L2GGG3X9/Up9SV2DC8ij4IEzEwyBSexa9p8s/E= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 01:39:24.7216 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca89cc56-9599-4f98-90cb-08d5595d5001 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB1879 Cc: Linux-ALSA , Simon Subject: [alsa-devel] [PATCH 106/187] 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 -> .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..5b730ae 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, + .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, };