* [PATCH 2/3] input: ti_am335x_tsc: Remove DT wire-config parameter
2014-09-04 14:39 [PATCH 1/3] Input: ti_am335x_tsc: Fix incorrect step config 5 wire touschscreen Sebastian Andrzej Siewior
@ 2014-09-04 14:39 ` Sebastian Andrzej Siewior
2014-09-04 14:39 ` [PATCH 3/3] ARM: DTS: AM335x: Drop TSC's wire-config parameters Sebastian Andrzej Siewior
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2014-09-04 14:39 UTC (permalink / raw)
To: linux-input
Cc: Dmitry Torokhov, Felipe Balbi, linux-omap, Jeff Lance,
Benoît Cousson, Tony Lindgren, Sebastian Andrzej Siewior
From: Jeff Lance <j-lance1@ti.com>
With the touschscreen in am335x, you do not have the option to mux the
analog input lines. You must connect the analog input to the corresponding
touchscreen terminal.
This patch removes the code that is parsing the ti,wire-config and uses
the "default" parameters instead.
In short,
inp_xp => STEPCONFIG_INP(0)
inp_xn => STEPCONFIG_INP(1)
inp_yp => STEPCONFIG_INP(2)
inp_yn => STEPCONFIG_INP(3)
bit_xp => STEPCONFIG_XPP
bit_xn => STEPCONFIG_XNN
bit_yp => STEPCONFIG_YPP
bit_yn => STEPCONFIG_YNN
Cc: "Benoît Cousson" <bcousson@baylibre.com>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jeff Lance <j-lance1@ti.com>
[bigeasy: refresh, drop AIN defines.]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/input/touchscreen/ti_am335x_tsc.c | 109 +++++-------------------------
1 file changed, 16 insertions(+), 93 deletions(-)
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 092fa8b31c67..92fb473621b0 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -33,13 +33,6 @@
#define SEQ_SETTLE 275
#define MAX_12BIT ((1 << 12) - 1)
-static const int config_pins[] = {
- STEPCONFIG_XPP,
- STEPCONFIG_XNN,
- STEPCONFIG_YPP,
- STEPCONFIG_YNN,
-};
-
struct titsc {
struct input_dev *input;
struct ti_tscadc_dev *mfd_tscadc;
@@ -48,9 +41,6 @@ struct titsc {
unsigned int x_plate_resistance;
bool pen_down;
int coordinate_readouts;
- u32 config_inp[4];
- u32 bit_xp, bit_xn, bit_yp, bit_yn;
- u32 inp_xp, inp_xn, inp_yp, inp_yn;
u32 step_mask;
};
@@ -65,58 +55,6 @@ static void titsc_writel(struct titsc *tsc, unsigned int reg,
writel(val, tsc->mfd_tscadc->tscadc_base + reg);
}
-static int titsc_config_wires(struct titsc *ts_dev)
-{
- u32 analog_line[4];
- u32 wire_order[4];
- int i, bit_cfg;
-
- for (i = 0; i < 4; i++) {
- /*
- * Get the order in which TSC wires are attached
- * w.r.t. each of the analog input lines on the EVM.
- */
- analog_line[i] = (ts_dev->config_inp[i] & 0xF0) >> 4;
- wire_order[i] = ts_dev->config_inp[i] & 0x0F;
- if (WARN_ON(analog_line[i] > 7))
- return -EINVAL;
- if (WARN_ON(wire_order[i] > ARRAY_SIZE(config_pins)))
- return -EINVAL;
- }
-
- for (i = 0; i < 4; i++) {
- int an_line;
- int wi_order;
-
- an_line = analog_line[i];
- wi_order = wire_order[i];
- bit_cfg = config_pins[wi_order];
- if (bit_cfg == 0)
- return -EINVAL;
- switch (wi_order) {
- case 0:
- ts_dev->bit_xp = bit_cfg;
- ts_dev->inp_xp = an_line;
- break;
-
- case 1:
- ts_dev->bit_xn = bit_cfg;
- ts_dev->inp_xn = an_line;
- break;
-
- case 2:
- ts_dev->bit_yp = bit_cfg;
- ts_dev->inp_yp = an_line;
- break;
- case 3:
- ts_dev->bit_yn = bit_cfg;
- ts_dev->inp_yn = an_line;
- break;
- }
- }
- return 0;
-}
-
static void titsc_step_config(struct titsc *ts_dev)
{
unsigned int config;
@@ -124,19 +62,17 @@ static void titsc_step_config(struct titsc *ts_dev)
int end_step;
u32 stepenable;
- config = STEPCONFIG_MODE_HWSYNC |
- STEPCONFIG_AVG_16 | ts_dev->bit_xp;
+ config = STEPCONFIG_MODE_HWSYNC | STEPCONFIG_AVG_16 | STEPCONFIG_XPP;
switch (ts_dev->wires) {
case 4:
- config |= STEPCONFIG_INP(ts_dev->inp_yp) | ts_dev->bit_xn;
+ config |= STEPCONFIG_INP(2) | STEPCONFIG_XNN;
break;
case 5:
- config |= ts_dev->bit_yn |
- STEPCONFIG_INP_AN4 | ts_dev->bit_xn |
- ts_dev->bit_yp;
+ config |= STEPCONFIG_YNN | STEPCONFIG_INP_AN4 | STEPCONFIG_XNN |
+ STEPCONFIG_YPP;
break;
case 8:
- config |= STEPCONFIG_INP(ts_dev->inp_yp) | ts_dev->bit_xn;
+ config |= STEPCONFIG_INP(2) | STEPCONFIG_XNN;
break;
}
@@ -147,20 +83,18 @@ static void titsc_step_config(struct titsc *ts_dev)
titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY);
}
- config = 0;
- config = STEPCONFIG_MODE_HWSYNC |
- STEPCONFIG_AVG_16 | ts_dev->bit_yn |
+ config = STEPCONFIG_MODE_HWSYNC | STEPCONFIG_AVG_16 | STEPCONFIG_YNN |
STEPCONFIG_INM_ADCREFM;
switch (ts_dev->wires) {
case 4:
- config |= ts_dev->bit_yp | STEPCONFIG_INP(ts_dev->inp_xp);
+ config |= STEPCONFIG_YPP | STEPCONFIG_INP(0);
break;
case 5:
- config |= ts_dev->bit_xp | STEPCONFIG_INP_AN4 |
+ config |= STEPCONFIG_XPP | STEPCONFIG_INP_AN4 |
STEPCONFIG_XNP | STEPCONFIG_YPN;
break;
case 8:
- config |= ts_dev->bit_yp | STEPCONFIG_INP(ts_dev->inp_xp);
+ config |= STEPCONFIG_YPP | STEPCONFIG_INP(0);
break;
}
@@ -172,24 +106,23 @@ static void titsc_step_config(struct titsc *ts_dev)
}
/* Charge step configuration */
- config = ts_dev->bit_xp | ts_dev->bit_yn |
- STEPCHARGE_RFP_XPUL | STEPCHARGE_RFM_XNUR |
- STEPCHARGE_INM_AN1 | STEPCHARGE_INP(ts_dev->inp_yp);
+ config = STEPCONFIG_XPP | STEPCONFIG_YNN | STEPCHARGE_RFP_XPUL |
+ STEPCHARGE_RFM_XNUR | STEPCHARGE_INM_AN1 | STEPCHARGE_INP(2);
titsc_writel(ts_dev, REG_CHARGECONFIG, config);
titsc_writel(ts_dev, REG_CHARGEDELAY, CHARGEDLY_OPENDLY);
/* coordinate_readouts * 2 … coordinate_readouts * 2 + 2 is for Z */
config = STEPCONFIG_MODE_HWSYNC |
- STEPCONFIG_AVG_16 | ts_dev->bit_yp |
- ts_dev->bit_xn | STEPCONFIG_INM_ADCREFM |
- STEPCONFIG_INP(ts_dev->inp_xp);
+ STEPCONFIG_AVG_16 | STEPCONFIG_YPP |
+ STEPCONFIG_XNN | STEPCONFIG_INM_ADCREFM |
+ STEPCONFIG_INP(0);
titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
titsc_writel(ts_dev, REG_STEPDELAY(end_step),
STEPCONFIG_OPENDLY);
end_step++;
- config |= STEPCONFIG_INP(ts_dev->inp_yn);
+ config |= STEPCONFIG_INP(3);
titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config);
titsc_writel(ts_dev, REG_STEPDELAY(end_step),
STEPCONFIG_OPENDLY);
@@ -364,12 +297,7 @@ static int titsc_parse_dt(struct platform_device *pdev,
err = of_property_read_u32(node, "ti,coordiante-readouts",
&ts_dev->coordinate_readouts);
}
-
- if (err < 0)
- return err;
-
- return of_property_read_u32_array(node, "ti,wire-config",
- ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp));
+ return err;
}
/*
@@ -411,11 +339,6 @@ static int titsc_probe(struct platform_device *pdev)
}
titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES);
- err = titsc_config_wires(ts_dev);
- if (err) {
- dev_err(&pdev->dev, "wrong i/p wire configuration\n");
- goto err_free_irq;
- }
titsc_step_config(ts_dev);
titsc_writel(ts_dev, REG_FIFO0THR,
ts_dev->coordinate_readouts * 2 + 2 - 1);
--
2.1.0
--
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 related [flat|nested] 3+ messages in thread
* [PATCH 3/3] ARM: DTS: AM335x: Drop TSC's wire-config parameters
2014-09-04 14:39 [PATCH 1/3] Input: ti_am335x_tsc: Fix incorrect step config 5 wire touschscreen Sebastian Andrzej Siewior
2014-09-04 14:39 ` [PATCH 2/3] input: ti_am335x_tsc: Remove DT wire-config parameter Sebastian Andrzej Siewior
@ 2014-09-04 14:39 ` Sebastian Andrzej Siewior
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2014-09-04 14:39 UTC (permalink / raw)
To: linux-input
Cc: Dmitry Torokhov, Felipe Balbi, linux-omap, Jeff Lance,
Benoît Cousson, Tony Lindgren, devicetree,
Sebastian Andrzej Siewior
From: Jeff Lance <j-lance1@ti.com>
The TSC driver is beeing updated, the parameter is not used anymore. The
AIN lines can not be muxed. All boards use the same value.
This patch updates the Documentation and dts files.
Cc: "Benoît Cousson" <bcousson@baylibre.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Jeff Lance <j-lance1@ti.com>
[bigeasy: split, add .dts files to the removal]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
.../devicetree/bindings/input/touchscreen/ti-tsc-adc.txt | 10 ----------
arch/arm/boot/dts/am335x-evm.dts | 1 -
arch/arm/boot/dts/am335x-evmsk.dts | 1 -
arch/arm/boot/dts/am335x-pepper.dts | 1 -
4 files changed, 13 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
index 878549ba814d..eeaf065563c9 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
@@ -15,15 +15,6 @@
Y and 2 for Z (always). This utilises 12
of the 16 software steps available. The
remaining 4 can be used by the ADC.
- ti,wire-config: Different boards could have a different order for
- connecting wires on touchscreen. We need to provide an
- 8 bit number where in the 1st four bits represent the
- analog lines and the next 4 bits represent positive/
- negative terminal on that input line. Notations to
- represent the input lines and terminals resoectively
- is as follows:
- AIN0 = 0, AIN1 = 1 and so on till AIN7 = 7.
- XP = 0, XN = 1, YP = 2, YN = 3.
- child "adc"
ti,adc-channels: List of analog inputs available for ADC.
AIN0 = 0, AIN1 = 1 and so on till AIN7 = 7.
@@ -35,7 +26,6 @@
ti,wires = <4>;
ti,x-plate-resistance = <200>;
ti,coordiante-readouts = <5>;
- ti,wire-config = <0x00 0x11 0x22 0x33>;
};
adc {
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index e2156a583de7..4c0a5eab5ef2 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -640,7 +640,6 @@
ti,wires = <4>;
ti,x-plate-resistance = <200>;
ti,coordinate-readouts = <5>;
- ti,wire-config = <0x00 0x11 0x22 0x33>;
};
adc {
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index df5fee6b6b4b..88d83b25089a 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -671,7 +671,6 @@
ti,wires = <4>;
ti,x-plate-resistance = <200>;
ti,coordinate-readouts = <5>;
- ti,wire-config = <0x00 0x11 0x22 0x33>;
};
};
diff --git a/arch/arm/boot/dts/am335x-pepper.dts b/arch/arm/boot/dts/am335x-pepper.dts
index 0d35ab64641c..0939ded7eea5 100644
--- a/arch/arm/boot/dts/am335x-pepper.dts
+++ b/arch/arm/boot/dts/am335x-pepper.dts
@@ -502,7 +502,6 @@
ti,wires = <4>;
ti,x-plate-resistance = <200>;
ti,coordinate-readouts = <5>;
- ti,wire-config = <0x00 0x11 0x22 0x33>;
};
adc {
--
2.1.0
--
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 related [flat|nested] 3+ messages in thread