mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
media: v4l2-flash-led-class: Create separate sub-devices for indicators
The V4L2 flash interface allows controlling multiple LEDs through a single sub-devices if, and only if, these LEDs are of different types. This approach scales badly for flash controllers that drive multiple flash LEDs or for LED specific associations. Essentially, the original assumption of a LED driver chip that drives a single flash LED and an indicator LED is no longer valid. Address the matter by registering one sub-device per LED. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Jacek Anaszewski <[email protected]> Acked-by: Pavel Machek <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> (for greybus/light) Acked-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
parent
428359cbfe
commit
503dd28af1
5 changed files with 117 additions and 67 deletions
|
|
@ -432,7 +432,7 @@ static void aat1290_init_v4l2_flash_config(struct aat1290_led *led,
|
|||
strlcpy(v4l2_sd_cfg->dev_name, led_cdev->name,
|
||||
sizeof(v4l2_sd_cfg->dev_name));
|
||||
|
||||
s = &v4l2_sd_cfg->torch_intensity;
|
||||
s = &v4l2_sd_cfg->intensity;
|
||||
s->min = led->mm_current_scale[0];
|
||||
s->max = led_cfg->max_mm_current;
|
||||
s->step = 1;
|
||||
|
|
@ -504,7 +504,7 @@ static int aat1290_led_probe(struct platform_device *pdev)
|
|||
|
||||
/* Create V4L2 Flash subdev. */
|
||||
led->v4l2_flash = v4l2_flash_init(dev, of_fwnode_handle(sub_node),
|
||||
fled_cdev, NULL, &v4l2_flash_ops,
|
||||
fled_cdev, &v4l2_flash_ops,
|
||||
&v4l2_sd_cfg);
|
||||
if (IS_ERR(led->v4l2_flash)) {
|
||||
ret = PTR_ERR(led->v4l2_flash);
|
||||
|
|
|
|||
|
|
@ -856,7 +856,7 @@ static void max77693_init_v4l2_flash_config(struct max77693_sub_led *sub_led,
|
|||
"%s %d-%04x", sub_led->fled_cdev.led_cdev.name,
|
||||
i2c_adapter_id(i2c->adapter), i2c->addr);
|
||||
|
||||
s = &v4l2_sd_cfg->torch_intensity;
|
||||
s = &v4l2_sd_cfg->intensity;
|
||||
s->min = TORCH_IOUT_MIN;
|
||||
s->max = sub_led->fled_cdev.led_cdev.max_brightness * TORCH_IOUT_STEP;
|
||||
s->step = TORCH_IOUT_STEP;
|
||||
|
|
@ -931,7 +931,7 @@ static int max77693_register_led(struct max77693_sub_led *sub_led,
|
|||
|
||||
/* Register in the V4L2 subsystem. */
|
||||
sub_led->v4l2_flash = v4l2_flash_init(dev, of_fwnode_handle(sub_node),
|
||||
fled_cdev, NULL, &v4l2_flash_ops,
|
||||
fled_cdev, &v4l2_flash_ops,
|
||||
&v4l2_sd_cfg);
|
||||
if (IS_ERR(sub_led->v4l2_flash)) {
|
||||
ret = PTR_ERR(sub_led->v4l2_flash);
|
||||
|
|
|
|||
Loading…
Reference in a new issue