Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2679084rdb; Mon, 4 Dec 2023 04:47:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IER3Q2LbZqpvDgYKF95mGxHRdgYQPqHUQz5rbqnw22N76yzSR0R5IN9f+5iatiVB0p9LOI/ X-Received: by 2002:a17:90b:4a10:b0:286:6cd8:ef16 with SMTP id kk16-20020a17090b4a1000b002866cd8ef16mr4258985pjb.46.1701694075713; Mon, 04 Dec 2023 04:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701694075; cv=none; d=google.com; s=arc-20160816; b=W+EpGP8mhcf/HL3D0diqfrqwxibeA2Awhwf4KB70GLvzTJhysTKECAdkXJqNqoP1iv 1fVmJsSX8t9JX7or8msFa8frGaTnrwvBiBxafh71vuYmvh1dN6HH78H6+WbIL7uhGD02 Jd1GqBveswN68M4GvtkytUnvgJCSOEVOR1w2MBebvLg7xjVcXH149yBtYg+VcAwDnJlM UySg8ISOlDi6dSHb98KVQZJleXlyfV1VCW3VRxOzGWkDPIMmvozDv9WFEQP5hOfXhjU1 b/+VxlGiElh1MfXmRbm7zx3cBr6Z0jTb3f1W+fINBzjOo984NN/FQM2l/K3xTH3WNVEF r0aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KY0JnJRKpd3/EUynN0UwcoxBlBhaBotyx7RxLf0wHWk=; fh=tKMKhgl5y3qWFLA4WbTOKHpRmq3iK42KyhZj04F1xWA=; b=RBVcWGg+9xWN0Ib159z0ccO1THpdkawNrd137IPAzmHHrhdGqmATCjRK1hquLQ0HoZ pnDHDcm9ZgtCmxseQeSCHUgSJgHurHj6CjbxAGB231uNRjy6o4Zh6T1f6EJBYyFlSdZj i4/UJk77kyWAbdqFHnC5j8f34I6bmzjp2YS3HHMr2pL6AU/ZKrayGgJvMEzm9zBwPLBy SkIZ/+26ToSTKbDqoATWpkZtTuNvqGdcnTddJ6Ypl3We7vloFy0YLVxQBtICdQTOpSUU OPYbtRZK4V9jNW3qF8y5b/uOUgcDd8Anef9mTJgeUhi9sxWr3caTiOLnQi+hpK0ULQIs F0/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WxFUILUg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o2-20020a17090ac70200b00286b8bafefasi1288297pjt.120.2023.12.04.04.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 04:47:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WxFUILUg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id AD05880A22FF; Mon, 4 Dec 2023 04:47:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343948AbjLDMrl (ORCPT + 99 others); Mon, 4 Dec 2023 07:47:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343931AbjLDMri (ORCPT ); Mon, 4 Dec 2023 07:47:38 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBD0AAA for ; Mon, 4 Dec 2023 04:47:44 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-54bfd4546fbso5393828a12.1 for ; Mon, 04 Dec 2023 04:47:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701694063; x=1702298863; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KY0JnJRKpd3/EUynN0UwcoxBlBhaBotyx7RxLf0wHWk=; b=WxFUILUg9AlH39Y2EB9mtJahq3vrhq/0j2+JHA2WeUFVB/LtnhfAJJ6nRyCnFjGPpq BhXtUVYhlZ5Sctx4Jf5xJG9kNB1uhew7yHFhboABHNdA9G6ritHPu+7MyG2S0hMh7rA9 AwroFr7K940CJq4OKdWBdtYC0AjjyENd5/IHGtq6Yjsan9cNv+IjayLquw1iPCpv/aee dtzIN8IBwrImDDCb8s4iKTKA2JT20iNBuC2qDj6lbMWjZbhizaAhvauTUotVGSe86eHD giq6/GlbCED9cuEJY21EL25GlMokfTByfuXlceuYWtHd2261n6fkp7+BaSOk1Q+y+Tzv oV3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701694063; x=1702298863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KY0JnJRKpd3/EUynN0UwcoxBlBhaBotyx7RxLf0wHWk=; b=oh13hUHnfAtrSK2989pMFroXDl+Br6pk2Rt1YMrW0C3WrzVHMNLLMG2GwIQs4kjFVL rrlK0Wtyke8XQNVz7D0+yBB4NQq9ATl6AsStl4yxgXsnSwN9Icb+4I31wuQLrzVV2Nn8 e/tdV7TqXq3R8VmDaYQoPaK2mlH1AAreJmcJTilmNACCm7vwKHhDhwp6paomE6pRU/ND wHkGpUrjdOgOsKbWFJBqoHIZVjEu3dx1PWkljYf6agQPLZ+SG2GSX14uABsvA4bEHipB 5/uhupbM63Cnk2QPQ+uFtc+8s5h4xKGsHOUqRTZnxn63l0IlhGqAePLr8I96WKdUOnMZ RQNA== X-Gm-Message-State: AOJu0YzFPXqvlEJl22IOX7BSYf96sL2VffWssiGPOYsuzaUL/Z9is3+i htEcYee0p3VS8iArMePdjRPYDw== X-Received: by 2002:a05:6402:17dc:b0:54c:a21b:8088 with SMTP id s28-20020a05640217dc00b0054ca21b8088mr1192577edy.63.1701694063127; Mon, 04 Dec 2023 04:47:43 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id dc15-20020a056402310f00b0054ced65bd26sm457017edb.41.2023.12.04.04.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 04:47:42 -0800 (PST) From: srinivas.kandagatla@linaro.org To: broonie@kernel.org, alsa-devel@alsa-project.org Cc: perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, johan+linaro@kernel.org, Srinivas Kandagatla Subject: [PATCH 2/2] ASoC: qcom: sc8280xp: Limit speaker digital volumes Date: Mon, 4 Dec 2023 12:47:36 +0000 Message-Id: <20231204124736.132185-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204124736.132185-1-srinivas.kandagatla@linaro.org> References: <20231204124736.132185-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 04:47:54 -0800 (PST) From: Srinivas Kandagatla Limit the speaker digital gains to 0dB so that the users will not damage them. Currently there is a limit in UCM, but this does not stop the user form changing the digital gains from command line. So limit this in driver which makes the speakers more safer without active speaker protection in place. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/sc8280xp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c index 249a43e1dee3..1e8f9452cd28 100644 --- a/sound/soc/qcom/sc8280xp.c +++ b/sound/soc/qcom/sc8280xp.c @@ -25,6 +25,23 @@ struct sc8280xp_snd_data { static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd) { struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); + struct snd_soc_card *card = rtd->card; + + switch (cpu_dai->id) { + 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 + */ + snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 84); + snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 84); + break; + default: + break; + } return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup); } -- 2.25.1