From patchwork Fri Jan 12 01:41:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10159395 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 5C515601A1 for ; Fri, 12 Jan 2018 02:37:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4343228709 for ; Fri, 12 Jan 2018 02:37:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 377FE28848; Fri, 12 Jan 2018 02:37:53 +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 7CF9E28709 for ; Fri, 12 Jan 2018 02:37:51 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C6F2526826C; Fri, 12 Jan 2018 03:37:02 +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 BAA2A268266; Fri, 12 Jan 2018 03:36:59 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 88292267DB1 for ; Fri, 12 Jan 2018 02:41:20 +0100 (CET) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 12 Jan 2018 10:41:18 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 0CC626DEA7; Fri, 12 Jan 2018 10:41:19 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,346,1511794800"; d="scan'208";a="269310956" Received: from mail-hk2apc01lp0213.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.213]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 12 Jan 2018 10:41:18 +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=ZM2eTs3y0lw3A7l1VcMPhksaNfvc9XgCkmR1vm6o+0A=; b=RGpQONWa+f3xEryTLzLb1e8jUsj9I+0SE8bZ5g6+ct1kuH/8HYGNSxQNE+4QNkPBcZXuP61c3u5njVvmDAcobyYOtP9spYxyZOtkMtU8ChDg6dSQb7JsaSko0Ftjj1vZt07O2w2TsNDBSVxJZvMoJezGLbFqNDDLo2K4GGUsMF0= 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:41:15 +0000 Message-ID: <87shbb7t3c.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:41:15 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: TY1PR01CA0188.jpnprd01.prod.outlook.com (2603:1096:403::18) To PS1PR0601MB1882.apcprd06.prod.outlook.com (2603:1096:803:8::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6ad92ee-8ecc-4e01-7153-08d5595d91ee 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:nWma7313nr+dF5ykHTaWvn5K9R2Q48QFQ8FZodL+MiUGxC2YH88sTFoYw7IK+I+vjjfl6B8nSTS+0U1CqZzSq2fipLR5kAXHbrsP70H1JLXmsaHgVw1VzcyoUSRfU7+QRWK37RU7HBJ90ciMTaD8qJg1KLpANyMLXQConYFyrm7wDwD4wbvQwkiY9l4hrq8t3TbUPQIrdVFBVqVh41OeeJWwS2JUPxD66EJpacA86tcdHqVMO1rp4RoS1x8LIOjj; 25:kJ6TuKj+jA6Fln+BO7N3Xfl2x9AVB3Twiv32b2cviGZFjh7n10vKLKjQa6iyXCi0nSINl8JWAk487oXz2X9kUo8+bKjXI3pNfOjcBqvNFRd5jRFOGhy8kXFuhfdFW8RLLcj1h5sHX4vCVDI2qelOP/RUbE+IlIIP7yxSH9fVlj6HMVT91+lYmmmg23kvSTVEwgnKIqIEK/z+WuPjLa6PotHYw5dpkpXG27wwbHUlSAeVojSjHhZb4s00sbcpcu3pEp7hVikeyQy8XvUfvuSUDDh8vfBGcbhZ97r5ZTUGtQey95aHi0ZanppRydS7CTRy5AMVmd3GBjEGSRStB3ERKg==; 31:Nav7pnsA9Xz4VRfPZ6ejGuXGn+giH18kt+kLo7OXDcu1jTr43f3iJfoB50rtEpoxhdR9WEDSd9cvJEzq4wHIHuRoOkl8ljNBrZ6Nl+ExriIYmAKkKQQUqKZVal4NOrwP8y73FXJ9ZWIgyySOfd2X42WfU5e29PUa+Gt35hJBeRry2eymP5+3dBNjjrP/wgcXyvJjhfA0GT38R70KahH1WKmHyqkLKS2AU8D2SZUmr18= X-MS-TrafficTypeDiagnostic: PS1PR0601MB1882: X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1882; 20:glsu6mtJ1zROTxa/GZuNukyT5gIgYs/A8kKRgMehTazkAwseK+tq42keG5WIyMOR/837gyEGDIItKHxrdgvQW7TObRUADpxsRpjocD+BFOqPKvvuEwdgrMw2336O2uXZvhF7PQGeaMymaH1QmbLG1bk6e4F9XordoFnvwPagvTc6Q4hg15VTaOQUL0Jzgj5RwlgVq3YI6Z58g00Nhts8LbyK7S+H3LpCgK88DN1/u5GYyRt3an9O4doiOBEtym4fnPbXZSpWdLSA3NJCKNq1QzB7brtx5o7AYZoG2ja+jr4TAVliWI3Bv8LigTDdTLsn0hYvREZRzxqs4rLTL5qB72XUukjzHndYWHp+0A2jSJvNSTbrcFzoik02tOgvAT4wc7TAKMcan6eULW9iw/VPkwcVCBOV5VwxrHR3NPiUXy7i9VMWQcaWf+ltfIbDow7Zq2eeaVyZnEy5DBII4SsiUSPJuRRuFElHu2rj5CpjmHdAqhWQ+RhfFVNwzHRwCayA; 4:8B60NmXL8rnIwbqmJBj/TDfxXkQPj5OcSZVdOLCc8B8kzqgLGSD9WEZ0Az32bgXux026ssNVUTdL/H7N+srb240EwnfvFOypt/cmctHh591t+4hbnGKA4bH/wCYFU1hfMzXcprobBT7YGk2iarRMEtCVy+3He+/jxQZKwky5aPJSZtIQa5aUiQ+ptdaAJr9VnU1vzQrkO2PMl6F1mLTokplC/alr7G3pAwDoCN2hMpOS6sfZW0/KmYB0dNTx0x2PTVsQ1bTHP16FppArzfG4dWQyfI+RLnTCLIQiOoZxl3Llxy9i8CKv6r9UF/2NQSdD 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)(396003)(346002)(366004)(39380400002)(376002)(39860400002)(199004)(189003)(68736007)(97736004)(86362001)(8936002)(50466002)(81166006)(8676002)(81156014)(305945005)(7736002)(23726003)(3846002)(36756003)(6116002)(2906002)(69596002)(53416004)(386003)(59450400001)(16526018)(53936002)(105586002)(76176011)(52116002)(54906003)(478600001)(7696005)(83506002)(58126008)(2950100002)(6916009)(16586007)(66066001)(25786009)(316002)(6486002)(4326008)(47776003)(106356001)(5660300001)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1882; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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:g2r4pNdMvsRp/BVpZQgfY9noQzg1XKJya71yYQB?= =?us-ascii?Q?kdWz4EcMMXfBsHCEACWkxMvi3M5BML4E9bH5x4nUygNo5QvconKW9ugfQD1p?= =?us-ascii?Q?elG56WPUiubnwPUnUpHFh18mGKu9o6tBvI/6a86+48CA/zLdkd/Hpa6YJiWc?= =?us-ascii?Q?zfZxnEI4l/VyYymGRWfuqHtoQVtidAQUgVFEadAgBUrczxghPCS4E4ranytE?= =?us-ascii?Q?RBZdQM9TYSwhpUC7L47gAY5J9EaTse/WuyBiqVt38Drqgu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; PS1PR0601MB1882; 20:ilT99TktZ6gQhqVEIaCrmVjTyWxEN1jN4iph3pgo+4hgrSfL+UytmyuI7CqWxihX2pTHOZHk0/MSBV9oYNe8BMueO8FIUlTIiXbosf9BW+nKSRcPo7K8tJl/rJVYjfTGt7cU70lQjgucLCGC0yLr4GaW8msVeJx7i8634gpihx8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 01:41:15.4977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6ad92ee-8ecc-4e01-7153-08d5595d91ee 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 113/187] ASoC: tlv320aic31xx: 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/tlv320aic31xx.c | 240 +++++++++++++++++++-------------------- 1 file changed, 116 insertions(+), 124 deletions(-) diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 858cb8b..66ae7bc 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -153,7 +153,7 @@ struct aic31xx_disable_nb { }; struct aic31xx_priv { - struct snd_soc_codec *codec; + struct snd_soc_component *component; u8 i2c_regs_status; struct device *dev; struct regmap *regmap; @@ -348,8 +348,8 @@ static int aic31xx_wait_bits(struct aic31xx_priv *aic31xx, unsigned int reg, static int aic31xx_dapm_power_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 aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); unsigned int reg = AIC31XX_DACFLAG1; unsigned int mask; @@ -377,7 +377,7 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w, reg = AIC31XX_ADCFLAG; break; default: - dev_err(codec->dev, "Unknown widget '%s' calling %s\n", + dev_err(component->dev, "Unknown widget '%s' calling %s\n", w->name, __func__); return -EINVAL; } @@ -388,7 +388,7 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_POST_PMD: return aic31xx_wait_bits(aic31xx, reg, mask, 0, 5000, 100); default: - dev_dbg(codec->dev, + dev_dbg(component->dev, "Unhandled dapm widget event %d from %s\n", event, w->name); } @@ -444,23 +444,23 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w, 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 aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct aic31xx_priv *aic31xx = 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, AIC31XX_MICBIAS, + snd_soc_component_update_bits(component, AIC31XX_MICBIAS, AIC31XX_MICBIAS_MASK, aic31xx->micbias_vg << AIC31XX_MICBIAS_SHIFT); - dev_dbg(codec->dev, "%s: turned on\n", __func__); + dev_dbg(component->dev, "%s: turned on\n", __func__); break; case SND_SOC_DAPM_PRE_PMD: /* turn mic bias off */ - snd_soc_update_bits(codec, AIC31XX_MICBIAS, + snd_soc_component_update_bits(component, AIC31XX_MICBIAS, AIC31XX_MICBIAS_MASK, 0); - dev_dbg(codec->dev, "%s: turned off\n", __func__); + dev_dbg(component->dev, "%s: turned off\n", __func__); break; } return 0; @@ -670,34 +670,34 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, {"SPK", NULL, "SPK ClassD"}, }; -static int aic31xx_add_controls(struct snd_soc_codec *codec) +static int aic31xx_add_controls(struct snd_soc_component *component) { int ret = 0; - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); if (!(aic31xx->codec_type & DAC31XX_BIT)) - ret = snd_soc_add_codec_controls( - codec, aic31xx_snd_controls, + ret = snd_soc_add_component_controls( + component, aic31xx_snd_controls, ARRAY_SIZE(aic31xx_snd_controls)); if (ret) return ret; if (aic31xx->codec_type & AIC31XX_STEREO_CLASS_D_BIT) - ret = snd_soc_add_codec_controls( - codec, aic311x_snd_controls, + ret = snd_soc_add_component_controls( + component, aic311x_snd_controls, ARRAY_SIZE(aic311x_snd_controls)); else - ret = snd_soc_add_codec_controls( - codec, aic310x_snd_controls, + ret = snd_soc_add_component_controls( + component, aic310x_snd_controls, ARRAY_SIZE(aic310x_snd_controls)); return ret; } -static int aic31xx_add_widgets(struct snd_soc_codec *codec) +static int aic31xx_add_widgets(struct snd_soc_component *component) { - struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); int ret = 0; if (aic31xx->codec_type & DAC31XX_BIT) { @@ -751,10 +751,10 @@ static int aic31xx_add_widgets(struct snd_soc_codec *codec) return 0; } -static int aic31xx_setup_pll(struct snd_soc_codec *codec, +static int aic31xx_setup_pll(struct snd_soc_component *component, struct snd_pcm_hw_params *params) { - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); int bclk_score = snd_soc_params_to_frame_size(params); int mclk_p; int bclk_n = 0; @@ -762,15 +762,15 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, int i; if (!aic31xx->sysclk || !aic31xx->p_div) { - dev_err(codec->dev, "Master clock not supplied\n"); + dev_err(component->dev, "Master clock not supplied\n"); return -EINVAL; } mclk_p = aic31xx->sysclk / aic31xx->p_div; /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */ - snd_soc_update_bits(codec, AIC31XX_CLKMUX, + snd_soc_component_update_bits(component, AIC31XX_CLKMUX, AIC31XX_CODEC_CLKIN_MASK, AIC31XX_CODEC_CLKIN_PLL); - snd_soc_update_bits(codec, AIC31XX_IFACE2, + snd_soc_component_update_bits(component, AIC31XX_IFACE2, AIC31XX_BDIVCLK_MASK, AIC31XX_DAC2BCLK); for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) { @@ -789,14 +789,14 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, } if (match == -1) { - dev_err(codec->dev, + dev_err(component->dev, "%s: Sample rate (%u) and format not supported\n", __func__, params_rate(params)); /* See bellow for details how fix this. */ return -EINVAL; } if (bclk_score != 0) { - dev_warn(codec->dev, "Can not produce exact bitclock"); + dev_warn(component->dev, "Can not produce exact bitclock"); /* This is fine if using dsp format, but if using i2s there may be trouble. To fix the issue edit the aic31xx_divs table for your mclk and sample @@ -808,39 +808,39 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, i = match; /* PLL configuration */ - snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK, + snd_soc_component_update_bits(component, AIC31XX_PLLPR, AIC31XX_PLL_MASK, (aic31xx->p_div << 4) | 0x01); - snd_soc_write(codec, AIC31XX_PLLJ, aic31xx_divs[i].pll_j); + snd_soc_component_write(component, AIC31XX_PLLJ, aic31xx_divs[i].pll_j); - snd_soc_write(codec, AIC31XX_PLLDMSB, + snd_soc_component_write(component, AIC31XX_PLLDMSB, aic31xx_divs[i].pll_d >> 8); - snd_soc_write(codec, AIC31XX_PLLDLSB, + snd_soc_component_write(component, AIC31XX_PLLDLSB, aic31xx_divs[i].pll_d & 0xff); /* DAC dividers configuration */ - snd_soc_update_bits(codec, AIC31XX_NDAC, AIC31XX_PLL_MASK, + snd_soc_component_update_bits(component, AIC31XX_NDAC, AIC31XX_PLL_MASK, aic31xx_divs[i].ndac); - snd_soc_update_bits(codec, AIC31XX_MDAC, AIC31XX_PLL_MASK, + snd_soc_component_update_bits(component, AIC31XX_MDAC, AIC31XX_PLL_MASK, aic31xx_divs[i].mdac); - snd_soc_write(codec, AIC31XX_DOSRMSB, aic31xx_divs[i].dosr >> 8); - snd_soc_write(codec, AIC31XX_DOSRLSB, aic31xx_divs[i].dosr & 0xff); + snd_soc_component_write(component, AIC31XX_DOSRMSB, aic31xx_divs[i].dosr >> 8); + snd_soc_component_write(component, AIC31XX_DOSRLSB, aic31xx_divs[i].dosr & 0xff); /* ADC dividers configuration. Write reset value 1 if not used. */ - snd_soc_update_bits(codec, AIC31XX_NADC, AIC31XX_PLL_MASK, + snd_soc_component_update_bits(component, AIC31XX_NADC, AIC31XX_PLL_MASK, aic31xx_divs[i].nadc ? aic31xx_divs[i].nadc : 1); - snd_soc_update_bits(codec, AIC31XX_MADC, AIC31XX_PLL_MASK, + snd_soc_component_update_bits(component, AIC31XX_MADC, AIC31XX_PLL_MASK, aic31xx_divs[i].madc ? aic31xx_divs[i].madc : 1); - snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr); + snd_soc_component_write(component, AIC31XX_AOSR, aic31xx_divs[i].aosr); /* Bit clock divider configuration. */ - snd_soc_update_bits(codec, AIC31XX_BCLKN, + snd_soc_component_update_bits(component, AIC31XX_BCLKN, AIC31XX_PLL_MASK, bclk_n); aic31xx->rate_div_line = i; - dev_dbg(codec->dev, + dev_dbg(component->dev, "pll %d.%04d/%d dosr %d n %d m %d aosr %d n %d m %d bclk_n %d\n", aic31xx_divs[i].pll_j, aic31xx_divs[i].pll_d, @@ -861,10 +861,10 @@ static int aic31xx_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; u8 data = 0; - dev_dbg(codec->dev, "## %s: width %d rate %d\n", + dev_dbg(component->dev, "## %s: width %d rate %d\n", __func__, params_width(params), params_rate(params)); @@ -884,28 +884,28 @@ static int aic31xx_hw_params(struct snd_pcm_substream *substream, AIC31XX_IFACE1_DATALEN_SHIFT); break; default: - dev_err(codec->dev, "%s: Unsupported width %d\n", + dev_err(component->dev, "%s: Unsupported width %d\n", __func__, params_width(params)); return -EINVAL; } - snd_soc_update_bits(codec, AIC31XX_IFACE1, + snd_soc_component_update_bits(component, AIC31XX_IFACE1, AIC31XX_IFACE1_DATALEN_MASK, data); - return aic31xx_setup_pll(codec, params); + return aic31xx_setup_pll(component, params); } static int aic31xx_dac_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; if (mute) { - snd_soc_update_bits(codec, AIC31XX_DACMUTE, + snd_soc_component_update_bits(component, AIC31XX_DACMUTE, AIC31XX_DACMUTE_MASK, AIC31XX_DACMUTE_MASK); } else { - snd_soc_update_bits(codec, AIC31XX_DACMUTE, + snd_soc_component_update_bits(component, AIC31XX_DACMUTE, AIC31XX_DACMUTE_MASK, 0x0); } @@ -915,12 +915,12 @@ static int aic31xx_dac_mute(struct snd_soc_dai *codec_dai, int mute) static int aic31xx_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; u8 iface_reg1 = 0; u8 iface_reg2 = 0; u8 dsp_a_val = 0; - dev_dbg(codec->dev, "## %s: fmt = 0x%x\n", __func__, fmt); + dev_dbg(component->dev, "## %s: fmt = 0x%x\n", __func__, fmt); /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -936,7 +936,7 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai, case SND_SOC_DAIFMT_CBS_CFS: break; default: - dev_err(codec->dev, "Invalid DAI master/slave interface\n"); + dev_err(component->dev, "Invalid DAI master/slave interface\n"); return -EINVAL; } @@ -948,7 +948,7 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai, iface_reg2 |= AIC31XX_BCLKINV_MASK; break; default: - dev_err(codec->dev, "Invalid DAI clock signal polarity\n"); + dev_err(component->dev, "Invalid DAI clock signal polarity\n"); return -EINVAL; } @@ -977,18 +977,18 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai, AIC31XX_IFACE1_DATATYPE_SHIFT); break; default: - dev_err(codec->dev, "Invalid DAI interface format\n"); + dev_err(component->dev, "Invalid DAI interface format\n"); return -EINVAL; } - snd_soc_update_bits(codec, AIC31XX_IFACE1, + snd_soc_component_update_bits(component, AIC31XX_IFACE1, AIC31XX_IFACE1_DATATYPE_MASK | AIC31XX_IFACE1_MASTER_MASK, iface_reg1); - snd_soc_update_bits(codec, AIC31XX_DATA_OFFSET, + snd_soc_component_update_bits(component, AIC31XX_DATA_OFFSET, AIC31XX_DATA_OFFSET_MASK, dsp_a_val); - snd_soc_update_bits(codec, AIC31XX_IFACE2, + snd_soc_component_update_bits(component, AIC31XX_IFACE2, AIC31XX_BCLKINV_MASK, iface_reg2); @@ -998,11 +998,11 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai, static int aic31xx_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 aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); int i; - dev_dbg(codec->dev, "## %s: clk_id = %d, freq = %d, dir = %d\n", + dev_dbg(component->dev, "## %s: clk_id = %d, freq = %d, dir = %d\n", __func__, clk_id, freq, dir); for (i = 1; i < 8; i++) @@ -1025,7 +1025,7 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai, } /* set clock on MCLK, BCLK, or GPIO1 as PLL input */ - snd_soc_update_bits(codec, AIC31XX_CLKMUX, AIC31XX_PLL_CLKIN_MASK, + snd_soc_component_update_bits(component, AIC31XX_CLKMUX, AIC31XX_PLL_CLKIN_MASK, clk_id << AIC31XX_PLL_CLKIN_SHIFT); aic31xx->sysclk = freq; @@ -1071,42 +1071,42 @@ static int aic31xx_reset(struct aic31xx_priv *aic31xx) return ret; } -static void aic31xx_clk_on(struct snd_soc_codec *codec) +static void aic31xx_clk_on(struct snd_soc_component *component) { - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); u8 mask = AIC31XX_PM_MASK; u8 on = AIC31XX_PM_MASK; - dev_dbg(codec->dev, "codec clock -> on (rate %d)\n", + dev_dbg(component->dev, "codec clock -> on (rate %d)\n", aic31xx_divs[aic31xx->rate_div_line].rate); - snd_soc_update_bits(codec, AIC31XX_PLLPR, mask, on); + snd_soc_component_update_bits(component, AIC31XX_PLLPR, mask, on); mdelay(10); - snd_soc_update_bits(codec, AIC31XX_NDAC, mask, on); - snd_soc_update_bits(codec, AIC31XX_MDAC, mask, on); + snd_soc_component_update_bits(component, AIC31XX_NDAC, mask, on); + snd_soc_component_update_bits(component, AIC31XX_MDAC, mask, on); if (aic31xx_divs[aic31xx->rate_div_line].nadc) - snd_soc_update_bits(codec, AIC31XX_NADC, mask, on); + snd_soc_component_update_bits(component, AIC31XX_NADC, mask, on); if (aic31xx_divs[aic31xx->rate_div_line].madc) - snd_soc_update_bits(codec, AIC31XX_MADC, mask, on); - snd_soc_update_bits(codec, AIC31XX_BCLKN, mask, on); + snd_soc_component_update_bits(component, AIC31XX_MADC, mask, on); + snd_soc_component_update_bits(component, AIC31XX_BCLKN, mask, on); } -static void aic31xx_clk_off(struct snd_soc_codec *codec) +static void aic31xx_clk_off(struct snd_soc_component *component) { u8 mask = AIC31XX_PM_MASK; u8 off = 0; - dev_dbg(codec->dev, "codec clock -> off\n"); - snd_soc_update_bits(codec, AIC31XX_BCLKN, mask, off); - snd_soc_update_bits(codec, AIC31XX_MADC, mask, off); - snd_soc_update_bits(codec, AIC31XX_NADC, mask, off); - snd_soc_update_bits(codec, AIC31XX_MDAC, mask, off); - snd_soc_update_bits(codec, AIC31XX_NDAC, mask, off); - snd_soc_update_bits(codec, AIC31XX_PLLPR, mask, off); + dev_dbg(component->dev, "codec clock -> off\n"); + snd_soc_component_update_bits(component, AIC31XX_BCLKN, mask, off); + snd_soc_component_update_bits(component, AIC31XX_MADC, mask, off); + snd_soc_component_update_bits(component, AIC31XX_NADC, mask, off); + snd_soc_component_update_bits(component, AIC31XX_MDAC, mask, off); + snd_soc_component_update_bits(component, AIC31XX_NDAC, mask, off); + snd_soc_component_update_bits(component, AIC31XX_PLLPR, mask, off); } -static int aic31xx_power_on(struct snd_soc_codec *codec) +static int aic31xx_power_on(struct snd_soc_component *component) { - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); int ret; ret = regulator_bulk_enable(ARRAY_SIZE(aic31xx->supplies), @@ -1123,7 +1123,7 @@ static int aic31xx_power_on(struct snd_soc_codec *codec) ret = regcache_sync(aic31xx->regmap); if (ret) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to restore cache: %d\n", ret); regcache_cache_only(aic31xx->regmap, true); regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies), @@ -1134,57 +1134,57 @@ static int aic31xx_power_on(struct snd_soc_codec *codec) return 0; } -static void aic31xx_power_off(struct snd_soc_codec *codec) +static void aic31xx_power_off(struct snd_soc_component *component) { - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); regcache_cache_only(aic31xx->regmap, true); regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies), aic31xx->supplies); } -static int aic31xx_set_bias_level(struct snd_soc_codec *codec, +static int aic31xx_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - dev_dbg(codec->dev, "## %s: %d -> %d\n", __func__, - snd_soc_codec_get_bias_level(codec), level); + dev_dbg(component->dev, "## %s: %d -> %d\n", __func__, + snd_soc_component_get_bias_level(component), level); 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) - aic31xx_clk_on(codec); + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) + aic31xx_clk_on(component); break; case SND_SOC_BIAS_STANDBY: - switch (snd_soc_codec_get_bias_level(codec)) { + switch (snd_soc_component_get_bias_level(component)) { case SND_SOC_BIAS_OFF: - aic31xx_power_on(codec); + aic31xx_power_on(component); break; case SND_SOC_BIAS_PREPARE: - aic31xx_clk_off(codec); + aic31xx_clk_off(component); break; default: BUG(); } break; case SND_SOC_BIAS_OFF: - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) - aic31xx_power_off(codec); + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) + aic31xx_power_off(component); break; } return 0; } -static int aic31xx_codec_probe(struct snd_soc_codec *codec) +static int aic31xx_codec_probe(struct snd_soc_component *component) { - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); int i, ret; dev_dbg(aic31xx->dev, "## %s\n", __func__); - aic31xx->codec = codec; + aic31xx->component = component; for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) { aic31xx->disable_nb[i].nb.notifier_call = @@ -1193,7 +1193,7 @@ static int aic31xx_codec_probe(struct snd_soc_codec *codec) ret = regulator_register_notifier(aic31xx->supplies[i].consumer, &aic31xx->disable_nb[i].nb); if (ret) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to request regulator notifier: %d\n", ret); return ret; @@ -1203,43 +1203,42 @@ static int aic31xx_codec_probe(struct snd_soc_codec *codec) regcache_cache_only(aic31xx->regmap, true); regcache_mark_dirty(aic31xx->regmap); - ret = aic31xx_add_controls(codec); + ret = aic31xx_add_controls(component); if (ret) return ret; - ret = aic31xx_add_widgets(codec); + ret = aic31xx_add_widgets(component); if (ret) return ret; return 0; } -static int aic31xx_codec_remove(struct snd_soc_codec *codec) +static void aic31xx_codec_remove(struct snd_soc_component *component) { - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); + struct aic31xx_priv *aic31xx = snd_soc_component_get_drvdata(component); int i; for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) regulator_unregister_notifier(aic31xx->supplies[i].consumer, &aic31xx->disable_nb[i].nb); - - return 0; } -static const struct snd_soc_codec_driver soc_codec_driver_aic31xx = { +static const struct snd_soc_component_driver soc_codec_driver_aic31xx = { .probe = aic31xx_codec_probe, .remove = aic31xx_codec_remove, .set_bias_level = aic31xx_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = common31xx_snd_controls, - .num_controls = ARRAY_SIZE(common31xx_snd_controls), - .dapm_widgets = common31xx_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(common31xx_dapm_widgets), - .dapm_routes = common31xx_audio_map, - .num_dapm_routes = ARRAY_SIZE(common31xx_audio_map), - }, + .controls = common31xx_snd_controls, + .num_controls = ARRAY_SIZE(common31xx_snd_controls), + .dapm_widgets = common31xx_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(common31xx_dapm_widgets), + .dapm_routes = common31xx_audio_map, + .num_dapm_routes = ARRAY_SIZE(common31xx_audio_map), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct snd_soc_dai_ops aic31xx_dai_ops = { @@ -1375,23 +1374,17 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c, } if (aic31xx->codec_type & DAC31XX_BIT) - return snd_soc_register_codec(&i2c->dev, + return devm_snd_soc_register_component(&i2c->dev, &soc_codec_driver_aic31xx, dac31xx_dai_driver, ARRAY_SIZE(dac31xx_dai_driver)); else - return snd_soc_register_codec(&i2c->dev, + return devm_snd_soc_register_component(&i2c->dev, &soc_codec_driver_aic31xx, aic31xx_dai_driver, ARRAY_SIZE(aic31xx_dai_driver)); } -static int aic31xx_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_codec(&i2c->dev); - return 0; -} - static const struct i2c_device_id aic31xx_i2c_id[] = { { "tlv320aic310x", AIC3100 }, { "tlv320aic311x", AIC3110 }, @@ -1412,7 +1405,6 @@ static int aic31xx_i2c_remove(struct i2c_client *i2c) .acpi_match_table = ACPI_PTR(aic31xx_acpi_match), }, .probe = aic31xx_i2c_probe, - .remove = aic31xx_i2c_remove, .id_table = aic31xx_i2c_id, }; module_i2c_driver(aic31xx_i2c_driver);