* [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
@ 2013-09-23 14:36 Juergen Beisert
2013-09-23 14:36 ` [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling Juergen Beisert
` (8 more replies)
0 siblings, 9 replies; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: devel, marex, fabio.estevam, jic23, linux-input, linux-arm-kernel
The following series replaces the current busy loop touchscreen implementation
for i.MX28/i.MX23 SoCs by a fully interrupt driven implementation.
Since i.MX23 and i.MX28 silicon differs, the existing implementation can
be used for the i.MX28 SoC only.
The first patch adds proper clock handling. Various platforms seems to disable
the internal 2 kHz clock which is used by the LRADC delay units.
The next two patches of this series move the i.MX28 specific definitions
out of the way. The forth patch simplifies the register access to make it easier
to add the i.MX23 support. Then the i.MX23 specific definitions are added, also
the code to distinguish both SoCs at run-time.
Up to here the existing touchscreen driver will now run on an i.MX23 Soc as well.
When these i.MX SoCs are running from battery it seems not to be a good idea to
run a busy loop to detect touches and their location. The 6th patch adds a
fully interrupt driven implementation which makes use of the built-in delay
and multiple sample features of the touchscreen controller. This will reduce
the interrupt load to a minimum.
The remaining patches in this series just removes the existing busy loop
implementation, add a proposal for devicetree binding and a reminder what has
still to be done with the LRADC driver.
Changes since v5:
- add missing clock handling which prevents the delay units from work (this
should make it work on the MX28EVK and M28EVK as well)
Changes since v4:
- honor Jonathan's comments about function names
- honor Dmitry's comments about workqueue canceling and interrupts
- adding devicetree bindings proposal
Changes since v3:
- split adding register access functions and i.MX23 support into two patches
Changes since v2:
- useless debug output removed
Changes since v1:
- adding register access functions to make the existing code more readable
- adding some functions to distinguish the SoCs at run-time to avoid if-else
contructs whenever differences in the register layout between i.MX23 and
i.MX28 must be handled
Comments are welcome.
Juergen
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
@ 2013-09-23 14:36 ` Juergen Beisert
2013-09-23 15:13 ` Fabio Estevam
[not found] ` <1379946998-23041-2-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 14:36 ` [PATCH 2/9] Staging/iio/adc/touchscreen/MXS: distinguish i.MX23's and i.MX28's LRADC Juergen Beisert
` (7 subsequent siblings)
8 siblings, 2 replies; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: devel, marex, fabio.estevam, jic23, linux-input, linux-arm-kernel
The delay units inside the LRADC depend on the presence of a 2 kHz clock.
This change enables the clock to be able to use the delay unit for the
touchscreen part of the driver.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
arch/arm/boot/dts/imx23.dtsi | 1 +
arch/arm/boot/dts/imx28.dtsi | 1 +
drivers/staging/iio/adc/mxs-lradc.c | 7 +++++++
3 files changed, 9 insertions(+)
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 28b5ce2..07caf76 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -430,6 +430,7 @@
reg = <0x80050000 0x2000>;
interrupts = <36 37 38 39 40 41 42 43 44>;
status = "disabled";
+ clocks = <&clks 26>;
};
spdif@80054000 {
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 7363fde..175deef 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -902,6 +902,7 @@
interrupts = <10 14 15 16 17 18 19
20 21 22 23 24 25>;
status = "disabled";
+ clocks = <&clks 41>;
};
spdif: spdif@80054000 {
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index a08c173..00b61ac 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -35,6 +35,7 @@
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/input.h>
+#include <linux/clk.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
@@ -134,6 +135,8 @@ struct mxs_lradc {
void __iomem *base;
int irq[13];
+ struct clk *clk;
+
uint32_t *buffer;
struct iio_trigger *trig;
@@ -928,6 +931,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
if (IS_ERR(lradc->base))
return PTR_ERR(lradc->base);
+ lradc->clk = devm_clk_get(&pdev->dev, NULL);
+ clk_prepare_enable(lradc->clk);
+
INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
/* Check if touchscreen is enabled in DT. */
@@ -1020,6 +1026,7 @@ static int mxs_lradc_remove(struct platform_device *pdev)
iio_triggered_buffer_cleanup(iio);
mxs_lradc_trigger_remove(iio);
+ clk_disable_unprepare(lradc->clk);
return 0;
}
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 2/9] Staging/iio/adc/touchscreen/MXS: distinguish i.MX23's and i.MX28's LRADC
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
2013-09-23 14:36 ` [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling Juergen Beisert
@ 2013-09-23 14:36 ` Juergen Beisert
[not found] ` <1379946998-23041-3-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 14:36 ` [PATCH 3/9] Staging/iio/adc/touchscreen/MXS: separate i.MX28 specific register bits Juergen Beisert
` (6 subsequent siblings)
8 siblings, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: devel, marex, fabio.estevam, jic23, linux-input, linux-arm-kernel
The LRADC units in i.MX23 and i.MX28 differ and we need to distinguish both
SoC variants in order to make the touchscreen work on i.MX23
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-input@vger.kernel.org
CC: devel@driverdev.osuosl.org
CC: Marek Vasut <marex@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
CC: Jonathan Cameron <jic23@cam.ac.uk>
---
drivers/staging/iio/adc/mxs-lradc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 00b61ac..3abc91f 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -177,6 +177,8 @@ struct mxs_lradc {
struct input_dev *ts_input;
struct work_struct ts_work;
+
+ enum mxs_lradc_id soc;
};
#define LRADC_CTRL0 0x00
@@ -923,6 +925,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
}
lradc = iio_priv(iio);
+ lradc->soc = (enum mxs_lradc_id)of_id->data;
/* Grab the memory area */
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 3/9] Staging/iio/adc/touchscreen/MXS: separate i.MX28 specific register bits
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
2013-09-23 14:36 ` [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling Juergen Beisert
2013-09-23 14:36 ` [PATCH 2/9] Staging/iio/adc/touchscreen/MXS: distinguish i.MX23's and i.MX28's LRADC Juergen Beisert
@ 2013-09-23 14:36 ` Juergen Beisert
[not found] ` <1379946998-23041-4-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 14:36 ` [PATCH 4/9] Staging/iio/adc/touchscreen/MXS: simplify register access Juergen Beisert
` (5 subsequent siblings)
8 siblings, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: devel, marex, fabio.estevam, jic23, linux-input, linux-arm-kernel
In order to support i.MX23 and i.MX28 within one driver we need to separate the
register definitions which differ in both SoC variants.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-input@vger.kernel.org
CC: devel@driverdev.osuosl.org
CC: Marek Vasut <marex@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
CC: Jonathan Cameron <jic23@cam.ac.uk>
---
drivers/staging/iio/adc/mxs-lradc.c | 61 ++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 3abc91f..f2fb10a 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -182,24 +182,29 @@ struct mxs_lradc {
};
#define LRADC_CTRL0 0x00
-#define LRADC_CTRL0_TOUCH_DETECT_ENABLE (1 << 23)
-#define LRADC_CTRL0_TOUCH_SCREEN_TYPE (1 << 22)
-#define LRADC_CTRL0_YNNSW /* YM */ (1 << 21)
-#define LRADC_CTRL0_YPNSW /* YP */ (1 << 20)
-#define LRADC_CTRL0_YPPSW /* YP */ (1 << 19)
-#define LRADC_CTRL0_XNNSW /* XM */ (1 << 18)
-#define LRADC_CTRL0_XNPSW /* XM */ (1 << 17)
-#define LRADC_CTRL0_XPPSW /* XP */ (1 << 16)
-#define LRADC_CTRL0_PLATE_MASK (0x3f << 16)
+# define LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE (1 << 23)
+# define LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE (1 << 22)
+# define LRADC_CTRL0_MX28_YNNSW /* YM */ (1 << 21)
+# define LRADC_CTRL0_MX28_YPNSW /* YP */ (1 << 20)
+# define LRADC_CTRL0_MX28_YPPSW /* YP */ (1 << 19)
+# define LRADC_CTRL0_MX28_XNNSW /* XM */ (1 << 18)
+# define LRADC_CTRL0_MX28_XNPSW /* XM */ (1 << 17)
+# define LRADC_CTRL0_MX28_XPPSW /* XP */ (1 << 16)
+
+# define LRADC_CTRL0_MX28_PLATE_MASK \
+ (LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE | \
+ LRADC_CTRL0_MX28_YNNSW | LRADC_CTRL0_MX28_YPNSW | \
+ LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW | \
+ LRADC_CTRL0_MX28_XNPSW | LRADC_CTRL0_MX28_XPPSW)
#define LRADC_CTRL1 0x10
#define LRADC_CTRL1_TOUCH_DETECT_IRQ_EN (1 << 24)
#define LRADC_CTRL1_LRADC_IRQ_EN(n) (1 << ((n) + 16))
-#define LRADC_CTRL1_LRADC_IRQ_EN_MASK (0x1fff << 16)
+#define LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK (0x1fff << 16)
#define LRADC_CTRL1_LRADC_IRQ_EN_OFFSET 16
#define LRADC_CTRL1_TOUCH_DETECT_IRQ (1 << 8)
#define LRADC_CTRL1_LRADC_IRQ(n) (1 << (n))
-#define LRADC_CTRL1_LRADC_IRQ_MASK 0x1fff
+#define LRADC_CTRL1_MX28_LRADC_IRQ_MASK 0x1fff
#define LRADC_CTRL1_LRADC_IRQ_OFFSET 0
#define LRADC_CTRL2 0x20
@@ -267,7 +272,7 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
* Virtual channel 0 is always used here as the others are always not
* used if doing raw sampling.
*/
- writel(LRADC_CTRL1_LRADC_IRQ_EN_MASK,
+ writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
@@ -322,9 +327,9 @@ static int mxs_lradc_ts_touched(struct mxs_lradc *lradc)
uint32_t reg;
/* Enable touch detection. */
- writel(LRADC_CTRL0_PLATE_MASK,
+ writel(LRADC_CTRL0_MX28_PLATE_MASK,
lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
- writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
+ writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
msleep(LRADC_TS_SAMPLE_DELAY_MS);
@@ -370,21 +375,21 @@ static int32_t mxs_lradc_ts_sample(struct mxs_lradc *lradc,
*/
switch (plate) {
case LRADC_SAMPLE_X:
- ctrl0 = LRADC_CTRL0_XPPSW | LRADC_CTRL0_XNNSW;
+ ctrl0 = LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
chan = 3;
break;
case LRADC_SAMPLE_Y:
- ctrl0 = LRADC_CTRL0_YPPSW | LRADC_CTRL0_YNNSW;
+ ctrl0 = LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
chan = 4;
break;
case LRADC_SAMPLE_PRESSURE:
- ctrl0 = LRADC_CTRL0_YPPSW | LRADC_CTRL0_XNNSW;
+ ctrl0 = LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
chan = 5;
break;
}
if (change) {
- writel(LRADC_CTRL0_PLATE_MASK,
+ writel(LRADC_CTRL0_MX28_PLATE_MASK,
lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
writel(ctrl0, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
@@ -445,7 +450,7 @@ static void mxs_lradc_ts_work(struct work_struct *ts_work)
while (mxs_lradc_ts_touched(lradc)) {
/* Disable touch detector so we can sample the touchscreen. */
- writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
+ writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
if (likely(valid)) {
@@ -494,7 +499,7 @@ static int mxs_lradc_ts_open(struct input_dev *dev)
lradc->stop_touchscreen = false;
/* Enable the touch-detect circuitry. */
- writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
+ writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
/* Enable the touch-detect IRQ. */
@@ -520,7 +525,7 @@ static void mxs_lradc_ts_close(struct input_dev *dev)
lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
/* Power-down touchscreen touch-detect circuitry. */
- writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
+ writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
}
@@ -584,7 +589,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
LRADC_CTRL1_TOUCH_DETECT_IRQ_EN |
LRADC_CTRL1_TOUCH_DETECT_IRQ;
- if (!(reg & LRADC_CTRL1_LRADC_IRQ_MASK))
+ if (!(reg & LRADC_CTRL1_MX28_LRADC_IRQ_MASK))
return IRQ_NONE;
/*
@@ -604,7 +609,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
complete(&lradc->completion);
- writel(reg & LRADC_CTRL1_LRADC_IRQ_MASK,
+ writel(reg & LRADC_CTRL1_MX28_LRADC_IRQ_MASK,
lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
return IRQ_HANDLED;
@@ -725,7 +730,7 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
if (ret < 0)
goto err_buf;
- writel(LRADC_CTRL1_LRADC_IRQ_EN_MASK,
+ writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
@@ -766,7 +771,7 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
lradc->base + LRADC_DELAY(0) + STMP_OFFSET_REG_CLR);
writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
- writel(LRADC_CTRL1_LRADC_IRQ_EN_MASK,
+ writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
kfree(lradc->buffer);
@@ -870,11 +875,11 @@ static int mxs_lradc_hw_init(struct mxs_lradc *lradc)
writel(0, lradc->base + LRADC_DELAY(3));
/* Configure the touchscreen type */
- writel(LRADC_CTRL0_TOUCH_SCREEN_TYPE,
+ writel(LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
if (lradc->use_touchscreen == MXS_LRADC_TOUCHSCREEN_5WIRE) {
- writel(LRADC_CTRL0_TOUCH_SCREEN_TYPE,
+ writel(LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
}
@@ -888,7 +893,7 @@ static void mxs_lradc_hw_stop(struct mxs_lradc *lradc)
{
int i;
- writel(LRADC_CTRL1_LRADC_IRQ_EN_MASK,
+ writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
for (i = 0; i < LRADC_MAX_DELAY_CHANS; i++)
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 4/9] Staging/iio/adc/touchscreen/MXS: simplify register access
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
` (2 preceding siblings ...)
2013-09-23 14:36 ` [PATCH 3/9] Staging/iio/adc/touchscreen/MXS: separate i.MX28 specific register bits Juergen Beisert
@ 2013-09-23 14:36 ` Juergen Beisert
2013-10-01 11:01 ` Jonathan Cameron
2013-09-23 14:36 ` [PATCH 5/9] Staging/iio/adc/touchscreen/MXS: add i.MX23 support to the LRADC touchscreen driver Juergen Beisert
` (4 subsequent siblings)
8 siblings, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: devel, marex, fabio.estevam, jic23, linux-input, linux-arm-kernel
Replace the individual register access by a few shared access function to make the
code easier to read and in order to add the i.MX23 SoC in the next step.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-input@vger.kernel.org
CC: devel@driverdev.osuosl.org
CC: Marek Vasut <marex@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
CC: Jonathan Cameron <jic23@cam.ac.uk>
---
drivers/staging/iio/adc/mxs-lradc.c | 204 +++++++++++++++++++++---------------
1 file changed, 120 insertions(+), 84 deletions(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index f2fb10a..dd47ec2 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -238,6 +238,56 @@ struct mxs_lradc {
#define LRADC_RESOLUTION 12
#define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1)
+static void mxs_lradc_reg_set(struct mxs_lradc *lradc, u32 val, u32 reg)
+{
+ writel(val, lradc->base + reg + STMP_OFFSET_REG_SET);
+}
+
+static void mxs_lradc_reg_clear(struct mxs_lradc *lradc, u32 val, u32 reg)
+{
+ writel(val, lradc->base + reg + STMP_OFFSET_REG_CLR);
+}
+
+static void mxs_lradc_reg_wrt(struct mxs_lradc *lradc, u32 val, u32 reg)
+{
+ writel(val, lradc->base + reg);
+}
+
+static u32 mxs_lradc_plate_mask(struct mxs_lradc *lradc)
+{
+ return LRADC_CTRL0_MX28_PLATE_MASK;
+}
+
+static u32 mxs_lradc_irq_en_mask(struct mxs_lradc *lradc)
+{
+ return LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK;
+}
+
+static u32 mxs_lradc_irq_mask(struct mxs_lradc *lradc)
+{
+ return LRADC_CTRL1_MX28_LRADC_IRQ_MASK;
+}
+
+static u32 mxs_lradc_touch_detect_bit(struct mxs_lradc *lradc)
+{
+ return LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE;
+}
+
+static u32 mxs_lradc_drive_x_plate(struct mxs_lradc *lradc)
+{
+ return LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
+}
+
+static u32 mxs_lradc_drive_y_plate(struct mxs_lradc *lradc)
+{
+ return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
+}
+
+static u32 mxs_lradc_drive_pressure(struct mxs_lradc *lradc)
+{
+ return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
+}
+
/*
* Raw I/O operations
*/
@@ -272,21 +322,19 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
* Virtual channel 0 is always used here as the others are always not
* used if doing raw sampling.
*/
- writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
- writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
+ LRADC_CTRL1);
+ mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
/* Clean the slot's previous content, then set new one. */
- writel(LRADC_CTRL4_LRADCSELECT_MASK(0),
- lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_CLR);
- writel(chan->channel, lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(0), LRADC_CTRL4);
+ mxs_lradc_reg_set(lradc, chan->channel, LRADC_CTRL4);
- writel(0, lradc->base + LRADC_CH(0));
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(0));
/* Enable the IRQ and start sampling the channel. */
- writel(LRADC_CTRL1_LRADC_IRQ_EN(0),
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_SET);
- writel(1 << 0, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), LRADC_CTRL1);
+ mxs_lradc_reg_set(lradc, 1 << 0, LRADC_CTRL0);
/* Wait for completion on the channel, 1 second max. */
ret = wait_for_completion_killable_timeout(&lradc->completion, HZ);
@@ -300,8 +348,7 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
ret = IIO_VAL_INT;
err:
- writel(LRADC_CTRL1_LRADC_IRQ_EN(0),
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), LRADC_CTRL1);
mutex_unlock(&lradc->lock);
@@ -327,10 +374,9 @@ static int mxs_lradc_ts_touched(struct mxs_lradc *lradc)
uint32_t reg;
/* Enable touch detection. */
- writel(LRADC_CTRL0_MX28_PLATE_MASK,
- lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
- writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
- lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
+ mxs_lradc_reg_set(lradc, mxs_lradc_touch_detect_bit(lradc),
+ LRADC_CTRL0);
msleep(LRADC_TS_SAMPLE_DELAY_MS);
@@ -375,32 +421,33 @@ static int32_t mxs_lradc_ts_sample(struct mxs_lradc *lradc,
*/
switch (plate) {
case LRADC_SAMPLE_X:
- ctrl0 = LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
+ ctrl0 = mxs_lradc_drive_x_plate(lradc);
chan = 3;
break;
case LRADC_SAMPLE_Y:
- ctrl0 = LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
+ ctrl0 = mxs_lradc_drive_y_plate(lradc);
chan = 4;
break;
case LRADC_SAMPLE_PRESSURE:
- ctrl0 = LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
+ ctrl0 = mxs_lradc_drive_pressure(lradc);
chan = 5;
break;
}
if (change) {
- writel(LRADC_CTRL0_MX28_PLATE_MASK,
- lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
- writel(ctrl0, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
-
- writel(LRADC_CTRL4_LRADCSELECT_MASK(slot),
- lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_CLR);
- writel(chan << LRADC_CTRL4_LRADCSELECT_OFFSET(slot),
- lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc),
+ LRADC_CTRL0);
+ mxs_lradc_reg_set(lradc, ctrl0, LRADC_CTRL0);
+
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(slot),
+ LRADC_CTRL4);
+ mxs_lradc_reg_set(lradc,
+ chan << LRADC_CTRL4_LRADCSELECT_OFFSET(slot),
+ LRADC_CTRL4);
}
- writel(0xffffffff, lradc->base + LRADC_CH(slot) + STMP_OFFSET_REG_CLR);
- writel(1 << slot, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_clear(lradc, 0xffffffff, LRADC_CH(slot));
+ mxs_lradc_reg_set(lradc, 1 << slot, LRADC_CTRL0);
delay = jiffies + msecs_to_jiffies(LRADC_TS_SAMPLE_DELAY_MS);
do {
@@ -410,8 +457,7 @@ static int32_t mxs_lradc_ts_sample(struct mxs_lradc *lradc,
break;
} while (time_before(jiff, delay));
- writel(LRADC_CTRL1_LRADC_IRQ(slot),
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(slot), LRADC_CTRL1);
if (time_after_eq(jiff, delay))
return -ETIMEDOUT;
@@ -450,8 +496,8 @@ static void mxs_lradc_ts_work(struct work_struct *ts_work)
while (mxs_lradc_ts_touched(lradc)) {
/* Disable touch detector so we can sample the touchscreen. */
- writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
- lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, mxs_lradc_touch_detect_bit(lradc),
+ LRADC_CTRL0);
if (likely(valid)) {
input_report_abs(lradc->ts_input, ABS_X, val_x);
@@ -485,10 +531,8 @@ static void mxs_lradc_ts_work(struct work_struct *ts_work)
return;
/* Restart the touchscreen interrupts. */
- writel(LRADC_CTRL1_TOUCH_DETECT_IRQ,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
- writel(LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
+ mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
}
static int mxs_lradc_ts_open(struct input_dev *dev)
@@ -499,12 +543,11 @@ static int mxs_lradc_ts_open(struct input_dev *dev)
lradc->stop_touchscreen = false;
/* Enable the touch-detect circuitry. */
- writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
- lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_set(lradc, mxs_lradc_touch_detect_bit(lradc),
+ LRADC_CTRL0);
/* Enable the touch-detect IRQ. */
- writel(LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
return 0;
}
@@ -521,12 +564,11 @@ static void mxs_lradc_ts_close(struct input_dev *dev)
cancel_work_sync(&lradc->ts_work);
/* Disable touchscreen touch-detect IRQ. */
- writel(LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
+ LRADC_CTRL1);
/* Power-down touchscreen touch-detect circuitry. */
- writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
- lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, mxs_lradc_touch_detect_bit(lradc), LRADC_CTRL0);
}
static int mxs_lradc_ts_register(struct mxs_lradc *lradc)
@@ -589,7 +631,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
LRADC_CTRL1_TOUCH_DETECT_IRQ_EN |
LRADC_CTRL1_TOUCH_DETECT_IRQ;
- if (!(reg & LRADC_CTRL1_MX28_LRADC_IRQ_MASK))
+ if (!(reg & mxs_lradc_irq_mask(lradc)))
return IRQ_NONE;
/*
@@ -598,8 +640,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
* it ASAP
*/
if (reg & LRADC_CTRL1_TOUCH_DETECT_IRQ) {
- writel(ts_irq_mask,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, ts_irq_mask, LRADC_CTRL1);
if (!lradc->stop_touchscreen)
schedule_work(&lradc->ts_work);
}
@@ -609,8 +650,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
complete(&lradc->completion);
- writel(reg & LRADC_CTRL1_MX28_LRADC_IRQ_MASK,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc), LRADC_CTRL1);
return IRQ_HANDLED;
}
@@ -629,7 +669,7 @@ static irqreturn_t mxs_lradc_trigger_handler(int irq, void *p)
for_each_set_bit(i, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
lradc->buffer[j] = readl(lradc->base + LRADC_CH(j));
- writel(chan_value, lradc->base + LRADC_CH(j));
+ mxs_lradc_reg_wrt(lradc, chan_value, LRADC_CH(j));
lradc->buffer[j] &= LRADC_CH_VALUE_MASK;
lradc->buffer[j] /= LRADC_DELAY_TIMER_LOOP;
j++;
@@ -654,7 +694,7 @@ static int mxs_lradc_configure_trigger(struct iio_trigger *trig, bool state)
struct mxs_lradc *lradc = iio_priv(iio);
const uint32_t st = state ? STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR;
- writel(LRADC_DELAY_KICK, lradc->base + LRADC_DELAY(0) + st);
+ mxs_lradc_reg_wrt(lradc, LRADC_DELAY_KICK, LRADC_DELAY(0) + st);
return 0;
}
@@ -730,29 +770,26 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
if (ret < 0)
goto err_buf;
- writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
- writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
+ LRADC_CTRL1);
+ mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs);
ctrl4_clr |= LRADC_CTRL4_LRADCSELECT_MASK(ofs);
ctrl1_irq |= LRADC_CTRL1_LRADC_IRQ_EN(ofs);
- writel(chan_value, lradc->base + LRADC_CH(ofs));
+ mxs_lradc_reg_wrt(lradc, chan_value, LRADC_CH(ofs));
bitmap_set(&enable, ofs, 1);
ofs++;
}
- writel(LRADC_DELAY_TRIGGER_LRADCS_MASK | LRADC_DELAY_KICK,
- lradc->base + LRADC_DELAY(0) + STMP_OFFSET_REG_CLR);
-
- writel(ctrl4_clr, lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_CLR);
- writel(ctrl4_set, lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_SET);
-
- writel(ctrl1_irq, lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_SET);
-
- writel(enable << LRADC_DELAY_TRIGGER_LRADCS_OFFSET,
- lradc->base + LRADC_DELAY(0) + STMP_OFFSET_REG_SET);
+ mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
+ LRADC_DELAY_KICK, LRADC_DELAY(0));
+ mxs_lradc_reg_clear(lradc, ctrl4_clr, LRADC_CTRL4);
+ mxs_lradc_reg_set(lradc, ctrl4_set, LRADC_CTRL4);
+ mxs_lradc_reg_set(lradc, ctrl1_irq, LRADC_CTRL1);
+ mxs_lradc_reg_set(lradc, enable << LRADC_DELAY_TRIGGER_LRADCS_OFFSET,
+ LRADC_DELAY(0));
return 0;
@@ -767,12 +804,12 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
{
struct mxs_lradc *lradc = iio_priv(iio);
- writel(LRADC_DELAY_TRIGGER_LRADCS_MASK | LRADC_DELAY_KICK,
- lradc->base + LRADC_DELAY(0) + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
+ LRADC_DELAY_KICK, LRADC_DELAY(0));
- writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
- writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
+ LRADC_CTRL1);
kfree(lradc->buffer);
mutex_unlock(&lradc->lock);
@@ -867,24 +904,24 @@ static int mxs_lradc_hw_init(struct mxs_lradc *lradc)
return ret;
/* Configure DELAY CHANNEL 0 for generic ADC sampling. */
- writel(adc_cfg, lradc->base + LRADC_DELAY(0));
+ mxs_lradc_reg_wrt(lradc, adc_cfg, LRADC_DELAY(0));
/* Disable remaining DELAY CHANNELs */
- writel(0, lradc->base + LRADC_DELAY(1));
- writel(0, lradc->base + LRADC_DELAY(2));
- writel(0, lradc->base + LRADC_DELAY(3));
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(1));
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2));
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
/* Configure the touchscreen type */
- writel(LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
- lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
+ LRADC_CTRL0);
- if (lradc->use_touchscreen == MXS_LRADC_TOUCHSCREEN_5WIRE) {
- writel(LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
- lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
+ if (lradc->use_touchscreen == MXS_LRADC_TOUCHSCREEN_5WIRE)
+ mxs_lradc_reg_set(lradc, LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
+ LRADC_CTRL0);
}
/* Start internal temperature sensing. */
- writel(0, lradc->base + LRADC_CTRL2);
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_CTRL2);
return 0;
}
@@ -893,11 +930,10 @@ static void mxs_lradc_hw_stop(struct mxs_lradc *lradc)
{
int i;
- writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
- lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
+ mxs_lradc_reg_clear(lradc, mxs_lradc_irq_en_mask(lradc), LRADC_CTRL1);
for (i = 0; i < LRADC_MAX_DELAY_CHANS; i++)
- writel(0, lradc->base + LRADC_DELAY(i));
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(i));
}
static const struct of_device_id mxs_lradc_dt_ids[] = {
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 5/9] Staging/iio/adc/touchscreen/MXS: add i.MX23 support to the LRADC touchscreen driver
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
` (3 preceding siblings ...)
2013-09-23 14:36 ` [PATCH 4/9] Staging/iio/adc/touchscreen/MXS: simplify register access Juergen Beisert
@ 2013-09-23 14:36 ` Juergen Beisert
2013-10-01 11:02 ` Jonathan Cameron
2013-09-23 14:36 ` [PATCH 6/9] Staging/iio/adc/touchscreen/MXS: add interrupt driven touch detection Juergen Beisert
` (3 subsequent siblings)
8 siblings, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: linux-arm-kernel, devel, marex, fabio.estevam, jic23, linux-input
Distinguish i.MX23 and i.MX28 at runtime and do the same for both SoC at least
for the 4 wire touchscreen.
Note: support for the remaining LRADC channels is not tested on an
i.MX23 yet.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-input@vger.kernel.org
CC: devel@driverdev.osuosl.org
CC: Marek Vasut <marex@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
CC: Jonathan Cameron <jic23@cam.ac.uk>
---
drivers/staging/iio/adc/mxs-lradc.c | 66 ++++++++++++++++++++++++++++++-------
1 file changed, 55 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index dd47ec2..a92e810 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -191,20 +191,33 @@ struct mxs_lradc {
# define LRADC_CTRL0_MX28_XNPSW /* XM */ (1 << 17)
# define LRADC_CTRL0_MX28_XPPSW /* XP */ (1 << 16)
+# define LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE (1 << 20)
+# define LRADC_CTRL0_MX23_YM (1 << 19)
+# define LRADC_CTRL0_MX23_XM (1 << 18)
+# define LRADC_CTRL0_MX23_YP (1 << 17)
+# define LRADC_CTRL0_MX23_XP (1 << 16)
+
# define LRADC_CTRL0_MX28_PLATE_MASK \
(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE | \
LRADC_CTRL0_MX28_YNNSW | LRADC_CTRL0_MX28_YPNSW | \
LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW | \
LRADC_CTRL0_MX28_XNPSW | LRADC_CTRL0_MX28_XPPSW)
+# define LRADC_CTRL0_MX23_PLATE_MASK \
+ (LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE | \
+ LRADC_CTRL0_MX23_YM | LRADC_CTRL0_MX23_XM | \
+ LRADC_CTRL0_MX23_YP | LRADC_CTRL0_MX23_XP)
+
#define LRADC_CTRL1 0x10
#define LRADC_CTRL1_TOUCH_DETECT_IRQ_EN (1 << 24)
#define LRADC_CTRL1_LRADC_IRQ_EN(n) (1 << ((n) + 16))
#define LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK (0x1fff << 16)
+#define LRADC_CTRL1_MX23_LRADC_IRQ_EN_MASK (0x01ff << 16)
#define LRADC_CTRL1_LRADC_IRQ_EN_OFFSET 16
#define LRADC_CTRL1_TOUCH_DETECT_IRQ (1 << 8)
#define LRADC_CTRL1_LRADC_IRQ(n) (1 << (n))
#define LRADC_CTRL1_MX28_LRADC_IRQ_MASK 0x1fff
+#define LRADC_CTRL1_MX23_LRADC_IRQ_MASK 0x01ff
#define LRADC_CTRL1_LRADC_IRQ_OFFSET 0
#define LRADC_CTRL2 0x20
@@ -255,37 +268,58 @@ static void mxs_lradc_reg_wrt(struct mxs_lradc *lradc, u32 val, u32 reg)
static u32 mxs_lradc_plate_mask(struct mxs_lradc *lradc)
{
- return LRADC_CTRL0_MX28_PLATE_MASK;
+ if (lradc->soc == IMX23_LRADC)
+ return LRADC_CTRL0_MX23_PLATE_MASK;
+ else
+ return LRADC_CTRL0_MX28_PLATE_MASK;
}
static u32 mxs_lradc_irq_en_mask(struct mxs_lradc *lradc)
{
- return LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK;
+ if (lradc->soc == IMX23_LRADC)
+ return LRADC_CTRL1_MX23_LRADC_IRQ_EN_MASK;
+ else
+ return LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK;
}
static u32 mxs_lradc_irq_mask(struct mxs_lradc *lradc)
{
- return LRADC_CTRL1_MX28_LRADC_IRQ_MASK;
+ if (lradc->soc == IMX23_LRADC)
+ return LRADC_CTRL1_MX23_LRADC_IRQ_MASK;
+ else
+ return LRADC_CTRL1_MX28_LRADC_IRQ_MASK;
}
static u32 mxs_lradc_touch_detect_bit(struct mxs_lradc *lradc)
{
- return LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE;
+ if (lradc->soc == IMX23_LRADC)
+ return LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE;
+ else
+ return LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE;
}
static u32 mxs_lradc_drive_x_plate(struct mxs_lradc *lradc)
{
- return LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
+ if (lradc->soc == IMX23_LRADC)
+ return LRADC_CTRL0_MX23_XP | LRADC_CTRL0_MX23_XM;
+ else
+ return LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
}
static u32 mxs_lradc_drive_y_plate(struct mxs_lradc *lradc)
{
- return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
+ if (lradc->soc == IMX23_LRADC)
+ return LRADC_CTRL0_MX23_YP | LRADC_CTRL0_MX23_YM;
+ else
+ return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
}
static u32 mxs_lradc_drive_pressure(struct mxs_lradc *lradc)
{
- return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
+ if (lradc->soc == IMX23_LRADC)
+ return LRADC_CTRL0_MX23_YP | LRADC_CTRL0_MX23_XM;
+ else
+ return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
}
/*
@@ -322,7 +356,8 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
* Virtual channel 0 is always used here as the others are always not
* used if doing raw sampling.
*/
- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
+ if (lradc->soc == IMX28_LRADC)
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
LRADC_CTRL1);
mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
@@ -770,7 +805,8 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
if (ret < 0)
goto err_buf;
- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
+ if (lradc->soc == IMX28_LRADC)
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
LRADC_CTRL1);
mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
@@ -808,7 +844,8 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
LRADC_DELAY_KICK, LRADC_DELAY(0));
mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
+ if (lradc->soc == IMX28_LRADC)
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
LRADC_CTRL1);
kfree(lradc->buffer);
@@ -912,7 +949,8 @@ static int mxs_lradc_hw_init(struct mxs_lradc *lradc)
mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
/* Configure the touchscreen type */
- mxs_lradc_reg_clear(lradc, LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
+ if (lradc->soc == IMX28_LRADC) {
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
LRADC_CTRL0);
if (lradc->use_touchscreen == MXS_LRADC_TOUCHSCREEN_5WIRE)
@@ -993,6 +1031,12 @@ static int mxs_lradc_probe(struct platform_device *pdev)
dev_warn(dev, "Unsupported number of touchscreen wires (%d)\n",
ts_wires);
+ if ((lradc->soc == IMX23_LRADC) && (ts_wires == 5)) {
+ dev_warn(dev, "No support for 5 wire touches on i.MX23\n");
+ dev_warn(dev, "Falling back to 4 wire\n");
+ ts_wires = 4;
+ }
+
/* Grab all IRQ sources */
for (i = 0; i < of_cfg->irq_count; i++) {
lradc->irq[i] = platform_get_irq(pdev, i);
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 6/9] Staging/iio/adc/touchscreen/MXS: add interrupt driven touch detection
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
` (4 preceding siblings ...)
2013-09-23 14:36 ` [PATCH 5/9] Staging/iio/adc/touchscreen/MXS: add i.MX23 support to the LRADC touchscreen driver Juergen Beisert
@ 2013-09-23 14:36 ` Juergen Beisert
[not found] ` <1379946998-23041-7-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 14:36 ` [PATCH 7/9] Staging/iio/adc/touchscreen/MXS: remove old touchscreen detection implementation Juergen Beisert
` (2 subsequent siblings)
8 siblings, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: linux-arm-kernel, devel, marex, fabio.estevam, jic23, linux-input,
Dmitry Torokhov
For battery driven systems it is a very bad idea to collect the touchscreen
data within a kernel busy loop.
This change uses the features of the hardware to delay and accumulate samples in
hardware to avoid a high interrupt and CPU load.
Note: this is only tested on an i.MX23 SoC yet.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-input@vger.kernel.org
CC: devel@driverdev.osuosl.org
CC: Marek Vasut <marex@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
CC: Jonathan Cameron <jic23@cam.ac.uk>
CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
CC: linux-input@vger.kernel.org
---
drivers/staging/iio/adc/mxs-lradc.c | 530 ++++++++++++++++++++++++++++++++----
1 file changed, 476 insertions(+), 54 deletions(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index a92e810..76a900d 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -130,6 +130,17 @@ enum mxs_lradc_ts {
MXS_LRADC_TOUCHSCREEN_5WIRE,
};
+/*
+ * Touchscreen handling
+ */
+enum lradc_ts_plate {
+ LRADC_TOUCH = 0,
+ LRADC_SAMPLE_X,
+ LRADC_SAMPLE_Y,
+ LRADC_SAMPLE_PRESSURE,
+ LRADC_SAMPLE_VALID,
+};
+
struct mxs_lradc {
struct device *dev;
void __iomem *base;
@@ -172,13 +183,25 @@ struct mxs_lradc {
#define CHAN_MASK_TOUCHSCREEN_4WIRE (0xf << 2)
#define CHAN_MASK_TOUCHSCREEN_5WIRE (0x1f << 2)
enum mxs_lradc_ts use_touchscreen;
- bool stop_touchscreen;
bool use_touchbutton;
struct input_dev *ts_input;
struct work_struct ts_work;
enum mxs_lradc_id soc;
+ enum lradc_ts_plate cur_plate; /* statemachine */
+ bool ts_valid;
+ unsigned ts_x_pos;
+ unsigned ts_y_pos;
+ unsigned ts_pressure;
+
+ /* handle touchscreen's physical behaviour */
+ /* samples per coordinate */
+ unsigned over_sample_cnt;
+ /* time clocks between samples */
+ unsigned over_sample_delay;
+ /* time in clocks to wait after the plates where switched */
+ unsigned settling_delay;
};
#define LRADC_CTRL0 0x00
@@ -230,19 +253,33 @@ struct mxs_lradc {
#define LRADC_CH_ACCUMULATE (1 << 29)
#define LRADC_CH_NUM_SAMPLES_MASK (0x1f << 24)
#define LRADC_CH_NUM_SAMPLES_OFFSET 24
+#define LRADC_CH_NUM_SAMPLES(x) \
+ ((x) << LRADC_CH_NUM_SAMPLES_OFFSET)
#define LRADC_CH_VALUE_MASK 0x3ffff
#define LRADC_CH_VALUE_OFFSET 0
#define LRADC_DELAY(n) (0xd0 + (0x10 * (n)))
#define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24)
#define LRADC_DELAY_TRIGGER_LRADCS_OFFSET 24
+#define LRADC_DELAY_TRIGGER(x) \
+ (((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \
+ LRADC_DELAY_TRIGGER_LRADCS_MASK)
#define LRADC_DELAY_KICK (1 << 20)
#define LRADC_DELAY_TRIGGER_DELAYS_MASK (0xf << 16)
#define LRADC_DELAY_TRIGGER_DELAYS_OFFSET 16
+#define LRADC_DELAY_TRIGGER_DELAYS(x) \
+ (((x) << LRADC_DELAY_TRIGGER_DELAYS_OFFSET) & \
+ LRADC_DELAY_TRIGGER_DELAYS_MASK)
#define LRADC_DELAY_LOOP_COUNT_MASK (0x1f << 11)
#define LRADC_DELAY_LOOP_COUNT_OFFSET 11
+#define LRADC_DELAY_LOOP(x) \
+ (((x) << LRADC_DELAY_LOOP_COUNT_OFFSET) & \
+ LRADC_DELAY_LOOP_COUNT_MASK)
#define LRADC_DELAY_DELAY_MASK 0x7ff
#define LRADC_DELAY_DELAY_OFFSET 0
+#define LRADC_DELAY_DELAY(x) \
+ (((x) << LRADC_DELAY_DELAY_OFFSET) & \
+ LRADC_DELAY_DELAY_MASK)
#define LRADC_CTRL4 0x140
#define LRADC_CTRL4_LRADCSELECT_MASK(n) (0xf << ((n) * 4))
@@ -322,6 +359,404 @@ static u32 mxs_lradc_drive_pressure(struct mxs_lradc *lradc)
return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
}
+static bool mxs_lradc_check_touch_event(struct mxs_lradc *lradc)
+{
+ return !!(readl(lradc->base + LRADC_STATUS) &
+ LRADC_STATUS_TOUCH_DETECT_RAW);
+}
+
+static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch)
+{
+ /*
+ * prepare for oversampling conversion
+ *
+ * from the datasheet:
+ * "The ACCUMULATE bit in the appropriate channel register
+ * HW_LRADC_CHn must be set to 1 if NUM_SAMPLES is greater then 0;
+ * otherwise, the IRQs will not fire."
+ */
+ mxs_lradc_reg_wrt(lradc, LRADC_CH_ACCUMULATE |
+ LRADC_CH_NUM_SAMPLES(lradc->over_sample_cnt - 1),
+ LRADC_CH(ch));
+
+ /* from the datasheet:
+ * "Software must clear this register in preparation for a
+ * multi-cycle accumulation.
+ */
+ mxs_lradc_reg_clear(lradc, LRADC_CH_VALUE_MASK, LRADC_CH(ch));
+
+ /* prepare the delay/loop unit according to the oversampling count */
+ mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << ch) |
+ LRADC_DELAY_TRIGGER_DELAYS(0) |
+ LRADC_DELAY_LOOP(lradc->over_sample_cnt - 1) |
+ LRADC_DELAY_DELAY(lradc->over_sample_delay - 1),
+ LRADC_DELAY(3));
+
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) |
+ LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) |
+ LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
+
+ /* wake us again, when the complete conversion is done */
+ mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch), LRADC_CTRL1);
+ /*
+ * after changing the touchscreen plates setting
+ * the signals need some initial time to settle. Start the
+ * SoC's delay unit and start the conversion later
+ * and automatically.
+ */
+ mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(0) | /* don't trigger ADC */
+ LRADC_DELAY_TRIGGER_DELAYS(1 << 3) | /* trigger DELAY unit#3 */
+ LRADC_DELAY_KICK |
+ LRADC_DELAY_DELAY(lradc->settling_delay),
+ LRADC_DELAY(2));
+}
+
+/*
+ * Pressure detection is special:
+ * We want to do both required measurements for the pressure detection in
+ * one turn. Use the hardware features to chain both conversions and let the
+ * hardware report one interrupt if both conversions are done
+ */
+static void mxs_lradc_setup_ts_pressure(struct mxs_lradc *lradc, unsigned ch1,
+ unsigned ch2)
+{
+ u32 reg;
+
+ /*
+ * prepare for oversampling conversion
+ *
+ * from the datasheet:
+ * "The ACCUMULATE bit in the appropriate channel register
+ * HW_LRADC_CHn must be set to 1 if NUM_SAMPLES is greater then 0;
+ * otherwise, the IRQs will not fire."
+ */
+ reg = LRADC_CH_ACCUMULATE |
+ LRADC_CH_NUM_SAMPLES(lradc->over_sample_cnt - 1);
+ mxs_lradc_reg_wrt(lradc, reg, LRADC_CH(ch1));
+ mxs_lradc_reg_wrt(lradc, reg, LRADC_CH(ch2));
+
+ /* from the datasheet:
+ * "Software must clear this register in preparation for a
+ * multi-cycle accumulation.
+ */
+ mxs_lradc_reg_clear(lradc, LRADC_CH_VALUE_MASK, LRADC_CH(ch1));
+ mxs_lradc_reg_clear(lradc, LRADC_CH_VALUE_MASK, LRADC_CH(ch2));
+
+ /* prepare the delay/loop unit according to the oversampling count */
+ mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << ch1) |
+ LRADC_DELAY_TRIGGER(1 << ch2) | /* start both channels */
+ LRADC_DELAY_TRIGGER_DELAYS(0) |
+ LRADC_DELAY_LOOP(lradc->over_sample_cnt - 1) |
+ LRADC_DELAY_DELAY(lradc->over_sample_delay - 1),
+ LRADC_DELAY(3));
+
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) |
+ LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) |
+ LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
+
+ /* wake us again, when the conversions are done */
+ mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch2), LRADC_CTRL1);
+ /*
+ * after changing the touchscreen plates setting
+ * the signals need some initial time to settle. Start the
+ * SoC's delay unit and start the conversion later
+ * and automatically.
+ */
+ mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(0) | /* don't trigger ADC */
+ LRADC_DELAY_TRIGGER_DELAYS(1 << 3) | /* trigger DELAY unit#3 */
+ LRADC_DELAY_KICK |
+ LRADC_DELAY_DELAY(lradc->settling_delay), LRADC_DELAY(2));
+}
+
+static unsigned mxs_lradc_read_raw_channel(struct mxs_lradc *lradc,
+ unsigned channel)
+{
+ u32 reg;
+ unsigned num_samples, val;
+
+ reg = readl(lradc->base + LRADC_CH(channel));
+ if (reg & LRADC_CH_ACCUMULATE)
+ num_samples = lradc->over_sample_cnt;
+ else
+ num_samples = 1;
+
+ val = (reg & LRADC_CH_VALUE_MASK) >> LRADC_CH_VALUE_OFFSET;
+ return val / num_samples;
+}
+
+static unsigned mxs_lradc_read_ts_pressure(struct mxs_lradc *lradc,
+ unsigned ch1, unsigned ch2)
+{
+ u32 reg, mask;
+ unsigned pressure, m1, m2;
+
+ mask = LRADC_CTRL1_LRADC_IRQ(ch1) | LRADC_CTRL1_LRADC_IRQ(ch2);
+ reg = readl(lradc->base + LRADC_CTRL1) & mask;
+
+ while (reg != mask) {
+ reg = readl(lradc->base + LRADC_CTRL1) & mask;
+ dev_dbg(lradc->dev, "One channel is still busy: %X\n", reg);
+ }
+
+ m1 = mxs_lradc_read_raw_channel(lradc, ch1);
+ m2 = mxs_lradc_read_raw_channel(lradc, ch2);
+
+ if (m2 == 0) {
+ dev_warn(lradc->dev, "Cannot calculate pressure\n");
+ return 1 << (LRADC_RESOLUTION - 1);
+ }
+
+ /* simply scale the value from 0 ... max ADC resolution */
+ pressure = m1;
+ pressure *= (1 << LRADC_RESOLUTION);
+ pressure /= m2;
+
+ dev_dbg(lradc->dev, "Pressure = %u\n", pressure);
+ return pressure;
+}
+
+#define TS_CH_XP 2
+#define TS_CH_YP 3
+#define TS_CH_XM 4
+#define TS_CH_YM 5
+
+static int mxs_lradc_read_ts_channel(struct mxs_lradc *lradc)
+{
+ u32 reg;
+ int val;
+
+ reg = readl(lradc->base + LRADC_CTRL1);
+
+ /* only channels 3 to 5 are of interest here */
+ if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YP)) {
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YP) |
+ LRADC_CTRL1_LRADC_IRQ(TS_CH_YP), LRADC_CTRL1);
+ val = mxs_lradc_read_raw_channel(lradc, TS_CH_YP);
+ } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_XM)) {
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_XM) |
+ LRADC_CTRL1_LRADC_IRQ(TS_CH_XM), LRADC_CTRL1);
+ val = mxs_lradc_read_raw_channel(lradc, TS_CH_XM);
+ } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YM)) {
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YM) |
+ LRADC_CTRL1_LRADC_IRQ(TS_CH_YM), LRADC_CTRL1);
+ val = mxs_lradc_read_raw_channel(lradc, TS_CH_YM);
+ } else {
+ return -EIO;
+ }
+
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2));
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
+
+ return val;
+}
+
+/*
+ * YP(open)--+-------------+
+ * | |--+
+ * | | |
+ * YM(-)--+-------------+ |
+ * +--------------+
+ * | |
+ * XP(weak+) XM(open)
+ *
+ * "weak+" means 200k Ohm VDDIO
+ * (-) means GND
+ */
+static void mxs_lradc_setup_touch_detection(struct mxs_lradc *lradc)
+{
+ /*
+ * In order to detect a touch event the 'touch detect enable' bit
+ * enables:
+ * - a weak pullup to the X+ connector
+ * - a strong ground at the Y- connector
+ */
+ mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
+ mxs_lradc_reg_set(lradc, mxs_lradc_touch_detect_bit(lradc),
+ LRADC_CTRL0);
+}
+
+/*
+ * YP(meas)--+-------------+
+ * | |--+
+ * | | |
+ * YM(open)--+-------------+ |
+ * +--------------+
+ * | |
+ * XP(+) XM(-)
+ *
+ * (+) means here 1.85 V
+ * (-) means here GND
+ */
+static void mxs_lradc_prepare_x_pos(struct mxs_lradc *lradc)
+{
+ mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
+ mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0);
+
+ lradc->cur_plate = LRADC_SAMPLE_X;
+ mxs_lradc_setup_ts_channel(lradc, TS_CH_YP);
+}
+
+/*
+ * YP(+)--+-------------+
+ * | |--+
+ * | | |
+ * YM(-)--+-------------+ |
+ * +--------------+
+ * | |
+ * XP(open) XM(meas)
+ *
+ * (+) means here 1.85 V
+ * (-) means here GND
+ */
+static void mxs_lradc_prepare_y_pos(struct mxs_lradc *lradc)
+{
+ mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
+ mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0);
+
+ lradc->cur_plate = LRADC_SAMPLE_Y;
+ mxs_lradc_setup_ts_channel(lradc, TS_CH_XM);
+}
+
+/*
+ * YP(+)--+-------------+
+ * | |--+
+ * | | |
+ * YM(meas)--+-------------+ |
+ * +--------------+
+ * | |
+ * XP(meas) XM(-)
+ *
+ * (+) means here 1.85 V
+ * (-) means here GND
+ */
+static void mxs_lradc_prepare_pressure(struct mxs_lradc *lradc)
+{
+ mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
+ mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0);
+
+ lradc->cur_plate = LRADC_SAMPLE_PRESSURE;
+ mxs_lradc_setup_ts_pressure(lradc, TS_CH_XP, TS_CH_YM);
+}
+
+static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc)
+{
+ mxs_lradc_setup_touch_detection(lradc);
+
+ lradc->cur_plate = LRADC_TOUCH;
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ |
+ LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
+ mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
+}
+
+static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc)
+{
+ input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos);
+ input_report_abs(lradc->ts_input, ABS_Y, lradc->ts_y_pos);
+ input_report_abs(lradc->ts_input, ABS_PRESSURE, lradc->ts_pressure);
+ input_report_key(lradc->ts_input, BTN_TOUCH, 1);
+ input_sync(lradc->ts_input);
+}
+
+static void mxs_lradc_complete_touch_event(struct mxs_lradc *lradc)
+{
+ mxs_lradc_setup_touch_detection(lradc);
+ lradc->cur_plate = LRADC_SAMPLE_VALID;
+ /*
+ * start a dummy conversion to burn time to settle the signals
+ * note: we are not interested in the conversion's value
+ */
+ mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(5));
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
+ mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(5), LRADC_CTRL1);
+ mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << 5) |
+ LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */
+ LRADC_DELAY(2));
+}
+
+/*
+ * in order to avoid false measurements, report only samples where
+ * the surface is still touched after the position measurement
+ */
+static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
+{
+ /* if it is still touched, report the sample */
+ if (valid && mxs_lradc_check_touch_event(lradc)) {
+ lradc->ts_valid = true;
+ mxs_lradc_report_ts_event(lradc);
+ }
+
+ /* if it is even still touched, continue with the next measurement */
+ if (mxs_lradc_check_touch_event(lradc)) {
+ mxs_lradc_prepare_y_pos(lradc);
+ return;
+ }
+
+ if (lradc->ts_valid) {
+ /* signal the release */
+ lradc->ts_valid = false;
+ input_report_key(lradc->ts_input, BTN_TOUCH, 0);
+ input_sync(lradc->ts_input);
+ }
+
+ /* if it is released, wait for the next touch via IRQ */
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
+ mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
+}
+
+/* touchscreen's state machine */
+static void mxs_lradc_handle_touch(struct mxs_lradc *lradc)
+{
+ int val;
+
+ switch (lradc->cur_plate) {
+ case LRADC_TOUCH:
+ /*
+ * start with the Y-pos, because it uses nearly the same plate
+ * settings like the touch detection
+ */
+ if (mxs_lradc_check_touch_event(lradc)) {
+ mxs_lradc_reg_clear(lradc,
+ LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
+ LRADC_CTRL1);
+ mxs_lradc_prepare_y_pos(lradc);
+ }
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ,
+ LRADC_CTRL1);
+ return;
+
+ case LRADC_SAMPLE_Y:
+ val = mxs_lradc_read_ts_channel(lradc);
+ if (val < 0) {
+ mxs_lradc_enable_touch_detection(lradc); /* re-start */
+ return;
+ }
+ lradc->ts_y_pos = val;
+ mxs_lradc_prepare_x_pos(lradc);
+ return;
+
+ case LRADC_SAMPLE_X:
+ val = mxs_lradc_read_ts_channel(lradc);
+ if (val < 0) {
+ mxs_lradc_enable_touch_detection(lradc); /* re-start */
+ return;
+ }
+ lradc->ts_x_pos = val;
+ mxs_lradc_prepare_pressure(lradc);
+ return;
+
+ case LRADC_SAMPLE_PRESSURE:
+ lradc->ts_pressure =
+ mxs_lradc_read_ts_pressure(lradc, TS_CH_XP, TS_CH_YM);
+ mxs_lradc_complete_touch_event(lradc);
+ return;
+
+ case LRADC_SAMPLE_VALID:
+ val = mxs_lradc_read_ts_channel(lradc); /* ignore the value */
+ mxs_lradc_finish_touch_event(lradc, 1);
+ break;
+ }
+}
+
/*
* Raw I/O operations
*/
@@ -395,15 +830,6 @@ static const struct iio_info mxs_lradc_iio_info = {
.read_raw = mxs_lradc_read_raw,
};
-/*
- * Touchscreen handling
- */
-enum lradc_ts_plate {
- LRADC_SAMPLE_X,
- LRADC_SAMPLE_Y,
- LRADC_SAMPLE_PRESSURE,
-};
-
static int mxs_lradc_ts_touched(struct mxs_lradc *lradc)
{
uint32_t reg;
@@ -561,10 +987,6 @@ static void mxs_lradc_ts_work(struct work_struct *ts_work)
input_report_key(lradc->ts_input, BTN_TOUCH, 0);
input_sync(lradc->ts_input);
- /* Do not restart the TS IRQ if the driver is shutting down. */
- if (lradc->stop_touchscreen)
- return;
-
/* Restart the touchscreen interrupts. */
mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
@@ -574,36 +996,29 @@ static int mxs_lradc_ts_open(struct input_dev *dev)
{
struct mxs_lradc *lradc = input_get_drvdata(dev);
- /* The touchscreen is starting. */
- lradc->stop_touchscreen = false;
-
/* Enable the touch-detect circuitry. */
- mxs_lradc_reg_set(lradc, mxs_lradc_touch_detect_bit(lradc),
- LRADC_CTRL0);
-
- /* Enable the touch-detect IRQ. */
- mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
+ mxs_lradc_enable_touch_detection(lradc);
return 0;
}
-static void mxs_lradc_ts_close(struct input_dev *dev)
+static void mxs_lradc_disable_ts(struct mxs_lradc *lradc)
{
- struct mxs_lradc *lradc = input_get_drvdata(dev);
-
- /* Indicate the touchscreen is stopping. */
- lradc->stop_touchscreen = true;
- mb();
+ /* stop all interrupts from firing */
+ mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN |
+ LRADC_CTRL1_LRADC_IRQ_EN(2) | LRADC_CTRL1_LRADC_IRQ_EN(3) |
+ LRADC_CTRL1_LRADC_IRQ_EN(4) | LRADC_CTRL1_LRADC_IRQ_EN(5),
+ LRADC_CTRL1);
- /* Wait until touchscreen thread finishes any possible remnants. */
- cancel_work_sync(&lradc->ts_work);
+ /* Power-down touchscreen touch-detect circuitry. */
+ mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
+}
- /* Disable touchscreen touch-detect IRQ. */
- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
- LRADC_CTRL1);
+static void mxs_lradc_ts_close(struct input_dev *dev)
+{
+ struct mxs_lradc *lradc = input_get_drvdata(dev);
- /* Power-down touchscreen touch-detect circuitry. */
- mxs_lradc_reg_clear(lradc, mxs_lradc_touch_detect_bit(lradc), LRADC_CTRL0);
+ mxs_lradc_disable_ts(lradc);
}
static int mxs_lradc_ts_register(struct mxs_lradc *lradc)
@@ -649,8 +1064,7 @@ static void mxs_lradc_ts_unregister(struct mxs_lradc *lradc)
if (!lradc->use_touchscreen)
return;
- cancel_work_sync(&lradc->ts_work);
-
+ mxs_lradc_disable_ts(lradc);
input_unregister_device(lradc->ts_input);
}
@@ -663,22 +1077,17 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
struct mxs_lradc *lradc = iio_priv(iio);
unsigned long reg = readl(lradc->base + LRADC_CTRL1);
const uint32_t ts_irq_mask =
- LRADC_CTRL1_TOUCH_DETECT_IRQ_EN |
- LRADC_CTRL1_TOUCH_DETECT_IRQ;
+ LRADC_CTRL1_TOUCH_DETECT_IRQ |
+ LRADC_CTRL1_LRADC_IRQ(2) |
+ LRADC_CTRL1_LRADC_IRQ(3) |
+ LRADC_CTRL1_LRADC_IRQ(4) |
+ LRADC_CTRL1_LRADC_IRQ(5);
if (!(reg & mxs_lradc_irq_mask(lradc)))
return IRQ_NONE;
- /*
- * Touchscreen IRQ handling code has priority and therefore
- * is placed here. In case touchscreen IRQ arrives, disable
- * it ASAP
- */
- if (reg & LRADC_CTRL1_TOUCH_DETECT_IRQ) {
- mxs_lradc_reg_clear(lradc, ts_irq_mask, LRADC_CTRL1);
- if (!lradc->stop_touchscreen)
- schedule_work(&lradc->ts_work);
- }
+ if (lradc->use_touchscreen && (reg & ts_irq_mask))
+ mxs_lradc_handle_touch(lradc);
if (iio_buffer_enabled(iio))
iio_trigger_poll(iio->trig, iio_get_time_ns());
@@ -981,6 +1390,17 @@ static const struct of_device_id mxs_lradc_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, mxs_lradc_dt_ids);
+static int mxs_lradc_probe_touchscreen(struct mxs_lradc *lradc,
+ struct device_node *lradc_node)
+{
+ /* TODO retrieve from device tree */
+ lradc->over_sample_cnt = 4;
+ lradc->over_sample_delay = 2;
+ lradc->settling_delay = 10;
+
+ return 0;
+}
+
static int mxs_lradc_probe(struct platform_device *pdev)
{
const struct of_device_id *of_id =
@@ -993,7 +1413,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
struct iio_dev *iio;
struct resource *iores;
uint32_t ts_wires = 0;
- int ret = 0;
+ int ret = 0, touch_ret;
int i;
/* Allocate the IIO device. */
@@ -1016,7 +1436,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
lradc->clk = devm_clk_get(&pdev->dev, NULL);
clk_prepare_enable(lradc->clk);
- INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
+ touch_ret = mxs_lradc_probe_touchscreen(lradc, node);
/* Check if touchscreen is enabled in DT. */
ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
@@ -1079,9 +1499,11 @@ static int mxs_lradc_probe(struct platform_device *pdev)
goto err_dev;
/* Register the touchscreen input device. */
- ret = mxs_lradc_ts_register(lradc);
- if (ret)
- goto err_dev;
+ if (touch_ret == 0) {
+ ret = mxs_lradc_ts_register(lradc);
+ if (ret)
+ goto err_dev;
+ }
/* Register IIO device. */
ret = iio_device_register(iio);
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 7/9] Staging/iio/adc/touchscreen/MXS: remove old touchscreen detection implementation
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
` (5 preceding siblings ...)
2013-09-23 14:36 ` [PATCH 6/9] Staging/iio/adc/touchscreen/MXS: add interrupt driven touch detection Juergen Beisert
@ 2013-09-23 14:36 ` Juergen Beisert
2013-10-01 11:13 ` Jonathan Cameron
[not found] ` <1379946998-23041-1-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 14:36 ` [PATCH 9/9] Staging/iio: add TODO reminder Juergen Beisert
8 siblings, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: devel, marex, fabio.estevam, jic23, linux-input, linux-arm-kernel
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-input@vger.kernel.org
CC: devel@driverdev.osuosl.org
CC: Marek Vasut <marex@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
CC: Jonathan Cameron <jic23@cam.ac.uk>
---
drivers/staging/iio/adc/mxs-lradc.c | 163 ------------------------------------
1 file changed, 163 deletions(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 76a900d..aa1f337 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -186,7 +186,6 @@ struct mxs_lradc {
bool use_touchbutton;
struct input_dev *ts_input;
- struct work_struct ts_work;
enum mxs_lradc_id soc;
enum lradc_ts_plate cur_plate; /* statemachine */
@@ -830,168 +829,6 @@ static const struct iio_info mxs_lradc_iio_info = {
.read_raw = mxs_lradc_read_raw,
};
-static int mxs_lradc_ts_touched(struct mxs_lradc *lradc)
-{
- uint32_t reg;
-
- /* Enable touch detection. */
- mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
- mxs_lradc_reg_set(lradc, mxs_lradc_touch_detect_bit(lradc),
- LRADC_CTRL0);
-
- msleep(LRADC_TS_SAMPLE_DELAY_MS);
-
- reg = readl(lradc->base + LRADC_STATUS);
-
- return reg & LRADC_STATUS_TOUCH_DETECT_RAW;
-}
-
-static int32_t mxs_lradc_ts_sample(struct mxs_lradc *lradc,
- enum lradc_ts_plate plate, int change)
-{
- unsigned long delay, jiff;
- uint32_t reg, ctrl0 = 0, chan = 0;
- /* The touchscreen always uses CTRL4 slot #7. */
- const uint8_t slot = 7;
- uint32_t val;
-
- /*
- * There are three correct configurations of the controller sampling
- * the touchscreen, each of these configuration provides different
- * information from the touchscreen.
- *
- * The following table describes the sampling configurations:
- * +-------------+-------+-------+-------+
- * | Wire \ Axis | X | Y | Z |
- * +---------------------+-------+-------+
- * | X+ (CH2) | HI | TS | TS |
- * +-------------+-------+-------+-------+
- * | X- (CH4) | LO | SH | HI |
- * +-------------+-------+-------+-------+
- * | Y+ (CH3) | SH | HI | HI |
- * +-------------+-------+-------+-------+
- * | Y- (CH5) | TS | LO | SH |
- * +-------------+-------+-------+-------+
- *
- * HI ... strong '1' ; LO ... strong '0'
- * SH ... sample here ; TS ... tri-state
- *
- * There are a few other ways of obtaining the Z coordinate
- * (aka. pressure), but the one in the table seems to be the
- * most reliable one.
- */
- switch (plate) {
- case LRADC_SAMPLE_X:
- ctrl0 = mxs_lradc_drive_x_plate(lradc);
- chan = 3;
- break;
- case LRADC_SAMPLE_Y:
- ctrl0 = mxs_lradc_drive_y_plate(lradc);
- chan = 4;
- break;
- case LRADC_SAMPLE_PRESSURE:
- ctrl0 = mxs_lradc_drive_pressure(lradc);
- chan = 5;
- break;
- }
-
- if (change) {
- mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc),
- LRADC_CTRL0);
- mxs_lradc_reg_set(lradc, ctrl0, LRADC_CTRL0);
-
- mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(slot),
- LRADC_CTRL4);
- mxs_lradc_reg_set(lradc,
- chan << LRADC_CTRL4_LRADCSELECT_OFFSET(slot),
- LRADC_CTRL4);
- }
-
- mxs_lradc_reg_clear(lradc, 0xffffffff, LRADC_CH(slot));
- mxs_lradc_reg_set(lradc, 1 << slot, LRADC_CTRL0);
-
- delay = jiffies + msecs_to_jiffies(LRADC_TS_SAMPLE_DELAY_MS);
- do {
- jiff = jiffies;
- reg = readl_relaxed(lradc->base + LRADC_CTRL1);
- if (reg & LRADC_CTRL1_LRADC_IRQ(slot))
- break;
- } while (time_before(jiff, delay));
-
- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(slot), LRADC_CTRL1);
-
- if (time_after_eq(jiff, delay))
- return -ETIMEDOUT;
-
- val = readl(lradc->base + LRADC_CH(slot));
- val &= LRADC_CH_VALUE_MASK;
-
- return val;
-}
-
-static int32_t mxs_lradc_ts_sample_filter(struct mxs_lradc *lradc,
- enum lradc_ts_plate plate)
-{
- int32_t val, tot = 0;
- int i;
-
- val = mxs_lradc_ts_sample(lradc, plate, 1);
-
- /* Delay a bit so the touchscreen is stable. */
- mdelay(2);
-
- for (i = 0; i < LRADC_TS_SAMPLE_AMOUNT; i++) {
- val = mxs_lradc_ts_sample(lradc, plate, 0);
- tot += val;
- }
-
- return tot / LRADC_TS_SAMPLE_AMOUNT;
-}
-
-static void mxs_lradc_ts_work(struct work_struct *ts_work)
-{
- struct mxs_lradc *lradc = container_of(ts_work,
- struct mxs_lradc, ts_work);
- int val_x, val_y, val_p;
- bool valid = false;
-
- while (mxs_lradc_ts_touched(lradc)) {
- /* Disable touch detector so we can sample the touchscreen. */
- mxs_lradc_reg_clear(lradc, mxs_lradc_touch_detect_bit(lradc),
- LRADC_CTRL0);
-
- if (likely(valid)) {
- input_report_abs(lradc->ts_input, ABS_X, val_x);
- input_report_abs(lradc->ts_input, ABS_Y, val_y);
- input_report_abs(lradc->ts_input, ABS_PRESSURE, val_p);
- input_report_key(lradc->ts_input, BTN_TOUCH, 1);
- input_sync(lradc->ts_input);
- }
-
- valid = false;
-
- val_x = mxs_lradc_ts_sample_filter(lradc, LRADC_SAMPLE_X);
- if (val_x < 0)
- continue;
- val_y = mxs_lradc_ts_sample_filter(lradc, LRADC_SAMPLE_Y);
- if (val_y < 0)
- continue;
- val_p = mxs_lradc_ts_sample_filter(lradc, LRADC_SAMPLE_PRESSURE);
- if (val_p < 0)
- continue;
-
- valid = true;
- }
-
- input_report_abs(lradc->ts_input, ABS_PRESSURE, 0);
- input_report_key(lradc->ts_input, BTN_TOUCH, 0);
- input_sync(lradc->ts_input);
-
- /* Restart the touchscreen interrupts. */
- mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
- mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
-}
-
static int mxs_lradc_ts_open(struct input_dev *dev)
{
struct mxs_lradc *lradc = input_get_drvdata(dev);
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 8/9] Staging/iio/adc/touchscreen/MXS: provide devicetree adaption
[not found] ` <1379946998-23041-1-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-09-23 14:36 ` Juergen Beisert
[not found] ` <1379946998-23041-9-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 15:25 ` [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Marek Vasut
` (2 subsequent siblings)
3 siblings, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
This is an RFC for the new touchscreen properties.
Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
CC: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
CC: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
CC: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
CC: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
CC: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
.../bindings/staging/iio/adc/mxs-lradc.txt | 36 ++++++++++++--
arch/arm/boot/dts/imx28-evk.dts | 4 ++
drivers/staging/iio/adc/mxs-lradc.c | 57 ++++++++++++++--------
3 files changed, 71 insertions(+), 26 deletions(-)
diff --git a/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt
index 4688205..ee05dc3 100644
--- a/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt
+++ b/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt
@@ -1,7 +1,8 @@
* Freescale i.MX28 LRADC device driver
Required properties:
-- compatible: Should be "fsl,imx28-lradc"
+- compatible: Should be "fsl,imx23-lradc" for i.MX23 SoC and "fsl,imx28-lradc"
+ for i.MX28 SoC
- reg: Address and length of the register set for the device
- interrupts: Should contain the LRADC interrupts
@@ -9,13 +10,38 @@ Optional properties:
- fsl,lradc-touchscreen-wires: Number of wires used to connect the touchscreen
to LRADC. Valid value is either 4 or 5. If this
property is not present, then the touchscreen is
- disabled.
+ disabled. 5 wires is valid for i.MX28 SoC only.
+- fsl,ave-ctrl: number of samples per direction to calculate an average value.
+ Allowed value is 1 ... 31, default is 4
+- fsl,ave-delay: delay between consecutive samples. Allowed value is
+ 1 ... 2047. It is used if 'fsl,ave-ctrl' > 1, counts at
+ 2 kHz and its default is 2 (= 1 ms)
+- fsl,settling: delay between plate switch to next sample. Allowed value is
+ 1 ... 2047. It counts at 2 kHz and its default is
+ 10 (= 5 ms)
-Examples:
+Example for i.MX23 SoC:
+
+ lradc@80050000 {
+ compatible = "fsl,imx23-lradc";
+ reg = <0x80050000 0x2000>;
+ interrupts = <36 37 38 39 40 41 42 43 44>;
+ status = "okay";
+ fsl,lradc-touchscreen-wires = <4>;
+ fsl,ave-ctrl = <4>;
+ fsl,ave-delay = <2>;
+ fsl,settling = <10>;
+ };
+
+Example for i.MX28 SoC:
lradc@80050000 {
compatible = "fsl,imx28-lradc";
reg = <0x80050000 0x2000>;
- interrupts = <10 14 15 16 17 18 19
- 20 21 22 23 24 25>;
+ interrupts = <10 14 15 16 17 18 19 20 21 22 23 24 25>;
+ status = "okay";
+ fsl,lradc-touchscreen-wires = <5>;
+ fsl,ave-ctrl = <4>;
+ fsl,ave-delay = <2>;
+ fsl,settling = <10>;
};
diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts
index 15715d9..aa33393 100644
--- a/arch/arm/boot/dts/imx28-evk.dts
+++ b/arch/arm/boot/dts/imx28-evk.dts
@@ -183,6 +183,10 @@
lradc@80050000 {
status = "okay";
+ fsl,lradc-touchscreen-wires = <4>;
+ fsl,ave-ctrl = <4>;
+ fsl,ave-delay = <2>;
+ fsl,settling = <10>;
};
i2c0: i2c@80058000 {
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index aa1f337..dbc0af6 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1230,10 +1230,45 @@ MODULE_DEVICE_TABLE(of, mxs_lradc_dt_ids);
static int mxs_lradc_probe_touchscreen(struct mxs_lradc *lradc,
struct device_node *lradc_node)
{
- /* TODO retrieve from device tree */
+ int ret;
+ u32 ts_wires = 0, adapt;
+
+ ret = of_property_read_u32(lradc_node, "fsl,lradc-touchscreen-wires",
+ &ts_wires);
+ if (ret)
+ return -ENODEV; /* touchscreen feature disabled */
+
+ switch (ts_wires) {
+ case 4:
+ lradc->use_touchscreen = MXS_LRADC_TOUCHSCREEN_4WIRE;
+ break;
+ case 5:
+ if (lradc->soc == IMX28_LRADC) {
+ lradc->use_touchscreen = MXS_LRADC_TOUCHSCREEN_5WIRE;
+ break;
+ }
+ /* fall through an error message for i.MX23 */
+ default:
+ dev_err(lradc->dev,
+ "Unsupported number of touchscreen wires (%d)\n",
+ ts_wires);
+ return -EINVAL;
+ }
+
lradc->over_sample_cnt = 4;
+ ret = of_property_read_u32(lradc_node, "fsl,ave-ctrl", &adapt);
+ if (ret == 0)
+ lradc->over_sample_cnt = adapt;
+
lradc->over_sample_delay = 2;
+ ret = of_property_read_u32(lradc_node, "fsl,ave-delay", &adapt);
+ if (ret == 0)
+ lradc->over_sample_delay = adapt;
+
lradc->settling_delay = 10;
+ ret = of_property_read_u32(lradc_node, "fsl,settling", &adapt);
+ if (ret == 0)
+ lradc->settling_delay = adapt;
return 0;
}
@@ -1249,7 +1284,6 @@ static int mxs_lradc_probe(struct platform_device *pdev)
struct mxs_lradc *lradc;
struct iio_dev *iio;
struct resource *iores;
- uint32_t ts_wires = 0;
int ret = 0, touch_ret;
int i;
@@ -1275,25 +1309,6 @@ static int mxs_lradc_probe(struct platform_device *pdev)
touch_ret = mxs_lradc_probe_touchscreen(lradc, node);
- /* Check if touchscreen is enabled in DT. */
- ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
- &ts_wires);
- if (ret)
- dev_info(dev, "Touchscreen not enabled.\n");
- else if (ts_wires == 4)
- lradc->use_touchscreen = MXS_LRADC_TOUCHSCREEN_4WIRE;
- else if (ts_wires == 5)
- lradc->use_touchscreen = MXS_LRADC_TOUCHSCREEN_5WIRE;
- else
- dev_warn(dev, "Unsupported number of touchscreen wires (%d)\n",
- ts_wires);
-
- if ((lradc->soc == IMX23_LRADC) && (ts_wires == 5)) {
- dev_warn(dev, "No support for 5 wire touches on i.MX23\n");
- dev_warn(dev, "Falling back to 4 wire\n");
- ts_wires = 4;
- }
-
/* Grab all IRQ sources */
for (i = 0; i < of_cfg->irq_count; i++) {
lradc->irq[i] = platform_get_irq(pdev, i);
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 9/9] Staging/iio: add TODO reminder
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
` (7 preceding siblings ...)
[not found] ` <1379946998-23041-1-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-09-23 14:36 ` Juergen Beisert
[not found] ` <1379946998-23041-10-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
8 siblings, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2013-09-23 14:36 UTC (permalink / raw)
To: linux-iio
Cc: devel, marex, fabio.estevam, jic23, linux-input, linux-arm-kernel
Some things have still to be done to the LRADC driver.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-input@vger.kernel.org
CC: devel@driverdev.osuosl.org
CC: Marek Vasut <marex@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
CC: Jonathan Cameron <jic23@cam.ac.uk>
---
drivers/staging/iio/TODO | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/staging/iio/TODO b/drivers/staging/iio/TODO
index 04c2326..c22a0ed 100644
--- a/drivers/staging/iio/TODO
+++ b/drivers/staging/iio/TODO
@@ -13,6 +13,17 @@ Would be nice
3) Expand device set. Lots of other maxim adc's have very
similar interfaces.
+MXS LRADC driver:
+This is a classic MFD device as it combines the following subdevices
+ - touchscreen controller (input subsystem related device)
+ - general purpose ADC channels
+ - battery voltage monitor (power subsystem related device)
+ - die temperature monitor (thermal management)
+
+At least the battery voltage and die temperature feature is required in-kernel
+by a driver of the SoC's battery charging unit to avoid any damage to the
+silicon and the battery.
+
TSL2561
Would be nice
1) Open question of userspace vs kernel space balance when
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling
2013-09-23 14:36 ` [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling Juergen Beisert
@ 2013-09-23 15:13 ` Fabio Estevam
[not found] ` <52405A7F.1050801-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
[not found] ` <1379946998-23041-2-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
1 sibling, 1 reply; 44+ messages in thread
From: Fabio Estevam @ 2013-09-23 15:13 UTC (permalink / raw)
To: Juergen Beisert, linux-iio
Cc: devel, marex, jic23, linux-arm-kernel, linux-input
On 09/23/2013 11:36 AM, Juergen Beisert wrote:
> + lradc->clk = devm_clk_get(&pdev->dev, NULL);
> + clk_prepare_enable(lradc->clk);
clk_prepare_enable() may fail, so better check its return value.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
[not found] ` <1379946998-23041-1-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 14:36 ` [PATCH 8/9] Staging/iio/adc/touchscreen/MXS: provide devicetree adaption Juergen Beisert
@ 2013-09-23 15:25 ` Marek Vasut
2013-10-01 9:25 ` Jonathan Cameron
2014-01-09 13:31 ` Alexandre Belloni
3 siblings, 0 replies; 44+ messages in thread
From: Marek Vasut @ 2013-09-23 15:25 UTC (permalink / raw)
To: Juergen Beisert
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Dear Juergen Beisert,
> The following series replaces the current busy loop touchscreen
> implementation for i.MX28/i.MX23 SoCs by a fully interrupt driven
> implementation.
>
> Since i.MX23 and i.MX28 silicon differs, the existing implementation can
> be used for the i.MX28 SoC only.
>
> The first patch adds proper clock handling. Various platforms seems to
> disable the internal 2 kHz clock which is used by the LRADC delay units.
>
> The next two patches of this series move the i.MX28 specific definitions
> out of the way. The forth patch simplifies the register access to make it
> easier to add the i.MX23 support. Then the i.MX23 specific definitions are
> added, also the code to distinguish both SoCs at run-time.
> Up to here the existing touchscreen driver will now run on an i.MX23 Soc as
> well.
>
> When these i.MX SoCs are running from battery it seems not to be a good
> idea to run a busy loop to detect touches and their location. The 6th
> patch adds a fully interrupt driven implementation which makes use of the
> built-in delay and multiple sample features of the touchscreen controller.
> This will reduce the interrupt load to a minimum.
>
> The remaining patches in this series just removes the existing busy loop
> implementation, add a proposal for devicetree binding and a reminder what
> has still to be done with the LRADC driver.
>
> Changes since v5:
>
> - add missing clock handling which prevents the delay units from work (this
> should make it work on the MX28EVK and M28EVK as well)
>
> Changes since v4:
>
> - honor Jonathan's comments about function names
> - honor Dmitry's comments about workqueue canceling and interrupts
> - adding devicetree bindings proposal
>
> Changes since v3:
>
> - split adding register access functions and i.MX23 support into two
> patches
>
> Changes since v2:
>
> - useless debug output removed
>
> Changes since v1:
>
> - adding register access functions to make the existing code more readable
> - adding some functions to distinguish the SoCs at run-time to avoid
> if-else contructs whenever differences in the register layout between
> i.MX23 and i.MX28 must be handled
>
> Comments are welcome.
On M28EVK:
Tested-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
Acked-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
Thanks!
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling
[not found] ` <1379946998-23041-2-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-09-23 15:30 ` Lothar Waßmann
[not found] ` <21056.24202.312851.105281-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>
0 siblings, 1 reply; 44+ messages in thread
From: Lothar Waßmann @ 2013-09-23 15:30 UTC (permalink / raw)
To: Juergen Beisert
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Hi,
Juergen Beisert writes:
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index a08c173..00b61ac 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -35,6 +35,7 @@
> #include <linux/completion.h>
> #include <linux/delay.h>
> #include <linux/input.h>
> +#include <linux/clk.h>
>
> #include <linux/iio/iio.h>
> #include <linux/iio/buffer.h>
> @@ -134,6 +135,8 @@ struct mxs_lradc {
> void __iomem *base;
> int irq[13];
>
> + struct clk *clk;
> +
> uint32_t *buffer;
> struct iio_trigger *trig;
>
> @@ -928,6 +931,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> if (IS_ERR(lradc->base))
> return PTR_ERR(lradc->base);
>
> + lradc->clk = devm_clk_get(&pdev->dev, NULL);
> + clk_prepare_enable(lradc->clk);
> +
Wouldn't it make sense to enable the clock only when the device is
opened to save power while not actually in use?
Lothar Waßmann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info-AvR2QvxeiV7DiMYJYoSAnRvVK+yQ3ZXh@public.gmane.org
___________________________________________________________
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling
[not found] ` <21056.24202.312851.105281-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>
@ 2013-09-24 7:39 ` Jürgen Beisert
0 siblings, 0 replies; 44+ messages in thread
From: Jürgen Beisert @ 2013-09-24 7:39 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Lothar Waßmann, linux-iio-u79uwXL29TY76Z2rM5mHXA,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Hi Lothar,
On Monday 23 September 2013 17:30:18 Lothar Waßmann wrote:
> > [...]
> > @@ -928,6 +931,9 @@ static int mxs_lradc_probe(struct platform_device
> > *pdev) if (IS_ERR(lradc->base))
> > return PTR_ERR(lradc->base);
> >
> > + lradc->clk = devm_clk_get(&pdev->dev, NULL);
> > + clk_prepare_enable(lradc->clk);
> > +
>
> Wouldn't it make sense to enable the clock only when the device is
> opened to save power while not actually in use?
Sure. But I haven't analyzed yet if the IIO part of the driver also uses the
delay units and - more important - when it use them.
@Marek: can you tell us, where the clock should be enabled in your part of the
driver (if required)?
BTW: do we also need to get and enable the 24 MHz clock (used by the ADC
itself)? I'm not sure if this clock is the "CLK_ANA24M" shown in
their "Logical Diagram of Clock Domains". The datasheets also mention
the "clk_xtal24m" clock for "analog 24 MHz clock domains". But does "Fixed
clock domains" mean they are not switchable and thus always enabled?
Regards,
Juergen
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling
[not found] ` <52405A7F.1050801-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2013-09-24 7:50 ` Jürgen Beisert
2013-09-24 13:50 ` Fabio Estevam
2013-10-01 10:57 ` Jonathan Cameron
0 siblings, 2 replies; 44+ messages in thread
From: Jürgen Beisert @ 2013-09-24 7:50 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, linux-iio-u79uwXL29TY76Z2rM5mHXA,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Hi Fabio,
On Monday 23 September 2013 17:13:03 Fabio Estevam wrote:
> On 09/23/2013 11:36 AM, Juergen Beisert wrote:
> > + lradc->clk = devm_clk_get(&pdev->dev, NULL);
> > + clk_prepare_enable(lradc->clk);
>
> clk_prepare_enable() may fail, so better check its return value.
Thanks for the comment. Better this way?
commit 825c5bb787a0dc9d25d480178e117be08810639c
Author: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Date: Mon Sep 23 16:10:56 2013 +0200
Staging/iio/adc/touchscreen/MXS: add proper clock handling
The delay units inside the LRADC depend on the presence of a 2 kHz clock.
This change enables the clock to be able to use the delay unit for the
touchscreen part of the driver.
Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 28b5ce2..07caf76 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -430,6 +430,7 @@
reg = <0x80050000 0x2000>;
interrupts = <36 37 38 39 40 41 42 43 44>;
status = "disabled";
+ clocks = <&clks 26>;
};
spdif@80054000 {
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 7363fde..175deef 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -902,6 +902,7 @@
interrupts = <10 14 15 16 17 18 19
20 21 22 23 24 25>;
status = "disabled";
+ clocks = <&clks 41>;
};
spdif: spdif@80054000 {
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index a08c173..eaca1ae 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -35,6 +35,7 @@
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/input.h>
+#include <linux/clk.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
@@ -134,6 +135,8 @@ struct mxs_lradc {
void __iomem *base;
int irq[13];
+ struct clk *clk;
+
uint32_t *buffer;
struct iio_trigger *trig;
@@ -928,6 +931,17 @@ static int mxs_lradc_probe(struct platform_device *pdev)
if (IS_ERR(lradc->base))
return PTR_ERR(lradc->base);
+ lradc->clk = devm_clk_get(&pdev->dev, NULL);
+ if (IS_ERR(lradc->clk)) {
+ dev_err(dev, "Failed to get the delay unit clock\n");
+ return PTR_ERR(lradc->clk);
+ }
+ ret = clk_prepare_enable(lradc->clk);
+ if (ret != 0) {
+ dev_err(dev, "Failed to enable the delay unit clock\n");
+ return ret;
+ }
+
INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
/* Check if touchscreen is enabled in DT. */
@@ -1020,6 +1034,7 @@ static int mxs_lradc_remove(struct platform_device *pdev)
iio_triggered_buffer_cleanup(iio);
mxs_lradc_trigger_remove(iio);
+ clk_disable_unprepare(lradc->clk);
return 0;
}
Juergen
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling
2013-09-24 7:50 ` Jürgen Beisert
@ 2013-09-24 13:50 ` Fabio Estevam
2013-10-01 10:57 ` Jonathan Cameron
1 sibling, 0 replies; 44+ messages in thread
From: Fabio Estevam @ 2013-09-24 13:50 UTC (permalink / raw)
To: Jürgen Beisert
Cc: Fabio Estevam, Marek Vašut, devel, linux-iio,
Jonathan Cameron, linux-input,
linux-arm-kernel@lists.infradead.org
On Tue, Sep 24, 2013 at 4:50 AM, Jürgen Beisert <jbe@pengutronix.de> wrote:
> Hi Fabio,
>
> On Monday 23 September 2013 17:13:03 Fabio Estevam wrote:
>> On 09/23/2013 11:36 AM, Juergen Beisert wrote:
>> > + lradc->clk = devm_clk_get(&pdev->dev, NULL);
>> > + clk_prepare_enable(lradc->clk);
>>
>> clk_prepare_enable() may fail, so better check its return value.
>
> Thanks for the comment. Better this way?
Yes, looks better.
Thanks,
Fabio Estevam
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
[not found] ` <1379946998-23041-1-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 14:36 ` [PATCH 8/9] Staging/iio/adc/touchscreen/MXS: provide devicetree adaption Juergen Beisert
2013-09-23 15:25 ` [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Marek Vasut
@ 2013-10-01 9:25 ` Jonathan Cameron
[not found] ` <524A951A.5050606-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-01-09 13:31 ` Alexandre Belloni
3 siblings, 1 reply; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 9:25 UTC (permalink / raw)
To: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
I'm looking for some Tested-by: or Acks on this before applying the series.
I got the impression from the comments on the previous version that the
series has now been reasonably thoroughly tested on both i.MX28 and i.MX23 boards.
This is not yet reflected in the sign off trail and in fact a couple of the patch
descriptions say that they are untested on i.MX28.
Jonathan
On 09/23/13 15:36, Juergen Beisert wrote:
> The following series replaces the current busy loop touchscreen implementation
> for i.MX28/i.MX23 SoCs by a fully interrupt driven implementation.
>
> Since i.MX23 and i.MX28 silicon differs, the existing implementation can
> be used for the i.MX28 SoC only.
>
> The first patch adds proper clock handling. Various platforms seems to disable
> the internal 2 kHz clock which is used by the LRADC delay units.
>
> The next two patches of this series move the i.MX28 specific definitions
> out of the way. The forth patch simplifies the register access to make it easier
> to add the i.MX23 support. Then the i.MX23 specific definitions are added, also
> the code to distinguish both SoCs at run-time.
> Up to here the existing touchscreen driver will now run on an i.MX23 Soc as well.
>
> When these i.MX SoCs are running from battery it seems not to be a good idea to
> run a busy loop to detect touches and their location. The 6th patch adds a
> fully interrupt driven implementation which makes use of the built-in delay
> and multiple sample features of the touchscreen controller. This will reduce
> the interrupt load to a minimum.
>
> The remaining patches in this series just removes the existing busy loop
> implementation, add a proposal for devicetree binding and a reminder what has
> still to be done with the LRADC driver.
>
> Changes since v5:
>
> - add missing clock handling which prevents the delay units from work (this
> should make it work on the MX28EVK and M28EVK as well)
>
> Changes since v4:
>
> - honor Jonathan's comments about function names
> - honor Dmitry's comments about workqueue canceling and interrupts
> - adding devicetree bindings proposal
>
> Changes since v3:
>
> - split adding register access functions and i.MX23 support into two patches
>
> Changes since v2:
>
> - useless debug output removed
>
> Changes since v1:
>
> - adding register access functions to make the existing code more readable
> - adding some functions to distinguish the SoCs at run-time to avoid if-else
> contructs whenever differences in the register layout between i.MX23 and
> i.MX28 must be handled
>
> Comments are welcome.
>
> Juergen
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 6/9] Staging/iio/adc/touchscreen/MXS: add interrupt driven touch detection
[not found] ` <1379946998-23041-7-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-10-01 9:28 ` Jürgen Beisert
2013-10-01 10:51 ` Jonathan Cameron
0 siblings, 1 reply; 44+ messages in thread
From: Jürgen Beisert @ 2013-10-01 9:28 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg, Dmitry Torokhov,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Hi Jonathan,
On Tuesday 01 October 2013 11:25:46 Jonathan Cameron wrote:
> a couple of the patch descriptions say that they are untested on i.MX28.
On Monday 23 September 2013 16:36:35 Juergen Beisert wrote:
> For battery driven systems it is a very bad idea to collect the touchscreen
> data within a kernel busy loop.
>
> This change uses the features of the hardware to delay and accumulate
> samples in hardware to avoid a high interrupt and CPU load.
>
> Note: this is only tested on an i.MX23 SoC yet.
This note is no longer true. Marek tested it on his M28EVK, Lothar on his TX28
and myself also on an i.MX28EVK.
For the IIO part of the driver I tested on my i.MX23 based ChumbyOne and some
customer hardware and it seems still to work (I can only guess if the values I
read from the sysfs entries are correct, sorry).
Regards,
Juergen
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
[not found] ` <524A951A.5050606-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2013-10-01 10:49 ` Marek Vasut
0 siblings, 0 replies; 44+ messages in thread
From: Marek Vasut @ 2013-10-01 10:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Dear Jonathan Cameron,
> I'm looking for some Tested-by: or Acks on this before applying the series.
> I got the impression from the comments on the previous version that the
> series has now been reasonably thoroughly tested on both i.MX28 and i.MX23
> boards. This is not yet reflected in the sign off trail and in fact a
> couple of the patch descriptions say that they are untested on i.MX28.
>
> Jonathan
>
Tested-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
on M28EVK
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 6/9] Staging/iio/adc/touchscreen/MXS: add interrupt driven touch detection
2013-10-01 9:28 ` Jürgen Beisert
@ 2013-10-01 10:51 ` Jonathan Cameron
[not found] ` <524AA91F.7000906-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 10:51 UTC (permalink / raw)
To: Jürgen Beisert
Cc: devel, marex, fabio.estevam, linux-iio, Dmitry Torokhov, jic23,
linux-input, linux-arm-kernel
On 10/01/13 10:28, Jürgen Beisert wrote:
> Hi Jonathan,
>
> On Tuesday 01 October 2013 11:25:46 Jonathan Cameron wrote:
>> a couple of the patch descriptions say that they are untested on i.MX28.
>
> On Monday 23 September 2013 16:36:35 Juergen Beisert wrote:
>> For battery driven systems it is a very bad idea to collect the touchscreen
>> data within a kernel busy loop.
>>
>> This change uses the features of the hardware to delay and accumulate
>> samples in hardware to avoid a high interrupt and CPU load.
>>
>> Note: this is only tested on an i.MX23 SoC yet.
>
> This note is no longer true. Marek tested it on his M28EVK, Lothar on his TX28
> and myself also on an i.MX28EVK.
>
> For the IIO part of the driver I tested on my i.MX23 based ChumbyOne and some
> customer hardware and it seems still to work (I can only guess if the values I
> read from the sysfs entries are correct, sorry).
Excellent. I'll assume everyone is happy then and add some appropriate
tested-by tags. I'd missed Marek's reply saying he was fine with this.
Thanks,
Jonathan
>
> Regards,
> Juergen
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling
2013-09-24 7:50 ` Jürgen Beisert
2013-09-24 13:50 ` Fabio Estevam
@ 2013-10-01 10:57 ` Jonathan Cameron
1 sibling, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 10:57 UTC (permalink / raw)
To: Jürgen Beisert, linux-arm-kernel
Cc: Fabio Estevam, linux-iio, devel, marex, jic23, linux-input
On 09/24/13 08:50, Jürgen Beisert wrote:
> Hi Fabio,
>
> On Monday 23 September 2013 17:13:03 Fabio Estevam wrote:
>> On 09/23/2013 11:36 AM, Juergen Beisert wrote:
>>> + lradc->clk = devm_clk_get(&pdev->dev, NULL);
>>> + clk_prepare_enable(lradc->clk);
>>
>> clk_prepare_enable() may fail, so better check its return value.
>
> Thanks for the comment. Better this way?
>
> commit 825c5bb787a0dc9d25d480178e117be08810639c
> Author: Juergen Beisert <jbe@pengutronix.de>
> Date: Mon Sep 23 16:10:56 2013 +0200
Applied. If you are going to have a new patch version in the middle of the thread
please generate it with git format-patch and then send it as a reply to the email
you are responding to. Applying a patch like this is no where near as easy.
Applied to the togreg branch of iio.git
Thanks
>
> Staging/iio/adc/touchscreen/MXS: add proper clock handling
>
> The delay units inside the LRADC depend on the presence of a 2 kHz clock.
> This change enables the clock to be able to use the delay unit for the
> touchscreen part of the driver.
>
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
>
> diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
> index 28b5ce2..07caf76 100644
> --- a/arch/arm/boot/dts/imx23.dtsi
> +++ b/arch/arm/boot/dts/imx23.dtsi
> @@ -430,6 +430,7 @@
> reg = <0x80050000 0x2000>;
> interrupts = <36 37 38 39 40 41 42 43 44>;
> status = "disabled";
> + clocks = <&clks 26>;
> };
>
> spdif@80054000 {
> diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
> index 7363fde..175deef 100644
> --- a/arch/arm/boot/dts/imx28.dtsi
> +++ b/arch/arm/boot/dts/imx28.dtsi
> @@ -902,6 +902,7 @@
> interrupts = <10 14 15 16 17 18 19
> 20 21 22 23 24 25>;
> status = "disabled";
> + clocks = <&clks 41>;
> };
>
> spdif: spdif@80054000 {
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index a08c173..eaca1ae 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -35,6 +35,7 @@
> #include <linux/completion.h>
> #include <linux/delay.h>
> #include <linux/input.h>
> +#include <linux/clk.h>
>
> #include <linux/iio/iio.h>
> #include <linux/iio/buffer.h>
> @@ -134,6 +135,8 @@ struct mxs_lradc {
> void __iomem *base;
> int irq[13];
>
> + struct clk *clk;
> +
> uint32_t *buffer;
> struct iio_trigger *trig;
>
> @@ -928,6 +931,17 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> if (IS_ERR(lradc->base))
> return PTR_ERR(lradc->base);
>
> + lradc->clk = devm_clk_get(&pdev->dev, NULL);
> + if (IS_ERR(lradc->clk)) {
> + dev_err(dev, "Failed to get the delay unit clock\n");
> + return PTR_ERR(lradc->clk);
> + }
> + ret = clk_prepare_enable(lradc->clk);
> + if (ret != 0) {
> + dev_err(dev, "Failed to enable the delay unit clock\n");
> + return ret;
> + }
> +
> INIT_WORK(&lradc->ts_work, mxs_lradc_ts_work);
>
> /* Check if touchscreen is enabled in DT. */
> @@ -1020,6 +1034,7 @@ static int mxs_lradc_remove(struct platform_device *pdev)
> iio_triggered_buffer_cleanup(iio);
> mxs_lradc_trigger_remove(iio);
>
> + clk_disable_unprepare(lradc->clk);
> return 0;
> }
>
> Juergen
>
--
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] 44+ messages in thread
* Re: [PATCH 2/9] Staging/iio/adc/touchscreen/MXS: distinguish i.MX23's and i.MX28's LRADC
[not found] ` <1379946998-23041-3-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-10-01 10:58 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 10:58 UTC (permalink / raw)
To: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
On 09/23/13 15:36, Juergen Beisert wrote:
> The LRADC units in i.MX23 and i.MX28 differ and we need to distinguish both
> SoC variants in order to make the touchscreen work on i.MX23
>
> Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> CC: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> CC: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
> CC: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> CC: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> CC: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
Applied to the togreg branch of iio.git
Thanks
> ---
> drivers/staging/iio/adc/mxs-lradc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index 00b61ac..3abc91f 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -177,6 +177,8 @@ struct mxs_lradc {
>
> struct input_dev *ts_input;
> struct work_struct ts_work;
> +
> + enum mxs_lradc_id soc;
> };
>
> #define LRADC_CTRL0 0x00
> @@ -923,6 +925,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> }
>
> lradc = iio_priv(iio);
> + lradc->soc = (enum mxs_lradc_id)of_id->data;
>
> /* Grab the memory area */
> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/9] Staging/iio/adc/touchscreen/MXS: separate i.MX28 specific register bits
[not found] ` <1379946998-23041-4-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-10-01 11:00 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:00 UTC (permalink / raw)
To: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
On 09/23/13 15:36, Juergen Beisert wrote:
> In order to support i.MX23 and i.MX28 within one driver we need to separate the
> register definitions which differ in both SoC variants.
>
> Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> CC: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> CC: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
> CC: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> CC: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> CC: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
Applied to the togreg branch of iio.git
Thanks
> ---
> drivers/staging/iio/adc/mxs-lradc.c | 61 ++++++++++++++++++++-----------------
> 1 file changed, 33 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index 3abc91f..f2fb10a 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -182,24 +182,29 @@ struct mxs_lradc {
> };
>
> #define LRADC_CTRL0 0x00
> -#define LRADC_CTRL0_TOUCH_DETECT_ENABLE (1 << 23)
> -#define LRADC_CTRL0_TOUCH_SCREEN_TYPE (1 << 22)
> -#define LRADC_CTRL0_YNNSW /* YM */ (1 << 21)
> -#define LRADC_CTRL0_YPNSW /* YP */ (1 << 20)
> -#define LRADC_CTRL0_YPPSW /* YP */ (1 << 19)
> -#define LRADC_CTRL0_XNNSW /* XM */ (1 << 18)
> -#define LRADC_CTRL0_XNPSW /* XM */ (1 << 17)
> -#define LRADC_CTRL0_XPPSW /* XP */ (1 << 16)
> -#define LRADC_CTRL0_PLATE_MASK (0x3f << 16)
> +# define LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE (1 << 23)
> +# define LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE (1 << 22)
> +# define LRADC_CTRL0_MX28_YNNSW /* YM */ (1 << 21)
> +# define LRADC_CTRL0_MX28_YPNSW /* YP */ (1 << 20)
> +# define LRADC_CTRL0_MX28_YPPSW /* YP */ (1 << 19)
> +# define LRADC_CTRL0_MX28_XNNSW /* XM */ (1 << 18)
> +# define LRADC_CTRL0_MX28_XNPSW /* XM */ (1 << 17)
> +# define LRADC_CTRL0_MX28_XPPSW /* XP */ (1 << 16)
> +
> +# define LRADC_CTRL0_MX28_PLATE_MASK \
> + (LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE | \
> + LRADC_CTRL0_MX28_YNNSW | LRADC_CTRL0_MX28_YPNSW | \
> + LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW | \
> + LRADC_CTRL0_MX28_XNPSW | LRADC_CTRL0_MX28_XPPSW)
>
> #define LRADC_CTRL1 0x10
> #define LRADC_CTRL1_TOUCH_DETECT_IRQ_EN (1 << 24)
> #define LRADC_CTRL1_LRADC_IRQ_EN(n) (1 << ((n) + 16))
> -#define LRADC_CTRL1_LRADC_IRQ_EN_MASK (0x1fff << 16)
> +#define LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK (0x1fff << 16)
> #define LRADC_CTRL1_LRADC_IRQ_EN_OFFSET 16
> #define LRADC_CTRL1_TOUCH_DETECT_IRQ (1 << 8)
> #define LRADC_CTRL1_LRADC_IRQ(n) (1 << (n))
> -#define LRADC_CTRL1_LRADC_IRQ_MASK 0x1fff
> +#define LRADC_CTRL1_MX28_LRADC_IRQ_MASK 0x1fff
> #define LRADC_CTRL1_LRADC_IRQ_OFFSET 0
>
> #define LRADC_CTRL2 0x20
> @@ -267,7 +272,7 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
> * Virtual channel 0 is always used here as the others are always not
> * used if doing raw sampling.
> */
> - writel(LRADC_CTRL1_LRADC_IRQ_EN_MASK,
> + writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
>
> @@ -322,9 +327,9 @@ static int mxs_lradc_ts_touched(struct mxs_lradc *lradc)
> uint32_t reg;
>
> /* Enable touch detection. */
> - writel(LRADC_CTRL0_PLATE_MASK,
> + writel(LRADC_CTRL0_MX28_PLATE_MASK,
> lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> - writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
> + writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
> lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
>
> msleep(LRADC_TS_SAMPLE_DELAY_MS);
> @@ -370,21 +375,21 @@ static int32_t mxs_lradc_ts_sample(struct mxs_lradc *lradc,
> */
> switch (plate) {
> case LRADC_SAMPLE_X:
> - ctrl0 = LRADC_CTRL0_XPPSW | LRADC_CTRL0_XNNSW;
> + ctrl0 = LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
> chan = 3;
> break;
> case LRADC_SAMPLE_Y:
> - ctrl0 = LRADC_CTRL0_YPPSW | LRADC_CTRL0_YNNSW;
> + ctrl0 = LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
> chan = 4;
> break;
> case LRADC_SAMPLE_PRESSURE:
> - ctrl0 = LRADC_CTRL0_YPPSW | LRADC_CTRL0_XNNSW;
> + ctrl0 = LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
> chan = 5;
> break;
> }
>
> if (change) {
> - writel(LRADC_CTRL0_PLATE_MASK,
> + writel(LRADC_CTRL0_MX28_PLATE_MASK,
> lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> writel(ctrl0, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
>
> @@ -445,7 +450,7 @@ static void mxs_lradc_ts_work(struct work_struct *ts_work)
>
> while (mxs_lradc_ts_touched(lradc)) {
> /* Disable touch detector so we can sample the touchscreen. */
> - writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
> + writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
> lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
>
> if (likely(valid)) {
> @@ -494,7 +499,7 @@ static int mxs_lradc_ts_open(struct input_dev *dev)
> lradc->stop_touchscreen = false;
>
> /* Enable the touch-detect circuitry. */
> - writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
> + writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
> lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
>
> /* Enable the touch-detect IRQ. */
> @@ -520,7 +525,7 @@ static void mxs_lradc_ts_close(struct input_dev *dev)
> lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
>
> /* Power-down touchscreen touch-detect circuitry. */
> - writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
> + writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
> lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> }
>
> @@ -584,7 +589,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
> LRADC_CTRL1_TOUCH_DETECT_IRQ_EN |
> LRADC_CTRL1_TOUCH_DETECT_IRQ;
>
> - if (!(reg & LRADC_CTRL1_LRADC_IRQ_MASK))
> + if (!(reg & LRADC_CTRL1_MX28_LRADC_IRQ_MASK))
> return IRQ_NONE;
>
> /*
> @@ -604,7 +609,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
> else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
> complete(&lradc->completion);
>
> - writel(reg & LRADC_CTRL1_LRADC_IRQ_MASK,
> + writel(reg & LRADC_CTRL1_MX28_LRADC_IRQ_MASK,
> lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
>
> return IRQ_HANDLED;
> @@ -725,7 +730,7 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
> if (ret < 0)
> goto err_buf;
>
> - writel(LRADC_CTRL1_LRADC_IRQ_EN_MASK,
> + writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
>
> @@ -766,7 +771,7 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
> lradc->base + LRADC_DELAY(0) + STMP_OFFSET_REG_CLR);
>
> writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> - writel(LRADC_CTRL1_LRADC_IRQ_EN_MASK,
> + writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
>
> kfree(lradc->buffer);
> @@ -870,11 +875,11 @@ static int mxs_lradc_hw_init(struct mxs_lradc *lradc)
> writel(0, lradc->base + LRADC_DELAY(3));
>
> /* Configure the touchscreen type */
> - writel(LRADC_CTRL0_TOUCH_SCREEN_TYPE,
> + writel(LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
> lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
>
> if (lradc->use_touchscreen == MXS_LRADC_TOUCHSCREEN_5WIRE) {
> - writel(LRADC_CTRL0_TOUCH_SCREEN_TYPE,
> + writel(LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
> lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
> }
>
> @@ -888,7 +893,7 @@ static void mxs_lradc_hw_stop(struct mxs_lradc *lradc)
> {
> int i;
>
> - writel(LRADC_CTRL1_LRADC_IRQ_EN_MASK,
> + writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
>
> for (i = 0; i < LRADC_MAX_DELAY_CHANS; i++)
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 4/9] Staging/iio/adc/touchscreen/MXS: simplify register access
2013-09-23 14:36 ` [PATCH 4/9] Staging/iio/adc/touchscreen/MXS: simplify register access Juergen Beisert
@ 2013-10-01 11:01 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:01 UTC (permalink / raw)
To: Juergen Beisert, linux-iio
Cc: linux-arm-kernel, devel, marex, fabio.estevam, jic23, linux-input
On 09/23/13 15:36, Juergen Beisert wrote:
> Replace the individual register access by a few shared access function to make the
> code easier to read and in order to add the i.MX23 SoC in the next step.
>
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> CC: linux-arm-kernel@lists.infradead.org
> CC: linux-input@vger.kernel.org
> CC: devel@driverdev.osuosl.org
> CC: Marek Vasut <marex@denx.de>
> CC: Fabio Estevam <fabio.estevam@freescale.com>
> CC: Jonathan Cameron <jic23@cam.ac.uk>
Applied to the togreg branch of iio.git
Thanks,
Jonathan
> ---
> drivers/staging/iio/adc/mxs-lradc.c | 204 +++++++++++++++++++++---------------
> 1 file changed, 120 insertions(+), 84 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index f2fb10a..dd47ec2 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -238,6 +238,56 @@ struct mxs_lradc {
> #define LRADC_RESOLUTION 12
> #define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1)
>
> +static void mxs_lradc_reg_set(struct mxs_lradc *lradc, u32 val, u32 reg)
> +{
> + writel(val, lradc->base + reg + STMP_OFFSET_REG_SET);
> +}
> +
> +static void mxs_lradc_reg_clear(struct mxs_lradc *lradc, u32 val, u32 reg)
> +{
> + writel(val, lradc->base + reg + STMP_OFFSET_REG_CLR);
> +}
> +
> +static void mxs_lradc_reg_wrt(struct mxs_lradc *lradc, u32 val, u32 reg)
> +{
> + writel(val, lradc->base + reg);
> +}
> +
> +static u32 mxs_lradc_plate_mask(struct mxs_lradc *lradc)
> +{
> + return LRADC_CTRL0_MX28_PLATE_MASK;
> +}
> +
> +static u32 mxs_lradc_irq_en_mask(struct mxs_lradc *lradc)
> +{
> + return LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK;
> +}
> +
> +static u32 mxs_lradc_irq_mask(struct mxs_lradc *lradc)
> +{
> + return LRADC_CTRL1_MX28_LRADC_IRQ_MASK;
> +}
> +
> +static u32 mxs_lradc_touch_detect_bit(struct mxs_lradc *lradc)
> +{
> + return LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE;
> +}
> +
> +static u32 mxs_lradc_drive_x_plate(struct mxs_lradc *lradc)
> +{
> + return LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
> +}
> +
> +static u32 mxs_lradc_drive_y_plate(struct mxs_lradc *lradc)
> +{
> + return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
> +}
> +
> +static u32 mxs_lradc_drive_pressure(struct mxs_lradc *lradc)
> +{
> + return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
> +}
> +
> /*
> * Raw I/O operations
> */
> @@ -272,21 +322,19 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
> * Virtual channel 0 is always used here as the others are always not
> * used if doing raw sampling.
> */
> - writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> - writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> + LRADC_CTRL1);
> + mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
>
> /* Clean the slot's previous content, then set new one. */
> - writel(LRADC_CTRL4_LRADCSELECT_MASK(0),
> - lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_CLR);
> - writel(chan->channel, lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(0), LRADC_CTRL4);
> + mxs_lradc_reg_set(lradc, chan->channel, LRADC_CTRL4);
>
> - writel(0, lradc->base + LRADC_CH(0));
> + mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(0));
>
> /* Enable the IRQ and start sampling the channel. */
> - writel(LRADC_CTRL1_LRADC_IRQ_EN(0),
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_SET);
> - writel(1 << 0, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), LRADC_CTRL1);
> + mxs_lradc_reg_set(lradc, 1 << 0, LRADC_CTRL0);
>
> /* Wait for completion on the channel, 1 second max. */
> ret = wait_for_completion_killable_timeout(&lradc->completion, HZ);
> @@ -300,8 +348,7 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
> ret = IIO_VAL_INT;
>
> err:
> - writel(LRADC_CTRL1_LRADC_IRQ_EN(0),
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), LRADC_CTRL1);
>
> mutex_unlock(&lradc->lock);
>
> @@ -327,10 +374,9 @@ static int mxs_lradc_ts_touched(struct mxs_lradc *lradc)
> uint32_t reg;
>
> /* Enable touch detection. */
> - writel(LRADC_CTRL0_MX28_PLATE_MASK,
> - lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> - writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
> - lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
> + mxs_lradc_reg_set(lradc, mxs_lradc_touch_detect_bit(lradc),
> + LRADC_CTRL0);
>
> msleep(LRADC_TS_SAMPLE_DELAY_MS);
>
> @@ -375,32 +421,33 @@ static int32_t mxs_lradc_ts_sample(struct mxs_lradc *lradc,
> */
> switch (plate) {
> case LRADC_SAMPLE_X:
> - ctrl0 = LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
> + ctrl0 = mxs_lradc_drive_x_plate(lradc);
> chan = 3;
> break;
> case LRADC_SAMPLE_Y:
> - ctrl0 = LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
> + ctrl0 = mxs_lradc_drive_y_plate(lradc);
> chan = 4;
> break;
> case LRADC_SAMPLE_PRESSURE:
> - ctrl0 = LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
> + ctrl0 = mxs_lradc_drive_pressure(lradc);
> chan = 5;
> break;
> }
>
> if (change) {
> - writel(LRADC_CTRL0_MX28_PLATE_MASK,
> - lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> - writel(ctrl0, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
> -
> - writel(LRADC_CTRL4_LRADCSELECT_MASK(slot),
> - lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_CLR);
> - writel(chan << LRADC_CTRL4_LRADCSELECT_OFFSET(slot),
> - lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc),
> + LRADC_CTRL0);
> + mxs_lradc_reg_set(lradc, ctrl0, LRADC_CTRL0);
> +
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(slot),
> + LRADC_CTRL4);
> + mxs_lradc_reg_set(lradc,
> + chan << LRADC_CTRL4_LRADCSELECT_OFFSET(slot),
> + LRADC_CTRL4);
> }
>
> - writel(0xffffffff, lradc->base + LRADC_CH(slot) + STMP_OFFSET_REG_CLR);
> - writel(1 << slot, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_clear(lradc, 0xffffffff, LRADC_CH(slot));
> + mxs_lradc_reg_set(lradc, 1 << slot, LRADC_CTRL0);
>
> delay = jiffies + msecs_to_jiffies(LRADC_TS_SAMPLE_DELAY_MS);
> do {
> @@ -410,8 +457,7 @@ static int32_t mxs_lradc_ts_sample(struct mxs_lradc *lradc,
> break;
> } while (time_before(jiff, delay));
>
> - writel(LRADC_CTRL1_LRADC_IRQ(slot),
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(slot), LRADC_CTRL1);
>
> if (time_after_eq(jiff, delay))
> return -ETIMEDOUT;
> @@ -450,8 +496,8 @@ static void mxs_lradc_ts_work(struct work_struct *ts_work)
>
> while (mxs_lradc_ts_touched(lradc)) {
> /* Disable touch detector so we can sample the touchscreen. */
> - writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
> - lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, mxs_lradc_touch_detect_bit(lradc),
> + LRADC_CTRL0);
>
> if (likely(valid)) {
> input_report_abs(lradc->ts_input, ABS_X, val_x);
> @@ -485,10 +531,8 @@ static void mxs_lradc_ts_work(struct work_struct *ts_work)
> return;
>
> /* Restart the touchscreen interrupts. */
> - writel(LRADC_CTRL1_TOUCH_DETECT_IRQ,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> - writel(LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
> + mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
> }
>
> static int mxs_lradc_ts_open(struct input_dev *dev)
> @@ -499,12 +543,11 @@ static int mxs_lradc_ts_open(struct input_dev *dev)
> lradc->stop_touchscreen = false;
>
> /* Enable the touch-detect circuitry. */
> - writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
> - lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_set(lradc, mxs_lradc_touch_detect_bit(lradc),
> + LRADC_CTRL0);
>
> /* Enable the touch-detect IRQ. */
> - writel(LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
>
> return 0;
> }
> @@ -521,12 +564,11 @@ static void mxs_lradc_ts_close(struct input_dev *dev)
> cancel_work_sync(&lradc->ts_work);
>
> /* Disable touchscreen touch-detect IRQ. */
> - writel(LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
> + LRADC_CTRL1);
>
> /* Power-down touchscreen touch-detect circuitry. */
> - writel(LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE,
> - lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, mxs_lradc_touch_detect_bit(lradc), LRADC_CTRL0);
> }
>
> static int mxs_lradc_ts_register(struct mxs_lradc *lradc)
> @@ -589,7 +631,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
> LRADC_CTRL1_TOUCH_DETECT_IRQ_EN |
> LRADC_CTRL1_TOUCH_DETECT_IRQ;
>
> - if (!(reg & LRADC_CTRL1_MX28_LRADC_IRQ_MASK))
> + if (!(reg & mxs_lradc_irq_mask(lradc)))
> return IRQ_NONE;
>
> /*
> @@ -598,8 +640,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
> * it ASAP
> */
> if (reg & LRADC_CTRL1_TOUCH_DETECT_IRQ) {
> - writel(ts_irq_mask,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, ts_irq_mask, LRADC_CTRL1);
> if (!lradc->stop_touchscreen)
> schedule_work(&lradc->ts_work);
> }
> @@ -609,8 +650,7 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
> else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
> complete(&lradc->completion);
>
> - writel(reg & LRADC_CTRL1_MX28_LRADC_IRQ_MASK,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc), LRADC_CTRL1);
>
> return IRQ_HANDLED;
> }
> @@ -629,7 +669,7 @@ static irqreturn_t mxs_lradc_trigger_handler(int irq, void *p)
>
> for_each_set_bit(i, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
> lradc->buffer[j] = readl(lradc->base + LRADC_CH(j));
> - writel(chan_value, lradc->base + LRADC_CH(j));
> + mxs_lradc_reg_wrt(lradc, chan_value, LRADC_CH(j));
> lradc->buffer[j] &= LRADC_CH_VALUE_MASK;
> lradc->buffer[j] /= LRADC_DELAY_TIMER_LOOP;
> j++;
> @@ -654,7 +694,7 @@ static int mxs_lradc_configure_trigger(struct iio_trigger *trig, bool state)
> struct mxs_lradc *lradc = iio_priv(iio);
> const uint32_t st = state ? STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR;
>
> - writel(LRADC_DELAY_KICK, lradc->base + LRADC_DELAY(0) + st);
> + mxs_lradc_reg_wrt(lradc, LRADC_DELAY_KICK, LRADC_DELAY(0) + st);
>
> return 0;
> }
> @@ -730,29 +770,26 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
> if (ret < 0)
> goto err_buf;
>
> - writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> - writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> + LRADC_CTRL1);
> + mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
>
> for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
> ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs);
> ctrl4_clr |= LRADC_CTRL4_LRADCSELECT_MASK(ofs);
> ctrl1_irq |= LRADC_CTRL1_LRADC_IRQ_EN(ofs);
> - writel(chan_value, lradc->base + LRADC_CH(ofs));
> + mxs_lradc_reg_wrt(lradc, chan_value, LRADC_CH(ofs));
> bitmap_set(&enable, ofs, 1);
> ofs++;
> }
>
> - writel(LRADC_DELAY_TRIGGER_LRADCS_MASK | LRADC_DELAY_KICK,
> - lradc->base + LRADC_DELAY(0) + STMP_OFFSET_REG_CLR);
> -
> - writel(ctrl4_clr, lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_CLR);
> - writel(ctrl4_set, lradc->base + LRADC_CTRL4 + STMP_OFFSET_REG_SET);
> -
> - writel(ctrl1_irq, lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_SET);
> -
> - writel(enable << LRADC_DELAY_TRIGGER_LRADCS_OFFSET,
> - lradc->base + LRADC_DELAY(0) + STMP_OFFSET_REG_SET);
> + mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
> + LRADC_DELAY_KICK, LRADC_DELAY(0));
> + mxs_lradc_reg_clear(lradc, ctrl4_clr, LRADC_CTRL4);
> + mxs_lradc_reg_set(lradc, ctrl4_set, LRADC_CTRL4);
> + mxs_lradc_reg_set(lradc, ctrl1_irq, LRADC_CTRL1);
> + mxs_lradc_reg_set(lradc, enable << LRADC_DELAY_TRIGGER_LRADCS_OFFSET,
> + LRADC_DELAY(0));
>
> return 0;
>
> @@ -767,12 +804,12 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
> {
> struct mxs_lradc *lradc = iio_priv(iio);
>
> - writel(LRADC_DELAY_TRIGGER_LRADCS_MASK | LRADC_DELAY_KICK,
> - lradc->base + LRADC_DELAY(0) + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
> + LRADC_DELAY_KICK, LRADC_DELAY(0));
>
> - writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> - writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> + LRADC_CTRL1);
>
> kfree(lradc->buffer);
> mutex_unlock(&lradc->lock);
> @@ -867,24 +904,24 @@ static int mxs_lradc_hw_init(struct mxs_lradc *lradc)
> return ret;
>
> /* Configure DELAY CHANNEL 0 for generic ADC sampling. */
> - writel(adc_cfg, lradc->base + LRADC_DELAY(0));
> + mxs_lradc_reg_wrt(lradc, adc_cfg, LRADC_DELAY(0));
>
> /* Disable remaining DELAY CHANNELs */
> - writel(0, lradc->base + LRADC_DELAY(1));
> - writel(0, lradc->base + LRADC_DELAY(2));
> - writel(0, lradc->base + LRADC_DELAY(3));
> + mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(1));
> + mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2));
> + mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
>
> /* Configure the touchscreen type */
> - writel(LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
> - lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
> + LRADC_CTRL0);
>
> - if (lradc->use_touchscreen == MXS_LRADC_TOUCHSCREEN_5WIRE) {
> - writel(LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
> - lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_SET);
> + if (lradc->use_touchscreen == MXS_LRADC_TOUCHSCREEN_5WIRE)
> + mxs_lradc_reg_set(lradc, LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
> + LRADC_CTRL0);
> }
>
> /* Start internal temperature sensing. */
> - writel(0, lradc->base + LRADC_CTRL2);
> + mxs_lradc_reg_wrt(lradc, 0, LRADC_CTRL2);
>
> return 0;
> }
> @@ -893,11 +930,10 @@ static void mxs_lradc_hw_stop(struct mxs_lradc *lradc)
> {
> int i;
>
> - writel(LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> - lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
> + mxs_lradc_reg_clear(lradc, mxs_lradc_irq_en_mask(lradc), LRADC_CTRL1);
>
> for (i = 0; i < LRADC_MAX_DELAY_CHANS; i++)
> - writel(0, lradc->base + LRADC_DELAY(i));
> + mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(i));
> }
>
> static const struct of_device_id mxs_lradc_dt_ids[] = {
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 5/9] Staging/iio/adc/touchscreen/MXS: add i.MX23 support to the LRADC touchscreen driver
2013-09-23 14:36 ` [PATCH 5/9] Staging/iio/adc/touchscreen/MXS: add i.MX23 support to the LRADC touchscreen driver Juergen Beisert
@ 2013-10-01 11:02 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:02 UTC (permalink / raw)
To: Juergen Beisert, linux-iio
Cc: linux-arm-kernel, devel, marex, fabio.estevam, jic23, linux-input
On 09/23/13 15:36, Juergen Beisert wrote:
> Distinguish i.MX23 and i.MX28 at runtime and do the same for both SoC at least
> for the 4 wire touchscreen.
>
> Note: support for the remaining LRADC channels is not tested on an
> i.MX23 yet.
>
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> CC: linux-arm-kernel@lists.infradead.org
> CC: linux-input@vger.kernel.org
> CC: devel@driverdev.osuosl.org
> CC: Marek Vasut <marex@denx.de>
> CC: Fabio Estevam <fabio.estevam@freescale.com>
> CC: Jonathan Cameron <jic23@cam.ac.uk>
Applied to the togreg branch of iio.git
Thanks,
> ---
> drivers/staging/iio/adc/mxs-lradc.c | 66 ++++++++++++++++++++++++++++++-------
> 1 file changed, 55 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index dd47ec2..a92e810 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -191,20 +191,33 @@ struct mxs_lradc {
> # define LRADC_CTRL0_MX28_XNPSW /* XM */ (1 << 17)
> # define LRADC_CTRL0_MX28_XPPSW /* XP */ (1 << 16)
>
> +# define LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE (1 << 20)
> +# define LRADC_CTRL0_MX23_YM (1 << 19)
> +# define LRADC_CTRL0_MX23_XM (1 << 18)
> +# define LRADC_CTRL0_MX23_YP (1 << 17)
> +# define LRADC_CTRL0_MX23_XP (1 << 16)
> +
> # define LRADC_CTRL0_MX28_PLATE_MASK \
> (LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE | \
> LRADC_CTRL0_MX28_YNNSW | LRADC_CTRL0_MX28_YPNSW | \
> LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW | \
> LRADC_CTRL0_MX28_XNPSW | LRADC_CTRL0_MX28_XPPSW)
>
> +# define LRADC_CTRL0_MX23_PLATE_MASK \
> + (LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE | \
> + LRADC_CTRL0_MX23_YM | LRADC_CTRL0_MX23_XM | \
> + LRADC_CTRL0_MX23_YP | LRADC_CTRL0_MX23_XP)
> +
> #define LRADC_CTRL1 0x10
> #define LRADC_CTRL1_TOUCH_DETECT_IRQ_EN (1 << 24)
> #define LRADC_CTRL1_LRADC_IRQ_EN(n) (1 << ((n) + 16))
> #define LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK (0x1fff << 16)
> +#define LRADC_CTRL1_MX23_LRADC_IRQ_EN_MASK (0x01ff << 16)
> #define LRADC_CTRL1_LRADC_IRQ_EN_OFFSET 16
> #define LRADC_CTRL1_TOUCH_DETECT_IRQ (1 << 8)
> #define LRADC_CTRL1_LRADC_IRQ(n) (1 << (n))
> #define LRADC_CTRL1_MX28_LRADC_IRQ_MASK 0x1fff
> +#define LRADC_CTRL1_MX23_LRADC_IRQ_MASK 0x01ff
> #define LRADC_CTRL1_LRADC_IRQ_OFFSET 0
>
> #define LRADC_CTRL2 0x20
> @@ -255,37 +268,58 @@ static void mxs_lradc_reg_wrt(struct mxs_lradc *lradc, u32 val, u32 reg)
>
> static u32 mxs_lradc_plate_mask(struct mxs_lradc *lradc)
> {
> - return LRADC_CTRL0_MX28_PLATE_MASK;
> + if (lradc->soc == IMX23_LRADC)
> + return LRADC_CTRL0_MX23_PLATE_MASK;
> + else
> + return LRADC_CTRL0_MX28_PLATE_MASK;
> }
>
> static u32 mxs_lradc_irq_en_mask(struct mxs_lradc *lradc)
> {
> - return LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK;
> + if (lradc->soc == IMX23_LRADC)
> + return LRADC_CTRL1_MX23_LRADC_IRQ_EN_MASK;
> + else
> + return LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK;
> }
>
> static u32 mxs_lradc_irq_mask(struct mxs_lradc *lradc)
> {
> - return LRADC_CTRL1_MX28_LRADC_IRQ_MASK;
> + if (lradc->soc == IMX23_LRADC)
> + return LRADC_CTRL1_MX23_LRADC_IRQ_MASK;
> + else
> + return LRADC_CTRL1_MX28_LRADC_IRQ_MASK;
> }
>
> static u32 mxs_lradc_touch_detect_bit(struct mxs_lradc *lradc)
> {
> - return LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE;
> + if (lradc->soc == IMX23_LRADC)
> + return LRADC_CTRL0_MX23_TOUCH_DETECT_ENABLE;
> + else
> + return LRADC_CTRL0_MX28_TOUCH_DETECT_ENABLE;
> }
>
> static u32 mxs_lradc_drive_x_plate(struct mxs_lradc *lradc)
> {
> - return LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
> + if (lradc->soc == IMX23_LRADC)
> + return LRADC_CTRL0_MX23_XP | LRADC_CTRL0_MX23_XM;
> + else
> + return LRADC_CTRL0_MX28_XPPSW | LRADC_CTRL0_MX28_XNNSW;
> }
>
> static u32 mxs_lradc_drive_y_plate(struct mxs_lradc *lradc)
> {
> - return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
> + if (lradc->soc == IMX23_LRADC)
> + return LRADC_CTRL0_MX23_YP | LRADC_CTRL0_MX23_YM;
> + else
> + return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_YNNSW;
> }
>
> static u32 mxs_lradc_drive_pressure(struct mxs_lradc *lradc)
> {
> - return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
> + if (lradc->soc == IMX23_LRADC)
> + return LRADC_CTRL0_MX23_YP | LRADC_CTRL0_MX23_XM;
> + else
> + return LRADC_CTRL0_MX28_YPPSW | LRADC_CTRL0_MX28_XNNSW;
> }
>
> /*
> @@ -322,7 +356,8 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
> * Virtual channel 0 is always used here as the others are always not
> * used if doing raw sampling.
> */
> - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> + if (lradc->soc == IMX28_LRADC)
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> LRADC_CTRL1);
> mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
>
> @@ -770,7 +805,8 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
> if (ret < 0)
> goto err_buf;
>
> - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> + if (lradc->soc == IMX28_LRADC)
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> LRADC_CTRL1);
> mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
>
> @@ -808,7 +844,8 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
> LRADC_DELAY_KICK, LRADC_DELAY(0));
>
> mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
> - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> + if (lradc->soc == IMX28_LRADC)
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
> LRADC_CTRL1);
>
> kfree(lradc->buffer);
> @@ -912,7 +949,8 @@ static int mxs_lradc_hw_init(struct mxs_lradc *lradc)
> mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
>
> /* Configure the touchscreen type */
> - mxs_lradc_reg_clear(lradc, LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
> + if (lradc->soc == IMX28_LRADC) {
> + mxs_lradc_reg_clear(lradc, LRADC_CTRL0_MX28_TOUCH_SCREEN_TYPE,
> LRADC_CTRL0);
>
> if (lradc->use_touchscreen == MXS_LRADC_TOUCHSCREEN_5WIRE)
> @@ -993,6 +1031,12 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> dev_warn(dev, "Unsupported number of touchscreen wires (%d)\n",
> ts_wires);
>
> + if ((lradc->soc == IMX23_LRADC) && (ts_wires == 5)) {
> + dev_warn(dev, "No support for 5 wire touches on i.MX23\n");
> + dev_warn(dev, "Falling back to 4 wire\n");
> + ts_wires = 4;
> + }
> +
> /* Grab all IRQ sources */
> for (i = 0; i < of_cfg->irq_count; i++) {
> lradc->irq[i] = platform_get_irq(pdev, i);
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 6/9] Staging/iio/adc/touchscreen/MXS: add interrupt driven touch detection
[not found] ` <524AA91F.7000906-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2013-10-01 11:06 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:06 UTC (permalink / raw)
To: Jürgen Beisert
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg, Dmitry Torokhov,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
On 10/01/13 11:51, Jonathan Cameron wrote:
> On 10/01/13 10:28, Jürgen Beisert wrote:
>> Hi Jonathan,
>>
>> On Tuesday 01 October 2013 11:25:46 Jonathan Cameron wrote:
>>> a couple of the patch descriptions say that they are untested on i.MX28.
>>
>> On Monday 23 September 2013 16:36:35 Juergen Beisert wrote:
>>> For battery driven systems it is a very bad idea to collect the touchscreen
>>> data within a kernel busy loop.
>>>
>>> This change uses the features of the hardware to delay and accumulate
>>> samples in hardware to avoid a high interrupt and CPU load.
>>>
>>> Note: this is only tested on an i.MX23 SoC yet.
>>
>> This note is no longer true. Marek tested it on his M28EVK, Lothar on his TX28
>> and myself also on an i.MX28EVK.
>>
>> For the IIO part of the driver I tested on my i.MX23 based ChumbyOne and some
>> customer hardware and it seems still to work (I can only guess if the values I
>> read from the sysfs entries are correct, sorry).
>
> Excellent. I'll assume everyone is happy then and add some appropriate
> tested-by tags. I'd missed Marek's reply saying he was fine with this.
This one is not applying cleanly. I've merged what I think is the right
fixup, but please check.
The issue is around the error handling after mxs_lradc_ts_register which has
been changed in the meantime it seems.
Jonathan
>
>
> Thanks,
>
> Jonathan
>>
>> Regards,
>> Juergen
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 7/9] Staging/iio/adc/touchscreen/MXS: remove old touchscreen detection implementation
2013-09-23 14:36 ` [PATCH 7/9] Staging/iio/adc/touchscreen/MXS: remove old touchscreen detection implementation Juergen Beisert
@ 2013-10-01 11:13 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:13 UTC (permalink / raw)
To: Juergen Beisert, linux-iio
Cc: devel, marex, fabio.estevam, jic23, linux-input, linux-arm-kernel
On 09/23/13 15:36, Juergen Beisert wrote:
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> CC: linux-arm-kernel@lists.infradead.org
> CC: linux-input@vger.kernel.org
> CC: devel@driverdev.osuosl.org
> CC: Marek Vasut <marex@denx.de>
> CC: Fabio Estevam <fabio.estevam@freescale.com>
> CC: Jonathan Cameron <jic23@cam.ac.uk>
Applied to the togreg branch of iio.git
Thanks,
> ---
> drivers/staging/iio/adc/mxs-lradc.c | 163 ------------------------------------
> 1 file changed, 163 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index 76a900d..aa1f337 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -186,7 +186,6 @@ struct mxs_lradc {
> bool use_touchbutton;
>
> struct input_dev *ts_input;
> - struct work_struct ts_work;
>
> enum mxs_lradc_id soc;
> enum lradc_ts_plate cur_plate; /* statemachine */
> @@ -830,168 +829,6 @@ static const struct iio_info mxs_lradc_iio_info = {
> .read_raw = mxs_lradc_read_raw,
> };
>
> -static int mxs_lradc_ts_touched(struct mxs_lradc *lradc)
> -{
> - uint32_t reg;
> -
> - /* Enable touch detection. */
> - mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
> - mxs_lradc_reg_set(lradc, mxs_lradc_touch_detect_bit(lradc),
> - LRADC_CTRL0);
> -
> - msleep(LRADC_TS_SAMPLE_DELAY_MS);
> -
> - reg = readl(lradc->base + LRADC_STATUS);
> -
> - return reg & LRADC_STATUS_TOUCH_DETECT_RAW;
> -}
> -
> -static int32_t mxs_lradc_ts_sample(struct mxs_lradc *lradc,
> - enum lradc_ts_plate plate, int change)
> -{
> - unsigned long delay, jiff;
> - uint32_t reg, ctrl0 = 0, chan = 0;
> - /* The touchscreen always uses CTRL4 slot #7. */
> - const uint8_t slot = 7;
> - uint32_t val;
> -
> - /*
> - * There are three correct configurations of the controller sampling
> - * the touchscreen, each of these configuration provides different
> - * information from the touchscreen.
> - *
> - * The following table describes the sampling configurations:
> - * +-------------+-------+-------+-------+
> - * | Wire \ Axis | X | Y | Z |
> - * +---------------------+-------+-------+
> - * | X+ (CH2) | HI | TS | TS |
> - * +-------------+-------+-------+-------+
> - * | X- (CH4) | LO | SH | HI |
> - * +-------------+-------+-------+-------+
> - * | Y+ (CH3) | SH | HI | HI |
> - * +-------------+-------+-------+-------+
> - * | Y- (CH5) | TS | LO | SH |
> - * +-------------+-------+-------+-------+
> - *
> - * HI ... strong '1' ; LO ... strong '0'
> - * SH ... sample here ; TS ... tri-state
> - *
> - * There are a few other ways of obtaining the Z coordinate
> - * (aka. pressure), but the one in the table seems to be the
> - * most reliable one.
> - */
> - switch (plate) {
> - case LRADC_SAMPLE_X:
> - ctrl0 = mxs_lradc_drive_x_plate(lradc);
> - chan = 3;
> - break;
> - case LRADC_SAMPLE_Y:
> - ctrl0 = mxs_lradc_drive_y_plate(lradc);
> - chan = 4;
> - break;
> - case LRADC_SAMPLE_PRESSURE:
> - ctrl0 = mxs_lradc_drive_pressure(lradc);
> - chan = 5;
> - break;
> - }
> -
> - if (change) {
> - mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc),
> - LRADC_CTRL0);
> - mxs_lradc_reg_set(lradc, ctrl0, LRADC_CTRL0);
> -
> - mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(slot),
> - LRADC_CTRL4);
> - mxs_lradc_reg_set(lradc,
> - chan << LRADC_CTRL4_LRADCSELECT_OFFSET(slot),
> - LRADC_CTRL4);
> - }
> -
> - mxs_lradc_reg_clear(lradc, 0xffffffff, LRADC_CH(slot));
> - mxs_lradc_reg_set(lradc, 1 << slot, LRADC_CTRL0);
> -
> - delay = jiffies + msecs_to_jiffies(LRADC_TS_SAMPLE_DELAY_MS);
> - do {
> - jiff = jiffies;
> - reg = readl_relaxed(lradc->base + LRADC_CTRL1);
> - if (reg & LRADC_CTRL1_LRADC_IRQ(slot))
> - break;
> - } while (time_before(jiff, delay));
> -
> - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(slot), LRADC_CTRL1);
> -
> - if (time_after_eq(jiff, delay))
> - return -ETIMEDOUT;
> -
> - val = readl(lradc->base + LRADC_CH(slot));
> - val &= LRADC_CH_VALUE_MASK;
> -
> - return val;
> -}
> -
> -static int32_t mxs_lradc_ts_sample_filter(struct mxs_lradc *lradc,
> - enum lradc_ts_plate plate)
> -{
> - int32_t val, tot = 0;
> - int i;
> -
> - val = mxs_lradc_ts_sample(lradc, plate, 1);
> -
> - /* Delay a bit so the touchscreen is stable. */
> - mdelay(2);
> -
> - for (i = 0; i < LRADC_TS_SAMPLE_AMOUNT; i++) {
> - val = mxs_lradc_ts_sample(lradc, plate, 0);
> - tot += val;
> - }
> -
> - return tot / LRADC_TS_SAMPLE_AMOUNT;
> -}
> -
> -static void mxs_lradc_ts_work(struct work_struct *ts_work)
> -{
> - struct mxs_lradc *lradc = container_of(ts_work,
> - struct mxs_lradc, ts_work);
> - int val_x, val_y, val_p;
> - bool valid = false;
> -
> - while (mxs_lradc_ts_touched(lradc)) {
> - /* Disable touch detector so we can sample the touchscreen. */
> - mxs_lradc_reg_clear(lradc, mxs_lradc_touch_detect_bit(lradc),
> - LRADC_CTRL0);
> -
> - if (likely(valid)) {
> - input_report_abs(lradc->ts_input, ABS_X, val_x);
> - input_report_abs(lradc->ts_input, ABS_Y, val_y);
> - input_report_abs(lradc->ts_input, ABS_PRESSURE, val_p);
> - input_report_key(lradc->ts_input, BTN_TOUCH, 1);
> - input_sync(lradc->ts_input);
> - }
> -
> - valid = false;
> -
> - val_x = mxs_lradc_ts_sample_filter(lradc, LRADC_SAMPLE_X);
> - if (val_x < 0)
> - continue;
> - val_y = mxs_lradc_ts_sample_filter(lradc, LRADC_SAMPLE_Y);
> - if (val_y < 0)
> - continue;
> - val_p = mxs_lradc_ts_sample_filter(lradc, LRADC_SAMPLE_PRESSURE);
> - if (val_p < 0)
> - continue;
> -
> - valid = true;
> - }
> -
> - input_report_abs(lradc->ts_input, ABS_PRESSURE, 0);
> - input_report_key(lradc->ts_input, BTN_TOUCH, 0);
> - input_sync(lradc->ts_input);
> -
> - /* Restart the touchscreen interrupts. */
> - mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
> - mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
> -}
> -
> static int mxs_lradc_ts_open(struct input_dev *dev)
> {
> struct mxs_lradc *lradc = input_get_drvdata(dev);
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 8/9] Staging/iio/adc/touchscreen/MXS: provide devicetree adaption
[not found] ` <1379946998-23041-9-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-10-01 11:14 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:14 UTC (permalink / raw)
To: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
On 09/23/13 15:36, Juergen Beisert wrote:
> This is an RFC for the new touchscreen properties.
>
> Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> CC: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> CC: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
> CC: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> CC: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> CC: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
> CC: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Applied to the togreg branch of iio.git
Thanks,
> ---
> .../bindings/staging/iio/adc/mxs-lradc.txt | 36 ++++++++++++--
> arch/arm/boot/dts/imx28-evk.dts | 4 ++
> drivers/staging/iio/adc/mxs-lradc.c | 57 ++++++++++++++--------
> 3 files changed, 71 insertions(+), 26 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt
> index 4688205..ee05dc3 100644
> --- a/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt
> +++ b/Documentation/devicetree/bindings/staging/iio/adc/mxs-lradc.txt
> @@ -1,7 +1,8 @@
> * Freescale i.MX28 LRADC device driver
>
> Required properties:
> -- compatible: Should be "fsl,imx28-lradc"
> +- compatible: Should be "fsl,imx23-lradc" for i.MX23 SoC and "fsl,imx28-lradc"
> + for i.MX28 SoC
> - reg: Address and length of the register set for the device
> - interrupts: Should contain the LRADC interrupts
>
> @@ -9,13 +10,38 @@ Optional properties:
> - fsl,lradc-touchscreen-wires: Number of wires used to connect the touchscreen
> to LRADC. Valid value is either 4 or 5. If this
> property is not present, then the touchscreen is
> - disabled.
> + disabled. 5 wires is valid for i.MX28 SoC only.
> +- fsl,ave-ctrl: number of samples per direction to calculate an average value.
> + Allowed value is 1 ... 31, default is 4
> +- fsl,ave-delay: delay between consecutive samples. Allowed value is
> + 1 ... 2047. It is used if 'fsl,ave-ctrl' > 1, counts at
> + 2 kHz and its default is 2 (= 1 ms)
> +- fsl,settling: delay between plate switch to next sample. Allowed value is
> + 1 ... 2047. It counts at 2 kHz and its default is
> + 10 (= 5 ms)
>
> -Examples:
> +Example for i.MX23 SoC:
> +
> + lradc@80050000 {
> + compatible = "fsl,imx23-lradc";
> + reg = <0x80050000 0x2000>;
> + interrupts = <36 37 38 39 40 41 42 43 44>;
> + status = "okay";
> + fsl,lradc-touchscreen-wires = <4>;
> + fsl,ave-ctrl = <4>;
> + fsl,ave-delay = <2>;
> + fsl,settling = <10>;
> + };
> +
> +Example for i.MX28 SoC:
>
> lradc@80050000 {
> compatible = "fsl,imx28-lradc";
> reg = <0x80050000 0x2000>;
> - interrupts = <10 14 15 16 17 18 19
> - 20 21 22 23 24 25>;
> + interrupts = <10 14 15 16 17 18 19 20 21 22 23 24 25>;
> + status = "okay";
> + fsl,lradc-touchscreen-wires = <5>;
> + fsl,ave-ctrl = <4>;
> + fsl,ave-delay = <2>;
> + fsl,settling = <10>;
> };
> diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts
> index 15715d9..aa33393 100644
> --- a/arch/arm/boot/dts/imx28-evk.dts
> +++ b/arch/arm/boot/dts/imx28-evk.dts
> @@ -183,6 +183,10 @@
>
> lradc@80050000 {
> status = "okay";
> + fsl,lradc-touchscreen-wires = <4>;
> + fsl,ave-ctrl = <4>;
> + fsl,ave-delay = <2>;
> + fsl,settling = <10>;
> };
>
> i2c0: i2c@80058000 {
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index aa1f337..dbc0af6 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -1230,10 +1230,45 @@ MODULE_DEVICE_TABLE(of, mxs_lradc_dt_ids);
> static int mxs_lradc_probe_touchscreen(struct mxs_lradc *lradc,
> struct device_node *lradc_node)
> {
> - /* TODO retrieve from device tree */
> + int ret;
> + u32 ts_wires = 0, adapt;
> +
> + ret = of_property_read_u32(lradc_node, "fsl,lradc-touchscreen-wires",
> + &ts_wires);
> + if (ret)
> + return -ENODEV; /* touchscreen feature disabled */
> +
> + switch (ts_wires) {
> + case 4:
> + lradc->use_touchscreen = MXS_LRADC_TOUCHSCREEN_4WIRE;
> + break;
> + case 5:
> + if (lradc->soc == IMX28_LRADC) {
> + lradc->use_touchscreen = MXS_LRADC_TOUCHSCREEN_5WIRE;
> + break;
> + }
> + /* fall through an error message for i.MX23 */
> + default:
> + dev_err(lradc->dev,
> + "Unsupported number of touchscreen wires (%d)\n",
> + ts_wires);
> + return -EINVAL;
> + }
> +
> lradc->over_sample_cnt = 4;
> + ret = of_property_read_u32(lradc_node, "fsl,ave-ctrl", &adapt);
> + if (ret == 0)
> + lradc->over_sample_cnt = adapt;
> +
> lradc->over_sample_delay = 2;
> + ret = of_property_read_u32(lradc_node, "fsl,ave-delay", &adapt);
> + if (ret == 0)
> + lradc->over_sample_delay = adapt;
> +
> lradc->settling_delay = 10;
> + ret = of_property_read_u32(lradc_node, "fsl,settling", &adapt);
> + if (ret == 0)
> + lradc->settling_delay = adapt;
>
> return 0;
> }
> @@ -1249,7 +1284,6 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> struct mxs_lradc *lradc;
> struct iio_dev *iio;
> struct resource *iores;
> - uint32_t ts_wires = 0;
> int ret = 0, touch_ret;
> int i;
>
> @@ -1275,25 +1309,6 @@ static int mxs_lradc_probe(struct platform_device *pdev)
>
> touch_ret = mxs_lradc_probe_touchscreen(lradc, node);
>
> - /* Check if touchscreen is enabled in DT. */
> - ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
> - &ts_wires);
> - if (ret)
> - dev_info(dev, "Touchscreen not enabled.\n");
> - else if (ts_wires == 4)
> - lradc->use_touchscreen = MXS_LRADC_TOUCHSCREEN_4WIRE;
> - else if (ts_wires == 5)
> - lradc->use_touchscreen = MXS_LRADC_TOUCHSCREEN_5WIRE;
> - else
> - dev_warn(dev, "Unsupported number of touchscreen wires (%d)\n",
> - ts_wires);
> -
> - if ((lradc->soc == IMX23_LRADC) && (ts_wires == 5)) {
> - dev_warn(dev, "No support for 5 wire touches on i.MX23\n");
> - dev_warn(dev, "Falling back to 4 wire\n");
> - ts_wires = 4;
> - }
> -
> /* Grab all IRQ sources */
> for (i = 0; i < of_cfg->irq_count; i++) {
> lradc->irq[i] = platform_get_irq(pdev, i);
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 9/9] Staging/iio: add TODO reminder
[not found] ` <1379946998-23041-10-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-10-01 11:14 ` Jonathan Cameron
[not found] ` <524AAEA8.4090106-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:14 UTC (permalink / raw)
To: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
On 09/23/13 15:36, Juergen Beisert wrote:
> Some things have still to be done to the LRADC driver.
>
> Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> CC: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> CC: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
> CC: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> CC: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> CC: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
Applied to the togreg branch of iio.git
Thanks.
Please check over the entire series as it was more than a little
fiddly to apply and I may well have messed it up!
Jonathan
> ---
> drivers/staging/iio/TODO | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/staging/iio/TODO b/drivers/staging/iio/TODO
> index 04c2326..c22a0ed 100644
> --- a/drivers/staging/iio/TODO
> +++ b/drivers/staging/iio/TODO
> @@ -13,6 +13,17 @@ Would be nice
> 3) Expand device set. Lots of other maxim adc's have very
> similar interfaces.
>
> +MXS LRADC driver:
> +This is a classic MFD device as it combines the following subdevices
> + - touchscreen controller (input subsystem related device)
> + - general purpose ADC channels
> + - battery voltage monitor (power subsystem related device)
> + - die temperature monitor (thermal management)
> +
> +At least the battery voltage and die temperature feature is required in-kernel
> +by a driver of the SoC's battery charging unit to avoid any damage to the
> +silicon and the battery.
> +
> TSL2561
> Would be nice
> 1) Open question of userspace vs kernel space balance when
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 9/9] Staging/iio: add TODO reminder
[not found] ` <524AAEA8.4090106-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2013-10-01 11:21 ` Jonathan Cameron
[not found] ` <524AB04C.4070409-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:21 UTC (permalink / raw)
To: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
On 10/01/13 12:14, Jonathan Cameron wrote:
> On 09/23/13 15:36, Juergen Beisert wrote:
>> Some things have still to be done to the LRADC driver.
>>
>> Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>> CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>> CC: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> CC: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
>> CC: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
>> CC: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>> CC: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
> Applied to the togreg branch of iio.git
>
> Thanks.
>
> Please check over the entire series as it was more than a little
> fiddly to apply and I may well have messed it up!
There may be a delay on me pushing this out. Kernel.org isn't talking
to me right now for some reason.
>
> Jonathan
>> ---
>> drivers/staging/iio/TODO | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/staging/iio/TODO b/drivers/staging/iio/TODO
>> index 04c2326..c22a0ed 100644
>> --- a/drivers/staging/iio/TODO
>> +++ b/drivers/staging/iio/TODO
>> @@ -13,6 +13,17 @@ Would be nice
>> 3) Expand device set. Lots of other maxim adc's have very
>> similar interfaces.
>>
>> +MXS LRADC driver:
>> +This is a classic MFD device as it combines the following subdevices
>> + - touchscreen controller (input subsystem related device)
>> + - general purpose ADC channels
>> + - battery voltage monitor (power subsystem related device)
>> + - die temperature monitor (thermal management)
>> +
>> +At least the battery voltage and die temperature feature is required in-kernel
>> +by a driver of the SoC's battery charging unit to avoid any damage to the
>> +silicon and the battery.
>> +
>> TSL2561
>> Would be nice
>> 1) Open question of userspace vs kernel space balance when
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 9/9] Staging/iio: add TODO reminder
[not found] ` <524AB04C.4070409-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2013-10-01 11:22 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2013-10-01 11:22 UTC (permalink / raw)
To: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
On 10/01/13 12:21, Jonathan Cameron wrote:
> On 10/01/13 12:14, Jonathan Cameron wrote:
>> On 09/23/13 15:36, Juergen Beisert wrote:
>>> Some things have still to be done to the LRADC driver.
>>>
>>> Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>>> CC: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>>> CC: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> CC: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
>>> CC: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
>>> CC: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>>> CC: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
>> Applied to the togreg branch of iio.git
>>
>> Thanks.
>>
>> Please check over the entire series as it was more than a little
>> fiddly to apply and I may well have messed it up!
> There may be a delay on me pushing this out. Kernel.org isn't talking
> to me right now for some reason.
Hmm. Typical, it worked just after I sent this.
Anyhow, all there now.
>>
>> Jonathan
>>> ---
>>> drivers/staging/iio/TODO | 11 +++++++++++
>>> 1 file changed, 11 insertions(+)
>>>
>>> diff --git a/drivers/staging/iio/TODO b/drivers/staging/iio/TODO
>>> index 04c2326..c22a0ed 100644
>>> --- a/drivers/staging/iio/TODO
>>> +++ b/drivers/staging/iio/TODO
>>> @@ -13,6 +13,17 @@ Would be nice
>>> 3) Expand device set. Lots of other maxim adc's have very
>>> similar interfaces.
>>>
>>> +MXS LRADC driver:
>>> +This is a classic MFD device as it combines the following subdevices
>>> + - touchscreen controller (input subsystem related device)
>>> + - general purpose ADC channels
>>> + - battery voltage monitor (power subsystem related device)
>>> + - die temperature monitor (thermal management)
>>> +
>>> +At least the battery voltage and die temperature feature is required in-kernel
>>> +by a driver of the SoC's battery charging unit to avoid any damage to the
>>> +silicon and the battery.
>>> +
>>> TSL2561
>>> Would be nice
>>> 1) Open question of userspace vs kernel space balance when
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
[not found] ` <1379946998-23041-1-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (2 preceding siblings ...)
2013-10-01 9:25 ` Jonathan Cameron
@ 2014-01-09 13:31 ` Alexandre Belloni
[not found] ` <52CEA4AA.8050503-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
3 siblings, 1 reply; 44+ messages in thread
From: Alexandre Belloni @ 2014-01-09 13:31 UTC (permalink / raw)
To: Juergen Beisert, linux-iio-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Hi,
Sorry to chime in only now but it seems that this series is breaking the
touchscreen calibration on 3.13 (and -rc7 is out so it might be too
late).
At first, I though I became a terrible clicker ;) but I found some
evidences:
xinput_calibrator is complaining about misclicks, debug output:
DEBUG: Adding click 0 (X=105, Y=59)
DEBUG: Not adding click 1 (X=100, Y=59): within 7 pixels of previous click
DEBUG: Adding click 1 (X=696, Y=58)
DEBUG: Not adding click 2 (X=700, Y=55): within 7 pixels of previous click
DEBUG: Adding click 2 (X=103, Y=422)
DEBUG: Mis-click detected, click 3 (X=438, Y=415) not aligned with click 1 (X=696, Y=58) or click 2 (X=103, Y=422) (threshold=15)
DEBUG: Adding click 0 (X=424, Y=411)
Do you see the confusion ? At some point one of the coordinates is not
updated. Successful calibration with 3.12.6 gives:
DEBUG: Adding click 0 (X=126, Y=405)
DEBUG: Adding click 1 (X=684, Y=399)
DEBUG: Adding click 2 (X=128, Y=77)
DEBUG: Adding click 3 (X=683, Y=77)
With ts_calibrate:
xres = 800, yres = 480
Took 1 samples...
Top left : X = 435 Y = 3572
Took 2 samples...
Top right : X = 2094 Y = 3553
Took 2 samples...
Bot right : X = 2939 Y = 2077
Took 2 samples...
Bot left : X = 2060 Y = 644
Took 2 samples...
Center : X = 1279 Y = 1346
We experience the same thing, when changing position on an axis, we get
an average between the previous and the new position (probably because
we got 2 samples):
- Top Left is ok
- Top right is almost ok: X should be around 3500/3700
- Bot right is starting to get really wrong: X is getting better (it
should still be around 3500/3700) but Y should be quite lower
- Bot left: Y is ok but X should be lower
- Center is completely wrong, both values should be around 2000
Last test with evtest which is always difficult because it outputs a lot
of debug. Two separate touchs, bottom left and then top right (note that
this is with fsl,ave-ctrl = <8>;):
Event: time 1389210862.451000, type 3 (Absolute), code 0 (X), value 2183
Event: time 1389210862.451000, type 3 (Absolute), code 1 (Y), value 720
Event: time 1389210862.451000, type 3 (Absolute), code 24 (Pressure), value 6
Event: time 1389210862.451000, type 1 (Key), code 330 (Touch), value 1
Event: time 1389210862.451000, -------------- Report Sync ------------
Event: time 1389210862.477721, type 3 (Absolute), code 0 (X), value 448
Event: time 1389210862.477721, type 3 (Absolute), code 1 (Y), value 667
Event: time 1389210862.477721, type 3 (Absolute), code 24 (Pressure), value 595
Event: time 1389210862.477721, -------------- Report Sync ------------
Event: time 1389210862.504718, type 3 (Absolute), code 0 (X), value 434
Event: time 1389210862.504718, type 3 (Absolute), code 1 (Y), value 704
Event: time 1389210862.504718, type 3 (Absolute), code 24 (Pressure), value 580
Event: time 1389210862.504718, -------------- Report Sync ------------
Event: time 1389210862.536688, type 1 (Key), code 330 (Touch), value 0
Event: time 1389210862.536688, -------------- Report Sync ------------
Event: time 1389210863.359697, type 3 (Absolute), code 0 (X), value 432
Event: time 1389210863.359697, type 3 (Absolute), code 1 (Y), value 726
Event: time 1389210863.359697, type 3 (Absolute), code 24 (Pressure), value 210
Event: time 1389210863.359697, type 1 (Key), code 330 (Touch), value 1
Event: time 1389210863.359697, -------------- Report Sync ------------
Event: time 1389210863.391687, type 1 (Key), code 330 (Touch), value 0
Event: time 1389210863.391687, -------------- Report Sync ------------
We get 3 reports for bottom left, then pen up, then one report for top
right that is almost exactly the same a bottom left !
Output from 3.12:
Event: time 1389210022.146809, type 3 (Absolute), code 0 (X), value 286
Event: time 1389210022.146809, type 3 (Absolute), code 1 (Y), value 504
Event: time 1389210022.146809, type 3 (Absolute), code 24 (Pressure), value 3045
Event: time 1389210022.146809, type 1 (Key), code 330 (Touch), value 1
Event: time 1389210022.146809, -------------- Report Sync ------------
Event: time 1389210022.166830, type 3 (Absolute), code 0 (X), value 256
Event: time 1389210022.166830, type 3 (Absolute), code 1 (Y), value 489
Event: time 1389210022.166830, type 3 (Absolute), code 24 (Pressure), value 3033
Event: time 1389210022.166830, -------------- Report Sync ------------
Event: time 1389210022.186812, type 3 (Absolute), code 24 (Pressure), value 0
Event: time 1389210022.186812, type 1 (Key), code 330 (Touch), value 0
Event: time 1389210022.186812, -------------- Report Sync ------------
Event: time 1389210025.196808, type 3 (Absolute), code 0 (X), value 3812
Event: time 1389210025.196808, type 3 (Absolute), code 1 (Y), value 3637
Event: time 1389210025.196808, type 3 (Absolute), code 24 (Pressure), value 4032
Event: time 1389210025.196808, type 1 (Key), code 330 (Touch), value 1
Event: time 1389210025.196808, -------------- Report Sync ------------
Event: time 1389210025.216819, type 3 (Absolute), code 24 (Pressure), value 0
Event: time 1389210025.216819, type 1 (Key), code 330 (Touch), value 0
Event: time 1389210025.216819, -------------- Report Sync ------------
While this is not necessarily an issue with ts_calibrate (it is possible
to click longer so it collects more samples), I don't see that working
with xinput_calibrator.
While I don't have much experience with the TS part of the code but I
can investigate if you don't have any idea.
On 23/09/2013 16:36, Juergen Beisert wrote:
> The following series replaces the current busy loop touchscreen implementation
> for i.MX28/i.MX23 SoCs by a fully interrupt driven implementation.
>
> Since i.MX23 and i.MX28 silicon differs, the existing implementation can
> be used for the i.MX28 SoC only.
>
> The first patch adds proper clock handling. Various platforms seems to disable
> the internal 2 kHz clock which is used by the LRADC delay units.
>
> The next two patches of this series move the i.MX28 specific definitions
> out of the way. The forth patch simplifies the register access to make it easier
> to add the i.MX23 support. Then the i.MX23 specific definitions are added, also
> the code to distinguish both SoCs at run-time.
> Up to here the existing touchscreen driver will now run on an i.MX23 Soc as well.
>
> When these i.MX SoCs are running from battery it seems not to be a good idea to
> run a busy loop to detect touches and their location. The 6th patch adds a
> fully interrupt driven implementation which makes use of the built-in delay
> and multiple sample features of the touchscreen controller. This will reduce
> the interrupt load to a minimum.
>
> The remaining patches in this series just removes the existing busy loop
> implementation, add a proposal for devicetree binding and a reminder what has
> still to be done with the LRADC driver.
>
> Changes since v5:
>
> - add missing clock handling which prevents the delay units from work (this
> should make it work on the MX28EVK and M28EVK as well)
>
> Changes since v4:
>
> - honor Jonathan's comments about function names
> - honor Dmitry's comments about workqueue canceling and interrupts
> - adding devicetree bindings proposal
>
> Changes since v3:
>
> - split adding register access functions and i.MX23 support into two patches
>
> Changes since v2:
>
> - useless debug output removed
>
> Changes since v1:
>
> - adding register access functions to make the existing code more readable
> - adding some functions to distinguish the SoCs at run-time to avoid if-else
> contructs whenever differences in the register layout between i.MX23 and
> i.MX28 must be handled
>
> Comments are welcome.
>
> Juergen
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
[not found] ` <52CEA4AA.8050503-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
@ 2014-01-10 8:55 ` Jürgen Beisert
2014-02-04 23:45 ` Marek Vasut
[not found] ` <201401100955.45885.jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 2 replies; 44+ messages in thread
From: Jürgen Beisert @ 2014-01-10 8:55 UTC (permalink / raw)
To: Alexandre Belloni
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Hi Alexandre,
On Thursday 09 January 2014 14:31:22 Alexandre Belloni wrote:
> Sorry to chime in only now but it seems that this series is breaking the
> touchscreen calibration on 3.13 (and -rc7 is out so it might be too
> late).
>
> At first, I though I became a terrible clicker ;) but I found some
> evidences:
>
> xinput_calibrator is complaining about misclicks, debug output:
> DEBUG: Adding click 0 (X=105, Y=59)
> DEBUG: Not adding click 1 (X=100, Y=59): within 7 pixels of previous click
> DEBUG: Adding click 1 (X=696, Y=58)
> DEBUG: Not adding click 2 (X=700, Y=55): within 7 pixels of previous click
> DEBUG: Adding click 2 (X=103, Y=422)
> DEBUG: Mis-click detected, click 3 (X=438, Y=415) not aligned with click 1 (X=696, Y=58) or click 2 (X=103, Y=422) (threshold=15)
> DEBUG: Adding click 0 (X=424, Y=411)
>
> Do you see the confusion ? At some point one of the coordinates is not
> updated. Successful calibration with 3.12.6 gives:
> DEBUG: Adding click 0 (X=126, Y=405)
> DEBUG: Adding click 1 (X=684, Y=399)
> DEBUG: Adding click 2 (X=128, Y=77)
> DEBUG: Adding click 3 (X=683, Y=77)
>
>
> With ts_calibrate:
> xres = 800, yres = 480
> Took 1 samples...
> Top left : X = 435 Y = 3572
> Took 2 samples...
> Top right : X = 2094 Y = 3553
> Took 2 samples...
> Bot right : X = 2939 Y = 2077
> Took 2 samples...
> Bot left : X = 2060 Y = 644
> Took 2 samples...
> Center : X = 1279 Y = 1346
>
> We experience the same thing, when changing position on an axis, we get
> an average between the previous and the new position (probably because
> we got 2 samples):
> - Top Left is ok
> - Top right is almost ok: X should be around 3500/3700
> - Bot right is starting to get really wrong: X is getting better (it
> should still be around 3500/3700) but Y should be quite lower
> - Bot left: Y is ok but X should be lower
> - Center is completely wrong, both values should be around 2000
>
> Last test with evtest which is always difficult because it outputs a lot
> of debug. Two separate touchs, bottom left and then top right (note that
> this is with fsl,ave-ctrl = <8>;):
>
> Event: time 1389210862.451000, type 3 (Absolute), code 0 (X), value 2183
> Event: time 1389210862.451000, type 3 (Absolute), code 1 (Y), value 720
> Event: time 1389210862.451000, type 3 (Absolute), code 24 (Pressure), value 6
> Event: time 1389210862.451000, type 1 (Key), code 330 (Touch), value 1
> Event: time 1389210862.451000, -------------- Report Sync ------------
> Event: time 1389210862.477721, type 3 (Absolute), code 0 (X), value 448
> Event: time 1389210862.477721, type 3 (Absolute), code 1 (Y), value 667
> Event: time 1389210862.477721, type 3 (Absolute), code 24 (Pressure), value 595
> Event: time 1389210862.477721, -------------- Report Sync ------------
> Event: time 1389210862.504718, type 3 (Absolute), code 0 (X), value 434
> Event: time 1389210862.504718, type 3 (Absolute), code 1 (Y), value 704
> Event: time 1389210862.504718, type 3 (Absolute), code 24 (Pressure), value 580
> Event: time 1389210862.504718, -------------- Report Sync ------------
> Event: time 1389210862.536688, type 1 (Key), code 330 (Touch), value 0
> Event: time 1389210862.536688, -------------- Report Sync ------------
> Event: time 1389210863.359697, type 3 (Absolute), code 0 (X), value 432
> Event: time 1389210863.359697, type 3 (Absolute), code 1 (Y), value 726
> Event: time 1389210863.359697, type 3 (Absolute), code 24 (Pressure), value 210
> Event: time 1389210863.359697, type 1 (Key), code 330 (Touch), value 1
> Event: time 1389210863.359697, -------------- Report Sync ------------
> Event: time 1389210863.391687, type 1 (Key), code 330 (Touch), value 0
> Event: time 1389210863.391687, -------------- Report Sync ------------
>
> We get 3 reports for bottom left, then pen up, then one report for top
> right that is almost exactly the same a bottom left !
>
> Output from 3.12:
> Event: time 1389210022.146809, type 3 (Absolute), code 0 (X), value 286
> Event: time 1389210022.146809, type 3 (Absolute), code 1 (Y), value 504
> Event: time 1389210022.146809, type 3 (Absolute), code 24 (Pressure), value 3045
> Event: time 1389210022.146809, type 1 (Key), code 330 (Touch), value 1
> Event: time 1389210022.146809, -------------- Report Sync ------------
> Event: time 1389210022.166830, type 3 (Absolute), code 0 (X), value 256
> Event: time 1389210022.166830, type 3 (Absolute), code 1 (Y), value 489
> Event: time 1389210022.166830, type 3 (Absolute), code 24 (Pressure), value 3033
> Event: time 1389210022.166830, -------------- Report Sync ------------
> Event: time 1389210022.186812, type 3 (Absolute), code 24 (Pressure), value 0
> Event: time 1389210022.186812, type 1 (Key), code 330 (Touch), value 0
> Event: time 1389210022.186812, -------------- Report Sync ------------
> Event: time 1389210025.196808, type 3 (Absolute), code 0 (X), value 3812
> Event: time 1389210025.196808, type 3 (Absolute), code 1 (Y), value 3637
> Event: time 1389210025.196808, type 3 (Absolute), code 24 (Pressure), value 4032
> Event: time 1389210025.196808, type 1 (Key), code 330 (Touch), value 1
> Event: time 1389210025.196808, -------------- Report Sync ------------
> Event: time 1389210025.216819, type 3 (Absolute), code 24 (Pressure), value 0
> Event: time 1389210025.216819, type 1 (Key), code 330 (Touch), value 0
> Event: time 1389210025.216819, -------------- Report Sync ------------
>
>
> While this is not necessarily an issue with ts_calibrate (it is possible
> to click longer so it collects more samples), I don't see that working
> with xinput_calibrator.
>
> While I don't have much experience with the TS part of the code but I
> can investigate if you don't have any idea.
You are right. I have seen the same behaviour here a few times. Currently I'm
short in time to dig deeper into this issue, but I will try to do so.
Juergen
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
2014-01-10 8:55 ` Jürgen Beisert
@ 2014-02-04 23:45 ` Marek Vasut
[not found] ` <201401100955.45885.jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
1 sibling, 0 replies; 44+ messages in thread
From: Marek Vasut @ 2014-02-04 23:45 UTC (permalink / raw)
To: Jürgen Beisert
Cc: Alexandre Belloni, linux-iio, linux-arm-kernel, devel,
fabio.estevam, jic23, linux-input
On Friday, January 10, 2014 at 09:55:45 AM, Jürgen Beisert wrote:
[...]
> > While this is not necessarily an issue with ts_calibrate (it is possible
> > to click longer so it collects more samples), I don't see that working
> > with xinput_calibrator.
> >
> > While I don't have much experience with the TS part of the code but I
> > can investigate if you don't have any idea.
>
> You are right. I have seen the same behaviour here a few times. Currently
> I'm short in time to dig deeper into this issue, but I will try to do so.
Hi guys, is this still broken?
Best regards,
Marek Vasut
--
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] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
[not found] ` <201401100955.45885.jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2014-02-24 13:16 ` Juergen Beisert
2014-02-24 13:33 ` Dan Carpenter
[not found] ` <201402241416.24270.jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 2 replies; 44+ messages in thread
From: Juergen Beisert @ 2014-02-24 13:16 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Alexandre Belloni, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
marex-ynQEQJNshbs, fabio.estevam-KZfg59tc24xl57MIdRCFDg,
linux-iio-u79uwXL29TY76Z2rM5mHXA, jic23-KWPb1pKIrIJaa/9Udqfwiw,
linux-input-u79uwXL29TY76Z2rM5mHXA
Hi Alexandre,
> While I don't have much experience with the TS part of the code but I
> can investigate if you don't have any idea.
can you please test the following patch?
After releasing the touchscreen the internal state machine was left in a
wrong state.
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index e2dd783..558a76c 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -698,6 +698,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
}
/* if it is released, wait for the next touch via IRQ */
+ lradc->cur_plate = LRADC_TOUCH;
mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
}
Regards,
Juergen
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | Phone: +49-5121-206917-5128 |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ |
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
2014-02-24 13:16 ` Juergen Beisert
@ 2014-02-24 13:33 ` Dan Carpenter
2014-02-24 14:38 ` Juergen Beisert
2014-02-24 14:39 ` [PATCH] staging/iio/adc/MXS/LRADC: fix touchscreen statemachine Juergen Beisert
[not found] ` <201402241416.24270.jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
1 sibling, 2 replies; 44+ messages in thread
From: Dan Carpenter @ 2014-02-24 13:33 UTC (permalink / raw)
To: Juergen Beisert
Cc: devel, marex, fabio.estevam, linux-iio, Alexandre Belloni, jic23,
linux-input, linux-arm-kernel
On Mon, Feb 24, 2014 at 02:16:24PM +0100, Juergen Beisert wrote:
> Hi Alexandre,
>
> > While I don't have much experience with the TS part of the code but I
> > can investigate if you don't have any idea.
>
> can you please test the following patch?
> After releasing the touchscreen the internal state machine was left in a
> wrong state.
>
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index e2dd783..558a76c 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -698,6 +698,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
> }
>
> /* if it is released, wait for the next touch via IRQ */
> + lradc->cur_plate = LRADC_TOUCH;
> mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
> mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
> }
I am confused. Why don't you send this like a normal patch?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
[not found] ` <201402241416.24270.jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2014-02-24 14:26 ` Alexandre Belloni
[not found] ` <20140224142658.GD4436-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
0 siblings, 1 reply; 44+ messages in thread
From: Alexandre Belloni @ 2014-02-24 14:26 UTC (permalink / raw)
To: Juergen Beisert
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
linux-iio-u79uwXL29TY76Z2rM5mHXA, jic23-KWPb1pKIrIJaa/9Udqfwiw,
linux-input-u79uwXL29TY76Z2rM5mHXA
Hi Juergen,
On 24/02/2014 at 14:16:24 +0100, Juergen Beisert wrote :
> Hi Alexandre,
>
> > While I don't have much experience with the TS part of the code but I
> > can investigate if you don't have any idea.
>
> can you please test the following patch?
> After releasing the touchscreen the internal state machine was left in a
> wrong state.
>
This seems to solve the issue. You can send the patch with my Tested-by.
It is probably worth trying to get it in 3.14.
Thanks !
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index e2dd783..558a76c 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -698,6 +698,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
> }
>
> /* if it is released, wait for the next touch via IRQ */
> + lradc->cur_plate = LRADC_TOUCH;
> mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
> mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
> }
>
> Regards,
> Juergen
>
> --
> Pengutronix e.K. | Juergen Beisert |
> Linux Solutions for Science and Industry | Phone: +49-5121-206917-5128 |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Fax: +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ |
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
2014-02-24 13:33 ` Dan Carpenter
@ 2014-02-24 14:38 ` Juergen Beisert
2014-02-24 14:47 ` Dan Carpenter
2014-02-24 14:39 ` [PATCH] staging/iio/adc/MXS/LRADC: fix touchscreen statemachine Juergen Beisert
1 sibling, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2014-02-24 14:38 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Dan Carpenter, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
marex-ynQEQJNshbs, fabio.estevam-KZfg59tc24xl57MIdRCFDg,
linux-iio-u79uwXL29TY76Z2rM5mHXA, Alexandre Belloni,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Hi Dan,
On Monday 24 February 2014 14:33:16 Dan Carpenter wrote:
> On Mon, Feb 24, 2014 at 02:16:24PM +0100, Juergen Beisert wrote:
> > > While I don't have much experience with the TS part of the code but I
> > > can investigate if you don't have any idea.
> >
> > can you please test the following patch?
> > After releasing the touchscreen the internal state machine was left in a
> > wrong state.
> >
> > diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> > index e2dd783..558a76c 100644
> > --- a/drivers/staging/iio/adc/mxs-lradc.c
> > +++ b/drivers/staging/iio/adc/mxs-lradc.c
> > @@ -698,6 +698,7 @@ static void mxs_lradc_finish_touch_event(struct
> > mxs_lradc *lradc, bool valid) }
> >
> > /* if it is released, wait for the next touch via IRQ */
> > + lradc->cur_plate = LRADC_TOUCH;
> > mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
> > mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
> > }
>
> I am confused. Why don't you send this like a normal patch?
For testing fist. But you are right, patch will follow.
Regards,
Juergen
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH] staging/iio/adc/MXS/LRADC: fix touchscreen statemachine
2014-02-24 13:33 ` Dan Carpenter
2014-02-24 14:38 ` Juergen Beisert
@ 2014-02-24 14:39 ` Juergen Beisert
2014-02-24 16:48 ` Alexandre Belloni
1 sibling, 1 reply; 44+ messages in thread
From: Juergen Beisert @ 2014-02-24 14:39 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Dan Carpenter, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
marex-ynQEQJNshbs, fabio.estevam-KZfg59tc24xl57MIdRCFDg,
linux-iio-u79uwXL29TY76Z2rM5mHXA, Alexandre Belloni,
jic23-KWPb1pKIrIJaa/9Udqfwiw, linux-input-u79uwXL29TY76Z2rM5mHXA
Releasing the touchscreen lets the internal statemachine left in a wrong state.
Due to this the release coordinate will be reported again by accident when the next
touchscreen event happens. This change sets up the correct state when waiting
for the next touchscreen event.
Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 7fc66a6..514844e 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -757,6 +757,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
}
/* if it is released, wait for the next touch via IRQ */
+ lradc->cur_plate = LRADC_TOUCH;
mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
}
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
2014-02-24 14:38 ` Juergen Beisert
@ 2014-02-24 14:47 ` Dan Carpenter
0 siblings, 0 replies; 44+ messages in thread
From: Dan Carpenter @ 2014-02-24 14:47 UTC (permalink / raw)
To: Juergen Beisert
Cc: devel, marex, fabio.estevam, linux-iio, Alexandre Belloni, jic23,
linux-input, linux-arm-kernel
On Mon, Feb 24, 2014 at 03:38:26PM +0100, Juergen Beisert wrote:
> Hi Dan,
>
> On Monday 24 February 2014 14:33:16 Dan Carpenter wrote:
> > On Mon, Feb 24, 2014 at 02:16:24PM +0100, Juergen Beisert wrote:
> > > > While I don't have much experience with the TS part of the code but I
> > > > can investigate if you don't have any idea.
> > >
> > > can you please test the following patch?
> > > After releasing the touchscreen the internal state machine was left in a
> > > wrong state.
> > >
> > > diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> > > index e2dd783..558a76c 100644
> > > --- a/drivers/staging/iio/adc/mxs-lradc.c
> > > +++ b/drivers/staging/iio/adc/mxs-lradc.c
> > > @@ -698,6 +698,7 @@ static void mxs_lradc_finish_touch_event(struct
> > > mxs_lradc *lradc, bool valid) }
> > >
> > > /* if it is released, wait for the next touch via IRQ */
> > > + lradc->cur_plate = LRADC_TOUCH;
> > > mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
> > > mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
> > > }
> >
> > I am confused. Why don't you send this like a normal patch?
>
> For testing fist. But you are right, patch will follow.
>
Never mind, I suck at reading.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH] staging/iio/adc/MXS/LRADC: fix touchscreen statemachine
2014-02-24 14:39 ` [PATCH] staging/iio/adc/MXS/LRADC: fix touchscreen statemachine Juergen Beisert
@ 2014-02-24 16:48 ` Alexandre Belloni
[not found] ` <20140224164817.GE4436-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
0 siblings, 1 reply; 44+ messages in thread
From: Alexandre Belloni @ 2014-02-24 16:48 UTC (permalink / raw)
To: Juergen Beisert
Cc: devel, marex, fabio.estevam, linux-iio, linux-arm-kernel,
linux-input, Dan Carpenter, jic23
On 24/02/2014 at 15:39:53 +0100, Juergen Beisert wrote :
> Releasing the touchscreen lets the internal statemachine left in a wrong state.
> Due to this the release coordinate will be reported again by accident when the next
> touchscreen event happens. This change sets up the correct state when waiting
> for the next touchscreen event.
>
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
>
Tested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index 7fc66a6..514844e 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -757,6 +757,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
> }
>
> /* if it is released, wait for the next touch via IRQ */
> + lradc->cur_plate = LRADC_TOUCH;
> mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
> mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
> }
>
> --
> Pengutronix e.K. | Juergen Beisert |
> Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation
[not found] ` <20140224142658.GD4436-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
@ 2014-02-24 17:14 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2014-02-24 17:14 UTC (permalink / raw)
To: Alexandre Belloni, Juergen Beisert
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
linux-iio-u79uwXL29TY76Z2rM5mHXA, jic23-KWPb1pKIrIJaa/9Udqfwiw,
linux-input-u79uwXL29TY76Z2rM5mHXA
On February 24, 2014 2:26:58 PM GMT+00:00, Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>Hi Juergen,
>
>On 24/02/2014 at 14:16:24 +0100, Juergen Beisert wrote :
>> Hi Alexandre,
>>
>> > While I don't have much experience with the TS part of the code but
>I
>> > can investigate if you don't have any idea.
>>
>> can you please test the following patch?
>> After releasing the touchscreen the internal state machine was left
>in a
>> wrong state.
>>
>
>This seems to solve the issue. You can send the patch with my
>Tested-by.
>
>It is probably worth trying to get it in 3.14.
Definitely. There is time.
>
>Thanks !
>
>> diff --git a/drivers/staging/iio/adc/mxs-lradc.c
>b/drivers/staging/iio/adc/mxs-lradc.c
>> index e2dd783..558a76c 100644
>> --- a/drivers/staging/iio/adc/mxs-lradc.c
>> +++ b/drivers/staging/iio/adc/mxs-lradc.c
>> @@ -698,6 +698,7 @@ static void mxs_lradc_finish_touch_event(struct
>mxs_lradc *lradc, bool valid)
>> }
>>
>> /* if it is released, wait for the next touch via IRQ */
>> + lradc->cur_plate = LRADC_TOUCH;
>> mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ,
>LRADC_CTRL1);
>> mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
>LRADC_CTRL1);
>> }
>>
>> Regards,
>> Juergen
>>
>> --
>> Pengutronix e.K. | Juergen Beisert
> |
>> Linux Solutions for Science and Industry | Phone:
>+49-5121-206917-5128 |
>> Peiner Str. 6-8, 31137 Hildesheim, Germany | Fax:
>+49-5121-206917-5555 |
>> Amtsgericht Hildesheim, HRA 2686 |
>http://www.pengutronix.de/ |
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH] staging/iio/adc/MXS/LRADC: fix touchscreen statemachine
[not found] ` <20140224164817.GE4436-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
@ 2014-02-24 21:14 ` Jonathan Cameron
[not found] ` <530BB63D.4050200-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 44+ messages in thread
From: Jonathan Cameron @ 2014-02-24 21:14 UTC (permalink / raw)
To: Alexandre Belloni, Juergen Beisert
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Dan Carpenter,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
linux-iio-u79uwXL29TY76Z2rM5mHXA, jic23-KWPb1pKIrIJaa/9Udqfwiw,
linux-input-u79uwXL29TY76Z2rM5mHXA
On 24/02/14 16:48, Alexandre Belloni wrote:
> On 24/02/2014 at 15:39:53 +0100, Juergen Beisert wrote :
>> Releasing the touchscreen lets the internal statemachine left in a wrong state.
>> Due to this the release coordinate will be reported again by accident when the next
>> touchscreen event happens. This change sets up the correct state when waiting
>> for the next touchscreen event.
>>
>> Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>>
>
> Tested-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Applied to the fixes-togreg branch of iio.git Thanks
Jonathan
>
>> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
>> index 7fc66a6..514844e 100644
>> --- a/drivers/staging/iio/adc/mxs-lradc.c
>> +++ b/drivers/staging/iio/adc/mxs-lradc.c
>> @@ -757,6 +757,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
>> }
>>
>> /* if it is released, wait for the next touch via IRQ */
>> + lradc->cur_plate = LRADC_TOUCH;
>> mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
>> mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
>> }
>>
>> --
>> Pengutronix e.K. | Juergen Beisert |
>> Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH] staging/iio/adc/MXS/LRADC: fix touchscreen statemachine
[not found] ` <530BB63D.4050200-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2014-02-24 22:04 ` Jonathan Cameron
0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2014-02-24 22:04 UTC (permalink / raw)
To: Alexandre Belloni, Juergen Beisert
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Dan Carpenter,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, marex-ynQEQJNshbs,
fabio.estevam-KZfg59tc24xl57MIdRCFDg,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA
On 24/02/14 21:14, Jonathan Cameron wrote:
> On 24/02/14 16:48, Alexandre Belloni wrote:
>> On 24/02/2014 at 15:39:53 +0100, Juergen Beisert wrote :
>>> Releasing the touchscreen lets the internal statemachine left in a wrong state.
>>> Due to this the release coordinate will be reported again by accident when the next
>>> touchscreen event happens. This change sets up the correct state when waiting
>>> for the next touchscreen event.
>>>
>>> Signed-off-by: Juergen Beisert <jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>>>
>>
>> Tested-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> Applied to the fixes-togreg branch of iio.git Thanks
I just forced an update to the tree having realised that I'd not
marked it for stable (the change went into the 3.13 tree) and that
a few more details were needed to explain the effects of the problem
and where it came from. Will let it sit overnight then send on to
Greg sometime in the next few days. Good to have this one cleared up.
Jonathan
>
> Jonathan
>>
>>> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
>>> index 7fc66a6..514844e 100644
>>> --- a/drivers/staging/iio/adc/mxs-lradc.c
>>> +++ b/drivers/staging/iio/adc/mxs-lradc.c
>>> @@ -757,6 +757,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
>>> }
>>>
>>> /* if it is released, wait for the next touch via IRQ */
>>> + lradc->cur_plate = LRADC_TOUCH;
>>> mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
>>> mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
>>> }
>>>
>>> --
>>> Pengutronix e.K. | Juergen Beisert |
>>> Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2014-02-24 22:04 UTC | newest]
Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-23 14:36 [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Juergen Beisert
2013-09-23 14:36 ` [PATCH 1/9] Staging/iio/adc/touchscreen/MXS: add proper clock handling Juergen Beisert
2013-09-23 15:13 ` Fabio Estevam
[not found] ` <52405A7F.1050801-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2013-09-24 7:50 ` Jürgen Beisert
2013-09-24 13:50 ` Fabio Estevam
2013-10-01 10:57 ` Jonathan Cameron
[not found] ` <1379946998-23041-2-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 15:30 ` Lothar Waßmann
[not found] ` <21056.24202.312851.105281-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>
2013-09-24 7:39 ` Jürgen Beisert
2013-09-23 14:36 ` [PATCH 2/9] Staging/iio/adc/touchscreen/MXS: distinguish i.MX23's and i.MX28's LRADC Juergen Beisert
[not found] ` <1379946998-23041-3-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-10-01 10:58 ` Jonathan Cameron
2013-09-23 14:36 ` [PATCH 3/9] Staging/iio/adc/touchscreen/MXS: separate i.MX28 specific register bits Juergen Beisert
[not found] ` <1379946998-23041-4-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-10-01 11:00 ` Jonathan Cameron
2013-09-23 14:36 ` [PATCH 4/9] Staging/iio/adc/touchscreen/MXS: simplify register access Juergen Beisert
2013-10-01 11:01 ` Jonathan Cameron
2013-09-23 14:36 ` [PATCH 5/9] Staging/iio/adc/touchscreen/MXS: add i.MX23 support to the LRADC touchscreen driver Juergen Beisert
2013-10-01 11:02 ` Jonathan Cameron
2013-09-23 14:36 ` [PATCH 6/9] Staging/iio/adc/touchscreen/MXS: add interrupt driven touch detection Juergen Beisert
[not found] ` <1379946998-23041-7-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-10-01 9:28 ` Jürgen Beisert
2013-10-01 10:51 ` Jonathan Cameron
[not found] ` <524AA91F.7000906-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-10-01 11:06 ` Jonathan Cameron
2013-09-23 14:36 ` [PATCH 7/9] Staging/iio/adc/touchscreen/MXS: remove old touchscreen detection implementation Juergen Beisert
2013-10-01 11:13 ` Jonathan Cameron
[not found] ` <1379946998-23041-1-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-09-23 14:36 ` [PATCH 8/9] Staging/iio/adc/touchscreen/MXS: provide devicetree adaption Juergen Beisert
[not found] ` <1379946998-23041-9-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-10-01 11:14 ` Jonathan Cameron
2013-09-23 15:25 ` [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Marek Vasut
2013-10-01 9:25 ` Jonathan Cameron
[not found] ` <524A951A.5050606-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-10-01 10:49 ` Marek Vasut
2014-01-09 13:31 ` Alexandre Belloni
[not found] ` <52CEA4AA.8050503-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-10 8:55 ` Jürgen Beisert
2014-02-04 23:45 ` Marek Vasut
[not found] ` <201401100955.45885.jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-02-24 13:16 ` Juergen Beisert
2014-02-24 13:33 ` Dan Carpenter
2014-02-24 14:38 ` Juergen Beisert
2014-02-24 14:47 ` Dan Carpenter
2014-02-24 14:39 ` [PATCH] staging/iio/adc/MXS/LRADC: fix touchscreen statemachine Juergen Beisert
2014-02-24 16:48 ` Alexandre Belloni
[not found] ` <20140224164817.GE4436-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2014-02-24 21:14 ` Jonathan Cameron
[not found] ` <530BB63D.4050200-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-02-24 22:04 ` Jonathan Cameron
[not found] ` <201402241416.24270.jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-02-24 14:26 ` [PATCHv6] staging/iio/adc: change the MXS touchscreen driver implementation Alexandre Belloni
[not found] ` <20140224142658.GD4436-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2014-02-24 17:14 ` Jonathan Cameron
2013-09-23 14:36 ` [PATCH 9/9] Staging/iio: add TODO reminder Juergen Beisert
[not found] ` <1379946998-23041-10-git-send-email-jbe-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-10-01 11:14 ` Jonathan Cameron
[not found] ` <524AAEA8.4090106-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-10-01 11:21 ` Jonathan Cameron
[not found] ` <524AB04C.4070409-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-10-01 11:22 ` Jonathan Cameron
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).