[PATCH] backlight : add lp855x backlight driver

From: Kim, Milo
Date: Sun Nov 27 2011 - 21:10:18 EST


Hello, Backlight Class Maintainer

I send the patch for new lp855x backlight driver.
This patch provides Texas Instruments LP855x backlight driver.

* Supported Backlight ICs
LP8550, LP8551, LP8552 and LP8556

* Consolidated Driver
Just one driver file can support several LP855x backlight ICs.

* Driver Description
1) Brightness control
Brightness can be controlled by pwm input or i2c command.
lp855x driver support both cases.
PWM are platform specific data, so the driver provides pwm functions
in lp855x_platform_data structure.

2) Debugfs nodes : For debug purpose, 3 files are exported in the debugfs.
a) bl_ctl_mode : backlight control mode
pwm based or register based

b) chip_id : lp855x chip id
lp8550/lp8551/lp8552/lp8556

c) registers
we can control the lp855x registers via the debugfs.
read/write/dump mode are supported.

3) Platform data for lp855x
a) name : backlight driver name
b) mode : brightness control by pwm or lp855x register
c) device_control : value of DEVICE CONTROL register
d) initial_brightness : initial value of backlight brightness
e) max_brightness : maximum value of backlight brightness
f) pwm_data : platform specific pwm generation functions.
Only valid when brightness is pwm input mode.
g) load_new_rom_data :
0 : use default configuration data
1 : update values of eeprom or eprom registers on loading driver
h) size_program : total size of lp855x_rom_data
i) rom_data : list of new eeprom/eprom registers

example 1) lp8552 platform data : i2c register mode with new eeprom data

static struct lp855x_rom_data lp8552_eeprom_arr[] = {
{0xa5, 0x4f}, /* EN_VSYNC=0 */
};

static struct lp855x_platform_data lp8552_pdata = {
.name = "lcd-backlight",
.mode = REGISTER_BASED,
.device_control = I2C_CONFIG(LP8552),
.initial_brightness = INITIAL_BRT,
.max_brightness = MAX_BRT,
.load_new_rom_data = 1,
.size_program = ARRAY_SIZE(lp8552_eeprom_arr),
.rom_data = lp8552_eeprom_arr,
};

example 2) lp8556 platform data : pwm input mode

static struct lp855x_platform_data lp8556_pdata = {
.name = "lcd-backlight",
.mode = PWM_BASED,
.device_control = PWM_CONFIG(LP8556),
.initial_brightness = INITIAL_BRT,
.max_brightness = MAX_BRT,
.pwm_data = {
.pwm_set_intensity = platform_pwm_set_intensity,
.pwm_get_intensity = platform_pwm_get_intensity,
},
};

* Test Environment
OMAP3530 beagelborad with LP8551/LP8552/LP8556 ICs