Message ID | 20240118165811.13672-4-johan+linaro@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-30385-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp478417dyb; Thu, 18 Jan 2024 08:59:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSQhxqp/GX/EExh8yxZ8PFCjZ6H0BdlhuCYhyDL5lKIgkZUR3+lCSJDAynCKUlqPe5bjr3 X-Received: by 2002:ac8:5c12:0:b0:42a:1eb3:ca33 with SMTP id i18-20020ac85c12000000b0042a1eb3ca33mr617620qti.126.1705597187264; Thu, 18 Jan 2024 08:59:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705597187; cv=pass; d=google.com; s=arc-20160816; b=FIDfiqId6GYzA2foez3nphCVSOafcxYsbvYo+29fjVhn4DGjmOfN3G9HBQsU9IsIY1 jRVTSbQ85nBNumxXPARHuLFJaU9DOm76I6QyQUX4lK2ryZFtmGinjd/p8uEJaJahha5g 9CopqCqAmV8EUIxwJV9/jUy3TYWbcs85Mb6Vl9BKF9LFYIbJS/yprjvlYttxqjCFpHbX S8nmOaJdPrwum9ePySc4TkVQs8boVZ+SsAOJckC81M3xTKzDkJswBpW5FkF5wiMefpUJ Uhs26t00vAzslELo5sIkWYS7/AxqmeiBb5feA+stfUpInfqE0qzhLNFy2QhlvYx3x36u nV7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=WfwngcY3tQ0NHHHOCXOUcHQdYt4hfrWEUIeN8ro/CrQ=; fh=KBIhiGdu1Ygtr3M+FTFcsBcOHAnQgw4Q3/a7frwkCBE=; b=veGLjF6gi48ccWQfaNjehuzzvHfCPvg68fQjstfSy0dEA/s2Ag48cxcCYY82xoJOMs Xnxbtxz2kPdGFcIli8Pxgy33kihCc2+4K+0byUm+zh7hg9YWa0AMyu2IPn8HTxsnJRe+ Tbri12uzdUxbw29A2EIT18873Kl4gmndXI2B4k1QfEtImpjunVBaKuUMwRx+geYgOKFo O25IqBhltJiCuXqqpu87S6VKfKAE7usRskk/63tqkjV12WuGE1H79ImUxAXn4apivct2 /k5UMwKQxzvGrJJ1WW79zZdGpZ/2RkVxjvtgKYy7TRFIVmNcipiehQU/LlUqHnTNdoPY 67Lw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CaopBlRH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-30385-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30385-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v16-20020a05622a015000b00429f8344fd8si7111353qtw.759.2024.01.18.08.59.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 08:59:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30385-ouuuleilei=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=@kernel.org header.s=k20201202 header.b=CaopBlRH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-30385-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30385-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 152671C21E1D for <ouuuleilei@gmail.com>; Thu, 18 Jan 2024 16:59:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7BBC2D636; Thu, 18 Jan 2024 16:58:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CaopBlRH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F15E42C6AE; Thu, 18 Jan 2024 16:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705597106; cv=none; b=fpp4M4kYYpEhDCLY5GvPRs3Cgkdd9XM+xfxFcrnBDoSyXoQOGGW2FLQKgHfkGoInfduTemC5NAw86aLo1VaqZj3aQ7pJjTNkVKP9VHH1yhZ2t945V492AIwQOR8bS07CPJMuzCpI9pvJhVEfOxWy0bmIYgixlaZpF7a5owse67M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705597106; c=relaxed/simple; bh=VB3r36g1TRzb+ZnbcM0huvM7RrOa7bcVG6ouX9BQqJA=; h=Received:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; b=O+xWeItNq8pJozdSMZarpv78olXlHUk9qwDrLEGFqgk69cnbK/xFDza/C+zxncdKgov/mFs1Q9PbDCYI/++WuP9DevKfWxANhpD2lybRcpZ7F1kA0hgiBMwO5o6i00HaGGE8Sjjnbfsi5mIPd+aDxnqJCRGbk3ESCMVT0QEytvo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CaopBlRH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2FDEC43390; Thu, 18 Jan 2024 16:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705597105; bh=VB3r36g1TRzb+ZnbcM0huvM7RrOa7bcVG6ouX9BQqJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CaopBlRHiCrC8zCeZp67HFQyNRiRgFzPECgJWdw8s18TdyRTNbsl2RO/26CPvhC8Q 1f+ALwq2Z5yJg79gFKKhAF4BBYC1Ef9RLD7NKPWKHpYJTXo4p3EhwKyV2xgWjS4a/S 5sscBlUUHPo/9iPuR2X0ehW7E10ESQuI9EbakUQ0ip2bY0GJeDcPbzfz2QS5K064HB rM8O6/SiwgTwLXvzMXt/hYsb09g+mBcvYw1n1txszMEx2I+0Gq0uuxmvmqgx9n1pdm BZm6SJ80h27wmzK6OHXn43VIZkQLcUXAKn14gFpUSTwBIAbShIe/skwOxSBufY8r7u NtSEMTQS7lapQ== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from <johan+linaro@kernel.org>) id 1rQVir-0003Z2-2R; Thu, 18 Jan 2024 17:58:33 +0100 From: Johan Hovold <johan+linaro@kernel.org> To: Mark Brown <broonie@kernel.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Banajit Goswami <bgoswami@quicinc.com>, Liam Girdwood <lgirdwood@gmail.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org>, stable@vger.kernel.org Subject: [PATCH v3 3/5] ASoC: qcom: sc8280xp: limit speaker volumes Date: Thu, 18 Jan 2024 17:58:09 +0100 Message-ID: <20240118165811.13672-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240118165811.13672-1-johan+linaro@kernel.org> References: <20240118165811.13672-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788448276499052962 X-GMAIL-MSGID: 1788448276499052962 |
Series |
ASoC: qcom: volume fixes and codec cleanups
|
|
Commit Message
Johan Hovold
Jan. 18, 2024, 4:58 p.m. UTC
The UCM configuration for the Lenovo ThinkPad X13s has up until now been setting the speaker PA volume to -3 dB when enabling the speakers, but this does not prevent the user from increasing the volume further. Limit the PA volume to -3 dB in the machine driver to reduce the risk of speaker damage until we have active speaker protection in place. Note that this will probably need to be generalised using machine-specific limits, but a common limit should do for now. Cc: stable@vger.kernel.org # 6.5 Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> --- sound/soc/qcom/sc8280xp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Comments
On 18/01/2024 16:58, Johan Hovold wrote: > The UCM configuration for the Lenovo ThinkPad X13s has up until now > been setting the speaker PA volume to -3 dB when enabling the speakers, > but this does not prevent the user from increasing the volume further. > > Limit the PA volume to -3 dB in the machine driver to reduce the risk of > speaker damage until we have active speaker protection in place. > > Note that this will probably need to be generalised using > machine-specific limits, but a common limit should do for now. > > Cc: stable@vger.kernel.org # 6.5 > Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > --- > sound/soc/qcom/sc8280xp.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c > index ed4bb551bfbb..a19bfa354af8 100644 > --- a/sound/soc/qcom/sc8280xp.c > +++ b/sound/soc/qcom/sc8280xp.c > @@ -32,12 +32,14 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd) > case WSA_CODEC_DMA_RX_0: > case WSA_CODEC_DMA_RX_1: > /* > - * set limit of 0dB on Digital Volume for Speakers, > - * this can prevent damage of speakers to some extent without > - * active speaker protection > + * Set limit of 0 dB on Digital Volume and -3 dB on PA Volume > + * to reduce the risk of speaker damage until we have active > + * speaker protection in place. I would prefer a 0dB here instead of -3dB, this could become issue if we are testing speakers without any pluseaudio or any software amplification. ex: console > */ > snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 84); > snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 84); > + snd_soc_limit_volume(card, "SpkrLeft PA Volume", 1); > + snd_soc_limit_volume(card, "SpkrRight PA Volume", 1) It would be nice to consider using component->name_prefix here. thanks, srini ; > break; > default: > break;
On Fri, Jan 19, 2024 at 07:37:14AM +0000, Srinivas Kandagatla wrote: > > > On 18/01/2024 16:58, Johan Hovold wrote: > > The UCM configuration for the Lenovo ThinkPad X13s has up until now > > been setting the speaker PA volume to -3 dB when enabling the speakers, > > but this does not prevent the user from increasing the volume further. > > > > Limit the PA volume to -3 dB in the machine driver to reduce the risk of > > speaker damage until we have active speaker protection in place. > > > > Note that this will probably need to be generalised using > > machine-specific limits, but a common limit should do for now. > > > > Cc: stable@vger.kernel.org # 6.5 > > Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > > --- > > sound/soc/qcom/sc8280xp.c | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c > > index ed4bb551bfbb..a19bfa354af8 100644 > > --- a/sound/soc/qcom/sc8280xp.c > > +++ b/sound/soc/qcom/sc8280xp.c > > @@ -32,12 +32,14 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd) > > case WSA_CODEC_DMA_RX_0: > > case WSA_CODEC_DMA_RX_1: > > /* > > - * set limit of 0dB on Digital Volume for Speakers, > > - * this can prevent damage of speakers to some extent without > > - * active speaker protection > > + * Set limit of 0 dB on Digital Volume and -3 dB on PA Volume > > + * to reduce the risk of speaker damage until we have active > > + * speaker protection in place. > > I would prefer a 0dB here instead of -3dB, this could become issue if we > are testing speakers without any pluseaudio or any software > amplification. ex: console I know you want that, but I'm not willing to be the one raising the default volume that people have been using so far and that you have (unknowingly) used in your tests to verify that you did not break your speakers. Once you've run some more tests we can easily raise this limit. I just want to make sure we have something safe in place ASAP now that people will soon be able to change the hardware volume control more easily (i.e. with the fixed UCM files). > > */ > > snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 84); > > snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 84); > > + snd_soc_limit_volume(card, "SpkrLeft PA Volume", 1); > > + snd_soc_limit_volume(card, "SpkrRight PA Volume", 1) > > It would be nice to consider using component->name_prefix here. That can possibly be done later. Johan
diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c index ed4bb551bfbb..a19bfa354af8 100644 --- a/sound/soc/qcom/sc8280xp.c +++ b/sound/soc/qcom/sc8280xp.c @@ -32,12 +32,14 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd) case WSA_CODEC_DMA_RX_0: case WSA_CODEC_DMA_RX_1: /* - * set limit of 0dB on Digital Volume for Speakers, - * this can prevent damage of speakers to some extent without - * active speaker protection + * Set limit of 0 dB on Digital Volume and -3 dB on PA Volume + * to reduce the risk of speaker damage until we have active + * speaker protection in place. */ snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 84); snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 84); + snd_soc_limit_volume(card, "SpkrLeft PA Volume", 1); + snd_soc_limit_volume(card, "SpkrRight PA Volume", 1); break; default: break;