leds: netxbig: set led_classdev max_brightness
This patch sets the led_classdev max_brightness to the maximum level value supported by hardware. This allows to get rid of the brightness conversion operation (from software [0:LED_FULL] to hardware ranges) in brightness_set(). Signed-off-by: Simon Guinot <simon.guinot@sequanux.org> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
This commit is contained in:
parent
cd0109555b
commit
7b9d9d8815
|
@ -116,7 +116,6 @@ struct netxbig_led_data {
|
||||||
int mode_addr;
|
int mode_addr;
|
||||||
int *mode_val;
|
int *mode_val;
|
||||||
int bright_addr;
|
int bright_addr;
|
||||||
int bright_max;
|
|
||||||
struct netxbig_led_timer *timer;
|
struct netxbig_led_timer *timer;
|
||||||
int num_timer;
|
int num_timer;
|
||||||
enum netxbig_led_mode mode;
|
enum netxbig_led_mode mode;
|
||||||
|
@ -178,7 +177,7 @@ static void netxbig_led_set(struct led_classdev *led_cdev,
|
||||||
struct netxbig_led_data *led_dat =
|
struct netxbig_led_data *led_dat =
|
||||||
container_of(led_cdev, struct netxbig_led_data, cdev);
|
container_of(led_cdev, struct netxbig_led_data, cdev);
|
||||||
enum netxbig_led_mode mode;
|
enum netxbig_led_mode mode;
|
||||||
int mode_val, bright_val;
|
int mode_val;
|
||||||
int set_brightness = 1;
|
int set_brightness = 1;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
@ -204,12 +203,9 @@ static void netxbig_led_set(struct led_classdev *led_cdev,
|
||||||
* SATA LEDs. So, change the brightness setting for a single
|
* SATA LEDs. So, change the brightness setting for a single
|
||||||
* SATA LED will affect all the others.
|
* SATA LED will affect all the others.
|
||||||
*/
|
*/
|
||||||
if (set_brightness) {
|
if (set_brightness)
|
||||||
bright_val = DIV_ROUND_UP(value * led_dat->bright_max,
|
|
||||||
LED_FULL);
|
|
||||||
gpio_ext_set_value(led_dat->gpio_ext,
|
gpio_ext_set_value(led_dat->gpio_ext,
|
||||||
led_dat->bright_addr, bright_val);
|
led_dat->bright_addr, value);
|
||||||
}
|
|
||||||
|
|
||||||
spin_unlock_irqrestore(&led_dat->lock, flags);
|
spin_unlock_irqrestore(&led_dat->lock, flags);
|
||||||
}
|
}
|
||||||
|
@ -306,11 +302,11 @@ static int create_netxbig_led(struct platform_device *pdev,
|
||||||
*/
|
*/
|
||||||
led_dat->sata = 0;
|
led_dat->sata = 0;
|
||||||
led_dat->cdev.brightness = LED_OFF;
|
led_dat->cdev.brightness = LED_OFF;
|
||||||
|
led_dat->cdev.max_brightness = template->bright_max;
|
||||||
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
|
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
|
||||||
led_dat->mode_addr = template->mode_addr;
|
led_dat->mode_addr = template->mode_addr;
|
||||||
led_dat->mode_val = template->mode_val;
|
led_dat->mode_val = template->mode_val;
|
||||||
led_dat->bright_addr = template->bright_addr;
|
led_dat->bright_addr = template->bright_addr;
|
||||||
led_dat->bright_max = template->bright_max;
|
|
||||||
led_dat->timer = pdata->timer;
|
led_dat->timer = pdata->timer;
|
||||||
led_dat->num_timer = pdata->num_timer;
|
led_dat->num_timer = pdata->num_timer;
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue