Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp107933imm; Tue, 17 Jul 2018 15:01:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpejX9WkKOJJh0fZsE17gvg+BlaBmHWSPs2eO1dMiMXF1pXXk5XTELRMs7VJ9u72vNknSzjC X-Received: by 2002:a62:d98f:: with SMTP id b15-v6mr2446057pfl.1.1531864878375; Tue, 17 Jul 2018 15:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531864878; cv=none; d=google.com; s=arc-20160816; b=oM2pINx9wiJZWlSoJcjwj4F5va4WhM5f2+FHv2lGAOHX8vPaz2EAL1Uhn+mTLAa0Hv oMjtKgEWq4Jyi/vS6zvATzdq2Uv2YlsBBiwpSmJhXJ3A9b3pFrA21+ku7E0zpHn0CFgy TuMLxSD3IHT5GNzpxFGUgXUCkPvmpnr0G32kjjzOkztWBfgHsAEXhhpIIbk2s89gBdGw XtfJpMA9uwQLjY8HIXeQuP6hDik3lOdkJpVm5ze79ZQdPk2jfZWOmLUmb/RWQK2lv48X QPuwNyi8l+FEvtYcTu3YeBHsI7DwTJWyF28Q7YlRHl+1I5GqxSNpDz+ZQ8vsBNmZs4T4 MEbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=s8RCurzsYy1LTOzRfp8y3gwbvytCuOdRf0wzeaTd46A=; b=U4JE+/2NMBto1O5Xl/O5UEWkVBw1z6VS0dIPA9DxVk2Tey3i8WU+Zx/R5PPdU8Tcmf QbbBDkqwBDgAzf9CNnFDtDGk9HC8buZBMhMjHkndH4Q25pmJpBqZ2jj2UnexTXU8n2TW dtpV6kbk/rAViWpzMjV2IcuROce8HcDc4sn2szcZf6jjWJuLvbc3EIxvXeyf6qFgtH97 XAK5ljS8HRyw8x0tGW/uMv83HZNHjqKqav7YbyoLHNbxPBgHP201ejdjGmPAL90pKib5 zwXMwdJq3brHILUf1xMTWiTa4AfRGRO9QI2G+PPOQC4GtfzsR+Gk32g5f6JmLAXcUlj+ GR2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SFDWH2tX; 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 x19-v6si1868490pgl.660.2018.07.17.15.01.03; Tue, 17 Jul 2018 15:01:18 -0700 (PDT) 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=SFDWH2tX; 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 S1731325AbeGQWe4 (ORCPT + 99 others); Tue, 17 Jul 2018 18:34:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:44466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730480AbeGQWe4 (ORCPT ); Tue, 17 Jul 2018 18:34:56 -0400 Received: from ziggy.de (144.pool85-56-49.dynamic.orange.es [85.56.49.144]) (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 5FF2220836; Tue, 17 Jul 2018 22:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531864816; bh=totdlQGjZC0xH4Bv4jG2HvOFf3a91b0+KWpmIUhORts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SFDWH2tXGBUhEircQ6PK+rAkm+klitELOOCvO2BmQeckx9TC8tAmTJHht8fTQ3lJa kQgW8IjYvb/Um16qbbmEii1mayLU/JTfhmb90MqsaerjBXLA3uuqzjCQQuxEhON8YU 1bO+CD1PbnoFEShp18eFn3t10WZoah1Ety6+IAXM= From: matthias.bgg@kernel.org To: laurent.pinchart@ideasonboard.com, ck.hu@mediatek.com, p.zabel@pengutronix.de, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@codeaurora.org, lee.jones@linaro.org Cc: davem@davemloft.net, gregkh@linuxfoundation.org, mchehab@kernel.org, rdunlap@infradead.org, pi-cheng.chen@linaro.org, sean.wang@mediatek.com, linux-clk@vger.kernel.org, linux@armlinux.org.uk, matthias.bgg@gmail.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Matthias Brugger Subject: [PATCH v4--to=ulrich.hecht+renesas@gmail.com 2/5] clk: mediatek: mt2701-mmsys: switch to platform device probing Date: Tue, 17 Jul 2018 23:59:48 +0200 Message-Id: <20180717215951.378-3-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180717215951.378-1-matthias.bgg@kernel.org> References: <20180717215951.378-1-matthias.bgg@kernel.org> 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 | 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); -- 2.17.1