From patchwork Fri Jan 12 01:15:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10159165 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 96C846029B for ; Fri, 12 Jan 2018 01:18:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 824052870F for ; Fri, 12 Jan 2018 01:18:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74CF02875E; Fri, 12 Jan 2018 01:18:57 +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 B69022870F for ; Fri, 12 Jan 2018 01:18:55 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 8BD12267B26; Fri, 12 Jan 2018 02:18:54 +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 65D4C267B27; Fri, 12 Jan 2018 02:18:53 +0100 (CET) Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id C12C2267B26 for ; Fri, 12 Jan 2018 02:15:24 +0100 (CET) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie3.idc.renesas.com with ESMTP; 12 Jan 2018 10:15:23 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 546776C6B7; Fri, 12 Jan 2018 10:15:23 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,346,1511794800"; d="scan'208";a="268006570" Received: from mail-sg2apc01lp0242.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.242]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 12 Jan 2018 10:15:22 +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=fbH9q4EjB2ABuvEJk1HVNlUyLtWWGCJZGeE/AoHtSrw=; b=LO6bDg05u8HGh7DXHqDv5KgVZZMNxgZ7rhnzA3Hm/KLBlNlee56O+N6xamxRzGFR/qOEovo6FsCDAFY/zB9dDWs+968Mx5xQ8eskBQn6dgNLxMaa7XTTuXilLVXB0Qb/oH+UtOSTOi3HDw6ZINMlWAy0Vc3Tcd+PCE3X0YApTck= 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 SG2PR0601MB1885.apcprd06.prod.outlook.com (2603:1096:3:9::18) 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:15:19 +0000 Message-ID: <87bmhzdgkc.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:15:19 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: TY1PR01CA0103.jpnprd01.prod.outlook.com (2603:1096:401:d::21) To SG2PR0601MB1885.apcprd06.prod.outlook.com (2603:1096:3:9::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5388fc3e-42dc-495f-351a-08d55959f2ce X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020074)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SG2PR0601MB1885; X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1885; 3:O/RH0Tt8B1QmqoWhBdtu7zyvj5iOW9P7qN6eL1fZ00MqSV4tryNKYFAAncSs3qzPlo96j9VxDvex08dQSPDETZq8xygQKxtAUe+ueS3AlfwcRdWB633e3zpYLsWJaqdLlzWlIBsx9h7xSc5aKyW8FOq1L8zY5A6LvAdnLV6WoHppWVh4GlSbjTr8Ua86sEKkuUl5svNQWogAsQZaqeFHA2hl/XxJlz+WzXlEuMpVl28HAwxS0ok41PAyWaUAXhGm; 25:+1n0iDZMUpHsahEJFA3mXfGZDlLOOY155YZtYXNij3BbC4dlAdwQYc0d+01O30YR/OeJtfys8SbG6atbpuFhNjgTxFXUYr3qNsXbde6yUnQGxgRf4IH4QYAHOfmQmlNHqzmu1MEze6qaL3H0apxrrBuzqB/S1wxVyq/Dj+DayALYa73KXEBhdGxKq9UlHA+MA31oI7bDM7D/V9HjVwMmQh+U4xk2U6nha8SP3182HPq2QQIiR1EWZUV22x28i9ojqJqVVvig0lc+TnHZCDahoIB09QO7vvO6FeaA1Nw30RpyTmlBszQQzjaf+KP6bVNHz2Q1mcpyTf3t0c2POkcVsg==; 31:vn9wDph1UIqB9zcYAhh9rdw872jM7kVq4q5s8UuLlMZcWrQR/MRiqsMiU6YpGHqSoY3S6+/J4osJo1qPMOdBtEmpFOVPIye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change-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501137)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041268)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SG2PR0601MB1885; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SG2PR0601MB1885; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(396003)(39380400002)(346002)(366004)(39860400002)(189003)(199004)(2950100002)(6916009)(97736004)(105586002)(68736007)(69596002)(36756003)(4326008)(8676002)(5660300001)(478600001)(81156014)(86362001)(575784001)(6116002)(106356001)(3846002)(50466002)(53416004)(25786009)(81166006)(83506002)(52116002)(54906003)(23726003)(59450400001)(7696005)(66066001)(76176011)(7736002)(386003)(47776003)(53936002)(58126008)(16586007)(2906002)(16526018)(8936002)(316002)(305945005)(6486002)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR0601MB1885; 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; SG2PR0601MB1885; 23:RBlXid3m6LP9UYSU+iu7c524uxFOdswwvKGRN84?= =?us-ascii?Q?My0hZj3/tUm2gt7tekslIPMNGj11/gzY227XqXDSGSCAR2ycFhQKhSCZRPb/?= =?us-ascii?Q?xKPAiQuui2X/yH6qxvbRDJ2KD3wJ7mju1JTQ22gfyAWaiqCv4Ib0oYvF3uEP?= =?us-ascii?Q?W4UAGm+1Q1dGlwYk3gXZ4hF8GpuuKvr1cFlGzq91jY1wewXkucqZNMSkHyWk?= =?us-ascii?Q?LqT88yQN44GtfQQ3X+D89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99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1885; 20:3B1ofl1VuBFiiBhdZyYv2LVX9Q1dizSI8cArTz3PT/WpyJ77mF7HZmCR/pvRy3sjS4koItU+s/GKX2gtypLXlJdut5A6dC2Uej4FfCv55ev7qIfZqm3Iw0bJyu0L4TduV50mK2R8jusozIpWcRInhGP5/9oWHlpG9iG2eruksWQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 01:15:19.7417 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5388fc3e-42dc-495f-351a-08d55959f2ce X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR0601MB1885 Cc: Linux-ALSA , Simon Subject: [alsa-devel] [PATCH 025/187] ASoC: wm8900: 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/wm8900.c | 251 +++++++++++++++++++++++----------------------- 1 file changed, 125 insertions(+), 126 deletions(-) diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index c77b49a..74a7d0c 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -216,23 +216,23 @@ static bool wm8900_volatile_register(struct device *dev, unsigned int reg) } } -static void wm8900_reset(struct snd_soc_codec *codec) +static void wm8900_reset(struct snd_soc_component *component) { - snd_soc_write(codec, WM8900_REG_RESET, 0); + snd_soc_component_write(component, WM8900_REG_RESET, 0); } static int wm8900_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 hpctl1 = snd_soc_read(codec, WM8900_REG_HPCTL1); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + u16 hpctl1 = snd_soc_component_read32(component, WM8900_REG_HPCTL1); switch (event) { case SND_SOC_DAPM_PRE_PMU: /* Clamp headphone outputs */ hpctl1 = WM8900_REG_HPCTL1_HP_CLAMP_IP | WM8900_REG_HPCTL1_HP_CLAMP_OP; - snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1); + snd_soc_component_write(component, WM8900_REG_HPCTL1, hpctl1); break; case SND_SOC_DAPM_POST_PMU: @@ -241,41 +241,41 @@ static int wm8900_hp_event(struct snd_soc_dapm_widget *w, hpctl1 |= WM8900_REG_HPCTL1_HP_SHORT | WM8900_REG_HPCTL1_HP_SHORT2 | WM8900_REG_HPCTL1_HP_IPSTAGE_ENA; - snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1); + snd_soc_component_write(component, WM8900_REG_HPCTL1, hpctl1); msleep(400); /* Enable the output stage */ hpctl1 &= ~WM8900_REG_HPCTL1_HP_CLAMP_OP; hpctl1 |= WM8900_REG_HPCTL1_HP_OPSTAGE_ENA; - snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1); + snd_soc_component_write(component, WM8900_REG_HPCTL1, hpctl1); /* Remove the shorts */ hpctl1 &= ~WM8900_REG_HPCTL1_HP_SHORT2; - snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1); + snd_soc_component_write(component, WM8900_REG_HPCTL1, hpctl1); hpctl1 &= ~WM8900_REG_HPCTL1_HP_SHORT; - snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1); + snd_soc_component_write(component, WM8900_REG_HPCTL1, hpctl1); break; case SND_SOC_DAPM_PRE_PMD: /* Short the output */ hpctl1 |= WM8900_REG_HPCTL1_HP_SHORT; - snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1); + snd_soc_component_write(component, WM8900_REG_HPCTL1, hpctl1); /* Disable the output stage */ hpctl1 &= ~WM8900_REG_HPCTL1_HP_OPSTAGE_ENA; - snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1); + snd_soc_component_write(component, WM8900_REG_HPCTL1, hpctl1); /* Clamp the outputs and power down input */ hpctl1 |= WM8900_REG_HPCTL1_HP_CLAMP_IP | WM8900_REG_HPCTL1_HP_CLAMP_OP; hpctl1 &= ~WM8900_REG_HPCTL1_HP_IPSTAGE_ENA; - snd_soc_write(codec, WM8900_REG_HPCTL1, hpctl1); + snd_soc_component_write(component, WM8900_REG_HPCTL1, hpctl1); break; case SND_SOC_DAPM_POST_PMD: /* Disable everything */ - snd_soc_write(codec, WM8900_REG_HPCTL1, 0); + snd_soc_component_write(component, WM8900_REG_HPCTL1, 0); break; default: @@ -635,10 +635,10 @@ static int wm8900_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 snd_soc_component *component = dai->component; u16 reg; - reg = snd_soc_read(codec, WM8900_REG_AUDIO1) & ~0x60; + reg = snd_soc_component_read32(component, WM8900_REG_AUDIO1) & ~0x60; switch (params_width(params)) { case 16: @@ -656,17 +656,17 @@ static int wm8900_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - snd_soc_write(codec, WM8900_REG_AUDIO1, reg); + snd_soc_component_write(component, WM8900_REG_AUDIO1, reg); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - reg = snd_soc_read(codec, WM8900_REG_DACCTRL); + reg = snd_soc_component_read32(component, WM8900_REG_DACCTRL); if (params_rate(params) <= 24000) reg |= WM8900_REG_DACCTRL_DAC_SB_FILT; else reg &= ~WM8900_REG_DACCTRL_DAC_SB_FILT; - snd_soc_write(codec, WM8900_REG_DACCTRL, reg); + snd_soc_component_write(component, WM8900_REG_DACCTRL, reg); } return 0; @@ -751,24 +751,24 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref, return 0; } -static int wm8900_set_fll(struct snd_soc_codec *codec, +static int wm8900_set_fll(struct snd_soc_component *component, int fll_id, unsigned int freq_in, unsigned int freq_out) { - struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec); + struct wm8900_priv *wm8900 = snd_soc_component_get_drvdata(component); struct _fll_div fll_div; if (wm8900->fll_in == freq_in && wm8900->fll_out == freq_out) return 0; /* The digital side should be disabled during any change. */ - snd_soc_update_bits(codec, WM8900_REG_POWER1, + snd_soc_component_update_bits(component, WM8900_REG_POWER1, WM8900_REG_POWER1_FLL_ENA, 0); /* Disable the FLL? */ if (!freq_in || !freq_out) { - snd_soc_update_bits(codec, WM8900_REG_CLOCKING1, + snd_soc_component_update_bits(component, WM8900_REG_CLOCKING1, WM8900_REG_CLOCKING1_MCLK_SRC, 0); - snd_soc_update_bits(codec, WM8900_REG_FLLCTL1, + snd_soc_component_update_bits(component, WM8900_REG_FLLCTL1, WM8900_REG_FLLCTL1_OSC_ENA, 0); wm8900->fll_in = freq_in; wm8900->fll_out = freq_out; @@ -784,32 +784,32 @@ static int wm8900_set_fll(struct snd_soc_codec *codec, /* The osclilator *MUST* be enabled before we enable the * digital circuit. */ - snd_soc_write(codec, WM8900_REG_FLLCTL1, + snd_soc_component_write(component, WM8900_REG_FLLCTL1, fll_div.fll_ratio | WM8900_REG_FLLCTL1_OSC_ENA); - snd_soc_write(codec, WM8900_REG_FLLCTL4, fll_div.n >> 5); - snd_soc_write(codec, WM8900_REG_FLLCTL5, + snd_soc_component_write(component, WM8900_REG_FLLCTL4, fll_div.n >> 5); + snd_soc_component_write(component, WM8900_REG_FLLCTL5, (fll_div.fllclk_div << 6) | (fll_div.n & 0x1f)); if (fll_div.k) { - snd_soc_write(codec, WM8900_REG_FLLCTL2, + snd_soc_component_write(component, WM8900_REG_FLLCTL2, (fll_div.k >> 8) | 0x100); - snd_soc_write(codec, WM8900_REG_FLLCTL3, fll_div.k & 0xff); + snd_soc_component_write(component, WM8900_REG_FLLCTL3, fll_div.k & 0xff); } else - snd_soc_write(codec, WM8900_REG_FLLCTL2, 0); + snd_soc_component_write(component, WM8900_REG_FLLCTL2, 0); if (fll_div.fll_slow_lock_ref) - snd_soc_write(codec, WM8900_REG_FLLCTL6, + snd_soc_component_write(component, WM8900_REG_FLLCTL6, WM8900_REG_FLLCTL6_FLL_SLOW_LOCK_REF); else - snd_soc_write(codec, WM8900_REG_FLLCTL6, 0); + snd_soc_component_write(component, WM8900_REG_FLLCTL6, 0); - snd_soc_update_bits(codec, WM8900_REG_POWER1, + snd_soc_component_update_bits(component, WM8900_REG_POWER1, WM8900_REG_POWER1_FLL_ENA, WM8900_REG_POWER1_FLL_ENA); reenable: - snd_soc_update_bits(codec, WM8900_REG_CLOCKING1, + snd_soc_component_update_bits(component, WM8900_REG_CLOCKING1, WM8900_REG_CLOCKING1_MCLK_SRC, WM8900_REG_CLOCKING1_MCLK_SRC); return 0; @@ -818,41 +818,41 @@ static int wm8900_set_fll(struct snd_soc_codec *codec, static int wm8900_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out) { - return wm8900_set_fll(codec_dai->codec, pll_id, freq_in, freq_out); + return wm8900_set_fll(codec_dai->component, pll_id, freq_in, freq_out); } static int wm8900_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; switch (div_id) { case WM8900_BCLK_DIV: - snd_soc_update_bits(codec, WM8900_REG_CLOCKING1, + snd_soc_component_update_bits(component, WM8900_REG_CLOCKING1, WM8900_REG_CLOCKING1_BCLK_MASK, div); break; case WM8900_OPCLK_DIV: - snd_soc_update_bits(codec, WM8900_REG_CLOCKING1, + snd_soc_component_update_bits(component, WM8900_REG_CLOCKING1, WM8900_REG_CLOCKING1_OPCLK_MASK, div); break; case WM8900_DAC_LRCLK: - snd_soc_update_bits(codec, WM8900_REG_AUDIO4, + snd_soc_component_update_bits(component, WM8900_REG_AUDIO4, WM8900_LRC_MASK, div); break; case WM8900_ADC_LRCLK: - snd_soc_update_bits(codec, WM8900_REG_AUDIO3, + snd_soc_component_update_bits(component, WM8900_REG_AUDIO3, WM8900_LRC_MASK, div); break; case WM8900_DAC_CLKDIV: - snd_soc_update_bits(codec, WM8900_REG_CLOCKING2, + snd_soc_component_update_bits(component, WM8900_REG_CLOCKING2, WM8900_REG_CLOCKING2_DAC_CLKDIV, div); break; case WM8900_ADC_CLKDIV: - snd_soc_update_bits(codec, WM8900_REG_CLOCKING2, + snd_soc_component_update_bits(component, WM8900_REG_CLOCKING2, WM8900_REG_CLOCKING2_ADC_CLKDIV, div); break; case WM8900_LRCLK_MODE: - snd_soc_update_bits(codec, WM8900_REG_DACCTRL, + snd_soc_component_update_bits(component, WM8900_REG_DACCTRL, WM8900_REG_DACCTRL_AIF_LRCLKRATE, div); break; default: @@ -866,13 +866,13 @@ static int wm8900_set_dai_clkdiv(struct snd_soc_dai *codec_dai, static int wm8900_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; unsigned int clocking1, aif1, aif3, aif4; - clocking1 = snd_soc_read(codec, WM8900_REG_CLOCKING1); - aif1 = snd_soc_read(codec, WM8900_REG_AUDIO1); - aif3 = snd_soc_read(codec, WM8900_REG_AUDIO3); - aif4 = snd_soc_read(codec, WM8900_REG_AUDIO4); + clocking1 = snd_soc_component_read32(component, WM8900_REG_CLOCKING1); + aif1 = snd_soc_component_read32(component, WM8900_REG_AUDIO1); + aif3 = snd_soc_component_read32(component, WM8900_REG_AUDIO3); + aif4 = snd_soc_component_read32(component, WM8900_REG_AUDIO4); /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -968,27 +968,27 @@ static int wm8900_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - snd_soc_write(codec, WM8900_REG_CLOCKING1, clocking1); - snd_soc_write(codec, WM8900_REG_AUDIO1, aif1); - snd_soc_write(codec, WM8900_REG_AUDIO3, aif3); - snd_soc_write(codec, WM8900_REG_AUDIO4, aif4); + snd_soc_component_write(component, WM8900_REG_CLOCKING1, clocking1); + snd_soc_component_write(component, WM8900_REG_AUDIO1, aif1); + snd_soc_component_write(component, WM8900_REG_AUDIO3, aif3); + snd_soc_component_write(component, WM8900_REG_AUDIO4, aif4); return 0; } static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; u16 reg; - reg = snd_soc_read(codec, WM8900_REG_DACCTRL); + reg = snd_soc_component_read32(component, WM8900_REG_DACCTRL); if (mute) reg |= WM8900_REG_DACCTRL_MUTE; else reg &= ~WM8900_REG_DACCTRL_MUTE; - snd_soc_write(codec, WM8900_REG_DACCTRL, reg); + snd_soc_component_write(component, WM8900_REG_DACCTRL, reg); return 0; } @@ -1028,7 +1028,7 @@ static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute) .ops = &wm8900_dai_ops, }; -static int wm8900_set_bias_level(struct snd_soc_codec *codec, +static int wm8900_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { u16 reg; @@ -1036,10 +1036,10 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec, switch (level) { case SND_SOC_BIAS_ON: /* Enable thermal shutdown */ - snd_soc_update_bits(codec, WM8900_REG_GPIO, + snd_soc_component_update_bits(component, WM8900_REG_GPIO, WM8900_REG_GPIO_TEMP_ENA, WM8900_REG_GPIO_TEMP_ENA); - snd_soc_update_bits(codec, WM8900_REG_ADDCTL, + snd_soc_component_update_bits(component, WM8900_REG_ADDCTL, WM8900_REG_ADDCTL_TEMP_SD, WM8900_REG_ADDCTL_TEMP_SD); break; @@ -1049,113 +1049,113 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_STANDBY: /* Charge capacitors if initial power up */ - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { /* STARTUP_BIAS_ENA on */ - snd_soc_write(codec, WM8900_REG_POWER1, + snd_soc_component_write(component, WM8900_REG_POWER1, WM8900_REG_POWER1_STARTUP_BIAS_ENA); /* Startup bias mode */ - snd_soc_write(codec, WM8900_REG_ADDCTL, + snd_soc_component_write(component, WM8900_REG_ADDCTL, WM8900_REG_ADDCTL_BIAS_SRC | WM8900_REG_ADDCTL_VMID_SOFTST); /* VMID 2x50k */ - snd_soc_write(codec, WM8900_REG_POWER1, + snd_soc_component_write(component, WM8900_REG_POWER1, WM8900_REG_POWER1_STARTUP_BIAS_ENA | 0x1); /* Allow capacitors to charge */ schedule_timeout_interruptible(msecs_to_jiffies(400)); /* Enable bias */ - snd_soc_write(codec, WM8900_REG_POWER1, + snd_soc_component_write(component, WM8900_REG_POWER1, WM8900_REG_POWER1_STARTUP_BIAS_ENA | WM8900_REG_POWER1_BIAS_ENA | 0x1); - snd_soc_write(codec, WM8900_REG_ADDCTL, 0); + snd_soc_component_write(component, WM8900_REG_ADDCTL, 0); - snd_soc_write(codec, WM8900_REG_POWER1, + snd_soc_component_write(component, WM8900_REG_POWER1, WM8900_REG_POWER1_BIAS_ENA | 0x1); } - reg = snd_soc_read(codec, WM8900_REG_POWER1); - snd_soc_write(codec, WM8900_REG_POWER1, + reg = snd_soc_component_read32(component, WM8900_REG_POWER1); + snd_soc_component_write(component, WM8900_REG_POWER1, (reg & WM8900_REG_POWER1_FLL_ENA) | WM8900_REG_POWER1_BIAS_ENA | 0x1); - snd_soc_write(codec, WM8900_REG_POWER2, + snd_soc_component_write(component, WM8900_REG_POWER2, WM8900_REG_POWER2_SYSCLK_ENA); - snd_soc_write(codec, WM8900_REG_POWER3, 0); + snd_soc_component_write(component, WM8900_REG_POWER3, 0); break; case SND_SOC_BIAS_OFF: /* Startup bias enable */ - reg = snd_soc_read(codec, WM8900_REG_POWER1); - snd_soc_write(codec, WM8900_REG_POWER1, + reg = snd_soc_component_read32(component, WM8900_REG_POWER1); + snd_soc_component_write(component, WM8900_REG_POWER1, reg & WM8900_REG_POWER1_STARTUP_BIAS_ENA); - snd_soc_write(codec, WM8900_REG_ADDCTL, + snd_soc_component_write(component, WM8900_REG_ADDCTL, WM8900_REG_ADDCTL_BIAS_SRC | WM8900_REG_ADDCTL_VMID_SOFTST); /* Discharge caps */ - snd_soc_write(codec, WM8900_REG_POWER1, + snd_soc_component_write(component, WM8900_REG_POWER1, WM8900_REG_POWER1_STARTUP_BIAS_ENA); schedule_timeout_interruptible(msecs_to_jiffies(500)); /* Remove clamp */ - snd_soc_write(codec, WM8900_REG_HPCTL1, 0); + snd_soc_component_write(component, WM8900_REG_HPCTL1, 0); /* Power down */ - snd_soc_write(codec, WM8900_REG_ADDCTL, 0); - snd_soc_write(codec, WM8900_REG_POWER1, 0); - snd_soc_write(codec, WM8900_REG_POWER2, 0); - snd_soc_write(codec, WM8900_REG_POWER3, 0); + snd_soc_component_write(component, WM8900_REG_ADDCTL, 0); + snd_soc_component_write(component, WM8900_REG_POWER1, 0); + snd_soc_component_write(component, WM8900_REG_POWER2, 0); + snd_soc_component_write(component, WM8900_REG_POWER3, 0); /* Need to let things settle before stopping the clock * to ensure that restart works, see "Stopping the * master clock" in the datasheet. */ schedule_timeout_interruptible(msecs_to_jiffies(1)); - snd_soc_write(codec, WM8900_REG_POWER2, + snd_soc_component_write(component, WM8900_REG_POWER2, WM8900_REG_POWER2_SYSCLK_ENA); break; } return 0; } -static int wm8900_suspend(struct snd_soc_codec *codec) +static int wm8900_suspend(struct snd_soc_component *component) { - struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec); + struct wm8900_priv *wm8900 = snd_soc_component_get_drvdata(component); int fll_out = wm8900->fll_out; int fll_in = wm8900->fll_in; int ret; /* Stop the FLL in an orderly fashion */ - ret = wm8900_set_fll(codec, 0, 0, 0); + ret = wm8900_set_fll(component, 0, 0, 0); if (ret != 0) { - dev_err(codec->dev, "Failed to stop FLL\n"); + dev_err(component->dev, "Failed to stop FLL\n"); return ret; } wm8900->fll_out = fll_out; wm8900->fll_in = fll_in; - snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); + snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); return 0; } -static int wm8900_resume(struct snd_soc_codec *codec) +static int wm8900_resume(struct snd_soc_component *component) { - struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec); + struct wm8900_priv *wm8900 = snd_soc_component_get_drvdata(component); int ret; - wm8900_reset(codec); + wm8900_reset(component); ret = regcache_sync(wm8900->regmap); if (ret != 0) { - dev_err(codec->dev, "Failed to restore cache: %d\n", ret); + dev_err(component->dev, "Failed to restore cache: %d\n", ret); return ret; } - snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); + snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); /* Restart the FLL? */ if (wm8900->fll_out) { @@ -1165,9 +1165,9 @@ static int wm8900_resume(struct snd_soc_codec *codec) wm8900->fll_in = 0; wm8900->fll_out = 0; - ret = wm8900_set_fll(codec, 0, fll_in, fll_out); + ret = wm8900_set_fll(component, 0, fll_in, fll_out); if (ret != 0) { - dev_err(codec->dev, "Failed to restart FLL\n"); + dev_err(component->dev, "Failed to restart FLL\n"); return ret; } } @@ -1175,53 +1175,54 @@ static int wm8900_resume(struct snd_soc_codec *codec) return 0; } -static int wm8900_probe(struct snd_soc_codec *codec) +static int wm8900_probe(struct snd_soc_component *component) { int reg; - reg = snd_soc_read(codec, WM8900_REG_ID); + reg = snd_soc_component_read32(component, WM8900_REG_ID); if (reg != 0x8900) { - dev_err(codec->dev, "Device is not a WM8900 - ID %x\n", reg); + dev_err(component->dev, "Device is not a WM8900 - ID %x\n", reg); return -ENODEV; } - wm8900_reset(codec); + wm8900_reset(component); /* Turn the chip on */ - snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); + snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); /* Latch the volume update bits */ - snd_soc_update_bits(codec, WM8900_REG_LINVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_RINVOL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_LOUT1CTL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_ROUT1CTL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_LOUT2CTL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_ROUT2CTL, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_LDAC_DV, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_RDAC_DV, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_LADC_DV, 0x100, 0x100); - snd_soc_update_bits(codec, WM8900_REG_RADC_DV, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_LINVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_RINVOL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_LOUT1CTL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_ROUT1CTL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_LOUT2CTL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_ROUT2CTL, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_LDAC_DV, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_RDAC_DV, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_LADC_DV, 0x100, 0x100); + snd_soc_component_update_bits(component, WM8900_REG_RADC_DV, 0x100, 0x100); /* Set the DAC and mixer output bias */ - snd_soc_write(codec, WM8900_REG_OUTBIASCTL, 0x81); + snd_soc_component_write(component, WM8900_REG_OUTBIASCTL, 0x81); return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8900 = { - .probe = wm8900_probe, - .suspend = wm8900_suspend, - .resume = wm8900_resume, - .set_bias_level = wm8900_set_bias_level, - - .component_driver = { - .controls = wm8900_snd_controls, - .num_controls = ARRAY_SIZE(wm8900_snd_controls), - .dapm_widgets = wm8900_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8900_dapm_widgets), - .dapm_routes = wm8900_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8900_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8900 = { + .probe = wm8900_probe, + .suspend = wm8900_suspend, + .resume = wm8900_resume, + .set_bias_level = wm8900_set_bias_level, + .controls = wm8900_snd_controls, + .num_controls = ARRAY_SIZE(wm8900_snd_controls), + .dapm_widgets = wm8900_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8900_dapm_widgets), + .dapm_routes = wm8900_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8900_dapm_routes), + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config wm8900_regmap = { @@ -1253,15 +1254,14 @@ static int wm8900_spi_probe(struct spi_device *spi) spi_set_drvdata(spi, wm8900); - ret = snd_soc_register_codec(&spi->dev, - &soc_codec_dev_wm8900, &wm8900_dai, 1); + ret = devm_snd_soc_register_component(&spi->dev, + &soc_component_dev_wm8900, &wm8900_dai, 1); return ret; } static int wm8900_spi_remove(struct spi_device *spi) { - snd_soc_unregister_codec(&spi->dev); return 0; } @@ -1292,15 +1292,14 @@ static int wm8900_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8900); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm8900, &wm8900_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_wm8900, &wm8900_dai, 1); return ret; } static int wm8900_i2c_remove(struct i2c_client *client) { - snd_soc_unregister_codec(&client->dev); return 0; }