linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: ti_am335x_tsc: clamp coordinate_readouts to DT maximum (6)
@ 2025-11-17  3:23 Junjie Cao
  0 siblings, 0 replies; only message in thread
From: Junjie Cao @ 2025-11-17  3:23 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, junjie.cao

DT binding (ti,am3359-tsc.yaml) sets ti,coordinate-readouts to a
maximum of 6. The MFD parent also enforces that
(readouts * 2 + 2) + adc_channels <= 16 and fails probe if this
is violated, so the touchscreen subdriver will not even probe
in those cases.

Clamp coordinate_readouts > 6 to 6 in the subdriver to align with the
binding and keep behavior sane if invalid platform data bypasses schema
checks. Keep the existing default to 5 for non-positive values.

No functional change with valid DT.

Signed-off-by: Junjie Cao <junjie.cao@intel.com>
---
 drivers/input/touchscreen/ti_am335x_tsc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 73980142f492..0534b2ba650b 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -389,6 +389,10 @@ static int titsc_parse_dt(struct platform_device *pdev,
 		dev_warn(&pdev->dev,
 			 "invalid co-ordinate readouts, resetting it to 5\n");
 		ts_dev->coordinate_readouts = 5;
+	} else if (ts_dev->coordinate_readouts > 6) {
+		dev_warn(&pdev->dev,
+			 "co-ordinate readouts too large, limiting to 6\n");
+		ts_dev->coordinate_readouts = 6;
 	}
 
 	err = of_property_read_u32(node, "ti,charge-delay",
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-17  3:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17  3:23 [PATCH] Input: ti_am335x_tsc: clamp coordinate_readouts to DT maximum (6) Junjie Cao

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).