Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp113015imm; Tue, 17 Jul 2018 15:05:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc5CwlIq7xAeAmhPte7TzWpzs1rzsmGp3fGmuzn2vjcJ1XO07IGRn8i3QI6zgw5KRSuqGhI X-Received: by 2002:a17:902:8d91:: with SMTP id v17-v6mr3330638plo.9.1531865150773; Tue, 17 Jul 2018 15:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531865150; cv=none; d=google.com; s=arc-20160816; b=MySsOBk1WOqRsMICbxjqDo9g4+pwYGHUKoBbYxkHkfYpkfvZmwIC0Iw5uy2h+ySlHk DiUVzYv8YvOfoZtLC4NGETqzqZURzEf3ka/YnjZUrvi7djwKPFKU21ZfW67y5SnjZKaq JkPXXWKPCbxexa/lslimGtdzpd5+M0exNN1pX4uheNBggzNTq4dkjCVP0ZaiccPQ6aSS Uwjxh+L9zYMLdc3G9yHsv4zFRT7XYM0beiHsfOWSBbQCdu7qdQaBSsRH95wSDiS9f7b9 dYRoM9mGxd/ZP8a17myvXxJDUZN5QtMuAklbVVmzEywJBPjpWcQ4w55BHpMArIHf6hiz ClJQ== 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=D8J+EA8qyKFdbEmMrLxFtUsNSzOt2KJX40VhnOg3EjZANe6b2MKo1VsumSV43Tzn0v IIjevaHj/Wt9mn0C3siga0ieTq+CyovnnN88oZcCJNbbPDpuiodsBFSSN+eEO9ek/a1c 6t7+/rFP1j8daQSwQiTZrCJefjicI6T5Ix3OFpaC5tQJc80ruuDPK5qB9YNxFcFdBhqR 2I22bIESE0h9LDGGQDUHTYyvHIVTxLaFmP0HQMHkcntj2I6WUGhpfT6e/8whCQDs52lU 20npBr8/XTz1oCUXMQ6Z+XiXdHMPQF+CT9oRelWtUvHTfghs8O3Vf1zn8XfGuIJpnwsF zQMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AvylgIcs; 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 23-v6si1885370pge.589.2018.07.17.15.05.35; Tue, 17 Jul 2018 15:05:50 -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=AvylgIcs; 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 S1731452AbeGQWim (ORCPT + 99 others); Tue, 17 Jul 2018 18:38:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:45832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731404AbeGQWim (ORCPT ); Tue, 17 Jul 2018 18:38:42 -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 3673220693; Tue, 17 Jul 2018 22:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531865041; bh=N9KVlc87ADl1cpTrfAOr4Pv9YxzTCgoDn6201pGoWlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvylgIcsss62vawR5EX9VQMi35NExD/7Humak+vRns6XFmHNBIR00QqqU95/ApyVy +cKbjVo3qa3aXNQKF7ypxbivpz4aN3eXFmaczJ7fSevg9w59UkaOwL7G+9e1VM9NHr Lh5UAvtcKdbva5u6Ktdt7rnEjbwmU3nw952vOgJY= From: matthias.bgg@kernel.org To: ulrich.hecht+renesas@gmail.com, 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: [resend PATCH v4 4/5] drm/mediatek: Add support for mmsys through a pdev Date: Wed, 18 Jul 2018 00:03:27 +0200 Message-Id: <20180717220328.792-5-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180717220328.792-1-matthias.bgg@kernel.org> References: <20180717220328.792-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