misc: ws2812-pio-rp1: Add pass-through mode

Pass-through mode disables all gamma and brightness processing, sending
the raw pixel data directly to the LEDs. It is enabled by setting the
brightness to zero, either in Device Tree or using the runtime method of
writing a single byte (in this case 0) to the device.

See: https://github.com/raspberrypi/linux/issues/7108

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This commit is contained in:
Phil Elwell
2025-10-26 17:05:51 +00:00
committed by Dom Cobley
parent 36f4e6d11b
commit 767c0e4712
2 changed files with 6 additions and 4 deletions

View File

@@ -5986,8 +5986,10 @@ Params: brightness Set the initial brightness for the LEDs. The
a single byte to offset 0 of the device. Note
that brightness is a multiplier for the pixel
values, and only white pixels can reach the
maximum visible brightness. (range 0-255,
default 255)
maximum visible brightness. N.B. Setting
brightness to 0 acctivates pass-through mode,
disabling all brightness and gamma processing.
(range 0-255, default 255)
dev_name The name for the /dev/ device entry. Note that
if the name includes '%d' it will be replaced
by the instance number. (default 'leds%d')

View File

@@ -142,8 +142,8 @@ static uint8_t ws2812_apply_gamma(uint8_t brightness, uint8_t val)
{
int bright;
if (!val)
return 0;
if (!val || !brightness)
return val;
bright = (val * brightness) / 255;
return ws2812_gamma[bright];
}