Searched refs:lm3533 (Results 1 - 7 of 7) sorted by relevance

/linux-4.1.27/drivers/mfd/
H A Dlm3533-core.c2 * lm3533-core.c -- LM3533 Core
26 #include <linux/mfd/lm3533.h>
52 .name = "lm3533-als",
59 .name = "lm3533-backlight",
63 .name = "lm3533-backlight",
70 .name = "lm3533-leds",
74 .name = "lm3533-leds",
78 .name = "lm3533-leds",
82 .name = "lm3533-leds",
87 int lm3533_read(struct lm3533 *lm3533, u8 reg, u8 *val) lm3533_read() argument
92 ret = regmap_read(lm3533->regmap, reg, &tmp); lm3533_read()
94 dev_err(lm3533->dev, "failed to read register %02x: %d\n", lm3533_read()
101 dev_dbg(lm3533->dev, "read [%02x]: %02x\n", reg, *val); lm3533_read()
107 int lm3533_write(struct lm3533 *lm3533, u8 reg, u8 val) lm3533_write() argument
111 dev_dbg(lm3533->dev, "write [%02x]: %02x\n", reg, val); lm3533_write()
113 ret = regmap_write(lm3533->regmap, reg, val); lm3533_write()
115 dev_err(lm3533->dev, "failed to write register %02x: %d\n", lm3533_write()
123 int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask) lm3533_update() argument
127 dev_dbg(lm3533->dev, "update [%02x]: %02x/%02x\n", reg, val, mask); lm3533_update()
129 ret = regmap_update_bits(lm3533->regmap, reg, mask, val); lm3533_update()
131 dev_err(lm3533->dev, "failed to update register %02x: %d\n", lm3533_update()
139 static int lm3533_set_boost_freq(struct lm3533 *lm3533, lm3533_set_boost_freq() argument
144 ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM, lm3533_set_boost_freq()
148 dev_err(lm3533->dev, "failed to set boost frequency\n"); lm3533_set_boost_freq()
154 static int lm3533_set_boost_ovp(struct lm3533 *lm3533, lm3533_set_boost_ovp() argument
159 ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM, lm3533_set_boost_ovp()
163 dev_err(lm3533->dev, "failed to set boost ovp\n"); lm3533_set_boost_ovp()
171 static int lm3533_set_hvled_config(struct lm3533 *lm3533, u8 hvled, u8 bl) lm3533_set_hvled_config() argument
188 ret = lm3533_update(lm3533, LM3533_REG_OUTPUT_CONF1, val, mask); lm3533_set_hvled_config()
190 dev_err(lm3533->dev, "failed to set hvled config\n"); lm3533_set_hvled_config()
198 static int lm3533_set_lvled_config(struct lm3533 *lm3533, u8 lvled, u8 led) lm3533_set_lvled_config() argument
223 ret = lm3533_update(lm3533, reg, val, mask); lm3533_set_lvled_config()
225 dev_err(lm3533->dev, "failed to set lvled config\n"); lm3533_set_lvled_config()
230 static void lm3533_enable(struct lm3533 *lm3533) lm3533_enable() argument
232 if (gpio_is_valid(lm3533->gpio_hwen)) lm3533_enable()
233 gpio_set_value(lm3533->gpio_hwen, 1); lm3533_enable()
236 static void lm3533_disable(struct lm3533 *lm3533) lm3533_disable() argument
238 if (gpio_is_valid(lm3533->gpio_hwen)) lm3533_disable()
239 gpio_set_value(lm3533->gpio_hwen, 0); lm3533_disable()
263 struct lm3533 *lm3533 = dev_get_drvdata(dev); show_output() local
287 ret = lm3533_read(lm3533, reg, &val); show_output()
300 struct lm3533 *lm3533 = dev_get_drvdata(dev); store_output() local
310 ret = lm3533_set_hvled_config(lm3533, id, val); store_output()
312 ret = lm3533_set_lvled_config(lm3533, id, val); store_output()
366 struct lm3533 *lm3533 = dev_get_drvdata(dev); lm3533_attr_is_visible() local
372 if (!lm3533->have_backlights && type == LM3533_ATTR_TYPE_BACKLIGHT) lm3533_attr_is_visible()
374 else if (!lm3533->have_leds && type == LM3533_ATTR_TYPE_LED) lm3533_attr_is_visible()
385 static int lm3533_device_als_init(struct lm3533 *lm3533) lm3533_device_als_init() argument
387 struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev); lm3533_device_als_init()
396 ret = mfd_add_devices(lm3533->dev, 0, lm3533_als_devs, 1, NULL, lm3533_device_als_init()
399 dev_err(lm3533->dev, "failed to add ALS device\n"); lm3533_device_als_init()
403 lm3533->have_als = 1; lm3533_device_als_init()
408 static int lm3533_device_bl_init(struct lm3533 *lm3533) lm3533_device_bl_init() argument
410 struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev); lm3533_device_bl_init()
425 ret = mfd_add_devices(lm3533->dev, 0, lm3533_bl_devs, lm3533_device_bl_init()
428 dev_err(lm3533->dev, "failed to add backlight devices\n"); lm3533_device_bl_init()
432 lm3533->have_backlights = 1; lm3533_device_bl_init()
437 static int lm3533_device_led_init(struct lm3533 *lm3533) lm3533_device_led_init() argument
439 struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev); lm3533_device_led_init()
454 ret = mfd_add_devices(lm3533->dev, 0, lm3533_led_devs, lm3533_device_led_init()
457 dev_err(lm3533->dev, "failed to add LED devices\n"); lm3533_device_led_init()
461 lm3533->have_leds = 1; lm3533_device_led_init()
466 static int lm3533_device_setup(struct lm3533 *lm3533, lm3533_device_setup() argument
471 ret = lm3533_set_boost_freq(lm3533, pdata->boost_freq); lm3533_device_setup()
475 ret = lm3533_set_boost_ovp(lm3533, pdata->boost_ovp); lm3533_device_setup()
482 static int lm3533_device_init(struct lm3533 *lm3533) lm3533_device_init() argument
484 struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev); lm3533_device_init()
487 dev_dbg(lm3533->dev, "%s\n", __func__); lm3533_device_init()
490 dev_err(lm3533->dev, "no platform data\n"); lm3533_device_init()
494 lm3533->gpio_hwen = pdata->gpio_hwen; lm3533_device_init()
496 dev_set_drvdata(lm3533->dev, lm3533); lm3533_device_init()
498 if (gpio_is_valid(lm3533->gpio_hwen)) { lm3533_device_init()
499 ret = devm_gpio_request_one(lm3533->dev, lm3533->gpio_hwen, lm3533_device_init()
500 GPIOF_OUT_INIT_LOW, "lm3533-hwen"); lm3533_device_init()
502 dev_err(lm3533->dev, lm3533_device_init()
504 lm3533->gpio_hwen); lm3533_device_init()
509 lm3533_enable(lm3533); lm3533_device_init()
511 ret = lm3533_device_setup(lm3533, pdata); lm3533_device_init()
515 lm3533_device_als_init(lm3533); lm3533_device_init()
516 lm3533_device_bl_init(lm3533); lm3533_device_init()
517 lm3533_device_led_init(lm3533); lm3533_device_init()
519 ret = sysfs_create_group(&lm3533->dev->kobj, &lm3533_attribute_group); lm3533_device_init()
521 dev_err(lm3533->dev, "failed to create sysfs attributes\n"); lm3533_device_init()
528 mfd_remove_devices(lm3533->dev); lm3533_device_init()
530 lm3533_disable(lm3533); lm3533_device_init()
535 static void lm3533_device_exit(struct lm3533 *lm3533) lm3533_device_exit() argument
537 dev_dbg(lm3533->dev, "%s\n", __func__); lm3533_device_exit()
539 sysfs_remove_group(&lm3533->dev->kobj, &lm3533_attribute_group); lm3533_device_exit()
541 mfd_remove_devices(lm3533->dev); lm3533_device_exit()
542 lm3533_disable(lm3533); lm3533_device_exit()
598 struct lm3533 *lm3533; lm3533_i2c_probe() local
603 lm3533 = devm_kzalloc(&i2c->dev, sizeof(*lm3533), GFP_KERNEL); lm3533_i2c_probe()
604 if (!lm3533) lm3533_i2c_probe()
607 i2c_set_clientdata(i2c, lm3533); lm3533_i2c_probe()
609 lm3533->regmap = devm_regmap_init_i2c(i2c, &regmap_config); lm3533_i2c_probe()
610 if (IS_ERR(lm3533->regmap)) lm3533_i2c_probe()
611 return PTR_ERR(lm3533->regmap); lm3533_i2c_probe()
613 lm3533->dev = &i2c->dev; lm3533_i2c_probe()
614 lm3533->irq = i2c->irq; lm3533_i2c_probe()
616 ret = lm3533_device_init(lm3533); lm3533_i2c_probe()
625 struct lm3533 *lm3533 = i2c_get_clientdata(i2c); lm3533_i2c_remove() local
629 lm3533_device_exit(lm3533); lm3533_i2c_remove()
635 { "lm3533", 0 },
642 .name = "lm3533",
H A Dlm3533-ctrlbank.c2 * lm3533-ctrlbank.c -- LM3533 Generic Control Bank interface
17 #include <linux/mfd/lm3533.h>
46 ret = lm3533_update(cb->lm3533, LM3533_REG_CTRLBANK_ENABLE, lm3533_ctrlbank_enable()
63 ret = lm3533_update(cb->lm3533, LM3533_REG_CTRLBANK_ENABLE, 0, mask); lm3533_ctrlbank_disable()
88 ret = lm3533_write(cb->lm3533, reg, val); lm3533_ctrlbank_set_max_current()
106 ret = lm3533_write(cb->lm3533, reg, val); \
121 ret = lm3533_read(cb->lm3533, reg, val); \
H A DMakefile172 obj-$(CONFIG_MFD_LM3533) += lm3533-core.o lm3533-ctrlbank.o
/linux-4.1.27/include/linux/mfd/
H A Dlm3533.h2 * lm3533.h -- LM3533 interface
25 struct lm3533 { struct
39 struct lm3533 *lm3533; member in struct:lm3533_ctrlbank
100 extern int lm3533_read(struct lm3533 *lm3533, u8 reg, u8 *val);
101 extern int lm3533_write(struct lm3533 *lm3533, u8 reg, u8 val);
102 extern int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask);
/linux-4.1.27/drivers/video/backlight/
H A Dlm3533_bl.c2 * lm3533-bl.c -- LM3533 Backlight driver
21 #include <linux/mfd/lm3533.h>
31 struct lm3533 *lm3533; member in struct:lm3533_bl
101 ret = lm3533_read(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, &val); show_als_en()
132 ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, val, store_als_en()
149 ret = lm3533_read(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, &val); show_linear()
183 ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, val, store_linear()
248 if (!bl->lm3533->have_als) lm3533_bl_attr_is_visible()
274 struct lm3533 *lm3533; lm3533_bl_probe() local
283 lm3533 = dev_get_drvdata(pdev->dev.parent); lm3533_bl_probe()
284 if (!lm3533) lm3533_bl_probe()
302 bl->lm3533 = lm3533; lm3533_bl_probe()
305 bl->cb.lm3533 = lm3533; lm3533_bl_probe()
399 .name = "lm3533-backlight",
411 MODULE_ALIAS("platform:lm3533-backlight");
/linux-4.1.27/drivers/iio/light/
H A Dlm3533-als.c2 * lm3533-als.c -- LM3533 Ambient Light Sensor driver
27 #include <linux/mfd/lm3533.h>
55 struct lm3533 *lm3533; member in struct:lm3533_als
79 ret = lm3533_read(als->lm3533, reg, &val); lm3533_als_get_adc()
96 ret = lm3533_read(als->lm3533, LM3533_REG_ALS_ZONE_INFO, &val); _lm3533_als_get_zone()
147 ret = lm3533_read(als->lm3533, reg, val); lm3533_als_get_target()
168 ret = lm3533_write(als->lm3533, reg, val); lm3533_als_set_target()
287 ret = lm3533_update(als->lm3533, LM3533_REG_ALS_ZONE_INFO, val, mask); lm3533_als_set_int_mode()
304 ret = lm3533_read(als->lm3533, LM3533_REG_ALS_ZONE_INFO, &val); lm3533_als_get_int_mode()
333 ret = lm3533_read(als->lm3533, reg, val); lm3533_als_get_threshold()
355 ret = lm3533_read(als->lm3533, reg2, &val2); lm3533_als_set_threshold()
370 ret = lm3533_write(als->lm3533, reg, val); lm3533_als_set_threshold()
732 ret = lm3533_update(als->lm3533, LM3533_REG_ALS_CONF, val, mask); lm3533_als_set_input_mode()
749 ret = lm3533_write(als->lm3533, LM3533_REG_ALS_RESISTOR_SELECT, val); lm3533_als_set_resistor()
783 ret = lm3533_update(als->lm3533, LM3533_REG_ALS_ZONE_INFO, 0, mask); lm3533_als_setup_irq()
806 ret = lm3533_update(als->lm3533, LM3533_REG_ALS_CONF, mask, mask); lm3533_als_enable()
818 ret = lm3533_update(als->lm3533, LM3533_REG_ALS_CONF, 0, mask); lm3533_als_disable()
834 struct lm3533 *lm3533; lm3533_als_probe() local
840 lm3533 = dev_get_drvdata(pdev->dev.parent); lm3533_als_probe()
841 if (!lm3533) lm3533_als_probe()
862 als->lm3533 = lm3533; lm3533_als_probe()
864 als->irq = lm3533->irq; lm3533_als_probe()
917 .name = "lm3533-als",
927 MODULE_ALIAS("platform:lm3533-als");
/linux-4.1.27/drivers/leds/
H A Dleds-lm3533.c2 * leds-lm3533.c -- LM3533 LED driver
22 #include <linux/mfd/lm3533.h>
49 struct lm3533 *lm3533; member in struct:lm3533_led
112 ret = lm3533_update(led->lm3533, LM3533_REG_PATTERN_ENABLE, val, mask); lm3533_led_pattern_enable()
280 ret = lm3533_write(led->lm3533, reg, val); lm3533_led_delay_set()
361 ret = lm3533_read(led->lm3533, reg, &val); show_risefalltime()
396 ret = lm3533_write(led->lm3533, reg, val); store_risefalltime()
430 ret = lm3533_read(led->lm3533, reg, &val); show_als_channel()
462 ret = lm3533_update(led->lm3533, reg, val, mask); store_als_channel()
480 ret = lm3533_read(led->lm3533, reg, &val); show_als_en()
512 ret = lm3533_update(led->lm3533, reg, val, mask); store_als_en()
530 ret = lm3533_read(led->lm3533, reg, &val); show_linear()
565 ret = lm3533_update(led->lm3533, reg, val, mask); store_linear()
636 if (!led->lm3533->have_als) lm3533_led_attr_is_visible()
667 struct lm3533 *lm3533; lm3533_led_probe() local
674 lm3533 = dev_get_drvdata(pdev->dev.parent); lm3533_led_probe()
675 if (!lm3533) lm3533_led_probe()
693 led->lm3533 = lm3533; lm3533_led_probe()
710 led->cb.lm3533 = lm3533; lm3533_led_probe()
712 led->cb.dev = lm3533->dev; lm3533_led_probe()
768 .name = "lm3533-leds",
779 MODULE_ALIAS("platform:lm3533-leds");

Completed in 324 milliseconds