mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 01:11:14 +00:00
c439003497
Add basic support for the LED driver for GCA230718.
- I didn't find any documentation or driver for it, so the information below is purely based on my investigations
- If there is already I driver for it, please tell me. Maybe I didn't search enough
- I implemented a kernel module (leds-gca230718) to access the LEDs via DTS
- The LED controller supports PWM for brightness control and ramp control for smooth blinking. This is not implemented in the driver
- The LED controller supports toggling (on -> off -> on -> off) where the brightness of the LEDs can be set individually for each on cycle
- Until now, only simple active/inactive control is implemented (like when the LEDs would have been connected via GPIO)
- Controlling the LEDs requires three sequences sent to the chip. Each sequence consists of
- A reset command (0x81 0xE4) written to register 0x00
- A control command (for example 0x0C 0x02 0x01 0x00 0x00 0x00 0xFF 0x01 0x00 0x00 0x00 0xFF 0x87 written to register 0x03)
- The reset command is always the same
- In the control command
- byte 0 is always the same
- byte 1 (0x02 in the example above) must be changed in every sequence: 0x02 -> 0x01 -> 0x03)
- byte 2 is set to 0x01 which disables toggling. 0x02 would be LED toggling without ramp control, 0x03 would be toggling with ramp control
- byte 3 to 6 define the brightness values for the LEDs (R,G,B,W) for the first on cycle when toggling
- byte 7 defines the toggling frequency (if toggling enabled)
- byte 8 to 11 define the brightness values for the LEDs (R,G,B,W) for the second on cycle when toggling
- byte 12 is constant 0x87
Signed-off-by: Roland Reinl <reinlroland+github@gmail.com>
(cherry picked from commit 0682974aa8
)
35 lines
795 B
Makefile
35 lines
795 B
Makefile
#
|
|
# Copyright (C) 2008-2010 OpenWrt.org
|
|
#
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
# See /LICENSE for more information.
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
include $(INCLUDE_DIR)/kernel.mk
|
|
|
|
PKG_NAME:=leds-gca230718
|
|
PKG_RELEASE:=1
|
|
PKG_LICENSE:=GPL-2.0
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define KernelPackage/leds-gca230718
|
|
SUBMENU:=LED modules
|
|
TITLE:=GCA230718 LED support (e.g. for D-Link M30)
|
|
FILES:= \
|
|
$(PKG_BUILD_DIR)/leds-gca230718.ko
|
|
AUTOLOAD:=$(call AutoProbe,leds-gca230718,1)
|
|
DEPENDS:=@TARGET_mediatek_filogic
|
|
endef
|
|
|
|
define KernelPackage/leds-gca230718/description
|
|
GCA230718 LED support (e.g. for D-Link M30) using I2C.
|
|
endef
|
|
|
|
define Build/Compile
|
|
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,leds-gca230718))
|