Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2403133rwb; Fri, 20 Jan 2023 02:26:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXt2NuCtHXimBlItNlxuNsA51jQcMPWtCpOsJQRUx232VHPeKjAMYgh5Xp4YOaY/++ESk3dT X-Received: by 2002:a05:6a21:2d8e:b0:b8:4cc9:16d9 with SMTP id ty14-20020a056a212d8e00b000b84cc916d9mr14281450pzb.46.1674210395278; Fri, 20 Jan 2023 02:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674210395; cv=none; d=google.com; s=arc-20160816; b=A6bvf4GHZgbtxta0VTy293OWzc6kaj9zgHjboWj7mjRqAuEQv4kStjQZvrHv0DVGvY ZgOLI8FJE0TPyuIxLi+R4C84+abx+Wwk8z6lPrf7XnCAisaK+Eyf40r/06CnCkV/aZkj ul+HyvivcB5ioROPRtFsVzzjqkjFXfpQfs/eWggUY1s/aa/12ujC2bI0HkwEIsHXe0JQ 3Z5ANwrOjahKHm2GNBLpAvWqWaQklCo5XfkCZm5ax8Av8OyWP/unBwYZpRs/k1D7MfXe uoWzrxC2L+DaO6oYLgCeHg/ujKRCP7nXM1VPyL2pfmS/8F7vOuem7OIkFboqbLjv4MjJ jvRw== 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=snza9X6zJt/8WGo2gTops8lbx9NJvo+SSINcOXc+/oE=; b=RAXGQ6kT1fZDHefMJPBHGA44M2h7LFZHm+RA+b3L6xTPkPvUrlpvn5cYdudoWmZTse wakBoIiouL2JJNpE/+aJbz7dY8fLNxW2R1vzkZ08lpOyI+CwpJSUzuiW0u1TZQq59HI3 w2f7gqKyUZVRG/cPOwQ7srWb191xzdBT/R8/Gg7knmZ5lkRWv0UWTdW0ku0An9mWwgLr RmJ+0ziu0yWT0thBiFYEdGYTgkkyBDINS/9b8XcPGRT/PYx9GwEBeHgSw9Bg6EciibGs Qpx8hIOaqdkA6bcwGTlS9oDDbqBhKJ1crWHxhCzSPHZEEk+o0NRMC12Fo3Zjbxti5j1U adFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=beMomBTF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020aa782c5000000b0058dada4acbasi13441262pfn.67.2023.01.20.02.26.29; Fri, 20 Jan 2023 02:26:35 -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=beMomBTF; 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 S230468AbjATJ2B (ORCPT + 48 others); Fri, 20 Jan 2023 04:28:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbjATJ16 (ORCPT ); Fri, 20 Jan 2023 04:27:58 -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 2F8C494C98; Fri, 20 Jan 2023 01:27: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 45AEA6602E83; Fri, 20 Jan 2023 09:21:28 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1674206489; bh=lcznLPtgtJvQ60PU2ET5xSjALXesFcVHBES0BrXeFys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=beMomBTFbEOHG4rWdJkH52yabPWOcak0HncGkOJfd0tX/mGC9ixXUD/yM6yEjftlM jznF4mQSrdcST8eSL/EzcDW81fVY4tUqtB3QKtj0Lju7ga75wFK5fTGo/FNE6h8LCK 5uJ4NAA+3e+CEWJ0LBthwzUjxVeOMFyKSyK42bL8IPnoAloB4R3VKuu2pnmK5iA9FC n3wEKlDA1vc3XFCEry6cEBAhoolLdp4W08OUPBcvNu2TDmp4WLxeO2Nmhwc6dRv2+j hUppv2WoUI2hFwUlD7NT1y79QZIdoIF+ChvNQ0G/RyYFpk0Y8oIPehx0K4qnbNi4Di tZjRAOpYdxelA== 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 v4 18/23] clk: mediatek: clk-mtk: Register MFG notifier in mtk_clk_simple_probe() Date: Fri, 20 Jan 2023 10:20:48 +0100 Message-Id: <20230120092053.182923-19-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120092053.182923-1-angelogioacchino.delregno@collabora.com> References: <20230120092053.182923-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: X-Mailing-List: linux-kernel@vger.kernel.org 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 Tested-by: Miles Chen --- 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 281d30d6cb2b..c90c0a6b501b 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -534,6 +534,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 1bdaa0acb909..41f4fa3b0c21 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); -- 2.39.0