From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD9F160A2607 for ; Thu, 19 Nov 2026 00:13:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=alsa-project.org header.i=@alsa-project.org header.a=rsa-sha256 header.s=default header.b=egJe1/zJ; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YJYTqNfx Received: from alsa1.perex.cz (alsa1.perex.cz [45.14.194.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5EEE9601EC; Thu, 19 Nov 2026 01:13:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5EEE9601EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1795047205; bh=6aA2FbtO+HG6rgjKAZ++GmYUwF65A98OdNOKOM9rD1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=egJe1/zJZW9poiEYxOBb9LMX8zqNew9fEkdyU9A4STquWf9EdFLOV/Js1t9kZynxE bOndT2ZPR637WsOfq6F/kLbw4pKCbsrKW0qSjDlX1ibTeRDwqK3oxWAg9MwQRbLKu8 D+bPZubc9CldZN92mBVPEWFLUu7+r8jZcejNiGjk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id BEA9FF805FC; Thu, 19 Nov 2026 01:12:52 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 18B8DF80601; Thu, 19 Nov 2026 01:12:52 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DCF46F805C5; Thu, 19 Nov 2026 01:12:42 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: alsa1.perex.cz; arc=none smtp.remote-ip=172.234.252.31 ARC-Seal: i=1; d=alsa-project.org; s=arc; a=rsa-sha256; cv=none; t=1795047160; b=WuLaTpqTXgSBqC9AHrytvgudPM6klbf2qThSc1kOgzNnTF+qg8+gN4kUC8ZUopE80UAa 14A26iF57CWNKp6bVxln37crnAixse495dIumSfxAzbsdydgSd9qr5+vFCYqHYHBBQZi/ qz7go82mXSJd7DHIpbHm4KiMOwCf7xDBr+y8/h9mvrZBVgtjkI/IYXxa/NJ37x1EzIG7w NeePw105Kdp+f4HQCLhw1XAccH+9qdkUYrY+baGyr6Mbkd0O0tTi/4YMENas9fjvoMxW7 01xLwsAx2tt20E/NADQxHAJ0Dw3zItk/KiQIwORlUb79XG5NVV4xrEB91RNsUjQG9bw== ARC-Message-Signature: i=1; d=alsa-project.org; s=arc; a=rsa-sha256; c=relaxed/simple; t=1795047160; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; bh=6aA2FbtO+HG6rgjKAZ++GmYUwF65A98OdNOKOM9rD1k=; b=FqZAGjjEM0Bfbv6e3hV5eQ5sBcmVkyPkNvKRUO+39SmcGfZPtwj6s1xvm7qqQ5g1Nsfy ZLq117yWv7tA9sEXlD/goJAinunsQaLU2x2eDhYwgBnXR3R7g4GgBxHnQ3oNiri+HKGsD yIkCIr5cS1oHGLU6XKWZgPzwIFdd4OlP1+KyEou68fs5w6yOr1pS3lTCWtjmnplB/VeiX 93YrrZzTxXxXEw6mZ0hV4Yw0p4/UUIXclN8Hui0GACJ1x9I97NyeyUVPI6dc3GwELTHWG WlHDddew4u5Ry07ZSh+m3aDgusHtENf4NkrMFnzgAqFiPfXCaCAdk+zmLLhuR0f0nqA== ARC-Authentication-Results: i=1; alsa1.perex.cz; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YJYTqNfx; arc=none smtp.remote-ip=172.234.252.31 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4DF08F80152 for ; Thu, 19 Nov 2026 01:12:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4DF08F80152 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YJYTqNfx Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 019934387E; Thu, 19 Nov 2026 00:12:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64E541F000C4; Thu, 19 Nov 2026 00:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795047155; bh=DIqQFGIC7J5qnRaNS9phqmSdkQP/RjENla8W63ksbFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YJYTqNfxPEZdRJfh4i0+27ejmGTYL3kcwzrGzULcRnvA3Nd5c0XVG/f7y5ClkpRtY lbmCk9E8CWFhV3LtNuPw6vuIYYSC5jeDm15ye82ZcgPNpiMxRNuH8HnP7pKb7sFz3q o1B+n7L9l9HyrKAtG+tXjRSmUR0H+nIjnUQ7D34g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jaroslav Kysela , Liam Girdwood , Mark Brown , Takashi Iwai , alsa-devel@alsa-project.org, Maxime Ripard , Stephen Boyd , Sasha Levin Subject: [PATCH 6.1 1537/2857] ASoC: tlv320aic32x4: div: Switch to determine_rate Date: Wed, 18 Nov 2026 15:42:51 +0100 Message-ID: <20261118150256.662121601@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150201.293410965@linuxfoundation.org> References: <20261118150201.293410965@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: NGYDCTGY7SBHWG245B675564QO4CEQK5 X-Message-ID-Hash: NGYDCTGY7SBHWG245B675564QO4CEQK5 X-MailFrom: gregkh@linuxfoundation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maxime Ripard [ Upstream commit 2b6c9b0eee89379fda238d543c5acf098a2ac5a5 ] The tlv320aic32x4 divider clocks implements a mux with a set_parent hook, but doesn't provide a determine_rate implementation. This is a bit odd, since set_parent() is there to, as its name implies, change the parent of a clock. However, the most likely candidate to trigger that parent change is a call to clk_set_rate(), with determine_rate() figuring out which parent is the best suited for a given rate. The other trigger would be a call to clk_set_parent(), but it's far less used, and it doesn't look like there's any obvious user for that clock. So, the set_parent hook is effectively unused, possibly because of an oversight. However, it could also be an explicit decision by the original author to avoid any reparenting but through an explicit call to clk_set_parent(). The driver does implement round_rate() though, which means that we can change the rate of the clock, but we will never get to change the parent. However, It's hard to tell whether it's been done on purpose or not. Since we'll start mandating a determine_rate() implementation, let's convert the round_rate() implementation to a determine_rate(), which will also make the current behavior explicit. And if it was an oversight, the clock behaviour can be adjusted later on. Cc: Jaroslav Kysela Cc: Liam Girdwood Cc: Mark Brown Cc: Takashi Iwai Cc: alsa-devel@alsa-project.org Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-67-971d5077e7d2@cerno.tech Signed-off-by: Stephen Boyd Stable-dep-of: 8cf9607d2d85 ("ASoC: tlv320aic32x4: Prevent division by zero in divider callbacks") Signed-off-by: Sasha Levin --- sound/soc/codecs/tlv320aic32x4-clk.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c index 2f78e6820c75a..96979243d3a6a 100644 --- a/sound/soc/codecs/tlv320aic32x4-clk.c +++ b/sound/soc/codecs/tlv320aic32x4-clk.c @@ -326,16 +326,17 @@ static int clk_aic32x4_div_set_rate(struct clk_hw *hw, unsigned long rate, AIC32X4_DIV_MASK, divisor); } -static long clk_aic32x4_div_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int clk_aic32x4_div_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { unsigned long divisor; - divisor = DIV_ROUND_UP(*parent_rate, rate); + divisor = DIV_ROUND_UP(req->best_parent_rate, req->rate); if (divisor > 128) return -EINVAL; - return DIV_ROUND_UP(*parent_rate, divisor); + req->rate = DIV_ROUND_UP(req->best_parent_rate, divisor); + return 0; } static unsigned long clk_aic32x4_div_recalc_rate(struct clk_hw *hw, @@ -354,7 +355,7 @@ static const struct clk_ops aic32x4_div_ops = { .prepare = clk_aic32x4_div_prepare, .unprepare = clk_aic32x4_div_unprepare, .set_rate = clk_aic32x4_div_set_rate, - .round_rate = clk_aic32x4_div_round_rate, + .determine_rate = clk_aic32x4_div_determine_rate, .recalc_rate = clk_aic32x4_div_recalc_rate, }; @@ -382,7 +383,7 @@ static const struct clk_ops aic32x4_bdiv_ops = { .set_parent = clk_aic32x4_bdiv_set_parent, .get_parent = clk_aic32x4_bdiv_get_parent, .set_rate = clk_aic32x4_div_set_rate, - .round_rate = clk_aic32x4_div_round_rate, + .determine_rate = clk_aic32x4_div_determine_rate, .recalc_rate = clk_aic32x4_div_recalc_rate, }; -- 2.53.0