From patchwork Fri Jan 12 01:19:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10159189 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 6B7856029B for ; Fri, 12 Jan 2018 01:23:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56D44269E2 for ; Fri, 12 Jan 2018 01:23:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 489382870F; Fri, 12 Jan 2018 01:23:31 +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 F3EDB269E2 for ; Fri, 12 Jan 2018 01:23:29 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BC457267B49; Fri, 12 Jan 2018 02:23:28 +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 55BED267B48; Fri, 12 Jan 2018 02:23:27 +0100 (CET) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 3E5F3267BBB for ; Fri, 12 Jan 2018 02:19:23 +0100 (CET) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie1.idc.renesas.com with ESMTP; 12 Jan 2018 10:19:06 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 2FCBF69B69; Fri, 12 Jan 2018 10:19:06 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,346,1511794800"; d="scan'208";a="268007078" Received: from mail-sg2apc01lp0248.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.248]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 12 Jan 2018 10:19:05 +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=ag0z+7i+AlZ+D1BerD/UbHyFUjem4oqm01ZoEyf+0Oo=; b=Pcmx8afPC/7U7rzdABHLHFSeWFBQs5NNgpmLveOKcO4WlB2kUpkHrXjhf4Ac8sOdrjND0xJ0NfHIGbHLVDEpaQ9OdOR2ajhQpxlcSm61qR9iJD3dL9tYrkNNQXrcAT6iZR/G7cfFhYcPFCuMS3Kd3GuoygdVe4CrUbncs/wRo1M= Received: from morimoto-PC.renesas.com (211.11.155.138) by HK2PR0601MB1875.apcprd06.prod.outlook.com (2603:1096:202:a::19) 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:19:03 +0000 Message-ID: <87tvvrc1to.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:19:03 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: TYXPR0101CA0007.jpnprd01.prod.outlook.com (2603:1096:401:1::17) To HK2PR0601MB1875.apcprd06.prod.outlook.com (2603:1096:202:a::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ea8fdc66-1979-4a2f-d169-08d5595a7818 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020074)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:HK2PR0601MB1875; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1875; 3:WEO/D673aLdZb6Wv//MCmFexAs5syIyXX5knY11jyZtO2BFvm1tmaJX03dlRcwmIC6gAr5wW0JfzFYzFSO+DaBSBztRYjDite5KluHrAJVO+5B8Mzpj7nurtiX0nEDMoyT09ZWW/5eVoVYXqdjf1pz6t4WerqybZ3bjL89+5HfkXg0nA9QMT5JjCddKwg1vD/peBvqAK52Kx9aYHE9iC0RLx4sxtff4YspFsIqioR06PHDbDOvhq7dRKWxQOKoQ+; 25:Uj2hcFA+hgJoMVJrAU2nRy0qV/eI29M/CX6hX/pVb1ifkC/OxYfgjO8u8H62JZPdD7RgYJBLo811sEXytPORGHJL2UzFnzXTRRnirUhJVemH6f0Eouimlob07k39z2PNyNezYcr1bYzv2afKPzSLIwhDFfb9l6aSAtM/lcwMau5zugHl0Ros3+C0m2xq4TYSi019M0qka9IJP1XZCQRFRzPxddZN+E6Cz+JrOIPX8L77L8e9Cj12CW7nzwJC09Hv91nKHyJxiNpz9Vp3BQT4BYAxrHmkjNuMaqbKH4H5s9G0KBxbT45l4kYlJIdDpc+STYa+ERwgoYWZnMMnI2iOSg==; 31:q950PeJUbjYbs31YGwRHwjNJoznRmGg/qdyKO/0yuWzEGs17I38wu6BLi4LReVGL/iOv7WJLKc2WseEThTD4oZBI+HJudxKZ7UC0Js91eJZK1izqAYYKjgMb5N2NVrF55RV1X+YX1RYlRd992mCTqffLR2BCvMUgoSkhJLL3cyaTVR2g/zDUbbUBocPOonZOqQsn5RD6YyJsjTBey/zrB41X8pInW/M62+8LSCWdw3k= X-MS-TrafficTypeDiagnostic: HK2PR0601MB1875: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1875; 20:hi6DbFutEst2oPVmf4BQePRSzDucGwbz9pheUdGRl+lWFM6ufCs3GeusaCVa4SnhqaWZZHMt1KqIkbGITY5aA2as9FzkVaqFKRoW6UcEBpoOecLkdkKmUveVwDK/NQL0SodYANG/nnZRZM9Lgo4s89XNQL2KP+P5F2t0DT1F9ZKoTRGHf6Jmjdpm29/MyvRodX8gj8nC13ToTC2sxLzvy4m3dvlg5nSWDR/8QYTPFIIfvNWJbxJennPo03pUpNrejNr8cWeDiOU2486dWwhVblugOsNRLDlBDSvrRTe+RWil1R6XKmhPeoR37JcgncGgbOuH5Y8o8EAb9hlpCWMRjKbbQkM3oRflbfY5iFHs/bpKteo8K3psErkgUP2blel52JrwupVUl5TMPZaUEI+8XgqJa8XIY3BudT7ol5eC/LFrlCuq1en8tdlfYjw3+QtoPsGr13V4fXj4zScZEVVyosCcgE9x9XqBudvE9QmcpLgGHyxwzil1PbRbZkznI8M3; 4:B14+x1FayojY5l+a22uCB4j8LrhvwF9EMka1FJyPhFtDjo2Z0gKYo4FZ6/ynSzRSnardj/UGircMxTIMV1U/bmEbZhSUUwgtd5d85hCMBl4aaC0pka87BseePIYNdf2CQJzP5/d5eQQ3o0VW+Ka3Xz6Nlu/ar8HVSs9v6oHrwa1UqowAqmMlshAln5B5kxFwvQ/j39m0JYML0pgaNDugKtHMCTrrVdNX4sMUbPJI7B2tQCe7xC9o3pt9/3E39Vyqx5IXL4ACziwXsVb3y6gHzazNBcP9jWUpHuIwwUnjvNf+Jv/U04/37anPKVW7Tc6I X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231023)(944501138)(10201501046)(3002001)(6055026)(6041268)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:HK2PR0601MB1875; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HK2PR0601MB1875; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(39860400002)(346002)(396003)(39380400002)(376002)(189003)(199004)(6486002)(81156014)(4326008)(25786009)(81166006)(69596002)(8676002)(86362001)(7736002)(47776003)(305945005)(58126008)(316002)(54906003)(97736004)(16586007)(16526018)(478600001)(53936002)(66066001)(59450400001)(386003)(83506002)(2950100002)(6916009)(105586002)(106356001)(53416004)(76176011)(6116002)(3846002)(52116002)(5660300001)(23726003)(2906002)(36756003)(50466002)(8936002)(7696005)(68736007)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR0601MB1875; 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; HK2PR0601MB1875; 23:4r64FJVYQYMlYxpYIs2sUePbBmBDGN83TZRTG7c?= =?us-ascii?Q?DpriNdjlVoQoZre8NbmbHuMURA5I9X8KlZXvIxRoZ9Jf+xrmwyJcDx7jVaGF?= =?us-ascii?Q?6YU4ntaU7WRqdy5mVWV1tGujY7fGj760sA/eLwab8yE5zm5mRBT4te5cdlaT?= =?us-ascii?Q?w5rsnnJ3wmvghhRnV4Zjh2FuBcPC+2UVdO+LlqGD1BLDkOF7IJl/9fN+vhBV?= =?us-ascii?Q?dxpq/ND2Aeg7qU7oPb3tfEzqpIFgOk9eb9OopAUKX6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1; HK2PR0601MB1875; 20:rMWSiqz4oR3xvWnSPspA5s61KiLF5BjFvUamyDnwKa2935Ij36kTDLTgxg/VOrVwv91kzj7+9qRqvQiTe6B7hwPXGfBt9xyrG1aopFVEf+pGNgZoDFd5iFfueAU/gzwdIMiCh28MIP9tRIrlhSdMdtQRhBDFYAtr+XSEyMHJmy8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 01:19:03.4926 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea8fdc66-1979-4a2f-d169-08d5595a7818 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0601MB1875 Cc: Linux-ALSA , Simon Subject: [alsa-devel] [PATCH 038/187] ASoC: wm8991: 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 = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/wm8991.c | 167 ++++++++++++++++++++++------------------------ 1 file changed, 80 insertions(+), 87 deletions(-) diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index 802c0694..99c397b 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c @@ -133,7 +133,7 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(out_sidetone_tlv, static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); int reg = kcontrol->private_value & 0xff; int ret; u16 val; @@ -143,8 +143,8 @@ static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, return ret; /* now hit the volume update bits (always bit 8) */ - val = snd_soc_read(codec, reg); - return snd_soc_write(codec, reg, val | 0x0100); + val = snd_soc_component_read32(component, reg); + return snd_soc_component_write(component, reg, val | 0x0100); } static const char *wm8991_digital_sidetone[] = @@ -361,14 +361,14 @@ static SOC_ENUM_SINGLE_DECL(wm8991_right_adcmode_enum, static int outmixer_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 snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); u32 reg_shift = kcontrol->private_value & 0xfff; int ret = 0; u16 reg; switch (reg_shift) { case WM8991_SPEAKER_MIXER | (WM8991_LDSPK_BIT << 8): - reg = snd_soc_read(codec, WM8991_OUTPUT_MIXER1); + reg = snd_soc_component_read32(component, WM8991_OUTPUT_MIXER1); if (reg & WM8991_LDLO) { printk(KERN_WARNING "Cannot set as Output Mixer 1 LDLO Set\n"); @@ -377,7 +377,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, break; case WM8991_SPEAKER_MIXER | (WM8991_RDSPK_BIT << 8): - reg = snd_soc_read(codec, WM8991_OUTPUT_MIXER2); + reg = snd_soc_component_read32(component, WM8991_OUTPUT_MIXER2); if (reg & WM8991_RDRO) { printk(KERN_WARNING "Cannot set as Output Mixer 2 RDRO Set\n"); @@ -386,7 +386,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, break; case WM8991_OUTPUT_MIXER1 | (WM8991_LDLO_BIT << 8): - reg = snd_soc_read(codec, WM8991_SPEAKER_MIXER); + reg = snd_soc_component_read32(component, WM8991_SPEAKER_MIXER); if (reg & WM8991_LDSPK) { printk(KERN_WARNING "Cannot set as Speaker Mixer LDSPK Set\n"); @@ -395,7 +395,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, break; case WM8991_OUTPUT_MIXER2 | (WM8991_RDRO_BIT << 8): - reg = snd_soc_read(codec, WM8991_SPEAKER_MIXER); + reg = snd_soc_component_read32(component, WM8991_SPEAKER_MIXER); if (reg & WM8991_RDSPK) { printk(KERN_WARNING "Cannot set as Speaker Mixer RDSPK Set\n"); @@ -927,31 +927,31 @@ static int wm8991_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, int src, unsigned int freq_in, unsigned int freq_out) { u16 reg; - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; struct _pll_div pll_div; if (freq_in && freq_out) { pll_factors(&pll_div, freq_out * 4, freq_in); /* Turn on PLL */ - reg = snd_soc_read(codec, WM8991_POWER_MANAGEMENT_2); + reg = snd_soc_component_read32(component, WM8991_POWER_MANAGEMENT_2); reg |= WM8991_PLL_ENA; - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_2, reg); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_2, reg); /* sysclk comes from PLL */ - reg = snd_soc_read(codec, WM8991_CLOCKING_2); - snd_soc_write(codec, WM8991_CLOCKING_2, reg | WM8991_SYSCLK_SRC); + reg = snd_soc_component_read32(component, WM8991_CLOCKING_2); + snd_soc_component_write(component, WM8991_CLOCKING_2, reg | WM8991_SYSCLK_SRC); /* set up N , fractional mode and pre-divisor if necessary */ - snd_soc_write(codec, WM8991_PLL1, pll_div.n | WM8991_SDM | + snd_soc_component_write(component, WM8991_PLL1, pll_div.n | WM8991_SDM | (pll_div.div2 ? WM8991_PRESCALE : 0)); - snd_soc_write(codec, WM8991_PLL2, (u8)(pll_div.k>>8)); - snd_soc_write(codec, WM8991_PLL3, (u8)(pll_div.k & 0xFF)); + snd_soc_component_write(component, WM8991_PLL2, (u8)(pll_div.k>>8)); + snd_soc_component_write(component, WM8991_PLL3, (u8)(pll_div.k & 0xFF)); } else { /* Turn on PLL */ - reg = snd_soc_read(codec, WM8991_POWER_MANAGEMENT_2); + reg = snd_soc_component_read32(component, WM8991_POWER_MANAGEMENT_2); reg &= ~WM8991_PLL_ENA; - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_2, reg); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_2, reg); } return 0; } @@ -962,11 +962,11 @@ static int wm8991_set_dai_pll(struct snd_soc_dai *codec_dai, static int wm8991_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; u16 audio1, audio3; - audio1 = snd_soc_read(codec, WM8991_AUDIO_INTERFACE_1); - audio3 = snd_soc_read(codec, WM8991_AUDIO_INTERFACE_3); + audio1 = snd_soc_component_read32(component, WM8991_AUDIO_INTERFACE_1); + audio3 = snd_soc_component_read32(component, WM8991_AUDIO_INTERFACE_3); /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -1007,37 +1007,37 @@ static int wm8991_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - snd_soc_write(codec, WM8991_AUDIO_INTERFACE_1, audio1); - snd_soc_write(codec, WM8991_AUDIO_INTERFACE_3, audio3); + snd_soc_component_write(component, WM8991_AUDIO_INTERFACE_1, audio1); + snd_soc_component_write(component, WM8991_AUDIO_INTERFACE_3, audio3); return 0; } static int wm8991_set_dai_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; u16 reg; switch (div_id) { case WM8991_MCLK_DIV: - reg = snd_soc_read(codec, WM8991_CLOCKING_2) & + reg = snd_soc_component_read32(component, WM8991_CLOCKING_2) & ~WM8991_MCLK_DIV_MASK; - snd_soc_write(codec, WM8991_CLOCKING_2, reg | div); + snd_soc_component_write(component, WM8991_CLOCKING_2, reg | div); break; case WM8991_DACCLK_DIV: - reg = snd_soc_read(codec, WM8991_CLOCKING_2) & + reg = snd_soc_component_read32(component, WM8991_CLOCKING_2) & ~WM8991_DAC_CLKDIV_MASK; - snd_soc_write(codec, WM8991_CLOCKING_2, reg | div); + snd_soc_component_write(component, WM8991_CLOCKING_2, reg | div); break; case WM8991_ADCCLK_DIV: - reg = snd_soc_read(codec, WM8991_CLOCKING_2) & + reg = snd_soc_component_read32(component, WM8991_CLOCKING_2) & ~WM8991_ADC_CLKDIV_MASK; - snd_soc_write(codec, WM8991_CLOCKING_2, reg | div); + snd_soc_component_write(component, WM8991_CLOCKING_2, reg | div); break; case WM8991_BCLK_DIV: - reg = snd_soc_read(codec, WM8991_CLOCKING_1) & + reg = snd_soc_component_read32(component, WM8991_CLOCKING_1) & ~WM8991_BCLK_DIV_MASK; - snd_soc_write(codec, WM8991_CLOCKING_1, reg | div); + snd_soc_component_write(component, WM8991_CLOCKING_1, reg | div); break; default: return -EINVAL; @@ -1053,8 +1053,8 @@ static int wm8991_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; - u16 audio1 = snd_soc_read(codec, WM8991_AUDIO_INTERFACE_1); + struct snd_soc_component *component = dai->component; + u16 audio1 = snd_soc_component_read32(component, WM8991_AUDIO_INTERFACE_1); audio1 &= ~WM8991_AIF_WL_MASK; /* bit size */ @@ -1072,27 +1072,27 @@ static int wm8991_hw_params(struct snd_pcm_substream *substream, break; } - snd_soc_write(codec, WM8991_AUDIO_INTERFACE_1, audio1); + snd_soc_component_write(component, WM8991_AUDIO_INTERFACE_1, audio1); return 0; } static int wm8991_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; u16 val; - val = snd_soc_read(codec, WM8991_DAC_CTRL) & ~WM8991_DAC_MUTE; + val = snd_soc_component_read32(component, WM8991_DAC_CTRL) & ~WM8991_DAC_MUTE; if (mute) - snd_soc_write(codec, WM8991_DAC_CTRL, val | WM8991_DAC_MUTE); + snd_soc_component_write(component, WM8991_DAC_CTRL, val | WM8991_DAC_MUTE); else - snd_soc_write(codec, WM8991_DAC_CTRL, val); + snd_soc_component_write(component, WM8991_DAC_CTRL, val); return 0; } -static int wm8991_set_bias_level(struct snd_soc_codec *codec, +static int wm8991_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct wm8991_priv *wm8991 = snd_soc_codec_get_drvdata(codec); + struct wm8991_priv *wm8991 = snd_soc_component_get_drvdata(component); u16 val; switch (level) { @@ -1101,22 +1101,22 @@ static int wm8991_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_PREPARE: /* VMID=2*50k */ - val = snd_soc_read(codec, WM8991_POWER_MANAGEMENT_1) & + val = snd_soc_component_read32(component, WM8991_POWER_MANAGEMENT_1) & ~WM8991_VMID_MODE_MASK; - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, val | 0x2); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, val | 0x2); 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) { regcache_sync(wm8991->regmap); /* Enable all output discharge bits */ - snd_soc_write(codec, WM8991_ANTIPOP1, WM8991_DIS_LLINE | + snd_soc_component_write(component, WM8991_ANTIPOP1, WM8991_DIS_LLINE | WM8991_DIS_RLINE | WM8991_DIS_OUT3 | WM8991_DIS_OUT4 | WM8991_DIS_LOUT | WM8991_DIS_ROUT); /* Enable POBCTRL, SOFT_ST, VMIDTOG and BUFDCOPEN */ - snd_soc_write(codec, WM8991_ANTIPOP2, WM8991_SOFTST | + snd_soc_component_write(component, WM8991_ANTIPOP2, WM8991_SOFTST | WM8991_BUFDCOPEN | WM8991_POBCTRL | WM8991_VMIDTOG); @@ -1124,78 +1124,78 @@ static int wm8991_set_bias_level(struct snd_soc_codec *codec, msleep(300); /* Disable VMIDTOG */ - snd_soc_write(codec, WM8991_ANTIPOP2, WM8991_SOFTST | + snd_soc_component_write(component, WM8991_ANTIPOP2, WM8991_SOFTST | WM8991_BUFDCOPEN | WM8991_POBCTRL); /* disable all output discharge bits */ - snd_soc_write(codec, WM8991_ANTIPOP1, 0); + snd_soc_component_write(component, WM8991_ANTIPOP1, 0); /* Enable outputs */ - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, 0x1b00); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, 0x1b00); msleep(50); /* Enable VMID at 2x50k */ - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, 0x1f02); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, 0x1f02); msleep(100); /* Enable VREF */ - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, 0x1f03); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, 0x1f03); msleep(600); /* Enable BUFIOEN */ - snd_soc_write(codec, WM8991_ANTIPOP2, WM8991_SOFTST | + snd_soc_component_write(component, WM8991_ANTIPOP2, WM8991_SOFTST | WM8991_BUFDCOPEN | WM8991_POBCTRL | WM8991_BUFIOEN); /* Disable outputs */ - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, 0x3); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, 0x3); /* disable POBCTRL, SOFT_ST and BUFDCOPEN */ - snd_soc_write(codec, WM8991_ANTIPOP2, WM8991_BUFIOEN); + snd_soc_component_write(component, WM8991_ANTIPOP2, WM8991_BUFIOEN); } /* VMID=2*250k */ - val = snd_soc_read(codec, WM8991_POWER_MANAGEMENT_1) & + val = snd_soc_component_read32(component, WM8991_POWER_MANAGEMENT_1) & ~WM8991_VMID_MODE_MASK; - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, val | 0x4); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, val | 0x4); break; case SND_SOC_BIAS_OFF: /* Enable POBCTRL and SOFT_ST */ - snd_soc_write(codec, WM8991_ANTIPOP2, WM8991_SOFTST | + snd_soc_component_write(component, WM8991_ANTIPOP2, WM8991_SOFTST | WM8991_POBCTRL | WM8991_BUFIOEN); /* Enable POBCTRL, SOFT_ST and BUFDCOPEN */ - snd_soc_write(codec, WM8991_ANTIPOP2, WM8991_SOFTST | + snd_soc_component_write(component, WM8991_ANTIPOP2, WM8991_SOFTST | WM8991_BUFDCOPEN | WM8991_POBCTRL | WM8991_BUFIOEN); /* mute DAC */ - val = snd_soc_read(codec, WM8991_DAC_CTRL); - snd_soc_write(codec, WM8991_DAC_CTRL, val | WM8991_DAC_MUTE); + val = snd_soc_component_read32(component, WM8991_DAC_CTRL); + snd_soc_component_write(component, WM8991_DAC_CTRL, val | WM8991_DAC_MUTE); /* Enable any disabled outputs */ - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, 0x1f03); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, 0x1f03); /* Disable VMID */ - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, 0x1f01); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, 0x1f01); msleep(300); /* Enable all output discharge bits */ - snd_soc_write(codec, WM8991_ANTIPOP1, WM8991_DIS_LLINE | + snd_soc_component_write(component, WM8991_ANTIPOP1, WM8991_DIS_LLINE | WM8991_DIS_RLINE | WM8991_DIS_OUT3 | WM8991_DIS_OUT4 | WM8991_DIS_LOUT | WM8991_DIS_ROUT); /* Disable VREF */ - snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, 0x0); + snd_soc_component_write(component, WM8991_POWER_MANAGEMENT_1, 0x0); /* disable POBCTRL, SOFT_ST and BUFDCOPEN */ - snd_soc_write(codec, WM8991_ANTIPOP2, 0x0); + snd_soc_component_write(component, WM8991_ANTIPOP2, 0x0); regcache_mark_dirty(wm8991->regmap); break; } @@ -1242,18 +1242,19 @@ static int wm8991_set_bias_level(struct snd_soc_codec *codec, .ops = &wm8991_ops }; -static const struct snd_soc_codec_driver soc_codec_dev_wm8991 = { - .set_bias_level = wm8991_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8991_snd_controls, - .num_controls = ARRAY_SIZE(wm8991_snd_controls), - .dapm_widgets = wm8991_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8991_dapm_widgets), - .dapm_routes = wm8991_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8991_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8991 = { + .set_bias_level = wm8991_set_bias_level, + .controls = wm8991_snd_controls, + .num_controls = ARRAY_SIZE(wm8991_snd_controls), + .dapm_widgets = wm8991_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8991_dapm_widgets), + .dapm_routes = wm8991_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8991_dapm_routes), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config wm8991_regmap = { @@ -1319,19 +1320,12 @@ static int wm8991_i2c_probe(struct i2c_client *i2c, regmap_write(wm8991->regmap, WM8991_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm8991, &wm8991_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_wm8991, &wm8991_dai, 1); return ret; } -static int wm8991_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - - return 0; -} - static const struct i2c_device_id wm8991_i2c_id[] = { { "wm8991", 0 }, { } @@ -1343,7 +1337,6 @@ static int wm8991_i2c_remove(struct i2c_client *client) .name = "wm8991", }, .probe = wm8991_i2c_probe, - .remove = wm8991_i2c_remove, .id_table = wm8991_i2c_id, };