* [PATCH] mfd: ti_am335x_tscadc: Update logic in CTRL register for 5-wire TS
@ 2014-09-04 17:01 Sebastian Andrzej Siewior
2014-09-18 13:38 ` Sebastian Andrzej Siewior
2014-09-24 11:26 ` Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2014-09-04 17:01 UTC (permalink / raw)
To: linux-kernel
Cc: linux-input, Felipe Balbi, linux-omap, Samuel Ortiz, Lee Jones,
Jeff Lance, Sebastian Andrzej Siewior
From: Jeff Lance <j-lance1@ti.com>
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>
---
I've been looking at moving this piece and the idle mode setting into the
TSC driver. Kinda odd that I have to patch within the MFD driver for this
TSC related change.
Anyone disagrees?
drivers/mfd/ti_am335x_tscadc.c | 30 +++++++++++++++++-------------
include/linux/mfd/ti_am335x_tscadc.h | 1 +
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index dd4bf5816221..6c9cfb8c1d01 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -241,18 +241,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);
@@ -324,21 +326,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);
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index fb96c84dada5..e2e70053470e 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -155,6 +155,7 @@ struct ti_tscadc_dev {
void __iomem *tscadc_base;
int irq;
int used_cells; /* 1-2 */
+ int tsc_wires;
int tsc_cell; /* -1 if not used */
int adc_cell; /* -1 if not used */
struct mfd_cell cells[TSCADC_CELLS];
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: ti_am335x_tscadc: Update logic in CTRL register for 5-wire TS
2014-09-04 17:01 [PATCH] mfd: ti_am335x_tscadc: Update logic in CTRL register for 5-wire TS Sebastian Andrzej Siewior
@ 2014-09-18 13:38 ` Sebastian Andrzej Siewior
2014-09-24 11:26 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2014-09-18 13:38 UTC (permalink / raw)
To: Samuel Ortiz, Lee Jones
Cc: linux-kernel, linux-input, Felipe Balbi, linux-omap, Jeff Lance,
Sebastian Andrzej Siewior
On 2014-09-04 19:01:57 [+0200], Sebastian Andrzej Siewior wrote:
> From: Jeff Lance <j-lance1@ti.com>
>
> 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>
> ---
ping
> I've been looking at moving this piece and the idle mode setting into the
> TSC driver. Kinda odd that I have to patch within the MFD driver for this
> TSC related change.
> Anyone disagrees?
>
> drivers/mfd/ti_am335x_tscadc.c | 30 +++++++++++++++++-------------
> include/linux/mfd/ti_am335x_tscadc.h | 1 +
> 2 files changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index dd4bf5816221..6c9cfb8c1d01 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -241,18 +241,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);
>
> @@ -324,21 +326,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);
>
> diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
> index fb96c84dada5..e2e70053470e 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -155,6 +155,7 @@ struct ti_tscadc_dev {
> void __iomem *tscadc_base;
> int irq;
> int used_cells; /* 1-2 */
> + int tsc_wires;
> int tsc_cell; /* -1 if not used */
> int adc_cell; /* -1 if not used */
> struct mfd_cell cells[TSCADC_CELLS];
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: ti_am335x_tscadc: Update logic in CTRL register for 5-wire TS
2014-09-04 17:01 [PATCH] mfd: ti_am335x_tscadc: Update logic in CTRL register for 5-wire TS Sebastian Andrzej Siewior
2014-09-18 13:38 ` Sebastian Andrzej Siewior
@ 2014-09-24 11:26 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2014-09-24 11:26 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-kernel, linux-input, Felipe Balbi, linux-omap, Samuel Ortiz,
Jeff Lance
On Thu, 04 Sep 2014, Sebastian Andrzej Siewior wrote:
> From: Jeff Lance <j-lance1@ti.com>
>
> 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>
> ---
> I've been looking at moving this piece and the idle mode setting into the
> TSC driver. Kinda odd that I have to patch within the MFD driver for this
> TSC related change.
> Anyone disagrees?
>
> drivers/mfd/ti_am335x_tscadc.c | 30 +++++++++++++++++-------------
> include/linux/mfd/ti_am335x_tscadc.h | 1 +
> 2 files changed, 18 insertions(+), 13 deletions(-)
I hope this has been fully tested.
Looks like it could work though, so applied, thanks.
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index dd4bf5816221..6c9cfb8c1d01 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -241,18 +241,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);
>
> @@ -324,21 +326,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);
>
> diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
> index fb96c84dada5..e2e70053470e 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -155,6 +155,7 @@ struct ti_tscadc_dev {
> void __iomem *tscadc_base;
> int irq;
> int used_cells; /* 1-2 */
> + int tsc_wires;
> int tsc_cell; /* -1 if not used */
> int adc_cell; /* -1 if not used */
> struct mfd_cell cells[TSCADC_CELLS];
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-24 11:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04 17:01 [PATCH] mfd: ti_am335x_tscadc: Update logic in CTRL register for 5-wire TS Sebastian Andrzej Siewior
2014-09-18 13:38 ` Sebastian Andrzej Siewior
2014-09-24 11:26 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).