Skip to content

lp5569 LED driver for Linux kernel 4.19

Notifications You must be signed in to change notification settings

jumptiger66/leds-lp5569

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

leds-lp5569

This is experimental LED driver as a module for NBG7815 device.

Usage:

  1. Put module in the openwrt path -> /openwrt/package/kernel

  2. make menuconfig and add a support for this driver as a module

  3. Compile openwrt distro or just module(and send to the router):

make V=sc package/kernel/leds-lp5569/compile
  1. Load module:
rmmod led-lp5569
insmod led-lp5569.ko
  1. Play fun with leds as example:

    original Zyxel Armor G5 router ready pattern

root@OpenWrt:~# echo 14 > /sys/devices/platform/soc/78b6000.i2c/i2c-0/0-0032/led_pattern
root@OpenWrt:~# echo 1 > /sys/devices/platform/soc/78b6000.i2c/i2c-0/0-0032/run_engine

root@OpenWrt:~# echo 14 > /sys/devices/platform/soc/78b6000.i2c/i2c-0/0-0035/led_pattern
root@OpenWrt:~# echo 1 > /sys/devices/platform/soc/78b6000.i2c/i2c-0/0-0035/run_engine

Patterns implemented

//1
static const u8 mode_slow_blinking_w[] = {
	0x01, 0xFF, 0x9C, 0x00, 0x40, 0xFF, 0x7E, 0x00, 0x40, 0x00, 0x7E, 0x00, 0xA0, 0x01,
};
//2
static const u8 mode_fast_blinking_w[] = {
	0x01, 0xFF, 0x9C, 0x00, 0x40, 0xFF, 0x50, 0x00, 0x40, 0x00, 0x50, 0x00, 0xA0, 0x01,
};
//3
static const u8 mode_slow_blinking_r[] = {
	0x00, 0x49, 0x9C, 0x00, 0x40, 0xFF, 0x7E, 0x00, 0x40, 0x00, 0x7E, 0x00, 0xA0, 0x01,
};
//4
static const u8 mode_fast_blinking_r[] = {
	0x00, 0x49, 0x9C, 0x00, 0x40, 0xFF, 0x50, 0x00, 0x40, 0x00, 0x50, 0x00, 0xA0, 0x01,
};
//5
static const u8 mode_slow_blinking_g[] = {
	0x00, 0x92, 0x9C, 0x00, 0x40, 0xFF, 0x7E, 0x00, 0x40, 0x00, 0x7E, 0x00, 0xA0, 0x01,
};
//6
static const u8 mode_fast_blinking_g[] = {
	0x00, 0x92, 0x9C, 0x00, 0x40, 0xFF, 0x50, 0x00, 0x40, 0x00, 0x50, 0x00, 0xA0, 0x01,
};
//7
static const u8 mode_slow_blinking_b[] = {
	0x01, 0x24, 0x9C, 0x00, 0x40, 0xFF, 0x7E, 0x00, 0x40, 0x00, 0x7E, 0x00, 0xA0, 0x01,
};
//8
static const u8 mode_fast_blinking_b[] = {
	0x01, 0x24, 0x9C, 0x00, 0x40, 0xFF, 0x50, 0x00, 0x40, 0x00, 0x50, 0x00, 0xA0, 0x01,
};
//9
static const u8 mode_booting1[] = {
	0x00, 0x07, 0x00, 0x38, 0x01, 0xC0, 0x9F, 0x80, 0x40, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x06, 0xFF,
	0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x02, 0x9F, 0x81, 0x40, 0x00, 0x6C, 0x00, 0x06, 0xFF,
	0x6C, 0x00, 0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x02, 0x9F, 0x82, 0x40, 0x00, 0x06, 0xFF,
	0x6C, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x02,
};
//10
static const u8 mode_booting2[] = {
	0x01, 0xC0, 0x00, 0x38, 0x00, 0x07, 0x9F, 0x80, 0x40, 0x00, 0x06, 0xFF, 0x6C, 0x00, 0x6C, 0x00,
	0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x02, 0x9F, 0x81, 0x40, 0x00, 0x6C, 0x00, 0x06, 0xFF,
	0x6C, 0x00, 0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x02, 0x9F, 0x82, 0x40, 0x00, 0x6C, 0x00,
	0x6C, 0x00, 0x06, 0xFF, 0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x02,
};
//11
static const u8 mode_bluetooth_ready[] = {
	0x00, 0xDB, 0x01, 0x24, 0x9F, 0x80, 0x40, 0x00, 0x9F, 0x81, 0x40, 0xFF, 0xC0, 0x00,
};
//12
static const u8 mode_bluetooth_configuring1[] = {
	0x00, 0x03, 0x00, 0x04, 0x00, 0x18, 0x00, 0x20, 0x00, 0xC0, 0x01, 0x00, 0x9F, 0x80, 0x40, 0x00,
	0x9F, 0x81, 0x40, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x06, 0xFF, 0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00,
	0xA0, 0x04, 0x9F, 0x82, 0x40, 0x00, 0x9F, 0x83, 0x40, 0x00, 0x6C, 0x00, 0x06, 0xFF, 0x6C, 0x00,
	0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x04, 0x9F, 0x84, 0x40, 0x00, 0x9F, 0x85, 0x40, 0x00,
	0x06, 0xFF, 0x6C, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x04,
};
//13
static const u8 mode_bluetooth_configuring2[] = {
	0x00, 0xC0, 0x01, 0x00, 0x00, 0x18, 0x00, 0x20, 0x00, 0x03, 0x00, 0x04, 0x9F, 0x80, 0x40, 0x00,
	0x9F, 0x81, 0x40, 0x00, 0x06, 0xFF, 0x6C, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00,
	0xA0, 0x04, 0x9F, 0x82, 0x40, 0x00, 0x9F, 0x83, 0x40, 0x00, 0x6C, 0x00, 0x06, 0xFF, 0x6C, 0x00,
	0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x04, 0x9F, 0x84, 0x40, 0x00, 0x9F, 0x85, 0x40, 0x00,
	0x6C, 0x00, 0x6C, 0x00, 0x06, 0xFF, 0x6C, 0x00, 0x05, 0xFF, 0x6C, 0x00, 0xA0, 0x04,
};
//14
static const u8 mode_ready1[] = {
	0x00, 0x09, 0x00, 0x12, 0x00, 0x24, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x9F, 0x81, 0x40, 0x00,
	0x9F, 0x82, 0x40, 0x32, 0x9F, 0x80, 0x40, 0x00, 0xE0, 0x04, 0x08, 0xFF, 0x09, 0xFF, 0x60, 0x00,
	0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xA0, 0x06, 0x9F, 0x84, 0x40, 0x00, 0x9F, 0x85, 0x40, 0x32,
	0x9F, 0x83, 0x40, 0xFF, 0xE0, 0x80, 0x09, 0xFF, 0x08, 0xFF, 0x09, 0xFF, 0x08, 0xFF, 0xA0, 0x06,
};
//15
static const u8 mode_ready2[] = {
	0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x00, 0x09, 0x00, 0x12, 0x00, 0x24, 0x9F, 0x81, 0x40, 0x00,
	0x9F, 0x82, 0x40, 0x32, 0x9F, 0x80, 0x40, 0x00, 0xE1, 0x00, 0x09, 0xFF, 0x08, 0xFF, 0x09, 0xFF,
	0x08, 0xFF, 0xA0, 0x06, 0x9F, 0x84, 0x40, 0x00, 0x9F, 0x85, 0x40, 0x32, 0x9F, 0x83, 0x40, 0x00,
	0xE0, 0x02, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x08, 0xFF, 0x09, 0xFF, 0xA0, 0x06,
};
//16
static const u8 mode_wps1[] = {
	0x00, 0x05, 0x00, 0x02, 0x00, 0x28, 0x00, 0x10, 0x01, 0x40, 0x00, 0x80, 0x9F, 0x81, 0x40, 0x00,
	0x9F, 0x80, 0x40, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x0A, 0x96, 0x6C, 0x00, 0x09, 0x96, 0x6C, 0x00,
	0xA0, 0x04, 0x9F, 0x83, 0x40, 0x00, 0x9F, 0x82, 0x40, 0x00, 0x6C, 0x00, 0x0A, 0x96, 0x6C, 0x00,
	0x6C, 0x00, 0x09, 0x96, 0x6C, 0x00, 0xA0, 0x04, 0x9F, 0x85, 0x40, 0x00, 0x9F, 0x84, 0x40, 0x00,
	0x0A, 0x96, 0x6C, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x09, 0x96, 0x6C, 0x00, 0xA0, 0x04,
};
//17
static const u8 mode_wps2[] = {
	0x01, 0x40, 0x00, 0x80, 0x00, 0x28, 0x00, 0x10, 0x00, 0x05, 0x00, 0x02, 0x9F, 0x81, 0x40, 0x00,
	0x9F, 0x80, 0x40, 0x00, 0x0A, 0x96, 0x6C, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x09, 0x96, 0x6C, 0x00,
	0xA0, 0x04, 0x9F, 0x83, 0x40, 0x00, 0x9F, 0x82, 0x40, 0x00, 0x6C, 0x00, 0x0A, 0x96, 0x6C, 0x00,
	0x6C, 0x00, 0x09, 0x96, 0x6C, 0x00, 0xA0, 0x04, 0x9F, 0x85, 0x40, 0x00, 0x9F, 0x84, 0x40, 0x00,
	0x6C, 0x00, 0x6C, 0x00, 0x0A, 0x96, 0x6C, 0x00, 0x09, 0x96, 0x6C, 0x00, 0xA0, 0x04,
};
//18
static const u8 mode_fw_upgrade1[] = {
	0x00, 0x3F, 0x01, 0xC0, 0x9F, 0x80, 0x40, 0x00, 0x06, 0xFF, 0x05, 0xFF, 0x6C, 0x00, 0x6C, 0x00,
	0x66, 0x00, 0xA0, 0x02, 0x9F, 0x81, 0x40, 0x00, 0x6C, 0x00, 0x04, 0xFF, 0x07, 0xFF, 0x6C, 0x00,
	0x66, 0x00, 0xA0, 0x02,
};
//19
static const u8 mode_fw_upgrade2[] = {
	0x01, 0xC0, 0x00, 0x3F, 0x9F, 0x80, 0x40, 0x00, 0x6C, 0x00, 0x04, 0xFF, 0x07, 0xFF, 0x6C, 0x00,
	0x66, 0x00, 0xA0, 0x02, 0x9F, 0x81, 0x40, 0x00, 0x6C, 0x00, 0x66, 0x00, 0x06, 0xFF, 0x6C, 0x00,
	0x05, 0xFF, 0xA0, 0x02,
};
//20
static const u8 mode_reset[] = {
	0x01, 0xFF, 0x9F, 0x80, 0x40, 0x00, 0x04, 0xFF, 0x05, 0xFF, 0xA0, 0x02,
};
//21
static const u8 mode_error[] = {
	0x01, 0xB6, 0x00, 0x49, 0x9F, 0x80, 0x40, 0x00, 0x9F, 0x81, 0x40, 0xFF, 0xC0, 0x00,
};

How to make own pattern

  1. Download and install LP5569 EVM https://www.ti.com/tool/download/SNVC210

  2. Read instructions https://www.ti.com/lit/an/snva822/snva822.pdf?ts=1701926645742

  3. Make some assembler code and compile by LASM.EXE tool

About

lp5569 LED driver for Linux kernel 4.19

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.0%
  • Makefile 2.0%