Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp106451lqg; Fri, 26 Apr 2024 09:59:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIogXvt9LbRsSsVp+Xxa1jmrHiocptIxEzIIZH61N1vqjQ69eJn0CB+blB9kb6xnZOMPnGLBI1l/LOBn39D/ZSUOk+yn9mvq63xkCNVw== X-Google-Smtp-Source: AGHT+IEnBHkvWBG3eAepmkJeD1ByeUZMf3c18KqAgSOxBhUgGnDUXk4mmmh+K0IqOYNB8tGNuef2 X-Received: by 2002:a05:6808:298e:b0:3c7:2d96:a385 with SMTP id ex14-20020a056808298e00b003c72d96a385mr3234536oib.6.1714150748404; Fri, 26 Apr 2024 09:59:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714150748; cv=pass; d=google.com; s=arc-20160816; b=WQA32b8lMGNxdVB0RCHbd1/egFy/UmGoBJjiLdov7nyV4wFE8/uRFdrMEBNW3WTvOZ ufHx8q/68MbLcZP5ezqcotX64gfexRYRlFOCsKbpbPqWRyoYDIzjVc8f5627nI6bcRg5 16oRY5OONKSvBIObLmOeJ9XPS6InR8TBIk1gbJ74stQc+uyZFPJruII3c0nPCZbAQTzK MOiiGUUNpoEZD8IcufJn6i+ux/9pWkoa00UB1Hvv+n7ChSO+zI6uHbb5+ddeUXKfV9TW 5y/p3rhWbIe+79P+YJbtoJ1sToMCw9kl/rtOh+tw4wJUCMCMZOy7+33RTOwJEU1wRcS0 a3bw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=Yg5gNzFKL5u/fDNdHuMLTH3QOE35rAIDeXoigKMZYRQ=; fh=nltZftsxQXuWoLpedj6X+btMoFrrKx13QYCe+HaZVzI=; b=i1bUY+TdSEAM8kT48fmt0W82fCpBBBKJ1PpbUsIrDkfJtiAYx+WsowIiXvoZEf1pPE GWPmKcNLdvV2dEd++MfOCUW3PgRZormMN3TT9l1gafhwjMwXMyXGOUAIRugsTCp7Eb6v qYGtl8bnIQxb/35xlQa1KQfRvDScmYgNLGqVEZ4zjEU4DNA7fOAZ9KGteR9phLkIqfWG itRvnhFpBJhuIBnwdT9T63QkcIBRywrO0w/pFHccrjF/m2vbzQNvwhvrtvXBr1fbqRyt 9nk3Izjh4gLGxjbALWQpKfCDCMgaSVjQ4339z+iop9kpqXFCFuJmeKBCiRAGZHWO6wGT v/mA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=esdeqpag; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-160428-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ye14-20020a05620a3b8e00b00790a45f2bfcsi3186578qkn.653.2024.04.26.09.59.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 09:59:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160428-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=esdeqpag; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-160428-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 22D9D1C203AC for ; Fri, 26 Apr 2024 16:59:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 492F117165A; Fri, 26 Apr 2024 16:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="esdeqpag" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BB8416FF39; Fri, 26 Apr 2024 16:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714150620; cv=none; b=SsNe8qPy7OXjBdF1gH3XJQ3ZuUq3xsBwcjtXJ/+D0vBVzzSzMW/KiZMwIwn7MrhhmG6nh3J6pl1+D62X/FlyzZHSbfOd4umobSNGN85IHZObvy9szDMJXfajoAsnGdlb7BDORIWTvflvwo1SvyUrqse7GDf3loryGSCqwYDXKCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714150620; c=relaxed/simple; bh=ZFg7sIJ9crczjv/BDIte8s7MP3nZeUb9WTkFeJyccUg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YouiLkQfVayO+S5VI/ukOsndo3eiREscKNBO4rEhlpAwgtppY0TK6Tku4VYAItbeSXusrA3/hqFza7xe2xChpNk2fTHNbxdhyw/cRBTQurKbQNGaHI7sYP98WQ5b+buLmiW/g6L2f/W1+1I/+/RV9c50/Q+irbJ9J5oiBXB1wzQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=esdeqpag; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 0228AFF807; Fri, 26 Apr 2024 16:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1714150616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yg5gNzFKL5u/fDNdHuMLTH3QOE35rAIDeXoigKMZYRQ=; b=esdeqpagdxcHH+IWfmoEI0xxDBZHisgParjZBUZTnM44mSB+BWPdr8e7ko1fzn1lAQr2Ba ukp78m25sAYeLdaSpFexfnBVjATKfnXxa4oTlMgx9nxmWXH1n+AfHdWxPSzkKlY5t0yygL p4A819tOAaAcstBzJftM4AWupRmCDkIXSWJKgJMmi5bzB2VHicmlktamcnkWPZXKuT5pXT jtoJFsBKRt2iGwcjZPabvHur2J8j1a3b/lqVb54VDIsfohnJ5kK67fFILl4qik31pxdOgr DIGokBGPugPAFcf8+gD20W+2c3zJUiiLKbaRhQAqCNUHwlpePjcrPaCrqMEYDA== From: Luca Ceresoli Date: Fri, 26 Apr 2024 18:56:44 +0200 Subject: [PATCH v2 11/12] ASoC: doc: dapm: update section "DAPM Widget Events" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240426-dapm-docs-v2-11-87b07547eb5b@bootlin.com> References: <20240426-dapm-docs-v2-0-87b07547eb5b@bootlin.com> In-Reply-To: <20240426-dapm-docs-v2-0-87b07547eb5b@bootlin.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Jonathan Corbet Cc: Alexandre Belloni , Bagas Sanjaya , Thomas Petazzoni , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.13.0 X-GND-Sasl: luca.ceresoli@bootlin.com The example in this section is not in the kernel sources anymore. Replace it with an up to date code fragment. Reword the initial paragraph. Remove "Please" which is not standard practice in documentation. Reviewed-by: Alexandre Belloni Signed-off-by: Luca Ceresoli --- Documentation/sound/soc/dapm.rst | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Documentation/sound/soc/dapm.rst b/Documentation/sound/soc/dapm.rst index 6096334226c0..da9313e10fd4 100644 --- a/Documentation/sound/soc/dapm.rst +++ b/Documentation/sound/soc/dapm.rst @@ -377,23 +377,29 @@ jacks can also be switched OFF. DAPM Widget Events ================== -Some widgets can register their interest with the DAPM core in PM events. -e.g. A Speaker with an amplifier registers a widget so the amplifier can be -powered only when the spk is in use. -:: +Widgets needing to implement a more complex behaviour than what DAPM can do +can set a custom "event handler" by setting a function pointer. An example +is a power supply needing to enable a GPIO:: - /* turn speaker amplifier on/off depending on use */ - static int corgi_amp_event(struct snd_soc_dapm_widget *w, int event) + static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) { - gpio_set_value(CORGI_GPIO_APM_ON, SND_SOC_DAPM_EVENT_ON(event)); - return 0; + if (SND_SOC_DAPM_EVENT_ON(event)) + gpiod_set_value_cansleep(gpio_pa, true); + else + gpiod_set_value_cansleep(gpio_pa, false); + + return 0; } - /* corgi machine dapm widgets */ - static const struct snd_soc_dapm_widget wm8731_dapm_widgets = - SND_SOC_DAPM_SPK("Ext Spk", corgi_amp_event); + static const struct snd_soc_dapm_widget st_widgets[] = { + ... + SND_SOC_DAPM_SUPPLY("Speaker Power", SND_SOC_NOPM, 0, 0, + sof_es8316_speaker_power_event, + SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), + }; -Please see soc-dapm.h for all other widgets that support events. +See soc-dapm.h for all other widgets that support events. Event types -- 2.34.1