Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2407956ybl; Sat, 7 Dec 2019 14:51:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyuGGygVfio3KAn7iFMiGudHoZcS4qCPrjkTOK94Po0ZBd3CxSzEpBiZF40S/pe5nbwfLic X-Received: by 2002:aca:48d6:: with SMTP id v205mr17959779oia.10.1575759118436; Sat, 07 Dec 2019 14:51:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575759118; cv=none; d=google.com; s=arc-20160816; b=WfA/twNVDnzOJ0weUiauxj/RywrYFupzLyZrx5cyJ7Qe74viX7v9rWBEaODF51/kfQ OZKLG10jhSsBfRLssnUGfbB/jN9iaP5uIcf136JeP0muixJHxWRhfm9B+JXtywl3kgBn X/E5+D8bZQaKDKMNrZJ2nQKJKrudgYkqiWBXsJqSAgNb0OwF1ZKgYh9Ael/eTJBAbmRX yZpgteDqjDyqi/MiJSsdbm/AdJcTNOQhkcI+Ugvt4ZgMONYj8DS2HkuMUx9rYRO3HLVP Lqtl5F9UFCKWDaioCkDRSQ0qMoBtkwa9dY29EhBPRSVZX676/OVQoBD0wR8+QrcOedg3 e9Zw== 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=IwXsZtU9KZh7bi0d8gBck9YWI8H8w4F4lHVQz5UxRZI=; b=WexCXjA4LALiNTpfQklRqeXikrIcm3RCxUjGZy992N2qoMoalR9v1GmOcQZgKGg2Cs COFm8HCyspfWm7XGzzi0j+dCagwe/FqcovqGR9UYBP5jmu5jCQ4+sBLWnxSm6YxtqP2H MICwAboPcTmYKYSxfWuKWxHxZEEXNFBM59i0DCQscOGkboyTWSxUSjJfKX0FAS3D92WO N+EzVJ5oDkW8u7Svn+QV0os36Wct8+uH5PH1xkX+Z4fVtFyV1XwqPcXCqrVB/O/kBmpL 8MlYe+2rFPM/xvbhzdhugyn7L9BJ12WRuAHxE6b8EF9Mys6q1lqE0ppGBBpBwmCNSqXe JKHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Hux5QYpp; 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 14si9672333oie.181.2019.12.07.14.51.45; Sat, 07 Dec 2019 14:51:58 -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=Hux5QYpp; 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 S1727079AbfLGWsp (ORCPT + 99 others); Sat, 7 Dec 2019 17:48:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:44192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfLGWso (ORCPT ); Sat, 7 Dec 2019 17:48:44 -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 A49C924683; Sat, 7 Dec 2019 22:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575758923; bh=TiW6KdtW/ar4YbEgXwuzvM2malWSh9JMEZcRb2LrTeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hux5QYpp3mkEwbFwe+Kii29sd+ioU4lhHyQ0rKFT5mU4jtTxwGU6AFkcyMdeEhuFX xDCs4tBbHV59MO1GJZUGjjegMqsYKGlbC8MQ/+UOWmAUvNKT7omB0+gblSCmjcY/f4 PaSo7GrV/K88iRpIRWGzTfueHmuv7BhxtvWYtEDo= 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 08/12] clk: mediatek: mt6779: switch mmsys to platform device probing Date: Sat, 7 Dec 2019 23:47:36 +0100 Message-Id: <20191207224740.24536-9-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. Singed-off-by: Matthias Brugger --- drivers/clk/mediatek/clk-mt6779-mm.c | 41 +++++++++++++++++++--------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt6779-mm.c b/drivers/clk/mediatek/clk-mt6779-mm.c index fb5fbb8e3e41..439ec460c166 100644 --- a/drivers/clk/mediatek/clk-mt6779-mm.c +++ b/drivers/clk/mediatek/clk-mt6779-mm.c @@ -4,13 +4,19 @@ * Author: Wendell Lin */ +#include #include #include #include +#include #include "clk-mtk.h" #include "clk-gate.h" +struct clk_mt6779_mm_priv { + struct clk_onecell_data *clk_data; +}; + static const struct mtk_gate_regs mm0_cg_regs = { .set_ofs = 0x0104, .clr_ofs = 0x0108, @@ -84,30 +90,39 @@ static const struct mtk_gate mm_clks[] = { GATE_MM1(CLK_MM_DISP_OVL_FBDC, "mm_disp_ovl_fbdc", "mm_sel", 16), }; -static const struct of_device_id of_match_clk_mt6779_mm[] = { - { .compatible = "mediatek,mt6779-mmsys", }, - {} -}; - static int clk_mt6779_mm_probe(struct platform_device *pdev) { - struct clk_onecell_data *clk_data; - struct device_node *node = pdev->dev.of_node; + struct clk_mt6779_mm_priv *private; + struct device_node *node = pdev->dev.parent->of_node; + + private = devm_kzalloc(&pdev->dev, sizeof(*private), GFP_KERNEL); + if (!private) + return -ENOMEM; - clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK); + private->clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK); + platform_set_drvdata(pdev, private); mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks), - clk_data); + private->clk_data); - return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + return of_clk_add_provider(node, of_clk_src_onecell_get, + private->clk_data); +} + +static int clk_mt6779_mm_remove(struct platform_device *pdev) +{ + struct clk_mt6779_mm_priv *private = platform_get_drvdata(pdev); + + kfree(private->clk_data); + + return 0; } static struct platform_driver clk_mt6779_mm_drv = { .probe = clk_mt6779_mm_probe, + .remove = clk_mt6779_mm_remove, .driver = { .name = "clk-mt6779-mm", - .of_match_table = of_match_clk_mt6779_mm, }, }; - -builtin_platform_driver(clk_mt6779_mm_drv); +module_platform_driver(clk_mt6779_mm_drv); -- 2.24.0