From f0933a60d1902c918249d11fb6d9a5ffd581ef5b Mon Sep 17 00:00:00 2001 From: Jeff Lance Date: Thu, 4 Sep 2014 19:01:57 +0200 Subject: mfd: ti_am335x_tscadc: Update logic in CTRL register for 5-wire TS The logic in AFE_Pen_Ctrl bitmask in the CTRL register is different for five wire versus four or eight wire touschscreens. This patch should fix this for five-wire touch screens. There should be no change needed here for four and eight wire tousch screens. Signed-off-by: Jeff Lance [bigeasy: keep the change mfd only] Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Lee Jones --- drivers/mfd/ti_am335x_tscadc.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'drivers/mfd/ti_am335x_tscadc.c') diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c index 121add8be456..d877e777cce6 100644 --- a/drivers/mfd/ti_am335x_tscadc.c +++ b/drivers/mfd/ti_am335x_tscadc.c @@ -242,18 +242,20 @@ static int ti_tscadc_probe(struct platform_device *pdev) tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div); /* Set the control register bits */ - ctrl = CNTRLREG_STEPCONFIGWRT | - CNTRLREG_STEPID; - if (tsc_wires > 0) - ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB; + ctrl = CNTRLREG_STEPCONFIGWRT | CNTRLREG_STEPID; tscadc_writel(tscadc, REG_CTRL, ctrl); /* Set register bits for Idle Config Mode */ - if (tsc_wires > 0) + if (tsc_wires > 0) { + tscadc->tsc_wires = tsc_wires; + if (tsc_wires == 5) + ctrl |= CNTRLREG_5WIRE | CNTRLREG_TSCENB; + else + ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB; tscadc_idle_config(tscadc); + } /* Enable the TSC module enable bit */ - ctrl = tscadc_readl(tscadc, REG_CTRL); ctrl |= CNTRLREG_TSCSSENB; tscadc_writel(tscadc, REG_CTRL, ctrl); @@ -325,21 +327,23 @@ static int tscadc_suspend(struct device *dev) static int tscadc_resume(struct device *dev) { struct ti_tscadc_dev *tscadc_dev = dev_get_drvdata(dev); - unsigned int restore, ctrl; + u32 ctrl; pm_runtime_get_sync(dev); /* context restore */ ctrl = CNTRLREG_STEPCONFIGWRT | CNTRLREG_STEPID; - if (tscadc_dev->tsc_cell != -1) - ctrl |= CNTRLREG_TSCENB | CNTRLREG_4WIRE; tscadc_writel(tscadc_dev, REG_CTRL, ctrl); - if (tscadc_dev->tsc_cell != -1) + if (tscadc_dev->tsc_cell != -1) { + if (tscadc_dev->tsc_wires == 5) + ctrl |= CNTRLREG_5WIRE | CNTRLREG_TSCENB; + else + ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB; tscadc_idle_config(tscadc_dev); - restore = tscadc_readl(tscadc_dev, REG_CTRL); - tscadc_writel(tscadc_dev, REG_CTRL, - (restore | CNTRLREG_TSCSSENB)); + } + ctrl |= CNTRLREG_TSCSSENB; + tscadc_writel(tscadc_dev, REG_CTRL, ctrl); tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div); -- cgit v1.2.3