Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2406948ybl; Sat, 7 Dec 2019 14:50:07 -0800 (PST) X-Google-Smtp-Source: APXvYqxywFHvv4wAQgwDd/S8q3Zhwt/5BKirc5sMBOKQBwIRf8iQqx4lFYLEgb9aneS8hGCpngPy X-Received: by 2002:a9d:6c06:: with SMTP id f6mr16273690otq.318.1575759007087; Sat, 07 Dec 2019 14:50:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575759007; cv=none; d=google.com; s=arc-20160816; b=GGgQRwBHISu/4Zy2CZ3H9rffGRlaHkV3lWuFknzaz/JQFoXd5jI5hdDE8HQFj8tKh9 xJmAcmKW0Z1FLnJZoqBwbaRDjXsHCPP+evD40XFR5xFuoke9uNTgiPt0cTYO+QxhNkLO Nwf09BhwbUkRwHh4t6mSs6yzWBUAWkbaoYeR9l0VuLPnMVe8RxR+wVK8bs397RjxQY16 kED9ygjGs8V0Pq+Fwsiz2IX9FNQ2SA2LyGU6FOaw2h3apdJEYVt/B9LTpkoFN1fba2UI HVMRhk1Ly7Ge3OeRHnkBenMvGlsyaa1j30YFikFAYTvWFrWgiYtjBVQ+LdaF9pE7G3u/ FvcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1pOgjlJA1673cnEYY26M2BRr2LB0xwm+4/wzxBa8b50=; b=GQgJ94qpRpICbcIjTAA+nBJdM2FbKUECAkjOU898ZAtBvhx+a7FLm/N84MVlwq/+4/ SkfR4gBsMRPcNTk3C8zG+1tK+IEPEy+609/xyxd5sl4AYz3I1BwslkL3cCxZZVucdovH GtqXxAN7KhCdXnFDeQO9s3nPnNW81CIdmPixbyYzCKbjipuk3baMXEzJoiObJs/J6qaR D9RF+CGNhUDygQNFW1NFlTO6sqGNf5Me+Db6T1SKhoHUjnBk8qIXPkiLMBGuY7hhagaE 1CNZO/7+Ei9VnyOVbFWpKEDnMUbpFyDL0qLMXW/FVvpjkBMpXw78NFa9I5qVjTo9y6rv l2Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=slqNGvYI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si12647349otz.101.2019.12.07.14.49.45; Sat, 07 Dec 2019 14:50:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=slqNGvYI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727038AbfLGWsf (ORCPT + 99 others); Sat, 7 Dec 2019 17:48:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:43890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfLGWse (ORCPT ); Sat, 7 Dec 2019 17:48:34 -0500 Received: from ziggy.de (unknown [95.169.229.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 76E652467C; Sat, 7 Dec 2019 22:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575758913; bh=FAUVKc3LCu1hHsC00k/MW/ZDjSgvalsHfSMYXaOWuAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=slqNGvYIkHPiWH0SVYrJieIrY/BdHrnDMEq2YBEeviwF+xRAQbnTcAfXtHU4ru5sY tChI3Jge/v0ITEB5mFaMKO2KGp3RNxPTPYtCpFApaJTxA9/f95b0YEu4ij5bWWo7zL TKYZiX9319uoU4c2WgM55GchJc4ee6IgFgxuOnEg= From: matthias.bgg@kernel.org To: robh+dt@kernel.org, mark.rutland@arm.com, ck.hu@mediatek.com, p.zabel@pengutronix.de, airlied@linux.ie, mturquette@baylibre.com, sboyd@kernel.org, ulrich.hecht+renesas@gmail.com, laurent.pinchart@ideasonboard.com, enric.balletbo@collabora.com Cc: sean.wang@mediatek.com, sean.wang@kernel.org, rdunlap@infradead.org, wens@csie.org, hsinyi@chromium.org, frank-w@public-files.de, drinkcat@chromium.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mbrugger@suse.com, matthias.bgg@kernel.org Subject: [resend PATCH v6 06/12] clk: mediatek: mt2701: switch mmsys to platform device probing Date: Sat, 7 Dec 2019 23:47:34 +0100 Message-Id: <20191207224740.24536-7-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191207224740.24536-1-matthias.bgg@kernel.org> References: <20191207224740.24536-1-matthias.bgg@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthias Brugger Switch probing for the MMSYS to support invocation to a plain paltform device. The driver will be probed by the DRM subsystem. Signed-off-by: Matthias Brugger --- drivers/clk/mediatek/clk-mt2701-mm.c | 41 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt2701-mm.c b/drivers/clk/mediatek/clk-mt2701-mm.c index 054b597d4a73..4a9433c2b2b8 100644 --- a/drivers/clk/mediatek/clk-mt2701-mm.c +++ b/drivers/clk/mediatek/clk-mt2701-mm.c @@ -4,14 +4,20 @@ * Author: Shunli Wang */ +#include #include #include +#include #include "clk-mtk.h" #include "clk-gate.h" #include +struct clk_mt2701_mm_priv { + struct clk_onecell_data *clk_data; +}; + static const struct mtk_gate_regs disp0_cg_regs = { .set_ofs = 0x0104, .clr_ofs = 0x0108, @@ -79,23 +85,25 @@ static const struct mtk_gate mm_clks[] = { GATE_DISP1(CLK_MM_TVE_FMM, "mm_tve_fmm", "mm_sel", 14), }; -static const struct of_device_id of_match_clk_mt2701_mm[] = { - { .compatible = "mediatek,mt2701-mmsys", }, - {} -}; - static int clk_mt2701_mm_probe(struct platform_device *pdev) { - struct clk_onecell_data *clk_data; int r; - struct device_node *node = pdev->dev.of_node; + struct device_node *node = pdev->dev.parent->of_node; + struct clk_mt2701_mm_priv *private; + + private = devm_kzalloc(&pdev->dev, sizeof(*private), GFP_KERNEL); + if (!private) + return -ENOMEM; - clk_data = mtk_alloc_clk_data(CLK_MM_NR); + private->clk_data = mtk_alloc_clk_data(CLK_MM_NR); + + platform_set_drvdata(pdev, private); mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks), - clk_data); + private->clk_data); - r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + r = of_clk_add_provider(node, of_clk_src_onecell_get, + private->clk_data); if (r) dev_err(&pdev->dev, "could not register clock provider: %s: %d\n", @@ -104,12 +112,21 @@ static int clk_mt2701_mm_probe(struct platform_device *pdev) return r; } +static int clk_mt2701_mm_remove(struct platform_device *pdev) +{ + struct clk_mt2701_mm_priv *private = platform_get_drvdata(pdev); + + kfree(private->clk_data); + + return 0; +} + static struct platform_driver clk_mt2701_mm_drv = { .probe = clk_mt2701_mm_probe, + .remove = clk_mt2701_mm_remove, .driver = { .name = "clk-mt2701-mm", - .of_match_table = of_match_clk_mt2701_mm, }, }; -builtin_platform_driver(clk_mt2701_mm_drv); +module_platform_driver(clk_mt2701_mm_drv); -- 2.24.0