Message ID | 20240116093903.19403-2-johan+linaro@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-27185-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp145544dye; Tue, 16 Jan 2024 01:40:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IELnrXJuyipvPT6cDox2q6XMxlYyuEF3ML0NZb8fQ/78cFOrtHRXBUHEeXHkzMhZ99UJd5a X-Received: by 2002:a17:906:6411:b0:a28:b774:5e6f with SMTP id d17-20020a170906641100b00a28b7745e6fmr2964975ejm.77.1705398057647; Tue, 16 Jan 2024 01:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705398057; cv=none; d=google.com; s=arc-20160816; b=Ww97ZMxEJwG21dKLiHKfb7fPyLYCRxstm6JsOVgVEKi6ms1JcwYxEnAC4oMvTD6h75 DyaqfInx9o5qEWZeOPKwrCgQjl56N9UCI0F9xD1ISM1Hwq7Y7AG4Szo1BrfybLu9ivjc bw3SirMgbq1RG6DmyGtZ9PmeF7TjTPma964Nq47zKONfkzACtxO+zHzB7r8j2HO7xS47 LveoG4dBcNAOb6zVjGRggoV+whehGZu0MfNebXPLG2GwkBUtnEGjV+Cyo7VGxPBXzVrc ccsg6OGLUXcDWHdkH9lNMca5M+cBoveqG93++ch1AEiKzSZR6yFHKo6Ojy5lybaQbLrb WxZw== ARC-Message-Signature: i=1; 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=Zzdq7YIi0bpXVaD3y9ogoQPVF10MFSQ+cQrEF/gE75k=; fh=KBIhiGdu1Ygtr3M+FTFcsBcOHAnQgw4Q3/a7frwkCBE=; b=v1uVDdoUYD3XKDn0cPpG3Asozgu7cZvF9kzGTo3hpBhRheTY8WVlegS1fhIdwx2ug3 4T9CFgcbpYWUiyMILmoC+3u46Mq/w2KLk3KXfTgIJ1BPS7j47aOnSoghbauxxbMkTm6C aPgLE0qo41FAiMfQ1YTKjysTsqVETP+MxOjz5cWIo/mWRUutCWDF3dD7IaDyGVCLkIK+ fzWeeKTElcS70G8YVLlKHy+0wvOzvE/3v4AoC2jHCPaeP/NU868dfbIxvdEQXk7f6A4i 8zi93Ybxk5FR5cEgum8EeXcqEWUgqdGbabM72mCX/WZQ7MF83tq6xJw1YbJUChkq1mvE 5W6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RKmoRJkw; spf=pass (google.com: domain of linux-kernel+bounces-27185-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27185-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d11-20020a170906174b00b00a2aa4d3ac10si4666375eje.715.2024.01.16.01.40.57 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 01:40:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27185-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RKmoRJkw; spf=pass (google.com: domain of linux-kernel+bounces-27185-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27185-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 28CBA1F24326 for <ouuuleilei@gmail.com>; Tue, 16 Jan 2024 09:40:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72B7017BBC; Tue, 16 Jan 2024 09:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RKmoRJkw" 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 BBF8B12B8D; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F772C43390; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705397981; bh=nvWSTvevOskToEZpfEU2EEaPDtMjqucztV5vWpemT2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKmoRJkwvYt5VDdESK9KIx/LDj4F0E7M/8n1WuR0soKQjN424GIFu75fnOUmyxpvL zDStNl/RrkH00uMgg5wKY62Qycvcq9zeb7YceufvII03mCUVQJX1Zle4gPbYaJaMxZ xf6RVMgkxEBnYUsTIXVeyvj6RX2L/9bp1n3TUwVE/0fz6T/lTKpTyaFLR835+MnfJW 9IbXMLS+JW4uMHe+h+t/VKyq3RxgyupwdfJtSK3orD0H46iJurVPSqIhNP8Np/IOTX KkrwvpT9FVjeMRrMrUDT+0wA3sZ0vXdjal0qWQrj+QRgOGN3DZpfsuN+OkgfVCoQoo W6g9qL1HrlqAw== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from <johan+linaro@kernel.org>) id 1rPfv6-00053R-0a; Tue, 16 Jan 2024 10:39:44 +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 1/7] ASoC: qcom: sc8280xp: limit speaker volumes Date: Tue, 16 Jan 2024 10:38:57 +0100 Message-ID: <20240116093903.19403-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240116093903.19403-1-johan+linaro@kernel.org> References: <20240116093903.19403-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: 1788239473554017222 X-GMAIL-MSGID: 1788239473554017222 |
Series |
ASoC: qcom: volume fixes and codec cleanups
|
|
Commit Message
Johan Hovold
Jan. 16, 2024, 9:38 a.m. UTC
The current UCM configuration sets the speaker PA volume to 15 dB when
enabling the speakers but this does not prevent the user from increasing
the volume further.
Limit the PA volume to 15 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
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
sound/soc/qcom/sc8280xp.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
On 16/01/2024 09:38, Johan Hovold wrote: > The current UCM configuration sets the speaker PA volume to 15 dB when > enabling the speakers but this does not prevent the user from increasing > the volume further. > > Limit the PA volume to 15 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 > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> LGTM, We can get rid of this limit once we have Speaker protection inplace. Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --srini > --- > 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..aa43903421f5 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 15 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", 12); > + snd_soc_limit_volume(card, "SpkrRight PA Volume", 12); > break; > default: > break;
On Tue, Jan 16, 2024 at 11:11:47AM +0000, Srinivas Kandagatla wrote: > On 16/01/2024 09:38, Johan Hovold wrote: > > The current UCM configuration sets the speaker PA volume to 15 dB when > > enabling the speakers but this does not prevent the user from increasing > > the volume further. > > > > Limit the PA volume to 15 dB in the machine driver to reduce the risk of > > speaker damage until we have active speaker protection in place. > LGTM, We can get rid of this limit once we have Speaker protection inplace. There should be a userspace component for speaker protection so you'll need to limit things when that's not running.
diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c index ed4bb551bfbb..aa43903421f5 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 15 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", 12); + snd_soc_limit_volume(card, "SpkrRight PA Volume", 12); break; default: break;