Skip to contentSkip to conversation

iio: mxs-lradc: Do hardware initialization earlier

PATCH New Alexandre Belloni 2 participants 5 messages Mar 28, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: mxs-lradc: Do hardware initialization earlier

We need to initialize hardware before registering the touchscreen. Else, we end up setting registers in mxs_lradc_ts_open(), getting called just after registering the touchscreen with input_register_device() and by the end of mxs_lradc_probe(), we reset the LRADC block hence losing the correct configuration.

Cc Fabio Estevam <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Marek Vasut <[email protected]>
---
 drivers/staging/iio/adc/mxs-lradc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +3 -3
index 55a459b..e927e3f 100644
@@ -933,6 +933,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 
 	INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
 
+	/* Configure the hardware. */
+	mxs_lradc_hw_init(lradc);
+
 	/* Check if touchscreen is enabled in DT. */
 	ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
 				&ts_wires);
@@ -995,9 +998,6 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 		goto err_ts;
 	}
 
-	/* Configure the hardware. */
-	mxs_lradc_hw_init(lradc);
-
 	return 0;
 
 err_ts:
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 iio: mxs-lradc: Do hardware initialization earlier

Quoted 5 lines · Alexandre Belloni

We need to initialize hardware before registering the touchscreen. Else, we end up setting registers in mxs_lradc_ts_open(), getting called just after registering the touchscreen with input_register_device() and by the end of mxs_lradc_probe(), we reset the LRADC block hence losing the correct configuration.

Sorry, I fumbled and forgot my SoB:

Quoted 31 lines
Cc Fabio Estevam <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Marek Vasut <[email protected]>
---
 drivers/staging/iio/adc/mxs-lradc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +3 -3
index 55a459b..e927e3f 100644
@@ -933,6 +933,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 
 	INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
 
+	/* Configure the hardware. */
+	mxs_lradc_hw_init(lradc);
+
 	/* Check if touchscreen is enabled in DT. */
 	ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
 				&ts_wires);
@@ -995,9 +998,6 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 		goto err_ts;
 	}
 
-	/* Configure the hardware. */
-	mxs_lradc_hw_init(lradc);
-
 	return 0;
 
 err_ts:
Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 iio: mxs-lradc: Do hardware initialization earlier

In reply to Alexandre Belloni

Dear Alexandre Belloni,

Quoted 18 lines

We need to initialize hardware before registering the touchscreen. Else, we end up setting registers in mxs_lradc_ts_open(), getting called just after registering the touchscreen with input_register_device() and by the end of mxs_lradc_probe(), we reset the LRADC block hence losing the correct configuration.

Cc Fabio Estevam <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Marek Vasut <[email protected]>
---
 drivers/staging/iio/adc/mxs-lradc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/iio/adc/mxs-lradc.c index 55a459b..e927e3f 100644

drivers/staging/iio/adc/mxs-lradc.c static int mxs_lradc_probe(struct platform_device · line 941

Quoted 9 lines
drivers/staging/iio/adc/mxs-lradc.c +3 -0
@@ -933,6 +933,9 @@ static int mxs_lradc_probe(struct platform_device
 *pdev)
 
 	INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
 
+	/* Configure the hardware. */
+	mxs_lradc_hw_init(lradc);
+
 	/* Check if touchscreen is enabled in DT. */
 	ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",

Isn't this too early? At least lradc->use_touchscreen is configured only after you call mxs_lradc_hw_init() in this case, while mxs_lradc_hw_init() uses it's value.

I think mxs_lradc_hw_init() shall be called just before mxs_lradc_ts_register().

Best regards,
Marek Vasut

#3 lore raw

PATCH 1/1 iio: mxs-lradc: Do hardware initialization earlier

Quoted 33 lines · Marek Vasut

Dear Alexandre Belloni,

Quoted 18 lines

We need to initialize hardware before registering the touchscreen. Else, we end up setting registers in mxs_lradc_ts_open(), getting called just after registering the touchscreen with input_register_device() and by the end of mxs_lradc_probe(), we reset the LRADC block hence losing the correct configuration.

Cc Fabio Estevam <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Marek Vasut <[email protected]>
---
 drivers/staging/iio/adc/mxs-lradc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/iio/adc/mxs-lradc.c index 55a459b..e927e3f 100644

drivers/staging/iio/adc/mxs-lradc.c static int mxs_lradc_probe(struct platform_device · line 941

Quoted 9 lines
drivers/staging/iio/adc/mxs-lradc.c +3 -0
@@ -933,6 +933,9 @@ static int mxs_lradc_probe(struct platform_device
 *pdev)
 
 	INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
 
+	/* Configure the hardware. */
+	mxs_lradc_hw_init(lradc);
+
 	/* Check if touchscreen is enabled in DT. */
 	ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",

Isn't this too early? At least lradc->use_touchscreen is configured only after you call mxs_lradc_hw_init() in this case, while mxs_lradc_hw_init() uses it's value.

Quoted 3 lines

I think mxs_lradc_hw_init() shall be called just before mxs_lradc_ts_register().

That's right, this would break 5 wires touchscreens. I'll fix that.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 iio: mxs-lradc: Do hardware initialization earlier

Dear Alexandre Belloni,

Quoted 37 lines · Marek Vasut
Quoted 36 lines

Dear Alexandre Belloni,

Quoted 28 lines

We need to initialize hardware before registering the touchscreen. Else, we end up setting registers in mxs_lradc_ts_open(), getting called just after registering the touchscreen with input_register_device() and by the end of mxs_lradc_probe(), we reset the LRADC block hence losing the correct configuration.

Cc Fabio Estevam <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Marek Vasut <[email protected]>

---

 drivers/staging/iio/adc/mxs-lradc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/iio/adc/mxs-lradc.c index 55a459b..e927e3f 100644

drivers/staging/iio/adc/mxs-lradc.c +3 -0
@@ -933,6 +933,9 @@ static int mxs_lradc_probe(struct platform_device
 *pdev)
 
 	INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
 
+	/* Configure the hardware. */
+	mxs_lradc_hw_init(lradc);
+
 
 	/* Check if touchscreen is enabled in DT. */
Quoted 1 line

ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",

Isn't this too early? At least lradc->use_touchscreen is configured only after you call mxs_lradc_hw_init() in this case, while mxs_lradc_hw_init() uses it's value.

Quoted 4 lines
Quoted 2 lines

I think mxs_lradc_hw_init() shall be called just before mxs_lradc_ts_register().

That's right, this would break 5 wires touchscreens. I'll fix that.

Thanks!

Best regards,
Marek Vasut