From patchwork Fri Nov 17 11:38:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1865061 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=j05beaJY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SWw0P6X57z1yRV for ; Fri, 17 Nov 2023 22:39:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8884287056; Fri, 17 Nov 2023 12:38:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="j05beaJY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CAB8686E96; Fri, 17 Nov 2023 12:38:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20724.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::724]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C94F886EB8 for ; Fri, 17 Nov 2023 12:38:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jtOcO3ZkmKD8ttLsc+Uj+SwqxFDOGNDRzkXOxvr/TtOOdvzxrMMoQvaPSRKq7m6p7lhCzIjeazOzv4x9KC2tzTtcSQBSGA9jKhID+OnDsVbRXw5GllZP6xOL3EHTUjUkYL48+12LCQVEbuuySKmNnIq4hNWUimYqLX0C3V4r7fAILVWqwMYcwBm1eyRFeGzQ0nq7Nq2QkfrmkNNDon78g9ibKhO1BDhUgo0fCkZhnAyCT/mAYcc5kAyNSobwyIg4Mm/UoptZVh6bUVRHvwF/OSWBPibYj5IaOByw5KhzAHUrzah3LuTCadQsu0z8xqQMrqdSKfxhtMB7t47Qw6EYkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XZL9sPwCr4VsdJsi1PHh3Q4O/y4yF32FKJCDM0ShQ9A=; b=Fym7W/iUTCei+iIPe2I3D8Pbc2g3Tj/hHSyFj10d+KVLTDTmpmpxZEsRR+aaQzbrseWITAuGwFLvDQ0bLmgKTlv2I2Huo2tq2lHe7x8x7lXVmvQB+3toGSj4iWay/14Xa7WCcsz2s35N+LN8IfAH5sucBFGOHFmoS9stcXSgmbex0JMtghf7boeElHQPqQHE8H5yF0rIlR9w0MIZUl3K/xIfB1AewUibuveY67+Cj+j9LFW6OL2Z4n4AA8o6Aw92V7e+AspZ4cgRANvRHpG+NIAMi1Lo2Ul3yR6Xer+8ZFy52WwZOHYV68TaLzT2C10yK8ghr53YKY+j8xoqe2Nzlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XZL9sPwCr4VsdJsi1PHh3Q4O/y4yF32FKJCDM0ShQ9A=; b=j05beaJYG3Q0W7IR4bvBARhMUtzOBWb2tQFskIRzfjRJR1yXOTkl5H8V+GGy+ZUShYti1wLbOCLpnVWT5eRx0R8PulFt3dH4ox7QrbOiqrie+B5ZVeah4ASo7Npjo7d0E2kNAiXa1hyVHpuF4SgxO3SwHJBRxz87gRFmzTeT2Z0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by VI1PR10MB3664.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:13f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 11:38:21 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15%5]) with mapi id 15.20.7002.021; Fri, 17 Nov 2023 11:38:21 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Marek Vasut , Philippe Reynes , Doug Zobel , Tom Rini , Christian Gmeiner , Rasmus Villemoes Subject: [PATCH v2 1/6] led-uclass: honour ->label field populated by driver's own .bind Date: Fri, 17 Nov 2023 12:38:06 +0100 Message-Id: <20231117113811.149329-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.40.1.1.g1c60b9335d In-Reply-To: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> References: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: GVX0EPF0000FA93.SWEP280.PROD.OUTLOOK.COM (2603:10a6:144:1:0:4:0:16) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|VI1PR10MB3664:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a3545f1-48de-4dbb-613c-08dbe761b376 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fuFLIB2pYC11UViyXmLnl2b3uFLsSNImsFW1fJ4leLLtNSv/ezeX8KG8pKgoVFzxx6aI3TNFpAF7jXZOVC0572B/BRMEAye0CDaKkrd/scjbc1eyc1iPYS6A80R45pm44rQSC3+uG+kPDW3+PMX6FdgvSCeLEUJn5QI0SAVitgvhsiV7rjh6Amf8G3g0LDtDAlcVJzDnIh4LZZSi7c5jXwS6j/MZ7qLqjV3B0lfqsraxASZNZ5Fls5JX9cKyGhRkmgnChqJSh6jJMfcHE/1RdAu0ktOxHCZ+a7uUtzAT+VD/bIu31m0js5ahQtG10cHHNo2i0L9YrG3ny0KkNnZosSWGiUSCxDrZfgRVNj1TdGtJVo/rf2CC9LBZeOoa1jcP3QADKL6qokHrAo77wanMrMiL4BgtO0pL0Ur+IOBiNUiCreVKrRVrBS79BdlkN7ZzAvUnhj/djakMdDvsCrtPZvWtl5cjSrQcD+A2m1kOOZh4WRqTaFu+FF5lmhhBM49sAqGjOh9LoxDY2ostLSO32zeYHEVWUhPHAZqqr0qiWIV3N03j5yMgZOuVxksyZ8UDkyQ1o8/ehM26hlXGoF752yKen3bMDD7+VfZOx9Qj/qROTHiQroOH+quVxJkGtIomyCfZpgaKS2DhjeL7biue5A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(39840400004)(136003)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(38350700005)(52116002)(6506007)(6512007)(36756003)(6486002)(41300700001)(8976002)(8936002)(4744005)(6666004)(107886003)(5660300002)(86362001)(1076003)(8676002)(4326008)(38100700002)(26005)(2906002)(44832011)(83380400001)(66476007)(66556008)(54906003)(66946007)(478600001)(6916009)(316002)(2616005)(142923001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: buUnxLB+44Dx9uT+ltub7M5s0y2XdKQziuQY86hPCB01fz9d6FFCMzUfgMhnK0Cbx6xTGN++znNezk+uoklJko38mli6CJ5itDx2s9CSUYheYBLPzx7Ds3i9cTgQkKqcmdXkNF8V4KA8qXZQdHzol9e9h8fGaeBzGKNLaNNjoZJEHacUlmNdUxvv5VUjFUYakfE0InbFuniW7kWs/E6PCS3mp0DUQvAZhNcYSb1Kr12uGykCbcqQkBcSsCDaTGJB0C8H4motuLB/Mzhfs99u0hrE2FAO88iyh4rj4YhyIThNj30LLbsTlmla1T2gULyy0+mkqeH99WPMHgMHPjRPaZ/jak7m+bANNTgnI8AgpHkQ212rWATH/HnShFWRc2+bOREVboSd/AQ9J2d2Db2oXmtZMNT9xQV7dN9QZK/SUN7Rk2r2jXZWtJz4nN9XW49rjYaTxRlX3TIpxt040sOqJjVsLHo/gor2uDZKuDtrU8GfawpiRZbFm+YwGFZ/qG99FZEuZj5tEoYqHquaFszyTqXeLeE6hb16XO2OTRHeFcMpNcSrK7f41AHPdPhVmg+uMvxUKl7SA+3PU20dWrM1TIaWrD8ZwBF7WTOw4jCYYeD8ZHCrr0zMaTxzv2XI3d+itTTm3ykKF8/V4VNckiObQg86ThgTdw1s5RL3eCZ5JPv97IZM2zrzXVsufaDpp+Bx8gesT/EVzXFIKeR9nQB1ZVCBMJVZvoyXvF+dEvut1/eNxGb5vBTY0zVoEwaUe8MxG4TqZ8K6eg9Cjtwu+jaG7GT2cRYQ3riUPQM3MSyOILwuZ2ArUH2+Q3roDoliM3P2bGRJn74a3E4yqmDz4clRq4+osMsl1wbdMFyVb2hUjVoDvhqEqWSqFibcuZzUfsVZKfYK2lOGhCQ68nhsxD1b9MHcZ1JN+HhSyf+AdliZHoRDDimCJ0KTVSRBRrt4p7PQYmCc1Qik7BU2ohdxzcWJny5yiQ1LLxBNyEB+pSemjT/cXJJB3aBKYd/xeqaB+HHBg+PbLOIvd0wrlq9o9fTpPuM3zO5k+Bs3BGwGa4cnT5Y+0J0topWVd0CShZHz0fSxJRvWPO/yEKPYRsht8FNJIuoy8KNEFDbW4YYywH+Z3Z/mL3V08iwGkshzaY4ZhLvyUxgPFO4K4/pfY23j2tWmH4+fU+UOopXyT477vj6VdHTu/Z02NqiRE/hv1JrY+loHnuSk1myJ1cu0cYZ7pJlA66bd7hUUev9waxhWgNc7emYgF6nktPavu9jThisY4RWgRGvCj5aPYYL+4AVn/ZUF5vxIr6ZV7oXjts91gAWE2gqlqagTRrSNcuCNhySH6Jeof8kJ7tsTGYyHj7tTPEwhADUMED2KCjFymBho2sF5JvMcL/Vn4yb4lB2KM7QzRrc+i4KqTmzimIZV9zOZd6FRHcjJ4FF1uTCIgBWEUaXjSfAnZSJHtyt8q8xGAxWKYd8wwWEdgp3RTrSsZmcn56Ji1JbZv1L1TYZMq7fBVjGrtZdzwAc7zo9TJQ6/2niJ8ogIC2vvXEDEbAZhGLEJI3tNIbkx7PVJeAsz/k9bKwPGOF0Clfm3XJvstN53/YQE+CgCft66mLRkDA9DS5Mj3VuGdA== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 2a3545f1-48de-4dbb-613c-08dbe761b376 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 11:38:21.3329 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5l0YwAGNuuoRgXkrojz4R1HPS6JPlB5euxpJdwrmLi6NuD1mhfTFuVgfx+RarQqfYC/Je9/ZgpYjZPlJO/clTk89pLTyEKoG7LWQYDWQvsk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3664 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean If the driver's own .bind method has populated uc_plat->label, don't override that. This is necessary for an upcoming driver for ti,lp5562, where the DT binding unfortunately says to use "chan-name" and not "label". Reviewed-by: Christian Gmeiner Reviewed-by: Marek Vasut Signed-off-by: Rasmus Villemoes --- drivers/led/led-uclass.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 68ca3c29702..009f1080197 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -71,7 +71,9 @@ static int led_post_bind(struct udevice *dev) struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); const char *default_state; - uc_plat->label = dev_read_string(dev, "label"); + if (!uc_plat->label) + uc_plat->label = dev_read_string(dev, "label"); + if (!uc_plat->label) uc_plat->label = ofnode_get_name(dev_ofnode(dev)); From patchwork Fri Nov 17 11:38:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1865064 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=UpjGrO16; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SWw1P2gF2z1yRV for ; Fri, 17 Nov 2023 22:39:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8FF088700A; Fri, 17 Nov 2023 12:38:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="UpjGrO16"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A584F874C3; Fri, 17 Nov 2023 12:38:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20730.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::730]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 152A48700A for ; Fri, 17 Nov 2023 12:38:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cXlCDTbGVptmN4ySo08FZu3w2DF8+lU00EVsv1kkEifWBkFVLOU0DuxjrMcbNMB02PRH50K7nPrysHcZWL/V+4EZGQcEAwDuQUIF+pXhE7x+tVPn+9HJHXonLPL1TCC3YMz3MI08BKygKjLqN1dOkLwra59iHWSk9xhAaL+MxXi9ZNRG7luZReLwGP+EVusyjRFYShqF3JY2VlcjVlg9TnoveSyx5UmDwK6CLZoUNM5rRMIeX/SdnIoobGN3s61ZvT0ryZ8iOFe870ZEyD9yP6/SACizYsHBnWW67n4HcsLipAvBvcNq5XFQW9ivI5IpMsVDYNp6BVMCyjobLa9W5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6fSI7/xn02EatSRAaXuthuJNosdTzLuB9JzGwKeIGPk=; b=NXHYGMt9vWEV9Xmmi7RPsqNYd+FM4Nw+bdlONw/ZjcZWHRf9h6z6mDm4eVj5xvzvsg/OrcoEeRUYraABbeY9UpXfSH560w8fbFMtAMxUXda7V6q6/Uid0GuYgLm2aEQmSQKwO8r2cI5keN8uxWzrFkialFiaKi/0Q7/g4F8SfV5xaA5sUXuaauJw47nWtoJcfRqmFJnpjM67mScEHWn1WAvA47QJzUe0S47oiTr6TUKnDwUnvEnd5lfo9FWJ4Fg7JX2Sz5uT0FNgQxMSDbxZEv9iAqUsBTYPMGhq587bIoz6SZJ63p/O6AuxyOp4gnzTZ1n5bRCsh+3zUrdi+xrM1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6fSI7/xn02EatSRAaXuthuJNosdTzLuB9JzGwKeIGPk=; b=UpjGrO162OORxH8KrlnG8dkANpMXXOPG0IK4DlXnXP5RqvPvFOTVVJDey6FeajEhlEPZXERtV7oJM7AHK3UezqJh9XXjf0h0TinO0PZLyTdCz9xs0J/lWdkfkK/PcjzED+xPZgpHs/KFHgmPgKg3wvitLmFOhLRBzAufXYt+Sis= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by VI1PR10MB3664.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:13f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 11:38:22 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15%5]) with mapi id 15.20.7002.021; Fri, 17 Nov 2023 11:38:22 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Marek Vasut , Philippe Reynes , Doug Zobel , Tom Rini , Christian Gmeiner , Rasmus Villemoes Subject: [PATCH v2 2/6] led-uclass: do not create fallback label for top-level node Date: Fri, 17 Nov 2023 12:38:07 +0100 Message-Id: <20231117113811.149329-3-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.40.1.1.g1c60b9335d In-Reply-To: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> References: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: GVX0EPF0000FA93.SWEP280.PROD.OUTLOOK.COM (2603:10a6:144:1:0:4:0:16) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|VI1PR10MB3664:EE_ X-MS-Office365-Filtering-Correlation-Id: e1892985-25fd-4ac4-85cd-08dbe761b418 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NfUuPVSubpPXPg2WUMaiLDVoOcOK3kiGw1srnuxz+Qkvwm+OL6LYlWPi9BprnQb8Z06jyZVrwsBqVoTQoB2i73ch/wXCkCB9qLSGbP24JDicKyr5wmZlfHT1kYDqU1XsfSVHIYoBSxpGFyem0AgVLQ/NODXYRTSKRszKsL9jWyZucpKJ1l6rHK89ZGwxSK/CsPZ4UOsXYrrEJitDnB2IidV+I4gZpJszJl7I5TiLEysZTKn8hKHGjEhLOIv8QwNksKmkqjdKGAwDCrPz/yIdigj8wjz7g1IlyFfj/sdQ+c+LXMz/wJr6oS+Z3AXz+ifjP+tV/tex6+Ckg5UlLJz3TJtgLz28Lh85t3L4VUxpt2zmNYEePMgRP6+jyjvQqn/Wpzhh6QZ74H+IxrHsFhTT0o2qo0BXrr7snmfnFPJD2fq3m65qwST9+9QO6KDc5Mtnrhwvpwd1GOA6CPfLg/HXS5Ov5QCffwdTaI1wxA2Mcb9LKhWTljqezXsM2zWW7MVFBb0XVoABGVVe9gb5SPAjMEgpCzY/+c6QtOogs3YugSczSwWiqS7jAXEzMQE3nO+I+qsFXF2Xl4saQX2/9yKgy9p9AmNFZYONb9UyF7Pg0pCXfE5bDakehW70xwnLY/Yy X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(39840400004)(136003)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(38350700005)(52116002)(6506007)(6512007)(36756003)(6486002)(41300700001)(8976002)(8936002)(6666004)(107886003)(5660300002)(86362001)(1076003)(8676002)(4326008)(38100700002)(26005)(2906002)(44832011)(83380400001)(66476007)(66556008)(54906003)(66946007)(478600001)(6916009)(316002)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BaXqTg0ncEMKybhp0hyccI+AyAvgvfXt1ATdS1CM3UyyFR+bOQsmWPR4vSHp2pyprvToLUBd3ykHDzzySp5qZAgFA/JBs5z3+lPpwA5WIMBKT8KOBjwxwMaLf6wniyYSvuI9yu5Cjwmk/EIm2PMLi1Qtf0FosH8b3e2byHqq4XTpIU81LRtBehTHAb73Zf/BouP8DhY2uIR3WBJ+yTgaPl7zVBNo961D5XD2URH9Y6UrxmfztZ+FVZn5bFl/+LYfTs9ItNF4fo7X5ANge+CX7zie6Sae4LK3vrqa6N15KNtDlKJCw9Ta644ChX2+p6HvIxcApz2IViOYL1tz/Rms1TYbov72Hy9bxe+bTcsYOluEP4bRwMYiiEj0N+H91tDfmYzVA7dyN99u4xmOvmN/jNkHTsKR2X1C37H7LCInFpdotRmBgTej7M/+wZOQ2HQp16KGFdGvqvHQ4vXry0joxL3Tob6jDDjGDpbF7juqpdsI0MgMApkXHdusZ4ppfvRnzCS8aXpGCyR4xQJ9aVYRP9A1z6G3gRj3Uhl6OKw7ODENOOLEZowOxcZxCopUAlJ53a0WY7b+aWlfKQMxFhMXYdxrg9xZDQVQ0+6V3xiTipG8539BoymkIuxrfv96KsuAgM74O2Pmgf3ZD3Pcrw9v1jWwqNkL+6UbGrkRT52ImvKMsvf42ckUNa9K6PFjYunbO8OQqNFE+/ZTJua1Ia+7ZocUuCVTh8ddlkDNisqr9bpiHIfUDVW+hfSNh6Gx/lUDSpahTkG2VpL4zQPWGSRck2hc6VNuWUzPerFSY+D44TpeV9/lvM8ZlQygzVJKjq9nGSUlw8WhfWtWtDGWa25y3AcOQER2YukSjsFx9UD/4xYLYfZEPjlxLYylt+ad4IhrW6+jGkClUCijEYBPflMMz0fzx2f4b5qiNfPA3+Z7YZhnP5fAgDFMEKeTvHqCuvmGvraX0Nl+69RQpRYLeGp2gfy3e5oMhifjkX+31brIEjSa8NKf9/60hpFKR+0/vEHNYFqKyMCc7gaTaXf0aDR76XjaJOebsQMmWw+DxiH0JMxezZKptH4O70Nby45dV9ivKQhPoxY+pKvH6WsiJYVaCHD/haKW7GlUvI7nA+NhcDGYvTWhRxTGvvtvi6rIGNX648ZuVr8sOSI7pNhAm8cZQKRUPcTO4RMxJqdheBdKHUz3NbsrDD3EDMx8bMrNz73cHMErdEqhwmEyGXjaMdruwj2VVCDOwI2cMXHhrHKIGHgMARStU+KefEpJkOa8Wng333dhDLR4GHJB3AmvJnozpQtzyLzRkaPmaRQ5E2lzvkf6B80gdoX8prWEq+B/EXuMrTrswW2iL+buJ0KZ4kVw7PUXf0v21pA2oa1qEnczqGS7xVGzIHntpmgUcz5f6NaiO7VEGZlt4XzJ+BvVd4EDEWGPaaEykv/M63BbYRVJH/i42OhqnK7K3Xg5VGH8S2esV9sBH/BYxVwBzmDPdpv7qDMNBurFXUPL0gbhtsSSavVy+5NZgZjf3q2aIm/I09W3VW7jAbXGEbTiuR8jbrn7Tz385reIj6lLauNZngt5axG12sP9Hl6A0NS6R1AhiStDGZUF74ibhKaG1s9O+rX8LQ== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: e1892985-25fd-4ac4-85cd-08dbe761b418 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 11:38:22.3411 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QnzmGGlGuE5CUR7p4viVvYr4Vip1UHZwIR6TPyy2pQZDaHPq9RxIi5ahvf0UNSFzU2tnmU4DO5KFd1qj+sB28WuWSWbMWnR8sLSeI/MZzFA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3664 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Many existing drivers, and led-uclass itself, rely on uc_plat->label being NULL for the device representing the top node, as opposed to the child nodes representing individual LEDs. This means that the drivers whose .probe methods rely on this were broken by 83c63f0d1185 ("led: Move OF "label" property parsing to core"), and also that the top node wrongly shows up with 'led list'. Binding the same driver to the top node as to the individual child nodes is arguably wrong, and the approach of using a UCLASS_NOP driver for the top node is probably better - this has for example been done in commits 01074697801b and 910b01c27c04. Until remaining affected drivers are fixed, we can use a heuristic that only sets the label to the fallback value derived from the node name if the node does not have a "compatible" property - i.e., if it has been bound to the LED driver explicitly via device_bind_driver_to_node(). This is similar to what e3aa76644c2a did for gpio_led, but that fix was then supplanted by 01074697801b. Fixes: 83c63f0d1185 ("led: Move OF "label" property parsing to core") Signed-off-by: Rasmus Villemoes --- drivers/led/led-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 009f1080197..0232fa84def 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -74,7 +74,7 @@ static int led_post_bind(struct udevice *dev) if (!uc_plat->label) uc_plat->label = dev_read_string(dev, "label"); - if (!uc_plat->label) + if (!uc_plat->label && !dev_read_string(dev, "compatible")) uc_plat->label = ofnode_get_name(dev_ofnode(dev)); uc_plat->default_state = LEDST_COUNT; From patchwork Fri Nov 17 11:38:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1865062 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=iln8gKL5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SWw0p1QtJz1yRV for ; Fri, 17 Nov 2023 22:39:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 97A74874A5; Fri, 17 Nov 2023 12:38:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="iln8gKL5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 126848700F; Fri, 17 Nov 2023 12:38:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20724.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::724]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4A6C487087 for ; Fri, 17 Nov 2023 12:38:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fKrn0saQj0sFGWmDNlcZghCImisTU3Tue2xTXS5ArQV15AE8HF9ldtNU1JWuOFJ71pBj1Uxe1gQUwoLm0rObhhRs/Y6jC1SlvYsyJSyrGBuOmoktLctTU7HGf5LcBpCztBIVQyUSNRJdMM4PHvG49qn4AJkCDCyNNqU5Ati9irgY1qA00/KMnmnzNMV35VzkcDNLtLH8/Hz/2P+mtZxaXBBcpOPuD9URRG7m+aRZLlgE1+ecozGxWHo/uGt1H1QS4CF1g8VGw2ZyqGxzne5Le2zUWKckpVEfgJiG4242T2diEoQTMaHoEXlGUjqHOb9169Fh8d3YZl4ttOMURhHGBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X/q5igHhV2kVwUKy6W8WQHbkat1NJInULUMkHCWlEv8=; b=FMYJhr/9Vl442fM/QY7XmzT+Y8jv+CR5teO2I8DhdLbeWYg03AmONS9JeuMxbRJpQS/Ws3BzqfheK+RtN5XX7nGdOgonuSDCUrFfnj7f7K2dlAMPYdupQflyT+RwgQNdzcCO1Yxdq/+W3HOgHIMzrwR7ELCv0KZdeqBl/zahYssGIj459q2FP9rEQNWFMFJBJzPF5rWpHPtOW+h9okZl5csjaCJGZKw+P86iJA8K7MJoIvHg8KY5umtSGQ4hwJ4hVL1OR2M0SkZ1tTNZBCSwd6fdsyj3tXvFtkF4Q7sBIDR5cikJYLMztWdwTMCScv3IBh0LAilyaMACLoFpj3vk+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X/q5igHhV2kVwUKy6W8WQHbkat1NJInULUMkHCWlEv8=; b=iln8gKL5Oz94wcFkwftfMJmXYUDGViH6V7d9hxlLuH+PY3NOxE73MckP4p+EN8PLgT13c1hh5v4U42czoPtbcBTVWHlmJzzCoUmIS6jWL1sSoNio2cupZOsaUCNFQZLrGDnf9GfO8jEM8elxBD2FM/+wpS02QAC1nx23uyb1L8E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by VI1PR10MB3664.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:13f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 11:38:23 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15%5]) with mapi id 15.20.7002.021; Fri, 17 Nov 2023 11:38:23 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Marek Vasut , Philippe Reynes , Doug Zobel , Tom Rini , Christian Gmeiner , Rasmus Villemoes Subject: [PATCH v2 3/6] led: introduce led_bind_generic() Date: Fri, 17 Nov 2023 12:38:08 +0100 Message-Id: <20231117113811.149329-4-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.40.1.1.g1c60b9335d In-Reply-To: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> References: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: GVX0EPF0000FA93.SWEP280.PROD.OUTLOOK.COM (2603:10a6:144:1:0:4:0:16) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|VI1PR10MB3664:EE_ X-MS-Office365-Filtering-Correlation-Id: adef9cd9-5886-4edb-bebc-08dbe761b48f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1LelGqD+AauBLrxrAQ1boWksuBH2vaCMyDpVx3TwhReokSCYACO/bT2K5kgYHbL8FeK19vcoM3zl6kgbB2QSb+FHRs8Bi6WxkMs2NHQpf2k4BbJ33JvpT2H0cp1CmoutZHdIMCyJ7oZ1P1vqcR9ObSoZOnnG7sXl0mMQrC6YlGRBTbj2VOvPCHZ5hq8b06coLfhprHucx1T4K6Een6vKvuUlwGf+5XygcSVYdJWTgwCFK1o8hImDIy6SFP9U5noWTG4ojtDq4dPIs2DekbzXVfDlJzdeHeE+t0RwwPHUZlPTP0JlmSJWGu+DJL6rart7OLPWq7NMbIVRPH2B6WNTrrJNIESmHLZ5v+lWtE3JF3v/Nyf/HBTRhSyUqnL3Vml7lzyrmO/oqjuFo+H6hZfTVSo3i4I3aQ4zBB7j/wuw/HtwGvbfZqbgC2ZmvgiwjTPfQ8q45asDnTLboQaVEcTkOQ9BrDWpj8yl6wlK9SPuSwgfw5vDJYxh/IGQQcNvD4+5rH3PvNgkj81ltlWZxjBA8L4rpQU3aRxUsX0rikXw5LXzpyeSM4IZEuFabJNeK3uO+5VrlYeXUOWuaCoZ8cL+DBg3Z9UctlI+4yodUcDfDQqWCP9onYZpnOFdlrfu/fjC2SUagCp/gC/J4ruyPzbWDQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(39840400004)(136003)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(38350700005)(52116002)(6506007)(6512007)(36756003)(6486002)(41300700001)(8976002)(8936002)(6666004)(107886003)(5660300002)(86362001)(1076003)(8676002)(4326008)(38100700002)(26005)(2906002)(44832011)(66476007)(66556008)(54906003)(66946007)(478600001)(6916009)(316002)(2616005)(41533002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GQRBxReyso7LW3aL/tw+2iVXe6Z1sxr7Dcy1xcLv3vHwPepKC4slZYrmHO96jfO+M2Y+KJH60AUiO7sMa3ohMZBTTNDrzWkQKGk0XTxVbBqoHmFUWXcqFP9brj5eGKy2ZtsaRkh5Gq8zyzyWF1Sn4SbtsVUWvEDGVosJzl1cPrN8OShPz0NbNZD8HwR+tPqwMop3V2LNpqHBltlGT/lLnF0ZExQQuWJKg4AmTTzVqLbqVmsu0RoY96SSXYm3dXP8h+NKxgpGYJaUg1VpOCNGHuFMITQOTF6JnLt07jogz0iBUMgrr8/yHgeII9uBpn2yEWqNJRk2e2yRp49kfeQvhlZ6xkjd8AbdKP4ZgIyo1Sp/rCEX6TGNM34ehWA9hD44a1bnrMevgprisyfdFizTbOPHQWgL1VstkS7aiTRaUIrjq82j3v53x2bK9CzTJrMeXUjhETgcFiaDmz02PoVD3ejBnciOFPYGsBtk0Uh9ljWDFH7XvokkbC303QZXUlmOLwOq0EKwO5NjJ6E3K1tPgfpd5Zd4xXmr28llGub7oAvC8VdqrzFLAGRZYa5qK09pxPT4qSUT6EoZz3eEeZc4l/z+q2VTBSmRcGCEMoSRmNaNwMDBZaHZ+eI9MiDv13wA1/YKzF/c01n5O8drGxdQjuLfkzMV1CWaEnCJLMDYAEFumQPUCeJ27A7dUDZaTqDDsD5Mol/7sGpzzIIqE0NRrnUR19TYg8Ku4giQUhsmSOs/dbA3OHZVtxq3gnKwQC9zP21asrxl//ibDTiFCPDF/NvNEu+JchumgpgT57/ZnWWuxl1NC2EPVj6/DLP1rUnGC7gTMHV8ipNgO+oWmdhwDvW7XFrOy00cNWXSc6X4wS9siGAl13GFtXbKkJth8ZoeZeqxk8a4V+zcfnEhWBksrmdB1thyF5HvsiBQX+/amMr3ZzvuGTSYJ0fGUpPBAgMtmM28PeD4TL8IwGJJcCZg6ZRVcH4j2Ui3yZ7WTKM9Zl+LPSM4QHgmH9e/lUOEhGWrVxkcntdyz2xn289TI/SpDfq/33UAA3TY3D4zmQ50aW0n2FipjjUZYMhcJ5Z9+HaTTz4It+VC6ZoqmMyKPcZ/hK0RO8xPooBnuuvBc5EnHwGLDya//PZJjFplly/UuVmevGI10l77HaOLRxVYNFS+VxHEBLQ09IiCkHbAuzIK36yuLQ+voT/mg/EmcegMLEdPiECOCSEx7VDL5U2DxtSCftmWaGXvoA+lS41pKb8e8rUHXBXWSTT8vrJ9tZKLNn1hsRRRO1YITPGLjAREdThn6hpHTnVZKhqsyxwaCigz9ch0eD8yez3DVsWYpmqBygFmE0LYnw0KJfISKTSawCcFu8I659ZIVG0ulybx2saPGaDVTiWsTye15nN3jXd0e7jr8c89YXFC7R5FEGn4TTSmd5+Xm5LEdXqRxSocjzGRacxrG3Lr9+F/ja3pcxAHJ2/SURUYxAKFNYvbVV2cnDLQCM9ymJ7wZFcoWeAdnFqUCxmM3mzxlfuZHCWvUCdt2sTJVrkWUdQ+jbg/Rvyykts6qjmPcaDYJR0L+P/qGBSBiFovOeWm4CvqBNF6r7IZ+NJzHzFSKY28Ehrn+q6bVJj6RA== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: adef9cd9-5886-4edb-bebc-08dbe761b48f X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 11:38:23.1073 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iDvTVWo4l7C/oLF2WwV0et1FDPnmvMvYUemEARKz81YdTZPC5e5M9VBhIaZHLHSQ5ACRya+t9mXfb3C9hrA3oNeFEo5fyBra4Vv1IPTuMgU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3664 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean All existing drivers in drivers/led/ contain a .bind method that does exactly the same thing, with just the actual driver name differing. Create a helper so all those individual methods can be changed to one-liners. Reviewed-by: Marek Vasut Signed-off-by: Rasmus Villemoes --- drivers/led/led-uclass.c | 18 ++++++++++++++++++ include/led.h | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 0232fa84def..a4be56fc258 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -11,9 +11,27 @@ #include #include #include +#include #include #include +int led_bind_generic(struct udevice *parent, const char *driver_name) +{ + struct udevice *dev; + ofnode node; + int ret; + + dev_for_each_subnode(node, parent) { + ret = device_bind_driver_to_node(parent, driver_name, + ofnode_get_name(node), + node, &dev); + if (ret) + return ret; + } + + return 0; +} + int led_get_by_label(const char *label, struct udevice **devp) { struct udevice *dev; diff --git a/include/led.h b/include/led.h index 329041008c1..a6353166289 100644 --- a/include/led.h +++ b/include/led.h @@ -110,4 +110,12 @@ enum led_state_t led_get_state(struct udevice *dev); */ int led_set_period(struct udevice *dev, int period_ms); +/** + * led_bind_generic() - bind children of parent to given driver + * + * @parent: Top-level LED device + * @driver_name: Driver for handling individual child nodes + */ +int led_bind_generic(struct udevice *parent, const char *driver_name); + #endif From patchwork Fri Nov 17 11:38:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1865063 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=QglaFfWG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SWw190zmlz1yRV for ; Fri, 17 Nov 2023 22:39:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 19D9D874DA; Fri, 17 Nov 2023 12:38:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="QglaFfWG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BAB4086FEF; Fri, 17 Nov 2023 12:38:42 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20724.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::724]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 798C7874A1 for ; Fri, 17 Nov 2023 12:38:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ina49ezH+GBwSQ2lPBcurHcmG46B7AUAN/d1oq4t/rPNcGuNnMy8iVmH1grXuG4If0MSvozp91YN6MZNN5DjjXCjTrHDiyh/BLMZhR/mW8UL5D7jeL0wTWP5Huu8ebpQwYW8NtplQVGZyfRyjY8xQX1mqK6wHx89vnK1Haa7dq9HAO2OdFSLp2FQons4elp7nh0uUwz40xrecuZ8H7NOqvIy0TEmQCKGVFKliV1y3LcX8O/s/xmCKJBtJqQQBYqi//0nm15ExRYBx09ifsHXj1gnXlXuCIu6ZhfzuLa4Img7gEeufAIgKcmtOZz6+QJLhPWxs/1DGXTgymzfuIfS2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bOpKsrW+ICNeNcBe54IP0ktuQesHn6Px/9wxnX42YAc=; b=cohm79wzCGOCFNipS6ac0196l3YCxz7FiiHme8poMPtlNqEyKZyTAWJzCjSmmFifLxoYUxo/asAthAJCj16rTPsbKFHDsXT/M+qF/gWrQj2lNH3XrKRgo4KeX4+T2aOFceAU4naNBtiAWxLcs0Ez5foKenCn7bw2Tmfktda42KezVBpEsspU20Yj3ZIc9A3oe2MuHreQjJXu1c88oxCybLoEYHHP0EozZ32QiXptMEtuejsrh5fAAGmcJJugnjIbvBOE2eFt2une9gKRZ9e2WSeOC70V7LM1r02HaaFWt2NQwTrlHZxHNOx9cwSORM57odPyHYg7S/+mhzTv/jiHXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bOpKsrW+ICNeNcBe54IP0ktuQesHn6Px/9wxnX42YAc=; b=QglaFfWG009/F8ZJVNZ8YeSJhFkAuEOZKa58H/2dY7W4+hzWirVnUNV6h5C0/ESuVRkLk4f9uuyJESDBaSA/bhzL7+ewuePuZXHWsK5PYQYZ/uqUnrKcFVeiJaVx52bOgLfRAdFLiCA1ewhRIrsPPJjfEDqztAvQNOJ6033hMWY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by VI1PR10MB3664.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:13f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 11:38:24 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15%5]) with mapi id 15.20.7002.021; Fri, 17 Nov 2023 11:38:24 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Marek Vasut , Philippe Reynes , Doug Zobel , Tom Rini , Christian Gmeiner , Rasmus Villemoes Subject: [PATCH v2 4/6] led: led_gpio: use led_bind_generic() helper Date: Fri, 17 Nov 2023 12:38:09 +0100 Message-Id: <20231117113811.149329-5-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.40.1.1.g1c60b9335d In-Reply-To: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> References: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: GVX0EPF0000FA93.SWEP280.PROD.OUTLOOK.COM (2603:10a6:144:1:0:4:0:16) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|VI1PR10MB3664:EE_ X-MS-Office365-Filtering-Correlation-Id: be91a5ed-7f4a-475d-d081-08dbe761b4ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZUehenPnHTVNHEV/VJfE8qRqDZ88eTRmwL/OacWYkOLf591VrRogPhfiibuxz3+hPUVf6XStZGyyL0hloC41f2Y5XO1fIQBb5HRAgXBmSRHnTKsh0gzWcyGCPDFUZjApjP34S/x58AVuXAy0/MBaGdqEmnoGs0EMj4lPIEd2LlWGHudtYe0LIga6MsnGx0K0uwpIqQlZXed4gCCQKfdDXmKLOzuJ/RIpu7mYBZOlVMsU73ehjcyUa3zL/PyK5yn5HDVOQTX+yvmpAlZew2BMO9QWvKwXKZZwHXWy4qYSXSahS9IVp583YJtZ8uIdqajVYfwqf5WT0AAeTFe+yWxIK+J568JpfGoHzXuqkxo1x+OHNVTSLXug1bmvHkF+9Y+YMuK3O1FaOwutKDALWEy6QTIsBfGgHZxEPLNIVKihVkE4qC+6FhB3+Wi0DDAw5neNUCkLBKpBqfgJw8cbmWxBv+kmM8m7KMzNJmOtXZx09H4XnHV3xDjXpDhpG+LtIzO4AIYxfUTYg0SeVUkq56bE752d72mrR1V1WTN+9tu8UQWeqv7SeQylDkdILISoaXtc9oNG4qflDE1yxD+lT0rqSqAmFFU6/vi15HphqXJbdyrZnSrtvWHUp+EV5naDDOZkK81BR//c4JqE9346ImF+CA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(39840400004)(136003)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(38350700005)(52116002)(6506007)(6512007)(36756003)(6486002)(41300700001)(8976002)(8936002)(4744005)(6666004)(107886003)(5660300002)(86362001)(1076003)(8676002)(4326008)(38100700002)(26005)(2906002)(44832011)(83380400001)(66476007)(66556008)(54906003)(66946007)(478600001)(6916009)(316002)(2616005)(41533002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MP4LEZK1sZAU6w3Uk7eMe0G5f+w9Px38GLfgeHlfL3Q5cG+A435qDlI48e9SsJFPN6tQ0BKUZi2y3AxT5Mihz8Ol77sLML0xlRbNCpsVBfwGlmAj42QyJPvApF3oXgYIy4EaMdxpTPNr9wNY5SyGhoEdnXVioYs5YEtuwZK9DgFr3LjM9h+NRUiQeEIjb+4J/KXf9vDScol5mkHArNkyA0KaEgRW8fByz0qRdhvVQqkMV0GaO4ox5uQy09ablfAOCQykLm0buZcdH2Leyy98MYPqoiV0u7aeSXk1egSgVfzVoyBBpTKEo8y5jl6JBnT4v5Jos6RFvQF9s1XgHX8mTu7WE9KDBsOWPekv4iRO1KEvdHlPxLuhVFKmeEvFTGm0ntfswuQz0U3LKajiCGg/uoZevuJ5mBaiRf+1n3Qh0hG2dvoYIEBXzNl5TuqdfifJGn3HVOI4ZbMDt6MofJF86Rprq7ZYDejmA6XJZV5BNqOjkoKxlw3NP1UwZkGnbGbK+E7pYU2ea1z+1Y32oxNcJ9LLaFQFXfqgIJlk+WtlgPtlIhcrEFbIiZGpDgEv3xxXNCJaOdzE+adblWCJUnixkvWxiJsVAV/X+XxO5JqOHMotC4jUanVo6Cbe1oAdBkTtJbLKeZsIiE7XwXQirqjyJjfH4oiyNfKmYWUVGBiQK6byn03MSq6eSZH4HTonxr4tF8O2ekHbnzky4uL/oWO1US+DEBXyWf9eRAIv3KJn6qJPMQ78Er1b8HgLWebVU5ZtlPEtgmAdAkIF2Mb0/04NJKxeeLEmFxNhxNadJWiU09uUyI2bBmnmWjygc+slzW5oLlIhm3Ax6xayKH0JbNZdIkNKiyBHKRl8yzWO5L13i2MbFeX6ZhgmTAVVOX4dCUuh4/YozEbWzPRRMCNa75M4/ox67npZMoaSgoa4oJ1C6n0kKaKHiWGNwQ80pzZlq+fy0z6qoq0CgSWcMkgE5uxjNys7qLoQvHGef3C8NMKOL86m6jt5bBPo1POu/Y6ABned8dyh3H1V7bfHyomR6ihBeS0FZ68NYii63SUfagLvyqiAfmpz/BcMTAqGb5+kIiYHZQyTvXHKwdd/IOlVo9xOrEhdUd8i1hN0JWjIl3ys0qi1UNf+H7VfZ+HtebueotrV8TXoZhd3iBsS1NTH6D5aNIdEGd8sl8LUYxQqxuCun9PEM/w0lQm4/+bxZJnvJOZMMVMaqECOEVQFZYJpcbSfnbBJ87WygZ3aNmqn3URblVZBJ31zpyD74MPVug9w/W+AEe7ZV5ACiLufXnBeLTT6qYgKM1QRnkeh+b4MMvub3/vm35f608vsx2K5hhzMlDG8kKeAHn4/LweJl4F8y/VXU4jo9RC1nEykm0VCXhjT6fBD+Or4yGw1JI008ka/LthEBRGkp/x8eOMIvscg08luPejM7si+F7Mgdic3YxOH2vMvf9B+B+zc1kWxhBRhpjsb6HikilWi9SjpmlmZtDETRh7lzhMY5cVsAMOest3EFZpmjPlMJFxnVyld34XMW/pzHaCG6MjPe8m+cVxN/Y06BlG/bMaoOJq8jL4S667e8y2dT4m15czXAQ33IStbHukTzEln6Owf8w9B/F3kJzO/aQ== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: be91a5ed-7f4a-475d-d081-08dbe761b4ff X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 11:38:24.5249 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Oc/v06O0E9TFX+FrPGv2Flao1IMX+szQ1gMY10SjbpY2lxgCHP4SJbOEmN+8CmlYHI6GjV+HVjzgwLRs+f8Tz1qRvd1+ZRYN2+iwFJWUVbs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3664 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Use the helper led_bind_generic() to reduce code duplication. Signed-off-by: Rasmus Villemoes Reviewed-by: Christian Gmeiner --- drivers/led/led_gpio.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c index fbed151b5d9..71421de628c 100644 --- a/drivers/led/led_gpio.c +++ b/drivers/led/led_gpio.c @@ -11,7 +11,6 @@ #include #include #include -#include struct led_gpio_priv { struct gpio_desc gpio; @@ -80,19 +79,7 @@ static int led_gpio_remove(struct udevice *dev) static int led_gpio_bind(struct udevice *parent) { - struct udevice *dev; - ofnode node; - int ret; - - dev_for_each_subnode(node, parent) { - ret = device_bind_driver_to_node(parent, "gpio_led", - ofnode_get_name(node), - node, &dev); - if (ret) - return ret; - } - - return 0; + return led_bind_generic(parent, "gpio_led"); } static const struct led_ops gpio_led_ops = { From patchwork Fri Nov 17 11:38:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1865066 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=W1tIE96X; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SWw226Rm7z1yRM for ; Fri, 17 Nov 2023 22:40:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7B7C2874D0; Fri, 17 Nov 2023 12:38:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="W1tIE96X"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71F81874E4; Fri, 17 Nov 2023 12:38:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20724.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::724]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A6904874BD for ; Fri, 17 Nov 2023 12:38:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MaR/a/+paojf7oT9lhytzQz5HTc2xhaLKQuggjrx+KyndMXuz+KD8CSGdxdOS+wZE+TDxVyl+PHbBXLVjDqu+EA3SmZKpkkOPI4LfE1tEf5QlvNoON3QpQQq9ABtXsJtNgwkvrr7CmZ7NSfLyRpD9eemEmY5Vz4Jjd66QmF3xoIFjwK94zcKq5IFp4rcZQUL2kMSJLcsvOPFZYVu8JU4Pnef2pJ0snYyuR35dWWKauRtFNJO59+Rf0oZ9TfoTT4Gw0FnjwgEEccjFtQg3voCO4Bb73/eKFsqJ5VlXM0SzQsZx8LRz7ysW6Kd2Mu137jllCW358lUK2MJ2tqOBp32Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZCveA8WW3uyjgCw7sF9lnTfdzi/bZH50W1r1BQrFivw=; b=E4+0oIMy9tnhlLIMnI/00z313G6qNtWTINKMvhAgGdbEmDhxIb2/G4Gmiw0fAK6zw8BKnDB7cTMdstSOzZNkj/QQHhARDjod+mzW9SC3M36R/I1MOsduB1PHWrBxkJJQ2kUg926ueL23UI4qa1ZUdX//pt0lDM1eBU0Gyqsp2nTDMaYSfkihtl4AFGWlYqy/3U+YQMp8kh/APhZUNbuKbYjpms/AXCDsl26aOzdN/yEz68R3uADtt9mwP5kQAc8ctkHyRsclYnu6Fkjow5kVjf7wI4rpPsF6cUwNldSfnLvwzbYUlRRGTrMUuOMKWGal1NQ1mRAwOUyns0w2hUcPTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZCveA8WW3uyjgCw7sF9lnTfdzi/bZH50W1r1BQrFivw=; b=W1tIE96XvxDx/DMBGOszhXL8Kvy+HmWS676BUvdJrry95U9jHP5bk1TC/Gtv7SN8ToaWyS2OOHese+8FfBciVBq0S4Uq3COTHhslpScv00x7OTKsNIDdHx8V91ZMVHS3xdAzjoP4vNHAcGtwB+PIzG3ZKNIsoc3OcssiFSLCkoo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by VI1PR10MB3664.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:13f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 11:38:25 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15%5]) with mapi id 15.20.7002.021; Fri, 17 Nov 2023 11:38:25 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Marek Vasut , Philippe Reynes , Doug Zobel , Tom Rini , Christian Gmeiner , Rasmus Villemoes Subject: [PATCH v2 5/6] led: led_pwm: use led_bind_generic() helper Date: Fri, 17 Nov 2023 12:38:10 +0100 Message-Id: <20231117113811.149329-6-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.40.1.1.g1c60b9335d In-Reply-To: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> References: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: GVX0EPF0000FA93.SWEP280.PROD.OUTLOOK.COM (2603:10a6:144:1:0:4:0:16) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|VI1PR10MB3664:EE_ X-MS-Office365-Filtering-Correlation-Id: e90b910d-470b-4fea-b8b8-08dbe761b5e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wnukOH96M8ukJ/XEAWnjWjT0wpNFqbb94AbRNQayrSvTA4ChQI54OhYGGIPNoNaymUh7wCMBpAJuLQdYBVQcb24593X+TUfewymMKNAzS5eJVDj/0O9KdkYbItQcnSH8+Ybty8p5HM7unlOxN8TlFw3r1m7RebiW22wBnaV1gte+z6pOl7RY6AaEB3MnSNtHGcuOSqgDJBZb4d+pPMRHdSMZ0jmRWeDkrsy0CtxaeLiPw8Un6Lha8A8lvL20rf8qrvAIp/NX8cZibSRQawuIigO2EHL9qo7HCYUQKIPyOv0Ebx0Ppj0/VWLYXIJfIEadXQ4nSsotqBxS9zAOxxN2sulFtg7PYM9n/4VXcpmcYnAEXqGctPCWcAVs6tGqS6Na9cFULjFiDM21BDhAli7dII17uSw8uPDayav4AUs/8x1aTY/TfXaIbFoWEUe0Nqh3RhP8RdxAPkxlIfTI0pmCm9UlWSZh0J6mJWJaXs75J2bi2T6LTM+V5OwWKaSyhoKrV+Ikuk0eEN3wZbSja+7bfU9jPfwBPPuZ11P2WAwYu8f8QGo9gzGXW2bSMuPZkKfgg0nJULEhvuO0UPit6ZR+DDZ1c7XUtfAna30btKKxrZVouNbwGg7lUU5ZIP8qKRSdSH6Jbo3a5YrsLOLJwlwwuA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(39840400004)(136003)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(38350700005)(52116002)(6506007)(6512007)(36756003)(6486002)(41300700001)(8976002)(8936002)(6666004)(107886003)(5660300002)(86362001)(1076003)(8676002)(4326008)(38100700002)(26005)(2906002)(44832011)(83380400001)(66476007)(66556008)(54906003)(66946007)(478600001)(6916009)(316002)(2616005)(41533002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: neKuUDNowWTmEDiw7peYhGOZHyCoO4kj2wJMjXKpxFaDiRTQiJIBMF/FZKyFV8Vf+ApfiLsc9jTEoGMS9wUbOBtor8PhMYB2T19Sd5iMgiYLQ//K3DxSEUQk8cPmTII8toDPAt6ddfL65uVX6jMv/f0NY9CPq23EHBH1ZWTyj4lEnwfBtUGJErM63NrwawZGrrbzsbVo3f1yFVWJ8KK6dsAJEDOhnYuzjXmPWzS1sWFGJJd17nvpaGGQpzBC5Ggk9yjcaNw0LB6Lubo5/YZh7+56izSjAfjiUEV3Gat9SOrlb0vkrC9ufnwwqgGih7LsW8UrdKD4f6z6At18AhJfKZYKH9vM/YmMYQ4+sPN/TvgaXTaWZQR9ALgmmSOkdlH2BrtETjmGzd6MDOK1gWJ0lPoRG2rlbwbfxTfwtdBwGWFVHIaYG6P0xdvTzreoN3UzS38f6m9NqK74v3V5XM3rnS0ZzPjDyghn5/XilfxFKZ2rDDZvyuHX8CtoaqlApACEMVK4se0UYf7+AmbOqyy8wdj+NWwQ+Du6usDNrwNAik1M3gLW/TGuGPYRzibeTdgcFkpF9M1h8j6MdwCl+ZiDoTzqD7MjyEkU+xZKKYOs8QT6UkPeJN6d/3F4bZMCWf7fl0geZrSHPWdj5DaYuHeKo6ym3wYZF+N7FTVvqwRMaE0JX06PpKV4Ne22nWoNAoxQ4GjB8XO8hnJ9zFGjtnjW3PjHyaHV6W++g8e4/zKBulOGIgyF1KscUqfVH7XBnsyq7baYPWruxydNw+YmSJfrJS8qiqy74+xpv+anXbJEvf9qHeaQ7s9XZIKci22A+A7krBGEt9zWNEfkWwLMB3x2+5VtZILTrsj5qK0RXSHNjdFJbp0+cruHHxZYNdUyEezJwRL1HfjAJzTk7VTNk3+n+2YsU3k8+g6cpf4AoZ+3YHL19++8ehXwQAglAIOrtRVompAsHUDUR4dt/CK72kNVT1rGglk/dmtQWWN4Pn+3IkrAFs5c4/20Hyv+PMn7+4EsUD1U3YXf1SKnv8w7vLrmjsP0/tichumNOl05YRikvMElWgEKcPHIFXbbGEwb0MPxu7j4e/BnejxHVu3eqNzAOwOQcb+oynZGYwmlmwZvODHpdps21/nE5ZW0ZsCwwRp1FIxL0x7+XueVUJhZYuTMXuCBNkfpV3FM1MlLASuIE+MoE44ShjlbohKXWZ2VJBPUm1nwzSNym+81urbCKh8c80Qv89ahM0gW0Rt9TjthfoXj6IPT6hhPLkrkzxukzB3llJ0BV4bo3ROltimVYoYygnEEeUTfOmL0WbSRGTqFR66Lsn+YovXU1CE3msHhkHneWQ+LRNIkBdIiWPF54AKDNNsUURpoYNJi6ETELz/gt6ytHx5HCwisW4fdMr6kP9TdBlGZvWpVwy+92crqNHafJAsklzx4msIxBbyFdPSGzvPCszSnj1VECfwfmJrbp44GZreO+1wujfio4y1NJxWL1vnupH7ApCrBmznYsFQnweVzc+lc5p9/IoQqNIli2OCpp5UHdB9lATGhSDyo0APoYa6OaZeBoHIf5YKw3zq5+Fr/bbDRqPf75+Z5uTT5sZdVq1eSQagCdqJKtyoSPr8V+w== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: e90b910d-470b-4fea-b8b8-08dbe761b5e4 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 11:38:25.4088 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OHBhcu2R8hmNbepTU2nf25oa+LFpJwGtVbNNTRpDYghQ2Z43O+goNI3VLoUo6SiLUwptvm9217iuoVJfjbaTmbCl4kyT82/ltDq/ahDO3Kc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3664 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Use the helper led_bind_generic() to reduce code duplication. Signed-off-by: Rasmus Villemoes Reviewed-by: Christian Gmeiner --- drivers/led/led_pwm.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/led/led_pwm.c b/drivers/led/led_pwm.c index 7c8eae9337b..ae6de3087ab 100644 --- a/drivers/led/led_pwm.c +++ b/drivers/led/led_pwm.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #define LEDS_PWM_DRIVER_NAME "led_pwm" @@ -136,18 +135,7 @@ static int led_pwm_of_to_plat(struct udevice *dev) static int led_pwm_bind(struct udevice *parent) { - struct udevice *dev; - ofnode node; - int ret; - - dev_for_each_subnode(node, parent) { - ret = device_bind_driver_to_node(parent, LEDS_PWM_DRIVER_NAME, - ofnode_get_name(node), - node, &dev); - if (ret) - return ret; - } - return 0; + return led_bind_generic(parent, LEDS_PWM_DRIVER_NAME); } static const struct led_ops led_pwm_ops = { From patchwork Fri Nov 17 11:38:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1865065 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=dCxvbKn3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SWw1j0y2Dz1yRM for ; Fri, 17 Nov 2023 22:40:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0C0CA874C7; Fri, 17 Nov 2023 12:38:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="dCxvbKn3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 008F5874B9; Fri, 17 Nov 2023 12:38:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20730.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::730]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 43A5C874D0 for ; Fri, 17 Nov 2023 12:38:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JYNi5+jZh1qP4INjIQ7gvmOonf4+mBGs7mdUACU5m9XzUr1dO80D32qA3+Yr0nM5fto23qdw+euo6047pm3zpvjRJLVDxp62QAPQyLE9j3WJ+j+vFublIV3hKPMsKFoVNopfKJAAGgc1SMUvcSdvb1PQi2+qiOcYfElFGQbVGAsYYg5WH7QzlEv74aRcbpFTIf6U40wzmOdJaAAR4I3dIZrgk8EVUF/6tywEyKmxvsdhjdgx7hklqlxpXOB78MNmI6uD89NrFp6kZyZJz1vgAPYw6rffy0kMRXXRQHk3e7Kx9CHaE3aYL0o4tqoTHGpeWb7Fxml6TZqgOPs4U8HgWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I93wzwOR5d8Kzqb6/Buys24gYq8bsp36hBfCDZtdbtU=; b=lcf2ImQF88G2SFtrXzJxbL006Vc+RkmKteB9TxB90ZfCn9MX7SFsPp54Y61BBiOy1XYcDfDD6Gpk2guEsFQLu7v3pCrDJaOg2+3rU7J4Usqbm6uGJ2XrukJ8+uvaQw8Y7Kbv3paIa+Zyimyz8DfPV4z+Kjol2pQMstDzboZ9SA1NLVEXw9n4sWa7BDcrkmGgwAFJQn14rXpz/aG2YjzSCnRWJGXqDkaCr1otk63jKTyFYyjdM06m4FqCGL7k5MH4x1M8kGwJnBILX3iF2hwmYvfrgkU44C/Se4S/SoHGSYrwIEt/VON1dF+P7HIMU85D+IQ7fUNqfTrZlkhcc71EIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I93wzwOR5d8Kzqb6/Buys24gYq8bsp36hBfCDZtdbtU=; b=dCxvbKn30fawQ7/qlkX3Bu11N5jhZym5qsmTw7KOSNx3coTlsyo7tbJz5l1FpQi6SUTd2trE/LkiyO6/zF7OQP3FTZrxKfcCfKz8Jd8nE7eRqfFVeup6jR9Et22afBhUpI+L4JGfowtIedJhuejB8jOOq4Ex7LaeNROwhHyZxDg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by VI1PR10MB3664.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:13f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23; Fri, 17 Nov 2023 11:38:26 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8bd9:31bc:d048:af15%5]) with mapi id 15.20.7002.021; Fri, 17 Nov 2023 11:38:26 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Marek Vasut , Philippe Reynes , Doug Zobel , Tom Rini , Christian Gmeiner , Rasmus Villemoes Subject: [PATCH v2 6/6] led: add TI LP5562 LED driver Date: Fri, 17 Nov 2023 12:38:11 +0100 Message-Id: <20231117113811.149329-7-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.40.1.1.g1c60b9335d In-Reply-To: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> References: <20231117113811.149329-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: GVX0EPF0000FA93.SWEP280.PROD.OUTLOOK.COM (2603:10a6:144:1:0:4:0:16) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|VI1PR10MB3664:EE_ X-MS-Office365-Filtering-Correlation-Id: d7942390-0ee8-4aaf-b68e-08dbe761b660 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ekXS7iYIwpcuKhOnKvVXE+UpRTdxhG6l2E2z6RVABftZfYJVNrrsS1ujeEPVCF7jG79TVXkNclWm2SU5KWWfLOH0z2QUZ2XSsau0rNBTS+7dI2seVlcx8FLOhciwqdNGbz7nLqFEXOKHu4Gkbg6Ssx6HXH3xX2XPFVCrqs3l2A32iPLFxK+1CamacncEJzm65WNqpijTu41WReFnwFO7neSMXe+192cZR9bdS1+UpRiYwBrSrDQaDj/vZwiYw83mbwX39qF38yNJMbajqpAHA9U9yqB5AInBxIg2XMfjxpaw1atv1ZR+944hI6fBeVzkI6E35PYmfatTPR0g8DPuwzvVhC3s3L9S6bXfAmqdUh8YXa9RqUjOLLLlBgKXODe10iT9zN0Zum+qrFIR+eVNRsL1d05d3KdrTC/1FWoSeiTsV4uyg81Jhnj9VCrBdxTM6Cz/OZBohcUrZVGQE8owMKEmoeGVghdKbpnGq+yDvtMUxljwm4sPp6TA7XiOuROaUvT3zSkeoIrmyNv7BVEetWh/89FhnYjKlUgkbsXcMFsakbrRSoli5aSP5jVtQi4TMnco8Y1bDj3BbcMZP0eCPi9zB0mw2A3k0OLent0wuGVCMi3AUO4x3dZDGzq5W2/MnAw12P9REV1NzvEXmCfwgg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(39840400004)(136003)(346002)(230922051799003)(230273577357003)(230173577357003)(451199024)(186009)(64100799003)(1800799009)(38350700005)(52116002)(6506007)(6512007)(36756003)(966005)(6486002)(41300700001)(8976002)(8936002)(30864003)(6666004)(107886003)(5660300002)(86362001)(1076003)(8676002)(4326008)(38100700002)(26005)(2906002)(44832011)(83380400001)(66476007)(66556008)(54906003)(66946007)(478600001)(6916009)(316002)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nrNUcJ4806TPylOHSuJCTJpoKLYu?= =?utf-8?q?GfzbUef8YqcNlXbnGPSfhUXhg44Lg0QCMF/4cu7OPzdCaq0xLijEo2lqDxC5CzWwL?= =?utf-8?q?MCijEPcNLwJTaQRaTbC9TE8+YUlPWvTIfFF5C6AsvgnaaoIuOHiZQJByxNjJrDa0x?= =?utf-8?q?xhSPvgzsO4Q3pF34ag8rKqS9JaOhhK+ZfpkZpuyqEn2bxWAalT2uTdVdNvpuZWvel?= =?utf-8?q?667LLSu9Tfpua5SnkFEMOe4htU569IhuFpBel9Tj55HnZKFrn19BdU7k5ZE3l3nKe?= =?utf-8?q?uUdARPP9AOCBE5ZPcf2edIht4jwhMUm60LAzE3v8CpeWkEABka7IHbAxxKpZ7Q5d0?= =?utf-8?q?IljEoeBWPMal+rciNxJNLKHvEV0o/1VVXhd1vvyTK6O9G9cNg/5y1+K6PNqhg8U7z?= =?utf-8?q?kTb0dYdGIN74P9UrxyHOtMzllkRvUoKKPMirVL7mrQ/CMLOHL3F6u/NvzaZHG4HMy?= =?utf-8?q?00esnPA1uckA878krknkkL9Mh/zLf5aouIzhllL60UzFWxxYQ3ZFdqMcYhNthaGBK?= =?utf-8?q?eS4c9heS27ne4sVfgwkx7w7Jvwi9VOOh4K0DgqXeuLv12uEyDsuuXSwVEdrHcspU9?= =?utf-8?q?Jp7D0OSac4CdDv5WTJ+dyMVfo/5hB/ecb+OjFinoxFKwA/DP9PKOgAgki1VgITJYB?= =?utf-8?q?3ANV+eQEccah5upw1K9wQ3SeVZdGBYrwIlrbejJcvw392RIMPapz6faxFDtXYKi+F?= =?utf-8?q?NFzPTNL6uBuEaTz+d3ncDg8O3tPA77WD1g+ryCKv8DEMTPcgeDHDq6bPQ3F8PzQcw?= =?utf-8?q?u+ES/9S5h5dhuDqwdEF24Ia2YKi3EDfFzHp0W6QpflZRsCDyKiyypzDhwsLvyqG13?= =?utf-8?q?RIxB130/Aohxky5CXm/IFTksN9H+ZvPUD9gUosQM0Ood0RO/6weR9+TBJE14GVgAi?= =?utf-8?q?gljZlpX87/Iv02txIuA5FS9e7ru271EwXukWh4KByq/zngCvXThsxwbxZpt35oP6p?= =?utf-8?q?LQ85vEfLhl2VuNZW9fAHAK+sB+gMTbCGL38aSQCvjgrWWVZy1SZ4ZPUpVTztot3mc?= =?utf-8?q?N90b+Duzu00F0wnvtbHT6TKlfyVaiekI9m+2goKjPx3k151ADfKTM9+GOOl6HdzCt?= =?utf-8?q?tXJ4GzwT616z/oEifdHJbeCYSw3XQzWiPLr7ZyaMSdLZn2qAvZ8+3dNAyzUo3aFHo?= =?utf-8?q?r7K7V85TzVeWsZ0Tamm7nnHgOn8ihYAYjusPqlPV0SdJeadHmrAFzz3PPdsC2xlfi?= =?utf-8?q?lyEKLV23OShupUyOWInvWk3m3lFLxJ840KoDVPInwrCWXxLnXBeUzkQ0QfK907OId?= =?utf-8?q?uKHoQiltIIy16537oCKxQaDFmpE8VuoiUViG1BTqW7ErC2TxkuMpUMp6QW3UpfxS/?= =?utf-8?q?ePmBmg3CrUvkEidsjWfBl/2B7RXHeLptQN1PoJ/Gy7Bb1tfpdsdbUJotfW7+xRlt/?= =?utf-8?q?bYQWzmZMN7/2r8LJac5g4/WEe5IepO1i9N+ag/mmhSAh6DMeMwe6eSvgRiQhxWgMc?= =?utf-8?q?zHqULE4ldzACJUbeJuaJTLlJ0z+Ks8SbARI3CvSs/qnXV/kri2Ir5qm4RrUZDhNmh?= =?utf-8?q?XqGU7SnNzgVt8PDxt35uClvBQp0RRQREjw=3D=3D?= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: d7942390-0ee8-4aaf-b68e-08dbe761b660 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 11:38:26.1985 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EJBtRP/Wehedmca4Ysu9JTevHqfP7tBq6h+FhfMYf6hzGuzDEMZ7XxtzucPv462LQck2/UYEn1cB4h34wNIWRV+eiEXfRQ7ybra5Rf7nz1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3664 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Doug Zobel Driver for the TI LP5562 4 channel LED controller. Supports independent on/off control of all 4 channels. Supports LED_BLINK on 3 independent channels: blue/green/red. The white channel can blink, but shares the blue channel blink rate. Heavily based on patch originally from Doug Zobel [1]. I have modified it so it matches the DT bindings in the linux tree, and also follows the linux driver implementation more closely. This should address Tom's concerns, and also matches my goal of making the U-Boot driver work with our existing .dts which is known to work in linux. As our boards only have the R,G,B outputs connected, I have not actually tested how the white channel behaves, but the R,G,B work exactly as expected. [1] https://lore.kernel.org/u-boot/1547150757-1561-1-git-send-email-douglas.zobel@climate.com/ Cc: Doug Zobel Signed-off-by: Rasmus Villemoes --- doc/device-tree-bindings/leds/leds-lp5562.txt | 63 ++ drivers/led/Kconfig | 8 + drivers/led/Makefile | 1 + drivers/led/led_lp5562.c | 578 ++++++++++++++++++ 4 files changed, 650 insertions(+) create mode 100644 doc/device-tree-bindings/leds/leds-lp5562.txt create mode 100644 drivers/led/led_lp5562.c diff --git a/doc/device-tree-bindings/leds/leds-lp5562.txt b/doc/device-tree-bindings/leds/leds-lp5562.txt new file mode 100644 index 00000000000..4e0c742959a --- /dev/null +++ b/doc/device-tree-bindings/leds/leds-lp5562.txt @@ -0,0 +1,63 @@ +LEDs connected to TI LP5562 controller + +This driver works with a TI LP5562 4-channel LED controller. +CONFIG_LED_BLINK is supported using the controller engines. However +there are only 3 engines available for the 4 channels. This means +that the blue and white channels share the same engine. When both +blue and white LEDs are set to blink, they will share the same blink +rate. Changing the blink rate of the blue LED will affect the white +LED and vice-versa. Manual on/off is handled independently for all 4 +channels. + +Required properties: + - compatible : should be "ti,lp5562". + - #address-cells : must be 1. + - #size-cells : must be 0. + - reg : LP5562 LED controller I2C address. + +Optional properties: + - enable-gpios : Enable GPIO + - clock-mode : u8, configures the clock mode: + - 0 # automode + - 1 # internal + - 2 # external + +Each LED is represented as a sub-node of the ti,lp5562 device. + +LED sub-node required properties: + - reg : Zero-based channel identifier: + - 0 red + - 1 green + - 2 blue + - 3 white + +LED sub-node optional properties: + - chan-name : name of LED + - max-cur : LED current at max brightness in 100uA steps (0x00 - 0xFF) + Default : 100 (10 mA) + +Example: + leds0: lp5562@30 { + compatible = "ti,lp5562"; + #address-cells = <1>; + #size-cells = <0>; + enable-gpios = <&gpio3 9 GPIO_ACTIVE_HIGH>; + reg = <0x30>; + clock-mode = /bits/8 <1>; + + led@0 { + reg = <0>; + chan-name = "red"; + max-cur = /bits/ 8 <200>; /* 20mA */ + }; + led@1 { + reg = <1>; + chan-name = "green"; + max-cur = /bits/ 8 <200>; /* 20mA */ + }; + led@2 { + reg = <2>; + chan-name = "blue"; + max-cur = /bits/ 8 <200>; /* 20mA */ + }; + }; diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 996b757e6d0..9837960198d 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -49,6 +49,14 @@ config LED_CORTINA This option enables support for LEDs connected to the Cortina Access CAxxxx SOCs. +config LED_LP5562 + bool "LED Support for LP5562" + depends on LED && DM_I2C + help + This option enables support for LEDs connected to the TI LP5562 + 4 channel I2C LED controller. Driver fully supports blink on the + B/G/R LEDs. White LED can blink, but re-uses the period from blue. + config LED_PWM bool "LED PWM" depends on LED && DM_PWM diff --git a/drivers/led/Makefile b/drivers/led/Makefile index 49ae91961d5..2bcb8589087 100644 --- a/drivers/led/Makefile +++ b/drivers/led/Makefile @@ -11,3 +11,4 @@ obj-$(CONFIG_LED_BCM6858) += led_bcm6858.o obj-$(CONFIG_LED_PWM) += led_pwm.o obj-$(CONFIG_$(SPL_)LED_GPIO) += led_gpio.o obj-$(CONFIG_LED_CORTINA) += led_cortina.o +obj-$(CONFIG_LED_LP5562) += led_lp5562.o diff --git a/drivers/led/led_lp5562.c b/drivers/led/led_lp5562.c new file mode 100644 index 00000000000..87479ec5515 --- /dev/null +++ b/drivers/led/led_lp5562.c @@ -0,0 +1,578 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Doug Zobel + * + * Driver for TI lp5562 4 channel LED driver. There are only 3 + * engines available for the 4 LEDs, so white and blue LEDs share + * the same engine. This means that the blink period is shared + * between them. Changing the period of blue blink will affect + * the white period (and vice-versa). Blue and white On/Off + * states remain independent (as would PWM brightness if that's + * ever added to the LED core). + */ + +#include +#include +#include +#include +#include +#include +#include + +#define DEFAULT_CURRENT 100 /* 10 mA */ +#define MIN_BLINK_PERIOD 32 /* ms */ +#define MAX_BLINK_PERIOD 2248 /* ms */ + +/* Register Map */ +#define REG_ENABLE 0x00 +#define REG_OP_MODE 0x01 +#define REG_B_PWM 0x02 +#define REG_G_PWM 0x03 +#define REG_R_PWM 0x04 +#define REG_B_CUR 0x05 +#define REG_G_CUR 0x06 +#define REG_R_CUR 0x07 +#define REG_CONFIG 0x08 +#define REG_ENG1_PC 0x09 +#define REG_ENG2_PC 0x0A +#define REG_ENG3_PC 0x0B +#define REG_STATUS 0x0C +#define REG_RESET 0x0D +#define REG_W_PWM 0x0E +#define REG_W_CUR 0x0F +#define REG_ENG1_MEM_BEGIN 0x10 +#define REG_ENG2_MEM_BEGIN 0x30 +#define REG_ENG3_MEM_BEGIN 0x50 +#define REG_LED_MAP 0x70 + +/* LED Register Values */ +/* 0x00 ENABLE */ +#define REG_ENABLE_CHIP_ENABLE (0x1 << 6) +#define REG_ENABLE_ENG_EXEC_HOLD 0x0 +#define REG_ENABLE_ENG_EXEC_RUN 0x2 +#define REG_ENABLE_ENG_EXEC_MASK 0x3 + +/* 0x01 OP MODE */ +#define REG_OP_MODE_DISABLED 0x0 +#define REG_OP_MODE_LOAD_SRAM 0x1 +#define REG_OP_MODE_RUN 0x2 +#define REG_OP_MODE_MASK 0x3 + +/* 0x02, 0x03, 0x04, 0x0E PWM */ +#define REG_PWM_MIN_VALUE 0 +#define REG_PWM_MAX_VALUE 0xFF + +/* 0x08 CONFIG */ +#define REG_CONFIG_EXT_CLK 0x0 +#define REG_CONFIG_INT_CLK 0x1 +#define REG_CONFIG_AUTO_CLK 0x2 +#define REG_CONFIG_CLK_MASK 0x3 + +/* 0x0D RESET */ +#define REG_RESET_RESET 0xFF + +/* 0x70 LED MAP */ +#define REG_LED_MAP_ENG_MASK 0x03 +#define REG_LED_MAP_W_ENG_SHIFT 6 +#define REG_LED_MAP_R_ENG_SHIFT 4 +#define REG_LED_MAP_G_ENG_SHIFT 2 +#define REG_LED_MAP_B_ENG_SHIFT 0 + +/* Engine program related */ +#define REG_ENGINE_MEM_SIZE 0x20 +#define LED_PGRM_RAMP_INCREMENT_SHIFT 0 +#define LED_PGRM_RAMP_SIGN_SHIFT 7 +#define LED_PGRM_RAMP_STEP_SHIFT 8 +#define LED_PGRM_RAMP_PRESCALE_SHIFT 14 + +struct lp5562_led_wrap_priv { + struct gpio_desc enable_gpio; +}; + +struct lp5562_led_priv { + u8 reg_pwm; + u8 reg_current; + u8 map_shift; + u8 enginenum; +}; + +/* enum values map to LED_MAP (0x70) values */ +enum lp5562_led_ctl_mode { + I2C = 0x0, +#ifdef CONFIG_LED_BLINK + ENGINE1 = 0x1, + ENGINE2 = 0x2, + ENGINE3 = 0x3 +#endif +}; + +/* + * Update a register value + * dev - I2C udevice (parent of led) + * regnum - register number to update + * value - value to write to register + * mask - mask of bits that should be changed + */ +static int lp5562_led_reg_update(struct udevice *dev, int regnum, + u8 value, u8 mask) +{ + int ret; + + if (mask == 0xFF) + ret = dm_i2c_reg_write(dev, regnum, value); + else + ret = dm_i2c_reg_clrset(dev, regnum, mask, value); + + + /* + * Data sheet says "Delay between consecutive I2C writes to + * ENABLE register (00h) need to be longer than 488 μs + * (typical)." and "Delay between consecutive I2C writes to + * OP_MODE register need to be longer than 153 μs (typ)." + * + * The linux driver does usleep_range(500, 600) and + * usleep_range(200, 300), respectively. + */ + switch (regnum) { + case REG_ENABLE: + udelay(600); + break; + case REG_OP_MODE: + udelay(300); + break; + } + + return ret; +} + +#ifdef CONFIG_LED_BLINK +/* + * Program the lp5562 engine + * dev - I2C udevice (parent of led) + * program - array of commands + * size - number of commands in program array (1-16) + * engine - engine number (1-3) + */ +static int lp5562_led_program_engine(struct udevice *dev, u16 *program, + u8 size, u8 engine) +{ + int ret, cmd; + u8 engine_reg = REG_ENG1_MEM_BEGIN + + ((engine - 1) * REG_ENGINE_MEM_SIZE); + u8 shift = (3 - engine) * 2; + __be16 prog_be[16]; + + if (size < 1 || size > 16 || engine < 1 || engine > 3) + return -EINVAL; + + for (cmd = 0; cmd < size; cmd++) + prog_be[cmd] = cpu_to_be16(program[cmd]); + + /* set engine mode to 'disabled' */ + ret = lp5562_led_reg_update(dev, REG_OP_MODE, + REG_OP_MODE_DISABLED << shift, + REG_OP_MODE_MASK << shift); + if (ret != 0) + goto done; + + /* set exec mode to 'hold' */ + ret = lp5562_led_reg_update(dev, REG_ENABLE, + REG_ENABLE_ENG_EXEC_HOLD << shift, + REG_ENABLE_ENG_EXEC_MASK << shift); + if (ret != 0) + goto done; + + /* set engine mode to 'load SRAM' */ + ret = lp5562_led_reg_update(dev, REG_OP_MODE, + REG_OP_MODE_LOAD_SRAM << shift, + REG_OP_MODE_MASK << shift); + if (ret != 0) + goto done; + + /* send the re-ordered program sequence */ + ret = dm_i2c_write(dev, engine_reg, (uchar *)prog_be, sizeof(u16) * size); + if (ret != 0) + goto done; + + /* set engine mode to 'run' */ + ret = lp5562_led_reg_update(dev, REG_OP_MODE, + REG_OP_MODE_RUN << shift, + REG_OP_MODE_MASK << shift); + if (ret != 0) + goto done; + + /* set engine exec to 'run' */ + ret = lp5562_led_reg_update(dev, REG_ENABLE, + REG_ENABLE_ENG_EXEC_RUN << shift, + REG_ENABLE_ENG_EXEC_MASK << shift); + +done: + return ret; +} + +/* + * Get the LED's current control mode (I2C or ENGINE[1-3]) + * dev - led udevice (child udevice) + */ +static enum lp5562_led_ctl_mode lp5562_led_get_control_mode(struct udevice *dev) +{ + struct lp5562_led_priv *priv = dev_get_priv(dev); + u8 data; + enum lp5562_led_ctl_mode mode = I2C; + + if (dm_i2c_read(dev_get_parent(dev), REG_LED_MAP, &data, 1) == 0) + mode = (data & (REG_LED_MAP_ENG_MASK << priv->map_shift)) + >> priv->map_shift; + + return mode; +} +#endif + +/* + * Set the LED's control mode to I2C or ENGINE[1-3] + * dev - led udevice (child udevice) + * mode - mode to change to + */ +static int lp5562_led_set_control_mode(struct udevice *dev, + enum lp5562_led_ctl_mode mode) +{ + struct lp5562_led_priv *priv = dev_get_priv(dev); + + return (lp5562_led_reg_update(dev_get_parent(dev), REG_LED_MAP, + mode << priv->map_shift, + REG_LED_MAP_ENG_MASK << priv->map_shift)); +} + +/* + * Return the LED's PWM value; If LED is in BLINK state, then it is + * under engine control mode which doesn't use this PWM value. + * dev - led udevice (child udevice) + */ +static int lp5562_led_get_pwm(struct udevice *dev) +{ + struct lp5562_led_priv *priv = dev_get_priv(dev); + u8 data; + + if (dm_i2c_read(dev_get_parent(dev), priv->reg_pwm, &data, 1) != 0) + return -EINVAL; + + return data; +} + +/* + * Set the LED's PWM value and configure it to use this (I2C mode). + * dev - led udevice (child udevice) + * value - PWM value (0 - 255) + */ +static int lp5562_led_set_pwm(struct udevice *dev, u8 value) +{ + struct lp5562_led_priv *priv = dev_get_priv(dev); + + if (lp5562_led_reg_update(dev_get_parent(dev), priv->reg_pwm, + value, 0xff) != 0) + return -EINVAL; + + /* set LED to I2C register mode */ + return lp5562_led_set_control_mode(dev, I2C); +} + +/* + * Return the led's current state + * dev - led udevice (child udevice) + * + */ +static enum led_state_t lp5562_led_get_state(struct udevice *dev) +{ + enum led_state_t state = LEDST_ON; + + if (lp5562_led_get_pwm(dev) == REG_PWM_MIN_VALUE) + state = LEDST_OFF; + +#ifdef CONFIG_LED_BLINK + if (lp5562_led_get_control_mode(dev) != I2C) + state = LEDST_BLINK; +#endif + + return state; +} + +/* + * Set the led state + * dev - led udevice (child udevice) + * state - State to set the LED to + */ +static int lp5562_led_set_state(struct udevice *dev, enum led_state_t state) +{ +#ifdef CONFIG_LED_BLINK + struct lp5562_led_priv *priv = dev_get_priv(dev); +#endif + + switch (state) { + case LEDST_OFF: + return lp5562_led_set_pwm(dev, REG_PWM_MIN_VALUE); + case LEDST_ON: + return lp5562_led_set_pwm(dev, REG_PWM_MAX_VALUE); +#ifdef CONFIG_LED_BLINK + case LEDST_BLINK: + return lp5562_led_set_control_mode(dev, priv->enginenum); +#endif + case LEDST_TOGGLE: + if (lp5562_led_get_state(dev) == LEDST_OFF) + return lp5562_led_set_state(dev, LEDST_ON); + else + return lp5562_led_set_state(dev, LEDST_OFF); + break; + default: + return -EINVAL; + } + + return 0; +} + +#ifdef CONFIG_LED_BLINK +/* + * Set the blink period of an LED; note blue and white share the same + * engine so changing the period of one affects the other. + * dev - led udevice (child udevice) + * period_ms - blink period in ms + */ +static int lp5562_led_set_period(struct udevice *dev, int period_ms) +{ + struct lp5562_led_priv *priv = dev_get_priv(dev); + u8 opcode = 0; + u16 program[7]; + u16 wait_time; + + /* Blink is implemented as an engine program. Simple on/off + * for short periods, or fade in/fade out for longer periods: + * + * if (period_ms < 500): + * set PWM to 100% + * pause for period / 2 + * set PWM to 0% + * pause for period / 2 + * goto start + * + * else + * raise PWM 0% -> 50% in 62.7 ms + * raise PWM 50% -> 100% in 62.7 ms + * pause for (period - 4 * 62.7) / 2 + * lower PWM 100% -> 50% in 62.7 ms + * lower PWM 50% -> 0% in 62.7 ms + * pause for (period - 4 * 62.7) / 2 + * goto start + */ + + if (period_ms < MIN_BLINK_PERIOD) + period_ms = MIN_BLINK_PERIOD; + else if (period_ms > MAX_BLINK_PERIOD) + period_ms = MAX_BLINK_PERIOD; + + if (period_ms < 500) { + /* Simple on/off blink */ + wait_time = period_ms / 2; + + /* 1st command is full brightness */ + program[opcode++] = + (1 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + REG_PWM_MAX_VALUE; + + /* 2nd command is wait (period / 2) using 15.6ms steps */ + program[opcode++] = + (1 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + (((wait_time * 10) / 156) << LED_PGRM_RAMP_STEP_SHIFT) | + (0 << LED_PGRM_RAMP_INCREMENT_SHIFT); + + /* 3rd command is 0% brightness */ + program[opcode++] = + (1 << LED_PGRM_RAMP_PRESCALE_SHIFT); + + /* 4th command is wait (period / 2) using 15.6ms steps */ + program[opcode++] = + (1 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + (((wait_time * 10) / 156) << LED_PGRM_RAMP_STEP_SHIFT) | + (0 << LED_PGRM_RAMP_INCREMENT_SHIFT); + + /* 5th command: repeat */ + program[opcode++] = 0x00; + } else { + /* fade-in / fade-out blink */ + wait_time = ((period_ms - 251) / 2); + + /* ramp up time is 256 * 0.49ms (125.4ms) done in 2 steps */ + /* 1st command is ramp up 1/2 way */ + program[opcode++] = + (0 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + (1 << LED_PGRM_RAMP_STEP_SHIFT) | + (127 << LED_PGRM_RAMP_INCREMENT_SHIFT); + + /* 2nd command is ramp up rest of the way */ + program[opcode++] = + (0 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + (1 << LED_PGRM_RAMP_STEP_SHIFT) | + (127 << LED_PGRM_RAMP_INCREMENT_SHIFT); + + /* 3rd: wait ((period - 2 * ramp_time) / 2) (15.6ms steps) */ + program[opcode++] = + (1 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + (((wait_time * 10) / 156) << LED_PGRM_RAMP_STEP_SHIFT) | + (0 << LED_PGRM_RAMP_INCREMENT_SHIFT); + + /* ramp down is same as ramp up with sign bit set */ + /* 4th command is ramp down 1/2 way */ + program[opcode++] = + (0 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + (1 << LED_PGRM_RAMP_STEP_SHIFT) | + (1 << LED_PGRM_RAMP_SIGN_SHIFT) | + (127 << LED_PGRM_RAMP_INCREMENT_SHIFT); + + /* 5th command is ramp down rest of the way */ + program[opcode++] = + (0 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + (1 << LED_PGRM_RAMP_STEP_SHIFT) | + (1 << LED_PGRM_RAMP_SIGN_SHIFT) | + (127 << LED_PGRM_RAMP_INCREMENT_SHIFT); + + /* 6th: wait ((period - 2 * ramp_time) / 2) (15.6ms steps) */ + program[opcode++] = + (1 << LED_PGRM_RAMP_PRESCALE_SHIFT) | + (((wait_time * 10) / 156) << LED_PGRM_RAMP_STEP_SHIFT) | + (0 << LED_PGRM_RAMP_INCREMENT_SHIFT); + + /* 7th command: repeat */ + program[opcode++] = 0x00; + } + + return lp5562_led_program_engine(dev_get_parent(dev), program, + opcode, priv->enginenum); +} +#endif + +static const struct led_ops lp5562_led_ops = { + .get_state = lp5562_led_get_state, + .set_state = lp5562_led_set_state, +#ifdef CONFIG_LED_BLINK + .set_period = lp5562_led_set_period, +#endif +}; + +static int lp5562_led_probe(struct udevice *dev) +{ + struct lp5562_led_priv *priv = dev_get_priv(dev); + u8 current; + int ret = 0; + + /* Child LED nodes */ + switch (dev_read_addr(dev)) { + case 0: + priv->reg_current = REG_R_CUR; + priv->reg_pwm = REG_R_PWM; + priv->map_shift = REG_LED_MAP_R_ENG_SHIFT; + priv->enginenum = 1; + break; + case 1: + priv->reg_current = REG_G_CUR; + priv->reg_pwm = REG_G_PWM; + priv->map_shift = REG_LED_MAP_G_ENG_SHIFT; + priv->enginenum = 2; + break; + case 2: + priv->reg_current = REG_B_CUR; + priv->reg_pwm = REG_B_PWM; + priv->map_shift = REG_LED_MAP_B_ENG_SHIFT; + priv->enginenum = 3; /* shared with white */ + break; + case 3: + priv->reg_current = REG_W_CUR; + priv->map_shift = REG_LED_MAP_W_ENG_SHIFT; + priv->enginenum = 3; /* shared with blue */ + break; + default: + return -EINVAL; + } + + current = dev_read_u8_default(dev, "max-cur", DEFAULT_CURRENT); + + ret = lp5562_led_reg_update(dev_get_parent(dev), priv->reg_current, + current, 0xff); + + return ret; +} + +static int lp5562_led_bind(struct udevice *dev) +{ + struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); + + /* + * For the child nodes, parse a "chan-name" property, since + * the DT bindings for this device use that instead of + * "label". + */ + uc_plat->label = dev_read_string(dev, "chan-name"); + + return 0; +} + +U_BOOT_DRIVER(lp5562_led) = { + .name = "lp5562-led", + .id = UCLASS_LED, + .bind = lp5562_led_bind, + .probe = lp5562_led_probe, + .priv_auto = sizeof(struct lp5562_led_priv), + .ops = &lp5562_led_ops, +}; + + +static int lp5562_led_wrap_probe(struct udevice *dev) +{ + struct lp5562_led_wrap_priv *priv = dev_get_priv(dev); + u8 clock_mode; + int ret; + + /* Enable gpio if needed */ + if (gpio_request_by_name(dev, "enabled-gpios", 0, + &priv->enable_gpio, GPIOD_IS_OUT) == 0) { + dm_gpio_set_value(&priv->enable_gpio, 1); + udelay(1000); + } + + /* Ensure all registers have default values. */ + ret = lp5562_led_reg_update(dev, REG_RESET, REG_RESET_RESET, 0xff); + if (ret) + return ret; + udelay(10000); + + /* Enable the chip */ + ret = lp5562_led_reg_update(dev, REG_ENABLE, REG_ENABLE_CHIP_ENABLE, 0xff); + if (ret) + return ret; + + /* + * The DT bindings say 0=auto, 1=internal, 2=external, while + * the register[0:1] values are 0=external, 1=internal, + * 2=auto. + */ + clock_mode = dev_read_u8_default(dev, "clock-mode", 0); + ret = lp5562_led_reg_update(dev, REG_CONFIG, 2 - clock_mode, REG_CONFIG_CLK_MASK); + + return ret; +} + +static int lp5562_led_wrap_bind(struct udevice *dev) +{ + return led_bind_generic(dev, "lp5562-led"); +} + +static const struct udevice_id lp5562_led_ids[] = { + { .compatible = "ti,lp5562" }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(lp5562_led_wrap) = { + .name = "lp5562-led-wrap", + .id = UCLASS_NOP, + .of_match = lp5562_led_ids, + .bind = lp5562_led_wrap_bind, + .probe = lp5562_led_wrap_probe, + .priv_auto = sizeof(struct lp5562_led_wrap_priv), +};