From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6CC52D97A4 for ; Tue, 30 Dec 2025 00:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767054791; cv=none; b=Vq1HNE/uSnA8qDw1nn5dblkIEh83Ytb2GTXFJEwY65yqqLAMT0Ne0fEnlWEzgKcsNPUW1QTaqrlS/Ba/Ume0TUHlNXWh8wwjg6k4hxqNJEQ8z2OMafYEMdhWHVmH/cgxZwt36zvEKGsI5cgzQd7gMomG89D22EnuH+EUHhKeWeY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767054791; c=relaxed/simple; bh=3y1NVc5vWTSx3MmvStySWn0mxLBSepomzp/r9o4iIeg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eIRhi53tUKNu76DBgG9agujv6U/ajoVSTw0G06XwudS+dC6hexjAn1/iLP8ePf88hroej6+k7HmWNGjB127jkjqZ4s+k/6Fjy050BDdhTxrt1YBBvZfErJL9K9FSCnsQi4eU+Z053Cz0SRiToNHGmJBxKouUnyDGehNqh3a15zo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U4WZJ9QW; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U4WZJ9QW" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-7d26a7e5639so10763223b3a.1 for ; Mon, 29 Dec 2025 16:33:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767054789; x=1767659589; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kYf7zCvIjBULgzq6jQ3x0ChfTPBHY+SYJeU7DZ2l1d0=; b=U4WZJ9QW0Kws4f/Y2fiVgd3cRZEsFpDZr8G0CTYuO/yfVIotZ2k6XKppYTMUOGkbO9 IowtPI9GrpQh+mz7jhkId7wanzl6pbv62cwDK+BENKNFAYKr70dwcb8X7IwxVDpc+ddg afxQied18lJTWMS7ECHGzMeKkA0qN0Ewo+szJkNAfE/tYYpI6+vZn6kQFh8M3nd2baNq AsQjnBI9hKXjrgzofeqZTw17xJ+PXZDVE6nJUdWlpUL8D+YBHL+TSparUnn3YtNMNVEC X5x5yJGJ78grEv8pIK/yMxi4AbXYqNlkLhXnZo5KMIubCwdJQZY1bor9BtiDoz5m4jJe 5h8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767054789; x=1767659589; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kYf7zCvIjBULgzq6jQ3x0ChfTPBHY+SYJeU7DZ2l1d0=; b=OgHPVCE9JJwb0VYtezu4QaYBg0BVPuit6yVSn+xRixqzE4PIWyB+7f9oERufJqw6Gi iiq0StYCbremZewbEACrVJpZUQUy7fHYWPsBxhsHWepgzRkjtvd36EVI5Ro5TPQDchsl /AzHW7Og/Pi8azbfFADxMCVr6KJB6VLS9emorMCOjn8qX17Av3On5Q7OkbjUqG76JOS4 1Fk2e7rGmjCugAO2gqJv0B2X4icrvKpc4EvAek12m08Gl/9s5vpTlZf7BVokPgKMId3C giiXvkqx4FXxPzschPyjFUxGn4Prfdt/I14Fdbf+bU05bUR4lhh5R96VMGhtsk7aORmj ZJtQ== X-Forwarded-Encrypted: i=1; AJvYcCUMlwDMnBpAqzN1U7MEKEpOhB4F5nP082sCcwBkFQ4vBeS3R3uCCyEDAceaCO4qVVTC1FWCPQxQJ14XlrM=@vger.kernel.org X-Gm-Message-State: AOJu0Yzsp8IVBHwbM+atwRK44R8x0+sDPify93GHO58N5M2rSGLGxXlX JvMsgp9kOsq6UCNkEy1BSGPGLZNrOoOrbX3rjrr2EBPTiyP5bugzUjF0 X-Gm-Gg: AY/fxX5LSFXbqIRJfYQ6nRs0sFnhpqvZ346VD8WH5Hj2Tzw4KFtdUtt1HOQETokWhWe Gg4xX1axTROCNcLCO/jMmEa8f1uQ2YDeBQ/kEFUer+d1E04q4/IACzKWZ0lITp9xgUDvhicxC/t Gui9zXZK9SkVq06DARUo6H4/X4FVCnCRJ+O+z+yqm0fjVKo3Si6IgZ2Oh5HqO27UBvg8yPcFKtm TDcWbAKuO4XRmN1d2CFWDZufFKm5oQpmQ+pcEuqptbs3LSI5hqt8YX5fymMjjlBpGJMZPSWbrZv 2K0O5xvV3pUZsoKj41q3FuuFjJOIIWq50HitecmLSz/p0K2tpMyEZCF0iFjjyHkoCADYQapeL2+ eQWUC87Uk0zTxAL4FV8TPwvziKxvY14DCJ2Fqx9+NucUe9Uwdc8NNzlEuwDHr0pq9PAMNmOfzBS 2DpvcZZSpoWAaRNXnsi7dKO+qN4l8ujAxN X-Google-Smtp-Source: AGHT+IFWBwGON5rFBSn5eTP82qw9eZo63G+2uS0ADX0k9HKBZ1vIa62hb0xOdbLqWkBnpUg0QtrRfw== X-Received: by 2002:a05:6a00:44c4:b0:7fe:788e:4ef6 with SMTP id d2e1a72fcca58-7ff66d5fc38mr29639210b3a.62.1767054788992; Mon, 29 Dec 2025 16:33:08 -0800 (PST) Received: from MRSPARKLE.localdomain ([150.228.155.85]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7e8947a1sm30241562b3a.67.2025.12.29.16.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Dec 2025 16:33:08 -0800 (PST) From: Jonathan Brophy To: lee Jones , Pavel Machek , Andriy Shevencho , Jonathan Brophy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Radoslav Tsvetkov Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: [PATCH v4 0/7] leds: Add virtual LED group driver with priority arbitration Date: Tue, 30 Dec 2025 13:32:37 +1300 Message-ID: <20251230003250.1197744-1-professorjonny98@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jonathan Brophy This patch series introduces a new LED driver that implements virtual LED groups with priority-based arbitration for shared physical LEDs. The driver provides a multicolor LED interface while solving the problem of multiple subsystems needing to control the same physical LEDs. Key features: - Winner-takes-all priority-based arbitration - Full multicolor LED ABI compliance - Two operating modes (multicolor and standard/fixed-color) - Deterministic channel ordering by LED_COLOR_ID - Comprehensive debugfs telemetry (when CONFIG_DEBUG_FS enabled) - Optimized memory footprint (~200 bytes per LED in production builds) Use cases: - System status indicators with boot/error/update priority levels - RGB lighting with coordinated control - Multi-element LED arrays unified into single logical controls The series includes: 1. New LED function identifier for virtual LEDs 2. Device tree bindings for virtual LED class 3. Device tree bindings for virtual LED group controller 4. ABI documentation for sysfs interface 5. Comprehensive driver documentation 6. fwnode_led_get() helper for firmware-agnostic LED resolution 7. Complete driver implementation Changes since last v3 commit - convert driver to pure fwnode - Multicolor LED ABI compliance - standard multi_intensity/multi_index attributes - Winner-takes-all arbitration - deterministic control with sequence-based tie-breaking - Proper LED reference management - fwnode_led_get() + led_put() prevents leaks - 30% memory reduction - conditional debug compilation - Global ownership tracking - prevents conflicts between multiple controllers - Hierarchical locking - documented 3-tier lock order prevents deadlocks - Lock-free hardware I/O - concurrent vLED updates during physical LED access - Dual operating modes - multicolor (dynamic) and standard (fixed-color) modes - Pre-allocated arbitration buffers - zero allocations in hot path - Comprehensive power management - suspend/resume with runtime PM support Additional highlights: Update batching for software PWM workloads Gamma correction for perceptual brightness Rate limiting for runaway updates Extensive debugfs telemetry with stress testing Deferred probe handling for late-probing LEDs Removal race prevention with atomic flags Testing: - Tested on ARM64 platform with GPIO and PWM LEDs - Stress tested with 10,000 iterations - Validated suspend/resume cycles - Memory leak detection passes Jonathan Brophy (7): dt-bindings: leds: Add LED_FUNCTION_VIRTUAL_STATUS identifier dt-bindings: leds: Add virtual LED class bindings dt-bindings: leds: Add virtual LED group controller bindings ABI: Add sysfs documentation for leds-group-virtualcolor leds: Add driver documentation for leds-group-virtualcolor leds: Add fwnode_led_get() for firmware-agnostic LED resolution leds: Add virtual LED group driver with priority arbitration .../sysfs-class-led-driver-virtualcolor | 168 + .../leds/leds-class-virtualcolor.yaml | 197 + .../leds/leds-group-virtualcolor.yaml | 170 + .../leds/leds-group-virtualcolor.rst | 641 ++++ drivers/leds/led-class.c | 136 +- drivers/leds/leds.h | 758 +++- drivers/leds/rgb/Kconfig | 17 + drivers/leds/rgb/Makefile | 1 + drivers/leds/rgb/leds-group-virtualcolor.c | 3360 +++++++++++++++++ include/dt-bindings/leds/common.h | 3 + 10 files changed, 5399 insertions(+), 52 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-led-driver-virtualcolor create mode 100644 Documentation/devicetree/bindings/leds/leds-class-virtualcolor.yaml create mode 100644 Documentation/devicetree/bindings/leds/leds-group-virtualcolor.yaml create mode 100644 Documentation/leds/leds-group-virtualcolor.rst create mode 100644 drivers/leds/rgb/leds-group-virtualcolor.c -- 2.43.0