From patchwork Thu Oct 11 16:28:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 10637061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1455B5CAF for ; Thu, 11 Oct 2018 17:06:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F31AE2BA75 for ; Thu, 11 Oct 2018 17:06:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7C3E2BCDF; Thu, 11 Oct 2018 17:06:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C78EA2BA75 for ; Thu, 11 Oct 2018 17:06:44 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BD6C92678FE; Thu, 11 Oct 2018 18:28:41 +0200 (CEST) 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 0A9B3267948; Thu, 11 Oct 2018 18:28:40 +0200 (CEST) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by alsa0.perex.cz (Postfix) with ESMTP id 617832678E9 for ; Thu, 11 Oct 2018 18:28:36 +0200 (CEST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9BGSZSM020805; Thu, 11 Oct 2018 11:28:35 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail3.cirrus.com ([87.246.76.56]) by mx0b-001ae601.pphosted.com with ESMTP id 2mxu49892n-1; Thu, 11 Oct 2018 11:28:33 -0500 Received: from EX17.ad.cirrus.com (ex17.ad.cirrus.com [172.20.9.81]) by mail3.cirrus.com (Postfix) with ESMTP id 91648611C8B5; Thu, 11 Oct 2018 11:30:45 -0500 (CDT) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Thu, 11 Oct 2018 17:28:31 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id w9BGSVIS010322; Thu, 11 Oct 2018 17:28:31 +0100 From: Charles Keepax To: Date: Thu, 11 Oct 2018 17:28:29 +0100 Message-ID: <20181011162831.26351-3-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181011162831.26351-1-ckeepax@opensource.cirrus.com> References: <20181011162831.26351-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810110158 Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, lgirdwood@gmail.com Subject: [alsa-devel] [RFC PATCH 2/4] ASoC: dapm: Add support for a rate domain widget 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Some CODECs can support multiple sample rates internally but frequently groups of functionality will be force to the run on the same sample rate. For example, perhaps all the DACs are required to run at a single rate. Utimately, it would be ideal if the sample rates could be propagated through from the top level DAI links to these groups of widgets. This should allow more complex use-cases involving multiple sample rates to be connected and will also allow detection of errors where blocks with incompatible sample rates are connected. A first step in this process is to provide a mechanism that documents which blocks are tidied together with respect to sample rate and track when they are in use. This is acheived by adding a supply like widget that represents a group of widgets that are bound to a single sample rate. This domain widget should be connected to all inputs and outputs to the group of widgets, that way it will power up whenever anything in that group of widgets does. Signed-off-by: Charles Keepax --- include/sound/soc-dapm.h | 4 ++++ sound/soc/soc-dapm.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index bd8163f151cb8..c0ef27b2d4b22 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -273,6 +273,9 @@ struct device; .reg = SND_SOC_NOPM, .event = dapm_pinctrl_event, \ .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD } +#define SND_SOC_DAPM_RATE(wname, wreg, wshift, winvert, wops, wpriv) \ +{ .id = snd_soc_dapm_rate, .name = wname, \ + SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert) } /* dapm kcontrol types */ @@ -519,6 +522,7 @@ enum snd_soc_dapm_type { snd_soc_dapm_asrc, /* DSP/CODEC ASRC component */ snd_soc_dapm_encoder, /* FW/SW audio encoder component */ snd_soc_dapm_decoder, /* FW/SW audio decoder component */ + snd_soc_dapm_rate, /* Rate group */ }; enum snd_soc_dapm_subclass { diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index a5178845065b3..7e3858d1e81dc 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -68,6 +68,7 @@ static int dapm_up_seq[] = { [snd_soc_dapm_regulator_supply] = 1, [snd_soc_dapm_pinctrl] = 1, [snd_soc_dapm_clock_supply] = 1, + [snd_soc_dapm_rate] = 2, [snd_soc_dapm_supply] = 2, [snd_soc_dapm_micbias] = 3, [snd_soc_dapm_dai_link] = 2, @@ -115,6 +116,7 @@ static int dapm_down_seq[] = { [snd_soc_dapm_dai_out] = 10, [snd_soc_dapm_dai_link] = 11, [snd_soc_dapm_supply] = 12, + [snd_soc_dapm_rate] = 12, [snd_soc_dapm_clock_supply] = 13, [snd_soc_dapm_pinctrl] = 13, [snd_soc_dapm_regulator_supply] = 13, @@ -1912,6 +1914,7 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event) case snd_soc_dapm_vmid: break; case snd_soc_dapm_supply: + case snd_soc_dapm_rate: case snd_soc_dapm_regulator_supply: case snd_soc_dapm_pinctrl: case snd_soc_dapm_clock_supply: @@ -2326,6 +2329,7 @@ static ssize_t dapm_widget_show_component(struct snd_soc_component *cmpnt, case snd_soc_dapm_mixer: case snd_soc_dapm_mixer_named_ctl: case snd_soc_dapm_supply: + case snd_soc_dapm_rate: case snd_soc_dapm_regulator_supply: case snd_soc_dapm_pinctrl: case snd_soc_dapm_clock_supply: @@ -3522,6 +3526,7 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, w->power_check = dapm_generic_check_power; break; case snd_soc_dapm_supply: + case snd_soc_dapm_rate: case snd_soc_dapm_regulator_supply: case snd_soc_dapm_pinctrl: case snd_soc_dapm_clock_supply: