[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <899376598.3134980.1698299600677@mail-kr5-0.mail-kr5.knoxportal-kr-prod-blue.svc.cluster.local>
Date: Thu, 26 Oct 2023 11:23:20 +0530
From: Abhishek Kumar Singh <abhi1.singh@...sung.com>
To: "dmitry.torokhov@...il.com" <dmitry.torokhov@...il.com>
CC: "robh@...nel.org" <robh@...nel.org>,
"linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
SRI-N IT Security <sri-n.itsec@...sung.com>,
Abhishek Kumar Singh <abhi1.singh@...sung.com>
Subject: [PATCH] input: gpio-keys - optimize wakeup sequence.
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@...sung.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
Download attachment "input_keys_optimized.zip" of type "application/octet-stream" (998 bytes)
Powered by blists - more mailing lists