Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3232915imm; Fri, 10 Aug 2018 06:05:40 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwPbwrxnmSwSN3UBeYPyTGYaeAOs+pDGZBbsXoHwfvMGhzIpqSXa3tH2XkS4uU2xB0hWk8W X-Received: by 2002:a63:f849:: with SMTP id v9-v6mr6317017pgj.71.1533906340102; Fri, 10 Aug 2018 06:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533906340; cv=none; d=google.com; s=arc-20160816; b=Ia7W7dGbGu0ik4DIgn4WPJd2wKk38p1srW2YFLGRmv2ApKhbctnLh/S+pV1h0zkyY1 F9EJ1A5AjdYUNl9tBp8eKJ93EACgAwqU6BqkR70k2y4MA7QkWgoTVeiqxLVCO/OTWjnM 8Q5wIRmQDJWfSBglBrClG2KjDyqI3q9TPx+hOEU8CuERyq/5c+FRDKTcUSjb9nHULhBu rMrIb4wCogJHpJXOo7tBHvSkZuoegVh3202vmTBwJH3XVndWu4rHDZAj6anWlAUVJHoK ldPd2PYC063lEITgizexQ4KIETxWm7gB1iMDNOlPCFAF9pz3cJth/OMVY5pcOLTqOFkl AOiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=JDxutFTwt6Aq9eAfDrVPglp75enktPxsSdR5mA48ads=; b=o+vXQbov832+j+0nVoEa0zyi4sXgHRuZD5HsWH/JHn+x/5C997a9HymbtmdG1F0fTq ovb/Vi5trjsF6L+CnKkyD99HRclopAlZnmqfQhtbSCnDvikR2c9Necz5pRR6QjIjGCSx Iejus5wFVkvs4LpYkbi+jyds3ofRWvrkrj9/YNgHxK0YLTq1kfZLcafDEuVo9yDlLcyz Ez3Rm8M63sY05xAOU0PMqqoRzp8PnGbAXVP2SVfESu30/Frm3zS2P/X0RXdcsbK7f4rb bFxqQ1iBS+bWi/bqyqZATcBpowARMFzhPzdHoqMHRK8Jb+T2gZwhD0TByVRZsHUNa2Rp ML9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axentia.se header.s=selector1 header.b=E6Nqv9TH; 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 q8-v6si9006682pfh.353.2018.08.10.06.05.25; Fri, 10 Aug 2018 06:05:40 -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=@axentia.se header.s=selector1 header.b=E6Nqv9TH; 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 S1728220AbeHJPeR (ORCPT + 99 others); Fri, 10 Aug 2018 11:34:17 -0400 Received: from mail-eopbgr00102.outbound.protection.outlook.com ([40.107.0.102]:51891 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726120AbeHJPeR (ORCPT ); Fri, 10 Aug 2018 11:34:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JDxutFTwt6Aq9eAfDrVPglp75enktPxsSdR5mA48ads=; b=E6Nqv9THp3Jj0KD87qwCCDhISNtTdpK3+k7tBfej6ilHkCafvcjUWkSEMFbl4uqmFIdKQE5/z2Fd4QDKnnfnPvCPmq1hq5s7jzUJu0/BG/AGrWCFRfUu0CzRfSLyzdbKd+sdRO8l63qCT/IRDJ4kD0CGA/rlQR81mhwQ8kx56Pc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; 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 Cc: Peter Rosin , Boris Brezillon , David Airlie , Rob Herring , Mark Rutland , Nicolas Ferre , Alexandre Belloni , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jyri Sarha , Daniel Vetter , Andrzej Hajda , Russell King - ARM Linux , Jacopo Mondi , Sakari Ailus 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 Content-Type: text/plain 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?= =?us-ascii?Q?9HkcS9IyewvXACGGg81obQfY0DhYsuY+Ox3EfSIIo1fSLN0bHVxiw82Zf0dq?= =?us-ascii?Q?u1YqGN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ascii?Q?sKxUog7gsorKi+pN/i7s81XL5q4lulIWXo5LNXIfUfumhX93FUiFY6lZ52yV?= =?us-ascii?Q?7H/R9M0oPrXGIJRQuQpNAiJvAl03YsA0j3/gY8o327aQDnj5PS8AmaoRIAxu?= =?us-ascii?Q?rvXg+EKxenneqWAcMk1uL4lTmegznZn7Elt/zD19HNHknspiikmFudDcgRtL?= =?us-ascii?Q?6ODS4X9NsxQlmZ7dAD9eboox/mev0IMF+05sOuR436jLlfVjEc75Mr2zVWQi?= =?us-ascii?Q?WLVQQegUfFYWmxXF8K3M1jLeK/yaUL+nUg1jtpKw2oVuWvl2Yl7+ncehKMGq?= =?us-ascii?Q?kpO3eOWb1jJAF/AyVeMGv7Yw7qc2/kQeqfHDmqtIDtlzw?= X-Microsoft-Antispam-Message-Info: fF+gR4iyeuN7cHzcAs2dy/eNY9p85w9K3d7LoA1a9fuQqRHxv2Di42R3Dl+eXpmIBIAIxTa8+ALMHmt3g0ESJ2t/wLLMsI0wNteTihGv5nt+nOT3VM0Yz6A7anymH5kZR7mMBk2iW/evQ+9xt7PYdfiTDV9Z45rAccsboUiwstH5AS6xLua+QxE1/8BHAJUhBUu9qPdIOBOjXBNhEP/PZdLgDh7MDVCKOB4Mst8Tn9TgnOwC29EKaKl4je15w7WvcXVl26SgSt2emgmq8/JtlhWjrMnPMI14KFXLb4INb6OhkmWKv33oxbkdqJrxLGA0X+60WCuLq5JNTFXug/lW897Kji3GzOgKnVeMzSpe2TA= X-Microsoft-Exchange-Diagnostics: 1;VI1PR0201MB2464;6:8rFCHihv2iKkjv84bSyP00IbOuuJfJ0brWb5RgOhQBm0TDlaeFXVxWEbBXmLADhKeeyrrNVz0GFeStpJ1Pw0PT5wUkO0nIXNXA8oZoEMkKrEdTrrif+Q0w4aCcvymhMDHupNT3MJnh9DC41jcldQ5GoIX4uVykDOWYyWBvKrwwItgWL/JIIVbfjhU17grUaN6LCiLik5rcCWgBdMRPyFgyGeTMsiGiEWYHByu8HttsfVhGaaAp61mFq9hKs3YDX/rHHieqDsWRTcVf1HSEG/brl6OHWeFY2gMgLu/GMnm9CS8BfYAoUmbd+DhaxMR49Hzn1o9Brq6OeTfxbP1926/WUhA5ep136AzhrglH1ERisKziILAsztbKrhveKLcQqry7HcK5hv2/v9LNHNS7/pP4bn59nreCL8AJlaDu1ifqv4asbXamcdQTL4gk9soVQLBzfh8INDO7SQb+4Hr3ObZg==;5:v8jHIecMklhbIcSHNP5YpA+oe0QyMunEtClrIa+qDqk+FnIEkdtB8YUcHwc8ipL8RwYQEkvLoF7O1lUrgvg5l6JnNxEZIq7tjWahao7LUYOyqsC4N5YHQhUrL2U+XA6E5m5QxMQSpvslE3zNNMJMuJR/al0uR8K1xMsMIwcJnvc=;7:rrnF0swFmg8192CEOALScXq89e2qBSLx/CMp0Ub/8v2pUMK/q1CurWffbBVeID9dAYE/6/sUfWpWOknpiIELWAv0wtwiBANzWHq0PTQTd0mP1ojWy+A8qgrDS2KN41aElYheG2FIKi/JvBhROoI0+2liWNjWweJR01akrfK6hnZdHv2amHd8x8si0wCvdrnFwvnoDoTHjJeLXkjdgbDPUESow9bjjaoFvQrIMPNpF1uH+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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.11.0