Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 1 | ======================== |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 2 | Kernel driver for lm3556 |
| 3 | ======================== |
| 4 | |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 5 | * Texas Instrument: |
| 6 | 1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 7 | * Datasheet: http://www.national.com/ds/LM/LM3556.pdf |
| 8 | |
| 9 | Authors: |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 10 | - Daniel Jeong |
| 11 | |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 12 | Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com) |
| 13 | |
| 14 | Description |
| 15 | ----------- |
| 16 | There are 3 functions in LM3556, Flash, Torch and Indicator. |
| 17 | |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 18 | Flash Mode |
| 19 | ^^^^^^^^^^ |
| 20 | |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 21 | In Flash Mode, the LED current source(LED) provides 16 target current levels |
| 22 | from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT |
| 23 | CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A), |
| 24 | or by pulling the STROBE pin HIGH. |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 25 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 26 | LM3556 Flash can be controlled through /sys/class/leds/flash/brightness file |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 27 | |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 28 | * if STROBE pin is enabled, below example control brightness only, and |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 29 | ON / OFF will be controlled by STROBE pin. |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 30 | |
| 31 | Flash Example: |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 32 | |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 33 | OFF:: |
| 34 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 35 | #echo 0 > /sys/class/leds/flash/brightness |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 36 | |
| 37 | 93.75 mA:: |
| 38 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 39 | #echo 1 > /sys/class/leds/flash/brightness |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 40 | |
| 41 | ... |
| 42 | |
| 43 | 1500 mA:: |
| 44 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 45 | #echo 16 > /sys/class/leds/flash/brightness |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 46 | |
| 47 | Torch Mode |
| 48 | ^^^^^^^^^^ |
| 49 | |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 50 | In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL |
| 51 | REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the |
| 52 | hardware TORCH input. |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 53 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 54 | LM3556 torch can be controlled through /sys/class/leds/torch/brightness file. |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 55 | * if TORCH pin is enabled, below example control brightness only, |
| 56 | and ON / OFF will be controlled by TORCH pin. |
| 57 | |
| 58 | Torch Example: |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 59 | |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 60 | OFF:: |
| 61 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 62 | #echo 0 > /sys/class/leds/torch/brightness |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 63 | |
| 64 | 46.88 mA:: |
| 65 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 66 | #echo 1 > /sys/class/leds/torch/brightness |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 67 | |
| 68 | ... |
| 69 | |
| 70 | 375 mA:: |
| 71 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 72 | #echo 8 > /sys/class/leds/torch/brightness |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 73 | |
| 74 | Indicator Mode |
| 75 | ^^^^^^^^^^^^^^ |
| 76 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 77 | Indicator pattern can be set through /sys/class/leds/indicator/pattern file, |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 78 | and 4 patterns are pre-defined in indicator_pattern array. |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 79 | |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 80 | According to N-lank, Pulse time and N Period values, different pattern wiill |
| 81 | be generated.If you want new patterns for your own device, change |
| 82 | indicator_pattern array with your own values and INDIC_PATTERN_SIZE. |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 83 | |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 84 | Please refer datasheet for more detail about N-Blank, Pulse time and N Period. |
| 85 | |
| 86 | Indicator pattern example: |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 87 | |
| 88 | pattern 0:: |
| 89 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 90 | #echo 0 > /sys/class/leds/indicator/pattern |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 91 | |
| 92 | ... |
| 93 | |
| 94 | pattern 3:: |
| 95 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 96 | #echo 3 > /sys/class/leds/indicator/pattern |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 97 | |
| 98 | Indicator brightness can be controlled through |
| 99 | sys/class/leds/indicator/brightness file. |
| 100 | |
| 101 | Example: |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 102 | |
| 103 | OFF:: |
| 104 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 105 | #echo 0 > /sys/class/leds/indicator/brightness |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 106 | |
| 107 | 5.86 mA:: |
| 108 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 109 | #echo 1 > /sys/class/leds/indicator/brightness |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 110 | |
| 111 | ... |
| 112 | |
| 113 | 46.875mA:: |
| 114 | |
Mark O'Donovan | abb9c07 | 2021-03-28 16:28:37 +0100 | [diff] [blame^] | 115 | #echo 8 > /sys/class/leds/indicator/brightness |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 116 | |
| 117 | Notes |
| 118 | ----- |
| 119 | Driver expects it is registered using the i2c_board_info mechanism. |
| 120 | To register the chip at address 0x63 on specific adapter, set the platform data |
| 121 | according to include/linux/platform_data/leds-lm3556.h, set the i2c board info |
| 122 | |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 123 | Example:: |
| 124 | |
Sachin Kamat | eb967b6 | 2013-08-09 09:19:33 -0700 | [diff] [blame] | 125 | static struct i2c_board_info board_i2c_ch4[] __initdata = { |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 126 | { |
| 127 | I2C_BOARD_INFO(LM3556_NAME, 0x63), |
| 128 | .platform_data = &lm3556_pdata, |
| 129 | }, |
| 130 | }; |
| 131 | |
| 132 | and register it in the platform init function |
| 133 | |
Mauro Carvalho Chehab | 8dab919 | 2019-06-28 09:20:20 -0300 | [diff] [blame] | 134 | Example:: |
| 135 | |
G.Shark Jeong | 32abb478 | 2012-06-22 08:12:06 +0800 | [diff] [blame] | 136 | board_register_i2c_bus(4, 400, |
| 137 | board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4)); |