From patchwork Mon Feb 12 12:41:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128047 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3197705ljc; Mon, 12 Feb 2018 05:13:56 -0800 (PST) X-Google-Smtp-Source: AH8x227titNzQGoyyq3iRol6SEV4VSFNZtwfFN2HiTcDrt8ZRQHyrw1qd3RSYf6iuumAQA3hvaQN X-Received: by 10.28.209.206 with SMTP id i197mr3299529wmg.102.1518441236786; Mon, 12 Feb 2018 05:13:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441236; cv=none; d=google.com; s=arc-20160816; b=i5zCjKk84xhJ1Wad22m6wheb1VZvf2KKVRxW7Z056cLd9AxqEImZFQL7fAyRzEKiSg htqB5AobMi4nLZf8lNpEoogLgo6XbukmGw40S/30qnVLCCm8MbFEWOvfcSExGT8yMRb9 Ea74VEirakjZPO1dWYY4N7ZiZL/bxr6uFAWGSbma7H80JHgY1lSXgGXlBzU9Igb9zCnw Ri+lrOW+ZMco4+GJxhMI1gROogMc/Eh7FcXKQsw3NqDn+v8yTSPYJfqJot7+kXcuoLw+ Bs62F44nH+K5c7qExpp/tDQb0IDW6ij0aGy1ek6Fz/3dWFBgggfZGHN7L54F5SyfRFJ4 1dVQ== 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=p5QneChUKUnrsQG3gGXJVFYEtYZdYHXSLRvbLtBIcdQ=; b=sVOhDG700UgAiO7TVMCrdzCZ66lSD213g8HIcL8P0S5GdYGnRLpJgzUH3SbKqKrfG3 JBb2jilNU1WXhcADvzCwUsMTc+gcISIZ6XC68sQhJ3liB9YUwJJJ12dzHI65IEbvxFrE 6+kJ+MhJTe1ZM37llB7xDUVFkNAs2sQlal3B4T0z7gZXHTDyL3d5lkjGiF9X5jk3uWF/ lkP8sANNljd4eZth2SRx6gbcpV31t+AAjb/rpzjTGvQBwYmmthXg5qyMiwwTt5mBeVnt yoR2sKOeeo8BBqzq4ynr3xWaTK8E1NM9zKY+zoUElgeFvdGZd9JK4a5LehcXc3hRGTxK M6IA== 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=u5+yXUSQ; 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 s5si6399141wre.305.2018.02.12.05.13.56; Mon, 12 Feb 2018 05:13:56 -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=u5+yXUSQ; 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 116B9267C30; Mon, 12 Feb 2018 14:13:23 +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 E2BB12684DF; Mon, 12 Feb 2018 14:13:21 +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 C1BDB267C3E for ; Mon, 12 Feb 2018 13:41:47 +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=/dsosm9Ct4aFt8MG6LzyC1LwuPgNAgqaqr+UXa1Yme4=; b=u5+yXUSQDUD4 G5nHMeR+c9cg8FyUJY5aQN+LDtgMkJ9/dSCDNBMduRcfF46LW8OtDsCnO+V0rl7ZwMIwlKFwyMV/O Q43IfUA+SxS+lwkBCmlAfAp/My0uRnQAuk4noA+pSjmrJMCfbxK6rPvo3K4fsu8v5+ZdCJeBSihVB Cu/lA=; 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 1elDQX-0002H3-QM; Mon, 12 Feb 2018 12:41:45 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDQX-0004tC-Ci; Mon, 12 Feb 2018 12:41:45 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87shapz4zr.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:41:45 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: max9850: 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: max9850: 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 0b3eda289c5cf84b7b1a5245812370accece2f19 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 04:04:34 +0000 Subject: [PATCH] ASoC: max9850: 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 = 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 Signed-off-by: Mark Brown --- sound/soc/codecs/max9850.c | 80 +++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 43 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/max9850.c b/sound/soc/codecs/max9850.c index a3dfc918c278..74d7f52c7e73 100644 --- a/sound/soc/codecs/max9850.c +++ b/sound/soc/codecs/max9850.c @@ -130,8 +130,8 @@ static int max9850_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 max9850_priv *max9850 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component); u64 lrclk_div; u8 sf, da; @@ -139,14 +139,14 @@ static int max9850_hw_params(struct snd_pcm_substream *substream, return -EINVAL; /* lrclk_div = 2^22 * rate / iclk with iclk = mclk / sf */ - sf = (snd_soc_read(codec, MAX9850_CLOCK) >> 2) + 1; + sf = (snd_soc_component_read32(component, MAX9850_CLOCK) >> 2) + 1; lrclk_div = (1 << 22); lrclk_div *= params_rate(params); lrclk_div *= sf; do_div(lrclk_div, max9850->sysclk); - snd_soc_write(codec, MAX9850_LRCLK_MSB, (lrclk_div >> 8) & 0x7f); - snd_soc_write(codec, MAX9850_LRCLK_LSB, lrclk_div & 0xff); + snd_soc_component_write(component, MAX9850_LRCLK_MSB, (lrclk_div >> 8) & 0x7f); + snd_soc_component_write(component, MAX9850_LRCLK_LSB, lrclk_div & 0xff); switch (params_width(params)) { case 16: @@ -161,7 +161,7 @@ static int max9850_hw_params(struct snd_pcm_substream *substream, default: return -EINVAL; } - snd_soc_update_bits(codec, MAX9850_DIGITAL_AUDIO, 0x3, da); + snd_soc_component_update_bits(component, MAX9850_DIGITAL_AUDIO, 0x3, da); return 0; } @@ -169,16 +169,16 @@ static int max9850_hw_params(struct snd_pcm_substream *substream, static int max9850_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 max9850_priv *max9850 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component); /* calculate mclk -> iclk divider */ if (freq <= 13000000) - snd_soc_write(codec, MAX9850_CLOCK, 0x0); + snd_soc_component_write(component, MAX9850_CLOCK, 0x0); else if (freq <= 26000000) - snd_soc_write(codec, MAX9850_CLOCK, 0x4); + snd_soc_component_write(component, MAX9850_CLOCK, 0x4); else if (freq <= 40000000) - snd_soc_write(codec, MAX9850_CLOCK, 0x8); + snd_soc_component_write(component, MAX9850_CLOCK, 0x8); else return -EINVAL; @@ -188,7 +188,7 @@ static int max9850_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int max9850_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 da = 0; /* set master/slave audio interface */ @@ -234,15 +234,15 @@ static int max9850_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) } /* set da */ - snd_soc_write(codec, MAX9850_DIGITAL_AUDIO, da); + snd_soc_component_write(component, MAX9850_DIGITAL_AUDIO, da); return 0; } -static int max9850_set_bias_level(struct snd_soc_codec *codec, +static int max9850_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct max9850_priv *max9850 = snd_soc_codec_get_drvdata(codec); + struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component); int ret; switch (level) { @@ -251,10 +251,10 @@ static int max9850_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_PREPARE: 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 = regcache_sync(max9850->regmap); if (ret) { - dev_err(codec->dev, + dev_err(component->dev, "Failed to sync cache: %d\n", ret); return ret; } @@ -289,31 +289,32 @@ static struct snd_soc_dai_driver max9850_dai = { .ops = &max9850_dai_ops, }; -static int max9850_probe(struct snd_soc_codec *codec) +static int max9850_probe(struct snd_soc_component *component) { /* enable zero-detect */ - snd_soc_update_bits(codec, MAX9850_GENERAL_PURPOSE, 1, 1); + snd_soc_component_update_bits(component, MAX9850_GENERAL_PURPOSE, 1, 1); /* enable slew-rate control */ - snd_soc_update_bits(codec, MAX9850_VOLUME, 0x40, 0x40); + snd_soc_component_update_bits(component, MAX9850_VOLUME, 0x40, 0x40); /* set slew-rate 125ms */ - snd_soc_update_bits(codec, MAX9850_CHARGE_PUMP, 0xff, 0xc0); + snd_soc_component_update_bits(component, MAX9850_CHARGE_PUMP, 0xff, 0xc0); return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_max9850 = { - .probe = max9850_probe, - .set_bias_level = max9850_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = max9850_controls, - .num_controls = ARRAY_SIZE(max9850_controls), - .dapm_widgets = max9850_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(max9850_dapm_widgets), - .dapm_routes = max9850_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(max9850_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_dev_max9850 = { + .probe = max9850_probe, + .set_bias_level = max9850_set_bias_level, + .controls = max9850_controls, + .num_controls = ARRAY_SIZE(max9850_controls), + .dapm_widgets = max9850_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(max9850_dapm_widgets), + .dapm_routes = max9850_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(max9850_dapm_routes), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int max9850_i2c_probe(struct i2c_client *i2c, @@ -333,17 +334,11 @@ static int max9850_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, max9850); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_max9850, &max9850_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_max9850, &max9850_dai, 1); return ret; } -static int max9850_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id max9850_i2c_id[] = { { "max9850", 0 }, { } @@ -355,7 +350,6 @@ static struct i2c_driver max9850_i2c_driver = { .name = "max9850", }, .probe = max9850_i2c_probe, - .remove = max9850_i2c_remove, .id_table = max9850_i2c_id, };