From patchwork Mon Jan 29 02:59:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10188821 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 D327D60375 for ; Mon, 29 Jan 2018 03:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1ADD28683 for ; Mon, 29 Jan 2018 03:01:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B651828685; Mon, 29 Jan 2018 03:01:59 +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 1567D28683 for ; Mon, 29 Jan 2018 03:01:58 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 61BAF2673CE; Mon, 29 Jan 2018 04:00:07 +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 B8D7C2676FB; Mon, 29 Jan 2018 04:00:05 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 44EF42673CE for ; Mon, 29 Jan 2018 03:59:53 +0100 (CET) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 29 Jan 2018 11:59:52 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id A96956711E; Mon, 29 Jan 2018 11:59:52 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,429,1511794800"; d="scan'208";a="269586776" Received: from mail-hk2apc01lp0213.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.213]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 29 Jan 2018 11:59:52 +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=LEXtdRVAluHC5DR9eRX3VNvBMIfaO22Sjy61cqf4UYs=; b=GS9vZJH5mLrpwZNxNDdJdlYQl5JiwKLevGoI7rYuu3K7zvabgPB+xK1XAH7ghkF2hy59IJl/z4wJjmAM7MJZc3E1JZ+lZNEvL41JUqN8wLz6xjGhfajI0Vp+e0fHpp9k+5Jwe546Mh6HHLif9JXN7UmhKnCbzjrUDOWDqGl46JM= 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 KL1PR0601MB1879.apcprd06.prod.outlook.com (2603:1096:802:8::15) 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 02:59:50 +0000 Message-ID: <878tch5q28.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 02:59:50 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OSBPR01CA0024.jpnprd01.prod.outlook.com (2603:1096:603::36) To KL1PR0601MB1879.apcprd06.prod.outlook.com (2603:1096:802:8::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 22e1bf89-b9d2-4490-2da0-08d566c45d3c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:KL1PR0601MB1879; X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1879; 3:+zO98GqGiyD59pTAqzVh2YGIB7U87H75SukJQFZ7irmgscIHKAA28LeJgOGASLB58qEafdTg3uZL3PykVTHmoW5KrMW/ijbcE9cGKyPbkelZ/tYA5FVo8kGAe6hdyYjOcmygWzHxs81+9V/TlwFyHmPmMpDpTsNWNuHfHZmg19ObLPidzSNFnONupZAjUvC6byIQxb91IKGznxt3PtIPZoapWyvKS7NdabDAGSFULv+rz+hXBwAPgh3fDJE1cxOF; 25:p0QorOfxyDc6bd+T3BG6MQ0T621PeU26pWCiUyEUMuLTRP06xO4/mN6F8aBykK4hCzGM2BYLLrBqsLe6kC2PH2h8ptrltsJCkgXVLwrYQqNXWFGg98lTaI1YJaemu5Q//f7d7lGfqlaljW8pIakYbwN8EuIaOyXmRl++WM6prtQty89mbxsTb6Sjqm1wFYrDybhKusjQ71clM4NMB2yafoU3mq9rnJJtOBiT+SiZxUQXf1PfHCC1OP438C1KSjXW34OoACqzkBWZqihKML/s6j6Qg5Ep4/UIyLfXtkdezogeFCmKhZCPtGlhSYWcF0rXoE9kxIzKuXSdkhmMgySL2w==; 31:FeGzrHy7DoPbCESmuqsXsEOfJCLFd0Mb/K5/M+IiojUF+NMcMTtd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CiGhG+omiSFotYNQv9/OT3IVNzXme6r/Wg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231101)(944501161)(3002001)(93006095)(93001095)(6055026)(6041288)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:KL1PR0601MB1879; BCL:0; PCL:0; RULEID:; SRVR:KL1PR0601MB1879; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(39380400002)(366004)(39860400002)(199004)(189003)(186003)(97736004)(50466002)(69596002)(386003)(59450400001)(26005)(76176011)(7696005)(105586002)(52116002)(53936002)(66066001)(47776003)(6486002)(16526019)(316002)(86362001)(16586007)(58126008)(68736007)(5660300001)(25786009)(4326008)(478600001)(106356001)(8676002)(83506002)(81166006)(2906002)(6116002)(2950100002)(3846002)(23726003)(36756003)(53416004)(81156014)(8936002)(6916009)(7736002)(305945005)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR0601MB1879; 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; KL1PR0601MB1879; 23:mAo+9HNbud4JQTrfvAYsXQ51NajfquA10mG7PPr?= =?us-ascii?Q?OY7FMiiqRgMkKLF1XISLCEHlGpzWHbyvrvNECopX9vJs43+W1eCinf5t77+U?= =?us-ascii?Q?VP1meGTkwFjd+txqEQi2xL8t7YfrisIKUMaTtm2QtxTPX6vZkn79BCDQR804?= =?us-ascii?Q?Yw9YB2DsPg5I+DvKDluYolF9Kcu9ejDJXrpkfB/LNhAxa3r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dvXHCq5krfrBcQRTsW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1879; 20:83iurHv0w7NQH6gOm6tJPGpDaTWnm66ulThaeiaUYnadw5fwT0HhaQZM4FHRA4I8oqu0WuU9Cfu9tQWnsH/Ct4RFtzt5YZ/C54jz+UQeW6TVqjMJWKono3L2aUsGnpVu/H/kBMw9Y+NWyCZOH0JM11k78ktKz99/P7yKYV3HlEA= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 02:59:50.2578 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22e1bf89-b9d2-4490-2da0-08d566c45d3c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB1879 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 007/186] ASoC: wm8350: 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/wm8350.c | 183 ++++++++++++++++++++++----------------------- sound/soc/codecs/wm8350.h | 4 +- sound/soc/fsl/wm1133-ev1.c | 6 +- 3 files changed, 93 insertions(+), 100 deletions(-) diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index fc79c67..e92ebe5 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -256,8 +256,8 @@ static void wm8350_pga_work(struct work_struct *work) static int pga_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 wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); struct wm8350_output *out; switch (w->shift) { @@ -299,8 +299,8 @@ static int pga_event(struct snd_soc_dapm_widget *w, static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wm8350_data *wm8350_priv = snd_soc_component_get_drvdata(component); struct wm8350_output *out = NULL; struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; @@ -334,16 +334,16 @@ static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol, return ret; /* now hit the volume update bits (always bit 8) */ - val = snd_soc_read(codec, reg); - snd_soc_write(codec, reg, val | WM8350_OUT1_VU); + val = snd_soc_component_read32(component, reg); + snd_soc_component_write(component, reg, val | WM8350_OUT1_VU); return 1; } static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct wm8350_data *wm8350_priv = snd_soc_component_get_drvdata(component); struct wm8350_output *out1 = &wm8350_priv->out1; struct wm8350_output *out2 = &wm8350_priv->out2; struct soc_mixer_control *mc = @@ -753,8 +753,8 @@ static const DECLARE_TLV_DB_RANGE(capture_sd_tlv, static int wm8350_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 wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = wm8350_data->wm8350; u16 fll_4; @@ -769,9 +769,9 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, case WM8350_MCLK_SEL_PLL_32K: wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_1, WM8350_MCLK_SEL); - fll_4 = snd_soc_read(codec, WM8350_FLL_CONTROL_4) & + fll_4 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_4) & ~WM8350_FLL_CLK_SRC_MASK; - snd_soc_write(codec, WM8350_FLL_CONTROL_4, fll_4 | clk_id); + snd_soc_component_write(component, WM8350_FLL_CONTROL_4, fll_4 | clk_id); break; } @@ -788,44 +788,44 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int wm8350_set_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; u16 val; switch (div_id) { case WM8350_ADC_CLKDIV: - val = snd_soc_read(codec, WM8350_ADC_DIVIDER) & + val = snd_soc_component_read32(component, WM8350_ADC_DIVIDER) & ~WM8350_ADC_CLKDIV_MASK; - snd_soc_write(codec, WM8350_ADC_DIVIDER, val | div); + snd_soc_component_write(component, WM8350_ADC_DIVIDER, val | div); break; case WM8350_DAC_CLKDIV: - val = snd_soc_read(codec, WM8350_DAC_CLOCK_CONTROL) & + val = snd_soc_component_read32(component, WM8350_DAC_CLOCK_CONTROL) & ~WM8350_DAC_CLKDIV_MASK; - snd_soc_write(codec, WM8350_DAC_CLOCK_CONTROL, val | div); + snd_soc_component_write(component, WM8350_DAC_CLOCK_CONTROL, val | div); break; case WM8350_BCLK_CLKDIV: - val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) & + val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) & ~WM8350_BCLK_DIV_MASK; - snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); + snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); break; case WM8350_OPCLK_CLKDIV: - val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) & + val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) & ~WM8350_OPCLK_DIV_MASK; - snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); + snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); break; case WM8350_SYS_CLKDIV: - val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) & + val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) & ~WM8350_MCLK_DIV_MASK; - snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); + snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); break; case WM8350_DACLR_CLKDIV: - val = snd_soc_read(codec, WM8350_DAC_LR_RATE) & + val = snd_soc_component_read32(component, WM8350_DAC_LR_RATE) & ~WM8350_DACLRC_RATE_MASK; - snd_soc_write(codec, WM8350_DAC_LR_RATE, val | div); + snd_soc_component_write(component, WM8350_DAC_LR_RATE, val | div); break; case WM8350_ADCLR_CLKDIV: - val = snd_soc_read(codec, WM8350_ADC_LR_RATE) & + val = snd_soc_component_read32(component, WM8350_ADC_LR_RATE) & ~WM8350_ADCLRC_RATE_MASK; - snd_soc_write(codec, WM8350_ADC_LR_RATE, val | div); + snd_soc_component_write(component, WM8350_ADC_LR_RATE, val | div); break; default: return -EINVAL; @@ -836,14 +836,14 @@ static int wm8350_set_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div) static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - u16 iface = snd_soc_read(codec, WM8350_AI_FORMATING) & + struct snd_soc_component *component = codec_dai->component; + u16 iface = snd_soc_component_read32(component, WM8350_AI_FORMATING) & ~(WM8350_AIF_BCLK_INV | WM8350_AIF_LRCLK_INV | WM8350_AIF_FMT_MASK); - u16 master = snd_soc_read(codec, WM8350_AI_DAC_CONTROL) & + u16 master = snd_soc_component_read32(component, WM8350_AI_DAC_CONTROL) & ~WM8350_BCLK_MSTR; - u16 dac_lrc = snd_soc_read(codec, WM8350_DAC_LR_RATE) & + u16 dac_lrc = snd_soc_component_read32(component, WM8350_DAC_LR_RATE) & ~WM8350_DACLRC_ENA; - u16 adc_lrc = snd_soc_read(codec, WM8350_ADC_LR_RATE) & + u16 adc_lrc = snd_soc_component_read32(component, WM8350_ADC_LR_RATE) & ~WM8350_ADCLRC_ENA; /* set master/slave audio interface */ @@ -896,10 +896,10 @@ static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) return -EINVAL; } - snd_soc_write(codec, WM8350_AI_FORMATING, iface); - snd_soc_write(codec, WM8350_AI_DAC_CONTROL, master); - snd_soc_write(codec, WM8350_DAC_LR_RATE, dac_lrc); - snd_soc_write(codec, WM8350_ADC_LR_RATE, adc_lrc); + snd_soc_component_write(component, WM8350_AI_FORMATING, iface); + snd_soc_component_write(component, WM8350_AI_DAC_CONTROL, master); + snd_soc_component_write(component, WM8350_DAC_LR_RATE, dac_lrc); + snd_soc_component_write(component, WM8350_ADC_LR_RATE, adc_lrc); return 0; } @@ -907,10 +907,10 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *codec_dai) { - struct snd_soc_codec *codec = codec_dai->codec; - struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = wm8350_data->wm8350; - u16 iface = snd_soc_read(codec, WM8350_AI_FORMATING) & + u16 iface = snd_soc_component_read32(component, WM8350_AI_FORMATING) & ~WM8350_AIF_WL_MASK; /* bit size */ @@ -928,7 +928,7 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream, break; } - snd_soc_write(codec, WM8350_AI_FORMATING, iface); + snd_soc_component_write(component, WM8350_AI_FORMATING, iface); /* The sloping stopband filter is recommended for use with * lower sample rates to improve performance. @@ -947,7 +947,7 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream, static int wm8350_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; unsigned int val; if (mute) @@ -955,7 +955,7 @@ static int wm8350_mute(struct snd_soc_dai *dai, int mute) else val = 0; - snd_soc_update_bits(codec, WM8350_DAC_MUTE, WM8350_DAC_MUTE_ENA, val); + snd_soc_component_update_bits(component, WM8350_DAC_MUTE, WM8350_DAC_MUTE_ENA, val); return 0; } @@ -1024,8 +1024,8 @@ static int wm8350_set_fll(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; - struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct wm8350_data *priv = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = priv->wm8350; struct _fll_div fll_div; int ret = 0; @@ -1050,17 +1050,17 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai, fll_div.ratio); /* set up N.K & dividers */ - fll_1 = snd_soc_read(codec, WM8350_FLL_CONTROL_1) & + fll_1 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_1) & ~(WM8350_FLL_OUTDIV_MASK | WM8350_FLL_RSP_RATE_MASK | 0xc000); - snd_soc_write(codec, WM8350_FLL_CONTROL_1, + snd_soc_component_write(component, WM8350_FLL_CONTROL_1, fll_1 | (fll_div.div << 8) | 0x50); - snd_soc_write(codec, WM8350_FLL_CONTROL_2, + snd_soc_component_write(component, WM8350_FLL_CONTROL_2, (fll_div.ratio << 11) | (fll_div. n & WM8350_FLL_N_MASK)); - snd_soc_write(codec, WM8350_FLL_CONTROL_3, fll_div.k); - fll_4 = snd_soc_read(codec, WM8350_FLL_CONTROL_4) & + snd_soc_component_write(component, WM8350_FLL_CONTROL_3, fll_div.k); + fll_4 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_4) & ~(WM8350_FLL_FRAC | WM8350_FLL_SLOW_LOCK_REF); - snd_soc_write(codec, WM8350_FLL_CONTROL_4, + snd_soc_component_write(component, WM8350_FLL_CONTROL_4, fll_4 | (fll_div.k ? WM8350_FLL_FRAC : 0) | (fll_div.ratio == 8 ? WM8350_FLL_SLOW_LOCK_REF : 0)); @@ -1074,10 +1074,10 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai, return 0; } -static int wm8350_set_bias_level(struct snd_soc_codec *codec, +static int wm8350_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); + struct wm8350_data *priv = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = priv->wm8350; struct wm8350_audio_platform_data *platform = wm8350->codec.platform_data; @@ -1101,7 +1101,7 @@ static int wm8350_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) { ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); if (ret != 0) @@ -1310,7 +1310,7 @@ static irqreturn_t wm8350_hpr_jack_handler(int irq, void *data) /** * wm8350_hp_jack_detect - Enable headphone jack detection. * - * @codec: WM8350 codec + * @component: WM8350 component * @which: left or right jack detect signal * @jack: jack to report detection events on * @report: value to report @@ -1318,10 +1318,10 @@ static irqreturn_t wm8350_hpr_jack_handler(int irq, void *data) * Enables the headphone jack detection of the WM8350. If no report * is specified then detection is disabled. */ -int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, +int wm8350_hp_jack_detect(struct snd_soc_component *component, enum wm8350_jack which, struct snd_soc_jack *jack, int report) { - struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); + struct wm8350_data *priv = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = priv->wm8350; int ena; @@ -1389,7 +1389,7 @@ static irqreturn_t wm8350_mic_handler(int irq, void *data) /** * wm8350_mic_jack_detect - Enable microphone jack detection. * - * @codec: WM8350 codec + * @component: WM8350 component * @jack: jack to report detection events on * @detect_report: value to report when presence detected * @short_report: value to report when microphone short detected @@ -1397,11 +1397,11 @@ static irqreturn_t wm8350_mic_handler(int irq, void *data) * Enables the microphone jack detection of the WM8350. If both reports * are specified as zero then detection is disabled. */ -int wm8350_mic_jack_detect(struct snd_soc_codec *codec, +int wm8350_mic_jack_detect(struct snd_soc_component *component, struct snd_soc_jack *jack, int detect_report, int short_report) { - struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); + struct wm8350_data *priv = snd_soc_component_get_drvdata(component); struct wm8350 *wm8350 = priv->wm8350; priv->mic.jack = jack; @@ -1455,26 +1455,26 @@ int wm8350_mic_jack_detect(struct snd_soc_codec *codec, .ops = &wm8350_dai_ops, }; -static int wm8350_codec_probe(struct snd_soc_codec *codec) +static int wm8350_component_probe(struct snd_soc_component *component) { - struct wm8350 *wm8350 = dev_get_platdata(codec->dev); + struct wm8350 *wm8350 = dev_get_platdata(component->dev); struct wm8350_data *priv; struct wm8350_output *out1; struct wm8350_output *out2; int ret, i; if (wm8350->codec.platform_data == NULL) { - dev_err(codec->dev, "No audio platform data supplied\n"); + dev_err(component->dev, "No audio platform data supplied\n"); return -EINVAL; } - priv = devm_kzalloc(codec->dev, sizeof(struct wm8350_data), + priv = devm_kzalloc(component->dev, sizeof(struct wm8350_data), GFP_KERNEL); if (priv == NULL) return -ENOMEM; - snd_soc_codec_init_regmap(codec, wm8350->regmap); - snd_soc_codec_set_drvdata(codec, priv); + snd_soc_component_init_regmap(component, wm8350->regmap); + snd_soc_component_set_drvdata(component, priv); priv->wm8350 = wm8350; @@ -1497,9 +1497,9 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); /* Enable robust clocking mode in ADC */ - snd_soc_write(codec, WM8350_SECURITY, 0xa7); - snd_soc_write(codec, 0xde, 0x13); - snd_soc_write(codec, WM8350_SECURITY, 0); + snd_soc_component_write(component, WM8350_SECURITY, 0xa7); + snd_soc_component_write(component, 0xde, 0x13); + snd_soc_component_write(component, WM8350_SECURITY, 0); /* read OUT1 & OUT2 volumes */ out1 = &priv->out1; @@ -1552,10 +1552,10 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) return 0; } -static int wm8350_codec_remove(struct snd_soc_codec *codec) +static void wm8350_component_remove(struct snd_soc_component *component) { - struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); - struct wm8350 *wm8350 = dev_get_platdata(codec->dev); + struct wm8350_data *priv = snd_soc_component_get_drvdata(component); + struct wm8350 *wm8350 = dev_get_platdata(component->dev); wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, WM8350_JDL_ENA | WM8350_JDR_ENA); @@ -1578,44 +1578,37 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec) flush_delayed_work(&priv->pga_work); wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); - - return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_wm8350 = { - .probe = wm8350_codec_probe, - .remove = wm8350_codec_remove, - .set_bias_level = wm8350_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = wm8350_snd_controls, - .num_controls = ARRAY_SIZE(wm8350_snd_controls), - .dapm_widgets = wm8350_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets), - .dapm_routes = wm8350_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_wm8350 = { + .probe = wm8350_component_probe, + .remove = wm8350_component_remove, + .set_bias_level = wm8350_set_bias_level, + .controls = wm8350_snd_controls, + .num_controls = ARRAY_SIZE(wm8350_snd_controls), + .dapm_widgets = wm8350_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets), + .dapm_routes = wm8350_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int wm8350_probe(struct platform_device *pdev) { - return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8350, + return devm_snd_soc_register_component(&pdev->dev, + &soc_component_dev_wm8350, &wm8350_dai, 1); } -static int wm8350_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - return 0; -} - static struct platform_driver wm8350_codec_driver = { .driver = { .name = "wm8350-codec", }, .probe = wm8350_probe, - .remove = wm8350_remove, }; module_platform_driver(wm8350_codec_driver); diff --git a/sound/soc/codecs/wm8350.h b/sound/soc/codecs/wm8350.h index 74108eb..1191326 100644 --- a/sound/soc/codecs/wm8350.h +++ b/sound/soc/codecs/wm8350.h @@ -20,9 +20,9 @@ enum wm8350_jack { WM8350_JDR = 2, }; -int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, +int wm8350_hp_jack_detect(struct snd_soc_component *component, enum wm8350_jack which, struct snd_soc_jack *jack, int report); -int wm8350_mic_jack_detect(struct snd_soc_codec *codec, +int wm8350_mic_jack_detect(struct snd_soc_component *component, struct snd_soc_jack *jack, int detect_report, int short_report); diff --git a/sound/soc/fsl/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c index cdaf163..2f80b21 100644 --- a/sound/soc/fsl/wm1133-ev1.c +++ b/sound/soc/fsl/wm1133-ev1.c @@ -201,18 +201,18 @@ static int wm1133_ev1_hw_params(struct snd_pcm_substream *substream, static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd) { - struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_component *component = rtd->codec_dai->component; /* Headphone jack detection */ snd_soc_card_jack_new(rtd->card, "Headphone", SND_JACK_HEADPHONE, &hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins)); - wm8350_hp_jack_detect(codec, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE); + wm8350_hp_jack_detect(component, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE); /* Microphone jack detection */ snd_soc_card_jack_new(rtd->card, "Microphone", SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack, mic_jack_pins, ARRAY_SIZE(mic_jack_pins)); - wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE, + wm8350_mic_jack_detect(component, &mic_jack, SND_JACK_MICROPHONE, SND_JACK_BTN_0); snd_soc_dapm_force_enable_pin(&rtd->card->dapm, "Mic Bias");