Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp431277imu; Fri, 16 Nov 2018 04:56:50 -0800 (PST) X-Google-Smtp-Source: AJdET5dTPsXyeqoz5jksGxrvxPrTjNCDLJILy47eKvtsqYMSZnJx0CJl0TWAiAWXoAcV82zbOnlj X-Received: by 2002:a63:5d55:: with SMTP id o21mr9624638pgm.92.1542373010344; Fri, 16 Nov 2018 04:56:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542373010; cv=none; d=google.com; s=arc-20160816; b=S/d5rAnqr/k5//3bG14Pj9yqGcq6njRGHRC2W1/DXmrneU7BVh60/LclxOoQ4J+ssM MRqkksGF+KYv7unkhPfZVQKF7DUHyenNUwU/YwbZAxuVsOmLW9zMNs0QeWmLK48dMT+a 3kMVHhNZdgK7aOtUGfz+UZu6y9ylhKCHfTEB19I5xUYzg/gc1RLV+SR9KUA5/y1a0bjs E31uY4OCJXbA5HQDbML0kTrS4T9QYGA27fhXY8sEa81lJ7MVtj4HUFBJt9mdD+MsdxnL KBbjvUp/+MyKmKAhUUY1KP3V8s5VacNTJylt8Hs04ThEcuwj3qN+1nX2nbXpdrXfyAfW hqZA== 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=mHzVuzLM8qGfCaADQ79A3BOwaJP8UMhcCOB+t0uWQeA=; b=nXppKLz1QaXrGA6b+hkHAg52zckWO2IM63hL0md8/HZRB9a4PytLpg83pBEMuETu+R 87eyUuxuutV2wqbugZUVkC133CUwBUD+wcdBPfgbQ0L60KI3d1f8YhBnHl8d/WVI7XcG 1mnRSNOVRzR299w/9kD4uxfaCPnNFnXXoohIhn2F6gFNNIDF5pzYaTpILFHV/xmt20ib 627ZvrpsPlwgZe32c4jY8jNVxOmLxzB8Kr0afEr6dsO7/gTLJd1tjHKXBiMt2UgFu5Qo R50fzFzCouFvf1TZc3q48cHU5ztFNVw4L8Yr2+fNLStYAP8dNXhZVbjW4SFpy3QMqmtf SPtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aHyFsb9t; 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 c10si31593325pgj.416.2018.11.16.04.56.36; Fri, 16 Nov 2018 04:56:50 -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=aHyFsb9t; 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 S2389841AbeKPXID (ORCPT + 99 others); Fri, 16 Nov 2018 18:08:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:33650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727965AbeKPXID (ORCPT ); Fri, 16 Nov 2018 18:08:03 -0500 Received: from ziggy.de (unknown [93.176.133.217]) (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 06FF4214C1; Fri, 16 Nov 2018 12:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542372944; bh=Vqcv+EtdLJRUThIgc9FngtK1nOwDf3Ju81xX6aM/6tM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aHyFsb9tFs8nt0V9K4MGUEt9nAz4BztN6kNy50TC99ScIB4DNP3wnxSSV2pLgobQE lq0D+fAs+rDDoJ/eTaJGcp4qN0WwGPhTEZ1QK2j08DQOUFWW0FkYhwb5fb7Z8+WMPX jVYyqVazC3+RAPzSpZORIGb0FCZdX1YMHLuL7xc4= 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@codeaurora.org, ulrich.hecht+renesas@gmail.com, laurent.pinchart@ideasonboard.com, matthias.bgg@gmail.com Cc: sean.wang@mediatek.com, sean.wang@kernel.org, rdunlap@infradead.org, wens@csie.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, Matthias Brugger Subject: [PATCH v5 04/12] drm/mediatek: Add support for mmsys through a pdev Date: Fri, 16 Nov 2018 13:54:41 +0100 Message-Id: <20181116125449.23581-5-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181116125449.23581-1-matthias.bgg@kernel.org> References: <20181116125449.23581-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 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 | 23 +++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_drv.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 99dd612a6683..18fc761ba94f 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -199,6 +199,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 mt2712_mmsys_driver_data = { @@ -215,6 +216,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) @@ -473,6 +475,24 @@ static int mtk_drm_probe(struct platform_device *pdev) if (IS_ERR(private->config_regs)) return PTR_ERR(private->config_regs); + /* + * For legacy reasons we need to probe the clock driver via + * a platfomr device. This is outdated and should not be used + * in newer SoCs. + */ + 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; @@ -577,6 +597,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 ab0adbd7d4ee..515ac4cae922 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -37,11 +37,13 @@ struct mtk_mmsys_driver_data { unsigned int third_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.19.1