Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0933a60 authored by Jeff Lance's avatar Jeff Lance Committed by Lee Jones
Browse files

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: default avatarJeff Lance <j-lance1@ti.com>
[bigeasy: keep the change mfd only]
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 92b8f3ab
Loading
Loading
Loading
Loading
+17 −13
Original line number Original line Diff line number Diff line
@@ -242,18 +242,20 @@ static int ti_tscadc_probe(struct platform_device *pdev)
	tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div);
	tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div);


	/* Set the control register bits */
	/* Set the control register bits */
	ctrl = CNTRLREG_STEPCONFIGWRT |
	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
			CNTRLREG_STEPID;
	if (tsc_wires > 0)
		ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB;
	tscadc_writel(tscadc, REG_CTRL, ctrl);
	tscadc_writel(tscadc, REG_CTRL, ctrl);


	/* Set register bits for Idle Config Mode */
	/* 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);
		tscadc_idle_config(tscadc);
	}


	/* Enable the TSC module enable bit */
	/* Enable the TSC module enable bit */
	ctrl = tscadc_readl(tscadc, REG_CTRL);
	ctrl |= CNTRLREG_TSCSSENB;
	ctrl |= CNTRLREG_TSCSSENB;
	tscadc_writel(tscadc, REG_CTRL, ctrl);
	tscadc_writel(tscadc, REG_CTRL, ctrl);


@@ -325,21 +327,23 @@ static int tscadc_suspend(struct device *dev)
static int tscadc_resume(struct device *dev)
static int tscadc_resume(struct device *dev)
{
{
	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
	unsigned int restore, ctrl;
	u32 ctrl;


	pm_runtime_get_sync(dev);
	pm_runtime_get_sync(dev);


	/* context restore */
	/* context restore */
	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
	if (tscadc_dev->tsc_cell != -1)
		ctrl |= CNTRLREG_TSCENB | CNTRLREG_4WIRE;
	tscadc_writel(tscadc_dev, REG_CTRL, ctrl);
	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);
		tscadc_idle_config(tscadc_dev);
	restore = tscadc_readl(tscadc_dev, REG_CTRL);
	}
	tscadc_writel(tscadc_dev, REG_CTRL,
	ctrl |= CNTRLREG_TSCSSENB;
			(restore | CNTRLREG_TSCSSENB));
	tscadc_writel(tscadc_dev, REG_CTRL, ctrl);


	tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div);
	tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div);


+1 −0
Original line number Original line Diff line number Diff line
@@ -155,6 +155,7 @@ struct ti_tscadc_dev {
	void __iomem *tscadc_base;
	void __iomem *tscadc_base;
	int irq;
	int irq;
	int used_cells;	/* 1-2 */
	int used_cells;	/* 1-2 */
	int tsc_wires;
	int tsc_cell;	/* -1 if not used */
	int tsc_cell;	/* -1 if not used */
	int adc_cell;	/* -1 if not used */
	int adc_cell;	/* -1 if not used */
	struct mfd_cell cells[TSCADC_CELLS];
	struct mfd_cell cells[TSCADC_CELLS];