From: Helge D. <de...@gm...> - 2008-01-06 14:30:53
|
Every write to the backlight control sysfs entries like (on a Sharp Zaurus Poodle): - /sys/class/backlight/locomo-bl/power - /sys/class/backlight/locomo-bl/brightness triggers a call of backlight_update_status(), even if the same value is written multiple times in row into those entries. In principle this is not critical, but e.g. on the SHARP Poodle everytime backlight_update_status() is called, a lot of registers are reset and this leads to screen distortions of a ~ 0.4 seconds time frame. Esp. tools like some light control programs with controlling sliders for the light intensity happen to set those values more often which is really annoying and makes it nearly impossible to use them because the reaction time is really slow and you see lots of screen distortions. The trivial patch below avoids this problem by comparing the new value with the already set value. In case they are the same, it just avoids to call backlight_update_status() again. It would be great if this patch could be applied to the fbdev git tree for inclusion in later linux kernels. Signed-off-by: Helge Deller <de...@gm...> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 4840fe2..3939475 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -94,8 +94,10 @@ static ssize_t backlight_store_power(struct device *dev, mutex_lock(&bd->ops_lock); if (bd->ops) { pr_debug("backlight: set power to %d\n", power); - bd->props.power = power; - backlight_update_status(bd); + if (bd->props.power != power) { + bd->props.power = power; + backlight_update_status(bd); + } rc = count; } mutex_unlock(&bd->ops_lock); @@ -132,8 +134,10 @@ static ssize_t backlight_store_brightness(struct device *dev, else { pr_debug("backlight: set brightness to %d\n", brightness); - bd->props.brightness = brightness; - backlight_update_status(bd); + if (bd->props.brightness != brightness) { + bd->props.brightness = brightness; + backlight_update_status(bd); + } rc = count; } } |