Skip to content

Commit aa6cc55

Browse files
pelwellpopcornmix
authored andcommitted
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 d098f8e commit aa6cc55

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
@@ -5986,8 +5986,10 @@ Params: brightness Set the initial brightness for the LEDs. The
59865986
a single byte to offset 0 of the device. Note
59875987
that brightness is a multiplier for the pixel
59885988
values, and only white pixels can reach the
5989-
maximum visible brightness. (range 0-255,
5990-
default 255)
5989+
maximum visible brightness. N.B. Setting
5990+
brightness to 0 acctivates pass-through mode,
5991+
disabling all brightness and gamma processing.
5992+
(range 0-255, default 255)
59915993
dev_name The name for the /dev/ device entry. Note that
59925994
if the name includes '%d' it will be replaced
59935995
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)