Message ID | 20221223094259.87373-16-angelogioacchino.delregno@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp230386wrn; Fri, 23 Dec 2022 01:46:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXu6xCJ5mRlNDV9joYBbB39s/RrssvL1WwJR+LFDNiSUgQo507cZHaFDuYSvRNzQ0wbVcj44 X-Received: by 2002:a17:90b:3c8d:b0:223:ed95:651c with SMTP id pv13-20020a17090b3c8d00b00223ed95651cmr10328216pjb.7.1671788772187; Fri, 23 Dec 2022 01:46:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671788772; cv=none; d=google.com; s=arc-20160816; b=dT/vv2eTcQTYrj+jBTO5NLmJKJ5MQakJoN69Edkv8DwOe1NdxNmu2lfASqGGXOh4gq Bg1GaOhVPpvmrrLiKHYYIJmN4PaRzFNromVNSiczW/GAwZek80K6qeNI1cKPz/gj+45b t76zTFH9UJso/zxE0uN3umZ9M9WPR70bQZtNQOtyYWdOwZT66+Xm6B+6AnEorjRFpOZ8 ufhu++kNTlOdYEuoQSoxaZ1CR2qehPboH4xWsQjmvvsBiw7ZNuZJrQwJpB+J9UyU4+zg +3+iecmQiUfyobVk+dPLKIt2B73lGKUkyxbWHiWvZofjehbANz2fzJIOPlw4/yH19pru Lxcw== 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=nwj6EBv/zIrCMqaul4jxoTOv2/8Z3qecnlfFOCxkFms=; b=0Ramtn4tK12sX4PWoc3qZ5PIUvac53OuQriFj/TZaENs5ml53Tq17GX3mxvea1pMsf R8M7SzykumrNiwmCq7iUYjQAhhppmIXcwMtB0WwweZVzNAMIHUUYSXtALpJN6rT3+Ofn h4/r3MxR2PrWqDKhIFz40TJKTgXlCMTs6VDHQrAWcS7HavXTrg1po1O6crDz9Kae4oZo EV9wfv1DvHDGnmlKXiB8UWE2zc4uOrOW9H/DenrHbzenBIyxfcruN7ajdM8G/WyIA1Bc P3qHShgUejJ1sRs4iuLkM7Qs+r0UNVD4Xdybos2togCLlTn99kfjAPP3i7jvLivozd0X ATDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aEtFMMjz; 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=NONE sp=NONE 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 ot1-20020a17090b3b4100b0021f249ab6acsi7082331pjb.139.2022.12.23.01.45.59; Fri, 23 Dec 2022 01:46:12 -0800 (PST) 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=aEtFMMjz; 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=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236176AbiLWJpH (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Fri, 23 Dec 2022 04:45:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236211AbiLWJoX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 23 Dec 2022 04:44:23 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DAC237FAD; Fri, 23 Dec 2022 01:43:30 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (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) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id A03B76602D0D; Fri, 23 Dec 2022 09:43:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1671788608; bh=p4HuxSnc6rYIjz4n4YZOsHO8uVPvIY0fR52pGIHTaV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aEtFMMjzr1Ic9EYQcGv+RtSahEiiR3Eiud0LCrk6AJp+Tjdsi//JSTCUJ1vTs0WND zE5FGQftHmWaXthWoFparZTgmhkYmN3fOahoNRIow2RTpHRkg+Kd5J57YhVJ1oOTHm 5OiM7xAN3xvXitMz4Yo6hQMJi0NNIdQ2icuauGrlA76RUIl/29fzA72GwNqqZGRvK9 fPjJ8aU9GZ3o4q+OjgoeKxWVIPn1Fy30EWmtYRQ9kdstbfF/DADe7F5TNNv+H6KEn6 IO8chWSw9ZHWWtLp+83+UQGQamAoonGEOjZS2QJaulXNFxuv2TXiePF+ih0Ws8UIsq ILW3+vCh1swJw== From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> To: mturquette@baylibre.com Cc: sboyd@kernel.org, matthias.bgg@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, angelogioacchino.delregno@collabora.com, wenst@chromium.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, fparent@baylibre.com, chun-jie.chen@mediatek.com, sam.shih@mediatek.com, y.oudjana@protonmail.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, ryder.lee@kernel.org, daniel@makrotopia.org, jose.exposito89@gmail.com, yangyingliang@huawei.com, pablo.sun@mediatek.com, msp@baylibre.com, weiyi.lu@mediatek.com, ikjn@chromium.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 15/23] clk: mediatek: mt8192: Join top_adj_divs and top_muxes Date: Fri, 23 Dec 2022 10:42:51 +0100 Message-Id: <20221223094259.87373-16-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221223094259.87373-1-angelogioacchino.delregno@collabora.com> References: <20221223094259.87373-1-angelogioacchino.delregno@collabora.com> 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,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752997583455220965?= X-GMAIL-MSGID: =?utf-8?q?1752997583455220965?= |
Series |
MediaTek clocks cleanups and improvements
|
|
Commit Message
AngeloGioacchino Del Regno
Dec. 23, 2022, 9:42 a.m. UTC
These two are both mtk_composite arrays, one dependent on another, but
that's something that the clock framework is supposed to sort out and
anyway registering them separately isn't going to ease the framework's
job in checking dependencies.
Put the contents of top_adj_divs in top_muxes to join them together
and register them in one shot.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/clk/mediatek/clk-mt8192.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
Comments
Hi, > These two are both mtk_composite arrays, one dependent on another, but > that's something that the clock framework is supposed to sort out and > anyway registering them separately isn't going to ease the framework's > job in checking dependencies. > > Put the contents of top_adj_divs in top_muxes to join them together > and register them in one shot. > In mt8192, we can join top_adj_divs and top_muxes: mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, &mt8192_clk_lock, top_clk_data); mtk_clk_register_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), base, &mt8192_clk_lock, top_clk_data); However, there are other top_adj_divs[] and top_muxes[] in different types so we cannot join them. For example: in drivers/clk/mediatek/clk-mt8167.c:mtk_topckgen_init(): mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, &mt8167_clk_lock, clk_data); mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs), base, &mt8167_clk_lock, clk_data); So we can join top_adj_divs and top_muxes in some platforms, but we cannot join top_adj_divs and top_muxes in some other platforms. I'm afraid that this will confuses people. thanks, Miles
On Fri, Dec 23, 2022 at 5:43 PM AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > > These two are both mtk_composite arrays, one dependent on another, but > that's something that the clock framework is supposed to sort out and > anyway registering them separately isn't going to ease the framework's > job in checking dependencies. > > Put the contents of top_adj_divs in top_muxes to join them together > and register them in one shot. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > --- > drivers/clk/mediatek/clk-mt8192.c | 13 ++----------- > 1 file changed, 2 insertions(+), 11 deletions(-) > > diff --git a/drivers/clk/mediatek/clk-mt8192.c b/drivers/clk/mediatek/clk-mt8192.c > index ec9dc7fe848e..702770326286 100644 > --- a/drivers/clk/mediatek/clk-mt8192.c > +++ b/drivers/clk/mediatek/clk-mt8192.c > @@ -698,9 +698,7 @@ static struct mtk_composite top_muxes[] = { > MUX(CLK_TOP_APLL_I2S7_M_SEL, "apll_i2s7_m_sel", apll_i2s_m_parents, 0x320, 23, 1), > MUX(CLK_TOP_APLL_I2S8_M_SEL, "apll_i2s8_m_sel", apll_i2s_m_parents, 0x320, 24, 1), > MUX(CLK_TOP_APLL_I2S9_M_SEL, "apll_i2s9_m_sel", apll_i2s_m_parents, 0x320, 25, 1), > -}; > - > -static const struct mtk_composite top_adj_divs[] = { > + /* APLL_DIV */ This would be CLK_AUDDIV_2 ~ 4 actually. 4 dividers per register. Otherwise, Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
On Wed, Dec 28, 2022 at 4:31 PM Miles Chen <miles.chen@mediatek.com> wrote: > > Hi, > > > These two are both mtk_composite arrays, one dependent on another, but > > that's something that the clock framework is supposed to sort out and > > anyway registering them separately isn't going to ease the framework's > > job in checking dependencies. > > > > Put the contents of top_adj_divs in top_muxes to join them together > > and register them in one shot. > > > > In mt8192, we can join top_adj_divs and top_muxes: > > mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, &mt8192_clk_lock, > top_clk_data); > mtk_clk_register_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), base, &mt8192_clk_lock, > top_clk_data); > > However, there are other top_adj_divs[] and top_muxes[] in different types so > we cannot join them. > > For example: > in drivers/clk/mediatek/clk-mt8167.c:mtk_topckgen_init(): > > mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, > &mt8167_clk_lock, clk_data); > mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs), > base, &mt8167_clk_lock, clk_data); > > So we can join top_adj_divs and top_muxes in some platforms, but we > cannot join top_adj_divs and top_muxes in some other platforms. > > I'm afraid that this will confuses people. I think the confusion comes from the macro names. It's not exactly clear that DIV_GATE is for composite clocks, while DIV_ADJ is for divider clocks. Doubly so for the mux related types. Either way, using the wrong macro or the wrong type will cause the compiler to complain, so I think it's something we can live with. If it's still not working out, maybe we should rethink the naming. ChenYu
diff --git a/drivers/clk/mediatek/clk-mt8192.c b/drivers/clk/mediatek/clk-mt8192.c index ec9dc7fe848e..702770326286 100644 --- a/drivers/clk/mediatek/clk-mt8192.c +++ b/drivers/clk/mediatek/clk-mt8192.c @@ -698,9 +698,7 @@ static struct mtk_composite top_muxes[] = { MUX(CLK_TOP_APLL_I2S7_M_SEL, "apll_i2s7_m_sel", apll_i2s_m_parents, 0x320, 23, 1), MUX(CLK_TOP_APLL_I2S8_M_SEL, "apll_i2s8_m_sel", apll_i2s_m_parents, 0x320, 24, 1), MUX(CLK_TOP_APLL_I2S9_M_SEL, "apll_i2s9_m_sel", apll_i2s_m_parents, 0x320, 25, 1), -}; - -static const struct mtk_composite top_adj_divs[] = { + /* APLL_DIV */ DIV_GATE(CLK_TOP_APLL12_DIV0, "apll12_div0", "apll_i2s0_m_sel", 0x320, 0, 0x328, 8, 0), DIV_GATE(CLK_TOP_APLL12_DIV1, "apll12_div1", "apll_i2s1_m_sel", 0x320, 1, 0x328, 8, 8), DIV_GATE(CLK_TOP_APLL12_DIV2, "apll12_div2", "apll_i2s2_m_sel", 0x320, 2, 0x328, 8, 16), @@ -1099,15 +1097,10 @@ static int clk_mt8192_top_probe(struct platform_device *pdev) if (r) goto unregister_muxes; - r = mtk_clk_register_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), base, - &mt8192_clk_lock, top_clk_data, &pdev->dev); - if (r) - goto unregister_top_composites; - r = mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), top_clk_data, &pdev->dev); if (r) - goto unregister_adj_divs_composites; + goto unregister_top_composites; r = clk_mt8192_reg_mfg_mux_notifier(&pdev->dev, top_clk_data->hws[CLK_TOP_MFG_PLL_SEL]->clk); @@ -1119,8 +1112,6 @@ static int clk_mt8192_top_probe(struct platform_device *pdev) unregister_gates: mtk_clk_unregister_gates(top_clks, ARRAY_SIZE(top_clks), top_clk_data); -unregister_adj_divs_composites: - mtk_clk_unregister_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), top_clk_data); unregister_top_composites: mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), top_clk_data); unregister_muxes: