Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3917415ybl; Mon, 9 Dec 2019 02:17:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzBokiDB8A13n7pWX6jMM9GBTe3aVhHJGQqeye/YB2AVTssefI5iOgS9gjRQOHlXwqmKW9A X-Received: by 2002:aca:b04:: with SMTP id 4mr16792707oil.151.1575886662541; Mon, 09 Dec 2019 02:17:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575886662; cv=none; d=google.com; s=arc-20160816; b=HvsOuHA7cEC6zlPB9Ob3p3cqBRm1i3/ogmDC1HDwZpB663xFN8WtWc+iQD+mDoc7sa qoE8+vKmeZXoH6x5DsJW406tzfaS6eXOQ8SrzjGUlW4WdVZ9xqe3qaQW2rhNRyiQ01cB 3VtPQSiXbXq8MmbSulO1DPP1gENWrotv/BqASonSVOORLnao+d968lA+Ow+iX6qEILKV 1fcOGL96zqeH+9gsUTXcy9AEipaW7vNWJtobB64LUa4ltCDR77tJbFVSEGZl9WkH4GH+ Fuj8QZvSkkYkBCcK+QlRlfmEKM9IuUtvx99WecLr6Rtjc35nzzw7hhpST6sO9zh1aXsg HOhQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=HhpghLqIj9IreFQS3gZJCFjyXNn3xdPGYejS8Gbj5UM=; b=tDQeStulx2cvGH/cYg7sR6Xyxie8LQc8CuR6w6vPttMP6SK7405OvMZEa6qc7WRvld uiZ3+LPt6dXwagTrR8HV1cYbY8VqBGrY4q2n6S1AC99ZOYUc3jxjZagNZ2ZdMbmOJfem Oz1ZXeAYlgF6tll+HlEgHkb+WAoYZRKKWlxXnr817bgh6o9/fbmUvA0zRh7tKxrGZ7Eo Ie01iqbh2qsBXL/eQ7vXSYjPkXjo9L+StBg+Ue3Bj/0nZH9cmXHpntRNNOyv+cM168DR Lfion9a5TFzI3ZaWX7XQ/O2TrsaDO9foEy7saXHltQd89B9S+Eb5AmnYKoJYXyqiloTW z68A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si12028307oig.123.2019.12.09.02.17.30; Mon, 09 Dec 2019 02:17:42 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727357AbfLIKPk (ORCPT + 99 others); Mon, 9 Dec 2019 05:15:40 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:41026 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfLIKPk (ORCPT ); Mon, 9 Dec 2019 05:15:40 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id C67AD28EDB5 Subject: Re: [resend PATCH v6 12/12] drm/mediatek: Add support for mmsys through a pdev To: matthias.bgg@kernel.org, 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 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 References: <20191207224740.24536-1-matthias.bgg@kernel.org> <20191207224740.24536-13-matthias.bgg@kernel.org> From: Enric Balletbo i Serra Message-ID: <96c850e0-9b12-a943-4e99-9aca7ce8ca8b@collabora.com> Date: Mon, 9 Dec 2019 11:15:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191207224740.24536-13-matthias.bgg@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matthias, Just one nit below and LGTM On 7/12/19 23:47, matthias.bgg@kernel.org wrote: > 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 Reviewed-by: Enric Balletbo i Serra > --- > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 24 ++++++++++++++++++++++++ > drivers/gpu/drm/mediatek/mtk_drm_drv.h | 2 ++ > 2 files changed, 26 insertions(+) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c > index 210455e9f46c..5ada74d8d0c9 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c > @@ -186,6 +186,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 = { > @@ -195,6 +196,7 @@ static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = { > .ext_len = ARRAY_SIZE(mt2712_mtk_ddp_ext), > .third_path = mt2712_mtk_ddp_third, > .third_len = ARRAY_SIZE(mt2712_mtk_ddp_third), > + .clk_drv_name = "clk-mt2712-mm", > }; > > static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = { > @@ -202,6 +204,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) > @@ -499,6 +502,24 @@ static int mtk_drm_probe(struct platform_device *pdev) > INIT_WORK(&private->commit.work, mtk_atomic_work); > private->data = of_device_get_match_data(dev); > > + /* > + * MMSYS includes apart from components management a block providing > + * clocks for the subsystem. We probe this clock driver via a platform > + * device. > + */ > + if (private->data->clk_drv_name) { > + private->clk_dev = platform_device_register_data(dev, > + private->data->clk_drv_name, -1, > + NULL, 0); Replace -1 for PLATFORM_DEVID_NONE > + > + if (IS_ERR(private->clk_dev)) { > + dev_err(dev, "failed to register %s platform device\n", > + private->data->clk_drv_name); > + > + return PTR_ERR(private->clk_dev); > + } > + } > + > private->config_regs = syscon_node_to_regmap(dev->of_node); > if (IS_ERR(private->config_regs)) > return PTR_ERR(private->config_regs); > @@ -605,6 +626,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 63a121577dcb..8fe9136adc38 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h > +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h > @@ -29,11 +29,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; > >