Re: [PATCH] platform/x86: x86-android-tablets: Adjust Xiaomi Pad 2 bottom bezel touch buttons LED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 9/16/24 2:05 PM, Andy Shevchenko wrote:
> On Mon, Sep 16, 2024 at 11:02:55AM +0200, Hans de Goede wrote:
>> The "input-events" LED trigger used to turn on the backlight LEDs had to
>> be rewritten to use led_trigger_register_simple() + led_trigger_event()
>> to fix a serious locking issue.
>>
>> This means it no longer supports using blink_brightness to set a per LED
>> brightness for the trigger and it no longer sets LED_CORE_SUSPENDRESUME.
>>
>> Adjust the MiPad 2 bottom bezel touch buttons LED class device to match:
>>
>> 1. Make LED_FULL the maximum brightness to fix the LED brightness
>>    being very low when on.
>> 2. Set flags = LED_CORE_SUSPENDRESUME.
> 
> ...
> 
>>  #define XIAOMI_MIPAD2_LED_PERIOD_NS		19200
>> -#define XIAOMI_MIPAD2_LED_DEFAULT_DUTY		 6000 /* From Android kernel */
>> +#define XIAOMI_MIPAD2_LED_MAX_DUTY		 6000 /* From Android kernel */
> 
> Perhaps + suffix at the same time? _NS? _US?

Good idea, fixed in my tree.

> 
> ...
> 
>> -		.duty_cycle = val,
>> +		.duty_cycle = XIAOMI_MIPAD2_LED_MAX_DUTY * val / LED_FULL,
> 
> I haven't checked, just to be sure there is no overflow and 64-bit div on
> 32-bit machines...

all variables are 32 bit, so this a 32 bit div. LED_FULL is 255
and 6000 * 255 = 1530000 so the maximum easily fits in 32 bits .

Regards,

Hans





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux