From patchwork Fri Jul 15 06:41:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meng Yi X-Patchwork-Id: 9231283 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 7B40560868 for ; Fri, 15 Jul 2016 07:52:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C47528304 for ; Fri, 15 Jul 2016 07:52:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F76A28325; Fri, 15 Jul 2016 07:52:39 +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 E4CBB28304 for ; Fri, 15 Jul 2016 07:52:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01D786E961; Fri, 15 Jul 2016 07:52:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 70249 seconds by postgrey-1.35 at gabe; Fri, 15 Jul 2016 06:52:17 UTC Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0087.outbound.protection.outlook.com [104.47.41.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF6596E04F for ; Fri, 15 Jul 2016 06:52:17 +0000 (UTC) Received: from BN3PR0301CA0050.namprd03.prod.outlook.com (10.160.152.146) by CO2PR03MB2408.namprd03.prod.outlook.com (10.166.93.138) 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 06:52:15 +0000 Received: from BY2FFO11OLC004.protection.gbl (2a01:111:f400:7c0c::120) by BN3PR0301CA0050.outlook.office365.com (2a01:111:e400:401e::18) 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 06:52:15 +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 BY2FFO11OLC004.mail.protection.outlook.com (10.1.15.184) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Fri, 15 Jul 2016 06:52:14 +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 u6F6q97V013867; Thu, 14 Jul 2016 23:52:11 -0700 From: Meng Yi To: Subject: [PATCH v4 1/2] drm/fsl-dcu: rework codes to support of_graph dt binding for panel Date: Fri, 15 Jul 2016 14:41:19 +0800 Message-ID: <1468564880-3198-1-git-send-email-meng.yi@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131130391347281292; (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)(189002)(199003)(2906002)(11100500001)(85426001)(87936001)(6806005)(19580395003)(86362001)(110136002)(8666005)(36756003)(8676002)(356003)(81156014)(50986999)(81166006)(104016004)(2351001)(189998001)(229853001)(50466002)(7846002)(47776003)(106466001)(5003940100001)(33646002)(105606002)(68736007)(8936002)(48376002)(4326007)(77096005)(586003)(92566002)(5890100001)(97736004)(305945005)(19580405001)(50226002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2408; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC004; 1:CArpfwyOgJRZF7yU2ngdpX1LnM+8xJ+YaTMPsJsc5gpR0+oHyMe58Qs0mFKQfzAKQX+N7cFke8tbaOs149YBSGQSRi0vRR6cUOmDO4V5AyYvwiFLiGW9VGUawKWvMMdHUaDxi+qjiHltA2bKN7TTQAvWrdBWcv72lXUwKXHWttr2vF3pY/sgSpM6PrnEJIp0AQu8UiI5hTnrsgtCW63CF2C4+kJm3AB70SszHp2c8fTfGth7taSAKuoPjLkBkgsgflb+JakNrjwbJyph5+3/10xpFGlk1zhfjFDXbxvpiph9UlbsFEdrfu0JneH9s8vfgXknXpqlvMnU0VHQhsTj1y4Rcv9OEHhhbyy7a4yhx6ip00NIIXWCnB8kxfJ9k+0FAWi0rIF0p9U7b0Po0SvGEM/AaNH9rK1ebAQMsy5zixJa6jKmkcf4WUssRWHZ/PPjpbY8eM/6r3/hBEWxfSIth+feb1KSgb6QDgslJZKnr7IOS3IVhtokZiDfRHHnWCfVGYRDwfvZKj8XszPJcfHqOzZcuEpXI7obKvddzwhSfZ1sZjwFcoU5E8W29DkjE/L/HmOec/240kOFmmT5x3QfnIyIIBesGRDKu3M/gYDXkPUARNBnyWB70uu/IXZq2x714X+cFknL4MhNjgtZwB/NuNd5Zu6LtODVsNSkGuOyxMVX5ABzUzzicuPIMNXaS8J0AOt6/E/+518C4M7LnLEa6wqrjMEzpdkl15HLg5cOpeA= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b7728846-3835-4198-d135-08d3ac7c8de4 X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2408; 2:4yZYCYDlq8FNbRbjRG3nJm34l2GOx8KEmH7QyMYdCB9xTFzFAPtx12cgi5A2U+K3UaCOkl6Yn7ruEW7vmh0qoIxrVxtI2kTLBNYVwKR2iAoBPGWvu58BuKAtcVd+slFSjkrcQ7cprgBtCH0aHDVg26ZnsNDuCRtd/j+JI76LF1nilINGEC3TavN9mCbcbmSC; 3:3VLq/jautOblf5tPvITyXo2AxDOqMM7lTak1KRqEe/pQn6T8RCIy2eyAcFNgnqswGiScFN/as9/jyFkf7KmPA/eYMSDCtyD0AhZgZDbogKdcXrEFXM9GH8HfZhxx27hbn/GcBG8HoiPbZmaSAtxgDkkHN1JHO/KlMP7fMv1dz7zjZTXHoFhyPR9DTo1B8gS1qDYWW7bGJ+cdylNTqeoaGgLrKz9M8I+9w17f0COlhU8= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR03MB2408; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2408; 25:pToSegi6C3pzmHOy5kdNGFG92uhH+dUWQaBKLrqyrq6rpdpjCZ3ZcVmSnR55qYDTy+mqZsAGfeI9XTWVYGTNasrCV9ZLkGR/MqkKi+Ob0vr+uEERtEbrjx+jpCWWruYlTHuh0cRyy9ui8lFDOeVONA5+cAXkWbe4M2Q5WFkJaXAXoEJfg0nx362NAnNwmdJP2NLCVCAgrbyF+NiPNwCMdsmIBS31fItkHOJvAlQHt88G/zac7dWpcSfx6m2sKoZkfpsmgL5qhPvLfSQE4y9TmIeRPa18gqWMDTT3DtHfPOT8WofiP5Z8YyXvKeW4Un9CCAdmKFrOaDKr3TzOZB+fxqHnWbmuVWgle5oguc7jkCAyQm9YCXgQ29F3SgOGh1cJM6bho5G3kmnmoZXfQdVtJPTr8ebFc2HOlhd7WVWPaxFyF4gNrLuwlth5zJmdtkjvSX0yDl+R4O/xyxYkU4NkaIiF6kj7d+g04OUoyHWr+ridYyt7GKMuVMR1y0xTw5Vw0dTh7Hkf9K35XYUMd/q51CGGTvW26aCVHEB402Eqdw3mokpWpH5yGD1t3W3cReJB5+CwtkGffSnvNsjDK9hVCnkXUE1whDo/qAjhvSxpJnFEalAQpQIcT2vP1gdIHMOs0m41waHkKKxeVXi1Ip/4gMg8C3zX7cSj6j84THsEkEfvXtr8YF0FSM8md5gbd4Sfdf8BnJMAbx91DyljNoW+NH71zkDvREy3kftSxiqPySk=; 31:CAlJySTGDVFBT/QmPHyxrlHTNjvhTkZc39pLWe/gawrY1B0a49wCYRk9Z/XR8GqWFi0ZMKp8iN04R6vK4HckHgtzA+jX/or59dhUhssao+Txvxi4tgXiW3wWNzmpWRBkRkqdSJCVM2JsTYUSEpARTci6FDWbroO3+EB/3VowkeIZdl4GRhZB/rocDRmdSbeA/5JWdEJB9m8I065z4iE5PA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13018025)(13017025)(5005006)(8121501046)(13023025)(13024025)(10201501046)(3002001)(6055026); SRVR:CO2PR03MB2408; BCL:0; PCL:0; RULEID:(400006); SRVR:CO2PR03MB2408; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2408; 4:6CixyiLuFPZFpKTvMc+OZs8EkmZlH15zKqzZPwpw7xTix2mZ6ru/utspig+IeiEiQ7mGlsv/MEsZzddWLuQFs8jXBGdd67mF1e+0Wv+H27KNgoJhVJUIA/RzMsjecvODzZL58ICFgJfamppGJiU/ICyK9GESxwA7M3qOhO/a16cqenO0SzSJlorFgy3wtOLXYkhdYUbDLLsLAJYTVRYnT0jzh0bCERCGwyaS+ndb9KprjTIBkM5d0gPJaYQGmuVeLBmf3LO5tXJNZt9FPTOwk24NGPWvKNeOCoLPm5sl0p/gPAk3DzenZ3cn8f9i3Qce8jd8kBhXlJKlRqQ2ncDBmA5f0unecpk5F64TFq4tiysOOQzIoA1Q1H6oCgk1OmKyxhV5AG4ll9SmOGD+0sbbitixyNjK3opV0NxG1+goPJo+kb9WZetG4YpLKuztUL+iHOBgLHTGg/BOLx8PfJbtJIontsOH4fQwL90vutYhzqoBb95apSkJPJnnD0alnyW8upi8QfPM/OsEM98pASuJeg== X-Forefront-PRVS: 00046D390F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2408; 23:SJTnOK9JmaIC2F08FMXLn0KZdQJjlZTEklh6+vEw4?= =?us-ascii?Q?3Zbn++kaDZIKke44eKxunMGZSva37WZv0BbmQ43LkG+PYuiBu/6sxcov4fWO?= =?us-ascii?Q?Es49lXbA0bdU57oxl57nwcfWm/3EFcuGqFa+a0kl2LQtUbV7bLRj9plDuWbJ?= =?us-ascii?Q?OH3BRVRBINAanqn2K/pGoK1LDN3/hCzgfNxxO0A22I+/Ta965p1lQsSG2WyH?= =?us-ascii?Q?7gTeDCYY9VXZxWK1tSm2vVS7mHCH7t2qhLUt14iM7O+E7muqXTVn2BbXuALK?= =?us-ascii?Q?50bM62AZh6hjJz62lgCW5BZ9ICSaTGzWV9drCb0PEHqiWisAr+jJXG+djk4l?= =?us-ascii?Q?Qu/3iXNDhQGphfH/idJuwqyNla2sDvjuayUBgxPgiJMmYcurEhkBJNOtfZDC?= =?us-ascii?Q?BeqMOO+6hydljTs5tuR/x84mdztqrcRmOPzawomyx/Ge/+pTvdr4yw/KMLIY?= =?us-ascii?Q?BKY9Af3o8VaBfbVcYKTcW5mIqsLLg2VJNUpirosqtYh0G+0o8m5SQEt9myet?= =?us-ascii?Q?IVVmCGQWPVai/raYLVC7CeBxJ2EPMi0txnWNl6UYUdkHTo84aYWqhufSROiA?= =?us-ascii?Q?cbX9+36QfB6ZOvZ5Htiy9wLBLC2EkInbsvurcAPRNQEtmF3kCZdQvkv1nFGf?= =?us-ascii?Q?fT7AynfBHrH1+f3BvAJfAsP3tASTPIC9P7kt0SiQRjetqJFcnZKQ9s4e8Cxf?= =?us-ascii?Q?BdSQRkfmRelf+l02I3N0c+kUg247aeWUqelL42/O6yoiELrLkNaoLsCOAlUk?= =?us-ascii?Q?rzI4H+uN7uXOKUei3t/8dZC8lV9xXetmDn01ffDXHhHdNT2RymGkYqFw6Kfc?= =?us-ascii?Q?GC6C3UnAaCE1JV0QFhrjb9PgmVyUR+nqXVsZ6L/XbCVLXQ+89dULpyNqVwJ2?= =?us-ascii?Q?JyJ1YtQ+o2RENQ1NeDvDSwH9HQV+fIIMalfrzBL3QUUo+4/uzM2Go4ah2Grn?= =?us-ascii?Q?k6wz0/jCtaKQAvZ/YKSypy4aX3DBv02v/6R78L+2FjXQHvb2T7VCgHl0tvAh?= =?us-ascii?Q?wA9ASPCerCIqxeXOhOklARPJkZsh/mmSbpvff+MWpRk9jlVRVKgt24ZAcF1t?= =?us-ascii?Q?f3l/MHSRelPyip3bNdzTLa7jew+/X6Chb0zJ9xVwEC5pkcDNBjLdMZlHkuuf?= =?us-ascii?Q?CCf6NAWtgIGRuGX9szng7Yd/IivJqsh?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2408; 6:nA7tfLZ3vHbkiZTm9uXpItNRRZrpotnwSiu3upu6zsWIY1UWDwnzetYLBxcWWytnx56H6m5L8DHE4iDOEYbGtTP14S5D6XF4YNvx9yV1ykA/pREfsDLrnLJb1RIXGM6i4MEH5tHHWxLCiZFrUHf3TZzd4DwEuwPcqW6APAplsubBTrN0+6qlUwYDqqQlT0gpKwCiHSeyUepzTbgIItjRvP3gaGij63bt+qsyZ4bdBy/RVzjAFF06TVxII/2iURUGj/pLi6sm0YSd6AOohZSjR7qZHc7CzuvMlkLHWbaGc68=; 5:tMcV276AwgDMO0oWyI32zgA6afq8a87wvUGZvj9xn+uKWCuOPwLgnidaYHCSDZSLCDMdmUf0GprkFRniCQeswLzdHKM686y5v1PDSZi7Ytm8A6EZC+h+sw1tCfhCVr/ldzoJGh422g793gxfcQeuTVYvaGaV78K0ng1LbMJXXXw=; 24:p5bXnudoC+MVtcyEwcB6M0JVOGVjnkMdBenoDCo/hIkPyMTgCTMpXZeNUTuDsg6tauskJJjtHxA770r+ZGbN1VUBVw395pDpFC46+LontX0=; 7:Gfhxyvq7GrcDo46fEV53q5ByPKhxcKPPbJOWLZh2DzdSAkYmxQO/hX4yjSKuvxpPxemvO6rP8lJxzBU9EPex1LQ78Gq6BJYupX1dKuhgVmyg8cH7cSwZ7SwU13MUWqRIGycOG8AK/CHFeRQ51fg3+q3Iq58qlrUjImF5QpxZCjEd7QSSK8fNcPdCs8U0U/ix3N2cC8orhPanJ2pzVjHJw43LoaRj4nTXhJ/izlw7PNwfw4ZiIL64G9BGipHOtJTl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2016 06:52:14.4005 (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: CO2PR03MB2408 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 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 | 69 +++++++++++++++------- 4 files changed, 58 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..ef34436 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,53 @@ 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; + int ret; + + 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); +}