Skip to content

Commit 135780f

Browse files
z3ntupavelmachek
authored andcommitted
leds: is31fl319x: Fix setting current limit for is31fl319{0,1,3}
The current setting lives in bits 4:2 (as also defined by the mask) but the current limit defines in the driver use bits 2:0 which should be shifted over so they don't get masked out completely (except for 17.5mA which became 10mA). Now checking /sys/kernel/debug/regmap/1-0068/registers shows that the current limit is applied correctly and doesn't take the default b000 = 42mA. Fixes: fa877cf ("leds: is31fl319x: Add support for is31fl319{0,1,3} chips") Signed-off-by: Luca Weiss <[email protected]> Reviewed-by: Vincent Knecht <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
1 parent 447242e commit 135780f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/leds/leds-is31fl319x.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define IS31FL3190_CURRENT_uA_MIN 5000
3939
#define IS31FL3190_CURRENT_uA_DEFAULT 42000
4040
#define IS31FL3190_CURRENT_uA_MAX 42000
41+
#define IS31FL3190_CURRENT_SHIFT 2
4142
#define IS31FL3190_CURRENT_MASK GENMASK(4, 2)
4243
#define IS31FL3190_CURRENT_5_mA 0x02
4344
#define IS31FL3190_CURRENT_10_mA 0x01
@@ -553,7 +554,7 @@ static int is31fl319x_probe(struct i2c_client *client)
553554
is31fl3196_db_to_gain(is31->audio_gain_db));
554555
else
555556
regmap_update_bits(is31->regmap, IS31FL3190_CURRENT, IS31FL3190_CURRENT_MASK,
556-
is31fl3190_microamp_to_cs(dev, aggregated_led_microamp));
557+
is31fl3190_microamp_to_cs(dev, aggregated_led_microamp) << IS31FL3190_CURRENT_SHIFT);
557558

558559
for (i = 0; i < is31->cdef->num_leds; i++) {
559560
struct is31fl319x_led *led = &is31->leds[i];

0 commit comments

Comments
 (0)