Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2407200ybl; Sat, 7 Dec 2019 14:50:32 -0800 (PST) X-Google-Smtp-Source: APXvYqyZzAQpWg02ay5TeCM4IzXLIEzYaXk9t8h5VjnXTM83Wj97haQYAWUp2Nzcde8j6VjRKOAe X-Received: by 2002:a05:6830:10d5:: with SMTP id z21mr17056601oto.30.1575759032262; Sat, 07 Dec 2019 14:50:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575759032; cv=none; d=google.com; s=arc-20160816; b=MQvuwZrrxk3CR/rC4S7icArP9q1W5kYDKG/c7bphspgc4cT7HQIoqvtKw/SpkfVVoS jQ4y5YVOIe/vJfHo2ZSbpg7AFzYWiGBEYT/BpIHMjs4KuR5kieRJqYv0n9rkQiae5RWm mXIYi1/pEkb6S8fPmU71EhxSbgG6h1vtn5EcCrX6ga8q2PyIX8KkEgGlqCi6oz1lm3xq 6fnuD9vgW4NtoA31B/DLhkz6R6XBYGD1KUIYwTnqxSyijHFQ2D7t4cqCZe5APhFMtlqK OlFKGn8Q7/9b2LCgEQyFvtzgTfrl/tCGktyP/peE2i3tbGdLjEtNVSfBR9L4WRjaKFYd nQ7A== 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=JZ7FnakMuMB+gQwFJVT/DV0Tqrhnd7V1U/mToGml1qk=; b=waSxTFZxope6xmNHhz++nxpM+ywhiCgtgPUTuI0jLONuVrHjEh5W1Fiw+iflitmUlb xIgOekEmNaS0JT7r+flRWXjgNdoG8NpD9zWfZdeGMKGWXtVf92KPV3Hriz6WCJY7XiFb 9BUknk14R6JX0BFpP+IF7VUw5SJsw3WX5qSeOFkyG31yZxlzdsufI2+Or1lUcG4xjQbB CNxECF//FSFVXPnpiHm/znE82XoZRWeDhhaeEg3UOLTcnaEcUV0MDxR+2gQjEZn6oMRo 8ATjMS34I45C6yc2wcrkpffSK/69uqI5jCdIDPrCUXnGU409JJApeHGKh3+meIfItFjs 7R9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FHzctaPD; 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 u16si9682245otq.92.2019.12.07.14.50.21; Sat, 07 Dec 2019 14:50:32 -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=FHzctaPD; 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 S1727109AbfLGWsw (ORCPT + 99 others); Sat, 7 Dec 2019 17:48:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:44320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfLGWst (ORCPT ); Sat, 7 Dec 2019 17:48:49 -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 BA4EB24679; Sat, 7 Dec 2019 22:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575758928; bh=3FbY01Yo8wuTVmQw8dJE0UXjIQE+PrPmANVZvznNVUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FHzctaPDg7dmplUogi7XCryhwqRMNZFXIBlR7oUmI2XAavnPHKo+bUlcIw4ffAhRL SSbhYLgM5RvNv3cYTgPLykvDmvIsjb+G+Wy4Z4mEQ7Upw/9o/g2hp/MD/IjGayc4Qd LCyQ/IyloH7OqNCHkU87vJ1ntXqRV2lf8ahzp3NE= 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 09/12] clk: mediatek: mt6797: switch to platform device probing Date: Sat, 7 Dec 2019 23:47:37 +0100 Message-Id: <20191207224740.24536-10-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-mt6797-mm.c | 43 +++++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt6797-mm.c b/drivers/clk/mediatek/clk-mt6797-mm.c index 8f05653b387d..1aea4f8d5a9d 100644 --- a/drivers/clk/mediatek/clk-mt6797-mm.c +++ b/drivers/clk/mediatek/clk-mt6797-mm.c @@ -4,13 +4,19 @@ * Author: Kevin Chen */ +#include #include #include +#include #include #include "clk-mtk.h" #include "clk-gate.h" +struct clk_mt6797_mm_priv { + struct clk_onecell_data *clk_data; +}; + static const struct mtk_gate_regs mm0_cg_regs = { .set_ofs = 0x0104, .clr_ofs = 0x0108, @@ -92,23 +98,24 @@ static const struct mtk_gate mm_clks[] = { "clk26m", 3), }; -static const struct of_device_id of_match_clk_mt6797_mm[] = { - { .compatible = "mediatek,mt6797-mmsys", }, - {} -}; - static int clk_mt6797_mm_probe(struct platform_device *pdev) { - struct clk_onecell_data *clk_data; + struct clk_mt6797_mm_priv *private; int r; - struct device_node *node = pdev->dev.of_node; + struct device *parent = pdev->dev.parent; + + 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); + mtk_clk_register_gates(parent->of_node, mm_clks, ARRAY_SIZE(mm_clks), + private->clk_data); - r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + r = of_clk_add_provider(parent->of_node, of_clk_src_onecell_get, + private->clk_data); if (r) dev_err(&pdev->dev, "could not register clock provider: %s: %d\n", @@ -117,12 +124,20 @@ static int clk_mt6797_mm_probe(struct platform_device *pdev) return r; } +static int clk_mt6797_mm_remove(struct platform_device *pdev) +{ + struct clk_mt6797_mm_priv *private = platform_get_drvdata(pdev); + + kfree(private->clk_data); + + return 0; +} + static struct platform_driver clk_mt6797_mm_drv = { .probe = clk_mt6797_mm_probe, + .remove = clk_mt6797_mm_remove, .driver = { .name = "clk-mt6797-mm", - .of_match_table = of_match_clk_mt6797_mm, }, }; - -builtin_platform_driver(clk_mt6797_mm_drv); +module_platform_driver(clk_mt6797_mm_drv); -- 2.24.0