static int max77693_led_brightness_set_sync( struct led_classdev *led_cdev, enum led_brightness value) { struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); struct max77693_sub_led *sub_led = flcdev_to_sub_led(fled_cdev); struct max77693_led_device *led = sub_led_to_led(sub_led); return __max77693_led_brightness_set(led, sub_led->fled_id, value); }
static void max77693_led_brightness_set( struct led_classdev *led_cdev, enum led_brightness value) { struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); struct max77693_sub_led *sub_led = flcdev_to_sub_led(fled_cdev); sub_led->torch_brightness = value; schedule_work(&sub_led->work_brightness_set); }
/* LED subsystem callbacks */ static int max77693_led_brightness_set(struct led_classdev *led_cdev, enum led_brightness value) { struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev); struct max77693_sub_led *sub_led = flcdev_to_sub_led(fled_cdev); struct max77693_led_device *led = sub_led_to_led(sub_led); int fled_id = sub_led->fled_id, ret; mutex_lock(&led->lock); if (value == 0) { ret = max77693_clear_mode(led, MODE_TORCH(fled_id)); if (ret < 0) dev_dbg(&led->pdev->dev, "Failed to clear torch mode (%d)\n", ret); goto unlock; } ret = max77693_set_torch_current(led, fled_id, value * TORCH_IOUT_STEP); if (ret < 0) { dev_dbg(&led->pdev->dev, "Failed to set torch current (%d)\n", ret); goto unlock; } ret = max77693_add_mode(led, MODE_TORCH(fled_id)); if (ret < 0) dev_dbg(&led->pdev->dev, "Failed to set torch mode (%d)\n", ret); unlock: mutex_unlock(&led->lock); return ret; }
static struct gb_channel *get_channel_from_cdev(struct led_classdev *cdev) { struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(cdev); return container_of(fled_cdev, struct gb_channel, fled); }