On Tue, 10 Dec 2024, Gerecke, Jason wrote: > From: Jason Gerecke <jason.gerecke@xxxxxxxxx> > > Assigning a non-standard brightness value to an LED can cause the value > to slowly drift downward over time as the effects of integer division > accumulate. Each time that an LED is triggered, a series of set and get > calls occur. For example, if we assume a tablet with max_hlv = 100, then > when brightness is set to "200" through sysfs, the hlv value written to > hardware will be `200*100/255 = 78`. If the LED trigger is later activated, > the hlv value will be used to determine the brightness: `78*255/100 = 198`. > This lower brightness then used to set the brightness of the next LED. > However, `198*100/255 = 77`, so the next LED ends up slightly dimmer. > Each subsequent trigger activation will cause the brightness to continue > drifting down until we reach a point where the result of integer divsion > does not introduce any new error. > > This commit corrects the issue by being more careful about how we handle > scaling between the two ranges (0..max_{h,l}lv) and (0..LED_FULL). > > Signed-off-by: Jason Gerecke <jason.gerecke@xxxxxxxxx> Both applied, thanks. -- Jiri Kosina SUSE Labs