Skip to content

Commit

Permalink
WIP: leds: tm1628: Optimize dirty-byte tracking
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Sep 16, 2020
1 parent 501557b commit 46c4020
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/leds/leds-tm1628.c
Expand Up @@ -261,7 +261,7 @@ static int tm1628_get_led(struct tm1628 *s,
}

static int tm1628_set_led(struct tm1628 *s,
unsigned int grid, unsigned int seg, bool on)
unsigned int grid, unsigned int seg, bool on, int *poffset)
{
int offset, bit;
int ret;
Expand All @@ -275,6 +275,10 @@ static int tm1628_set_led(struct tm1628 *s,
else
s->data[offset] &= ~BIT(bit);


if (poffset)
*poffset = offset;

return 0;
}

Expand All @@ -285,14 +289,10 @@ static int tm1628_led_set_brightness(struct led_classdev *led_cdev,
struct tm1628 *s = led->ctrl;
int ret, offset;

ret = tm1628_set_led(s, led->grid, led->seg, brightness != LED_OFF);
ret = tm1628_set_led(s, led->grid, led->seg, brightness != LED_OFF, &offset);
if (ret)
return ret;

ret = tm1628_get_led_offset(s, led->grid, led->seg, &offset, NULL);
if (unlikely(ret))
return ret;

ret = tm1628_set_address(s->spi, offset);
if (ret)
return ret;
Expand Down Expand Up @@ -371,7 +371,7 @@ static int tm1628_display_apply_map(struct tm1628 *s,

for (i = 0; i < 8; i++) {
segment = &display->segments[i];
tm1628_set_led(s, segment->grid, segment->seg, map & BIT(i));
tm1628_set_led(s, segment->grid, segment->seg, map & BIT(i), NULL);
}

return 0;
Expand Down

0 comments on commit 46c4020

Please sign in to comment.