Skip to content

Commit d140b69

Browse files
committed
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: #7108 Signed-off-by: Phil Elwell <[email protected]>
1 parent 2e376fd commit d140b69

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

arch/arm/boot/dts/overlays/README

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5980,8 +5980,10 @@ Params: brightness Set the initial brightness for the LEDs. The
59805980
a single byte to offset 0 of the device. Note
59815981
that brightness is a multiplier for the pixel
59825982
values, and only white pixels can reach the
5983-
maximum visible brightness. (range 0-255,
5984-
default 255)
5983+
maximum visible brightness. N.B. Setting
5984+
brightness to 0 acctivates pass-through mode,
5985+
disabling all brightness and gamma processing.
5986+
(range 0-255, default 255)
59855987
dev_name The name for the /dev/ device entry. Note that
59865988
if the name includes '%d' it will be replaced
59875989
by the instance number. (default 'leds%d')

drivers/misc/ws2812-pio-rp1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ static uint8_t ws2812_apply_gamma(uint8_t brightness, uint8_t val)
142142
{
143143
int bright;
144144

145-
if (!val)
146-
return 0;
145+
if (!val || !brightness)
146+
return val;
147147
bright = (val * brightness) / 255;
148148
return ws2812_gamma[bright];
149149
}

0 commit comments

Comments
 (0)