From patchwork Mon Jan 29 04:13:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10189095 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 7EBDA60375 for ; Mon, 29 Jan 2018 04:41:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B1C828792 for ; Mon, 29 Jan 2018 04:41:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 693B3287ED; Mon, 29 Jan 2018 04:41:03 +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 33F31287E7 for ; Mon, 29 Jan 2018 04:41:01 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id CF89D267BE4; Mon, 29 Jan 2018 05:26: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 5799D267BE4; Mon, 29 Jan 2018 05:26:29 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 786562678C0 for ; Mon, 29 Jan 2018 05:13:59 +0100 (CET) Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 29 Jan 2018 13:13:56 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 0495D70086; Mon, 29 Jan 2018 13:13:57 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,429,1511794800"; d="scan'208";a="269594828" Received: from mail-hk2apc01lp0216.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.216]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Jan 2018 13:13:56 +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=k7dRSgc+lbXOGJj7d9sqrrF/D75ITn7PNDghVYgtAqY=; b=NUm3C2jYrCqtA5W/6THzwVUiodOutcbrEogw3541y6Y2nIk2XQCKRgfx9DqHXP5tSve4uehte8F2A3afUVynz1knXoXoGWPGrnMrtAEYGSxX/6IG5HWTMKYg6ZSMI767uQWI0zd6dg3f64X7ZGJsH+UcD/D4wXlyY78cP+J9m24= 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 SG2PR0601MB1887.apcprd06.prod.outlook.com (2603:1096:3:9::20) 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 04:13:54 +0000 Message-ID: <87372pz4k5.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 04:13:54 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: KAWPR01CA0069.jpnprd01.prod.outlook.com (2603:1096:402:b::29) To SG2PR0601MB1887.apcprd06.prod.outlook.com (2603:1096:3:9::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 885c0ae4-195e-4c0f-6464-08d566ceb620 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SG2PR0601MB1887; X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1887; 3:ngbgQnz9L4avvkHmfmIgTwkRExDU0ShpMal+2/P/3YmZypsGSQY71+2aoFMYL3YsKPca/+Cr9iGytyu3x/SCAcd6u5Xv3im9pi2yPb25FUVTDvVQduC7XPcFrFFLuK1+LrNOxErXFdzZmCbs8kCsUMUxgz3SydUlidFow2M79gMpzBJ0UrNwbQaY4sCX3Z6ADo0YCBsf/5mC7V3b8VbiS8UfTyjbvE7L+tI9o5ueNGPHpnt7kJovKsFo5mw4OSxl; 25:17iDf94lH+IFF8EeQVbzO/8CDhDmvXU1TQV+LM0bFiIvRzEVL/LZiUaXdDxWsc+1Kzabo33fOMiPUXPPhlLECF7gZgnCnsQdaJWg++4k+66S2j+96G4NVhLrQzpE0w/j/fB/ms3ObtUtmbPeHMQ2Opy1sNXx80MjWuYdw7iI6lVufqrcWh03D4z3Ip6Tksa4UHH3iixfKBDp7w0OpJfNEwZcid2j3ofsY6NHWk+hDv9LbMYJaNkF4JLWX6hClpk0Inlz1U6a1o2WzIdvLuwIe84Wd9aogpxMNmE010nuFF/xtZHMu8GQ/MdmIjIyCDyPDfaoAsDYkVBpV8YlpEShbg==; 31:10DPii8Vf56LjJURjHwbq3sclF/qxOr7Oa4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Hn99NbTQga7U1hTMMIIHQEAYV70y X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(944501161)(93006095)(93001095)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:SG2PR0601MB1887; BCL:0; PCL:0; RULEID:; SRVR:SG2PR0601MB1887; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(39380400002)(366004)(346002)(396003)(189003)(199004)(105586002)(36756003)(97736004)(69596002)(58126008)(50466002)(83506002)(6116002)(23726003)(3846002)(316002)(86362001)(575784001)(305945005)(7736002)(16586007)(106356001)(2906002)(59450400001)(76176011)(52116002)(68736007)(478600001)(25786009)(81156014)(81166006)(8676002)(386003)(6486002)(16526019)(26005)(8936002)(47776003)(2950100002)(6916009)(186003)(5660300001)(53416004)(53936002)(7696005)(66066001)(4326008)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR0601MB1887; 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; SG2PR0601MB1887; 23:MpK7OJp4cdX+A7/otwJVkTu1F+Rdj+trlbVTwq3?= =?us-ascii?Q?DRWExskLKncfxO04T3Tuk5AIM16W8/NH3T3tE/JpT56gUIGR7uZElkxiC4aK?= =?us-ascii?Q?qpvK03utfhR2M87EqA1zPt8Edhv8fpGeruv1+krSMHu6AhXSJqYpiCHiuEql?= =?us-ascii?Q?Ip6eB8PvIDDlUIn4EOlUuL91iwidJXXfjHADw6uSTmB47EIg2bP3W3uzu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08U/FJ01zjsFqZhT5FBEUT0B SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SG2PR0601MB1887; 20:+djveADd5szjjctuCZHPjlbhLEsw/M2w7PpRQ/UJc1H2bttTECrnZUHJNa+kTLLTW/R969I9K1j4Fyd4VscJ3s45F9acZk7DHiqutIQhj1sMTZB8QfZAefErDooYJlBQIwt/J3Kc9dIIiLMWn+zEHphWw8KMQ9+E2CAvFC4a3J0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 04:13:54.4071 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 885c0ae4-195e-4c0f-6464-08d566ceb620 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR0601MB1887 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 110/186] ASoC: tlv320aic3x: 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 = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/tlv320aic3x.c | 293 ++++++++++++++++++++--------------------- 1 file changed, 145 insertions(+), 148 deletions(-) diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index b751cad..dbfa0d8 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -72,7 +72,7 @@ struct aic3x_disable_nb { /* codec private data */ struct aic3x_priv { - struct snd_soc_codec *codec; + struct snd_soc_component *component; struct regmap *regmap; struct regulator_bulk_data supplies[AIC3X_NUM_SUPPLIES]; struct aic3x_disable_nb disable_nb[AIC3X_NUM_SUPPLIES]; @@ -162,8 +162,8 @@ static bool aic3x_volatile_reg(struct device *dev, unsigned int reg) static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; unsigned int reg = mc->reg; @@ -189,7 +189,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, mask <<= shift; val <<= shift; - change = snd_soc_test_bits(codec, reg, mask, val); + change = snd_soc_component_test_bits(component, reg, mask, val); if (change) { update.kcontrol = kcontrol; update.reg = reg; @@ -215,19 +215,19 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, static int mic_bias_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); - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); switch (event) { case SND_SOC_DAPM_POST_PMU: /* change mic bias voltage to user defined */ - snd_soc_update_bits(codec, MICBIAS_CTRL, + snd_soc_component_update_bits(component, MICBIAS_CTRL, MICBIAS_LEVEL_MASK, aic3x->micbias_vg << MICBIAS_LEVEL_SHIFT); break; case SND_SOC_DAPM_PRE_PMD: - snd_soc_update_bits(codec, MICBIAS_CTRL, + snd_soc_component_update_bits(component, MICBIAS_CTRL, MICBIAS_LEVEL_MASK, 0); break; } @@ -993,10 +993,10 @@ static SOC_ENUM_SINGLE_DECL(aic3x_rampup_step_enum, HPOUT_POP_REDUCTION, 2, {"SPOM", NULL, "Right Class-D Out"}, }; -static int aic3x_add_widgets(struct snd_soc_codec *codec) +static int aic3x_add_widgets(struct snd_soc_component *component) { - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); switch (aic3x->model) { case AIC3X_MODEL_3X: @@ -1035,8 +1035,8 @@ static int aic3x_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 aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; u8 data, j, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; u16 d, pll_d = 1; @@ -1047,7 +1047,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, width = params_width(params); /* select data word length */ - data = snd_soc_read(codec, AIC3X_ASD_INTF_CTRLB) & (~(0x3 << 4)); + data = snd_soc_component_read32(component, AIC3X_ASD_INTF_CTRLB) & (~(0x3 << 4)); switch (width) { case 16: break; @@ -1061,7 +1061,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, data |= (0x03 << 4); break; } - snd_soc_write(codec, AIC3X_ASD_INTF_CTRLB, data); + snd_soc_component_write(component, AIC3X_ASD_INTF_CTRLB, data); /* Fsref can be 44100 or 48000 */ fsref = (params_rate(params) % 11025 == 0) ? 44100 : 48000; @@ -1076,15 +1076,15 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, if (bypass_pll) { pll_q &= 0xf; - snd_soc_write(codec, AIC3X_PLL_PROGA_REG, pll_q << PLLQ_SHIFT); - snd_soc_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_CLKDIV); + snd_soc_component_write(component, AIC3X_PLL_PROGA_REG, pll_q << PLLQ_SHIFT); + snd_soc_component_write(component, AIC3X_GPIOB_REG, CODEC_CLKIN_CLKDIV); /* disable PLL if it is bypassed */ - snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLL_ENABLE, 0); + snd_soc_component_update_bits(component, AIC3X_PLL_PROGA_REG, PLL_ENABLE, 0); } else { - snd_soc_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_PLLDIV); + snd_soc_component_write(component, AIC3X_GPIOB_REG, CODEC_CLKIN_PLLDIV); /* enable PLL when it is used */ - snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, + snd_soc_component_update_bits(component, AIC3X_PLL_PROGA_REG, PLL_ENABLE, PLL_ENABLE); } @@ -1094,7 +1094,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, data |= (fsref == 44100) ? FSREF_44100 : FSREF_48000; if (params_rate(params) >= 64000) data |= DUAL_RATE_MODE; - snd_soc_write(codec, AIC3X_CODEC_DATAPATH_REG, data); + snd_soc_component_write(component, AIC3X_CODEC_DATAPATH_REG, data); /* codec sample rate select */ data = (fsref * 20) / params_rate(params); @@ -1103,7 +1103,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, data /= 5; data -= 2; data |= (data << 4); - snd_soc_write(codec, AIC3X_SAMPLE_RATE_SEL_REG, data); + snd_soc_component_write(component, AIC3X_SAMPLE_RATE_SEL_REG, data); if (bypass_pll) return 0; @@ -1172,13 +1172,13 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, } found: - snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLLP_MASK, pll_p); - snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG, + snd_soc_component_update_bits(component, AIC3X_PLL_PROGA_REG, PLLP_MASK, pll_p); + snd_soc_component_write(component, AIC3X_OVRF_STATUS_AND_PLLR_REG, pll_r << PLLR_SHIFT); - snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT); - snd_soc_write(codec, AIC3X_PLL_PROGC_REG, + snd_soc_component_write(component, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT); + snd_soc_component_write(component, AIC3X_PLL_PROGC_REG, (pll_d >> 6) << PLLD_MSB_SHIFT); - snd_soc_write(codec, AIC3X_PLL_PROGD_REG, + snd_soc_component_write(component, AIC3X_PLL_PROGD_REG, (pll_d & 0x3F) << PLLD_LSB_SHIFT); return 0; @@ -1187,8 +1187,8 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, static int aic3x_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); int delay = 0; int width = aic3x->slot_width; @@ -1202,23 +1202,23 @@ static int aic3x_prepare(struct snd_pcm_substream *substream, delay += aic3x->tdm_delay*width; /* Configure data delay */ - snd_soc_write(codec, AIC3X_ASD_INTF_CTRLC, delay); + snd_soc_component_write(component, AIC3X_ASD_INTF_CTRLC, delay); return 0; } static int aic3x_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - u8 ldac_reg = snd_soc_read(codec, LDAC_VOL) & ~MUTE_ON; - u8 rdac_reg = snd_soc_read(codec, RDAC_VOL) & ~MUTE_ON; + struct snd_soc_component *component = dai->component; + u8 ldac_reg = snd_soc_component_read32(component, LDAC_VOL) & ~MUTE_ON; + u8 rdac_reg = snd_soc_component_read32(component, RDAC_VOL) & ~MUTE_ON; if (mute) { - snd_soc_write(codec, LDAC_VOL, ldac_reg | MUTE_ON); - snd_soc_write(codec, RDAC_VOL, rdac_reg | MUTE_ON); + snd_soc_component_write(component, LDAC_VOL, ldac_reg | MUTE_ON); + snd_soc_component_write(component, RDAC_VOL, rdac_reg | MUTE_ON); } else { - snd_soc_write(codec, LDAC_VOL, ldac_reg); - snd_soc_write(codec, RDAC_VOL, rdac_reg); + snd_soc_component_write(component, LDAC_VOL, ldac_reg); + snd_soc_component_write(component, RDAC_VOL, rdac_reg); } return 0; @@ -1227,13 +1227,13 @@ static int aic3x_mute(struct snd_soc_dai *dai, int mute) static int aic3x_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = codec_dai->codec; - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); /* set clock on MCLK or GPIO2 or BCLK */ - snd_soc_update_bits(codec, AIC3X_CLKGEN_CTRL_REG, PLLCLK_IN_MASK, + snd_soc_component_update_bits(component, AIC3X_CLKGEN_CTRL_REG, PLLCLK_IN_MASK, clk_id << PLLCLK_IN_SHIFT); - snd_soc_update_bits(codec, AIC3X_CLKGEN_CTRL_REG, CLKDIV_IN_MASK, + snd_soc_component_update_bits(component, AIC3X_CLKGEN_CTRL_REG, CLKDIV_IN_MASK, clk_id << CLKDIV_IN_SHIFT); aic3x->sysclk = freq; @@ -1243,12 +1243,12 @@ static int aic3x_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); u8 iface_areg, iface_breg; - iface_areg = snd_soc_read(codec, AIC3X_ASD_INTF_CTRLA) & 0x3f; - iface_breg = snd_soc_read(codec, AIC3X_ASD_INTF_CTRLB) & 0x3f; + iface_areg = snd_soc_component_read32(component, AIC3X_ASD_INTF_CTRLA) & 0x3f; + iface_breg = snd_soc_component_read32(component, AIC3X_ASD_INTF_CTRLB) & 0x3f; /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -1289,8 +1289,8 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai, aic3x->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK; /* set iface */ - snd_soc_write(codec, AIC3X_ASD_INTF_CTRLA, iface_areg); - snd_soc_write(codec, AIC3X_ASD_INTF_CTRLB, iface_breg); + snd_soc_component_write(component, AIC3X_ASD_INTF_CTRLA, iface_areg); + snd_soc_component_write(component, AIC3X_ASD_INTF_CTRLB, iface_breg); return 0; } @@ -1299,24 +1299,24 @@ static int aic3x_set_dai_tdm_slot(struct snd_soc_dai *codec_dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) { - struct snd_soc_codec *codec = codec_dai->codec; - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); unsigned int lsb; if (tx_mask != rx_mask) { - dev_err(codec->dev, "tx and rx masks must be symmetric\n"); + dev_err(component->dev, "tx and rx masks must be symmetric\n"); return -EINVAL; } if (unlikely(!tx_mask)) { - dev_err(codec->dev, "tx and rx masks need to be non 0\n"); + dev_err(component->dev, "tx and rx masks need to be non 0\n"); return -EINVAL; } /* TDM based on DSP mode requires slots to be adjacent */ lsb = __ffs(tx_mask); if ((lsb + 1) != __fls(tx_mask)) { - dev_err(codec->dev, "Invalid mask, slots must be adjacent\n"); + dev_err(component->dev, "Invalid mask, slots must be adjacent\n"); return -EINVAL; } @@ -1327,7 +1327,7 @@ static int aic3x_set_dai_tdm_slot(struct snd_soc_dai *codec_dai, case 32: break; default: - dev_err(codec->dev, "Unsupported slot width %d\n", slot_width); + dev_err(component->dev, "Unsupported slot width %d\n", slot_width); return -EINVAL; } @@ -1336,7 +1336,7 @@ static int aic3x_set_dai_tdm_slot(struct snd_soc_dai *codec_dai, aic3x->slot_width = slot_width; /* DOUT in high-impedance on inactive bit clocks */ - snd_soc_update_bits(codec, AIC3X_ASD_INTF_CTRLA, + snd_soc_component_update_bits(component, AIC3X_ASD_INTF_CTRLA, DOUT_TRISTATE, DOUT_TRISTATE); return 0; @@ -1362,9 +1362,9 @@ static int aic3x_regulator_event(struct notifier_block *nb, return 0; } -static int aic3x_set_power(struct snd_soc_codec *codec, int power) +static int aic3x_set_power(struct snd_soc_component *component, int power) { - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); unsigned int pll_c, pll_d; int ret; @@ -1388,12 +1388,12 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power) * writing one of them and thus caused other one also not * being written */ - pll_c = snd_soc_read(codec, AIC3X_PLL_PROGC_REG); - pll_d = snd_soc_read(codec, AIC3X_PLL_PROGD_REG); + pll_c = snd_soc_component_read32(component, AIC3X_PLL_PROGC_REG); + pll_d = snd_soc_component_read32(component, AIC3X_PLL_PROGD_REG); if (pll_c == aic3x_reg[AIC3X_PLL_PROGC_REG].def || pll_d == aic3x_reg[AIC3X_PLL_PROGD_REG].def) { - snd_soc_write(codec, AIC3X_PLL_PROGC_REG, pll_c); - snd_soc_write(codec, AIC3X_PLL_PROGD_REG, pll_d); + snd_soc_component_write(component, AIC3X_PLL_PROGC_REG, pll_c); + snd_soc_component_write(component, AIC3X_PLL_PROGD_REG, pll_d); } /* @@ -1407,7 +1407,7 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power) * possible VDD leakage currents in case the supply regulators * remain on */ - snd_soc_write(codec, AIC3X_RESET, SOFT_RESET); + snd_soc_component_write(component, AIC3X_RESET, SOFT_RESET); regcache_mark_dirty(aic3x->regmap); aic3x->power = 0; /* HW writes are needless when bias is off */ @@ -1419,35 +1419,35 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power) return ret; } -static int aic3x_set_bias_level(struct snd_soc_codec *codec, +static int aic3x_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); switch (level) { case SND_SOC_BIAS_ON: break; case SND_SOC_BIAS_PREPARE: - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY && + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY && aic3x->master) { /* enable pll */ - snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, + snd_soc_component_update_bits(component, AIC3X_PLL_PROGA_REG, PLL_ENABLE, PLL_ENABLE); } break; case SND_SOC_BIAS_STANDBY: if (!aic3x->power) - aic3x_set_power(codec, 1); - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE && + aic3x_set_power(component, 1); + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_PREPARE && aic3x->master) { /* disable pll */ - snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, + snd_soc_component_update_bits(component, AIC3X_PLL_PROGA_REG, PLL_ENABLE, 0); } break; case SND_SOC_BIAS_OFF: if (aic3x->power) - aic3x_set_power(codec, 0); + aic3x_set_power(component, 0); break; } @@ -1486,96 +1486,96 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec, .symmetric_rates = 1, }; -static void aic3x_mono_init(struct snd_soc_codec *codec) +static void aic3x_mono_init(struct snd_soc_component *component) { /* DAC to Mono Line Out default volume and route to Output mixer */ - snd_soc_write(codec, DACL1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON); - snd_soc_write(codec, DACR1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON); + snd_soc_component_write(component, DACL1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON); + snd_soc_component_write(component, DACR1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON); /* unmute all outputs */ - snd_soc_update_bits(codec, MONOLOPM_CTRL, UNMUTE, UNMUTE); + snd_soc_component_update_bits(component, MONOLOPM_CTRL, UNMUTE, UNMUTE); /* PGA to Mono Line Out default volume, disconnect from Output Mixer */ - snd_soc_write(codec, PGAL_2_MONOLOPM_VOL, DEFAULT_VOL); - snd_soc_write(codec, PGAR_2_MONOLOPM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, PGAL_2_MONOLOPM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, PGAR_2_MONOLOPM_VOL, DEFAULT_VOL); /* Line2 to Mono Out default volume, disconnect from Output Mixer */ - snd_soc_write(codec, LINE2L_2_MONOLOPM_VOL, DEFAULT_VOL); - snd_soc_write(codec, LINE2R_2_MONOLOPM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, LINE2L_2_MONOLOPM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, LINE2R_2_MONOLOPM_VOL, DEFAULT_VOL); } /* * initialise the AIC3X driver * register the mixer and dsp interfaces with the kernel */ -static int aic3x_init(struct snd_soc_codec *codec) +static int aic3x_init(struct snd_soc_component *component) { - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); - snd_soc_write(codec, AIC3X_PAGE_SELECT, PAGE0_SELECT); - snd_soc_write(codec, AIC3X_RESET, SOFT_RESET); + snd_soc_component_write(component, AIC3X_PAGE_SELECT, PAGE0_SELECT); + snd_soc_component_write(component, AIC3X_RESET, SOFT_RESET); /* DAC default volume and mute */ - snd_soc_write(codec, LDAC_VOL, DEFAULT_VOL | MUTE_ON); - snd_soc_write(codec, RDAC_VOL, DEFAULT_VOL | MUTE_ON); + snd_soc_component_write(component, LDAC_VOL, DEFAULT_VOL | MUTE_ON); + snd_soc_component_write(component, RDAC_VOL, DEFAULT_VOL | MUTE_ON); /* DAC to HP default volume and route to Output mixer */ - snd_soc_write(codec, DACL1_2_HPLOUT_VOL, DEFAULT_VOL | ROUTE_ON); - snd_soc_write(codec, DACR1_2_HPROUT_VOL, DEFAULT_VOL | ROUTE_ON); - snd_soc_write(codec, DACL1_2_HPLCOM_VOL, DEFAULT_VOL | ROUTE_ON); - snd_soc_write(codec, DACR1_2_HPRCOM_VOL, DEFAULT_VOL | ROUTE_ON); + snd_soc_component_write(component, DACL1_2_HPLOUT_VOL, DEFAULT_VOL | ROUTE_ON); + snd_soc_component_write(component, DACR1_2_HPROUT_VOL, DEFAULT_VOL | ROUTE_ON); + snd_soc_component_write(component, DACL1_2_HPLCOM_VOL, DEFAULT_VOL | ROUTE_ON); + snd_soc_component_write(component, DACR1_2_HPRCOM_VOL, DEFAULT_VOL | ROUTE_ON); /* DAC to Line Out default volume and route to Output mixer */ - snd_soc_write(codec, DACL1_2_LLOPM_VOL, DEFAULT_VOL | ROUTE_ON); - snd_soc_write(codec, DACR1_2_RLOPM_VOL, DEFAULT_VOL | ROUTE_ON); + snd_soc_component_write(component, DACL1_2_LLOPM_VOL, DEFAULT_VOL | ROUTE_ON); + snd_soc_component_write(component, DACR1_2_RLOPM_VOL, DEFAULT_VOL | ROUTE_ON); /* unmute all outputs */ - snd_soc_update_bits(codec, LLOPM_CTRL, UNMUTE, UNMUTE); - snd_soc_update_bits(codec, RLOPM_CTRL, UNMUTE, UNMUTE); - snd_soc_update_bits(codec, HPLOUT_CTRL, UNMUTE, UNMUTE); - snd_soc_update_bits(codec, HPROUT_CTRL, UNMUTE, UNMUTE); - snd_soc_update_bits(codec, HPLCOM_CTRL, UNMUTE, UNMUTE); - snd_soc_update_bits(codec, HPRCOM_CTRL, UNMUTE, UNMUTE); + snd_soc_component_update_bits(component, LLOPM_CTRL, UNMUTE, UNMUTE); + snd_soc_component_update_bits(component, RLOPM_CTRL, UNMUTE, UNMUTE); + snd_soc_component_update_bits(component, HPLOUT_CTRL, UNMUTE, UNMUTE); + snd_soc_component_update_bits(component, HPROUT_CTRL, UNMUTE, UNMUTE); + snd_soc_component_update_bits(component, HPLCOM_CTRL, UNMUTE, UNMUTE); + snd_soc_component_update_bits(component, HPRCOM_CTRL, UNMUTE, UNMUTE); /* ADC default volume and unmute */ - snd_soc_write(codec, LADC_VOL, DEFAULT_GAIN); - snd_soc_write(codec, RADC_VOL, DEFAULT_GAIN); + snd_soc_component_write(component, LADC_VOL, DEFAULT_GAIN); + snd_soc_component_write(component, RADC_VOL, DEFAULT_GAIN); /* By default route Line1 to ADC PGA mixer */ - snd_soc_write(codec, LINE1L_2_LADC_CTRL, 0x0); - snd_soc_write(codec, LINE1R_2_RADC_CTRL, 0x0); + snd_soc_component_write(component, LINE1L_2_LADC_CTRL, 0x0); + snd_soc_component_write(component, LINE1R_2_RADC_CTRL, 0x0); /* PGA to HP Bypass default volume, disconnect from Output Mixer */ - snd_soc_write(codec, PGAL_2_HPLOUT_VOL, DEFAULT_VOL); - snd_soc_write(codec, PGAR_2_HPROUT_VOL, DEFAULT_VOL); - snd_soc_write(codec, PGAL_2_HPLCOM_VOL, DEFAULT_VOL); - snd_soc_write(codec, PGAR_2_HPRCOM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, PGAL_2_HPLOUT_VOL, DEFAULT_VOL); + snd_soc_component_write(component, PGAR_2_HPROUT_VOL, DEFAULT_VOL); + snd_soc_component_write(component, PGAL_2_HPLCOM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, PGAR_2_HPRCOM_VOL, DEFAULT_VOL); /* PGA to Line Out default volume, disconnect from Output Mixer */ - snd_soc_write(codec, PGAL_2_LLOPM_VOL, DEFAULT_VOL); - snd_soc_write(codec, PGAR_2_RLOPM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, PGAL_2_LLOPM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, PGAR_2_RLOPM_VOL, DEFAULT_VOL); /* On tlv320aic3104, these registers are reserved and must not be written */ if (aic3x->model != AIC3X_MODEL_3104) { /* Line2 to HP Bypass default volume, disconnect from Output Mixer */ - snd_soc_write(codec, LINE2L_2_HPLOUT_VOL, DEFAULT_VOL); - snd_soc_write(codec, LINE2R_2_HPROUT_VOL, DEFAULT_VOL); - snd_soc_write(codec, LINE2L_2_HPLCOM_VOL, DEFAULT_VOL); - snd_soc_write(codec, LINE2R_2_HPRCOM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, LINE2L_2_HPLOUT_VOL, DEFAULT_VOL); + snd_soc_component_write(component, LINE2R_2_HPROUT_VOL, DEFAULT_VOL); + snd_soc_component_write(component, LINE2L_2_HPLCOM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, LINE2R_2_HPRCOM_VOL, DEFAULT_VOL); /* Line2 Line Out default volume, disconnect from Output Mixer */ - snd_soc_write(codec, LINE2L_2_LLOPM_VOL, DEFAULT_VOL); - snd_soc_write(codec, LINE2R_2_RLOPM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, LINE2L_2_LLOPM_VOL, DEFAULT_VOL); + snd_soc_component_write(component, LINE2R_2_RLOPM_VOL, DEFAULT_VOL); } switch (aic3x->model) { case AIC3X_MODEL_3X: case AIC3X_MODEL_33: - aic3x_mono_init(codec); + aic3x_mono_init(component); break; case AIC3X_MODEL_3007: - snd_soc_write(codec, CLASSD_CTRL, 0); + snd_soc_component_write(component, CLASSD_CTRL, 0); break; } /* Output common-mode voltage = 1.5 V */ - snd_soc_update_bits(codec, HPOUT_SC, HPOUT_SC_OCMV_MASK, + snd_soc_component_update_bits(component, HPOUT_SC, HPOUT_SC_OCMV_MASK, aic3x->ocmv << HPOUT_SC_OCMV_SHIFT); return 0; @@ -1594,13 +1594,13 @@ static bool aic3x_is_shared_reset(struct aic3x_priv *aic3x) return false; } -static int aic3x_probe(struct snd_soc_codec *codec) +static int aic3x_probe(struct snd_soc_component *component) { - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); int ret, i; INIT_LIST_HEAD(&aic3x->list); - aic3x->codec = codec; + aic3x->component = component; for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) { aic3x->disable_nb[i].nb.notifier_call = aic3x_regulator_event; @@ -1608,7 +1608,7 @@ static int aic3x_probe(struct snd_soc_codec *codec) ret = regulator_register_notifier(aic3x->supplies[i].consumer, &aic3x->disable_nb[i].nb); if (ret) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to request regulator notifier: %d\n", ret); goto err_notif; @@ -1616,32 +1616,32 @@ static int aic3x_probe(struct snd_soc_codec *codec) } regcache_mark_dirty(aic3x->regmap); - aic3x_init(codec); + aic3x_init(component); if (aic3x->setup) { if (aic3x->model != AIC3X_MODEL_3104) { /* setup GPIO functions */ - snd_soc_write(codec, AIC3X_GPIO1_REG, + snd_soc_component_write(component, AIC3X_GPIO1_REG, (aic3x->setup->gpio_func[0] & 0xf) << 4); - snd_soc_write(codec, AIC3X_GPIO2_REG, + snd_soc_component_write(component, AIC3X_GPIO2_REG, (aic3x->setup->gpio_func[1] & 0xf) << 4); } else { - dev_warn(codec->dev, "GPIO functionality is not supported on tlv320aic3104\n"); + dev_warn(component->dev, "GPIO functionality is not supported on tlv320aic3104\n"); } } switch (aic3x->model) { case AIC3X_MODEL_3X: case AIC3X_MODEL_33: - snd_soc_add_codec_controls(codec, aic3x_extra_snd_controls, + snd_soc_add_component_controls(component, aic3x_extra_snd_controls, ARRAY_SIZE(aic3x_extra_snd_controls)); - snd_soc_add_codec_controls(codec, aic3x_mono_controls, + snd_soc_add_component_controls(component, aic3x_mono_controls, ARRAY_SIZE(aic3x_mono_controls)); break; case AIC3X_MODEL_3007: - snd_soc_add_codec_controls(codec, aic3x_extra_snd_controls, + snd_soc_add_component_controls(component, aic3x_extra_snd_controls, ARRAY_SIZE(aic3x_extra_snd_controls)); - snd_soc_add_codec_controls(codec, + snd_soc_add_component_controls(component, &aic3x_classd_amp_gain_ctrl, 1); break; case AIC3X_MODEL_3104: @@ -1653,7 +1653,7 @@ static int aic3x_probe(struct snd_soc_codec *codec) case AIC3X_MICBIAS_2_0V: case AIC3X_MICBIAS_2_5V: case AIC3X_MICBIAS_AVDDV: - snd_soc_update_bits(codec, MICBIAS_CTRL, + snd_soc_component_update_bits(component, MICBIAS_CTRL, MICBIAS_LEVEL_MASK, (aic3x->micbias_vg) << MICBIAS_LEVEL_SHIFT); break; @@ -1666,7 +1666,7 @@ static int aic3x_probe(struct snd_soc_codec *codec) break; } - aic3x_add_widgets(codec); + aic3x_add_widgets(component); return 0; @@ -1677,32 +1677,30 @@ static int aic3x_probe(struct snd_soc_codec *codec) return ret; } -static int aic3x_remove(struct snd_soc_codec *codec) +static void aic3x_remove(struct snd_soc_component *component) { - struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); int i; list_del(&aic3x->list); for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) regulator_unregister_notifier(aic3x->supplies[i].consumer, &aic3x->disable_nb[i].nb); - - return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_aic3x = { - .set_bias_level = aic3x_set_bias_level, - .idle_bias_off = true, - .probe = aic3x_probe, - .remove = aic3x_remove, - .component_driver = { - .controls = aic3x_snd_controls, - .num_controls = ARRAY_SIZE(aic3x_snd_controls), - .dapm_widgets = aic3x_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(aic3x_dapm_widgets), - .dapm_routes = intercon, - .num_dapm_routes = ARRAY_SIZE(intercon), - }, +static const struct snd_soc_component_driver soc_component_dev_aic3x = { + .set_bias_level = aic3x_set_bias_level, + .probe = aic3x_probe, + .remove = aic3x_remove, + .controls = aic3x_snd_controls, + .num_controls = ARRAY_SIZE(aic3x_snd_controls), + .dapm_widgets = aic3x_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(aic3x_dapm_widgets), + .dapm_routes = intercon, + .num_dapm_routes = ARRAY_SIZE(intercon), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static void aic3x_configure_ocmv(struct i2c_client *client) @@ -1876,8 +1874,8 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, ret); } - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_aic3x, &aic3x_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_aic3x, &aic3x_dai, 1); if (ret != 0) goto err_gpio; @@ -1898,7 +1896,6 @@ static int aic3x_i2c_remove(struct i2c_client *client) { struct aic3x_priv *aic3x = i2c_get_clientdata(client); - snd_soc_unregister_codec(&client->dev); if (gpio_is_valid(aic3x->gpio_reset) && !aic3x_is_shared_reset(aic3x)) { gpio_set_value(aic3x->gpio_reset, 0);