From patchwork Fri Dec 23 09:42:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 36187 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp230430wrn; Fri, 23 Dec 2022 01:46:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcRXpBjuYK01jhm5H2NsGYTlkQgC+Qyhly2g+ZAdNRz6C5ddD42dfmK460Y/b7pS7siPg0 X-Received: by 2002:a62:1845:0:b0:577:9182:199a with SMTP id 66-20020a621845000000b005779182199amr24474112pfy.29.1671788783187; Fri, 23 Dec 2022 01:46:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671788783; cv=none; d=google.com; s=arc-20160816; b=O/V1swXqB746BPKgsDxcEN5gP7PA4LOdoU8+tn+vNO9s37+1m2cFu5KMOXaO2eNM7h v0jpxMBxHl2J3hqytqyXChySAZU7W69o0mJzcblskhTzD5LCZrF3zjMSTMzjPc5R1rrN BPhcdmRdHH2nZfTs2g4lp0kk5kA03xyAn/1ZOLKKzMZM2U+ZPL4fonMNYN/xzd+W0Tsw UHXHCRb043JCmqaFgCo0BExyh3N4Y5dLuLJbmuD55RFr+wpSrUNgvd50vZad7OhjcBas C8oW4ZPrM8K9CoXMtAKh23VA6iJ1T2vgvHkRw55LA0nP2KCxwbM0l/1kTLF6eeg8RPqB hdLA== 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=RnGVrTmbfW15kEASwjA5R+smQoKCeb6Jj32aS2/Gxxk=; b=vTU6hwhhR5WIhD/MQF56glLD1NfYg1nXGcmYmxpbYvmr8DJgToRaJZGqvSNpAe1UsG VG+LbHWyLMgtvQMVpUEBeMTxn30/golPanuUR1Z/9LUXU07F0FGwn7wcX5eMmVyhWEQD KGtVIMJyG6K8UFHYI4065/twXhsRjXV/IBNz7132zqvMliKqNjqucLj7dOK8l0meoOBY dLCcX3e5GQDuErGLLiE7jeYQMYFRvbN/u9B6IdpUZOBDVoRDcsQZEN/MIzvS+Ub2HUL8 BD7jbNcv5t37+aA49ghYirQUeiMowfq8qzprwQzJgwcyS2QWged+XDfaU1OrjV3owybl eIbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KPC7FPSj; 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 j2-20020a63ec02000000b004780edf920fsi3338487pgh.165.2022.12.23.01.46.10; Fri, 23 Dec 2022 01:46:23 -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=KPC7FPSj; 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 S236251AbiLWJpd (ORCPT + 99 others); Fri, 23 Dec 2022 04:45:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236245AbiLWJo1 (ORCPT ); Fri, 23 Dec 2022 04:44:27 -0500 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 63856389CD; Fri, 23 Dec 2022 01:43:34 -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 F410F6602CE4; Fri, 23 Dec 2022 09:43:31 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1671788613; bh=TB2QhHFNzebUtVjzF6MRv2ASnqmZ72MkQz0OkWYeXmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KPC7FPSj9LTlhYFP3851u8fVFh/LHpcxXQVw7iH3OD9wRtOwk0W87cbD9c3Xw+266 /Ch2BsVylfU3wGMS2ENX9wPRRgtQMYRaXROPkfq5QSbxxnzYn9IU2KsVMAxLUmQIMJ ypcd/IojllZzyAuM4lg3PFLzBrpZK3CENa7baO7kltwYiE5cq2azIeoZyAWE3Fo1tm HJbpKo4d01E4fxD/8lwu48c9WihtK0rQ1WXfFHjpVHXhxJIoPUXmBknifX6rKVusRE cJ1m711Cx8XbPWtT2dtVa4kXnyLMb/yHlH+rb5h+cxjzTI0pbH9eLLAD6fEHH2ZcMJ qU7nHjnbt7GAA== From: AngeloGioacchino Del Regno 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 18/23] clk: mediatek: clk-mtk: Register MFG notifier in mtk_clk_simple_probe() Date: Fri, 23 Dec 2022 10:42:54 +0100 Message-Id: <20221223094259.87373-19-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752997595210902814?= X-GMAIL-MSGID: =?utf-8?q?1752997595210902814?= In preparation for commonizing topckgen probe on various MediaTek SoCs clock drivers, add the ability to register the MFG MUX notifier in mtk_clk_simple_probe() by passing a custom notifier register function pointer, as this function will be slightly different across different SoCs. Signed-off-by: AngeloGioacchino Del Regno --- drivers/clk/mediatek/clk-mtk.c | 8 ++++++++ drivers/clk/mediatek/clk-mtk.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index b0a6225cd7b2..df6281492fb6 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -533,6 +533,14 @@ int mtk_clk_simple_probe(struct platform_device *pdev) goto unregister_composites; } + if (mcd->clk_notifier_func) { + struct clk *mfg_mux = clk_data->hws[mcd->mfg_clk_idx]->clk; + + r = mcd->clk_notifier_func(&pdev->dev, mfg_mux); + if (r) + goto unregister_clks; + } + r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); if (r) goto unregister_clks; diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h index 1d036ba6ca07..bdbd36e3d794 100644 --- a/drivers/clk/mediatek/clk-mtk.h +++ b/drivers/clk/mediatek/clk-mtk.h @@ -231,6 +231,9 @@ struct mtk_clk_desc { const struct mtk_clk_rst_desc *rst_desc; spinlock_t *clk_lock; bool shared_io; + + int (*clk_notifier_func)(struct device *dev, struct clk *clk); + unsigned int mfg_clk_idx; }; int mtk_clk_simple_probe(struct platform_device *pdev);