From patchwork Fri Aug 10 13:03:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10563441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00C7B14C0 for ; Sat, 11 Aug 2018 12:06:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1F212A2B8 for ; Sat, 11 Aug 2018 12:06:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5FE42A529; Sat, 11 Aug 2018 12:06:55 +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=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 781172A2B8 for ; Sat, 11 Aug 2018 12:06:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC9226E1FB; Sat, 11 Aug 2018 12:05:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02on0703.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe07::703]) by gabe.freedesktop.org (Postfix) with ESMTPS id C129C6E027 for ; Fri, 10 Aug 2018 13:04:26 +0000 (UTC) Received: from orc.pedanet (85.226.244.23) by VI1PR0201MB2464.eurprd02.prod.outlook.com (2603:10a6:800:55::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 13:04:22 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [PATCH v8 3/4] drm/atmel-hlcdc: iterate over all output endpoints Date: Fri, 10 Aug 2018 15:03:58 +0200 Message-Id: <20180810130359.9882-4-peda@axentia.se> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180810130359.9882-1-peda@axentia.se> References: <20180810130359.9882-1-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [85.226.244.23] X-ClientProxiedBy: VI1PR07CA0241.eurprd07.prod.outlook.com (2603:10a6:802:58::44) To VI1PR0201MB2464.eurprd02.prod.outlook.com (2603:10a6:800:55::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de74f84d-9f9d-4a15-7179-08d5fec1cb6f X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:VI1PR0201MB2464; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0201MB2464; 3:zL38bX7JZ7ry+w/lc//Uhk4xFrLkCs1Ky0+fVxJbiUv/ULuQ3JIRMxmRDNmVLIlPCqKafxQc6pCoqPzx+tjGhglSEcTXhmReqMYuPTx6yEEHRjgQyLsfnT8laENq81nj1Ygxql/3yjFUZ3z/G56NXTAfDZ0w0GG4nJ3BeJL4rGFIoUzBtYY3aPpfHDahUec73BhO4VmMlWyCLqLZOtsP0zy4CUAVI1nUmPr3/S7U3BE3seMQb6AhxLW7l0FAgrjS; 25:6wzAaZ/QiawFHNFfHvlNy/1kOE2JVjRuyPw0bvshP7flQ5fJ1pe8n4fKbOWHx9oinUTl6OY9ICbXM4KmMo13apjIva9J9HPQrsSlL9wAMGCFxHChZYabODsOUlTCemyKVGrLSlI5Shbo8DZ9yod/uA0HvIRaQIo2ku35u98y2jqpQTEKDchaagud45hbUZhJZ6uRhQkxF2igv7inoNoSSpH/mGfOMB0hsPYdkpUgEtiIpaqFtg9eYOUUVNW4ae/8O8PeXFhsY+QXII6zJkeNjNHyC8carfuR1oDrbF3Qzy9ESyKvfzzBO3MQAGQZ/E3DJ0qVmrcG1zNGruqQQGrhng==; 31:UEeHySlpq7omBwTXm7KIkZexz3hSlO2ja7RLLI7RgRbWKjkRjUIfYOfRzsQ9QjnQFHwEqLv+1aPYN3cA/4Q4IIs+AWqtwunEXtKv67F9sQiPRhqvsM7JQafDUhsr730QG3QKtYfhz/H6yHtJnp2uQ7dXQN1kpF033zsh/uwLlQu2jHbcib1Uc8gDI833P1h2Ij8ZECsMVALGW75/lzZvSA/Peuz3BI6W9yh5shGezPw= X-MS-TrafficTypeDiagnostic: VI1PR0201MB2464: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(2016111802025)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6043046)(6072148)(201708071742011)(7699016); SRVR:VI1PR0201MB2464; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0201MB2464; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0201MB2464; 4:OC4oGhMiVWszDKHnX9e16UAycCIc+1nIMyLvbcWjwY2cVZO72o59PwuynDo6Wgk87pr4IVDcjlLwnFngokIB2k4k9VHIglY1ilJWg5ePnEPa6B2ZFDvKtZmF+R3JhI2fPdj4e8pr0ssRy5BGpYqHdBxKjORh1ks2GUCcMkXg89Bv4fI8n0JbYZT125hED7zmsyc45U6C/iwbmUY+60hcuIikYuqg78sXWoaUDOBd1BkfaD7Rtnd1Ss5LLv10oboLepr8DDq6gE1TcscvaFm8CQ== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(39830400003)(136003)(376002)(396003)(346002)(189003)(199004)(5024004)(66066001)(3846002)(16526019)(50466002)(74482002)(50226002)(36756003)(305945005)(47776003)(8936002)(186003)(4326008)(86362001)(26005)(54906003)(48376002)(1076002)(6116002)(68736007)(6486002)(7736002)(76176011)(16586007)(25786009)(7416002)(6666003)(105586002)(81166006)(81156014)(316002)(8676002)(478600001)(6512007)(476003)(53936002)(956004)(2616005)(2361001)(2351001)(6506007)(52116002)(386003)(51416003)(5660300001)(106356001)(6916009)(11346002)(2906002)(486006)(446003)(97736004)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0201MB2464; H:orc.pedanet; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0201MB2464; 23:mPHQRIAVEX++CmlYWXDKqxFG74osAdDDOsRjEdk?= 9HkcS9IyewvXACGGg81obQfY0DhYsuY+Ox3EfSIIo1fSLN0bHVxiw82Zf0dqu1YqGNwjwESPcs+8d5uqWREsemQFCiiCLojuG4Byvb/z9F4MGvoRGXK0oI9+HtWersxogeq7aIxPnbSQOvDai3QejIHXew/ius++3c5gxckTqMRJHiLew3yv7yiK0S0gIUI6b3eYls28O+OXDhmqwRPhaOuyxIyrhDj381egLtZEIPSQ2dfNHg/IEw/esCDjQz7btt5HV+CgH7iXCWf9FmAU5ZWqzCn32D5C6nWIn4ts2MPXNYmwZjFTN5hCm2cf65RaLZ+KV9ftGL/MeOEJceDxiku3OXdRNkpALijdTwXxBEq+3mhAt1vcLgN9uCDsPy/4wkNZuQCLwDPHrEaBvxZQlLaKsCuc9faY06OtGYm1+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+JLtro4yOY64PsxX75OE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 13:04:22.9889 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de74f84d-9f9d-4a15-7179-08d5fec1cb6f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0201MB2464 X-Mailman-Approved-At: Sat, 11 Aug 2018 12:05:13 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Alexandre Belloni , David Airlie , Nicolas Ferre , dri-devel@lists.freedesktop.org, Russell King - ARM Linux , Boris Brezillon , Rob Herring , Jacopo Mondi , Jyri Sarha , Sakari Ailus , Peter Rosin , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This enables more flexible devicetrees. You can e.g. have two output nodes where one is not enabled, without the ordering affecting things. Prior to this patch the active node had to have endpoint id zero. Signed-off-by: Peter Rosin Reviewed-by: Jacopo Mondi --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 32 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c index 8db51fb131db..16c1b2f54b42 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c @@ -31,14 +31,16 @@ static const struct drm_encoder_funcs atmel_hlcdc_panel_encoder_funcs = { .destroy = drm_encoder_cleanup, }; -static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) +static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, + struct of_endpoint *endpoint) { struct drm_encoder *encoder; struct drm_panel *panel; struct drm_bridge *bridge; int ret; - ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, + ret = drm_of_find_panel_or_bridge(dev->dev->of_node, + endpoint->port, endpoint->id, &panel, &bridge); if (ret) return ret; @@ -77,13 +79,29 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) int atmel_hlcdc_create_outputs(struct drm_device *dev) { - int endpoint, ret = 0; - - for (endpoint = 0; !ret; endpoint++) - ret = atmel_hlcdc_attach_endpoint(dev, endpoint); + struct of_endpoint endpoint; + struct device_node *node = NULL; + int count = 0; + int ret = 0; + + for_each_endpoint_of_node(dev->dev->of_node, node) { + of_graph_parse_endpoint(node, &endpoint); + + if (endpoint.port) + continue; + + ret = atmel_hlcdc_attach_endpoint(dev, &endpoint); + if (ret == -ENODEV) + continue; + if (ret) { + of_node_put(node); + break; + } + count++; + } /* At least one device was successfully attached.*/ - if (ret == -ENODEV && endpoint) + if (ret == -ENODEV && count) return 0; return ret;