linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: himax_hx83112b - fix event stack size to clear irq correctly
@ 2025-01-22 12:14 Dmitry Mastykin
  2025-01-22 18:37 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Mastykin @ 2025-01-22 12:14 UTC (permalink / raw)
  To: job, dmitry.torokhov, linux-input, linux-kernel, felix; +Cc: Dmitry Mastykin

The datasheet suggests that the size of the event stack is 32 x 32-bit.
Reading less bytes did not clear the interrupt output. Extra interrupts
were called with zero himax_event_get_num_points() result.
Only every second call to himax_handle_input() cleared the interrupt
output.

Tested on: HX83102J

Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
---
 drivers/input/touchscreen/himax_hx83112b.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/himax_hx83112b.c b/drivers/input/touchscreen/himax_hx83112b.c
index 31f18860dbd3..fe7bdf8cec50 100644
--- a/drivers/input/touchscreen/himax_hx83112b.c
+++ b/drivers/input/touchscreen/himax_hx83112b.c
@@ -24,6 +24,7 @@
 #include <linux/regmap.h>
 
 #define HIMAX_MAX_POINTS		10
+#define HIMAX_EVENT_STACK_SIZE		128
 
 #define HIMAX_AHB_ADDR_BYTE_0			0x00
 #define HIMAX_AHB_ADDR_RDATA_BYTE_0		0x08
@@ -292,9 +293,9 @@ static int hx83100a_read_events(struct himax_ts_data *ts,
 static int himax_handle_input(struct himax_ts_data *ts)
 {
 	int error;
-	struct himax_event event;
+	u8 event[HIMAX_EVENT_STACK_SIZE];
 
-	error = ts->chip->read_events(ts, &event, sizeof(event));
+	error = ts->chip->read_events(ts, (struct himax_event *)&event, sizeof(event));
 	if (error) {
 		dev_err(&ts->client->dev, "Failed to read input event: %d\n",
 			error);
@@ -305,8 +306,8 @@ static int himax_handle_input(struct himax_ts_data *ts)
 	 * Only process the current event when it has a valid checksum but
 	 * don't consider it a fatal error when it doesn't.
 	 */
-	if (himax_verify_checksum(ts, &event))
-		himax_process_event(ts, &event);
+	if (himax_verify_checksum(ts, (struct himax_event *)&event))
+		himax_process_event(ts, (struct himax_event *)&event);
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-25  4:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-22 12:14 [PATCH] Input: himax_hx83112b - fix event stack size to clear irq correctly Dmitry Mastykin
2025-01-22 18:37 ` Dmitry Torokhov
2025-01-25  4:29   ` Dmitry Mastykin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).