Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp214250imm; Wed, 18 Jul 2018 00:29:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeJLaRtG7fx1VDrxVgiDj16avYboXMC/B01IAmznIMaPsM0GlJkOIXjF1wWjeGuBNctcMIQ X-Received: by 2002:a62:9b57:: with SMTP id r84-v6mr4056208pfd.6.1531898962425; Wed, 18 Jul 2018 00:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531898962; cv=none; d=google.com; s=arc-20160816; b=06tcHlf8sazdyZCla1gOg9jlpoeb4Xbi1HwmJ+x+sB/H1eX0gsHvWpF+EIi8Q2TLbF luUeYs6GvySVOU/1LEH8lbYov7ZBfJRcjX1zoYE2HPmZoy/FkHjts179PElIAQlf7vf/ o7JGHdEdGJN1k3BcDuTKFOxMzhgsO9AvpJihYtVTWjHsoCngjKp59lyZ78W2tgiPPDYs FUhkGHqyd3j2MhdoPSCCvc3K8TwhLgrz7BaTiyPsGG0WRNRvnBvUmQp1uzpY1aPYS1Hc QCspE4kiCXR6HMirJGfPepdH3VSEOZDpcR0kwKlMS2DEtffWxVPT7ZnCWckU5zBvKhN/ cCZA== 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:autocrypt:openpgp:references:cc:to:from:subject :dkim-signature:arc-authentication-results; bh=5ihHZnDWKTax7a8aI8g0Rv8srYjG5Q1pFQNQWNs+dKQ=; b=ZByru62lfgmcs2u9YsvLC6UxedskqrskczEtjehr+QCnRXmY7b+1/OGndtGdPkuuBX XSSKDN2hSDvuUNjVvEQDw9p7W4jHftZ/omBXfbGtEqAt+Ms446nQ3p/v3CvHvpKZoX9n SjHyqNE+MeKmuNJ49cMIWj9vcWlwraOjB0y+HHPBEZ6spae5/Pe9B+SFdxJrrrDqPF5t r6ew7AotmTLRMlcZDOcst+Q3kc8QwOJJ8QnrdJy5plU57a5j6EKzYSitux+aXd95t8yL lAZ7se/RzEVcPQp9IJscZQWMKxOrJApMPF5achDQEz0+PWWl3Qvbz3TfyMQPcHCiecGN z/4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gQzlASGD; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t128-v6si3032136pfc.194.2018.07.18.00.29.07; Wed, 18 Jul 2018 00:29:22 -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=@gmail.com header.s=20161025 header.b=gQzlASGD; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728491AbeGRIE5 (ORCPT + 99 others); Wed, 18 Jul 2018 04:04:57 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:33105 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbeGRIE5 (ORCPT ); Wed, 18 Jul 2018 04:04:57 -0400 Received: by mail-ed1-f66.google.com with SMTP id x5-v6so3403349edr.0; Wed, 18 Jul 2018 00:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5ihHZnDWKTax7a8aI8g0Rv8srYjG5Q1pFQNQWNs+dKQ=; b=gQzlASGDMgv8Whc+H88tiRmlR8AiJaYwmW3/GbQHM6OsjC9E11ZeCiyuW+DKKk0vGa ORPrctrutVHQLgdulpcWKPYr4hxJfQtzB3YWFagf+xbRZBggfa0IMeRUP/zZ0cmiAX/7 fZzBL7jPRDg9VuYYBV86tFNVcBBOITlNi9wplRiXEmi6rrIXIuiXC/7O1OAjutJ0xDTs rhUHIMOQ410Ds5U0Pr4QpnenidHz+CNirDZSfTwq2eAtetAf6YsYWtLnbf8JvIHV2QZ0 eMIKG6sLv0lFJk9c921S/VI6LvDXvycTg0jKiicRIDjLZXiP7wYcK7dzxP1ItH73GlxA NS2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=5ihHZnDWKTax7a8aI8g0Rv8srYjG5Q1pFQNQWNs+dKQ=; b=otZ2X0EHMWi+6RKAnGQeBoBUdhMpn2SAhAZiWph8uKZKQVKfRR46QhYOPaYJIqseSC vAawh7iGaF3UFT1he2qR+cEoE7bDEAg+Imbf6OITMRJAGXL2Zms7SB0C/n9XUm8QP3w0 0m0TtCR5nNUDlqigEfD/7LedmRaUc+HhaRluyT+J5mEPNC8j8+4xbi3ZKV/nMxTVT/bH pYTvJ0FbYahYkyzbKDO6U3mS+kdby1mlPGftaLS+PZtwZjTsMP4cXJaNbuABDE1u1oNj Xgxa6K0SWWA9PTRT3N2LfzjL5gSMLN+7KkKVR8S1HJr8eltVO2d1Ipc6YrDfWBJAiDxx alpw== X-Gm-Message-State: AOUpUlF0CTaZWhW7BHvdrjl008cLNZqUJMD1wPdlmym+A5hWkJ5kzaQp 4yvhbpLyGUKk8pPFTPI8ulQ= X-Received: by 2002:a50:ae04:: with SMTP id c4-v6mr5851611edd.137.1531898907773; Wed, 18 Jul 2018 00:28:27 -0700 (PDT) Received: from ziggy.stardust ([37.223.136.20]) by smtp.gmail.com with ESMTPSA id o7-v6sm55189edk.94.2018.07.18.00.28.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 00:28:26 -0700 (PDT) Subject: Re: [resend PATCH v4 4/5] drm/mediatek: Add support for mmsys through a pdev From: Matthias Brugger To: Sean Wang , matthias.bgg@kernel.org Cc: 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, davem@davemloft.net, gregkh@linuxfoundation.org, mchehab@kernel.org, rdunlap@infradead.org, pi-cheng.chen@linaro.org, linux-clk@vger.kernel.org, linux@armlinux.org.uk, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Matthias Brugger References: <20180717220328.792-1-matthias.bgg@kernel.org> <20180717220328.792-5-matthias.bgg@kernel.org> <1531882655.8953.83.camel@mtkswgap22> <50c93f6d-c546-1479-62c1-adc0b40d5dab@gmail.com> Openpgp: preference=signencrypt Autocrypt: addr=matthias.bgg@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFP1zgUBEAC21D6hk7//0kOmsUrE3eZ55kjc9DmFPKIz6l4NggqwQjBNRHIMh04BbCMY fL3eT7ZsYV5nur7zctmJ+vbszoOASXUpfq8M+S5hU2w7sBaVk5rpH9yW8CUWz2+ZpQXPJcFa OhLZuSKB1F5JcvLbETRjNzNU7B3TdS2+zkgQQdEyt7Ij2HXGLJ2w+yG2GuR9/iyCJRf10Okq gTh//XESJZ8S6KlOWbLXRE+yfkKDXQx2Jr1XuVvM3zPqH5FMg8reRVFsQ+vI0b+OlyekT/Xe 0Hwvqkev95GG6x7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HEp/tB +Fw7CArNtUtLlc8SuADCmMD+kBOVWktZyzkBkDfBXlTWl46T/8291lEspDWe5YW1ZAH/HdCR 1rQNZWjNCpB2Cic58CYMD1rSonCnbfUeyZYNNhNHZosl4dl7f+am87Q2x3pK0DLSoJRxWb7v ZB0uo9CzCSm3I++aYozF25xQoT+7zCx2cQi33jwvnJAK1o4VlNx36RfrxzBqc1uZGzJBCQu4 8UjmUSsTwWC3HpE/D9sM+xACs803lFUIZC5H62G059cCPAXKgsFpNMKmBAWweBkVJAisoQeX 50OP+/11ArV0cv+fOTfJj0/KwFXJaaYh3LUQNILLBNxkSrhCLl8dUg53IbHx4NfIAgqxLWGf XM8DY1aFdU79pac005PuhxCWkKTJz3gCmznnoat4GCnL5gy/m0Qk45l4PFqwWXVLo9AQg2Kp 3mlIFZ6fsEKIAN5hxlbNvNb9V2Zo5bFZjPWPFTxOteM0omUAS+QopwU0yPLLGJVf2iCmItHc UXI+r2JwH1CJjrHWeQEI2ucSKsNa8FllDmG/fQ== Message-ID: <660471a0-480b-241f-8880-8b56aed3e64b@gmail.com> Date: Wed, 18 Jul 2018 09:28:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <50c93f6d-c546-1479-62c1-adc0b40d5dab@gmail.com> 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 On 18/07/18 09:27, Matthias Brugger wrote: > Hi Sean, > > On 18/07/18 04:57, Sean Wang wrote: >> On Wed, 2018-07-18 at 00:03 +0200, 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. >>> >> >> Sorry for that I should have a response earlier for the series. >> >> Some points I felt they're not exactly right and should be fixed up >> before we're moving on >> >> Currently, drm driver have a wrong reference to the dt-binding, >> "mediatek,mt2701-mmsys" or "mediatek,mt8173-mmsys", they should be all >> for the subsystem exporting clock and reset line such common resource to >> its sub-devices. Every subsystem has a similar shape. I hope mmsys >> shouldn't be an exception. > > I'm not sure if I understand what you mean. You proposed to use a platform > device [1] and now you say we should change the DTS? > > What do you mean by "drm driver has a wrong reference to the dt-binding"? How > would you want to name it and most important, what would be your approach to > have backwards compatibility to older device tree bindings? > I forgot the reference: [1] https://patchwork.kernel.org/patch/10367797/ >> >> DRM device needs to have its own dt-binding show how connections between >> DRM components being made and its node should be put under mmsys node. >>> In this way, it becomes easy to see how the topology of the subsystem is >> and grows, like a tree "device tree", instead of hiding the details in >> the implementation. >> >> The similar example we already did for audsys on mt2701 and mt7623 as >> below >> >> audsys: clock-controller@11220000 { >> compatible = "mediatek,mt7623-audsys", >> "mediatek,mt2701-audsys", >> "syscon"; >> ... >> >> afe: audio-controller { >> compatible = "mediatek,mt7623-audio", >> "mediatek,mt2701-audio"; >> >> ... >> }; >> }; >> > > I think this approach is not working as, due to backwards compatibility, we have > to make sure that the DRM driver gets probed with the mmsys binding. > > Regards, > Matthias > >> >> Sean >> >> >>> 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; >>> >> >>