Message ID | 20250522-led-fix-v2-1-652046323ec3@axis.com |
---|---|
State | Superseded |
Headers | show
Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11013057.outbound.protection.outlook.com [40.107.162.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C2961F09B3; Thu, 22 May 2025 14:14:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.162.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747923300; cv=fail; b=mzxOHZK9PjQxTXT++8yFW+lTHiJTQpItXVqDvA9tGT1s4l2B2V6sad72cMLUIHPTNpfIhv1ggAOG5V2EGboAMTWVLSYapDDLQzdIwGX2gjqaxLTdFPl03mYPcxwSpyzOEsug4wHoaHFO5OT2Buv/TNiq41H/h5tH9qFLJHR5WpY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747923300; c=relaxed/simple; bh=rpBEWzAMTtwOLzgJONSLm3+B6XKYf8u3EQiAzYtPVas=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tUTq1AVj+6kZSV1cAZlbUP5N61LZFakEsn5C8hzozTusUGhJStSbi41Og7aZc5WLfyr7Om6mWRcIrl7CrvaMPLP+mKbuNc5hgCiBysBEUNpq+BgUKCuP/2wZAw6otb4B8rCgBYSchZ1jrUpceQhhckjca3dCyqFcb4SruJcCt88= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=Y3+1IS0z; arc=fail smtp.client-ip=40.107.162.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="Y3+1IS0z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=I7kMl29MBXw6hUh7A42sVGgPdIVG3sFGZCtX6W3viF7ktLMpOFFHpsijUb+NBRsCVh9Lk87XKGhAQECK9wcCGm0mJUn/YwLybixXvPbRusQFNnXBpedQbzSGhiEo8XCIcU4wGJy2yLA7KKpRlOjUx+Rh2Fb06Nw2BowcgGjDET2k7do0HXdy9TzfBOSj3ZheuZgTG8eCTIp5Z736n/lUMlVOdmBzpurLbtE5H/ZEvQ+qaNuFxuJhRFFdXlZg8K3vMR4y2WaTtKCgDls9sfz+USrnwKmOn9/+lvLTyfCj4Xj8Ajjc7faNp7aSCX43+ki6sWqCx5oyefcE7LzATCNeyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=St2MUIDS4Ve8WSUS/6sGoU0M7rest9FRet7CC4wN/U8=; b=mcuNXPaBUumG1YplbwQIny/JUe0wRdCT0lalqv4qabJQgDFyLPOXc8d/hTH5kHt/uGFgIXj6mX5KBBVFraNS/cjTuFCBgLk27YdZezfMtaIROYA92vU3Pl2pLlmm2UjaoJrj48yaMLXBUItGUcfkroPebxyJmzgxnPZwkZGN9sLQhDz5qS1VzyXwNtJVGeuXonWXnHYzuFu4YUfaMGqigiNKtLI3vpu3ivUZxGGbRFsYQ6Q7wqekzlxxb07cn22Fjc+HrArwaGwklFRfifn530YkfUN7x4DypHETdYRo1frlMJpYUavVQ9YvS6f6XCwSa2lf7SDHTk9MZbJLBLoNrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=gmail.com smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=St2MUIDS4Ve8WSUS/6sGoU0M7rest9FRet7CC4wN/U8=; b=Y3+1IS0zPLGGTKb2gsGUDFwn1+9QqMM3q8v0skOivez4I/gP+IqriNgqJl+cpOyRyoSq5bRFkx5Dx3/FTc59FjDtIsSTcsy5bA5+dYLmnuk3prX/q6qhuPBFE3JoLhOwGEOj+eSBPl/is/UtcEMdJ5luXZgcLwkdJ9umkOnhMhA= Received: from DU2PR04CA0251.eurprd04.prod.outlook.com (2603:10a6:10:28e::16) by DBAPR02MB6214.eurprd02.prod.outlook.com (2603:10a6:10:193::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8769.21; Thu, 22 May 2025 14:14:55 +0000 Received: from DB1PEPF00050A01.eurprd03.prod.outlook.com (2603:10a6:10:28e:cafe::cd) by DU2PR04CA0251.outlook.office365.com (2603:10a6:10:28e::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8746.27 via Frontend Transport; Thu, 22 May 2025 14:14:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB1PEPF00050A01.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8769.18 via Frontend Transport; Thu, 22 May 2025 14:14:55 +0000 Received: from SE-MAIL21W.axis.com (10.20.40.16) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Thu, 22 May 2025 16:14:54 +0200 Received: from se-mail02w.axis.com (10.20.40.8) by SE-MAIL21W.axis.com (10.20.40.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Thu, 22 May 2025 16:14:54 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.44 via Frontend Transport; Thu, 22 May 2025 16:14:54 +0200 Received: from pc51235-2237.se.axis.com (pc51235-2237.se.axis.com [10.96.29.3]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 5997E2F54; Thu, 22 May 2025 16:14:54 +0200 (CEST) Received: by pc51235-2237.se.axis.com (Postfix, from userid 3319) id 603524034D5F; Thu, 22 May 2025 16:14:54 +0200 (CEST) From: Johan Adolfsson <johan.adolfsson@axis.com> Date: Thu, 22 May 2025 16:14:48 +0200 Subject: [PATCH RFC v2 1/2] leds: leds-lp50xx: Handle reg to get correct multi_index Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: <linux-leds.vger.kernel.org> List-Subscribe: <mailto:linux-leds+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-leds+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20250522-led-fix-v2-1-652046323ec3@axis.com> References: <20250522-led-fix-v2-0-652046323ec3@axis.com> In-Reply-To: <20250522-led-fix-v2-0-652046323ec3@axis.com> To: Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>, "Jacek Anaszewski" <jacek.anaszewski@gmail.com> CC: <linux-leds@vger.kernel.org>, <linux-kernel@vger.kernel.org>, "Johan Adolfsson" <johan.adolfsson@axis.com>, <kernel@axis.com> X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF00050A01:EE_|DBAPR02MB6214:EE_ X-MS-Office365-Filtering-Correlation-Id: b8188d45-474f-42d6-12ba-08dd993b0724 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?98N+mKGtmIwnm95zpmOTSW+zLkn4TK9?= =?utf-8?q?bK0EUUcv/TTcXwwcw42Q0SHECl+TBS+l379NdxQ0XGO/Uf1dU5670JkUcF5KbOxSt?= =?utf-8?q?nB28hhsblk7QGzPCe9W8KAecJmAem+3p0ZjvPOKohzId8dBhwvt+MdixW4Db19MOC?= =?utf-8?q?+DuB3Mnm+oV73FhYvfHhVLNqY3aec9bisNxHV2ZqBDknnKaY23mH24+jgUjDUdL9m?= =?utf-8?q?5f8Oayqwtn7C3fK+TRCKkoMTNZeCR88/ITNMmYfDQakMQMf2VdwufWTpctIMYMnxU?= =?utf-8?q?6m+zZLT8PQCkIQs4js+E3OprImIuIuExLS6kJfDH00hWvn0iB9ajy/RxohXAMXoaK?= =?utf-8?q?7oKY4ZFA0fg2cXrNtvanG2SuEywG/JgvfV0w/SH6nmsPjVnLa7O2FJ1s+xCuIRVmy?= =?utf-8?q?jCUGjSzEDsby2/Aily57cgmHIsvkRvfNBrgviCIczpPVGX1xYiw8HJiKgg2G+o6DO?= =?utf-8?q?ZW4AerL1iPdTM4/SXSoS72cdO2nuMLiHXOUQQfvlURWhM7MGpwLcMNyWjl25+Ay3G?= =?utf-8?q?gDeM7gctLeBbAkVxaaWuqteDRNnr2KJGS40zlPRpoj8Gqr6t29xhv1Ll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Y9?= =?utf-8?q?Y+IiMhra84?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2025 14:14:55.7907 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8188d45-474f-42d6-12ba-08dd993b0724 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00050A01.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR02MB6214 |
Series |
leds-lp50xx: Support reg to set multi_index.
|
expand
|
diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c index 02cb1565a9fb..8067aaa916bf 100644 --- a/drivers/leds/leds-lp50xx.c +++ b/drivers/leds/leds-lp50xx.c @@ -476,6 +476,7 @@ static int lp50xx_probe_dt(struct lp50xx *priv) return -ENOMEM; fwnode_for_each_child_node(child, led_node) { + int multi_index = num_colors; ret = fwnode_property_read_u32(led_node, "color", &color_id); if (ret) { @@ -483,8 +484,13 @@ static int lp50xx_probe_dt(struct lp50xx *priv) dev_err(priv->dev, "Cannot read color\n"); return ret; } + ret = fwnode_property_read_u32(led_node, "reg", &multi_index); + if (ret == 0 && multi_index >= LP50XX_LEDS_PER_MODULE) { + dev_err(priv->dev, "reg %i out of range\n", multi_index); + return -EINVAL; + } - mc_led_info[num_colors].color_index = color_id; + mc_led_info[multi_index].color_index = color_id; num_colors++; }
mc_subled used for multi_index needs well defined array indexes, to guarantee the desired result, optionally use reg for that. If devicetree child nodes is processed in random or reverse order you may end up with multi_index "blue green red" instead of the expected "red green blue". If user space apps uses multi_index to deduce how to control the leds they would most likely be broken without this patch if devicetree processing is reversed (which it appears to be). arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-fuji.dts has reg set but I don't see how it can have worked without this change. If reg is not set, the previous behavior is kept, index will be in the order nodes are processed. If reg is out of range, an error is returned. reg within led child nodes starts with 0, to map to the iout in each bank. Signed-off-by: Johan Adolfsson <johan.adolfsson@axis.com> --- drivers/leds/leds-lp50xx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)