[PATCH] input: gpio-keys - optimize wakeup sequence.

From: Abhishek Kumar Singh
Date: Tue Oct 17 2023 - 06:34:39 EST


Dear Mr. Dmitry,

Greetings!



This patch is related to optimization in input key event driver of Kernel module.

Suggested change to avoid the many APIs call chain if there is no key press event triggered.



There is a call back function gpio_keys_resume() called for every suspend/resume of the device.

And whenever this function is called, it is reading the status of the key.

And gpio_keys_resume() API further calls the below chain of API irrespective of key press event.



APIs call chain:

static void gpio_keys_report_state(struct gpio_keys_drvdata *ddata)

static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)

gpiod_get_value_cansleep(bdata->gpiod);

input_event(input, type, *bdata->code, state);

input_sync(input);




Suggested changes to avoid the above APIs call chain if there is no key press event triggered.

It will save the device computational resources, power resources and optimize the suspend/resume time"


Please help to review the attached patch and integrate in main line kernel code.

 



Thanks and Regards,
Abhishek Kumar Singh
Sr. Chief Engineer, Samsung Electronics, Noida-India

Attachment: input_keys_optimized.zip
Description: Binary data