From patchwork Mon Feb 12 12:45:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128086 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3204850ljc; Mon, 12 Feb 2018 05:22:34 -0800 (PST) X-Google-Smtp-Source: AH8x224VCjXp5r0M4BXXkU9HMO2y0Ra5zgL5kdbJJ7InUPltOEP9a6CF4AB74wnE5u57T3BnJFQr X-Received: by 10.28.87.20 with SMTP id l20mr3395865wmb.48.1518441754521; Mon, 12 Feb 2018 05:22:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441754; cv=none; d=google.com; s=arc-20160816; b=fihDmTWiwYVANN2WOb3y4bT+ImFV4XeAvv4vv75SuW8UwZO45SMkcl/2beUnxjqe3a PqclpivJcOIDsbKubjvsn/N/huyKXCbRmnnIOwX22JN28AkFbu/nwx5fKxqZbv8zZm+x KQpMAA+r3mTm2IydHIQO5SWZYXmUz0TnCLSpQK2c1SUOTI5UO533lRRZJHTrvCBVMtd9 YK3iuFwbs9Y12C52zPFGer4gz7WZ/GOR8Z1f1Kz/mJvyd7jIRvSKzHUZDL+y1b9PBCU8 drfgd9Rfx/0VqQOFFmSGHQ5imAzAoXI1WIatRu/u/D1549kHXO5YNeqkZ6HvVwGJUSZk gi8A== 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=5d59x4xDa1Ow0aYSgCTdnnRhQNfVYt/C9aOLdvlt2VI=; b=C8z9n216badjBli6J4edV06L9g7eJWVzeTers1mJA1nl3JFK0Y4NJuN8VA+9yzsQGF qijxTlIDc2pS8fOJe9uNNEkCR1j5tnw1wthx6gGy6vi4K/KEHa69qakH9vmA6w6Tsob5 H8AbDfycczzC9WFKdzj46tsEfbpYmGa8DUgPWaAYNIQFIyerMZVn9qeSWBeyivEsSzky B+nNB4fJUH+Cw81GIG1CqB2eGEDbf5PEE+VirFZLgEHSeL3yYb69Arm7K8lbE5pYx1lf tpVAta9KNiC20lA1otb3xUVjI2wTkdvh+siLohWB+29Z7Mi7dtp3FzTQm0Cl4jVJwTj9 DwHA== 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=dgVOzNQ+; 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 g188si3734381wmf.248.2018.02.12.05.22.34; Mon, 12 Feb 2018 05:22:34 -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=dgVOzNQ+; 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 336C0268755; Mon, 12 Feb 2018 14:19:38 +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 6EFE02687A4; Mon, 12 Feb 2018 14:19:37 +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 C137E26782F for ; Mon, 12 Feb 2018 13:45:41 +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=3gXz2rhd5nMeFZ/oD7Ll8INgNiMemzquuzv0m/u1vNg=; b=dgVOzNQ+98Oj y72ssihkFWM6eskycflF0AedH97gJFLJVW+DP8DFXyTFVpr8br3d9ogWCGOZAN7qjaxuyhe+4Y7TZ 5c7rqlCpI0oYpJVcQJEQJ6QkMe7ZNDO/SuFPfzQBid+ctht+gAdsE84yn3ZuWv2vKVIjL6v4rBgtf qrOew=; 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 1elDUJ-0002Qm-Lf; Mon, 12 Feb 2018 12:45:39 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDUJ-0005MA-7g; Mon, 12 Feb 2018 12:45:39 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87607l2w7w.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:45:39 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: rt274: 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: rt274: 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 f548dd4f871b827763479e15654c7f0b935e28ee Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:15:08 +0000 Subject: [PATCH] ASoC: rt274: 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/rt274.c | 206 +++++++++++++++++++++++------------------------ 1 file changed, 102 insertions(+), 104 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/rt274.c b/sound/soc/codecs/rt274.c index 8f92e5c4dd9d..d88e67341083 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -38,7 +38,7 @@ struct rt274_priv { struct reg_default *index_cache; int index_cache_size; struct regmap *regmap; - struct snd_soc_codec *codec; + struct snd_soc_component *component; struct i2c_client *i2c; struct snd_soc_jack *jack; struct delayed_work jack_detect_work; @@ -338,13 +338,13 @@ static bool rt274_readable_register(struct device *dev, unsigned int reg) } #ifdef CONFIG_PM -static void rt274_index_sync(struct snd_soc_codec *codec) +static void rt274_index_sync(struct snd_soc_component *component) { - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); int i; for (i = 0; i < INDEX_CACHE_SIZE; i++) { - snd_soc_write(codec, rt274->index_cache[i].reg, + snd_soc_component_write(component, rt274->index_cache[i].reg, rt274->index_cache[i].def); } } @@ -357,7 +357,7 @@ static int rt274_jack_detect(struct rt274_priv *rt274, bool *hp, bool *mic) *hp = false; *mic = false; - if (!rt274->codec) + if (!rt274->component) return -EINVAL; regmap_read(rt274->regmap, RT274_GET_HP_SENSE, &buf); @@ -393,10 +393,10 @@ static void rt274_jack_detect_work(struct work_struct *work) static irqreturn_t rt274_irq(int irq, void *data); -static int rt274_mic_detect(struct snd_soc_codec *codec, +static int rt274_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data) { - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); if (jack == NULL) { /* Disable jack detection */ @@ -609,8 +609,8 @@ static int rt274_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 rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); unsigned int val = 0; int d_len_code = 0, c_len_code = 0; @@ -620,7 +620,7 @@ static int rt274_hw_params(struct snd_pcm_substream *substream, case 48000: break; default: - dev_err(codec->dev, "Unsupported sample rate %d\n", + dev_err(component->dev, "Unsupported sample rate %d\n", params_rate(params)); return -EINVAL; } @@ -628,7 +628,7 @@ static int rt274_hw_params(struct snd_pcm_substream *substream, case 12288000: case 24576000: if (params_rate(params) != 48000) { - dev_err(codec->dev, "Sys_clk is not matched (%d %d)\n", + dev_err(component->dev, "Sys_clk is not matched (%d %d)\n", params_rate(params), rt274->sys_clk); return -EINVAL; } @@ -636,7 +636,7 @@ static int rt274_hw_params(struct snd_pcm_substream *substream, case 11289600: case 22579200: if (params_rate(params) != 44100) { - dev_err(codec->dev, "Sys_clk is not matched (%d %d)\n", + dev_err(component->dev, "Sys_clk is not matched (%d %d)\n", params_rate(params), rt274->sys_clk); return -EINVAL; } @@ -647,7 +647,7 @@ static int rt274_hw_params(struct snd_pcm_substream *substream, /* bit 3:0 Number of Channel */ val |= (params_channels(params) - 1); } else { - dev_err(codec->dev, "Unsupported channels %d\n", + dev_err(component->dev, "Unsupported channels %d\n", params_channels(params)); return -EINVAL; } @@ -685,29 +685,29 @@ static int rt274_hw_params(struct snd_pcm_substream *substream, if (rt274->master) c_len_code = 0x3; - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, 0xc018, d_len_code << 3 | c_len_code << 14); - dev_dbg(codec->dev, "format val = 0x%x\n", val); + dev_dbg(component->dev, "format val = 0x%x\n", val); - snd_soc_update_bits(codec, RT274_DAC_FORMAT, 0x407f, val); - snd_soc_update_bits(codec, RT274_ADC_FORMAT, 0x407f, val); + snd_soc_component_update_bits(component, RT274_DAC_FORMAT, 0x407f, val); + snd_soc_component_update_bits(component, RT274_ADC_FORMAT, 0x407f, val); return 0; } static int rt274_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_I2S_MODE_MASK, RT274_I2S_MODE_M); rt274->master = true; break; case SND_SOC_DAIFMT_CBS_CFS: - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_I2S_MODE_MASK, RT274_I2S_MODE_S); rt274->master = false; break; @@ -717,27 +717,27 @@ static int rt274_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: - snd_soc_update_bits(codec, RT274_I2S_CTRL1, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_I2S_FMT_MASK, RT274_I2S_FMT_I2S); break; case SND_SOC_DAIFMT_LEFT_J: - snd_soc_update_bits(codec, RT274_I2S_CTRL1, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_I2S_FMT_MASK, RT274_I2S_FMT_LJ); break; case SND_SOC_DAIFMT_DSP_A: - snd_soc_update_bits(codec, RT274_I2S_CTRL1, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_I2S_FMT_MASK, RT274_I2S_FMT_PCMA); break; case SND_SOC_DAIFMT_DSP_B: - snd_soc_update_bits(codec, RT274_I2S_CTRL1, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_I2S_FMT_MASK, RT274_I2S_FMT_PCMB); break; default: return -EINVAL; } /* bit 15 Stream Type 0:PCM 1:Non-PCM */ - snd_soc_update_bits(codec, RT274_DAC_FORMAT, 0x8000, 0); - snd_soc_update_bits(codec, RT274_ADC_FORMAT, 0x8000, 0); + snd_soc_component_update_bits(component, RT274_DAC_FORMAT, 0x8000, 0); + snd_soc_component_update_bits(component, RT274_ADC_FORMAT, 0x8000, 0); return 0; } @@ -745,47 +745,47 @@ static int rt274_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int rt274_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 rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); switch (source) { case RT274_PLL2_S_MCLK: - snd_soc_update_bits(codec, RT274_PLL2_CTRL, + snd_soc_component_update_bits(component, RT274_PLL2_CTRL, RT274_PLL2_SRC_MASK, RT274_PLL2_SRC_MCLK); break; default: - dev_warn(codec->dev, "invalid pll source, use BCLK\n"); + dev_warn(component->dev, "invalid pll source, use BCLK\n"); case RT274_PLL2_S_BCLK: - snd_soc_update_bits(codec, RT274_PLL2_CTRL, + snd_soc_component_update_bits(component, RT274_PLL2_CTRL, RT274_PLL2_SRC_MASK, RT274_PLL2_SRC_BCLK); break; } if (source == RT274_PLL2_S_BCLK) { - snd_soc_update_bits(codec, RT274_MCLK_CTRL, + snd_soc_component_update_bits(component, RT274_MCLK_CTRL, (0x3 << 12), (0x3 << 12)); switch (rt274->fs) { case 50: - snd_soc_write(codec, 0x7a, 0xaab6); - snd_soc_write(codec, 0x7b, 0x0301); - snd_soc_write(codec, 0x7c, 0x04fe); + snd_soc_component_write(component, 0x7a, 0xaab6); + snd_soc_component_write(component, 0x7b, 0x0301); + snd_soc_component_write(component, 0x7c, 0x04fe); break; case 64: - snd_soc_write(codec, 0x7a, 0xaa96); - snd_soc_write(codec, 0x7b, 0x8003); - snd_soc_write(codec, 0x7c, 0x081e); + snd_soc_component_write(component, 0x7a, 0xaa96); + snd_soc_component_write(component, 0x7b, 0x8003); + snd_soc_component_write(component, 0x7c, 0x081e); break; case 128: - snd_soc_write(codec, 0x7a, 0xaa96); - snd_soc_write(codec, 0x7b, 0x8003); - snd_soc_write(codec, 0x7c, 0x080e); + snd_soc_component_write(component, 0x7a, 0xaa96); + snd_soc_component_write(component, 0x7b, 0x8003); + snd_soc_component_write(component, 0x7c, 0x080e); break; default: - dev_warn(codec->dev, "invalid freq_in, assume 4.8M\n"); + dev_warn(component->dev, "invalid freq_in, assume 4.8M\n"); case 100: - snd_soc_write(codec, 0x7a, 0xaab6); - snd_soc_write(codec, 0x7b, 0x0301); - snd_soc_write(codec, 0x7c, 0x047e); + snd_soc_component_write(component, 0x7a, 0xaab6); + snd_soc_component_write(component, 0x7b, 0x0301); + snd_soc_component_write(component, 0x7c, 0x047e); break; } } @@ -796,11 +796,11 @@ static int rt274_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, static int rt274_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = dai->codec; - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); unsigned int clk_src, mclk_en; - dev_dbg(codec->dev, "%s freq=%d\n", __func__, freq); + dev_dbg(component->dev, "%s freq=%d\n", __func__, freq); switch (clk_id) { case RT274_SCLK_S_MCLK: @@ -818,43 +818,43 @@ static int rt274_set_dai_sysclk(struct snd_soc_dai *dai, default: mclk_en = RT274_MCLK_MODE_DIS; clk_src = RT274_CLK_SRC_MCLK; - dev_warn(codec->dev, "invalid sysclk source, use PLL1\n"); + dev_warn(component->dev, "invalid sysclk source, use PLL1\n"); break; } - snd_soc_update_bits(codec, RT274_MCLK_CTRL, + snd_soc_component_update_bits(component, RT274_MCLK_CTRL, RT274_MCLK_MODE_MASK, mclk_en); - snd_soc_update_bits(codec, RT274_CLK_CTRL, + snd_soc_component_update_bits(component, RT274_CLK_CTRL, RT274_CLK_SRC_MASK, clk_src); switch (freq) { case 19200000: if (clk_id == RT274_SCLK_S_MCLK) { - dev_err(codec->dev, "Should not use MCLK\n"); + dev_err(component->dev, "Should not use MCLK\n"); return -EINVAL; } - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL2, 0x40, 0x40); break; case 24000000: if (clk_id == RT274_SCLK_S_MCLK) { - dev_err(codec->dev, "Should not use MCLK\n"); + dev_err(component->dev, "Should not use MCLK\n"); return -EINVAL; } - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL2, 0x40, 0x0); break; case 12288000: case 11289600: - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_MCLK_CTRL, 0x1fcf, 0x0008); break; case 24576000: case 22579200: - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_MCLK_CTRL, 0x1fcf, 0x1543); break; default: - dev_err(codec->dev, "Unsupported system clock\n"); + dev_err(component->dev, "Unsupported system clock\n"); return -EINVAL; } @@ -866,16 +866,16 @@ static int rt274_set_dai_sysclk(struct snd_soc_dai *dai, static int rt274_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) { - struct snd_soc_codec *codec = dai->codec; - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); - dev_dbg(codec->dev, "%s ratio=%d\n", __func__, ratio); + dev_dbg(component->dev, "%s ratio=%d\n", __func__, ratio); rt274->fs = ratio; if ((ratio / 50) == 0) - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, 0x1000, 0x1000); else - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, 0x1000, 0x0); @@ -886,28 +886,28 @@ static int rt274_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; if (rx_mask || tx_mask) { - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_TDM_EN, RT274_TDM_EN); } else { - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_TDM_EN, RT274_TDM_DIS); return 0; } switch (slots) { case 4: - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_TDM_CH_NUM, RT274_TDM_4CH); break; case 2: - snd_soc_update_bits(codec, + snd_soc_component_update_bits(component, RT274_I2S_CTRL1, RT274_TDM_CH_NUM, RT274_TDM_2CH); break; default: - dev_err(codec->dev, + dev_err(component->dev, "Support 2 or 4 slots TDM only\n"); return -EINVAL; } @@ -915,20 +915,20 @@ static int rt274_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, return 0; } -static int rt274_set_bias_level(struct snd_soc_codec *codec, +static int rt274_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { switch (level) { case SND_SOC_BIAS_PREPARE: if (SND_SOC_BIAS_STANDBY == - snd_soc_codec_get_bias_level(codec)) { - snd_soc_write(codec, + snd_soc_component_get_bias_level(component)) { + snd_soc_component_write(component, RT274_SET_AUDIO_POWER, AC_PWRST_D0); } break; case SND_SOC_BIAS_STANDBY: - snd_soc_write(codec, + snd_soc_component_write(component, RT274_SET_AUDIO_POWER, AC_PWRST_D3); break; @@ -968,11 +968,11 @@ static irqreturn_t rt274_irq(int irq, void *data) return IRQ_HANDLED; } -static int rt274_probe(struct snd_soc_codec *codec) +static int rt274_probe(struct snd_soc_component *component) { - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); - rt274->codec = codec; + rt274->component = component; if (rt274->i2c->irq) { INIT_DELAYED_WORK(&rt274->jack_detect_work, @@ -984,19 +984,17 @@ static int rt274_probe(struct snd_soc_codec *codec) return 0; } -static int rt274_remove(struct snd_soc_codec *codec) +static void rt274_remove(struct snd_soc_component *component) { - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); cancel_delayed_work_sync(&rt274->jack_detect_work); - - return 0; } #ifdef CONFIG_PM -static int rt274_suspend(struct snd_soc_codec *codec) +static int rt274_suspend(struct snd_soc_component *component) { - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); regcache_cache_only(rt274->regmap, true); regcache_mark_dirty(rt274->regmap); @@ -1004,12 +1002,12 @@ static int rt274_suspend(struct snd_soc_codec *codec) return 0; } -static int rt274_resume(struct snd_soc_codec *codec) +static int rt274_resume(struct snd_soc_component *component) { - struct rt274_priv *rt274 = snd_soc_codec_get_drvdata(codec); + struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); regcache_cache_only(rt274->regmap, false); - rt274_index_sync(codec); + rt274_index_sync(component); regcache_sync(rt274->regmap); return 0; @@ -1055,22 +1053,22 @@ static struct snd_soc_dai_driver rt274_dai[] = { }, }; -static const struct snd_soc_codec_driver soc_codec_dev_rt274 = { - .probe = rt274_probe, - .remove = rt274_remove, - .suspend = rt274_suspend, - .resume = rt274_resume, - .set_bias_level = rt274_set_bias_level, - .idle_bias_off = true, - .component_driver = { - .controls = rt274_snd_controls, - .num_controls = ARRAY_SIZE(rt274_snd_controls), - .dapm_widgets = rt274_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(rt274_dapm_widgets), - .dapm_routes = rt274_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(rt274_dapm_routes), - }, - .set_jack = rt274_mic_detect, +static const struct snd_soc_component_driver soc_component_dev_rt274 = { + .probe = rt274_probe, + .remove = rt274_remove, + .suspend = rt274_suspend, + .resume = rt274_resume, + .set_bias_level = rt274_set_bias_level, + .set_jack = rt274_mic_detect, + .controls = rt274_snd_controls, + .num_controls = ARRAY_SIZE(rt274_snd_controls), + .dapm_widgets = rt274_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rt274_dapm_widgets), + .dapm_routes = rt274_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(rt274_dapm_routes), + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static const struct regmap_config rt274_regmap = { @@ -1191,7 +1189,8 @@ static int rt274_i2c_probe(struct i2c_client *i2c, } } - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt274, + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_rt274, rt274_dai, ARRAY_SIZE(rt274_dai)); return ret; @@ -1203,7 +1202,6 @@ static int rt274_i2c_remove(struct i2c_client *i2c) if (i2c->irq) free_irq(i2c->irq, rt274); - snd_soc_unregister_codec(&i2c->dev); return 0; }