Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <j-lance1@ti.com>
[bigeasy: keep the change mfd only]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Jeff Lance and committed by
Lee Jones
f0933a60 92b8f3ab

+18 -13
+17 -13
drivers/mfd/ti_am335x_tscadc.c
··· 242 242 tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div); 243 243 244 244 /* Set the control register bits */ 245 - ctrl = CNTRLREG_STEPCONFIGWRT | 246 - CNTRLREG_STEPID; 247 - if (tsc_wires > 0) 248 - ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB; 245 + ctrl = CNTRLREG_STEPCONFIGWRT | CNTRLREG_STEPID; 249 246 tscadc_writel(tscadc, REG_CTRL, ctrl); 250 247 251 248 /* Set register bits for Idle Config Mode */ 252 - if (tsc_wires > 0) 249 + if (tsc_wires > 0) { 250 + tscadc->tsc_wires = tsc_wires; 251 + if (tsc_wires == 5) 252 + ctrl |= CNTRLREG_5WIRE | CNTRLREG_TSCENB; 253 + else 254 + ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB; 253 255 tscadc_idle_config(tscadc); 256 + } 254 257 255 258 /* Enable the TSC module enable bit */ 256 - ctrl = tscadc_readl(tscadc, REG_CTRL); 257 259 ctrl |= CNTRLREG_TSCSSENB; 258 260 tscadc_writel(tscadc, REG_CTRL, ctrl); 259 261 ··· 327 325 static int tscadc_resume(struct device *dev) 328 326 { 329 327 struct ti_tscadc_dev *tscadc_dev = dev_get_drvdata(dev); 330 - unsigned int restore, ctrl; 328 + u32 ctrl; 331 329 332 330 pm_runtime_get_sync(dev); 333 331 334 332 /* context restore */ 335 333 ctrl = CNTRLREG_STEPCONFIGWRT | CNTRLREG_STEPID; 336 - if (tscadc_dev->tsc_cell != -1) 337 - ctrl |= CNTRLREG_TSCENB | CNTRLREG_4WIRE; 338 334 tscadc_writel(tscadc_dev, REG_CTRL, ctrl); 339 335 340 - if (tscadc_dev->tsc_cell != -1) 336 + if (tscadc_dev->tsc_cell != -1) { 337 + if (tscadc_dev->tsc_wires == 5) 338 + ctrl |= CNTRLREG_5WIRE | CNTRLREG_TSCENB; 339 + else 340 + ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB; 341 341 tscadc_idle_config(tscadc_dev); 342 - restore = tscadc_readl(tscadc_dev, REG_CTRL); 343 - tscadc_writel(tscadc_dev, REG_CTRL, 344 - (restore | CNTRLREG_TSCSSENB)); 342 + } 343 + ctrl |= CNTRLREG_TSCSSENB; 344 + tscadc_writel(tscadc_dev, REG_CTRL, ctrl); 345 345 346 346 tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div); 347 347
+1
include/linux/mfd/ti_am335x_tscadc.h
··· 155 155 void __iomem *tscadc_base; 156 156 int irq; 157 157 int used_cells; /* 1-2 */ 158 + int tsc_wires; 158 159 int tsc_cell; /* -1 if not used */ 159 160 int adc_cell; /* -1 if not used */ 160 161 struct mfd_cell cells[TSCADC_CELLS];