Skip to content

Commit

Permalink
misc: Add ws2812-pio-rp1 driver
Browse files Browse the repository at this point in the history
ws2812-pio-rp1 is a PIO-based driver for WS2812 LEDS. It creates a
character device in /dev, the default name of which is /dev/leds<n>,
where <n> is the instance number. The number of LEDS should be set
in the DT overlay, as should whether it is RGB or RGBW, and the default
brightness.

Write data to the /dev/* entry in a 4 bytes-per-pixel format in RGBW
order:

  RR GG BB WW RR GG BB WW ...

The white values are ignored unless the rgbw flag is set for the device.

To change the brightness, write a single byte to offset 0, 255 being
full brightness and 0 being off.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
  • Loading branch information
pelwell committed Dec 20, 2024
1 parent fddd3e9 commit d6d83ad
Show file tree
Hide file tree
Showing 3 changed files with 518 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/misc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ config RP1_PIO
Driver providing control of the Raspberry Pi PIO block, as found in
RP1.

config WS2812_PIO_RP1
tristate "Raspberry Pi PIO-base WS2812 driver"
depends on RP1_PIO || COMPILE_TEST
default n
help
Driver for the WS2812 (NeoPixel) LEDs using the RP1 PIO hardware.
The driver creates a character device to which rgbw pixels may be
written. Single-byte writes to offset 0 set the brightness at
runtime.

config AD525X_DPOT
tristate "Analog Devices Digital Potentiometers"
depends on (I2C || SPI) && SYSFS
Expand Down
1 change: 1 addition & 0 deletions drivers/misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ obj-$(CONFIG_PHANTOM) += phantom.o
obj-$(CONFIG_QCOM_COINCELL) += qcom-coincell.o
obj-$(CONFIG_QCOM_FASTRPC) += fastrpc.o
obj-$(CONFIG_RP1_PIO) += rp1-pio.o
obj-$(CONFIG_WS2812_PIO_RP1) += ws2812-pio-rp1.o
obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o
obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o
obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
Expand Down
Loading

0 comments on commit d6d83ad

Please sign in to comment.