Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) LP5521/LP5523/LP55231/LP5562/LP8501 Common Driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) =================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) Authors: Milo(Woogyom) Kim <milo.kim@ti.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) LP5521, LP5523/55231, LP5562 and LP8501 have common features as below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)   Register access via the I2C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)   Device initialization/deinitialization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)   Create LED class devices for multiple output channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)   Device attributes for user-space interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)   Program memory for running LED patterns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) The LP55xx common driver provides these features using exported functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)   lp55xx_init_device() / lp55xx_deinit_device()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)   lp55xx_register_leds() / lp55xx_unregister_leds()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)   lp55xx_regsister_sysfs() / lp55xx_unregister_sysfs()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) ( Driver Structure Data )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) In lp55xx common driver, two different data structure is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) * lp55xx_led
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)     control multi output LED channels such as led current, channel index.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) * lp55xx_chip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)     general chip control such like the I2C and platform data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) For example, LP5521 has maximum 3 LED channels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) LP5523/55231 has 9 output channels::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)   lp55xx_chip for LP5521 ... lp55xx_led #1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 			     lp55xx_led #2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 			     lp55xx_led #3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)   lp55xx_chip for LP5523 ... lp55xx_led #1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 			     lp55xx_led #2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 				   .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 				   .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 			     lp55xx_led #9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) ( Chip Dependent Code )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) To support device specific configurations, special structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 'lpxx_device_config' is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)   - Maximum number of channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)   - Reset command, chip enable command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)   - Chip specific initialization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)   - Brightness control register access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)   - Setting LED output current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)   - Program memory address access for running patterns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)   - Additional device specific attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) ( Firmware Interface )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) LP55xx family devices have the internal program memory for running
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) various LED patterns.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) This pattern data is saved as a file in the user-land or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) hex byte string is written into the memory through the I2C.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) LP55xx common driver supports the firmware interface.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) LP55xx chips have three program engines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) To load and run the pattern, the programming sequence is following.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)   (1) Select an engine number (1/2/3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)   (2) Mode change to load
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)   (3) Write pattern data into selected area
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)   (4) Mode change to run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) The LP55xx common driver provides simple interfaces as below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) select_engine:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	Select which engine is used for running program
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) run_engine:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	Start program which is loaded via the firmware interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) firmware:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	Load program data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) In case of LP5523, one more command is required, 'enginex_leds'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) It is used for selecting LED output(s) at each engine number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) In more details, please refer to 'leds-lp5523.txt'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) For example, run blinking pattern in engine #1 of LP5521::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	echo 1 > /sys/bus/i2c/devices/xxxx/select_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	echo 1 > /sys/class/firmware/lp5521/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	echo "4000600040FF6000" > /sys/class/firmware/lp5521/data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	echo 0 > /sys/class/firmware/lp5521/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) For example, run blinking pattern in engine #3 of LP55231
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) Two LEDs are configured as pattern output channels::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	echo 3 > /sys/bus/i2c/devices/xxxx/select_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	echo 1 > /sys/class/firmware/lp55231/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	echo "9d0740ff7e0040007e00a0010000" > /sys/class/firmware/lp55231/data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	echo 0 > /sys/class/firmware/lp55231/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	echo "000001100" > /sys/bus/i2c/devices/xxxx/engine3_leds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) To start blinking patterns in engine #2 and #3 simultaneously::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	for idx in 2 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	echo $idx > /sys/class/leds/red/device/select_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	sleep 0.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	echo 1 > /sys/class/firmware/lp5521/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	echo "4000600040FF6000" > /sys/class/firmware/lp5521/data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	echo 0 > /sys/class/firmware/lp5521/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	echo 1 > /sys/class/leds/red/device/run_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) Here is another example for LP5523.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) Full LED strings are selected by 'engine2_leds'::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	echo 2 > /sys/bus/i2c/devices/xxxx/select_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	echo 1 > /sys/class/firmware/lp5523/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	echo "9d80400004ff05ff437f0000" > /sys/class/firmware/lp5523/data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	echo 0 > /sys/class/firmware/lp5523/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	echo "111111111" > /sys/bus/i2c/devices/xxxx/engine2_leds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) As soon as 'loading' is set to 0, registered callback is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) Inside the callback, the selected engine is loaded and memory is updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) To run programmed pattern, 'run_engine' attribute should be enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) The pattern sequence of LP8501 is similar to LP5523.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) However pattern data is specific.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) Ex 1) Engine 1 is used::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	echo 1 > /sys/bus/i2c/devices/xxxx/select_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	echo 1 > /sys/class/firmware/lp8501/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	echo "9d0140ff7e0040007e00a001c000" > /sys/class/firmware/lp8501/data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	echo 0 > /sys/class/firmware/lp8501/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) Ex 2) Engine 2 and 3 are used at the same time::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	echo 2 > /sys/bus/i2c/devices/xxxx/select_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	sleep 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	echo 1 > /sys/class/firmware/lp8501/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	echo "9d0140ff7e0040007e00a001c000" > /sys/class/firmware/lp8501/data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	echo 0 > /sys/class/firmware/lp8501/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	sleep 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	echo 3 > /sys/bus/i2c/devices/xxxx/select_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	sleep 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	echo 1 > /sys/class/firmware/lp8501/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	echo "9d0340ff7e0040007e00a001c000" > /sys/class/firmware/lp8501/data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	echo 0 > /sys/class/firmware/lp8501/loading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	sleep 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	echo 1 > /sys/class/leds/d1/device/run_engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) ( 'run_engine' and 'firmware_cb' )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) The sequence of running the program data is common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) But each device has own specific register addresses for commands.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) To support this, 'run_engine' and 'firmware_cb' are configurable in each driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) run_engine:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	Control the selected engine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) firmware_cb:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	The callback function after loading the firmware is done.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	Chip specific commands for loading and updating program memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) ( Predefined pattern data )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) Without the firmware interface, LP55xx driver provides another method for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) loading a LED pattern. That is 'predefined' pattern.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) A predefined pattern is defined in the platform data and load it(or them)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) via the sysfs if needed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) To use the predefined pattern concept, 'patterns' and 'num_patterns' should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) configured.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) Example of predefined pattern data::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)   /* mode_1: blinking data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)   static const u8 mode_1[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		0x40, 0x00, 0x60, 0x00, 0x40, 0xFF, 0x60, 0x00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)   /* mode_2: always on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)   static const u8 mode_2[] = { 0x40, 0xFF, };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)   struct lp55xx_predef_pattern board_led_patterns[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		.r = mode_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		.size_r = ARRAY_SIZE(mode_1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		.b = mode_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		.size_b = ARRAY_SIZE(mode_2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)   }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)   struct lp55xx_platform_data lp5562_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)   ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	.patterns      = board_led_patterns,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	.num_patterns  = ARRAY_SIZE(board_led_patterns),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)   };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) Then, mode_1 and mode_2 can be run via through the sysfs::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)   echo 1 > /sys/bus/i2c/devices/xxxx/led_pattern    # red blinking LED pattern
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)   echo 2 > /sys/bus/i2c/devices/xxxx/led_pattern    # blue LED always on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) To stop running pattern::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)   echo 0 > /sys/bus/i2c/devices/xxxx/led_pattern