From patchwork Mon Feb 12 12:45:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 128090 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3205327ljc; Mon, 12 Feb 2018 05:23:15 -0800 (PST) X-Google-Smtp-Source: AH8x224R6kPsfDky8k37T/r0Ogg9EzdGJEijjZ8q7vxCHVul8Yl+Z/ra7mD3B+JbYHkVX6dvU72r X-Received: by 10.223.157.129 with SMTP id p1mr9639860wre.95.1518441795145; Mon, 12 Feb 2018 05:23:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441795; cv=none; d=google.com; s=arc-20160816; b=cOaSVLtvDl/28hyKHVMwERks5XPkqAKkJ6Axg3V6sZfrDHYNCB/MSnFsz7GQQyKPgA LUoVygLD6KC+O4uxXMpdpBqYzyHuBTbX7xN6DyL7Brs3BAc1NAM7r0KwzjRfPABFQdb9 DDNQJlAEq8OMlfyKf+iJQFV8IZV89tKCqhLa52VW6fLRWTqcsX9rv/etl9gxpIs1bDO+ Dbelle5SnPEkTsvpPaqC3ASBCOTIxPfFO+Xg8chChosxsPDulyoaiP9YhotHGHU5glDA +ZcwZZ0Ec54dVPUexhZiMT9LpimH6Cd506YKh7IJUiMP1co9PeF1+DzqOXKPXZ5gDgIy ZnQA== 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=UKGxA9a6yI9qAsXbj49lek10/nH/58ToNNyQaC21a6I=; b=YEnZICI0+GuMlbfQJygVNR2tKolmtisOGl387hsKieGos5VsRjYgcVV+CgDGfNs3UR NiSrS+YrGN1kM7O4tk5xYHQOX+Bi3L3C4fH0vBhikRc1j/kUWYoTJxK5em2OvH4mODIA CVxWMwkvBM5s3cxVnOoa0S0kbNiSzj69JgX5Os3x7YBzzwyOePmwLakjtiOk1sxVLn4S HzLNugsI/Nx9DY4J4EKvF6V3//ju6+obyPYL3Ks+X9saNYtxjvsDft8dSwPwR1zlYyYz pOEjX8s9uLGpjOgvOUue5UsShR6yZN4YtCKDhXQaMTPv3mDWJ5/lXt7f2hsbnwwsy7i7 OYAg== 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=BkSDhQAh; 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 f66si3907208wmf.73.2018.02.12.05.23.14; Mon, 12 Feb 2018 05:23:15 -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=BkSDhQAh; 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 D93DC267D26; Mon, 12 Feb 2018 14:20:24 +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 050B12687E3; Mon, 12 Feb 2018 14:20:24 +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 915152678E4 for ; Mon, 12 Feb 2018 13:45:55 +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=sV9BKFxmbSSxePpDZbLdSmQE+v1Xu8Up1un98FCHgxg=; b=BkSDhQAhlRhQ nBL3q06BBu1mdrwaD0qj6a+CXvfNuL5Qe/EXbhlR7o2gAryuzNcw9fJUfNSfEQLpErunZWltqSws/ JY6g4VDSjmwYgSX8jYgkDmoLDzAELvTC5VKc7uClM8A5OfOVZ90QgRFOR8hj6NWmQbFysiWIOL23B Ucl4Y=; 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 1elDUX-0002R4-Mx; Mon, 12 Feb 2018 12:45:53 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1elDUX-0005PS-94; Mon, 12 Feb 2018 12:45:53 +0000 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87a7wx2w99.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Mon, 12 Feb 2018 12:45:53 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: ak4535: 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: ak4535: 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 d229c0bedc6117b71419250bfebbcd83c161daa6 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 29 Jan 2018 03:14:17 +0000 Subject: [PATCH] ASoC: ak4535: 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/ak4535.c | 78 ++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 42 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/ak4535.c b/sound/soc/codecs/ak4535.c index e3c157dc88db..31f609910bd6 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c @@ -251,8 +251,8 @@ static const struct snd_soc_dapm_route ak4535_audio_map[] = { static int ak4535_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 ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct ak4535_priv *ak4535 = snd_soc_component_get_drvdata(component); ak4535->sysclk = freq; return 0; @@ -262,9 +262,9 @@ static int ak4535_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 ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec); - u8 mode2 = snd_soc_read(codec, AK4535_MODE2) & ~(0x3 << 5); + struct snd_soc_component *component = dai->component; + struct ak4535_priv *ak4535 = snd_soc_component_get_drvdata(component); + u8 mode2 = snd_soc_component_read32(component, AK4535_MODE2) & ~(0x3 << 5); int rate = params_rate(params), fs = 256; if (rate) @@ -283,14 +283,14 @@ static int ak4535_hw_params(struct snd_pcm_substream *substream, } /* set rate */ - snd_soc_write(codec, AK4535_MODE2, mode2); + snd_soc_component_write(component, AK4535_MODE2, mode2); return 0; } static int ak4535_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 mode1 = 0; /* interface format */ @@ -308,37 +308,37 @@ static int ak4535_set_dai_fmt(struct snd_soc_dai *codec_dai, /* use 32 fs for BCLK to save power */ mode1 |= 0x4; - snd_soc_write(codec, AK4535_MODE1, mode1); + snd_soc_component_write(component, AK4535_MODE1, mode1); return 0; } static int ak4535_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - u16 mute_reg = snd_soc_read(codec, AK4535_DAC); + struct snd_soc_component *component = dai->component; + u16 mute_reg = snd_soc_component_read32(component, AK4535_DAC); if (!mute) - snd_soc_write(codec, AK4535_DAC, mute_reg & ~0x20); + snd_soc_component_write(component, AK4535_DAC, mute_reg & ~0x20); else - snd_soc_write(codec, AK4535_DAC, mute_reg | 0x20); + snd_soc_component_write(component, AK4535_DAC, mute_reg | 0x20); return 0; } -static int ak4535_set_bias_level(struct snd_soc_codec *codec, +static int ak4535_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { switch (level) { case SND_SOC_BIAS_ON: - snd_soc_update_bits(codec, AK4535_DAC, 0x20, 0); + snd_soc_component_update_bits(component, AK4535_DAC, 0x20, 0); break; case SND_SOC_BIAS_PREPARE: - snd_soc_update_bits(codec, AK4535_DAC, 0x20, 0x20); + snd_soc_component_update_bits(component, AK4535_DAC, 0x20, 0x20); break; case SND_SOC_BIAS_STANDBY: - snd_soc_update_bits(codec, AK4535_PM1, 0x80, 0x80); - snd_soc_update_bits(codec, AK4535_PM2, 0x80, 0); + snd_soc_component_update_bits(component, AK4535_PM1, 0x80, 0x80); + snd_soc_component_update_bits(component, AK4535_PM2, 0x80, 0); break; case SND_SOC_BIAS_OFF: - snd_soc_update_bits(codec, AK4535_PM1, 0x80, 0); + snd_soc_component_update_bits(component, AK4535_PM1, 0x80, 0); break; } return 0; @@ -372,9 +372,9 @@ static struct snd_soc_dai_driver ak4535_dai = { .ops = &ak4535_dai_ops, }; -static int ak4535_resume(struct snd_soc_codec *codec) +static int ak4535_resume(struct snd_soc_component *component) { - snd_soc_cache_sync(codec); + snd_soc_component_cache_sync(component); return 0; } @@ -390,19 +390,20 @@ static const struct regmap_config ak4535_regmap = { .num_reg_defaults = ARRAY_SIZE(ak4535_reg_defaults), }; -static const struct snd_soc_codec_driver soc_codec_dev_ak4535 = { - .resume = ak4535_resume, - .set_bias_level = ak4535_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = ak4535_snd_controls, - .num_controls = ARRAY_SIZE(ak4535_snd_controls), - .dapm_widgets = ak4535_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets), - .dapm_routes = ak4535_audio_map, - .num_dapm_routes = ARRAY_SIZE(ak4535_audio_map), - }, +static const struct snd_soc_component_driver soc_component_dev_ak4535 = { + .resume = ak4535_resume, + .set_bias_level = ak4535_set_bias_level, + .controls = ak4535_snd_controls, + .num_controls = ARRAY_SIZE(ak4535_snd_controls), + .dapm_widgets = ak4535_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets), + .dapm_routes = ak4535_audio_map, + .num_dapm_routes = ARRAY_SIZE(ak4535_audio_map), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; static int ak4535_i2c_probe(struct i2c_client *i2c, @@ -425,18 +426,12 @@ static int ak4535_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, ak4535); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_ak4535, &ak4535_dai, 1); + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_component_dev_ak4535, &ak4535_dai, 1); return ret; } -static int ak4535_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id ak4535_i2c_id[] = { { "ak4535", 0 }, { } @@ -448,7 +443,6 @@ static struct i2c_driver ak4535_i2c_driver = { .name = "ak4535", }, .probe = ak4535_i2c_probe, - .remove = ak4535_i2c_remove, .id_table = ak4535_i2c_id, };