From patchwork Mon Feb 12 12:45:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128076 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3203527ljc; Mon, 12 Feb 2018 05:20:55 -0800 (PST) X-Google-Smtp-Source: AH8x226p9cNhb+9DQai1imL28J4hynOE5WnxMCFxE8vUE7zTktOz/u8gnq5ntGIvmjppnv1u7WP4 X-Received: by 10.223.185.53 with SMTP id k50mr780048wrf.78.1518441655904; Mon, 12 Feb 2018 05:20:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441655; cv=none; d=google.com; s=arc-20160816; b=a8nULCFWqsEflS0I5xUiJ93sbRMdRWZcGqSM8zDNitCx1hWyrj0QHz0PIoixYKWLFf ZunAwA9KGa1EeWYx9jXlVvjGXKO1iQhf3N9psaWpDI4240LJCXjtNOVuZSQJr6/+hZyq nudHidVge0PY469gqejKUXggqcFeI6azeLoVFG/4q1+u2Xav/xi7zeyWBzxJYi2EuJeP RSw9kLZj5IlZ50G/KjbnSfsSbYOUEZxQedX1oo3Bb2sOaRri5mxG60dEtQCmL3f8AFQt GvuiMdwDtNhUhfTupH8hqOQNQch6CDzW9Fu07pG0gBtVEPqR33XeHCF26nPOuRnA8JER L/+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=w9JOJuQlpzUT6rfdinGMPeJPZriVS4XyhSp7InwYLw0=; b=XTdVTk2ppnAIla+t7PLU8v6VLwkRt7JfJ8TnLpDNNjVfOWWvnPJHauz/0yhS4IGgmw fI9bfKZSICe/8TCtxiKUprsULIORuecZWESSfMnFgPjWCLywhiX5YbPBlmBCU3mm2XIV wjLr230ODgQaY7wqj0gifiTkdyYOpPdfQQyaqkalUX9gHO7KkykqV5kkR9Nh2gRTb8bb 4dWmVHOmGnkav1H6CEOu0BTyhmkl5oaTKa2ynuKmzIVZ+ay6rTf52WC/l0E2m6/lGoOt C1z970eQRXFzqbtYZNFftoAGWuVHsiBbqpFxh3Y+TAV/AS99z4R5vhDOM+TTysf1bHxR pfXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=PKvZ5zWl; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id q23si3700806wmf.81.2018.02.12.05.20.55; Mon, 12 Feb 2018 05:20:55 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=PKvZ5zWl; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 115C326872C; Mon, 12 Feb 2018 14:18:13 +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 BE87026872B; Mon, 12 Feb 2018 14:18:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id B564C267A54 for ; Mon, 12 Feb 2018 13:45:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=s7fqwwovhsDc1Z6oDspV7jy1Yl1tL0pYNbRcnNT+KYM=; b=PKvZ5zWlrE2L bSw55RJZjiBKGjYJwc7vK/DsIKRoGVXmr19lVdoQQuwjQVQ50SWehygFrAflfXsCsnvDFodEipvMt Hpt7RcSBYZCdm1LzHXCrfNLBiTMByGL0BQa0oT58t9UvD27YalsYAxYVJKbrNBRkahSWB9vNEMsLt 3+XR0=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1elDTi-0002Q5-L4; Mon, 12 Feb 2018 12:45:02 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDTi-0005F3-3M; Mon, 12 Feb 2018 12:45:02 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87vafl1g5r.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:45:02 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: rt5660: replace codec to component" to the asoc tree 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: rt5660: replace codec to component has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From ca04dd8a9b4d350d473675c0f777ff8c213aa0a9 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:47:20 +0000 Subject: [PATCH] ASoC: rt5660: replace codec to component 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 Signed-off-by: Mark Brown --- sound/soc/codecs/rt5660.c | 145 ++++++++++++++++++++++------------------------ sound/soc/codecs/rt5660.h | 2 +- 2 files changed, 70 insertions(+), 77 deletions(-) -- 2.16.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/rt5660.c b/sound/soc/codecs/rt5660.c index d22ef00e0d96..20a755137e63 100644 --- a/sound/soc/codecs/rt5660.c +++ b/sound/soc/codecs/rt5660.c @@ -354,17 +354,17 @@ static const struct snd_kcontrol_new rt5660_snd_controls[] = { static int rt5660_set_dmic_clk(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 rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); int idx, rate; rate = rt5660->sysclk / rl6231_get_pre_div(rt5660->regmap, RT5660_ADDA_CLK1, RT5660_I2S_PD1_SFT); idx = rl6231_calc_dmic_clk(rate); if (idx < 0) - dev_err(codec->dev, "Failed to set DMIC clock\n"); + dev_err(component->dev, "Failed to set DMIC clock\n"); else - snd_soc_update_bits(codec, RT5660_DMIC_CTRL1, + snd_soc_component_update_bits(component, RT5660_DMIC_CTRL1, RT5660_DMIC_CLK_MASK, idx << RT5660_DMIC_CLK_SFT); return idx; @@ -373,10 +373,10 @@ static int rt5660_set_dmic_clk(struct snd_soc_dapm_widget *w, static int rt5660_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); + struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); unsigned int val; - val = snd_soc_read(codec, RT5660_GLB_CLK); + val = snd_soc_component_read32(component, RT5660_GLB_CLK); val &= RT5660_SCLK_SRC_MASK; if (val == RT5660_SCLK_SRC_PLL1) return 1; @@ -541,17 +541,17 @@ static const struct snd_kcontrol_new rt5660_if1_adc_swap_mux = static int rt5660_lout_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 snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); switch (event) { case SND_SOC_DAPM_POST_PMU: - snd_soc_update_bits(codec, RT5660_LOUT_AMP_CTRL, + snd_soc_component_update_bits(component, RT5660_LOUT_AMP_CTRL, RT5660_LOUT_CO_MASK | RT5660_LOUT_CB_MASK, RT5660_LOUT_CO_EN | RT5660_LOUT_CB_PU); break; case SND_SOC_DAPM_PRE_PMD: - snd_soc_update_bits(codec, RT5660_LOUT_AMP_CTRL, + snd_soc_component_update_bits(component, RT5660_LOUT_AMP_CTRL, RT5660_LOUT_CO_MASK | RT5660_LOUT_CB_MASK, RT5660_LOUT_CO_DIS | RT5660_LOUT_CB_PD); break; @@ -838,22 +838,22 @@ static const struct snd_soc_dapm_route rt5660_dapm_routes[] = { static int rt5660_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 rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); unsigned int val_len = 0, val_clk, mask_clk; int pre_div, bclk_ms, frame_size; rt5660->lrck[dai->id] = params_rate(params); pre_div = rl6231_get_clk_info(rt5660->sysclk, rt5660->lrck[dai->id]); if (pre_div < 0) { - dev_err(codec->dev, "Unsupported clock setting %d for DAI %d\n", + dev_err(component->dev, "Unsupported clock setting %d for DAI %d\n", rt5660->lrck[dai->id], dai->id); return -EINVAL; } frame_size = snd_soc_params_to_frame_size(params); if (frame_size < 0) { - dev_err(codec->dev, "Unsupported frame size: %d\n", frame_size); + dev_err(component->dev, "Unsupported frame size: %d\n", frame_size); return frame_size; } @@ -890,13 +890,13 @@ static int rt5660_hw_params(struct snd_pcm_substream *substream, mask_clk = RT5660_I2S_BCLK_MS1_MASK | RT5660_I2S_PD1_MASK; val_clk = bclk_ms << RT5660_I2S_BCLK_MS1_SFT | pre_div << RT5660_I2S_PD1_SFT; - snd_soc_update_bits(codec, RT5660_I2S1_SDP, RT5660_I2S_DL_MASK, + snd_soc_component_update_bits(component, RT5660_I2S1_SDP, RT5660_I2S_DL_MASK, val_len); - snd_soc_update_bits(codec, RT5660_ADDA_CLK1, mask_clk, val_clk); + snd_soc_component_update_bits(component, RT5660_ADDA_CLK1, mask_clk, val_clk); break; default: - dev_err(codec->dev, "Invalid dai->id: %d\n", dai->id); + dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); return -EINVAL; } @@ -905,8 +905,8 @@ static int rt5660_hw_params(struct snd_pcm_substream *substream, static int rt5660_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; - struct rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); unsigned int reg_val = 0; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -957,13 +957,13 @@ static int rt5660_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) switch (dai->id) { case RT5660_AIF1: - snd_soc_update_bits(codec, RT5660_I2S1_SDP, + snd_soc_component_update_bits(component, RT5660_I2S1_SDP, RT5660_I2S_MS_MASK | RT5660_I2S_BP_MASK | RT5660_I2S_DF_MASK, reg_val); break; default: - dev_err(codec->dev, "Invalid dai->id: %d\n", dai->id); + dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); return -EINVAL; } @@ -973,8 +973,8 @@ static int rt5660_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int rt5660_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = dai->codec; - struct rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); unsigned int reg_val = 0; if (freq == rt5660->sysclk && clk_id == rt5660->sysclk_src) @@ -994,11 +994,11 @@ static int rt5660_set_dai_sysclk(struct snd_soc_dai *dai, break; default: - dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id); + dev_err(component->dev, "Invalid clock id (%d)\n", clk_id); return -EINVAL; } - snd_soc_update_bits(codec, RT5660_GLB_CLK, RT5660_SCLK_SRC_MASK, + snd_soc_component_update_bits(component, RT5660_GLB_CLK, RT5660_SCLK_SRC_MASK, reg_val); rt5660->sysclk = freq; @@ -1012,8 +1012,8 @@ static int rt5660_set_dai_sysclk(struct snd_soc_dai *dai, static int rt5660_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out) { - struct snd_soc_codec *codec = dai->codec; - struct rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); struct rl6231_pll_code pll_code; int ret; @@ -1022,44 +1022,44 @@ static int rt5660_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, return 0; if (!freq_in || !freq_out) { - dev_dbg(codec->dev, "PLL disabled\n"); + dev_dbg(component->dev, "PLL disabled\n"); rt5660->pll_in = 0; rt5660->pll_out = 0; - snd_soc_update_bits(codec, RT5660_GLB_CLK, + snd_soc_component_update_bits(component, RT5660_GLB_CLK, RT5660_SCLK_SRC_MASK, RT5660_SCLK_SRC_MCLK); return 0; } switch (source) { case RT5660_PLL1_S_MCLK: - snd_soc_update_bits(codec, RT5660_GLB_CLK, + snd_soc_component_update_bits(component, RT5660_GLB_CLK, RT5660_PLL1_SRC_MASK, RT5660_PLL1_SRC_MCLK); break; case RT5660_PLL1_S_BCLK: - snd_soc_update_bits(codec, RT5660_GLB_CLK, + snd_soc_component_update_bits(component, RT5660_GLB_CLK, RT5660_PLL1_SRC_MASK, RT5660_PLL1_SRC_BCLK1); break; default: - dev_err(codec->dev, "Unknown PLL source %d\n", source); + dev_err(component->dev, "Unknown PLL source %d\n", source); return -EINVAL; } ret = rl6231_pll_calc(freq_in, freq_out, &pll_code); if (ret < 0) { - dev_err(codec->dev, "Unsupport input clock %d\n", freq_in); + dev_err(component->dev, "Unsupport input clock %d\n", freq_in); return ret; } - dev_dbg(codec->dev, "bypass=%d m=%d n=%d k=%d\n", + dev_dbg(component->dev, "bypass=%d m=%d n=%d k=%d\n", pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code), pll_code.n_code, pll_code.k_code); - snd_soc_write(codec, RT5660_PLL_CTRL1, + snd_soc_component_write(component, RT5660_PLL_CTRL1, pll_code.n_code << RT5660_PLL_N_SFT | pll_code.k_code); - snd_soc_write(codec, RT5660_PLL_CTRL2, + snd_soc_component_write(component, RT5660_PLL_CTRL2, (pll_code.m_bp ? 0 : pll_code.m_code) << RT5660_PLL_M_SFT | pll_code.m_bp << RT5660_PLL_M_BP_SFT); @@ -1070,10 +1070,10 @@ static int rt5660_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, return 0; } -static int rt5660_set_bias_level(struct snd_soc_codec *codec, +static int rt5660_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); int ret; switch (level) { @@ -1081,13 +1081,13 @@ static int rt5660_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_PREPARE: - snd_soc_update_bits(codec, RT5660_GEN_CTRL1, + snd_soc_component_update_bits(component, RT5660_GEN_CTRL1, RT5660_DIG_GATE_CTRL, RT5660_DIG_GATE_CTRL); if (IS_ERR(rt5660->mclk)) break; - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) { + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) { clk_disable_unprepare(rt5660->mclk); } else { ret = clk_prepare_enable(rt5660->mclk); @@ -1097,21 +1097,21 @@ static int rt5660_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) { - snd_soc_update_bits(codec, RT5660_PWR_ANLG1, + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { + snd_soc_component_update_bits(component, RT5660_PWR_ANLG1, RT5660_PWR_VREF1 | RT5660_PWR_MB | RT5660_PWR_BG | RT5660_PWR_VREF2, RT5660_PWR_VREF1 | RT5660_PWR_MB | RT5660_PWR_BG | RT5660_PWR_VREF2); usleep_range(10000, 15000); - snd_soc_update_bits(codec, RT5660_PWR_ANLG1, + snd_soc_component_update_bits(component, RT5660_PWR_ANLG1, RT5660_PWR_FV1 | RT5660_PWR_FV2, RT5660_PWR_FV1 | RT5660_PWR_FV2); } break; case SND_SOC_BIAS_OFF: - snd_soc_update_bits(codec, RT5660_GEN_CTRL1, + snd_soc_component_update_bits(component, RT5660_GEN_CTRL1, RT5660_DIG_GATE_CTRL, 0); break; @@ -1122,24 +1122,24 @@ static int rt5660_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int rt5660_probe(struct snd_soc_codec *codec) +static int rt5660_probe(struct snd_soc_component *component) { - struct rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); - rt5660->codec = codec; + rt5660->component = component; return 0; } -static int rt5660_remove(struct snd_soc_codec *codec) +static void rt5660_remove(struct snd_soc_component *component) { - return snd_soc_write(codec, RT5660_RESET, 0); + snd_soc_component_write(component, RT5660_RESET, 0); } #ifdef CONFIG_PM -static int rt5660_suspend(struct snd_soc_codec *codec) +static int rt5660_suspend(struct snd_soc_component *component) { - struct rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); regcache_cache_only(rt5660->regmap, true); regcache_mark_dirty(rt5660->regmap); @@ -1147,9 +1147,9 @@ static int rt5660_suspend(struct snd_soc_codec *codec) return 0; } -static int rt5660_resume(struct snd_soc_codec *codec) +static int rt5660_resume(struct snd_soc_component *component) { - struct rt5660_priv *rt5660 = snd_soc_codec_get_drvdata(codec); + struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); if (rt5660->pdata.poweroff_codec_in_suspend) msleep(350); @@ -1197,21 +1197,21 @@ static struct snd_soc_dai_driver rt5660_dai[] = { }, }; -static const struct snd_soc_codec_driver soc_codec_dev_rt5660 = { - .probe = rt5660_probe, - .remove = rt5660_remove, - .suspend = rt5660_suspend, - .resume = rt5660_resume, - .set_bias_level = rt5660_set_bias_level, - .idle_bias_off = true, - .component_driver = { - .controls = rt5660_snd_controls, - .num_controls = ARRAY_SIZE(rt5660_snd_controls), - .dapm_widgets = rt5660_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(rt5660_dapm_widgets), - .dapm_routes = rt5660_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(rt5660_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_rt5660 = { + .probe = rt5660_probe, + .remove = rt5660_remove, + .suspend = rt5660_suspend, + .resume = rt5660_resume, + .set_bias_level = rt5660_set_bias_level, + .controls = rt5660_snd_controls, + .num_controls = ARRAY_SIZE(rt5660_snd_controls), + .dapm_widgets = rt5660_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rt5660_dapm_widgets), + .dapm_routes = rt5660_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(rt5660_dapm_routes), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config rt5660_regmap = { @@ -1329,17 +1329,11 @@ static int rt5660_i2c_probe(struct i2c_client *i2c, RT5660_SEL_DMIC_DATA_IN1P); } - return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5660, + return devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_rt5660, rt5660_dai, ARRAY_SIZE(rt5660_dai)); } -static int rt5660_i2c_remove(struct i2c_client *i2c) -{ - snd_soc_unregister_codec(&i2c->dev); - - return 0; -} - static struct i2c_driver rt5660_i2c_driver = { .driver = { .name = "rt5660", @@ -1347,7 +1341,6 @@ static struct i2c_driver rt5660_i2c_driver = { .of_match_table = of_match_ptr(rt5660_of_match), }, .probe = rt5660_i2c_probe, - .remove = rt5660_i2c_remove, .id_table = rt5660_i2c_id, }; module_i2c_driver(rt5660_i2c_driver); diff --git a/sound/soc/codecs/rt5660.h b/sound/soc/codecs/rt5660.h index bba18fb66b6f..c65de0a20a49 100644 --- a/sound/soc/codecs/rt5660.h +++ b/sound/soc/codecs/rt5660.h @@ -831,7 +831,7 @@ enum { }; struct rt5660_priv { - struct snd_soc_codec *codec; + struct snd_soc_component *component; struct rt5660_platform_data pdata; struct regmap *regmap; struct clk *mclk;