From patchwork Mon Jan 29 03:06:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10188875 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 14C3760375 for ; Mon, 29 Jan 2018 03:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03470286E3 for ; Mon, 29 Jan 2018 03:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7502286F3; Mon, 29 Jan 2018 03:11:45 +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 49F09286E3 for ; Mon, 29 Jan 2018 03:11:44 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E8597267898; Mon, 29 Jan 2018 04:11:37 +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 9E42E267975; Mon, 29 Jan 2018 04:11:35 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id D33A5267976 for ; Mon, 29 Jan 2018 04:06:56 +0100 (CET) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 29 Jan 2018 12:06:55 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 33C1074FA9; Mon, 29 Jan 2018 12:06:55 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,429,1511794800"; d="scan'208";a="269587925" Received: from mail-pu1apc01lp0017.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.17]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Jan 2018 12:06:54 +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=S4QRB72PkSuop4Bw7tbw/xYY2e9TT4MMBPYEOiDiDWE=; b=MbkrO9YjqyStBGnHkgPkYPAuRtcEQrb72cOxpRE3KAESTQGUvPyQmQyCgo+gaYR0Qfr1aYZwapo1qizKe5hwyfiLT6hSbsomU1LvGhg0LN5VQua78S/6Rt59OlK7T9XieWJdIsIwagqgvWSS4zqs/1m9aMLe86NSj8oCF4V2TOE= Received: from morimoto-PC.renesas.com (211.11.155.138) by HK2PR0601MB1873.apcprd06.prod.outlook.com (2603:1096:202:a::17) 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 03:06:52 +0000 Message-ID: <878tch4b61.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 03:06:52 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OS2PR01CA0117.jpnprd01.prod.outlook.com (2603:1096:602::11) To HK2PR0601MB1873.apcprd06.prod.outlook.com (2603:1096:202:a::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d82734c8-41b8-4722-405d-08d566c5591a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:HK2PR0601MB1873; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1873; 3:kZ5nkZNdpNG1k5WQpTrLNMnNgwHfHv6co//UveKmfsLdshad6myQCGH5aziVfnoawt29jQJ/hS/FcyMmrJZWi9IUYoWj6IpuTHi/R3vc7OH0iQsGZY4NKw+q0mCdorzbluqRwpdffWScEWvBcRShFYXX26vDPV7aY8vZ4yFRDqXRYVV6gzz202HbeOSduzM+PmpfFXNsc0+b5SFJYufotfmbOtJ+5dXYx/gQLCk3PrXvTzGxqbFxyIs8lJpVIzgG; 25:sH2bsDkmiQOn1HiMfd3ElL2haGfzCLNOt5dnynyg2gvgDuXH//h6vLiIjfRe7SavAO0XgHqztMQntLnRP4T00wBkK1XNXwMnY0XBIXXrp6YkrMEZvs9Hi2wzBkD5gfJdc0Qvzu1JhulogX/U8V6TlUaV4PDuCDibOiBum0r2zJFOPsJenn6zKprr8T+5zDBTl3ofUCYuPyjfL6frby5EJS5YAFvh6/JjZ5AfkMG6KlbAesbyIwVVxNBY4wO2ZN17/5ojG5/wdfmE8+HoUWa6Mvrwksc9AOUbIgvMcxJN0OQb2dIM6HuKBzDMJPxrESVQCwriAqDYfYDO3rSFyUVsGg==; 31:B+FE9YmxUZmp5gzNbAQowHjWghVMzh5rmOEDcdlX4xpac700+4GsubMuVuX5kX0GWJPSwnbDw1tOYaHvyjwJ7vOdjOhuXH7uPj8HWhM7aICbMiHmMl3+9xrepdgvA1AOhOpysHB8B3oRe9P7wu+x7OxU/XDTuxgm9jaDylcL3LMHWcRggMLonXon3nJKzhTQvutrzle6sFaaa8AZyX74a92vQeInexLVnH5nAYvwXaI= X-MS-TrafficTypeDiagnostic: HK2PR0601MB1873: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1873; 20:+8vQ3DkpjoiYS8aIBWHPND4HGAdaxwB02OBGTz/u+bxo2S0Zv75dL+6VOMVo46hR3B6hCV/em3D0ITRgED8WES9vzEuKW0lvXioGc8bXpjewZAr8p45mPtsvMywQCSINflYPkUhTWgS2uFbZU0+5t9Y/sxkd5vp3U/77CcUdzFzTchYnRpfZ7+rqyj6zL+CbIiis8CdBl99RHQT1MVDDb/ZI/lyqgYCQ6JH06N4NJL9MIuN/cIYoCdWkljdleEg23djD3yZjsTHM7UFLwcPaC9vEI/k9nzyfj9SGe6XVWJeQaERQwSwaHMUAzWeuHNx5Z1KAkEQSEUdtJf/pi6v0JBjAf+q+ArpODVFsIF1FQEfNRmyiQAHVi3Lc1huUUWlDqp8RYr4D0eFST+FFsNeoQlzlfhr68lebTMVuBpr7rqGPmBSwrNaFXcT1Qd3GCRHlUNS+BEH5v0i0wio0l9k/Yky6j0uNARJfmLFzxwYsBOrsOk2OPSw7wcO2Mk+lIXDn; 4:ID2Qy6EiynUoC9bmXjw7LU6WuYvBgG3rvZ1BXAUV7cnJDFnzAAXIGLpJ9R1eKOcJYdu+Xq3o4aYoNWsp7cmtbGmaQUzD8ixdj2YgBwIR92pB/a2u3yRo3VhEWH2YpqSqXcAf8XL6DvD65eyLWFULpXQu3n5mscseWwMQb+WaWpo8zL4SIzBY/Qfwjei0J+uil0n/bq7j3987xdHz5O+Mj/744EBO2ujV+X/7IPIX8EGd2jlH+b6CkFOD/tBrQP4vdKgGBe9rMcQ9Dzmh5Gjt0zu4kfcjaHfKt5zKNe6xFuenX9dhac6YVEIFOJtydiU7 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231101)(944501161)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041288)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:HK2PR0601MB1873; BCL:0; PCL:0; RULEID:; SRVR:HK2PR0601MB1873; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(396003)(366004)(346002)(39860400002)(39380400002)(189003)(199004)(305945005)(2906002)(4326008)(106356001)(6486002)(53936002)(25786009)(6116002)(7736002)(23726003)(3846002)(97736004)(58126008)(16586007)(478600001)(53416004)(316002)(105586002)(47776003)(16526019)(186003)(36756003)(66066001)(83506002)(8676002)(69596002)(52116002)(81166006)(8936002)(81156014)(50466002)(68736007)(5660300001)(76176011)(7696005)(86362001)(575784001)(386003)(59450400001)(26005)(2950100002)(6916009)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR0601MB1873; 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; HK2PR0601MB1873; 23:PoXYn8HDR8whDaqeNsFdZtdoCVT7XE4XDnkJf6l?= =?us-ascii?Q?Oysaua/G2nzBw3BA/2etxT36khtEbzfGsZpjtCLQRc/KbjfZ7DFKDr5WE2sK?= =?us-ascii?Q?XzHXlHxkTMzpWhfozpJ+VUUHGmPd5iIN/a6aN3pKq4KjukQDSCiL1GWjdKGB?= =?us-ascii?Q?0KsXpq3Jj+cKCzQ2A7WkuQWswiR+aycmTBrbNJw3EW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wBWVkHMR6DBndJvSRIGv5gTUcF6mLIAzRCxI3tyGPZyRMiRH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1873; 20:YM7MJSHlmWbWTO9jeRJIMrilHRwDECCVDnHyEqBkj/g/KZkt+BeMOKL4qsU0NuGPYX5TxNgDtBxri/2tZ9otSmu6HQYwU6FpZhVyTCSPGgOfeF4i4s3bttwLkFMvs9/NeffDlrN+OegV3oVvN4VnmTf0Wdw0Oshiym67wU40dTM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 03:06:52.8995 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d82734c8-41b8-4722-405d-08d566c5591a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0601MB1873 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 032/186] ASoC: wm8974: 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 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/wm8974.c | 143 ++++++++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 75 deletions(-) diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index d414ddd..43edaf8 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -54,7 +54,7 @@ struct wm8974_priv { #define WM8974_POWER1_BIASEN 0x08 #define WM8974_POWER1_BUFIOEN 0x04 -#define wm8974_reset(c) snd_soc_write(c, WM8974_RESET, 0) +#define wm8974_reset(c) snd_soc_component_write(c, WM8974_RESET, 0) static const char *wm8974_companding[] = {"Off", "NC", "u-law", "A-law" }; static const char *wm8974_deemp[] = {"None", "32kHz", "44.1kHz", "48kHz" }; @@ -324,33 +324,33 @@ static void pll_factors(struct pll_ *pll_div, static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; struct pll_ pll_div; u16 reg; if (freq_in == 0 || freq_out == 0) { /* Clock CODEC directly from MCLK */ - reg = snd_soc_read(codec, WM8974_CLOCK); - snd_soc_write(codec, WM8974_CLOCK, reg & 0x0ff); + reg = snd_soc_component_read32(component, WM8974_CLOCK); + snd_soc_component_write(component, WM8974_CLOCK, reg & 0x0ff); /* Turn off PLL */ - reg = snd_soc_read(codec, WM8974_POWER1); - snd_soc_write(codec, WM8974_POWER1, reg & 0x1df); + reg = snd_soc_component_read32(component, WM8974_POWER1); + snd_soc_component_write(component, WM8974_POWER1, reg & 0x1df); return 0; } pll_factors(&pll_div, freq_out, freq_in); - snd_soc_write(codec, WM8974_PLLN, (pll_div.pre_div << 4) | pll_div.n); - snd_soc_write(codec, WM8974_PLLK1, pll_div.k >> 18); - snd_soc_write(codec, WM8974_PLLK2, (pll_div.k >> 9) & 0x1ff); - snd_soc_write(codec, WM8974_PLLK3, pll_div.k & 0x1ff); - reg = snd_soc_read(codec, WM8974_POWER1); - snd_soc_write(codec, WM8974_POWER1, reg | 0x020); + snd_soc_component_write(component, WM8974_PLLN, (pll_div.pre_div << 4) | pll_div.n); + snd_soc_component_write(component, WM8974_PLLK1, pll_div.k >> 18); + snd_soc_component_write(component, WM8974_PLLK2, (pll_div.k >> 9) & 0x1ff); + snd_soc_component_write(component, WM8974_PLLK3, pll_div.k & 0x1ff); + reg = snd_soc_component_read32(component, WM8974_POWER1); + snd_soc_component_write(component, WM8974_POWER1, reg | 0x020); /* Run CODEC from PLL instead of MCLK */ - reg = snd_soc_read(codec, WM8974_CLOCK); - snd_soc_write(codec, WM8974_CLOCK, reg | 0x100); + reg = snd_soc_component_read32(component, WM8974_CLOCK); + snd_soc_component_write(component, WM8974_CLOCK, reg | 0x100); return 0; } @@ -361,21 +361,21 @@ static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, static int wm8974_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 WM8974_OPCLKDIV: - reg = snd_soc_read(codec, WM8974_GPIO) & 0x1cf; - snd_soc_write(codec, WM8974_GPIO, reg | div); + reg = snd_soc_component_read32(component, WM8974_GPIO) & 0x1cf; + snd_soc_component_write(component, WM8974_GPIO, reg | div); break; case WM8974_MCLKDIV: - reg = snd_soc_read(codec, WM8974_CLOCK) & 0x11f; - snd_soc_write(codec, WM8974_CLOCK, reg | div); + reg = snd_soc_component_read32(component, WM8974_CLOCK) & 0x11f; + snd_soc_component_write(component, WM8974_CLOCK, reg | div); break; case WM8974_BCLKDIV: - reg = snd_soc_read(codec, WM8974_CLOCK) & 0x1e3; - snd_soc_write(codec, WM8974_CLOCK, reg | div); + reg = snd_soc_component_read32(component, WM8974_CLOCK) & 0x1e3; + snd_soc_component_write(component, WM8974_CLOCK, reg | div); break; default: return -EINVAL; @@ -418,8 +418,8 @@ static unsigned int wm8974_get_mclkdiv(unsigned int f_in, unsigned int f_out, static int wm8974_update_clocks(struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct wm8974_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct wm8974_priv *priv = snd_soc_component_get_drvdata(component); unsigned int fs256; unsigned int fpll = 0; unsigned int f; @@ -446,8 +446,8 @@ static int wm8974_update_clocks(struct snd_soc_dai *dai) static int wm8974_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = dai->codec; - struct wm8974_priv *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct wm8974_priv *priv = snd_soc_component_get_drvdata(component); if (dir != SND_SOC_CLOCK_IN) return -EINVAL; @@ -460,9 +460,9 @@ static int wm8974_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, static int wm8974_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 iface = 0; - u16 clk = snd_soc_read(codec, WM8974_CLOCK) & 0x1fe; + u16 clk = snd_soc_component_read32(component, WM8974_CLOCK) & 0x1fe; /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -509,8 +509,8 @@ static int wm8974_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - snd_soc_write(codec, WM8974_IFACE, iface); - snd_soc_write(codec, WM8974_CLOCK, clk); + snd_soc_component_write(component, WM8974_IFACE, iface); + snd_soc_component_write(component, WM8974_CLOCK, clk); return 0; } @@ -518,10 +518,10 @@ static int wm8974_pcm_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 wm8974_priv *priv = snd_soc_codec_get_drvdata(codec); - u16 iface = snd_soc_read(codec, WM8974_IFACE) & 0x19f; - u16 adn = snd_soc_read(codec, WM8974_ADD) & 0x1f1; + struct snd_soc_component *component = dai->component; + struct wm8974_priv *priv = snd_soc_component_get_drvdata(component); + u16 iface = snd_soc_component_read32(component, WM8974_IFACE) & 0x19f; + u16 adn = snd_soc_component_read32(component, WM8974_ADD) & 0x1f1; int err; priv->fs = params_rate(params); @@ -566,55 +566,55 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream, break; } - snd_soc_write(codec, WM8974_IFACE, iface); - snd_soc_write(codec, WM8974_ADD, adn); + snd_soc_component_write(component, WM8974_IFACE, iface); + snd_soc_component_write(component, WM8974_ADD, adn); return 0; } static int wm8974_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - u16 mute_reg = snd_soc_read(codec, WM8974_DAC) & 0xffbf; + struct snd_soc_component *component = dai->component; + u16 mute_reg = snd_soc_component_read32(component, WM8974_DAC) & 0xffbf; if (mute) - snd_soc_write(codec, WM8974_DAC, mute_reg | 0x40); + snd_soc_component_write(component, WM8974_DAC, mute_reg | 0x40); else - snd_soc_write(codec, WM8974_DAC, mute_reg); + snd_soc_component_write(component, WM8974_DAC, mute_reg); return 0; } /* liam need to make this lower power with dapm */ -static int wm8974_set_bias_level(struct snd_soc_codec *codec, +static int wm8974_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - u16 power1 = snd_soc_read(codec, WM8974_POWER1) & ~0x3; + u16 power1 = snd_soc_component_read32(component, WM8974_POWER1) & ~0x3; switch (level) { case SND_SOC_BIAS_ON: case SND_SOC_BIAS_PREPARE: power1 |= 0x1; /* VMID 50k */ - snd_soc_write(codec, WM8974_POWER1, power1); + snd_soc_component_write(component, WM8974_POWER1, power1); break; case SND_SOC_BIAS_STANDBY: power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN; - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { - regcache_sync(dev_get_regmap(codec->dev, NULL)); + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { + regcache_sync(dev_get_regmap(component->dev, NULL)); /* Initial cap charge at VMID 5k */ - snd_soc_write(codec, WM8974_POWER1, power1 | 0x3); + snd_soc_component_write(component, WM8974_POWER1, power1 | 0x3); mdelay(100); } power1 |= 0x2; /* VMID 500k */ - snd_soc_write(codec, WM8974_POWER1, power1); + snd_soc_component_write(component, WM8974_POWER1, power1); break; case SND_SOC_BIAS_OFF: - snd_soc_write(codec, WM8974_POWER1, 0); - snd_soc_write(codec, WM8974_POWER2, 0); - snd_soc_write(codec, WM8974_POWER3, 0); + snd_soc_component_write(component, WM8974_POWER1, 0); + snd_soc_component_write(component, WM8974_POWER2, 0); + snd_soc_component_write(component, WM8974_POWER3, 0); break; } @@ -663,32 +663,33 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec, .cache_type = REGCACHE_FLAT, }; -static int wm8974_probe(struct snd_soc_codec *codec) +static int wm8974_probe(struct snd_soc_component *component) { int ret = 0; - ret = wm8974_reset(codec); + ret = wm8974_reset(component); if (ret < 0) { - dev_err(codec->dev, "Failed to issue reset\n"); + dev_err(component->dev, "Failed to issue reset\n"); return ret; } return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8974 = { - .probe = wm8974_probe, - .set_bias_level = wm8974_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8974_snd_controls, - .num_controls = ARRAY_SIZE(wm8974_snd_controls), - .dapm_widgets = wm8974_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8974_dapm_widgets), - .dapm_routes = wm8974_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8974_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8974 = { + .probe = wm8974_probe, + .set_bias_level = wm8974_set_bias_level, + .controls = wm8974_snd_controls, + .num_controls = ARRAY_SIZE(wm8974_snd_controls), + .dapm_widgets = wm8974_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8974_dapm_widgets), + .dapm_routes = wm8974_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8974_dapm_routes), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int wm8974_i2c_probe(struct i2c_client *i2c, @@ -708,19 +709,12 @@ static int wm8974_i2c_probe(struct i2c_client *i2c, if (IS_ERR(regmap)) return PTR_ERR(regmap); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm8974, &wm8974_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_wm8974, &wm8974_dai, 1); return ret; } -static int wm8974_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - - return 0; -} - static const struct i2c_device_id wm8974_i2c_id[] = { { "wm8974", 0 }, { } @@ -739,7 +733,6 @@ static int wm8974_i2c_remove(struct i2c_client *client) .of_match_table = wm8974_of_match, }, .probe = wm8974_i2c_probe, - .remove = wm8974_i2c_remove, .id_table = wm8974_i2c_id, };