[PATCH 27/40] mfd: ti_am335x_tscadc: Move control register configuration

Miquel Raynal
2021-08-25T15:35:01Z

The datasheet states that most of the configuration should be set in the
control register in the first place, before actually enabling the
hardware. So far only half of the configuration was made in the first
step, which does not make really sense and would complicating the code
when introducing support for the am437x hardware.

Let's move that register write a bit below to enclose more configuration.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
drivers/mfd/ti_am335x_tscadc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index a40091830cea..1a30610dc65f 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -224,7 +224,6 @@ static int ti_tscadc_probe(struct platform_device *pdev)
tscadc->ctrl = CNTRLREG_STEPID;
if (tscadc->data->has_tsc) {
tscadc->ctrl |= CNTRLREG_TSC_STEPCONFIGWRT;
- regmap_write(tscadc->regmap, REG_CTRL, tscadc->ctrl);
if (use_tsc) {
tscadc->ctrl |= CNTRLREG_TSC_ENB;
if (tscmag_wires == 5)
@@ -235,6 +234,8 @@ static int ti_tscadc_probe(struct platform_device *pdev)

}

+ regmap_write(tscadc->regmap, REG_CTRL, tscadc->ctrl);
+
tscadc_idle_config(tscadc);

/* Enable the TSC module enable bit */
--
2.27.0