From patchwork Tue Mar 13 16:46:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 131508 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp964287ljb; Tue, 13 Mar 2018 09:47:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELvhsU/QnbytPq6r5Ke3fku8mWHRboPCBjVrI8d396w8+8IHtHY/15XxxWRmEJjJpI7FZJBc X-Received: by 10.28.136.18 with SMTP id k18mr1355025wmd.111.1520959624814; Tue, 13 Mar 2018 09:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520959624; cv=none; d=google.com; s=arc-20160816; b=Ce3LKiMBq3fdFKCTutT+R4xRGhgwjjCk3hOWlSBLy3HMetYQNwuaS1JncS5qe77k5D Ms2npj29myQ/V9KMli0O8zRJZnYxsYoidH/wkpqpWXpR116T8PALZLrcwrXmmLn23jtx H69VjRlnnaYsvQhjVtKdrOKgDIG4Sd8lUwAb8S1MnpqZko6bImZ3j/aT4Y7hpZy8Aro+ Rn1MMNvHuqh1rmDKsShSLRrBKzbqcNp7Mg+mfts561fnWJNkgQh4RL0ezPEQ+S5Wvb2e nDqq93aETZnSqry6BiBqSynap888ifkJhCBC81y99acfwnN1GDXmgtHAkVftrW8zSf+q BBew== 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=G/KkLQuG5oG+eI94zAzKx5QR+ok5prNLpU+noTURqv4=; b=loi10J34TFxiJrcnP4lIWPOfTGlo5yhbS4GaGfPXBeTSAXe0J3cknGUFPpfvARo7EX xlgjplqz+hQr8WkmzA1/hRj7TgXGx0PBaM1cwFlc6e05k5/7/k1EeGbohoxd46lrRPYX HQWs85qd7p/eQ5608zXYTBFHf/iPawRYB24UlSa7cr+Gzm20Bf3zdmFzQ/nq1oDyfSKW 84Yzp3lxquypLZR7SXYFvCONnOt9pvQdZP7O8ocNDlBKdcReLZWB7wlhtleuct0lMvOw jIxqFYTQeRCqsr2ir6GGt1TvX68DBbmPLTLxYpwiQdAN9Vfjoq4I4yNTvfsml6mK+P0n fmSg== 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=gmZmMqLz; 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 v3si411038wrd.0.2018.03.13.09.47.04; Tue, 13 Mar 2018 09:47:04 -0700 (PDT) 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=gmZmMqLz; 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 1E6B1266F1C; Tue, 13 Mar 2018 17:47:03 +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 E3A672670A1; Tue, 13 Mar 2018 17:47:00 +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 6F4E2266E77 for ; Tue, 13 Mar 2018 17:46:58 +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=zax1csgO0lnC7IzReMp1K7UvH869G6xlchJSWMjcqY0=; b=gmZmMqLzfqGU FJOZfMo3nRiNZw+LXY99/Ath3FUeTMNcEXtgzUsI4UJHIoYuGBIuj4WQFijFLRcG3EsRTqp9Qq+g3 i8OYDwNSx9VKD6F75KCcsu09Ag3KmjreUhhgwGwU0qNPOXGcqzDeHcJBaaHY6oJZGahQxJ6IUpwqD 19Bok=; Received: from [67.208.111.18] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1evn4i-0007mq-EZ; Tue, 13 Mar 2018 16:46:56 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 4F7FC440079; Tue, 13 Mar 2018 16:46:54 +0000 (GMT) From: Mark Brown To: Srinivas Kandagatla In-Reply-To: <20180310023727.27077-1-srinivas.kandagatla@linaro.org> Message-Id: <20180313164654.4F7FC440079@finisterre.ee.mobilebroadband> Date: Tue, 13 Mar 2018 16:46:54 +0000 (GMT) Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Mark Brown , Liam Girdwood , Takashi Iwai Subject: [alsa-devel] Applied "ASoC: dapm: add support to pinctrl dapm" 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: dapm: add support to pinctrl dapm 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 5b2d15bbd1eeb3d787c8e6459a8cb2645f336050 Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla Date: Sat, 10 Mar 2018 02:37:27 +0000 Subject: [PATCH] ASoC: dapm: add support to pinctrl dapm Purpose of having pinctrl dapm is to dynamically put the pins in low power state when they are not actively used by the audio and saving power. Without this each driver has to set the pinctrl states, either during probe or dynamically depending on the callbacks received from ASoC core. Signed-off-by: Srinivas Kandagatla Signed-off-by: Mark Brown --- include/sound/soc-dapm.h | 16 ++++++++++++++++ sound/soc/soc-dapm.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) -- 2.16.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 344b96c206a3..a6ce2de4e20a 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -269,6 +269,13 @@ struct device; .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \ .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD, \ .on_val = wflags} +#define SND_SOC_DAPM_PINCTRL(wname, active, sleep) \ +{ .id = snd_soc_dapm_pinctrl, .name = wname, \ + .priv = (&(struct snd_soc_dapm_pinctrl_priv) \ + { .active_state = active, .sleep_state = sleep,}), \ + .reg = SND_SOC_NOPM, .event = dapm_pinctrl_event, \ + .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD } + /* dapm kcontrol types */ @@ -374,6 +381,8 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); int dapm_clock_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); +int dapm_pinctrl_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event); /* dapm controls */ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, @@ -500,6 +509,7 @@ enum snd_soc_dapm_type { snd_soc_dapm_pre, /* machine specific pre widget - exec first */ snd_soc_dapm_post, /* machine specific post widget - exec last */ snd_soc_dapm_supply, /* power/clock supply */ + snd_soc_dapm_pinctrl, /* pinctrl */ snd_soc_dapm_regulator_supply, /* external regulator */ snd_soc_dapm_clock_supply, /* external clock */ snd_soc_dapm_aif_in, /* audio interface input */ @@ -581,6 +591,7 @@ struct snd_soc_dapm_widget { void *priv; /* widget specific data */ struct regulator *regulator; /* attached regulator */ + struct pinctrl *pinctrl; /* attached pinctrl */ const struct snd_soc_pcm_stream *params; /* params for dai links */ unsigned int num_params; /* number of params for dai links */ unsigned int params_select; /* currently selected param for dai link */ @@ -683,6 +694,11 @@ struct snd_soc_dapm_stats { int neighbour_checks; }; +struct snd_soc_dapm_pinctrl_priv { + const char *active_state; + const char *sleep_state; +}; + /** * snd_soc_dapm_init_bias_level() - Initialize DAPM bias level * @dapm: The DAPM context to initialize diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 92894d9cac19..a5fb4d404c99 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -72,6 +73,7 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, static int dapm_up_seq[] = { [snd_soc_dapm_pre] = 0, [snd_soc_dapm_regulator_supply] = 1, + [snd_soc_dapm_pinctrl] = 1, [snd_soc_dapm_clock_supply] = 1, [snd_soc_dapm_supply] = 2, [snd_soc_dapm_micbias] = 3, @@ -121,6 +123,7 @@ static int dapm_down_seq[] = { [snd_soc_dapm_dai_link] = 11, [snd_soc_dapm_supply] = 12, [snd_soc_dapm_clock_supply] = 13, + [snd_soc_dapm_pinctrl] = 13, [snd_soc_dapm_regulator_supply] = 13, [snd_soc_dapm_post] = 14, }; @@ -1289,6 +1292,31 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, } EXPORT_SYMBOL_GPL(dapm_regulator_event); +/* + * Handler for pinctrl widget. + */ +int dapm_pinctrl_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_dapm_pinctrl_priv *priv = w->priv; + struct pinctrl *p = w->pinctrl; + struct pinctrl_state *s; + + if (!p || !priv) + return -EIO; + + if (SND_SOC_DAPM_EVENT_ON(event)) + s = pinctrl_lookup_state(p, priv->active_state); + else + s = pinctrl_lookup_state(p, priv->sleep_state); + + if (IS_ERR(s)) + return PTR_ERR(s); + + return pinctrl_select_state(p, s); +} +EXPORT_SYMBOL_GPL(dapm_pinctrl_event); + /* * Handler for clock supply widget. */ @@ -1902,6 +1930,7 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event) break; case snd_soc_dapm_supply: case snd_soc_dapm_regulator_supply: + case snd_soc_dapm_pinctrl: case snd_soc_dapm_clock_supply: case snd_soc_dapm_micbias: if (d->target_bias_level < SND_SOC_BIAS_STANDBY) @@ -2315,6 +2344,7 @@ static ssize_t dapm_widget_show_component(struct snd_soc_component *cmpnt, case snd_soc_dapm_mixer_named_ctl: case snd_soc_dapm_supply: case snd_soc_dapm_regulator_supply: + case snd_soc_dapm_pinctrl: case snd_soc_dapm_clock_supply: if (w->name) count += sprintf(buf + count, "%s: %s\n", @@ -3464,6 +3494,17 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, w->name, ret); } break; + case snd_soc_dapm_pinctrl: + w->pinctrl = devm_pinctrl_get(dapm->dev); + if (IS_ERR_OR_NULL(w->pinctrl)) { + ret = PTR_ERR(w->pinctrl); + if (ret == -EPROBE_DEFER) + return ERR_PTR(ret); + dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n", + w->name, ret); + return NULL; + } + break; case snd_soc_dapm_clock_supply: #ifdef CONFIG_CLKDEV_LOOKUP w->clk = devm_clk_get(dapm->dev, w->name); @@ -3543,6 +3584,7 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, break; case snd_soc_dapm_supply: case snd_soc_dapm_regulator_supply: + case snd_soc_dapm_pinctrl: case snd_soc_dapm_clock_supply: case snd_soc_dapm_kcontrol: w->is_supply = 1;