From patchwork Mon Jan 29 03:10:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10188901 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 4CD68602C8 for ; Mon, 29 Jan 2018 03:17:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E22F286E3 for ; Mon, 29 Jan 2018 03:17:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32854286FC; Mon, 29 Jan 2018 03:17:16 +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 D8975286E3 for ; Mon, 29 Jan 2018 03:17:14 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 408A4267856; Mon, 29 Jan 2018 04:16:12 +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 A9E1E267B04; Mon, 29 Jan 2018 04:16:10 +0100 (CET) Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id 9B94926785A for ; Mon, 29 Jan 2018 04:10:13 +0100 (CET) Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 29 Jan 2018 12:10:12 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 2C53C6DCD0; Mon, 29 Jan 2018 12:10:12 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,429,1511794800"; d="scan'208";a="270908106" Received: from mail-sg2apc01lp0244.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.244]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Jan 2018 12:10:11 +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=3hSBBW51euegT+eJCU2czSv1KThcmJyi3kdYcLdzNIU=; b=gh8K0qI8HVfzdAnD9y3MLCMs75nNkzs4BY8iAnVKTBNuc3NSGdrwQE8Weh1Sv6KSJ9VG2Bwgzh2+2MMBwGAwWHoJ+8UtYL/S4iP2gWH4tj1IK8I1PE0zmGoJke4Gnj6cYAeE5n3VqW0mU173i7BlGTW8kCm3jd45dh9mrr3mFdg= 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 SG2PR0601MB1886.apcprd06.prod.outlook.com (2603:1096:3:9::19) 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:10:09 +0000 Message-ID: <87r2q92wg6.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:10:09 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OSXPR01CA0064.jpnprd01.prod.outlook.com (2603:1096:600:f::36) To SG2PR0601MB1886.apcprd06.prod.outlook.com (2603:1096:3:9::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 683cbb2d-737a-43b6-fce4-08d566c5ce56 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SG2PR0601MB1886; X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1886; 3:gPR8KEvw0maI8Z9zku2bDaxzuCDuB2IYGhZ9Qcd6K1Y1P389RSRQJSNbmlSA8FaV2/fu38LfZsEpXblTOKeTxD3J4Ubi/GoEspG7m+H0TWdhQe2NQ50oaxWGbVGkwUb5Bw7jxEFzlTCLaP0rXxADJfFeCZ3H6DDRX4rii58E0EkdNkKHsqAaGDt89lConoT7FVKWY/ZjMrZF2YANelc406Nso8DA2bu1BnYEUzcoJBnd1jcyfRw0dVYRPZnvwpVJ; 25:LpfTR2A9e1eysHAB839r7Hca5VAKdfrPDs9nwSe9tjw7lZRohCWf+u5ah8GOnTW0T2bbRw5F/+dXmrNkTBARoCoVRL8n8GqAmnoA1YoY+HJRk6Z097Xy+BARPqSPuohwTVyJtLiHDxrBG8uC9Ziz8tu5G89JyU/21J6nufMAyo1od+M6SgTg7et4ALdTeHdvlFwATp+AyEltxLUpf9+q+gP00oOZ7PC17MByEYafZ1s4FFYGAksqrgeg40Yn7eTU2Ej538w5Eo230q4kygA7UKgJl6oTprCEHewxGVnVhNTrI4QJwn2YfSSAaw5XDCy+H1LUVno2HNmzR2PBiE4zfA==; 31:6rWZeqVEhgDJ9zp+VgH4r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4yFWNuhrucEOg2yMXdXrFtS0mSKwwpZKd6JgcUZ7/ 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)(10201501046)(3002001)(6055026)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SG2PR0601MB1886; BCL:0; PCL:0; RULEID:; SRVR:SG2PR0601MB1886; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(39380400002)(346002)(39860400002)(396003)(366004)(189003)(199004)(7696005)(86362001)(59450400001)(68736007)(23726003)(16586007)(47776003)(316002)(5660300001)(97736004)(7736002)(3846002)(2950100002)(6116002)(6916009)(305945005)(69596002)(478600001)(58126008)(83506002)(50466002)(386003)(76176011)(52116002)(81166006)(105586002)(25786009)(106356001)(4326008)(53936002)(8676002)(6486002)(66066001)(26005)(16526019)(36756003)(53416004)(186003)(2906002)(81156014)(8936002)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR0601MB1886; 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; SG2PR0601MB1886; 23:EhZInScxbu5Jxu9eGD/AdS22e39J6YkvXi2eJsZ?= =?us-ascii?Q?dooI5SY+lo8PunyH0XJpr2C8C1xEO5WxyCcFHJgtxABFdFUoExs0pZSonbRe?= =?us-ascii?Q?nbJLeClEgDcgs71kjG2up2NYBGJflXJ84qf9fPdBuk+guMusBPS6kTmxBACx?= =?us-ascii?Q?7DWKPB19MlsYwaDgaP/toI8/OX1gM3NUFd7t6ngQNcmZ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XuSk9bf+QLRPScjjJ1bRn6Snn8nu49ESImT35YpNtHc8vuZy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1886; 20:26cMniH4uU5n9OP0bS84dwCzglQukunMILTwdpB2YzQ28+hs3zJgZz6MgolglVGqUa/UBoadi7EsM0OEFp5ucBKSmkzLFPdVjqsWtxQrFK2OVr8R8427ByfUNdgWUIhdfEbUjK29ThU0kquO9jU1dJrxoLdk05meOQUrTs9gP6o= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 03:10:09.5284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 683cbb2d-737a-43b6-fce4-08d566c5ce56 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR0601MB1886 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 044/186] ASoC: wm9090: 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/wm9090.c | 109 ++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 56 deletions(-) diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 5a13138..a9f1a03 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c @@ -143,23 +143,23 @@ static bool wm9090_readable(struct device *dev, unsigned int reg) } } -static void wait_for_dc_servo(struct snd_soc_codec *codec) +static void wait_for_dc_servo(struct snd_soc_component *component) { unsigned int reg; int count = 0; - dev_dbg(codec->dev, "Waiting for DC servo...\n"); + dev_dbg(component->dev, "Waiting for DC servo...\n"); do { count++; msleep(1); - reg = snd_soc_read(codec, WM9090_DC_SERVO_READBACK_0); - dev_dbg(codec->dev, "DC servo status: %x\n", reg); + reg = snd_soc_component_read32(component, WM9090_DC_SERVO_READBACK_0); + dev_dbg(component->dev, "DC servo status: %x\n", reg); } while ((reg & WM9090_DCS_CAL_COMPLETE_MASK) != WM9090_DCS_CAL_COMPLETE_MASK && count < 1000); if ((reg & WM9090_DCS_CAL_COMPLETE_MASK) != WM9090_DCS_CAL_COMPLETE_MASK) - dev_err(codec->dev, "Timed out waiting for DC Servo\n"); + dev_err(component->dev, "Timed out waiting for DC Servo\n"); } static const DECLARE_TLV_DB_RANGE(in_tlv, @@ -251,22 +251,22 @@ static const DECLARE_TLV_DB_RANGE(spkboost_tlv, static int hp_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); - unsigned int reg = snd_soc_read(codec, WM9090_ANALOGUE_HP_0); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + unsigned int reg = snd_soc_component_read32(component, WM9090_ANALOGUE_HP_0); switch (event) { case SND_SOC_DAPM_POST_PMU: - snd_soc_update_bits(codec, WM9090_CHARGE_PUMP_1, + snd_soc_component_update_bits(component, WM9090_CHARGE_PUMP_1, WM9090_CP_ENA, WM9090_CP_ENA); msleep(5); - snd_soc_update_bits(codec, WM9090_POWER_MANAGEMENT_1, + snd_soc_component_update_bits(component, WM9090_POWER_MANAGEMENT_1, WM9090_HPOUT1L_ENA | WM9090_HPOUT1R_ENA, WM9090_HPOUT1L_ENA | WM9090_HPOUT1R_ENA); reg |= WM9090_HPOUT1L_DLY | WM9090_HPOUT1R_DLY; - snd_soc_write(codec, WM9090_ANALOGUE_HP_0, reg); + snd_soc_component_write(component, WM9090_ANALOGUE_HP_0, reg); /* Start the DC servo. We don't currently use the * ability to save the state since we don't have full @@ -274,16 +274,16 @@ static int hp_ev(struct snd_soc_dapm_widget *w, * DC offsets; see the WM8904 driver for an example of * doing so. */ - snd_soc_write(codec, WM9090_DC_SERVO_0, + snd_soc_component_write(component, WM9090_DC_SERVO_0, WM9090_DCS_ENA_CHAN_0 | WM9090_DCS_ENA_CHAN_1 | WM9090_DCS_TRIG_STARTUP_1 | WM9090_DCS_TRIG_STARTUP_0); - wait_for_dc_servo(codec); + wait_for_dc_servo(component); reg |= WM9090_HPOUT1R_OUTP | WM9090_HPOUT1R_RMV_SHORT | WM9090_HPOUT1L_OUTP | WM9090_HPOUT1L_RMV_SHORT; - snd_soc_write(codec, WM9090_ANALOGUE_HP_0, reg); + snd_soc_component_write(component, WM9090_ANALOGUE_HP_0, reg); break; case SND_SOC_DAPM_PRE_PMD: @@ -294,15 +294,15 @@ static int hp_ev(struct snd_soc_dapm_widget *w, WM9090_HPOUT1R_DLY | WM9090_HPOUT1R_OUTP); - snd_soc_write(codec, WM9090_ANALOGUE_HP_0, reg); + snd_soc_component_write(component, WM9090_ANALOGUE_HP_0, reg); - snd_soc_write(codec, WM9090_DC_SERVO_0, 0); + snd_soc_component_write(component, WM9090_DC_SERVO_0, 0); - snd_soc_update_bits(codec, WM9090_POWER_MANAGEMENT_1, + snd_soc_component_update_bits(component, WM9090_POWER_MANAGEMENT_1, WM9090_HPOUT1L_ENA | WM9090_HPOUT1R_ENA, 0); - snd_soc_update_bits(codec, WM9090_CHARGE_PUMP_1, + snd_soc_component_update_bits(component, WM9090_CHARGE_PUMP_1, WM9090_CP_ENA, 0); break; } @@ -419,10 +419,10 @@ static int hp_ev(struct snd_soc_dapm_widget *w, { "IN2A PGA", NULL, "IN2-" }, }; -static int wm9090_add_controls(struct snd_soc_codec *codec) +static int wm9090_add_controls(struct snd_soc_component *component) { - struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct wm9090_priv *wm9090 = snd_soc_component_get_drvdata(component); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); int i; snd_soc_dapm_new_controls(dapm, wm9090_dapm_widgets, @@ -430,7 +430,7 @@ static int wm9090_add_controls(struct snd_soc_codec *codec) snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - snd_soc_add_codec_controls(codec, wm9090_controls, + snd_soc_add_component_controls(component, wm9090_controls, ARRAY_SIZE(wm9090_controls)); if (wm9090->pdata.lin1_diff) { @@ -439,7 +439,7 @@ static int wm9090_add_controls(struct snd_soc_codec *codec) } else { snd_soc_dapm_add_routes(dapm, audio_map_in1_se, ARRAY_SIZE(audio_map_in1_se)); - snd_soc_add_codec_controls(codec, wm9090_in1_se_controls, + snd_soc_add_component_controls(component, wm9090_in1_se_controls, ARRAY_SIZE(wm9090_in1_se_controls)); } @@ -449,18 +449,18 @@ static int wm9090_add_controls(struct snd_soc_codec *codec) } else { snd_soc_dapm_add_routes(dapm, audio_map_in2_se, ARRAY_SIZE(audio_map_in2_se)); - snd_soc_add_codec_controls(codec, wm9090_in2_se_controls, + snd_soc_add_component_controls(component, wm9090_in2_se_controls, ARRAY_SIZE(wm9090_in2_se_controls)); } if (wm9090->pdata.agc_ena) { for (i = 0; i < ARRAY_SIZE(wm9090->pdata.agc); i++) - snd_soc_write(codec, WM9090_AGC_CONTROL_0 + i, + snd_soc_component_write(component, WM9090_AGC_CONTROL_0 + i, wm9090->pdata.agc[i]); - snd_soc_update_bits(codec, WM9090_POWER_MANAGEMENT_3, + snd_soc_component_update_bits(component, WM9090_POWER_MANAGEMENT_3, WM9090_AGC_ENA, WM9090_AGC_ENA); } else { - snd_soc_update_bits(codec, WM9090_POWER_MANAGEMENT_3, + snd_soc_component_update_bits(component, WM9090_POWER_MANAGEMENT_3, WM9090_AGC_ENA, 0); } @@ -472,19 +472,19 @@ static int wm9090_add_controls(struct snd_soc_codec *codec) * The machine driver should call this from their set_bias_level; if there * isn't one then this can just be set as the set_bias_level function. */ -static int wm9090_set_bias_level(struct snd_soc_codec *codec, +static int wm9090_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); + struct wm9090_priv *wm9090 = snd_soc_component_get_drvdata(component); switch (level) { case SND_SOC_BIAS_ON: break; case SND_SOC_BIAS_PREPARE: - snd_soc_update_bits(codec, WM9090_ANTIPOP2, WM9090_VMID_ENA, + snd_soc_component_update_bits(component, WM9090_ANTIPOP2, WM9090_VMID_ENA, WM9090_VMID_ENA); - snd_soc_update_bits(codec, WM9090_POWER_MANAGEMENT_1, + snd_soc_component_update_bits(component, WM9090_POWER_MANAGEMENT_1, WM9090_BIAS_ENA | WM9090_VMID_RES_MASK, WM9090_BIAS_ENA | @@ -493,7 +493,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { /* Restore the register cache */ regcache_sync(wm9090->regmap); } @@ -502,9 +502,9 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, * ground referenced outputs and class D speaker mean that * latency is not an issue. */ - snd_soc_update_bits(codec, WM9090_POWER_MANAGEMENT_1, + snd_soc_component_update_bits(component, WM9090_POWER_MANAGEMENT_1, WM9090_BIAS_ENA | WM9090_VMID_RES_MASK, 0); - snd_soc_update_bits(codec, WM9090_ANTIPOP2, + snd_soc_component_update_bits(component, WM9090_ANTIPOP2, WM9090_VMID_ENA, 0); break; @@ -515,45 +515,49 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int wm9090_probe(struct snd_soc_codec *codec) +static int wm9090_probe(struct snd_soc_component *component) { /* Configure some defaults; they will be written out when we * bring the bias up. */ - snd_soc_update_bits(codec, WM9090_IN1_LINE_INPUT_A_VOLUME, + snd_soc_component_update_bits(component, WM9090_IN1_LINE_INPUT_A_VOLUME, WM9090_IN1_VU | WM9090_IN1A_ZC, WM9090_IN1_VU | WM9090_IN1A_ZC); - snd_soc_update_bits(codec, WM9090_IN1_LINE_INPUT_B_VOLUME, + snd_soc_component_update_bits(component, WM9090_IN1_LINE_INPUT_B_VOLUME, WM9090_IN1_VU | WM9090_IN1B_ZC, WM9090_IN1_VU | WM9090_IN1B_ZC); - snd_soc_update_bits(codec, WM9090_IN2_LINE_INPUT_A_VOLUME, + snd_soc_component_update_bits(component, WM9090_IN2_LINE_INPUT_A_VOLUME, WM9090_IN2_VU | WM9090_IN2A_ZC, WM9090_IN2_VU | WM9090_IN2A_ZC); - snd_soc_update_bits(codec, WM9090_IN2_LINE_INPUT_B_VOLUME, + snd_soc_component_update_bits(component, WM9090_IN2_LINE_INPUT_B_VOLUME, WM9090_IN2_VU | WM9090_IN2B_ZC, WM9090_IN2_VU | WM9090_IN2B_ZC); - snd_soc_update_bits(codec, WM9090_SPEAKER_VOLUME_LEFT, + snd_soc_component_update_bits(component, WM9090_SPEAKER_VOLUME_LEFT, WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC, WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC); - snd_soc_update_bits(codec, WM9090_LEFT_OUTPUT_VOLUME, + snd_soc_component_update_bits(component, WM9090_LEFT_OUTPUT_VOLUME, WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC, WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC); - snd_soc_update_bits(codec, WM9090_RIGHT_OUTPUT_VOLUME, + snd_soc_component_update_bits(component, WM9090_RIGHT_OUTPUT_VOLUME, WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC, WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC); - snd_soc_update_bits(codec, WM9090_CLOCKING_1, + snd_soc_component_update_bits(component, WM9090_CLOCKING_1, WM9090_TOCLK_ENA, WM9090_TOCLK_ENA); - wm9090_add_controls(codec); + wm9090_add_controls(component); return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm9090 = { - .probe = wm9090_probe, - .set_bias_level = wm9090_set_bias_level, - .suspend_bias_off = true, +static const struct snd_soc_component_driver soc_component_dev_wm9090 = { + .probe = wm9090_probe, + .set_bias_level = wm9090_set_bias_level, + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config wm9090_regmap = { @@ -607,8 +611,8 @@ static int wm9090_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm9090); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm9090, NULL, 0); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_wm9090, NULL, 0); if (ret != 0) { dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); return ret; @@ -617,12 +621,6 @@ static int wm9090_i2c_probe(struct i2c_client *i2c, return 0; } -static int wm9090_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_codec(&i2c->dev); - return 0; -} - static const struct i2c_device_id wm9090_id[] = { { "wm9090", 0 }, { "wm9093", 0 }, @@ -635,7 +633,6 @@ static int wm9090_i2c_remove(struct i2c_client *i2c) .name = "wm9090", }, .probe = wm9090_i2c_probe, - .remove = wm9090_i2c_remove, .id_table = wm9090_id, };