10 #include <linux/module.h>
11 #include <linux/slab.h>
12 #include <linux/i2c.h>
22 #define REG_DEV_ID 0x00
23 #define REG_CHECKSUM 0x01
24 #define REG_BL_CONF_1 0x02
25 #define REG_BL_CONF_2 0x03
26 #define REG_BL_CONF_3 0x04
27 #define REG_BL_CONF_4 0x05
28 #define REG_FL_CONF_1 0x06
29 #define REG_FL_CONF_2 0x07
30 #define REG_FL_CONF_3 0x08
31 #define REG_IO_CTRL 0x09
32 #define REG_ENABLE 0x0A
34 #define REG_MAX REG_FLAG
90 dev_err(pchip->
dev,
"i2c failed to access register\n");
107 dev_info(pchip->
dev,
"last flag is 0x%x\n", reg_val);
116 "No pwm control func. in plat-data\n");
117 return bl->
props.brightness;
128 if (!bl->
props.brightness)
135 return bl->
props.brightness;
137 dev_err(pchip->
dev,
"i2c failed to access registers\n");
138 return bl->
props.brightness;
153 "No pwm control func. in plat-data\n");
154 return bl->
props.brightness;
168 return bl->
props.brightness;
170 dev_err(pchip->
dev,
"i2c failed to access register\n");
171 return bl->
props.brightness;
176 .update_status = lm3639_bled_update_status,
177 .get_brightness = lm3639_bled_get_brightness,
208 dev_err(pchip->
dev,
"%s:i2c access fail to register\n", __func__);
212 dev_err(pchip->
dev,
"%s:input conversion fail\n", __func__);
233 dev_info(pchip->
dev,
"last flag is 0x%x\n", reg_val);
253 dev_err(pchip->
dev,
"i2c failed to access register\n");
258 static void lm3639_flash_brightness_set(
struct led_classdev *cdev,
271 dev_info(pchip->
dev,
"last flag is 0x%x\n", reg_val);
292 dev_err(pchip->
dev,
"i2c failed to access register\n");
296 static const struct regmap_config lm3639_regmap = {
311 dev_err(&client->
dev,
"i2c functionality check fail.\n");
316 dev_err(&client->
dev,
"Needs Platform Data.\n");
326 pchip->
dev = &client->
dev;
329 if (IS_ERR(pchip->
regmap)) {
330 ret = PTR_ERR(pchip->
regmap);
331 dev_err(&client->
dev,
"fail : allocate register map: %d\n",
335 i2c_set_clientdata(client, pchip);
338 ret = lm3639_chip_init(pchip);
350 &lm3639_bled_ops, &props);
351 if (IS_ERR(pchip->
bled)) {
352 dev_err(&client->
dev,
"fail : backlight register\n");
359 dev_err(&client->
dev,
"failed : add sysfs entries\n");
367 pchip->
cdev_flash.brightness_set = lm3639_flash_brightness_set;
371 dev_err(&client->
dev,
"fail : flash register\n");
379 pchip->
cdev_torch.brightness_set = lm3639_torch_brightness_set;
383 dev_err(&client->
dev,
"fail : torch register\n");
423 static struct i2c_driver lm3639_i2c_driver = {
427 .probe = lm3639_probe,
429 .id_table = lm3639_id,