Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp109584imm; Tue, 17 Jul 2018 15:02:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfbCaRNuHgab8eJb5V64BnLsQKl9vJOlZwxj+0spYl4ovW2XBpqHhv9sQzIcRkCWHnFcdZ9 X-Received: by 2002:a62:f610:: with SMTP id x16-v6mr2450995pfh.169.1531864953081; Tue, 17 Jul 2018 15:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531864953; cv=none; d=google.com; s=arc-20160816; b=Vtgw8/LVUc6Hy7eQaH4fE+TURkvwjrI7ifM6dws98wBNZJkSr+8zb5fIgJyIYHUqY9 U7Qe9rOLOa8rIwLiNbLRPUU8rE94okcRSRZPQ2wWNOclCfV+mTzvzQRBjofv5gz1FlxM BzPEK0dnF33i/hxCqA8oDl93kSGhJL5ZhD82BHaQx0su+c6cmZJTdjcacsiMaK4ek9+I KDUztksNvFCFUARkehoA9yqQPyX5nBw4kjy5R6zFoHCJ0KXl6iNEPFh7eL/zHwZpTNvH G+6dWeZzwDPmIjej+XH41dBjd1LeWX4v3phcqxetbr9UCSDzTZXLMSa9OKMJGH8x2ghd CKRg== 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=Z9Q6DpZD7Xo7VCC5x4DoILT4hFy0HqRwygh1gd20xI4=; b=O3lnCD88U6xMeLszURFopAB/6MzGboIC4zg8fyHE0/jEqLBzrEvR89U3q1sVpWLh00 94aOySyopBBghiGHrD97HsiD7gz6YcL2XL4ex2dqG6OaFlf4As4FGu2bqVYIrHlVhEmS 4tOmHeVO75BXaDdwRPlCg5X95bOkekOujmNBlNKGzhkWItugNKnrQDfDZauy4bJoDj2a mHc659qs5F7E92XmrGTS5c6nRnVSggEi/n1ZfcGpkSqjRQJRHk1AROrNW+NKx9d8YA3C XQzGsFCz084NsDm9R0itCNKGQX5W7Bi4ZA/zSwvdYtyIg+mrft4+Y+tilkXbJJ3OyZCF 6vTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XebF2Lr6; 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 f23-v6si1598436plr.247.2018.07.17.15.02.18; Tue, 17 Jul 2018 15:02:33 -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=XebF2Lr6; 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 S1731445AbeGQWfH (ORCPT + 99 others); Tue, 17 Jul 2018 18:35:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:44714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730008AbeGQWfG (ORCPT ); Tue, 17 Jul 2018 18:35:06 -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 D75B82075E; Tue, 17 Jul 2018 22:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531864826; bh=N9KVlc87ADl1cpTrfAOr4Pv9YxzTCgoDn6201pGoWlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XebF2Lr6o9uMlvUQ7KMcfqCYGivD3c8MYjxmuDJHheRN4dE3RgaLP5/mKI3nJx9/K h6okFxFPuXX8En/s85UXuchrfru0YRwhMYxX7/f7sfmpzNLTo4HId2YL69b5TV4Bcy Pd8SLX/nVG/4+6+C1FHBnx345z66w0S18envpArw= 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 4/5] drm/mediatek: Add support for mmsys through a pdev Date: Tue, 17 Jul 2018 23:59:50 +0200 Message-Id: <20180717215951.378-5-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 The MMSYS subsystem includes clocks and drm components. This patch adds an initailization path through a platform device for the clock part, so that both drivers get probed from the same device tree compatible. Signed-off-by: Matthias Brugger --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 18 ++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_drv.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index dd249cf5121e..c946aea722e5 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -173,6 +173,7 @@ static const struct mtk_mmsys_driver_data mt2701_mmsys_driver_data = { .ext_path = mt2701_mtk_ddp_ext, .ext_len = ARRAY_SIZE(mt2701_mtk_ddp_ext), .shadow_register = true, + .clk_drv_name = "clk-mt2701-mm", }; static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = { @@ -180,6 +181,7 @@ static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = { .main_len = ARRAY_SIZE(mt8173_mtk_ddp_main), .ext_path = mt8173_mtk_ddp_ext, .ext_len = ARRAY_SIZE(mt8173_mtk_ddp_ext), + .clk_drv_name = "clk-mt8173-mm", }; static int mtk_drm_kms_init(struct drm_device *drm) @@ -411,6 +413,19 @@ static int mtk_drm_probe(struct platform_device *pdev) if (IS_ERR(private->config_regs)) return PTR_ERR(private->config_regs); + if (private->data->clk_drv_name) { + private->clk_dev = platform_device_register_data(dev, + private->data->clk_drv_name, -1, + NULL, 0); + + if (IS_ERR(private->clk_dev)) { + pr_err("failed to register %s platform device\n", + private->data->clk_drv_name); + + return PTR_ERR(private->clk_dev); + } + } + /* Iterate over sibling DISP function blocks */ for_each_child_of_node(dev->of_node->parent, node) { const struct of_device_id *of_id; @@ -515,6 +530,9 @@ static int mtk_drm_remove(struct platform_device *pdev) for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) of_node_put(private->comp_node[i]); + if (private->clk_dev) + platform_device_unregister(private->clk_dev); + return 0; } diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index 86cec19193c4..200eee5de419 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -34,11 +34,13 @@ struct mtk_mmsys_driver_data { const enum mtk_ddp_comp_id *ext_path; unsigned int ext_len; bool shadow_register; + const char *clk_drv_name; }; struct mtk_drm_private { struct drm_device *drm; struct device *dma_dev; + struct platform_device *clk_dev; unsigned int num_pipes; -- 2.17.1