* [PATCH] input: gpio-keys - optimize wakeup sequence. [not found] <CGME20231017103415epcms5p2f8f5b28a8f5d71055622b82f71b0fc93@epcms5p2> @ 2023-10-17 10:34 ` Abhishek Kumar Singh 2023-10-18 21:49 ` Gareth Randall 0 siblings, 1 reply; 4+ messages in thread From: Abhishek Kumar Singh @ 2023-10-17 10:34 UTC (permalink / raw) To: dmitry.torokhov; +Cc: robh, linux-input, linux-kernel, SRI-N IT Security [-- Attachment #1: Type: text/plain, Size: 1193 bytes --] 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 #2: input_keys_optimized.zip --] [-- Type: application/octet-stream, Size: 998 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] input: gpio-keys - optimize wakeup sequence. 2023-10-17 10:34 ` [PATCH] input: gpio-keys - optimize wakeup sequence Abhishek Kumar Singh @ 2023-10-18 21:49 ` Gareth Randall 0 siblings, 0 replies; 4+ messages in thread From: Gareth Randall @ 2023-10-18 21:49 UTC (permalink / raw) To: abhi1.singh; +Cc: linux-input, linux-kernel, SRI-N IT Security Dear Mr Singh, I am not a maintainer but can point out some issues you need to resolve with this post. 1. Put the patch in the body of the email and not in an attachment. 2. You need a "Signed-off-by:" line. 3. The email needs to start with a description of the what the patch resolves. Don't put "suggested changes". There are probably other issues as well but I hope this helps you to get started. Note that I am not involved in the review process. Yours, Gareth On 17/10/2023 11:34, Abhishek Kumar Singh wrote: > 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CGME20231017103415epcms5p2f8f5b28a8f5d71055622b82f71b0fc93@epcms5p4>]
* [PATCH] input: gpio-keys - optimize wakeup sequence. [not found] <CGME20231017103415epcms5p2f8f5b28a8f5d71055622b82f71b0fc93@epcms5p4> @ 2023-10-26 5:53 ` Abhishek Kumar Singh 2023-10-29 2:11 ` dmitry.torokhov 0 siblings, 1 reply; 4+ messages in thread From: Abhishek Kumar Singh @ 2023-10-26 5:53 UTC (permalink / raw) To: dmitry.torokhov Cc: robh, linux-input, linux-kernel, SRI-N IT Security, Abhishek Kumar Singh [-- Attachment #1: Type: text/plain, Size: 2037 bytes --] Dear Mr. Dmitry, Greetings! The patch removes unused many APIs call chain for every suspend/resume of the device if 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 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); The patch 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 Signed-off-by: Abhishek Kumar Singh <abhi1.singh@samsung.com> --- linux-6.4.11/drivers/input/keyboard/gpio_keys.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/linux-6.4.11/drivers/input/keyboard/gpio_keys.c b/linux-6.4.11/drivers/input/keyboard/gpio_keys.c index 13a8ba5..cd1609e 100644 --- a/linux-6.4.11/drivers/input/keyboard/gpio_keys.c +++ b/linux-6.4.11/drivers/input/keyboard/gpio_keys.c @@ -687,8 +687,12 @@ static void gpio_keys_report_state(struct gpio_keys_drvdata *ddata) for (i = 0; i < ddata->pdata->nbuttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; - if (bdata->gpiod) - gpio_keys_gpio_report_event(bdata); + if (bdata->gpiod) { + struct gpio_keys_button *button = bdata->button; + if(button->value) { + gpio_keys_gpio_report_event(bdata); + } + } } input_sync(input); } --- Thanks and Regards, Abhishek Kumar Singh Sr. Chief Engineer, Samsung Electronics, Noida-India [-- Attachment #2: input_keys_optimized.zip --] [-- Type: application/octet-stream, Size: 998 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] input: gpio-keys - optimize wakeup sequence. 2023-10-26 5:53 ` Abhishek Kumar Singh @ 2023-10-29 2:11 ` dmitry.torokhov 0 siblings, 0 replies; 4+ messages in thread From: dmitry.torokhov @ 2023-10-29 2:11 UTC (permalink / raw) To: Abhishek Kumar Singh; +Cc: robh, linux-input, linux-kernel, SRI-N IT Security Hi Abhishek, On Thu, Oct 26, 2023 at 11:23:20AM +0530, Abhishek Kumar Singh wrote: > Dear Mr. Dmitry, > Greetings! > > > The patch removes unused many APIs call chain for every suspend/resume of the device > if 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 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); > > > The patch 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 Unfortunately it also breaks the driver as button->value does not hold the current state of the GPIO but rather set one via device tree so that the driver can use that value when sending EV_ABS events. So with typical GPIO-backed keys or buttons you change results in no events reported on resume. I also wonder what kind of measurements you did on improvements to suspend/resume time with your change. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-29 2:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20231017103415epcms5p2f8f5b28a8f5d71055622b82f71b0fc93@epcms5p2>
2023-10-17 10:34 ` [PATCH] input: gpio-keys - optimize wakeup sequence Abhishek Kumar Singh
2023-10-18 21:49 ` Gareth Randall
[not found] <CGME20231017103415epcms5p2f8f5b28a8f5d71055622b82f71b0fc93@epcms5p4>
2023-10-26 5:53 ` Abhishek Kumar Singh
2023-10-29 2:11 ` dmitry.torokhov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®