From patchwork Wed May 24 07:41:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 98357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2669354vqo; Wed, 24 May 2023 00:55:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7WrXvzBAXLFVEVVk4VZVq/dPkl4R/BLw8MPaQOIpB2qYNOqOxE6TRGqtcZ7b3xPKNknHqp X-Received: by 2002:a05:6a00:22c1:b0:644:d775:60bb with SMTP id f1-20020a056a0022c100b00644d77560bbmr2353920pfj.20.1684914922826; Wed, 24 May 2023 00:55:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684914922; cv=none; d=google.com; s=arc-20160816; b=i7XLqfDcQ+Xc4Gb/HUBTH7J0OSeXQY+u5ngFwBP6t/poOgVkgDIfE/w4INsIFhEZeA jMlEtEWgqTyqYr81Q/lRtT19yhj4Kpa+NdM0BOH462qKbeRR+xLOjyw7RF9l1EyVkmqx 1CpdiuvPw0yFPFgvJc4wb8qCOoBRPVlHfuY+5FWMLHMDLV2Stx01SYGIMY4GuPnXDsPd Skh8/4+c+TV3RHIiaD4irSnax66971A9WZC6pLbdMpmDpurlmFHKQfe2CXT6MFxLIrKI xkMK1H17ewFRdjd45NRJDtugjk1AAXmREbOcyoS+s9wNZajyEZUe4pCWYhySCdfdrVxk JfLg== 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=RgClWvfhJGPzqokulG9eB8JpQ13GW93oKJZu0l16QTs=; b=bBULRC4LYIFA7fQvBjHjXPQfuGDA1JqpZiyRYzApBizmqD63c9O5mGEfepdL+7B+xP XdzcY1XbtulTrTfriekSs+hO16wYB7iSPj0HB9H5Y4rnySBjB/PhXPlW0ThP3Iuae0QD NkLGiLqtZTJlbyBi1IexlQIm0qp6mCNZ0z+EXHE17unweEKxfJcDvayEoeu/2v5M8gQv g9d/F1vWbu7njN86DjBzTSligbJkC0ZuzfAaNya7wQGFVmv7gB/i5XbDC4lthitfq6QD bEmzLA4yJLKUfIb3PGa13q6oNY+gzVJ0/n4hQ3rvdoR9AEgtGUbxZmhxqKhkuPQkHWZh p7Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=fQkj2bN3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l192-20020a6391c9000000b00534293eee51si7937179pge.775.2023.05.24.00.55.10; Wed, 24 May 2023 00:55:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=fQkj2bN3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240032AbjEXHmL (ORCPT + 99 others); Wed, 24 May 2023 03:42:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240015AbjEXHmF (ORCPT ); Wed, 24 May 2023 03:42:05 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B0B19D; Wed, 24 May 2023 00:42:04 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id CE0296606E73; Wed, 24 May 2023 08:42:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1684914123; bh=faNfSMxsboihf/E9pG9NmNCYt8187yJ11iV3M4yxj3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQkj2bN38h3Di9mMwX+6e0iyLG8XxNYkrqv0WHX9HQak78Jbs46ss/kXVOF+9PmPe wbZk4DhZLsc4N1KDwZ06dsBy9g8j9KOt30+0na6+YYpBT+IIlRvyw8qnM+8SA75bhm OCMw1nDs4pC6kblznJuR8I9UKR5pw0uP4HTIOrT57Ji/+U3wAKaR4LPj/BPAANgOKS liUyIiql8a0BddF0uis/FYqY+BskTnpfuP+MOU2cuILvFRwz7iag3XqEpvUIWlLJtW E7h+9yO0DphnPj+YrvWWTnV8lpK5B7WF10o1GPadhsn2CvWZhX8L39Xzk6DVTXU1DP b3CcBpr8VaWfg== From: Cristian Ciocaltea To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Zhu Ning , Pierre-Louis Bossart , Charles Keepax , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , David Yang , Daniel Drake Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, kernel@collabora.com Subject: [PATCH 1/3] ASoC: es8316: Increment max value for ALC Capture Target Volume control Date: Wed, 24 May 2023 10:41:54 +0300 Message-Id: <20230524074156.147387-2-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230524074156.147387-1-cristian.ciocaltea@collabora.com> References: <20230524074156.147387-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766761349927911619?= X-GMAIL-MSGID: =?utf-8?q?1766761349927911619?= The following error occurs when trying to restore a previously saved ALSA mixer state (tested on a Rock 5B board): $ alsactl --no-ucm -f /tmp/asound.state store hw:Analog $ alsactl --no-ucm -I -f /tmp/asound.state restore hw:Analog alsactl: set_control:1475: Cannot write control '2:0:0:ALC Capture Target Volume:0' : Invalid argument According to ES8316 datasheet, the register at address 0x2B, which is related to the above mixer control, contains by default the value 0xB0. Considering the corresponding ALC target bits are 7:4, the control is initialized with 0xB, which is one step above the maximum value 0xA allowed by the driver. This means that either the hardware default is wrongly set to 0xB instead of 0xA, or the specs are incorrect and instead of having the range 0xA-0xF mapped to -1.5 dB, the single value 0xA should have been mapped to -1.5 dB and the remaining range 0xB-0xF to 0 dB. Increment the max value allowed for ALC Capture Target Volume control, so that it matches the hardware default. Fixes: b8b88b70875a ("ASoC: add es8316 codec driver") Signed-off-by: Cristian Ciocaltea --- sound/soc/codecs/es8316.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c index 9e033fb320a0..773c94fd3547 100644 --- a/sound/soc/codecs/es8316.c +++ b/sound/soc/codecs/es8316.c @@ -115,7 +115,7 @@ static const struct snd_kcontrol_new es8316_snd_controls[] = { alc_max_gain_tlv), SOC_SINGLE_TLV("ALC Capture Min Volume", ES8316_ADC_ALC2, 0, 28, 0, alc_min_gain_tlv), - SOC_SINGLE_TLV("ALC Capture Target Volume", ES8316_ADC_ALC3, 4, 10, 0, + SOC_SINGLE_TLV("ALC Capture Target Volume", ES8316_ADC_ALC3, 4, 11, 0, alc_target_tlv), SOC_SINGLE("ALC Capture Hold Time", ES8316_ADC_ALC3, 0, 10, 0), SOC_SINGLE("ALC Capture Decay Time", ES8316_ADC_ALC4, 4, 10, 0),