From patchwork Fri Jan 12 01:21:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10159207 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 F16186029B for ; Fri, 12 Jan 2018 01:28:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E003B2870F for ; Fri, 12 Jan 2018 01:28:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D34D428743; Fri, 12 Jan 2018 01:28:32 +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 642522870F for ; Fri, 12 Jan 2018 01:28:31 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 27F87267AD3; Fri, 12 Jan 2018 02:28:30 +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 6573A267B93; Fri, 12 Jan 2018 02:28:28 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id BF75C267CB9 for ; Fri, 12 Jan 2018 02:21:39 +0100 (CET) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 12 Jan 2018 10:21:38 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 4081E6CB79; Fri, 12 Jan 2018 10:21:38 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,346,1511794800"; d="scan'208";a="268007417" Received: from mail-sg2apc01lp0247.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.247]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 12 Jan 2018 10:21:37 +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=gy96DQ74OkCoDYgwO7g93JrxhhqiOTdWw2vk7JWID6E=; b=glSS8gT5rBkkmRgzlYAkFRPbVmeV4rnNME5trwxCWQvbqhMPw9xp+UL4iegKz9psXsxTKF4GywhW5SNDtbPjeF4FLFnN60MiXY7Ocue0Ji0bYSbP2nnxMyZ1ldtkvaYFQgVT7sRrxotDqNFHP2YlqgBnrh4v/dGjbIPm36h8gwg= 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 PS1PR0601MB1882.apcprd06.prod.outlook.com (2603:1096:803:8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Fri, 12 Jan 2018 01:21:34 +0000 Message-ID: <87h8rrc1ph.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:21:34 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OS2PR01CA0117.jpnprd01.prod.outlook.com (2603:1096:602::11) To PS1PR0601MB1882.apcprd06.prod.outlook.com (2603:1096:803:8::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 46117298-6762-43c4-551e-08d5595ad1fc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020074)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:PS1PR0601MB1882; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1882; 3:5IJnKygJV7D8lsiv1cro7kZvresRXTgB6iXTi1P0FAm8L0RXkrAc9er9M5JpYom6LNvfMVTNN6ELwH7tqqJmZYT8qcXzgnX98efN0J5tY4KsxPtRu8s0pd4lwbqYqdl6USGHhlsmjoyAXBm1LAZworBoDAxFlNrmGIdjk13NKuHdqf5yxYU18289Swi14/mHSiOA4JbUkt9Wd43s2YxmQrTZJaSCj3eorocooIXw4aRHrmzKZgUrmd47mhlozAsX; 25:1yozXDTrBWQLaUDtohBcL24+rk2Qs3VJXcDYNgu+9q4mJFIHczsvn0WFRmu3a0XxxGE7c51mGapGPqB5T97dBWbYFBoCqRZFGaGdp+81W8qu2/EXY1XIPuzRmLElSTgdSBm5kr9BPGvrXRXtKL24vDSNgQrqGnecW8v6MEuPUz9ScEGAfG1uUT43523pBmDiJCAm9bvQd0YYBsoDrrgak8/YO0kXDSfr6nnZBIzgYMy4lxMDAryh97JMsaHT9vO3WQlAV6AzMuqkHKGC+jpPacpP5qnpLruBPTEOaZLhYqaeHExNxkljPg8ohnrQIXBx8nhv5dCfBnRyo6KgO8YeIQ==; 31:x1u8IffogcBM3Z6OR3iGQozihEBjls8493lRB0oJWyfCGcEsw/9NfNlcqkdJr2Z4Uw6cNY6NheOzPmHy4OdpNPW6opNZDIjUupuRBNcLjXNV09LahM0gJ/zXNYRYdlnzoAAqLyQlrBTrEcc3LFnYjR/yo8gsge+/xd5s5rQ41ETn8V4WUqHYdHgcD77kIijgHBbLa8ry+YERi2d1K7NncN6gzL99Oivt2heQgnzb2jI= X-MS-TrafficTypeDiagnostic: PS1PR0601MB1882: X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1882; 20:cqiE72hxyDUGpNNn8oNSsRJz3A3+ockWm7wn/4P9rDX45UcudufSbaoI3MdoM/4E9EazWSfy53G4zBSoJZUfJ4aDSo8jvHBdmRJO33LiLiZwwut1/Pe2bgRJJyYTXpI/quZc/JPf5TMoRMFYTyroRL2Au/AZqblkO/LuovA6Xp7ZfiukmEmILd6e7d9yWigz5yPkvsDjkVF6KpuaFSLU5FRv3JhWk+/tOHFjtliwPzOhgpW2MhfFVrSjBxa62nbhw8ECO9MqWzkpacPnSJVHuaG6H2uZW8sQVz+cc3227bb0pNMxPBZnZ0NHZX1wv9Am5m2kTyu1VdObrn9f6y2x3Hvyh5NO63BWDb4GsbSi+5gdcGLaZ/X3r8+EBqLeYOKwbY0JR5wea4kES6dCGpqA9yj5whZ0srHIVC4iDd1L0aXZklVFnjn0dfmIO5W4CzefBV5I5B3R6+nz9ELVP6PBzUUbFF5ef7Y4cMBKEygFtteF42ymQhCdsTVrWdr57Hxa; 4:wMuZFsS1Hj8/po8wNPksEsh57hBrPThX8yhayuGvym645ieZ9mf6tvGDJmTe4SxHaPm73G+JXip/t5WCA/gdz7YsQ+ZUKYlRf0IcjnKvRL4IeXE/xrjIdRJbeiDe7iJ+a5pkkcthXHctU6tGVo6VuH9H9vIxOg2s4xofEReg66QiwtOssF9eBEq4MoOee6G/TKMeGpe1JBJUjEc1ydHKAy79Ja/LZ1zt29/50uIvcHffBxsG8LMR5410Ay+G/zQDoVCoA90KHpZ1qB25RLoXnTlCeEcM2TUoFavnk9g4R8NpX5ekz0yaEH/Zn2S9S0PL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231023)(944501138)(10201501046)(6055026)(6041268)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:PS1PR0601MB1882; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:PS1PR0601MB1882; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(39380400002)(376002)(39860400002)(346002)(396003)(57704003)(189003)(199004)(478600001)(52116002)(54906003)(7696005)(53936002)(59450400001)(16526018)(105586002)(76176011)(6486002)(4326008)(47776003)(5660300001)(106356001)(58126008)(66066001)(16586007)(2950100002)(6916009)(83506002)(316002)(25786009)(81156014)(8676002)(305945005)(7736002)(23726003)(3846002)(97736004)(68736007)(575784001)(8936002)(86362001)(81166006)(50466002)(69596002)(386003)(53416004)(6116002)(2906002)(36756003)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1882; 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; PS1PR0601MB1882; 23:YflLH3/jB95cEP4kmGJKQo/6Q7ZJSfunZPD6Ik/?= =?us-ascii?Q?Jlj0XEddNx7o5vCLQzmC6VCslmjMNlcz0CcNQl3CBMkCyNYAlwGS5dd1XN6I?= =?us-ascii?Q?AhzuBl+xOGbbfUQBrH3C7LQ5Qw3mRNAyZ1hIEtj5l8yB9rHv1ARmlGXVjO5y?= =?us-ascii?Q?9SfCTRs0rrJH+Gdfg1KynJ91/+q5aM+1k7VgMjkqxLKA4dCVQd7eKZjiwCno?= =?us-ascii?Q?odngLlR8dplISCKbgTerY3k1AItQ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C3V8aij+6DJPtya9y8fUcuZ0iEId1rD+0qLNTlYZAhtoJw+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1882; 20:/o/QiRjME15TSHhsSKUDRxBE78CMpkRJEHT/wJ90plPhv1D9tDWOpMgF+6iybn3oIb/SP2o2CNHWPNSx6b7RUOW93g6fDyjm/V6LCSZ5bC9T9z+bTzTIXe5W+2wdeBXiOta4TKyYHbjZF2pQEvYAKjEAmYSyP/bJH18ZjLqaTYw= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 01:21:34.1915 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46117298-6762-43c4-551e-08d5595ad1fc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1882 Cc: Linux-ALSA , Simon Subject: [alsa-devel] [PATCH 047/187] ASoC: wm9713: 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/wm9713.c | 201 ++++++++++++++++++++++------------------------ 1 file changed, 97 insertions(+), 104 deletions(-) diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index df72206..04c93dd 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -196,16 +196,16 @@ static const DECLARE_TLV_DB_RANGE(mic_tlv, static int wm9713_voice_shutdown(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); if (WARN_ON(event != SND_SOC_DAPM_PRE_PMD)) return -EINVAL; /* Gracefully shut down the voice interface. */ - snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0f00, 0x0200); + snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0f00, 0x0200); schedule_timeout_interruptible(msecs_to_jiffies(1)); - snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0f00, 0x0f00); - snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x1000, 0x1000); + snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0f00, 0x0f00); + snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0x1000, 0x1000); return 0; } @@ -229,8 +229,8 @@ static int wm9713_hp_mixer_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); - struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); + struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); unsigned int val = ucontrol->value.integer.value[0]; struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; @@ -273,8 +273,8 @@ static int wm9713_hp_mixer_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); - struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); + struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; unsigned int mixer, shift; @@ -753,7 +753,7 @@ struct _pll_div { * to allow rounding later */ #define FIXED_PLL_SIZE ((1 << 22) * 10) -static void pll_factors(struct snd_soc_codec *codec, +static void pll_factors(struct snd_soc_component *component, struct _pll_div *pll_div, unsigned int source) { u64 Kpart; @@ -789,7 +789,7 @@ static void pll_factors(struct snd_soc_codec *codec, Ndiv = target / source; if ((Ndiv < 5) || (Ndiv > 12)) - dev_warn(codec->dev, + dev_warn(component->dev, "WM9713 PLL N value %u out of recommended range!\n", Ndiv); @@ -815,28 +815,28 @@ static void pll_factors(struct snd_soc_codec *codec, * Please note that changing the PLL input frequency may require * resynchronisation with the AC97 controller. */ -static int wm9713_set_pll(struct snd_soc_codec *codec, +static int wm9713_set_pll(struct snd_soc_component *component, int pll_id, unsigned int freq_in, unsigned int freq_out) { - struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); + struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); u16 reg, reg2; struct _pll_div pll_div; /* turn PLL off ? */ if (freq_in == 0) { /* disable PLL power and select ext source */ - snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0080, 0x0080); - snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x0200, 0x0200); + snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0080, 0x0080); + snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0x0200, 0x0200); wm9713->pll_in = 0; return 0; } - pll_factors(codec, &pll_div, freq_in); + pll_factors(component, &pll_div, freq_in); if (pll_div.k == 0) { reg = (pll_div.n << 12) | (pll_div.lf << 11) | (pll_div.divsel << 9) | (pll_div.divctl << 8); - snd_soc_write(codec, AC97_LINE1_LEVEL, reg); + snd_soc_component_write(component, AC97_LINE1_LEVEL, reg); } else { /* write the fractional k to the reg 0x46 pages */ reg2 = (pll_div.n << 12) | (pll_div.lf << 11) | (1 << 10) | @@ -844,31 +844,31 @@ static int wm9713_set_pll(struct snd_soc_codec *codec, /* K [21:20] */ reg = reg2 | (0x5 << 4) | (pll_div.k >> 20); - snd_soc_write(codec, AC97_LINE1_LEVEL, reg); + snd_soc_component_write(component, AC97_LINE1_LEVEL, reg); /* K [19:16] */ reg = reg2 | (0x4 << 4) | ((pll_div.k >> 16) & 0xf); - snd_soc_write(codec, AC97_LINE1_LEVEL, reg); + snd_soc_component_write(component, AC97_LINE1_LEVEL, reg); /* K [15:12] */ reg = reg2 | (0x3 << 4) | ((pll_div.k >> 12) & 0xf); - snd_soc_write(codec, AC97_LINE1_LEVEL, reg); + snd_soc_component_write(component, AC97_LINE1_LEVEL, reg); /* K [11:8] */ reg = reg2 | (0x2 << 4) | ((pll_div.k >> 8) & 0xf); - snd_soc_write(codec, AC97_LINE1_LEVEL, reg); + snd_soc_component_write(component, AC97_LINE1_LEVEL, reg); /* K [7:4] */ reg = reg2 | (0x1 << 4) | ((pll_div.k >> 4) & 0xf); - snd_soc_write(codec, AC97_LINE1_LEVEL, reg); + snd_soc_component_write(component, AC97_LINE1_LEVEL, reg); reg = reg2 | (0x0 << 4) | (pll_div.k & 0xf); /* K [3:0] */ - snd_soc_write(codec, AC97_LINE1_LEVEL, reg); + snd_soc_component_write(component, AC97_LINE1_LEVEL, reg); } /* turn PLL on and select as source */ - snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x0200, 0x0000); - snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0080, 0x0000); + snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0x0200, 0x0000); + snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0080, 0x0000); wm9713->pll_in = freq_in; /* wait 10ms AC97 link frames for the link to stabilise */ @@ -879,8 +879,8 @@ static int wm9713_set_pll(struct snd_soc_codec *codec, static int wm9713_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; - return wm9713_set_pll(codec, pll_id, freq_in, freq_out); + struct snd_soc_component *component = codec_dai->component; + return wm9713_set_pll(component, pll_id, freq_in, freq_out); } /* @@ -890,10 +890,10 @@ static int wm9713_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, static int wm9713_set_dai_tristate(struct snd_soc_dai *codec_dai, int tristate) { - struct snd_soc_codec *codec = codec_dai->codec; + struct snd_soc_component *component = codec_dai->component; if (tristate) - snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER, + snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER, 0x6000, 0x0000); return 0; @@ -906,30 +906,30 @@ static int wm9713_set_dai_tristate(struct snd_soc_dai *codec_dai, static int wm9713_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 WM9713_PCMCLK_DIV: - snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0f00, div); + snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0f00, div); break; case WM9713_CLKA_MULT: - snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0002, div); + snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0002, div); break; case WM9713_CLKB_MULT: - snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x0004, div); + snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x0004, div); break; case WM9713_HIFI_DIV: - snd_soc_update_bits(codec, AC97_HANDSET_RATE, 0x7000, div); + snd_soc_component_update_bits(component, AC97_HANDSET_RATE, 0x7000, div); break; case WM9713_PCMBCLK_DIV: - snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER, 0x0e00, div); + snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER, 0x0e00, div); break; case WM9713_PCMCLK_PLL_DIV: - snd_soc_update_bits(codec, AC97_LINE1_LEVEL, + snd_soc_component_update_bits(component, AC97_LINE1_LEVEL, 0x007f, div | 0x60); break; case WM9713_HIFI_PLL_DIV: - snd_soc_update_bits(codec, AC97_LINE1_LEVEL, + snd_soc_component_update_bits(component, AC97_LINE1_LEVEL, 0x007f, div | 0x70); break; default: @@ -942,8 +942,8 @@ static int wm9713_set_dai_clkdiv(struct snd_soc_dai *codec_dai, static int wm9713_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - u16 gpio = snd_soc_read(codec, AC97_GPIO_CFG) & 0xffc5; + struct snd_soc_component *component = codec_dai->component; + u16 gpio = snd_soc_component_read32(component, AC97_GPIO_CFG) & 0xffc5; u16 reg = 0x8000; /* clock masters */ @@ -996,8 +996,8 @@ static int wm9713_set_dai_fmt(struct snd_soc_dai *codec_dai, break; } - snd_soc_write(codec, AC97_GPIO_CFG, gpio); - snd_soc_write(codec, AC97_CENTER_LFE_MASTER, reg); + snd_soc_component_write(component, AC97_GPIO_CFG, gpio); + snd_soc_component_write(component, AC97_CENTER_LFE_MASTER, reg); return 0; } @@ -1005,22 +1005,22 @@ static int wm9713_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 snd_soc_component *component = dai->component; /* enable PCM interface in master mode */ switch (params_width(params)) { case 16: break; case 20: - snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER, + snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER, 0x000c, 0x0004); break; case 24: - snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER, + snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER, 0x000c, 0x0008); break; case 32: - snd_soc_update_bits(codec, AC97_CENTER_LFE_MASTER, + snd_soc_component_update_bits(component, AC97_CENTER_LFE_MASTER, 0x000c, 0x000c); break; } @@ -1030,33 +1030,33 @@ static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream, static int ac97_hifi_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; struct snd_pcm_runtime *runtime = substream->runtime; int reg; - snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x0001, 0x0001); + snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x0001, 0x0001); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) reg = AC97_PCM_FRONT_DAC_RATE; else reg = AC97_PCM_LR_ADC_RATE; - return snd_soc_write(codec, reg, runtime->rate); + return snd_soc_component_write(component, reg, runtime->rate); } static int ac97_aux_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; struct snd_pcm_runtime *runtime = substream->runtime; - snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x0001, 0x0001); - snd_soc_update_bits(codec, AC97_PCI_SID, 0x8000, 0x8000); + snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x0001, 0x0001); + snd_soc_component_update_bits(component, AC97_PCI_SID, 0x8000, 0x8000); if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) return -ENODEV; - return snd_soc_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate); + return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate); } #define WM9713_RATES (SNDRV_PCM_RATE_8000 | \ @@ -1142,48 +1142,48 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream, }, }; -static int wm9713_set_bias_level(struct snd_soc_codec *codec, +static int wm9713_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { switch (level) { case SND_SOC_BIAS_ON: /* enable thermal shutdown */ - snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0xe400, 0x0000); + snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0xe400, 0x0000); break; case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: /* enable master bias and vmid */ - snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0xc400, 0x0000); - snd_soc_write(codec, AC97_POWERDOWN, 0x0000); + snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0xc400, 0x0000); + snd_soc_component_write(component, AC97_POWERDOWN, 0x0000); break; case SND_SOC_BIAS_OFF: /* disable everything including AC link */ - snd_soc_write(codec, AC97_EXTENDED_MID, 0xffff); - snd_soc_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); - snd_soc_write(codec, AC97_POWERDOWN, 0xffff); + snd_soc_component_write(component, AC97_EXTENDED_MID, 0xffff); + snd_soc_component_write(component, AC97_EXTENDED_MSTATUS, 0xffff); + snd_soc_component_write(component, AC97_POWERDOWN, 0xffff); break; } return 0; } -static int wm9713_soc_suspend(struct snd_soc_codec *codec) +static int wm9713_soc_suspend(struct snd_soc_component *component) { /* Disable everything except touchpanel - that will be handled * by the touch driver and left disabled if touch is not in * use. */ - snd_soc_update_bits(codec, AC97_EXTENDED_MID, 0x7fff, + snd_soc_component_update_bits(component, AC97_EXTENDED_MID, 0x7fff, 0x7fff); - snd_soc_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); - snd_soc_write(codec, AC97_POWERDOWN, 0x6f00); - snd_soc_write(codec, AC97_POWERDOWN, 0xffff); + snd_soc_component_write(component, AC97_EXTENDED_MSTATUS, 0xffff); + snd_soc_component_write(component, AC97_POWERDOWN, 0x6f00); + snd_soc_component_write(component, AC97_POWERDOWN, 0xffff); return 0; } -static int wm9713_soc_resume(struct snd_soc_codec *codec) +static int wm9713_soc_resume(struct snd_soc_component *component) { - struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); + struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); int ret; ret = snd_ac97_reset(wm9713->ac97, true, WM9713_VENDOR_ID, @@ -1191,24 +1191,24 @@ static int wm9713_soc_resume(struct snd_soc_codec *codec) if (ret < 0) return ret; - snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); + snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); /* do we need to re-start the PLL ? */ if (wm9713->pll_in) - wm9713_set_pll(codec, 0, wm9713->pll_in, 0); + wm9713_set_pll(component, 0, wm9713->pll_in, 0); /* only synchronise the codec if warm reset failed */ if (ret == 0) { - regcache_mark_dirty(codec->component.regmap); - snd_soc_cache_sync(codec); + regcache_mark_dirty(component->regmap); + snd_soc_component_cache_sync(component); } return ret; } -static int wm9713_soc_probe(struct snd_soc_codec *codec) +static int wm9713_soc_probe(struct snd_soc_component *component) { - struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); + struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); struct regmap *regmap = NULL; if (wm9713->mfd_pdata) { @@ -1216,54 +1216,54 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) regmap = wm9713->mfd_pdata->regmap; } else { #ifdef CONFIG_SND_SOC_AC97_BUS - wm9713->ac97 = snd_soc_new_ac97_codec(codec, WM9713_VENDOR_ID, + wm9713->ac97 = snd_soc_new_ac97_component(component, WM9713_VENDOR_ID, WM9713_VENDOR_ID_MASK); if (IS_ERR(wm9713->ac97)) return PTR_ERR(wm9713->ac97); regmap = regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config); if (IS_ERR(regmap)) { - snd_soc_free_ac97_codec(wm9713->ac97); + snd_soc_free_ac97_component(wm9713->ac97); return PTR_ERR(regmap); } #endif } - snd_soc_codec_init_regmap(codec, regmap); + snd_soc_component_init_regmap(component, regmap); /* unmute the adc - move to kcontrol */ - snd_soc_update_bits(codec, AC97_CD, 0x7fff, 0x0000); + snd_soc_component_update_bits(component, AC97_CD, 0x7fff, 0x0000); return 0; } -static int wm9713_soc_remove(struct snd_soc_codec *codec) +static void wm9713_soc_remove(struct snd_soc_component *component) { #ifdef CONFIG_SND_SOC_AC97_BUS - struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); + struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component); if (!wm9713->mfd_pdata) { - snd_soc_codec_exit_regmap(codec); - snd_soc_free_ac97_codec(wm9713->ac97); + snd_soc_component_exit_regmap(component); + snd_soc_free_ac97_component(wm9713->ac97); } #endif - return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm9713 = { - .probe = wm9713_soc_probe, - .remove = wm9713_soc_remove, - .suspend = wm9713_soc_suspend, - .resume = wm9713_soc_resume, - .set_bias_level = wm9713_set_bias_level, - - .component_driver = { - .controls = wm9713_snd_ac97_controls, - .num_controls = ARRAY_SIZE(wm9713_snd_ac97_controls), - .dapm_widgets = wm9713_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm9713_dapm_widgets), - .dapm_routes = wm9713_audio_map, - .num_dapm_routes = ARRAY_SIZE(wm9713_audio_map), - }, +static const struct snd_soc_component_driver soc_component_dev_wm9713 = { + .probe = wm9713_soc_probe, + .remove = wm9713_soc_remove, + .suspend = wm9713_soc_suspend, + .resume = wm9713_soc_resume, + .set_bias_level = wm9713_set_bias_level, + .controls = wm9713_snd_ac97_controls, + .num_controls = ARRAY_SIZE(wm9713_snd_ac97_controls), + .dapm_widgets = wm9713_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm9713_dapm_widgets), + .dapm_routes = wm9713_audio_map, + .num_dapm_routes = ARRAY_SIZE(wm9713_audio_map), + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int wm9713_probe(struct platform_device *pdev) @@ -1279,14 +1279,8 @@ static int wm9713_probe(struct platform_device *pdev) wm9713->mfd_pdata = dev_get_platdata(&pdev->dev); platform_set_drvdata(pdev, wm9713); - return snd_soc_register_codec(&pdev->dev, - &soc_codec_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai)); -} - -static int wm9713_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - return 0; + return devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai)); } static struct platform_driver wm9713_codec_driver = { @@ -1295,7 +1289,6 @@ static int wm9713_remove(struct platform_device *pdev) }, .probe = wm9713_probe, - .remove = wm9713_remove, }; module_platform_driver(wm9713_codec_driver);