Received: by 10.192.165.148 with SMTP id m20csp3627665imm; Mon, 30 Apr 2018 03:43:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoDTY/L3F44nXGMq6PnVLs5yX8JkBn07H1GwdqSmOzZ+4Y6z5PaibxaLVCsYeeBanEMFCGu X-Received: by 2002:a63:6110:: with SMTP id v16-v6mr9599877pgb.292.1525085003863; Mon, 30 Apr 2018 03:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525085003; cv=none; d=google.com; s=arc-20160816; b=sHJCKRejGTsVKIxxSEhYM14zXCshKxV3shE7riatNVQrn026dkRmgehYJpHF6fhHgo ZtUOjYFdbDN593lafBtyhHuy1ANV0uGcxW7n3R9jRYA4dpf0GZOGFqYXU2KiBKx4RuWF FsZ1Fbd6Y8fwXBNjSlaWI6xpav8071Ye5n1XIxkUlCCAw8bUPnhGCz8TJ/hnL5wP+2bC XU/l2kDFArW37FNgRovDDD5f2wtOwL3UfuQkKlBhZeRduArxSTXe6kLdSS+Tw3ubVfZj QS9/Iq4VK25IgJgwdFI3By4o+UndZ2G4ZTFnFxByVp2i7FHJGP8bfG8XL67mgSX0xSN4 vdeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=20kL/13eOawciohh7AYlVva5jeLjcK26HDuDQikcbf0=; b=HeNBDkai6sqBrUJY7BciifTNj/R7DHUeiziF12D4P3rxBbFlwmr6OgNsrpCRvd/xE+ tG6ghQ1JK4FY6gLZj4eDsxejj9rJpCsZO0eqkoE8roHOy7o7nNJj0+jTH+nDoOVQ6vLr kXQxJ8yUk/YLj2gVzk/QLnZSwBFyLVnfzV77ADqZU/1tjP3mb94jofaWJ6RstN+gAu7r wE5iZzaKG6QiP9ZI1e39p+SjvCl5h4esVnFgD3O8mijeZTpj/JOPDGYi9DtNj4mxWaDw eNQTYglMi/jUYXRJAuLNTxOTVDE9j1Xncvuy5lIL/O3cCFcAP8XzZniXLlTh9sp2jxPn r14Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 79-v6si5990677pga.440.2018.04.30.03.43.09; Mon, 30 Apr 2018 03:43:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbeD3Kmv (ORCPT + 99 others); Mon, 30 Apr 2018 06:42:51 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:46368 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751361AbeD3Kmu (ORCPT ); Mon, 30 Apr 2018 06:42:50 -0400 X-UUID: d23e429c040447d1beb2cf9f1afe2cbd-20180430 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 413656147; Mon, 30 Apr 2018 18:42:44 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 30 Apr 2018 18:42:42 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 30 Apr 2018 18:42:42 +0800 Message-ID: <1525084962.25456.2.camel@mtksdaap41> Subject: Re: [v3 04/10] drm/mediatek: mt2701: switch to mfd probing. From: CK Hu To: CC: , , , , , , , , , , , , , , , , , , , , , Matthias Brugger Date: Mon, 30 Apr 2018 18:42:42 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Matthias: On Fri, 2018-04-27 at 11:23 +0200, matthias.bgg@kernel.org wrote: > From: Matthias Brugger > > With the mtk-mmsys MFD device in place, we switch the probing for > mt2701 from device-tree to mfd. > > Signed-off-by: Matthias Brugger Reviewed-by: CK Hu Regards, CK > --- > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 30 +++++++++++++++++++++++------- > 1 file changed, 23 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c > index a48e28adad09..88ee35907744 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c > @@ -386,7 +386,7 @@ static int mtk_drm_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > struct mtk_drm_private *private; > - struct device_node *node; > + struct device_node *node, *parent_node, *mmsys_node; > struct component_match *match = NULL; > int ret; > int i; > @@ -399,12 +399,23 @@ 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); > > - private->config_regs = syscon_node_to_regmap(dev->of_node); > - if (IS_ERR(private->config_regs)) > - return PTR_ERR(private->config_regs); > + /* Check if called from mfd */ > + if (!dev->of_node) { > + mmsys_node = pdev->dev.parent->of_node; > + private->data = (struct mtk_mmsys_driver_data *) > + platform_get_device_id(pdev)->driver_data; > + private->config_regs = > + syscon_node_to_regmap(mmsys_node); > + parent_node = mmsys_node->parent; > + } else { > + private->config_regs = syscon_node_to_regmap(dev->of_node); > + if (IS_ERR(private->config_regs)) > + return PTR_ERR(private->config_regs); > + parent_node = dev->of_node->parent; > + } > > /* Iterate over sibling DISP function blocks */ > - for_each_child_of_node(dev->of_node->parent, node) { > + for_each_child_of_node(parent_node, node) { > const struct of_device_id *of_id; > enum mtk_ddp_comp_type comp_type; > int comp_id; > @@ -545,13 +556,17 @@ static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend, > mtk_drm_sys_resume); > > static const struct of_device_id mtk_drm_of_ids[] = { > - { .compatible = "mediatek,mt2701-mmsys", > - .data = &mt2701_mmsys_driver_data}, > { .compatible = "mediatek,mt8173-mmsys", > .data = &mt8173_mmsys_driver_data}, > { } > }; > > +static const struct platform_device_id mtk_drm_ids[] = { > + { "drm-mt2701-mm", (kernel_ulong_t)&mt2701_mmsys_driver_data }, > + { /* sentinel */ }, > +}; > +MODULE_DEVICE_TABLE(platform, mtk_drm_ids); > + > static struct platform_driver mtk_drm_platform_driver = { > .probe = mtk_drm_probe, > .remove = mtk_drm_remove, > @@ -560,6 +575,7 @@ static struct platform_driver mtk_drm_platform_driver = { > .of_match_table = mtk_drm_of_ids, > .pm = &mtk_drm_pm_ops, > }, > + .id_table = mtk_drm_ids, > }; > > static struct platform_driver * const mtk_drm_drivers[] = {