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), From patchwork Wed May 24 07:41:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 98355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2669239vqo; Wed, 24 May 2023 00:55:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47fYbgwv4txDydb8reXMf/FCDLJy3yxl8E3DkwUt6O+CODMjeYS7MdilhP2KC3HHzRcWCt X-Received: by 2002:a05:6a21:3299:b0:101:4348:3e4e with SMTP id yt25-20020a056a21329900b0010143483e4emr19349597pzb.42.1684914904962; Wed, 24 May 2023 00:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684914904; cv=none; d=google.com; s=arc-20160816; b=HM8NvP1pbzYLCmcWunPbF6sMplvEDLkqKDeNEF8jgbplf057As7VrF3UCwjcPn68Wr 0rTOvuettizFdlkVDV6ZxwjoBNbGRtf+M+b4E4p3KjAIxgly9ZRfZunHH96unid4Zjc/ D+PcvNBDnjR318PhqrxnR6lV0eqF4DLz8vSCa/3GaaMtvgoFtma3Ks53jgnZDTbSqHtm utjpbFrIZ27W1orhAo+40oRQq16D5pJ2rLSIrsaY2Ftq2Ag5Q56GhZOU2sww68iumBr3 iFY51sE2NI0ks0JIl4lTn5G1TA6R8Yq4BasCn40ENDwBwz+mOG4zUUPG012jsULWPYE5 edbg== 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=gwZmjt6lK4OQ7KURI4e5bgw009dfOTbRMAhV/sOexqY=; b=SR4MzD0zrbVYB7GYJL1CxlWNNbLViH0yxcpnq6/mRhpcn0r1sK4mjvgQAa42KMhO3Z p6GKYfUnK9uZuvWGhDyphCeBhYaTsVo+7IepyMrMdmaHyWpFl1Ig6wuCuuv+81m41Ndj gwvWUzCZxFYdn3pHMsULiJTprlJruSFwIi7e/FmYe/FA4RKF4mqAnb1z2RshXGfw/0t6 hM6Mv5Ls1eX4g0+jAVw+QHwMMG4IPnpAdguQLsHOgasdOki+r0Zylazndc4NMuebb/3X hRvWjDfJ23D8uFpxWSilCo/CdJpsO5PYpniZA+1M2PpTI47kgGy00ZllLk+IgSyS02Rl 0LTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=guHh2BSY; 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 s7-20020a637707000000b00534951b1b85si765657pgc.279.2023.05.24.00.54.52; Wed, 24 May 2023 00:55:04 -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=guHh2BSY; 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 S240041AbjEXHmO (ORCPT + 99 others); Wed, 24 May 2023 03:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240025AbjEXHmJ (ORCPT ); Wed, 24 May 2023 03:42:09 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D8529D; Wed, 24 May 2023 00:42:07 -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 2EC2F66059A4; Wed, 24 May 2023 08:42:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1684914126; bh=JWCo/GiQIjgEd33TLlVz5h/VBvQ/u8Y9VSES2Wef+Cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=guHh2BSYUS5UFvmOnh4vu8yu95UUSTNL+6Y80h+c0yZCnhsjVELoebtXgv1s+kNvU YoAz+N+yTIWAGBVBXWvngfo+VXZUc6meYNielFhHZxlueddOveDw8wI/YzLOpAMXtI z0tNjhsfuSwhGOmos0t5yD/wW5RnwtVfoQhlx5QyzXh0p704epqPb96bfl3nclpZ3m 4fipHtiioj1Z5mR16Pn1+akbINwMUwdYoUWg61UPKftKOGV6Ussew+lpNEjgDe8ozs nqNRVN0Tr4Rzi0xt0XjGzcI62ml4VP/8hMp8makZZDi4uAgN0p/eVXP2pt531T7j6T IsnTEQ5tiQTbw== 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 2/3] ASoC: es8316: Do not set rate constraints for unsupported MCLKs Date: Wed, 24 May 2023 10:41:55 +0300 Message-Id: <20230524074156.147387-3-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?1766761331369022810?= X-GMAIL-MSGID: =?utf-8?q?1766761331369022810?= When using the codec through the generic audio graph card, there are at least two calls of es8316_set_dai_sysclk(), with the effect of limiting the allowed sample rates according to the MCLK/LRCK ratios supported by the codec: 1. During audio card setup, to set the initial MCLK - see asoc_simple_init_dai(). 2. Before opening a stream, to update MCLK, according to the stream sample rate and the multiplication factor - see asoc_simple_hw_params(). In some cases the initial MCLK might be set to a frequency that doesn't match any of the supported ratios, e.g. 12287999 instead of 12288000, which is only 1 Hz below the supported clock, as that is what the hardware reports. This creates an empty list of rate constraints, which is further passed to snd_pcm_hw_constraint_list() via es8316_pcm_startup(), and causes the following error on the very first access of the sound card: $ speaker-test -D hw:Analog,0 -F S16_LE -c 2 -t wav Broken configuration for playback: no configurations available: Invalid argument Setting of hwparams failed: Invalid argument Note that all subsequent retries succeed thanks to the updated MCLK set at point 2 above, which uses a computed frequency value instead of a reading from the hardware registers. Normally this would have mitigated the issue, but es8316_pcm_startup() executes before the 2nd call to es8316_set_dai_sysclk(), hence it cannot make use of the updated constraints. Since es8316_pcm_hw_params() performs anyway a final validation of MCLK against the stream sample rate and the supported MCLK/LRCK ratios, fix the issue by ensuring that sysclk_constraints list is only set when at least one supported sample rate is autodetected by the codec. 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 773c94fd3547..a78c0049a30c 100644 --- a/sound/soc/codecs/es8316.c +++ b/sound/soc/codecs/es8316.c @@ -386,7 +386,7 @@ static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai, es8316->allowed_rates[count++] = freq / ratio; } - es8316->sysclk_constraints.list = es8316->allowed_rates; + es8316->sysclk_constraints.list = count ? es8316->allowed_rates : NULL; es8316->sysclk_constraints.count = count; return 0; From patchwork Wed May 24 07:41:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 98358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2669425vqo; Wed, 24 May 2023 00:55:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZXr5Cc1UabmvMvepVgYVgGp4Jn0R3V6tYqDWb+qPIzu0MFtKDg1bGZ5WnNNvvvSdEm5uv X-Received: by 2002:a05:6a20:1b26:b0:106:dfc8:6f4e with SMTP id ch38-20020a056a201b2600b00106dfc86f4emr14347890pzb.32.1684914935987; Wed, 24 May 2023 00:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684914935; cv=none; d=google.com; s=arc-20160816; b=OntBU+fMhOwbjRJfQOAn4yr7c/BMRjn7Gu+Cv+0M1PoF5FansXGt3pPJQyGm2RphXE P5IZNygeRdt0zerKRk1yT+3iOa8IjL4jC01heQXWzDVNoQWgqMTYH+ec32SM8YeRee9T X0ia0jdVWRNbC+acNsvqWLYOAI8BBGRgzWIMUFw5XRT+2Gh2YPZvDKMjLH3f9kiPnTVo SHeHrLot2TTt155Zb+vgsF3dkts9gqHTg1YqTqMof9Vdr4D+/2jA/WNvnYTasYLNxuox idV4S/QKPiN7/yFH02H70LYUhvPzzZ9vpU7vhypfp1X5BJvyt/h+A0+BC4Fh3to2da8w kqog== 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=MFVDh5xgMMARiI3cslvjVX0NVjFumB8W3NLLQ2yI33U=; b=h91PDLA6v+fplbvF2UEZM/DGfEqKa9TnyEzyLrTFTl+6alZ6lHw7dKmLg0UhnSHvv3 DbxYayEECNMTosGvxvL1Uv9OYYPGruxNs9x2wDUeRbHeGtZbsW4mkfxatY4uc2H2/fLJ mFdBeOMd/Hat/OrQGPUv8djJUnBlE/Le1b37JaeyJvWa5+uTipWrp5dfwEpKmeJ977os PiZNd7G8ye3XL95mUqRIOAKoYlCmK2aPF5rdptRJH5VENaRebyFvIY6J2BpCy/TOWnlR LOGkggsUscldvr35NtZjfkz0zwnrIjNH3jPolDe4mCuNd6OYMn1ZxC4kOgriw9Ymy7uB VH3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=J+8qeUL7; 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 x24-20020a63b218000000b00524db291facsi134833pge.504.2023.05.24.00.55.23; Wed, 24 May 2023 00:55:35 -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=J+8qeUL7; 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 S240051AbjEXHmR (ORCPT + 99 others); Wed, 24 May 2023 03:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240026AbjEXHmM (ORCPT ); Wed, 24 May 2023 03:42:12 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECDF98F; Wed, 24 May 2023 00:42:10 -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 8E2276606E75; Wed, 24 May 2023 08:42:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1684914129; bh=iHcb9BFc/X1bbxtUKpaxg5GTnEgeVVJ1yraooXSIn1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J+8qeUL7wLbyiWwOGcaIp1izZ9pvs2pzG+kKXf9VtlAgV1aIEOY3nxevi9XfcUKox OJYLHKoWg5DkHcg+7a+QJ2cYqYVkIu+fQSFLepbmnDNtTJ3Zd8d16JA/IdUFarzm47 X8RCPTHLDCeJ4b3zHJk4BIndaoGdwRhmmq3KMKL0a+0qdlaWxy8dfVlc7UH9yeoNeO vZORLe//LBSSgoVn94ITNS7MyHXzs6xmatvyGP48TYxFNkwVTbYxxDWVLk4HT8n0MO sgZo60pPr98ZANmyBLKDfNi+GXtIqw5rG3kmYjOFaN11/wzxgq+B7OtZsGRBwy7v7V dcYJc7OARA6jA== 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 3/3] arm64: dts: rockchip: Assign ES8316 MCLK rate on rk3588-rock-5b Date: Wed, 24 May 2023 10:41:56 +0300 Message-Id: <20230524074156.147387-4-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?1766761363953408266?= X-GMAIL-MSGID: =?utf-8?q?1766761363953408266?= The I2S0_8CH_MCLKOUT clock rate on Rock 5B board defaults to 12 MHz and it is used to provide the master clock (MCLK) for the ES8316 audio codec. On sound card initialization, this limits the allowed sample rates according to the MCLK/LRCK ratios supported by the codec, which results in the following non-standard rates: 15625, 30000, 31250, 46875. Hence, the very first access of the sound card fails: Broken configuration for playback: no configurations available: Invalid argument Setting of hwparams failed: Invalid argument However, all subsequent attempts will succeed, as the audio graph card will request a correct clock frequency, based on the stream sample rate and the multiplication factor. Assign MCLK to 12.288 MHz, which allows the codec to advertise most of the standard sample rates. Fixes: 55529fe3f32d ("arm64: dts: rockchip: Add rk3588-rock-5b analog audio") Signed-off-by: Cristian Ciocaltea --- arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts index 3e4aee8f70c1..30cdd366813f 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts @@ -133,6 +133,8 @@ es8316: audio-codec@11 { reg = <0x11>; clocks = <&cru I2S0_8CH_MCLKOUT>; clock-names = "mclk"; + assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; + assigned-clock-rates = <12288000>; #sound-dai-cells = <0>; port {