Skip to content

Commit a2cafdf

Browse files
Jean-Jacques Hiblotpavelmachek
authored andcommitted
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: e370d01 ("leds: tlc591xx: Driver for the TI 8/16 Channel i2c LED driver") Signed-off-by: Jean-Jacques Hiblot <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
1 parent da61a66 commit a2cafdf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/leds/leds-tlc591xx.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/slab.h>
1414

1515
#define TLC591XX_MAX_LEDS 16
16+
#define TLC591XX_MAX_BRIGHTNESS 256
1617

1718
#define TLC591XX_REG_MODE1 0x00
1819
#define MODE1_RESPON_ADDR_MASK 0xF0
@@ -112,11 +113,11 @@ tlc591xx_brightness_set(struct led_classdev *led_cdev,
112113
struct tlc591xx_priv *priv = led->priv;
113114
int err;
114115

115-
switch (brightness) {
116+
switch ((int)brightness) {
116117
case 0:
117118
err = tlc591xx_set_ledout(priv, led, LEDOUT_OFF);
118119
break;
119-
case LED_FULL:
120+
case TLC591XX_MAX_BRIGHTNESS:
120121
err = tlc591xx_set_ledout(priv, led, LEDOUT_ON);
121122
break;
122123
default:
@@ -209,7 +210,7 @@ tlc591xx_probe(struct i2c_client *client,
209210
led->priv = priv;
210211
led->led_no = reg;
211212
led->ldev.brightness_set_blocking = tlc591xx_brightness_set;
212-
led->ldev.max_brightness = LED_FULL;
213+
led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS;
213214
err = devm_led_classdev_register_ext(dev, &led->ldev,
214215
&init_data);
215216
if (err < 0) {

0 commit comments

Comments
 (0)