From patchwork Fri Jul 15 06:53:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meng Yi X-Patchwork-Id: 9231279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2928160865 for ; Fri, 15 Jul 2016 07:51:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19D7D2816B for ; Fri, 15 Jul 2016 07:51:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E9C828307; Fri, 15 Jul 2016 07:51:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9468E2816B for ; Fri, 15 Jul 2016 07:51:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D845C6E960; Fri, 15 Jul 2016 07:51:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 71926 seconds by postgrey-1.35 at gabe; Fri, 15 Jul 2016 07:04:36 UTC Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0072.outbound.protection.outlook.com [104.47.33.72]) by gabe.freedesktop.org (Postfix) with ESMTPS id 106FE6E94B for ; Fri, 15 Jul 2016 07:04:36 +0000 (UTC) Received: from BN3PR0301CA0047.namprd03.prod.outlook.com (10.160.152.143) by CO2PR03MB2406.namprd03.prod.outlook.com (10.166.93.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.528.16; Fri, 15 Jul 2016 07:04:33 +0000 Received: from BL2FFO11FD019.protection.gbl (2a01:111:f400:7c09::194) by BN3PR0301CA0047.outlook.office365.com (2a01:111:e400:401e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.534.14 via Frontend Transport; Fri, 15 Jul 2016 07:04:32 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD019.mail.protection.outlook.com (10.173.161.37) with Microsoft SMTP Server (TLS) id 15.1.523.9 via Frontend Transport; Fri, 15 Jul 2016 07:04:31 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u6F74Sdj001742; Fri, 15 Jul 2016 00:04:29 -0700 From: Meng Yi To: Subject: [PATCH v5 1/2] drm/fsl-dcu: rework codes to support of_graph dt binding for panel Date: Fri, 15 Jul 2016 14:53:37 +0800 Message-ID: <1468565618-27124-1-git-send-email-meng.yi@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131130398721022538; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(50226002)(85426001)(8676002)(33646002)(110136002)(50986999)(48376002)(106466001)(36756003)(8936002)(356003)(4326007)(189998001)(5003940100001)(2906002)(19580405001)(105606002)(586003)(305945005)(8666005)(7846002)(81166006)(81156014)(5890100001)(86362001)(229853001)(77096005)(97736004)(68736007)(47776003)(19580395003)(6806005)(50466002)(87936001)(92566002)(104016004)(2351001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2406; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD019; 1:qd3AOVBsSkUD9Ao936UlToabEmkrWrpaOreXZ1td5a38c9ug+ltX39FXpradNG98EwAO6Sm4J0dO50I48Jz1rF6RuHYDhRNBcv1tVjhjRvOnZmI3Yg2RRdAfXoERHnexiOyEADXzQABw4clo2akmwLBR/V6MftjnIGYACLWgZS0S2haOAVUSjgU5NY1c3XgAp98QMBOfxleuNCDpFx2L7LeJikcuZhn4DwyKfeZWffKsu02+c5TR5RcsexIYj2tRp598vvHhEorC/P9Xj3R2M0Nffvz6vJwF4phbMPySsomdqXTFPhBDwqubV9ghIhaW4IX14mfN6ggun6B4ZSun62U1EEqhCBSIi0p3GGl15RtZnLdxgM71C0kzT2C+V9Z2T1q3n3hWZmJb8uR2RoxxQd4rpwqJGzWcARAPu5A5Nbhvs9bGki426kJPCyODHkO2xEDFvluU7alHkLEn5i2uqq4VYGDEgM67kpp5MZeLcQ7t1sMTauLrBDQ2AWAVKa5b3sGcu3tQn6a1LveKLvfs1TvSV8Rh6INQ6PnjfMyWlFLYNh0SSU0VktuSIpdfaPqWELhQ4LHapcTF27xGuzpcCzaLsDevOAgEcSOYS+lkN7QaKjFrwhWt7E+/1L8u9wsTwBRZF2tBZWG9JO8MKWUVFahjF7cuJX9s0pToDoKwZbzWzdAI7EjbPhbvbLODfAM1dLwmgvYjkLxbYgPZ45eaoztYuy2do89ZsugxMEYwbUQ= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 7b6fc5ee-426f-4516-9a4a-08d3ac7e457c X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2406; 2:FJdGMkkBrs1VOv/Gh5YnNadTSxba6dUbpOlRQg4Vbo7fiWwyB7g3s9wQVtgAQP0ih8qAJsjZ/b4X27A57wGSnXymrWYhj62ol2Cs8vqy6g6GFL5nwM8t8Pbl3sODJKq1k8Kg1TtZnkDl4EjZQnevo9G00PzZibSY0OCiGGOLQOcCyIqAbRu8hy6Kq+4HPkll; 3:2xFiuAmQuG5x5qy1SwxqD9GUsdMZFgQWc0zVi7lakvXmmdLSfL9pXh7LmnV5L2pVC81Q0JU1v3cJnVhvCq1+El+hdIzS+kCCWMxLR7tsEINYYdMuJAOW5csEi6eVPua8drKQw1aiG5ObKAicqzKTHflISgYaLD/aODTUGXluWi7Oi4s4oQmEd3YP1Ly8BJI/m04I8KMc2ipIDefeSsYpuMq39aKAA8n48yP1OHTrq3U=; 25:P4yUfbgYQePJom/TKiasRV8sZ+3NmDeaoiRLPsYSDYYWk5lSh+Iw3xOk+k3YGjJKGpQJaqV41Db4m4bSqtpycsKNFRC83UBBz+XK8DTdzf9ZDXet827+x4zVDiVVZ6oLzZPyNZJ7N1mTyhnS/Jkikk9nfkHvIVhDClYcTQokfLKGU6taSW2kX8XHm0IQ5vje5uel/MVD3GWVRGBQDv8XbolWWTae8md268w1A6wTygsnJpM78cEqUcYebslQV+LVorC+d/lIC06LEvPx6f20eBSpOuDwYYah5TZyyhEToEJZX0P95ba8r/4sjy2WDTiVD9pLMo2n99K5oxaM3K+HyaPimHLPuCHaev6al0/UW2/lss+4e7PiCH2Ff+eZQJVNV3hwhDFCImBnQBeMBLnuxtJOjzPlVqPH/1rdG0OXqek= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR03MB2406; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2406; 31:Xaqbqkk53ZJ9Tlw8FblAbPrAPk79PQNHz+XybOrzJX+GiFxhVXL/ONDYpKEbYySNHjN4/iOKjtP+KutDzrO4xrzcFryHIFkmisHNMqAa172ElaZij5fX+v3xZgIhtkYBeMvqtPMS978h+XWkzF4cQREe+wk5M1PKEvCHddU8R41tz3UVLR3AddH7wZMJAcYy+YRzD12csL1u/V1si69R8g==; 4:pO436u1IqTdE8Mox2WxeCVxzTLDbZKQ5QalVZ8lUlNUhu6pCFfWE6jw7nIVF9IkL0uT9IGrKfE7aPxfqWKEL6g4AhZjnad+YQ7+dGEjCguCh2TyZKF7mKlEmjpV1KIb63aSp1fgEc4puuQFZtjZOpCdVSt2YhdZE4sGKRMusOq9Qz3B9j1pcRHTny7msnbmBH5JH2en84aCl9IwHnYKT6fC8d+PTiYyx+HK6/OufUNTABS7vbTurpJNkFQZhUgcHRsUU1zr+H7lxtPvR/paUhR3pKATMOg0E6zbIe4vQDV9eDirloudju5FqJRUXq5W8FYMts2lc26bBIFXsBSKvfocqiCTV2n/HCqOAYd+h83uBPQobjKmHf1EDbeg0mP0mGWiOVHt4L2D+V9AoeeAiGSHfXj8ZXbc9Ha5cGx/p42QyU45RK6XqJAqPi7neuzn/otiwiRL02mbcop83FMIex3zI69mXV1eLhUG0Uxuf2Lsqpgui8wZ3pU/JpaWKIGrmoq19Doblgia52j5ez7iMtw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13017025)(13024025)(13015025)(13023025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:CO2PR03MB2406; BCL:0; PCL:0; RULEID:(400006); SRVR:CO2PR03MB2406; X-Forefront-PRVS: 00046D390F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2406; 23:J8LVPZ1/oUl35eiu5Hl8vgTL116GAaP2Yy2BgbbXg?= =?us-ascii?Q?ci0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4aL4CA/08jeJ3z6QOLX480m7fQeJBJHQlkSpWsqrFSSeHCeB9d SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2016 07:04:31.9306 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2406 X-Mailman-Approved-At: Fri, 15 Jul 2016 07:51:48 +0000 Cc: Meng Yi , emil.l.velikov@gmail.com, dri-devel@lists.freedesktop.org, alexander.stein@systec-electronic.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch rework the output code to add of_graph dt binding support for panel device and also keeps the backward compatibility Signed-off-by: Meng Yi --- Changes in V5: -remove unused variable 'ret' Changes in V4: -simplify return value statements -merge corresponding documentation to this patch Changes in V3: -simplify return value statements Changes in V2: -fix some coding style issue -add fsl_dev->connector.panel check -use fsl_dev->np and drop fsl_dev->dev->of_node -return 'ret' when fsl_dcu_attach_panel failed --- .../devicetree/bindings/display/fsl,dcu.txt | 9 ++- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 2 +- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h | 3 +- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 68 +++++++++++++++------- 4 files changed, 57 insertions(+), 25 deletions(-) diff --git a/Documentation/devicetree/bindings/display/fsl,dcu.txt b/Documentation/devicetree/bindings/display/fsl,dcu.txt index ae55cde..63ec2a6 100644 --- a/Documentation/devicetree/bindings/display/fsl,dcu.txt +++ b/Documentation/devicetree/bindings/display/fsl,dcu.txt @@ -12,7 +12,7 @@ Required properties: - clock-names: Should be "dcu" and "pix" See ../clocks/clock-bindings.txt for details. - big-endian Boolean property, LS1021A DCU registers are big-endian. -- fsl,panel: The phandle to panel node. +- port Video port for the panel output Optional properties: - fsl,tcon: The phandle to the timing controller node. @@ -24,6 +24,11 @@ dcu: dcu@2ce0000 { clocks = <&platform_clk 0>, <&platform_clk 0>; clock-names = "dcu", "pix"; big-endian; - fsl,panel = <&panel>; fsl,tcon = <&tcon>; + + port { + dcu_out: endpoint { + remote-endpoint = <&panel_out>; + }; + }; }; diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c index a6e4cd5..d9d6cc1 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c @@ -43,7 +43,7 @@ int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev) if (ret) goto err; - ret = fsl_dcu_drm_connector_create(fsl_dev, &fsl_dev->encoder); + ret = fsl_dcu_create_outputs(fsl_dev); if (ret) goto err; diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h index 7093109..5a7b88e 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h @@ -25,9 +25,8 @@ to_fsl_dcu_connector(struct drm_connector *con) : NULL; } -int fsl_dcu_drm_connector_create(struct fsl_dcu_drm_device *fsl_dev, - struct drm_encoder *encoder); int fsl_dcu_drm_encoder_create(struct fsl_dcu_drm_device *fsl_dev, struct drm_crtc *crtc); +int fsl_dcu_create_outputs(struct fsl_dcu_drm_device *fsl_dev); #endif /* __FSL_DCU_DRM_CONNECTOR_H__ */ diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c index 0b0989e..ba1edb1 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c @@ -10,6 +10,7 @@ */ #include +#include #include #include @@ -132,12 +133,12 @@ static const struct drm_connector_helper_funcs connector_helper_funcs = { .mode_valid = fsl_dcu_drm_connector_mode_valid, }; -int fsl_dcu_drm_connector_create(struct fsl_dcu_drm_device *fsl_dev, - struct drm_encoder *encoder) +static int fsl_dcu_attach_panel(struct fsl_dcu_drm_device *fsl_dev, + struct drm_panel *panel) { + struct drm_encoder *encoder = &fsl_dev->encoder; struct drm_connector *connector = &fsl_dev->connector.base; struct drm_mode_config *mode_config = &fsl_dev->drm->mode_config; - struct device_node *panel_node; int ret; fsl_dev->connector.encoder = encoder; @@ -161,21 +162,7 @@ int fsl_dcu_drm_connector_create(struct fsl_dcu_drm_device *fsl_dev, mode_config->dpms_property, DRM_MODE_DPMS_OFF); - panel_node = of_parse_phandle(fsl_dev->np, "fsl,panel", 0); - if (!panel_node) { - dev_err(fsl_dev->dev, "fsl,panel property not found\n"); - ret = -ENODEV; - goto err_sysfs; - } - - fsl_dev->connector.panel = of_drm_find_panel(panel_node); - if (!fsl_dev->connector.panel) { - ret = -EPROBE_DEFER; - goto err_panel; - } - of_node_put(panel_node); - - ret = drm_panel_attach(fsl_dev->connector.panel, connector); + ret = drm_panel_attach(panel, connector); if (ret) { dev_err(fsl_dev->dev, "failed to attach panel\n"); goto err_sysfs; @@ -183,11 +170,52 @@ int fsl_dcu_drm_connector_create(struct fsl_dcu_drm_device *fsl_dev, return 0; -err_panel: - of_node_put(panel_node); err_sysfs: drm_connector_unregister(connector); err_cleanup: drm_connector_cleanup(connector); return ret; } + +static int fsl_dcu_attach_endpoint(struct fsl_dcu_drm_device *fsl_dev, + const struct of_endpoint *ep) +{ + struct device_node *np; + + np = of_graph_get_remote_port_parent(ep->local_node); + + fsl_dev->connector.panel = of_drm_find_panel(np); + of_node_put(np); + if (fsl_dev->connector.panel) + return fsl_dcu_attach_panel(fsl_dev, fsl_dev->connector.panel); + + return -ENODEV; +} + +int fsl_dcu_create_outputs(struct fsl_dcu_drm_device *fsl_dev) +{ + struct of_endpoint ep; + struct device_node *ep_node, *panel_node; + int ret; + + /* This is for backward compatibility */ + panel_node = of_parse_phandle(fsl_dev->np, "fsl,panel", 0); + if (panel_node) { + fsl_dev->connector.panel = of_drm_find_panel(panel_node); + of_node_put(panel_node); + if (!fsl_dev->connector.panel) + return -EPROBE_DEFER; + return fsl_dcu_attach_panel(fsl_dev, fsl_dev->connector.panel); + } + + ep_node = of_graph_get_next_endpoint(fsl_dev->np, NULL); + if (!ep_node) + return -ENODEV; + + ret = of_graph_parse_endpoint(ep_node, &ep); + of_node_put(ep_node); + if (ret) + return -ENODEV; + + return fsl_dcu_attach_endpoint(fsl_dev, &ep); +}