Commit a2cafdfd authored by Jean-Jacques Hiblot's avatar Jean-Jacques Hiblot Committed by Pavel

leds: tlc591xx: update the maximum brightness

The TLC chips actually offer 257 levels:
- 0: led OFF
- 1-255: Led dimmed is using a PWM. The duty cycle range from 0.4% to 99.6%
- 256: led fully ON

Fixes: e370d010 ("leds: tlc591xx: Driver for the TI 8/16 Channel i2c LED driver")
Signed-off-by: default avatarJean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent da61a66a
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#define TLC591XX_MAX_LEDS 16 #define TLC591XX_MAX_LEDS 16
#define TLC591XX_MAX_BRIGHTNESS 256
#define TLC591XX_REG_MODE1 0x00 #define TLC591XX_REG_MODE1 0x00
#define MODE1_RESPON_ADDR_MASK 0xF0 #define MODE1_RESPON_ADDR_MASK 0xF0
...@@ -112,11 +113,11 @@ tlc591xx_brightness_set(struct led_classdev *led_cdev, ...@@ -112,11 +113,11 @@ tlc591xx_brightness_set(struct led_classdev *led_cdev,
struct tlc591xx_priv *priv = led->priv; struct tlc591xx_priv *priv = led->priv;
int err; int err;
switch (brightness) { switch ((int)brightness) {
case 0: case 0:
err = tlc591xx_set_ledout(priv, led, LEDOUT_OFF); err = tlc591xx_set_ledout(priv, led, LEDOUT_OFF);
break; break;
case LED_FULL: case TLC591XX_MAX_BRIGHTNESS:
err = tlc591xx_set_ledout(priv, led, LEDOUT_ON); err = tlc591xx_set_ledout(priv, led, LEDOUT_ON);
break; break;
default: default:
...@@ -209,7 +210,7 @@ tlc591xx_probe(struct i2c_client *client, ...@@ -209,7 +210,7 @@ tlc591xx_probe(struct i2c_client *client,
led->priv = priv; led->priv = priv;
led->led_no = reg; led->led_no = reg;
led->ldev.brightness_set_blocking = tlc591xx_brightness_set; led->ldev.brightness_set_blocking = tlc591xx_brightness_set;
led->ldev.max_brightness = LED_FULL; led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS;
err = devm_led_classdev_register_ext(dev, &led->ldev, err = devm_led_classdev_register_ext(dev, &led->ldev,
&init_data); &init_data);
if (err < 0) { if (err < 0) {
......
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