Commit 9d79a05e authored by Jacek Anaszewski's avatar Jacek Anaszewski

leds: ktd2692: Remove work queue

Now the core implements the work queue, remove it from the drivers,
and switch to using brightness_set_blocking op.
Signed-off-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
Cc: Ingi Kim <ingi2.kim@samsung.com>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
parent 269e92da
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/workqueue.h>
/* Value related the movie mode */ /* Value related the movie mode */
#define KTD2692_MOVIE_MODE_CURRENT_LEVELS 16 #define KTD2692_MOVIE_MODE_CURRENT_LEVELS 16
...@@ -82,7 +81,6 @@ struct ktd2692_context { ...@@ -82,7 +81,6 @@ struct ktd2692_context {
/* secures access to the device */ /* secures access to the device */
struct mutex lock; struct mutex lock;
struct regulator *regulator; struct regulator *regulator;
struct work_struct work_brightness_set;
struct gpio_desc *aux_gpio; struct gpio_desc *aux_gpio;
struct gpio_desc *ctrl_gpio; struct gpio_desc *ctrl_gpio;
...@@ -158,9 +156,12 @@ static void ktd2692_expresswire_write(struct ktd2692_context *led, u8 value) ...@@ -158,9 +156,12 @@ static void ktd2692_expresswire_write(struct ktd2692_context *led, u8 value)
ktd2692_expresswire_end(led); ktd2692_expresswire_end(led);
} }
static void ktd2692_brightness_set(struct ktd2692_context *led, static int ktd2692_led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness brightness) enum led_brightness brightness)
{ {
struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
struct ktd2692_context *led = fled_cdev_to_led(fled_cdev);
mutex_lock(&led->lock); mutex_lock(&led->lock);
if (brightness == LED_OFF) { if (brightness == LED_OFF) {
...@@ -174,33 +175,6 @@ static void ktd2692_brightness_set(struct ktd2692_context *led, ...@@ -174,33 +175,6 @@ static void ktd2692_brightness_set(struct ktd2692_context *led,
ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE); ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE);
mutex_unlock(&led->lock); mutex_unlock(&led->lock);
}
static void ktd2692_brightness_set_work(struct work_struct *work)
{
struct ktd2692_context *led =
container_of(work, struct ktd2692_context, work_brightness_set);
ktd2692_brightness_set(led, led->torch_brightness);
}
static void ktd2692_led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
struct ktd2692_context *led = fled_cdev_to_led(fled_cdev);
led->torch_brightness = brightness;
schedule_work(&led->work_brightness_set);
}
static int ktd2692_led_brightness_set_sync(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
struct ktd2692_context *led = fled_cdev_to_led(fled_cdev);
ktd2692_brightness_set(led, brightness);
return 0; return 0;
} }
...@@ -381,12 +355,10 @@ static int ktd2692_probe(struct platform_device *pdev) ...@@ -381,12 +355,10 @@ static int ktd2692_probe(struct platform_device *pdev)
fled_cdev->ops = &flash_ops; fled_cdev->ops = &flash_ops;
led_cdev->max_brightness = led_cfg.max_brightness; led_cdev->max_brightness = led_cfg.max_brightness;
led_cdev->brightness_set = ktd2692_led_brightness_set; led_cdev->brightness_set_blocking = ktd2692_led_brightness_set;
led_cdev->brightness_set_blocking = ktd2692_led_brightness_set_sync;
led_cdev->flags |= LED_CORE_SUSPENDRESUME | LED_DEV_CAP_FLASH; led_cdev->flags |= LED_CORE_SUSPENDRESUME | LED_DEV_CAP_FLASH;
mutex_init(&led->lock); mutex_init(&led->lock);
INIT_WORK(&led->work_brightness_set, ktd2692_brightness_set_work);
platform_set_drvdata(pdev, led); platform_set_drvdata(pdev, led);
...@@ -408,7 +380,6 @@ static int ktd2692_remove(struct platform_device *pdev) ...@@ -408,7 +380,6 @@ static int ktd2692_remove(struct platform_device *pdev)
int ret; int ret;
led_classdev_flash_unregister(&led->fled_cdev); led_classdev_flash_unregister(&led->fled_cdev);
cancel_work_sync(&led->work_brightness_set);
if (led->regulator) { if (led->regulator) {
ret = regulator_disable(led->regulator); ret = regulator_disable(led->regulator);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment