Lines Matching +full:vled +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-only
3 * TI LP8860 4-Channel LED Driver
94 * @regulator: LED supply regulator pointer
143 mutex_lock(&led->lock); in lp8860_unlock_eeprom()
146 ret = regmap_write(led->regmap, in lp8860_unlock_eeprom()
150 dev_err(&led->client->dev, "EEPROM Unlock failed\n"); in lp8860_unlock_eeprom()
154 ret = regmap_write(led->regmap, in lp8860_unlock_eeprom()
158 dev_err(&led->client->dev, "EEPROM Unlock failed\n"); in lp8860_unlock_eeprom()
161 ret = regmap_write(led->regmap, in lp8860_unlock_eeprom()
165 dev_err(&led->client->dev, "EEPROM Unlock failed\n"); in lp8860_unlock_eeprom()
169 ret = regmap_write(led->regmap, in lp8860_unlock_eeprom()
175 mutex_unlock(&led->lock); in lp8860_unlock_eeprom()
184 ret = regmap_read(led->regmap, LP8860_LED_FAULT, &read_buf); in lp8860_fault_check()
190 ret = regmap_read(led->regmap, LP8860_FAULT, &read_buf); in lp8860_fault_check()
198 ret = regmap_write(led->regmap, LP8860_FAULT_CLEAR, in lp8860_fault_check()
212 mutex_lock(&led->lock); in lp8860_brightness_set()
216 dev_err(&led->client->dev, "Cannot read/clear faults\n"); in lp8860_brightness_set()
220 ret = regmap_write(led->regmap, LP8860_DISP_CL1_BRT_MSB, in lp8860_brightness_set()
223 dev_err(&led->client->dev, "Cannot write CL1 MSB\n"); in lp8860_brightness_set()
227 ret = regmap_write(led->regmap, LP8860_DISP_CL1_BRT_LSB, in lp8860_brightness_set()
230 dev_err(&led->client->dev, "Cannot write CL1 LSB\n"); in lp8860_brightness_set()
234 mutex_unlock(&led->lock); in lp8860_brightness_set()
243 if (led->regulator) { in lp8860_init()
244 ret = regulator_enable(led->regulator); in lp8860_init()
246 dev_err(&led->client->dev, in lp8860_init()
252 gpiod_direction_output(led->enable_gpio, 1); in lp8860_init()
258 ret = regmap_read(led->regmap, LP8860_STATUS, &read_buf); in lp8860_init()
264 dev_err(&led->client->dev, "Failed unlocking EEPROM\n"); in lp8860_init()
270 ret = regmap_write(led->eeprom_regmap, in lp8860_init()
274 dev_err(&led->client->dev, "Failed writing EEPROM\n"); in lp8860_init()
283 ret = regmap_write(led->regmap, in lp8860_init()
287 dev_err(&led->client->dev, "Failed programming EEPROM\n"); in lp8860_init()
295 gpiod_direction_output(led->enable_gpio, 0); in lp8860_init()
297 if (led->regulator) { in lp8860_init()
298 ret = regulator_disable(led->regulator); in lp8860_init()
300 dev_err(&led->client->dev, in lp8860_init()
379 struct device_node *np = dev_of_node(&client->dev); in lp8860_probe()
383 led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); in lp8860_probe()
385 return -ENOMEM; in lp8860_probe()
389 return -EINVAL; in lp8860_probe()
391 led->enable_gpio = devm_gpiod_get_optional(&client->dev, in lp8860_probe()
393 if (IS_ERR(led->enable_gpio)) { in lp8860_probe()
394 ret = PTR_ERR(led->enable_gpio); in lp8860_probe()
395 dev_err(&client->dev, "Failed to get enable gpio: %d\n", ret); in lp8860_probe()
399 led->regulator = devm_regulator_get(&client->dev, "vled"); in lp8860_probe()
400 if (IS_ERR(led->regulator)) in lp8860_probe()
401 led->regulator = NULL; in lp8860_probe()
403 led->client = client; in lp8860_probe()
404 led->led_dev.brightness_set_blocking = lp8860_brightness_set; in lp8860_probe()
406 mutex_init(&led->lock); in lp8860_probe()
410 led->regmap = devm_regmap_init_i2c(client, &lp8860_regmap_config); in lp8860_probe()
411 if (IS_ERR(led->regmap)) { in lp8860_probe()
412 ret = PTR_ERR(led->regmap); in lp8860_probe()
413 dev_err(&client->dev, "Failed to allocate register map: %d\n", in lp8860_probe()
418 led->eeprom_regmap = devm_regmap_init_i2c(client, &lp8860_eeprom_regmap_config); in lp8860_probe()
419 if (IS_ERR(led->eeprom_regmap)) { in lp8860_probe()
420 ret = PTR_ERR(led->eeprom_regmap); in lp8860_probe()
421 dev_err(&client->dev, "Failed to allocate register map: %d\n", in lp8860_probe()
434 ret = devm_led_classdev_register_ext(&client->dev, &led->led_dev, in lp8860_probe()
437 dev_err(&client->dev, "led register err: %d\n", ret); in lp8860_probe()
449 gpiod_direction_output(led->enable_gpio, 0); in lp8860_remove()
451 if (led->regulator) { in lp8860_remove()
452 ret = regulator_disable(led->regulator); in lp8860_remove()
454 dev_err(&led->client->dev, in lp8860_remove()
458 mutex_destroy(&led->lock); in lp8860_remove()