From patchwork Fri Nov 16 12:54:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 10686259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 425D414BD for ; Fri, 16 Nov 2018 12:55:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F23F2CDAB for ; Fri, 16 Nov 2018 12:55:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 230312CDB6; Fri, 16 Nov 2018 12:55:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BCF422CDAB for ; Fri, 16 Nov 2018 12:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZOdZMM0PfhUr00C5K2dvbjNp69/G/3+uLZ2C+m01OP8=; b=s3Lw0ZGRwbT3O1 pPNWfVgXyRQNc9ljvEGcX4CnPy6H6CzvY7Szw9fOtLpewz/bNPrUokmV2A8DRRxbcwUjLGvk9Yylq 2GE1J0W2QQK3BLfQXwztuntyc8gGplIm4tJl5UvPzPTUIrd6zx8tpusGSG79nuXVhACtVufL6NtvO Vlg+Gtwh8DySzT7hv0IXoFJpd3pEaq9jEs4uJoHmcfLHp47yykFYH2ZIqy7EoHeEkG7bbMxOriP39 r6qU6ZI/Lyn32HC8xWKCTics+wGAcG/8NMXC8rErr4EjX2qZFMdNPfm/menPoAWSjYuNcfFq6uAt6 BSbpNnyuLjtOQ1sRYhaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNdf3-0005OL-A3; Fri, 16 Nov 2018 12:55:49 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNdf1-0005O2-0K; Fri, 16 Nov 2018 12:55:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=t4vRb7vej7pA0poaDyESDl1Tk8levWPv2saLjPFHGIg=; b=isbNy6J6tbDsSdcrpZHOhHZKIo bZN388XlESWgZ6oSoCoALi/yTRqZM3zSshrEWOxetokS3pwNLJBap9sZxiOJyxe7/nL0p8aS2raq5 QSZwZPMUpba/5Vi7nAE2ZdSItuNjMdIIOVLZVIEGmj9bbYWY40GxXIh+ECazinGXXOBo4d2SxUzz0 NFXe0IozeY7vVqPSoTjNpD3pHJ9cZNgfF/8otKFOKSBHimbd6OwK3JDOtPT5p3UC1/tftpFtITV2g MDT/RP7dD3LuQcfM4tqvVIHzxFhodIoXu30AF2Yp54p9WVRcRRXn67UPK/xeK+uTHTO+orCaGzd5B tvvZoMuQ==; Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNdey-0008VK-7d; Fri, 16 Nov 2018 12:55:45 +0000 Received: from ziggy.de (unknown [93.176.133.217]) (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 66F2520989; Fri, 16 Nov 2018 12:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542372936; bh=YWa3oRPVlT/S63uQvThApqIKb9DzRSCSP+OAynmBwf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYpdYAGREL8rC/98+2atoSVHhmJBzkuuyZym5BrQ+pp92C8+ukAY045+yTqhYkGek oqBXxhgzlRS2e3pV1G7S673+hUKXsaXhMzhLOpEvwvPUIJyKisoCYplQciqqX2Dc7v zV5Sxq2+QlEWFW4funxYFx8SyS/FaNYAU3lLwk2s= 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@codeaurora.org, ulrich.hecht+renesas@gmail.com, laurent.pinchart@ideasonboard.com, matthias.bgg@gmail.com Subject: [PATCH v5 02/12] clk: mediatek: mt2701-mmsys: switch to platform device probing Date: Fri, 16 Nov 2018 13:54:39 +0100 Message-Id: <20181116125449.23581-3-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181116125449.23581-1-matthias.bgg@kernel.org> References: <20181116125449.23581-1-matthias.bgg@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181116_075544_426032_DCC9E99A X-CRM114-Status: GOOD ( 15.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, rdunlap@infradead.org, sean.wang@mediatek.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, sean.wang@kernel.org, wens@csie.org, Matthias Brugger , linux-mediatek@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 | 42 ++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt2701-mm.c b/drivers/clk/mediatek/clk-mt2701-mm.c index fe1f85072fc5..200b1842b94b 100644 --- a/drivers/clk/mediatek/clk-mt2701-mm.c +++ b/drivers/clk/mediatek/clk-mt2701-mm.c @@ -12,14 +12,20 @@ * GNU General Public License for more details. */ +#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, @@ -87,23 +93,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", @@ -112,12 +120,22 @@ 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); + kfree(private); + + 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);