From nobody Thu Nov 14 07:01:25 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE780C05027 for ; Mon, 6 Feb 2023 15:30:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbjBFPaO (ORCPT ); Mon, 6 Feb 2023 10:30:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbjBFP3y (ORCPT ); Mon, 6 Feb 2023 10:29:54 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F0BADBFA; Mon, 6 Feb 2023 07:29:53 -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 E14486602F95; Mon, 6 Feb 2023 15:29:50 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1675697392; bh=VUavP0qYk/wKIn4zeMlnEGssDqB/rSJrf27scQBcgnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TGRDyum1g6ftrAjjkSy3xWe/f1YxeCUQlpp7jDY4FUTLP4RaF/SBSj+1p6OXysXPN tRqalaAJoGBlfmH0tCmUTwM/UPK9R2qF98vKy79miQ45v0dJT0PlWNlDZentdBxmpk RYdp16XcjhzcZKuGl9WHcW8GcQH7nbDz+sud0IrKCoirY79N9MAmlsPqdtyJ8XeTKH b9s537IeHNLp8SdTmd5gKI2sH5d5iCkTyULQCxaN6oetuQ9MtC2smo5/I0+Ywd/jTv gA8QcUVBqc40hOMMxFV03UoqZ7NPPE8Ec+94IrkqYdBGjdKKB+Pay7ab9ltLZ/srTo 8QLjVgw6rmwAg== From: AngeloGioacchino Del Regno To: mturquette@baylibre.com Cc: sboyd@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, wenst@chromium.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, chun-jie.chen@mediatek.com, daniel@makrotopia.org, fparent@baylibre.com, msp@baylibre.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, zhaojh329@gmail.com, sam.shih@mediatek.com, edward-jw.yang@mediatek.com, yangyingliang@huawei.com, granquet@baylibre.com, pablo.sun@mediatek.com, sean.wang@mediatek.com, chen.zhong@mediatek.com, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v1 04/45] clk: mediatek: Add divider clocks to mtk_clk_simple_{probe,remove}() Date: Mon, 6 Feb 2023 16:28:47 +0100 Message-Id: <20230206152928.918562-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206152928.918562-1-angelogioacchino.delregno@collabora.com> References: <20230206152928.918562-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add support for divider clocks register/unregister in the common mtk_clk_simple_probe() and mtk_clk_simple_remove() functions. Signed-off-by: AngeloGioacchino Del Regno --- drivers/clk/mediatek/clk-mtk.c | 19 +++++++++++++++++-- drivers/clk/mediatek/clk-mtk.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index a69d3f0a38c7..39bd360aa0c9 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -496,7 +496,7 @@ static int __mtk_clk_simple_probe(struct platform_devic= e *pdev, /* Calculate how many clk_hw_onecell_data entries to allocate */ num_clks =3D mcd->num_clks + mcd->num_composite_clks; num_clks +=3D mcd->num_fixed_clks + mcd->num_factor_clks; - num_clks +=3D mcd->num_mux_clks; + num_clks +=3D mcd->num_mux_clks + mcd->num_divider_clks; =20 clk_data =3D mtk_alloc_clk_data(num_clks); if (!clk_data) @@ -534,11 +534,19 @@ static int __mtk_clk_simple_probe(struct platform_dev= ice *pdev, goto unregister_muxes; } =20 + if (mcd->divider_clks) { + r =3D mtk_clk_register_dividers(mcd->divider_clks, + mcd->num_divider_clks, + base, mcd->clk_lock, clk_data); + if (r) + goto unregister_composites; + } + if (mcd->clks) { r =3D mtk_clk_register_gates(&pdev->dev, node, mcd->clks, mcd->num_clks, clk_data); if (r) - goto unregister_composites; + goto unregister_dividers; } =20 if (mcd->clk_notifier_func) { @@ -567,6 +575,10 @@ static int __mtk_clk_simple_probe(struct platform_devi= ce *pdev, unregister_clks: if (mcd->clks) mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data); +unregister_dividers: + if (mcd->divider_clks) + mtk_clk_unregister_dividers(mcd->divider_clks, + mcd->num_divider_clks, clk_data); unregister_composites: if (mcd->composite_clks) mtk_clk_unregister_composites(mcd->composite_clks, @@ -599,6 +611,9 @@ static int __mtk_clk_simple_remove(struct platform_devi= ce *pdev, of_clk_del_provider(node); if (mcd->clks) mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data); + if (mcd->divider_clks) + mtk_clk_unregister_dividers(mcd->divider_clks, + mcd->num_divider_clks, clk_data); if (mcd->composite_clks) mtk_clk_unregister_composites(mcd->composite_clks, mcd->num_composite_clks, clk_data); diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h index b8e0ff8f52fa..554aecdc1015 100644 --- a/drivers/clk/mediatek/clk-mtk.h +++ b/drivers/clk/mediatek/clk-mtk.h @@ -222,6 +222,8 @@ struct mtk_clk_desc { size_t num_clks; const struct mtk_composite *composite_clks; size_t num_composite_clks; + const struct mtk_clk_divider *divider_clks; + size_t num_divider_clks; const struct mtk_fixed_clk *fixed_clks; size_t num_fixed_clks; const struct mtk_fixed_factor *factor_clks; --=20 2.39.1