From patchwork Fri Jan 12 01:19:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10159193 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 41E616029B for ; Fri, 12 Jan 2018 01:24:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C543269E2 for ; Fri, 12 Jan 2018 01:24:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DD862870F; Fri, 12 Jan 2018 01:24:21 +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 66302269E2 for ; Fri, 12 Jan 2018 01:24:19 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4218B267A56; Fri, 12 Jan 2018 02:24:18 +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 65A99267BFC; Fri, 12 Jan 2018 02:24:16 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 0BEF9267C01 for ; Fri, 12 Jan 2018 02:19:41 +0100 (CET) Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 12 Jan 2018 10:19:40 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 6E0AB4CCA4; Fri, 12 Jan 2018 10:19:40 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,346,1511794800"; d="scan'208";a="269307736" Received: from mail-hk2apc01lp0213.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.213]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 12 Jan 2018 10:19:39 +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=nLU1m76xbow/AjgzhcM14VG14o4byXoWJZ2x2kBxFjU=; b=QE3bkg5p/4Eihzco4SOluAu7jK55fayw9Orii2FR5xpyZfrzWNzPSfIAA1fOlEes6JIBawnSsCS49l2rUxwEtJm0keBaIutsefB3nQkuIAplg1otIt4GKEEDKYbv/cPlwPLoRLZFTni4CGqWs4tY+HRWbvIj/v2TT2LbT9Bz1P8= 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:19:37 +0000 Message-ID: <87r2qvc1sq.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:37 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: TYXPR0101CA0040.jpnprd01.prod.outlook.com (2603:1096:401:1::50) 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: 4e4c8fd4-16ad-4347-6d88-08d5595a8c6b 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:3heUHeH/A/Jj5a/8eHIHrkLJr4V5TRPNUuHSZvJs1i4Ho7BHMkMk31vsc5WsJCztXnlPnbp+xE6INszKxFrAVKuuYxUEGHhmnJxUrTv05BnkT/vSQyfMOtVgkePqn4HULyV4oSgMW87Fi8Kkxs4jOFcJJlXkh2YP51GeaWz3s47K8XFIuLGUf0u8kmH1d8xmqX3qli7U4iT1wGADTuUcKyBodsbHQ7DNdlKyaJFB11zq/o1fjOY4MoOHHgE/4lPn; 25:WqH1mG/ttDPW/4p7wf8F7SHxCK5tqpJAVYopH2fyhcIw8BmCJVDqlA07KlCGluEqxxftIwMya1G4z4yjIhin82g4JqU0g9ypR0GnN8+SCZTdYxM/HReNtG8slEW3jTIgQJSSxlMaduCDoWLENWskteprxw0+79BA2rkgwANsUXbUmuz+1KleKVw7r/529fU60PDU9V8LQ1xUSNEk0B5cgMt6OTg+6Kk8wAxW+hEHweNyEBpLPksai8T85sYtvYlNb6vPVL8cYMCN58/xGWdraEoYsF4IpBA04nZ/qcc5V3Kd9HU+hdYB8d8XJOAUJd5zuvcnM4rsSOCmT3XjgZIwWQ==; 31:kL2KsEveS1Rjj5bgPlEO5q2IWnldPHgO+qp6orqCqsYiTIvUg+nnheIqcpl9Lg3sT2pxTTIMzyxaSj+7I7cL+KqhG3OvRs4tONO/6lDj/CxoeZQYLf5WFUqMo9DIHOlmHqCcGhEIAbrO+IUCc3EdI815wu9guRaQpV33Z528fVOw86DSbj9YKTtggnPtdqdFtxjNsLy8SdODPcP85PHwffrjX2mICGMf0COemRQ9Bcs= X-MS-TrafficTypeDiagnostic: KL1PR0601MB1879: X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1879; 20:79xdxhnxX1UDZMUqcHMNH0lf6ocPzRyXtzgRON/lfHAfPDBrv0HpcaIGmYhO9AqVeB2Tm4Qn8xxOphNiHXYRhJQKoFYr9A+bLpB332nCIKRWtxNWUlSj4NKvre6ckBewJ3VDhb6Pnxgmx9IOvKIW68TwUoc+sGVyoFbmFce2TzvEHs/eo2/pjH4jubAS/ppaFnqIyF2RnKQNjyocAnT9DpNaIMGAfYWlqpww3Y2Qx4FABGxzebPzgiHMr10K/KgFAQo2fTX4Q3OQgJaZ7uzUmzfEadvP5Iiwezy361cGOorm8XYeC9uQpNZe1jvxg6IRj8EMkCfkYc0+fYOFvR0zsgiFaq7xH1n2XDzIltZmbtAoGUKeUUE579VZD9Cxj8irXU4ulxavVppDCNVJFNSvuy4VlrthqniMfvRmEbLn9qYV610rygOBtzhNcdrr+twEfmDma433d5EQ7p3zB2CP28k65ogfISWfiUphbGp+zBPneKSIdm72t74aaPxGm2RW; 4:KePk11zX+EnYpyrSsqoMl3bwUcM9sylP1WWXnZsg7fagdr4w1bCTi3IPnO+4+8VaCywlNMxE6j2ffe64fZBt91mGOXyPlyhXmHdIYbvjCxKCMozCALYF5fJ4HzfFc8mywhvnpdg8ZoANJKBFj9rkpcyeIukenbF/bs/IyRqvbMezXSzAfPoP0jN9cooMlCAu3w+qOTe2nRyveBycCh4iI2E3Irp+9wec6BVE3++KgwULM9NTyGBVt22gOB3uZU7XJ8dD0UTBHWWtSqq4k56GEouml9j3Fspbhib9Rdzn7S1QDRyV8zjxy2/kKhj71IP2 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)(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)(396003)(39380400002)(346002)(39860400002)(366004)(376002)(199004)(189003)(7696005)(8936002)(76176011)(4326008)(8676002)(36756003)(53936002)(81156014)(69596002)(54906003)(16586007)(2906002)(16526018)(86362001)(81166006)(316002)(58126008)(68736007)(7736002)(50466002)(97736004)(52116002)(106356001)(6486002)(305945005)(23726003)(83506002)(59450400001)(6116002)(386003)(6916009)(105586002)(25786009)(47776003)(478600001)(53416004)(2950100002)(5660300001)(66066001)(3846002)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR0601MB1879; 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; KL1PR0601MB1879; 23:fdomNZXQON36SyBMD725ht7njqg/bEQc5pqXiQF?= =?us-ascii?Q?tAmt7EUbC+QTqBpP1G0Ju1nCsSP9wA86wVkypF9tVYaqUQR+2Cgqj4RmwliB?= =?us-ascii?Q?g7yXkRgjIDxKxd1o/zMBXd5eUuFjvshs0vyUHVNd0RVfqlHhaeQm6juiv4cV?= =?us-ascii?Q?vNKg0iH6aAIXb1A59jeG+AHr2fGAenQ/3cLwqUeWRjSK1yXehNfT/w+LJeC2?= =?us-ascii?Q?ItI31XV4bsQ21kjb3TTjYZH7N6F3XVNYk9H3c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exchange-Diagnostics: 1; KL1PR0601MB1879; 20:Jg7YNys/TZfrZa6o2I8TUtSCkZqBM8yfOFI5Pio+yoPHui8ThmDncMGjQAbDI41FgYYM1YmsnFCIGk+Si5ITUWanSyUfMVpWn7AyQBfbzYuumbuyQccM4LthWkrybH0BetObfke6qqFr298/gOLZ10AY/BhPsgECgMbsyqvravk= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 01:19:37.4635 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e4c8fd4-16ad-4347-6d88-08d5595a8c6b 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 040/187] ASoC: wm8961: 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/wm8961.c | 241 ++++++++++++++++++++++------------------------ 1 file changed, 117 insertions(+), 124 deletions(-) diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index e23ceac..cab7d63 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -194,89 +194,89 @@ static bool wm8961_readable(struct device *dev, unsigned int reg) static int wm8961_hp_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); - u16 hp_reg = snd_soc_read(codec, WM8961_ANALOGUE_HP_0); - u16 cp_reg = snd_soc_read(codec, WM8961_CHARGE_PUMP_1); - u16 pwr_reg = snd_soc_read(codec, WM8961_PWR_MGMT_2); - u16 dcs_reg = snd_soc_read(codec, WM8961_DC_SERVO_1); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + u16 hp_reg = snd_soc_component_read32(component, WM8961_ANALOGUE_HP_0); + u16 cp_reg = snd_soc_component_read32(component, WM8961_CHARGE_PUMP_1); + u16 pwr_reg = snd_soc_component_read32(component, WM8961_PWR_MGMT_2); + u16 dcs_reg = snd_soc_component_read32(component, WM8961_DC_SERVO_1); int timeout = 500; if (event & SND_SOC_DAPM_POST_PMU) { /* Make sure the output is shorted */ hp_reg &= ~(WM8961_HPR_RMV_SHORT | WM8961_HPL_RMV_SHORT); - snd_soc_write(codec, WM8961_ANALOGUE_HP_0, hp_reg); + snd_soc_component_write(component, WM8961_ANALOGUE_HP_0, hp_reg); /* Enable the charge pump */ cp_reg |= WM8961_CP_ENA; - snd_soc_write(codec, WM8961_CHARGE_PUMP_1, cp_reg); + snd_soc_component_write(component, WM8961_CHARGE_PUMP_1, cp_reg); mdelay(5); /* Enable the PGA */ pwr_reg |= WM8961_LOUT1_PGA | WM8961_ROUT1_PGA; - snd_soc_write(codec, WM8961_PWR_MGMT_2, pwr_reg); + snd_soc_component_write(component, WM8961_PWR_MGMT_2, pwr_reg); /* Enable the amplifier */ hp_reg |= WM8961_HPR_ENA | WM8961_HPL_ENA; - snd_soc_write(codec, WM8961_ANALOGUE_HP_0, hp_reg); + snd_soc_component_write(component, WM8961_ANALOGUE_HP_0, hp_reg); /* Second stage enable */ hp_reg |= WM8961_HPR_ENA_DLY | WM8961_HPL_ENA_DLY; - snd_soc_write(codec, WM8961_ANALOGUE_HP_0, hp_reg); + snd_soc_component_write(component, WM8961_ANALOGUE_HP_0, hp_reg); /* Enable the DC servo & trigger startup */ dcs_reg |= WM8961_DCS_ENA_CHAN_HPR | WM8961_DCS_TRIG_STARTUP_HPR | WM8961_DCS_ENA_CHAN_HPL | WM8961_DCS_TRIG_STARTUP_HPL; - dev_dbg(codec->dev, "Enabling DC servo\n"); + dev_dbg(component->dev, "Enabling DC servo\n"); - snd_soc_write(codec, WM8961_DC_SERVO_1, dcs_reg); + snd_soc_component_write(component, WM8961_DC_SERVO_1, dcs_reg); do { msleep(1); - dcs_reg = snd_soc_read(codec, WM8961_DC_SERVO_1); + dcs_reg = snd_soc_component_read32(component, WM8961_DC_SERVO_1); } while (--timeout && dcs_reg & (WM8961_DCS_TRIG_STARTUP_HPR | WM8961_DCS_TRIG_STARTUP_HPL)); if (dcs_reg & (WM8961_DCS_TRIG_STARTUP_HPR | WM8961_DCS_TRIG_STARTUP_HPL)) - dev_err(codec->dev, "DC servo timed out\n"); + dev_err(component->dev, "DC servo timed out\n"); else - dev_dbg(codec->dev, "DC servo startup complete\n"); + dev_dbg(component->dev, "DC servo startup complete\n"); /* Enable the output stage */ hp_reg |= WM8961_HPR_ENA_OUTP | WM8961_HPL_ENA_OUTP; - snd_soc_write(codec, WM8961_ANALOGUE_HP_0, hp_reg); + snd_soc_component_write(component, WM8961_ANALOGUE_HP_0, hp_reg); /* Remove the short on the output stage */ hp_reg |= WM8961_HPR_RMV_SHORT | WM8961_HPL_RMV_SHORT; - snd_soc_write(codec, WM8961_ANALOGUE_HP_0, hp_reg); + snd_soc_component_write(component, WM8961_ANALOGUE_HP_0, hp_reg); } if (event & SND_SOC_DAPM_PRE_PMD) { /* Short the output */ hp_reg &= ~(WM8961_HPR_RMV_SHORT | WM8961_HPL_RMV_SHORT); - snd_soc_write(codec, WM8961_ANALOGUE_HP_0, hp_reg); + snd_soc_component_write(component, WM8961_ANALOGUE_HP_0, hp_reg); /* Disable the output stage */ hp_reg &= ~(WM8961_HPR_ENA_OUTP | WM8961_HPL_ENA_OUTP); - snd_soc_write(codec, WM8961_ANALOGUE_HP_0, hp_reg); + snd_soc_component_write(component, WM8961_ANALOGUE_HP_0, hp_reg); /* Disable DC offset cancellation */ dcs_reg &= ~(WM8961_DCS_ENA_CHAN_HPR | WM8961_DCS_ENA_CHAN_HPL); - snd_soc_write(codec, WM8961_DC_SERVO_1, dcs_reg); + snd_soc_component_write(component, WM8961_DC_SERVO_1, dcs_reg); /* Finish up */ hp_reg &= ~(WM8961_HPR_ENA_DLY | WM8961_HPR_ENA | WM8961_HPL_ENA_DLY | WM8961_HPL_ENA); - snd_soc_write(codec, WM8961_ANALOGUE_HP_0, hp_reg); + snd_soc_component_write(component, WM8961_ANALOGUE_HP_0, hp_reg); /* Disable the PGA */ pwr_reg &= ~(WM8961_LOUT1_PGA | WM8961_ROUT1_PGA); - snd_soc_write(codec, WM8961_PWR_MGMT_2, pwr_reg); + snd_soc_component_write(component, WM8961_PWR_MGMT_2, pwr_reg); /* Disable the charge pump */ - dev_dbg(codec->dev, "Disabling charge pump\n"); - snd_soc_write(codec, WM8961_CHARGE_PUMP_1, + dev_dbg(component->dev, "Disabling charge pump\n"); + snd_soc_component_write(component, WM8961_CHARGE_PUMP_1, cp_reg & ~WM8961_CP_ENA); } @@ -286,28 +286,28 @@ static int wm8961_hp_event(struct snd_soc_dapm_widget *w, static int wm8961_spk_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); - u16 pwr_reg = snd_soc_read(codec, WM8961_PWR_MGMT_2); - u16 spk_reg = snd_soc_read(codec, WM8961_CLASS_D_CONTROL_1); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + u16 pwr_reg = snd_soc_component_read32(component, WM8961_PWR_MGMT_2); + u16 spk_reg = snd_soc_component_read32(component, WM8961_CLASS_D_CONTROL_1); if (event & SND_SOC_DAPM_POST_PMU) { /* Enable the PGA */ pwr_reg |= WM8961_SPKL_PGA | WM8961_SPKR_PGA; - snd_soc_write(codec, WM8961_PWR_MGMT_2, pwr_reg); + snd_soc_component_write(component, WM8961_PWR_MGMT_2, pwr_reg); /* Enable the amplifier */ spk_reg |= WM8961_SPKL_ENA | WM8961_SPKR_ENA; - snd_soc_write(codec, WM8961_CLASS_D_CONTROL_1, spk_reg); + snd_soc_component_write(component, WM8961_CLASS_D_CONTROL_1, spk_reg); } if (event & SND_SOC_DAPM_PRE_PMD) { /* Disable the amplifier */ spk_reg &= ~(WM8961_SPKL_ENA | WM8961_SPKR_ENA); - snd_soc_write(codec, WM8961_CLASS_D_CONTROL_1, spk_reg); + snd_soc_component_write(component, WM8961_CLASS_D_CONTROL_1, spk_reg); /* Disable the PGA */ pwr_reg &= ~(WM8961_SPKL_PGA | WM8961_SPKR_PGA); - snd_soc_write(codec, WM8961_PWR_MGMT_2, pwr_reg); + snd_soc_component_write(component, WM8961_PWR_MGMT_2, pwr_reg); } return 0; @@ -505,15 +505,15 @@ static int wm8961_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 wm8961_priv *wm8961 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct wm8961_priv *wm8961 = snd_soc_component_get_drvdata(component); int i, best, target, fs; u16 reg; fs = params_rate(params); if (!wm8961->sysclk) { - dev_err(codec->dev, "MCLK has not been specified\n"); + dev_err(component->dev, "MCLK has not been specified\n"); return -EINVAL; } @@ -524,23 +524,23 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream, abs(wm8961_srate[best].rate - fs)) best = i; } - reg = snd_soc_read(codec, WM8961_ADDITIONAL_CONTROL_3); + reg = snd_soc_component_read32(component, WM8961_ADDITIONAL_CONTROL_3); reg &= ~WM8961_SAMPLE_RATE_MASK; reg |= wm8961_srate[best].val; - snd_soc_write(codec, WM8961_ADDITIONAL_CONTROL_3, reg); - dev_dbg(codec->dev, "Selected SRATE %dHz for %dHz\n", + snd_soc_component_write(component, WM8961_ADDITIONAL_CONTROL_3, reg); + dev_dbg(component->dev, "Selected SRATE %dHz for %dHz\n", wm8961_srate[best].rate, fs); /* Select a CLK_SYS/fs ratio equal to or higher than required */ target = wm8961->sysclk / fs; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && target < 64) { - dev_err(codec->dev, + dev_err(component->dev, "SYSCLK must be at least 64*fs for DAC\n"); return -EINVAL; } if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && target < 256) { - dev_err(codec->dev, + dev_err(component->dev, "SYSCLK must be at least 256*fs for ADC\n"); return -EINVAL; } @@ -550,19 +550,19 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream, break; } if (i == ARRAY_SIZE(wm8961_clk_sys_ratio)) { - dev_err(codec->dev, "Unable to generate CLK_SYS_RATE\n"); + dev_err(component->dev, "Unable to generate CLK_SYS_RATE\n"); return -EINVAL; } - dev_dbg(codec->dev, "Selected CLK_SYS_RATE of %d for %d/%d=%d\n", + dev_dbg(component->dev, "Selected CLK_SYS_RATE of %d for %d/%d=%d\n", wm8961_clk_sys_ratio[i].ratio, wm8961->sysclk, fs, wm8961->sysclk / fs); - reg = snd_soc_read(codec, WM8961_CLOCKING_4); + reg = snd_soc_component_read32(component, WM8961_CLOCKING_4); reg &= ~WM8961_CLK_SYS_RATE_MASK; reg |= wm8961_clk_sys_ratio[i].val << WM8961_CLK_SYS_RATE_SHIFT; - snd_soc_write(codec, WM8961_CLOCKING_4, reg); + snd_soc_component_write(component, WM8961_CLOCKING_4, reg); - reg = snd_soc_read(codec, WM8961_AUDIO_INTERFACE_0); + reg = snd_soc_component_read32(component, WM8961_AUDIO_INTERFACE_0); reg &= ~WM8961_WL_MASK; switch (params_width(params)) { case 16: @@ -579,15 +579,15 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream, default: return -EINVAL; } - snd_soc_write(codec, WM8961_AUDIO_INTERFACE_0, reg); + snd_soc_component_write(component, WM8961_AUDIO_INTERFACE_0, reg); /* Sloping stop-band filter is recommended for <= 24kHz */ - reg = snd_soc_read(codec, WM8961_ADC_DAC_CONTROL_2); + reg = snd_soc_component_read32(component, WM8961_ADC_DAC_CONTROL_2); if (fs <= 24000) reg |= WM8961_DACSLOPE; else reg &= ~WM8961_DACSLOPE; - snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_2, reg); + snd_soc_component_write(component, WM8961_ADC_DAC_CONTROL_2, reg); return 0; } @@ -596,25 +596,25 @@ static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = dai->codec; - struct wm8961_priv *wm8961 = snd_soc_codec_get_drvdata(codec); - u16 reg = snd_soc_read(codec, WM8961_CLOCKING1); + struct snd_soc_component *component = dai->component; + struct wm8961_priv *wm8961 = snd_soc_component_get_drvdata(component); + u16 reg = snd_soc_component_read32(component, WM8961_CLOCKING1); if (freq > 33000000) { - dev_err(codec->dev, "MCLK must be <33MHz\n"); + dev_err(component->dev, "MCLK must be <33MHz\n"); return -EINVAL; } if (freq > 16500000) { - dev_dbg(codec->dev, "Using MCLK/2 for %dHz MCLK\n", freq); + dev_dbg(component->dev, "Using MCLK/2 for %dHz MCLK\n", freq); reg |= WM8961_MCLKDIV; freq /= 2; } else { - dev_dbg(codec->dev, "Using MCLK/1 for %dHz MCLK\n", freq); + dev_dbg(component->dev, "Using MCLK/1 for %dHz MCLK\n", freq); reg &= ~WM8961_MCLKDIV; } - snd_soc_write(codec, WM8961_CLOCKING1, reg); + snd_soc_component_write(component, WM8961_CLOCKING1, reg); wm8961->sysclk = freq; @@ -623,8 +623,8 @@ static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id, static int wm8961_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; - u16 aif = snd_soc_read(codec, WM8961_AUDIO_INTERFACE_0); + struct snd_soc_component *component = dai->component; + u16 aif = snd_soc_component_read32(component, WM8961_AUDIO_INTERFACE_0); aif &= ~(WM8961_BCLKINV | WM8961_LRP | WM8961_MS | WM8961_FORMAT_MASK); @@ -684,26 +684,26 @@ static int wm8961_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EINVAL; } - return snd_soc_write(codec, WM8961_AUDIO_INTERFACE_0, aif); + return snd_soc_component_write(component, WM8961_AUDIO_INTERFACE_0, aif); } static int wm8961_set_tristate(struct snd_soc_dai *dai, int tristate) { - struct snd_soc_codec *codec = dai->codec; - u16 reg = snd_soc_read(codec, WM8961_ADDITIONAL_CONTROL_2); + struct snd_soc_component *component = dai->component; + u16 reg = snd_soc_component_read32(component, WM8961_ADDITIONAL_CONTROL_2); if (tristate) reg |= WM8961_TRIS; else reg &= ~WM8961_TRIS; - return snd_soc_write(codec, WM8961_ADDITIONAL_CONTROL_2, reg); + return snd_soc_component_write(component, WM8961_ADDITIONAL_CONTROL_2, reg); } static int wm8961_digital_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - u16 reg = snd_soc_read(codec, WM8961_ADC_DAC_CONTROL_1); + struct snd_soc_component *component = dai->component; + u16 reg = snd_soc_component_read32(component, WM8961_ADC_DAC_CONTROL_1); if (mute) reg |= WM8961_DACMU; @@ -712,27 +712,27 @@ static int wm8961_digital_mute(struct snd_soc_dai *dai, int mute) msleep(17); - return snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_1, reg); + return snd_soc_component_write(component, WM8961_ADC_DAC_CONTROL_1, reg); } static int wm8961_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; u16 reg; switch (div_id) { case WM8961_BCLK: - reg = snd_soc_read(codec, WM8961_CLOCKING2); + reg = snd_soc_component_read32(component, WM8961_CLOCKING2); reg &= ~WM8961_BCLKDIV_MASK; reg |= div; - snd_soc_write(codec, WM8961_CLOCKING2, reg); + snd_soc_component_write(component, WM8961_CLOCKING2, reg); break; case WM8961_LRCLK: - reg = snd_soc_read(codec, WM8961_AUDIO_INTERFACE_2); + reg = snd_soc_component_read32(component, WM8961_AUDIO_INTERFACE_2); reg &= ~WM8961_LRCLK_RATE_MASK; reg |= div; - snd_soc_write(codec, WM8961_AUDIO_INTERFACE_2, reg); + snd_soc_component_write(component, WM8961_AUDIO_INTERFACE_2, reg); break; default: @@ -742,7 +742,7 @@ static int wm8961_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) return 0; } -static int wm8961_set_bias_level(struct snd_soc_codec *codec, +static int wm8961_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { u16 reg; @@ -757,36 +757,36 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_PREPARE: - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) { + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) { /* Enable bias generation */ - reg = snd_soc_read(codec, WM8961_ANTI_POP); + reg = snd_soc_component_read32(component, WM8961_ANTI_POP); reg |= WM8961_BUFIOEN | WM8961_BUFDCOPEN; - snd_soc_write(codec, WM8961_ANTI_POP, reg); + snd_soc_component_write(component, WM8961_ANTI_POP, reg); /* VMID=2*50k, VREF */ - reg = snd_soc_read(codec, WM8961_PWR_MGMT_1); + reg = snd_soc_component_read32(component, WM8961_PWR_MGMT_1); reg &= ~WM8961_VMIDSEL_MASK; reg |= (1 << WM8961_VMIDSEL_SHIFT) | WM8961_VREF; - snd_soc_write(codec, WM8961_PWR_MGMT_1, reg); + snd_soc_component_write(component, WM8961_PWR_MGMT_1, reg); } break; case SND_SOC_BIAS_STANDBY: - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) { + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_PREPARE) { /* VREF off */ - reg = snd_soc_read(codec, WM8961_PWR_MGMT_1); + reg = snd_soc_component_read32(component, WM8961_PWR_MGMT_1); reg &= ~WM8961_VREF; - snd_soc_write(codec, WM8961_PWR_MGMT_1, reg); + snd_soc_component_write(component, WM8961_PWR_MGMT_1, reg); /* Bias generation off */ - reg = snd_soc_read(codec, WM8961_ANTI_POP); + reg = snd_soc_component_read32(component, WM8961_ANTI_POP); reg &= ~(WM8961_BUFIOEN | WM8961_BUFDCOPEN); - snd_soc_write(codec, WM8961_ANTI_POP, reg); + snd_soc_component_write(component, WM8961_ANTI_POP, reg); /* VMID off */ - reg = snd_soc_read(codec, WM8961_PWR_MGMT_1); + reg = snd_soc_component_read32(component, WM8961_PWR_MGMT_1); reg &= ~WM8961_VMIDSEL_MASK; - snd_soc_write(codec, WM8961_PWR_MGMT_1, reg); + snd_soc_component_write(component, WM8961_PWR_MGMT_1, reg); } break; @@ -830,51 +830,51 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec, .ops = &wm8961_dai_ops, }; -static int wm8961_probe(struct snd_soc_codec *codec) +static int wm8961_probe(struct snd_soc_component *component) { u16 reg; /* Enable class W */ - reg = snd_soc_read(codec, WM8961_CHARGE_PUMP_B); + reg = snd_soc_component_read32(component, WM8961_CHARGE_PUMP_B); reg |= WM8961_CP_DYN_PWR_MASK; - snd_soc_write(codec, WM8961_CHARGE_PUMP_B, reg); + snd_soc_component_write(component, WM8961_CHARGE_PUMP_B, reg); /* Latch volume update bits (right channel only, we always * write both out) and default ZC on. */ - reg = snd_soc_read(codec, WM8961_ROUT1_VOLUME); - snd_soc_write(codec, WM8961_ROUT1_VOLUME, + reg = snd_soc_component_read32(component, WM8961_ROUT1_VOLUME); + snd_soc_component_write(component, WM8961_ROUT1_VOLUME, reg | WM8961_LO1ZC | WM8961_OUT1VU); - snd_soc_write(codec, WM8961_LOUT1_VOLUME, reg | WM8961_LO1ZC); - reg = snd_soc_read(codec, WM8961_ROUT2_VOLUME); - snd_soc_write(codec, WM8961_ROUT2_VOLUME, + snd_soc_component_write(component, WM8961_LOUT1_VOLUME, reg | WM8961_LO1ZC); + reg = snd_soc_component_read32(component, WM8961_ROUT2_VOLUME); + snd_soc_component_write(component, WM8961_ROUT2_VOLUME, reg | WM8961_SPKRZC | WM8961_SPKVU); - snd_soc_write(codec, WM8961_LOUT2_VOLUME, reg | WM8961_SPKLZC); + snd_soc_component_write(component, WM8961_LOUT2_VOLUME, reg | WM8961_SPKLZC); - reg = snd_soc_read(codec, WM8961_RIGHT_ADC_VOLUME); - snd_soc_write(codec, WM8961_RIGHT_ADC_VOLUME, reg | WM8961_ADCVU); - reg = snd_soc_read(codec, WM8961_RIGHT_INPUT_VOLUME); - snd_soc_write(codec, WM8961_RIGHT_INPUT_VOLUME, reg | WM8961_IPVU); + reg = snd_soc_component_read32(component, WM8961_RIGHT_ADC_VOLUME); + snd_soc_component_write(component, WM8961_RIGHT_ADC_VOLUME, reg | WM8961_ADCVU); + reg = snd_soc_component_read32(component, WM8961_RIGHT_INPUT_VOLUME); + snd_soc_component_write(component, WM8961_RIGHT_INPUT_VOLUME, reg | WM8961_IPVU); /* Use soft mute by default */ - reg = snd_soc_read(codec, WM8961_ADC_DAC_CONTROL_2); + reg = snd_soc_component_read32(component, WM8961_ADC_DAC_CONTROL_2); reg |= WM8961_DACSMM; - snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_2, reg); + snd_soc_component_write(component, WM8961_ADC_DAC_CONTROL_2, reg); /* Use automatic clocking mode by default; for now this is all * we support. */ - reg = snd_soc_read(codec, WM8961_CLOCKING_3); + reg = snd_soc_component_read32(component, WM8961_CLOCKING_3); reg &= ~WM8961_MANUAL_MODE; - snd_soc_write(codec, WM8961_CLOCKING_3, reg); + snd_soc_component_write(component, WM8961_CLOCKING_3, reg); return 0; } #ifdef CONFIG_PM -static int wm8961_resume(struct snd_soc_codec *codec) +static int wm8961_resume(struct snd_soc_component *component) { - snd_soc_cache_sync(codec); + snd_soc_component_cache_sync(component); return 0; } @@ -882,20 +882,21 @@ static int wm8961_resume(struct snd_soc_codec *codec) #define wm8961_resume NULL #endif -static const struct snd_soc_codec_driver soc_codec_dev_wm8961 = { - .probe = wm8961_probe, - .resume = wm8961_resume, - .set_bias_level = wm8961_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8961_snd_controls, - .num_controls = ARRAY_SIZE(wm8961_snd_controls), - .dapm_widgets = wm8961_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8961_dapm_widgets), - .dapm_routes = audio_paths, - .num_dapm_routes = ARRAY_SIZE(audio_paths), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8961 = { + .probe = wm8961_probe, + .resume = wm8961_resume, + .set_bias_level = wm8961_set_bias_level, + .controls = wm8961_snd_controls, + .num_controls = ARRAY_SIZE(wm8961_snd_controls), + .dapm_widgets = wm8961_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8961_dapm_widgets), + .dapm_routes = audio_paths, + .num_dapm_routes = ARRAY_SIZE(audio_paths), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config wm8961_regmap = { @@ -961,19 +962,12 @@ static int wm8961_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8961); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm8961, &wm8961_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_wm8961, &wm8961_dai, 1); return ret; } -static int wm8961_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - - return 0; -} - static const struct i2c_device_id wm8961_i2c_id[] = { { "wm8961", 0 }, { } @@ -985,7 +979,6 @@ static int wm8961_i2c_remove(struct i2c_client *client) .name = "wm8961", }, .probe = wm8961_i2c_probe, - .remove = wm8961_i2c_remove, .id_table = wm8961_i2c_id, };