From patchwork Sat Feb 17 19:34:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 202681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp478735dyc; Sat, 17 Feb 2024 11:35:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW0+8+2cjhI2Wai3825vrGWZVwrK1n2WjC9lsqcnZHsF+1kcsAmMwBjL7KKZ4vXtAD6KGYmLt8/jfqYlZ3kPMoULjZMxQ== X-Google-Smtp-Source: AGHT+IFAacTS0zcALVLDFFx7wkU/7sOgyKpH2lV8q3Kdd8lihCt02Fq3r52TviQf3thROtc1wHCm X-Received: by 2002:a17:902:64d0:b0:1db:8ca0:2699 with SMTP id y16-20020a17090264d000b001db8ca02699mr7660854pli.24.1708198516896; Sat, 17 Feb 2024 11:35:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708198516; cv=pass; d=google.com; s=arc-20160816; b=Bf2VPzSQHTCmr7NktBULuxZXPmIwxPv/53oWceBGQgKdcdblVi+tE9PvWBaAdhy6TS qwaJvuaLCvJRkOAhG3KBbdUw2SD7IhSOdQpGeB5mLYskK0pTpXUVmjElOCmo9N/N598m JAeE5Edmr4ttACuXAxLB+5BYi7ulQh4U2Hu/vRdCTKDW2cnJlRACbsS+U/Vp/lgGBKg0 MOX7qC3BdJVCHemgKnUlEI6wYJ5otgKcoc33L7EdjnBBNJkTVezaHhsNOMjw+SMQLcnb GYv9JpY138cgbCraPdeBlwWiaXoCkFYLFRzhPtnihc8Xbzh9BFoSuycQjRDnI/+d/bK4 9ZTQ== ARC-Message-Signature: i=2; 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:message-id:date:subject:cc:to :from:dkim-signature; bh=wtX2aCGR3b+hWsi9+/9Li9+0u32JHUk5qbXHNZMMYMA=; fh=9nS11W2xz+yxnumbfIjk1DkI/1PJLt/yayQdyU5iFtE=; b=z0Z/IPIsh9hhov44TS6fCEw3ywvGYc+eVm2gnaq8YJUH0tJB38s/RJZ8T0a7fLc9CM Q0Al8P0RvlHu07OBjD/F9+A9WeiJOk6TeKSqUQQbdkRaGInY/AT+xMrq/UDhv/nwrIQF pdBcwAL5n5f+w5Th/gf/IV/He1kFo2zJvTi31fBebjeKzadI+KQdq7il8GC1v/xamw79 u9cWearAIgSe0o3wBR79G3Kc/DpTjmHuXX2ytUp7aCzAXZzWBDST8v86e/mVvEeKZo03 V/BhKpVxGJX8WuSyxREG9M/Ixuvt9DCabNIPJzmauCMj1WGOiDQpSgTDkVQ8Y5EuvHUQ r9Jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=koCjUDST; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-70034-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70034-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l17-20020a170903121100b001d7404481f6si1854172plh.161.2024.02.17.11.35.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 11:35:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70034-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=koCjUDST; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-70034-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70034-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D5C28282947 for ; Sat, 17 Feb 2024 19:35:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2506F7E58E; Sat, 17 Feb 2024 19:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="koCjUDST" Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF2977C6C4; Sat, 17 Feb 2024 19:34:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.181.215.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708198490; cv=none; b=LQLyL9jqN72N9RHhz7K+94XE0muLcMfpa4OYIFUKO5o9s1CGqOPKSzMHsFIdQ24PMAPQqWQUTQGeKTb5JPx5aB/+CTPusvQUK/+srr8gHwdGtcIg3XoFbVCo2uLYjwEhH1SqKcd6d6aMW90RC9YkWYj7wyMjy+Q3VHFtvDxuBjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708198490; c=relaxed/simple; bh=GDFM2rZjlq+HPVr5razRyWgRuOojfXjQpD41VCj6WJY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qMke5kKguqIarzNZ7W/ACj5/4xVTZlUULjoYU7qcp4pbSDrdkEE079ssd0MOZxLHv54A9w+iL7SAYeSu3Tk32sO3+nl46biaj+KtnHI0/IXTV8JLh79k0wWigwoPO33hxYl5As6dStnvlA3xPDzYIOaKSTpmBVVmSOL6g5BVHk4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz; spf=pass smtp.mailfrom=xff.cz; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b=koCjUDST; arc=none smtp.client-ip=195.181.215.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xff.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1708198486; bh=GDFM2rZjlq+HPVr5razRyWgRuOojfXjQpD41VCj6WJY=; h=From:To:Cc:Subject:Date:From; b=koCjUDSTKjRT3baQHGvj+LqngJ9+yqKbWdCO+vXaVwYn6hV/KgPGObAmwnk5sQluq 6iRuz4k3AF54CcMNRhSX+gC/HMCJR+xyIJ3vMOb+uLv0DId1tI3lQ+qEeZ0+xFdxSO 2lhUMqp1AWmtA4BcN5zsLg9LtWJLooreCPzePf6k= From: =?utf-8?q?Ond=C5=99ej_Jirman?= To: linux-kernel@vger.kernel.org Cc: Ondrej Jirman , Michael Turquette , Stephen Boyd , Heiko Stuebner , linux-clk@vger.kernel.org (open list:COMMON CLK FRAMEWORK), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support) Subject: [PATCH] clk: rk3399: Allow to set rate of clk_i2s0_frac's parent Date: Sat, 17 Feb 2024 20:34:38 +0100 Message-ID: <20240217193439.1762213-1-megi@xff.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791175968223709821 X-GMAIL-MSGID: 1791175968223709821 From: Ondrej Jirman Otherwise when when clk_i2s0 muxes to clk_i2s0_div which requires setting high divider value on clk_i2s0_div, and then muxes back to clk_i2s0_frac, clk_i2s0_frac would have no way to change the clk_i2s0_div's divider ratio back to 1 so that it can satisfy the condition for m/n > 20 for fractional division to work correctly. Bug is reproducible by playing 44.1k audio, then 48k audio, and then 44.1k audio again. This results in clk_i2s0_div being set to 49 and clk_i2s0_frac not being able to cope with such a low input clock rate and audio playing extremely slowly. The identical issue is on i2s1 and i2s2 clocks, too. Signed-off-by: Ondrej Jirman --- drivers/clk/rockchip/clk-rk3399.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c index 5efac2ca3048..a17996acd065 100644 --- a/drivers/clk/rockchip/clk-rk3399.c +++ b/drivers/clk/rockchip/clk-rk3399.c @@ -597,7 +597,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { COMPOSITE(0, "clk_i2s0_div", mux_pll_src_cpll_gpll_p, 0, RK3399_CLKSEL_CON(28), 7, 1, MFLAGS, 0, 7, DFLAGS, RK3399_CLKGATE_CON(8), 3, GFLAGS), - COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", 0, + COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", CLK_SET_RATE_PARENT, RK3399_CLKSEL_CON(96), 0, RK3399_CLKGATE_CON(8), 4, GFLAGS, &rk3399_i2s0_fracmux), @@ -607,7 +607,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { COMPOSITE(0, "clk_i2s1_div", mux_pll_src_cpll_gpll_p, 0, RK3399_CLKSEL_CON(29), 7, 1, MFLAGS, 0, 7, DFLAGS, RK3399_CLKGATE_CON(8), 6, GFLAGS), - COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", 0, + COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", CLK_SET_RATE_PARENT, RK3399_CLKSEL_CON(97), 0, RK3399_CLKGATE_CON(8), 7, GFLAGS, &rk3399_i2s1_fracmux), @@ -617,7 +617,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { COMPOSITE(0, "clk_i2s2_div", mux_pll_src_cpll_gpll_p, 0, RK3399_CLKSEL_CON(30), 7, 1, MFLAGS, 0, 7, DFLAGS, RK3399_CLKGATE_CON(8), 9, GFLAGS), - COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", 0, + COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", CLK_SET_RATE_PARENT, RK3399_CLKSEL_CON(98), 0, RK3399_CLKGATE_CON(8), 10, GFLAGS, &rk3399_i2s2_fracmux),