Thread (88 messages) 88 messages, 4 authors, 2021-09-05

Re: [PATCH 25/40] mfd: ti_am335x_tscadc: Add a boolean to clarify the presence of a touchscreen

From: Jonathan Cameron <jic23@kernel.org>
Date: 2021-08-30 13:56:55
Also in: linux-devicetree, linux-iio, linux-input, linux-omap

On Wed, 25 Aug 2021 17:25:03 +0200
Miquel Raynal [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Just checking the number of wires will soon not be enough, add a boolean
to indicated the actual use or not of the touchscreen.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mfd/ti_am335x_tscadc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 2f934fd2154a..30f53cdb41f8 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -121,6 +121,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	const __be32 *cur;
 	struct clk *clk;
 	u32 val;
+	bool use_tsc = false;
 	int tscmag_wires = 0, adc_channels = 0, readouts = 0, cell_idx = 0;
 	int total_channels, err;
 
@@ -141,6 +142,8 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	node = of_get_child_by_name(pdev->dev.of_node, "tsc");
 	of_property_read_u32(node, "ti,wires", &tscmag_wires);
 	of_property_read_u32(node, "ti,coordiante-readouts", &readouts);
+	if (tscmag_wires)
+		use_tsc = true;
 
 	node = of_get_child_by_name(pdev->dev.of_node, "adc");
 	of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
@@ -163,7 +166,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	if (readouts * 2 + 2 + adc_channels > 16) {
+	if (use_tsc && (readouts * 2 + 2 + adc_channels > 16)) {
This one is adding a check that wasn't there before.  The description should
mention why it will now be necessary and isn't a bug...
quoted hunk ↗ jump to hunk
 		dev_err(&pdev->dev, "Too many step configurations requested\n");
 		return -EINVAL;
 	}
@@ -218,7 +221,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	tscadc->ctrl = CNTRLREG_TSC_STEPCONFIGWRT | CNTRLREG_STEPID;
 	regmap_write(tscadc->regmap, REG_CTRL, tscadc->ctrl);
 
-	if (tscmag_wires > 0) {
+	if (use_tsc) {
 		tscadc->ctrl |= CNTRLREG_TSC_ENB;
 		if (tscmag_wires == 5)
 			tscadc->ctrl |= CNTRLREG_TSC_5WIRE;
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help