Commit 32abb478 authored by G.Shark Jeong's avatar G.Shark Jeong Committed by Bryan Wu

leds: Add LED driver for lm3556 chip

LM3556 :
The LM3556 is a 4 MHz fixed-frequency synchronous boost
converter plus 1.5A constant current driver for a high-current white LED.
Datasheet: www.national.com/ds/LM/LM3556.pdf

Tested on OMAP4430

(bryan.wu@canonical.com: use module_i2c_driver() rather than
lm3556_init/lm3556_exit for code simplicity; fixed some typo
pointed out by Rob Landley)
Signed-off-by: default avatarG.Shark Jeong <gshark.jeong@gmail.com>
Reviewed-by: default avatarAxel Lin <axel.lin@gmail.com>
Reviewed-by: default avatarKim, Milo <Milo.Kim@ti.com>
Acked-by: default avatarRob Landley <rob@landley.net>
Signed-off-by: default avatarBryan Wu <bryan.wu@canonical.com>
parent 1522d02e
...@@ -6,3 +6,5 @@ leds-lp5521.txt ...@@ -6,3 +6,5 @@ leds-lp5521.txt
- notes on how to use the leds-lp5521 driver. - notes on how to use the leds-lp5521 driver.
leds-lp5523.txt leds-lp5523.txt
- notes on how to use the leds-lp5523 driver. - notes on how to use the leds-lp5523 driver.
leds-lm3556.txt
- notes on how to use the leds-lm3556 driver.
Kernel driver for lm3556
========================
*Texas Instrument:
1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source
* Datasheet: http://www.national.com/ds/LM/LM3556.pdf
Authors:
Daniel Jeong
Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com)
Description
-----------
There are 3 functions in LM3556, Flash, Torch and Indicator.
FLASH MODE
In Flash Mode, the LED current source(LED) provides 16 target current levels
from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT
CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A),
or by pulling the STROBE pin HIGH.
LM3556 Flash can be controlled through sys/class/leds/flash/brightness file
* if STROBE pin is enabled, below example control brightness only, and
ON / OFF will be controlled by STROBE pin.
Flash Example:
OFF : #echo 0 > sys/class/leds/flash/brightness
93.75 mA: #echo 1 > sys/class/leds/flash/brightness
... .....
1500 mA: #echo 16 > sys/class/leds/flash/brightness
TORCH MODE
In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL
REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the
hardware TORCH input.
LM3556 torch can be controlled through sys/class/leds/torch/brightness file.
* if TORCH pin is enabled, below example control brightness only,
and ON / OFF will be controlled by TORCH pin.
Torch Example:
OFF : #echo 0 > sys/class/leds/torch/brightness
46.88 mA: #echo 1 > sys/class/leds/torch/brightness
... .....
375 mA : #echo 8 > sys/class/leds/torch/brightness
INDICATOR MODE
Indicator pattern can be set through sys/class/leds/indicator/pattern file,
and 4 patterns are pre-defined in indicator_pattern array.
According to N-lank, Pulse time and N Period values, different pattern wiill
be generated.If you want new patterns for your own device, change
indicator_pattern array with your own values and INDIC_PATTERN_SIZE.
Please refer datasheet for more detail about N-Blank, Pulse time and N Period.
Indicator pattern example:
pattern 0: #echo 0 > sys/class/leds/indicator/pattern
....
pattern 3: #echo 3 > sys/class/leds/indicator/pattern
Indicator brightness can be controlled through
sys/class/leds/indicator/brightness file.
Example:
OFF : #echo 0 > sys/class/leds/indicator/brightness
5.86 mA : #echo 1 > sys/class/leds/indicator/brightness
........
46.875mA : #echo 8 > sys/class/leds/indicator/brightness
Notes
-----
Driver expects it is registered using the i2c_board_info mechanism.
To register the chip at address 0x63 on specific adapter, set the platform data
according to include/linux/platform_data/leds-lm3556.h, set the i2c board info
Example:
static struct i2c_board_info __initdata board_i2c_ch4[] = {
{
I2C_BOARD_INFO(LM3556_NAME, 0x63),
.platform_data = &lm3556_pdata,
},
};
and register it in the platform init function
Example:
board_register_i2c_bus(4, 400,
board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4));
...@@ -415,6 +415,14 @@ config LEDS_MAX8997 ...@@ -415,6 +415,14 @@ config LEDS_MAX8997
This option enables support for on-chip LED drivers on This option enables support for on-chip LED drivers on
MAXIM MAX8997 PMIC. MAXIM MAX8997 PMIC.
config LEDS_LM3556
tristate "LED support for LM3556 Chip"
depends on LEDS_CLASS && I2C
select REGMAP_I2C
help
This option enables support for LEDs connected to LM3556.
LM3556 includes Torch, Flash and Indicator functions.
config LEDS_OT200 config LEDS_OT200
tristate "LED support for the Bachmann OT200" tristate "LED support for the Bachmann OT200"
depends on LEDS_CLASS && HAS_IOMEM depends on LEDS_CLASS && HAS_IOMEM
......
...@@ -47,6 +47,7 @@ obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o ...@@ -47,6 +47,7 @@ obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o
obj-$(CONFIG_LEDS_RENESAS_TPU) += leds-renesas-tpu.o obj-$(CONFIG_LEDS_RENESAS_TPU) += leds-renesas-tpu.o
obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
obj-$(CONFIG_LEDS_LM3556) += leds-lm3556.o
# LED SPI Drivers # LED SPI Drivers
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
......
This diff is collapsed.
/*
* Simple driver for Texas Instruments LM3556 LED Flash driver chip (Rev0x03)
* Copyright (C) 2012 Texas Instruments
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#ifndef __LINUX_LM3556_H
#define __LINUX_LM3556_H
#define LM3556_NAME "leds-lm3556"
enum lm3556_pin_polarity {
PIN_LOW_ACTIVE = 0,
PIN_HIGH_ACTIVE,
};
enum lm3556_pin_enable {
PIN_DISABLED = 0,
PIN_ENABLED,
};
enum lm3556_strobe_usuage {
STROBE_EDGE_DETECT = 0,
STROBE_LEVEL_DETECT,
};
enum lm3556_indic_mode {
INDIC_MODE_INTERNAL = 0,
INDIC_MODE_EXTERNAL,
};
struct lm3556_platform_data {
enum lm3556_pin_enable torch_pin_en;
enum lm3556_pin_polarity torch_pin_polarity;
enum lm3556_strobe_usuage strobe_usuage;
enum lm3556_pin_enable strobe_pin_en;
enum lm3556_pin_polarity strobe_pin_polarity;
enum lm3556_pin_enable tx_pin_en;
enum lm3556_pin_polarity tx_pin_polarity;
enum lm3556_indic_mode indicator_mode;
};
#endif /* __LINUX_LM3556_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment