From patchwork Fri Jan 20 09:20:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 46255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp98835wrn; Fri, 20 Jan 2023 01:26:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXs0+OKZVZogidZC9YoGrgmkXChRLKJA1F1FCeUEooyaV6GNXqoPYdLmL6d6KhswjjXdKuTx X-Received: by 2002:a17:90a:e554:b0:229:2a57:6df6 with SMTP id ei20-20020a17090ae55400b002292a576df6mr14216671pjb.2.1674206764640; Fri, 20 Jan 2023 01:26:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674206764; cv=none; d=google.com; s=arc-20160816; b=XNaX8yxoZWQ9VrgE+2FxQU1KhsYGQvSWpq6Spa7tfTklbILWHcZycyu5ZeM/6vtozi 6KLt3/r67rw3ci9TqkSHXtN+CyM7eSGzhhWldJ/dCgMWAYkYoD9ctQiEEs3+JOMy0/QM 5UhU5oi9LuwVz8m4L0crk1RjFpc6PV1/i2A2MUgXpB53pljt8UwE9bIXsW+ai/s738m7 UtJza340SXuaYW/sBeSzALPmpBRX2sGCDMzn87D/pD9dDn41SwAUNjNDpXFEe7T3qLiw iGG0rYdLe3IrZYEbjyYaRdSscg9pgD8jZD3un7jbIBwb9QVmghpAKGH0rFJGmckrhI6e 5VbQ== 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=vIsP57YLXGg8hP5ovflaeOS4NTXL98+zNH2CpmbnDOw=; b=cwHfnj1IVaR6CbKzv3BiPWk2v0e8h7f4NJvXS/eaHnZsiZViSj5CRwWV7/fhQ+/ufM ondbP1D8kgSIfTZ/D96zSpXIFTB2fmGD+YoPcbbqQo0XzRkW7jBh9PgxXW5DNCU+0ywd ZSq6fKEpyl64mnENfEnvZxBAKYYCI2RD+gdieoKmIsO2NlJYtV49iLD8t1wDphxs3EdX a3xliz73rp279EgkfpAW0K3WYjfpuxkcdJiCTDKVRXr1qU6Dn8hW18SduKXxE9irRN4A trFWlk5KY3zXrBjtcpSDAHNoDOtBK9RzrKZu4N96HQMC0gwWy0LVmlty+It9e//iL4SX 0VUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PYD6aK9i; 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 cm8-20020a17090afa0800b00229a54e2749si1814879pjb.165.2023.01.20.01.25.52; Fri, 20 Jan 2023 01:26:04 -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=PYD6aK9i; 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 S230393AbjATJX5 (ORCPT + 99 others); Fri, 20 Jan 2023 04:23:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230520AbjATJXp (ORCPT ); Fri, 20 Jan 2023 04:23:45 -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 D50B58F6E2; Fri, 20 Jan 2023 01:22:45 -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 9AD526602E55; Fri, 20 Jan 2023 09:21:36 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1674206498; bh=OR96jyfG6jmlGtj7KrVYH6mHMab9y7sfZFD/VnKDl1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYD6aK9iuoqfaPj1rxOp2FtUyanq7MUa+Kh+Z3AS+EBO1fFWBv7V+NsdxG80fYYau ibzZuQAsKtUqm2AJs+LnioSPBlf7zcBvDbCGKOnvgzRxFbK3yawIMsn6SFuxHIeBjL Az2D95dO+K8gNKj2Og1Cysb0H+kkKhI4WhDx3/i6Zyy/Xm6fr7PE1fSR06++katSGq 9p6HWmC5icK1dcQJfjzWIYFBUT+QcJWZdgCKsO52mDFKGM8G3yOsBy2xmJxnlPwxBF t1SxQW5JxPDH5slRuDOFjp7VJE/c32iyr20Wx7oIiyhva7qzrYkMBVeWN0N3fE/quu DN6cDOjLoOqqg== 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 23/23] clk: mediatek: clk-mt7986-topckgen: Migrate to mtk_clk_simple_probe() Date: Fri, 20 Jan 2023 10:20:53 +0100 Message-Id: <20230120092053.182923-24-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 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?1755533032411057753?= X-GMAIL-MSGID: =?utf-8?q?1755533032411057753?= There are no more non-common calls in clk_mt7986_topckgen_probe(): migrate this driver to mtk_clk_simple_probe(). Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Miles Chen Reviewed-by: Chen-Yu Tsai --- drivers/clk/mediatek/clk-mt7986-topckgen.c | 55 +++++----------------- 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt7986-topckgen.c b/drivers/clk/mediatek/clk-mt7986-topckgen.c index 36553f0c13fe..dff9976fa689 100644 --- a/drivers/clk/mediatek/clk-mt7986-topckgen.c +++ b/drivers/clk/mediatek/clk-mt7986-topckgen.c @@ -290,53 +290,24 @@ static const struct mtk_mux top_muxes[] = { 0x1C4, 5), }; -static int clk_mt7986_topckgen_probe(struct platform_device *pdev) -{ - struct clk_hw_onecell_data *clk_data; - struct device_node *node = pdev->dev.of_node; - int r; - void __iomem *base; - int nr = ARRAY_SIZE(top_fixed_clks) + ARRAY_SIZE(top_divs) + - ARRAY_SIZE(top_muxes); - - base = of_iomap(node, 0); - if (!base) { - pr_err("%s(): ioremap failed\n", __func__); - return -ENOMEM; - } - - clk_data = mtk_alloc_clk_data(nr); - if (!clk_data) - return -ENOMEM; - - mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), - clk_data); - mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); - mtk_clk_register_muxes(&pdev->dev, top_muxes, - ARRAY_SIZE(top_muxes), node, - &mt7986_clk_lock, clk_data); - - r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); - - if (r) { - pr_err("%s(): could not register clock provider: %d\n", - __func__, r); - goto free_topckgen_data; - } - return r; - -free_topckgen_data: - mtk_free_clk_data(clk_data); - return r; -} +static const struct mtk_clk_desc topck_desc = { + .fixed_clks = top_fixed_clks, + .num_fixed_clks = ARRAY_SIZE(top_fixed_clks), + .factor_clks = top_divs, + .num_factor_clks = ARRAY_SIZE(top_divs), + .mux_clks = top_muxes, + .num_mux_clks = ARRAY_SIZE(top_muxes), + .clk_lock = &mt7986_clk_lock, +}; static const struct of_device_id of_match_clk_mt7986_topckgen[] = { - { .compatible = "mediatek,mt7986-topckgen", }, - {} + { .compatible = "mediatek,mt7986-topckgen", .data = &topck_desc }, + { /* sentinel */ } }; static struct platform_driver clk_mt7986_topckgen_drv = { - .probe = clk_mt7986_topckgen_probe, + .probe = mtk_clk_simple_probe, + .remove = mtk_clk_simple_remove, .driver = { .name = "clk-mt7986-topckgen", .of_match_table = of_match_clk_mt7986_topckgen,