Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable

2013-07-04 Thread Sekhar Nori
On 7/4/2013 7:20 PM, Sebastian Andrzej Siewior wrote:
> On 07/04/2013 03:39 PM, Sekhar Nori wrote:
>> Yes, I noticed that after sending the mail. To me it does not make sense
>> to make changes to accept something as platform data only to remove
>> platform data itself later.
> 
> The patches were made earlier and it was easier that way to take
> everything and simple remove the platform part later.

Okay, then. If the maintainers do not have objection, I am fine too!

Regards,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable

2013-07-04 Thread Sebastian Andrzej Siewior
On 07/04/2013 03:39 PM, Sekhar Nori wrote:
> Yes, I noticed that after sending the mail. To me it does not make sense
> to make changes to accept something as platform data only to remove
> platform data itself later.

The patches were made earlier and it was easier that way to take
everything and simple remove the platform part later.

> May be reorder the series to move this to after platform data removal -
> that way any platform data related changes in the patch will have to go
> away.
> 
> Thanks,
> Sekhar

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable

2013-07-04 Thread Sekhar Nori
On 7/4/2013 5:03 PM, Sebastian Andrzej Siewior wrote:
> On 07/04/2013 01:14 PM, Sekhar Nori wrote:
>>
>> On 6/11/2013 5:00 PM, Sebastian Andrzej Siewior wrote:
>>> From: "Patil, Rachna" 
>>>
>>> The current driver expected touchscreen input
>>> wires(XP,XN,YP,YN) to be connected in a particular order.
>>> Making changes to accept this as platform data
>>
>> The platform data part of this driver will never get used since it is
>> used on DT-only platforms (and future platforms will all be DT-only).
>> You should get rid of it as it will save you some code.
> 
> If you follow the series you will notice that the platform bits are
> removed later. Should I have overlooked something please say so.

Yes, I noticed that after sending the mail. To me it does not make sense
to make changes to accept something as platform data only to remove
platform data itself later.

May be reorder the series to move this to after platform data removal -
that way any platform data related changes in the patch will have to go
away.

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable

2013-07-04 Thread Sebastian Andrzej Siewior
On 07/04/2013 01:14 PM, Sekhar Nori wrote:
> 
> On 6/11/2013 5:00 PM, Sebastian Andrzej Siewior wrote:
>> From: "Patil, Rachna" 
>>
>> The current driver expected touchscreen input
>> wires(XP,XN,YP,YN) to be connected in a particular order.
>> Making changes to accept this as platform data
> 
> The platform data part of this driver will never get used since it is
> used on DT-only platforms (and future platforms will all be DT-only).
> You should get rid of it as it will save you some code.

If you follow the series you will notice that the platform bits are
removed later. Should I have overlooked something please say so.

> 
> Thanks,
> Sekhar
> 

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable

2013-07-04 Thread Sekhar Nori

On 6/11/2013 5:00 PM, Sebastian Andrzej Siewior wrote:
> From: "Patil, Rachna" 
> 
> The current driver expected touchscreen input
> wires(XP,XN,YP,YN) to be connected in a particular order.
> Making changes to accept this as platform data

The platform data part of this driver will never get used since it is
used on DT-only platforms (and future platforms will all be DT-only).
You should get rid of it as it will save you some code.

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable

2013-06-11 Thread Sebastian Andrzej Siewior
On 06/11/2013 04:23 PM, Samuel Ortiz wrote:
> Hi Sebastian,

Hi Samuel,

> On Tue, Jun 11, 2013 at 01:30:50PM +0200, Sebastian Andrzej Siewior wrote:
>> diff --git a/include/linux/mfd/ti_am335x_tscadc.h 
>> b/include/linux/mfd/ti_am335x_tscadc.h
>> index eeead15..2d78af8 100644
>> --- a/include/linux/mfd/ti_am335x_tscadc.h
>> +++ b/include/linux/mfd/ti_am335x_tscadc.h
>> @@ -116,6 +113,13 @@
>>  #define CNTRLREG_8WIRE  CNTRLREG_AFE_CTRL(3)
>>  #define CNTRLREG_TSCENB BIT(7)
>>  
>> +#define XPP STEPCONFIG_XPP
>> +#define XNP STEPCONFIG_XNP
>> +#define XNN STEPCONFIG_XNN
>> +#define YPP STEPCONFIG_YPP
>> +#define YPN STEPCONFIG_YPN
>> +#define YNN STEPCONFIG_YNN
> What is that for ? Isn't STEPCONFIG_XPP explicit enough ?

Yeah :P It was added by the original author of the patch, I have no
problem getting rid of it.

> 
> Cheers,
> Samuel.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable

2013-06-11 Thread Samuel Ortiz
Hi Sebastian,

On Tue, Jun 11, 2013 at 01:30:50PM +0200, Sebastian Andrzej Siewior wrote:
> diff --git a/include/linux/mfd/ti_am335x_tscadc.h 
> b/include/linux/mfd/ti_am335x_tscadc.h
> index eeead15..2d78af8 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -71,8 +71,6 @@
>  #define STEPCONFIG_INM_ADCREFM   STEPCONFIG_INM(8)
>  #define STEPCONFIG_INP_MASK  (0xF << 19)
>  #define STEPCONFIG_INP(val)  ((val) << 19)
> -#define STEPCONFIG_INP_AN2   STEPCONFIG_INP(2)
> -#define STEPCONFIG_INP_AN3   STEPCONFIG_INP(3)
>  #define STEPCONFIG_INP_AN4   STEPCONFIG_INP(4)
>  #define STEPCONFIG_INP_ADCREFM   STEPCONFIG_INP(8)
>  #define STEPCONFIG_FIFO1 BIT(26)
> @@ -94,7 +92,6 @@
>  #define STEPCHARGE_INM_AN1   STEPCHARGE_INM(1)
>  #define STEPCHARGE_INP_MASK  (0xF << 19)
>  #define STEPCHARGE_INP(val)  ((val) << 19)
> -#define STEPCHARGE_INP_AN1   STEPCHARGE_INP(1)
>  #define STEPCHARGE_RFM_MASK  (3 << 23)
>  #define STEPCHARGE_RFM(val)  ((val) << 23)
>  #define STEPCHARGE_RFM_XNUR  STEPCHARGE_RFM(1)
> @@ -116,6 +113,13 @@
>  #define CNTRLREG_8WIRE   CNTRLREG_AFE_CTRL(3)
>  #define CNTRLREG_TSCENB  BIT(7)
>  
> +#define XPP  STEPCONFIG_XPP
> +#define XNP  STEPCONFIG_XNP
> +#define XNN  STEPCONFIG_XNN
> +#define YPP  STEPCONFIG_YPP
> +#define YPN  STEPCONFIG_YPN
> +#define YNN  STEPCONFIG_YNN
What is that for ? Isn't STEPCONFIG_XPP explicit enough ?

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/22] input/ti_am33x_tsc: Order of TSC wires, made configurable

2013-06-11 Thread Sebastian Andrzej Siewior
From: "Patil, Rachna" 

The current driver expected touchscreen input
wires(XP,XN,YP,YN) to be connected in a particular order.
Making changes to accept this as platform data.

Signed-off-by: Patil, Rachna 
Signed-off-by: Felipe Balbi 
[bigeasy: larger rework of the patch, no config[4][4] array, smaller
  sized config_inp, no regbit_map(), shrinked
  titsc_config_wires(), no config redo on resume, config_inp and
  friends are now u32]
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/input/touchscreen/ti_am335x_tsc.c |  102 -
 include/linux/input/ti_am335x_tsc.h   |   12 
 include/linux/mfd/ti_am335x_tscadc.h  |   10 ++-
 3 files changed, 105 insertions(+), 19 deletions(-)

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c 
b/drivers/input/touchscreen/ti_am335x_tsc.c
index 23d6a4d..56c6220 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -33,6 +33,13 @@
 #define SEQ_SETTLE 275
 #define MAX_12BIT  ((1 << 12) - 1)
 
+static const int config_pins[] = {
+   XPP,
+   XNN,
+   YPP,
+   YNN,
+};
+
 struct titsc {
struct input_dev*input;
struct ti_tscadc_dev*mfd_tscadc;
@@ -41,6 +48,9 @@ struct titsc {
unsigned intx_plate_resistance;
boolpen_down;
int steps_to_configure;
+   u32 config_inp[4];
+   u32 bit_xp, bit_xn, bit_yp, bit_yn;
+   u32 inp_xp, inp_xn, inp_yp, inp_yn;
 };
 
 static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
@@ -54,6 +64,58 @@ 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 intconfig;
@@ -64,18 +126,18 @@ static void titsc_step_config(struct titsc *ts_dev)
total_steps = 2 * ts_dev->steps_to_configure;
 
config = STEPCONFIG_MODE_HWSYNC |
-   STEPCONFIG_AVG_16 | STEPCONFIG_XPP;
+   STEPCONFIG_AVG_16 | ts_dev->bit_xp;
switch (ts_dev->wires) {
case 4:
-   config |= STEPCONFIG_INP_AN2 | STEPCONFIG_XNN;
+   config |= STEPCONFIG_INP(ts_dev->inp_yp) | ts_dev->bit_xn;
break;
case 5:
-   config |= STEPCONFIG_YNN |
-   STEPCONFIG_INP_AN4 | STEPCONFIG_XNN |
-   STEPCONFIG_YPP;
+   config |= ts_dev->bit_yn |
+   STEPCONFIG_INP_AN4 | ts_dev->bit_xn |
+   ts_dev->bit_yp;
break;
case 8:
-   config |= STEPCONFIG_INP_AN2 | STEPCONFIG_XNN;
+   config |= STEPCONFIG_INP(ts_dev->inp_yp) | ts_dev->bit_xn;
break;
}
 
@@ -86,18 +148,18 @@ static void titsc_step_config(struct titsc *ts_dev)
 
config = 0;
config = STEPCONFIG_MODE_HWSYNC |
-   STEPCONFIG_AVG_16 | STEPCONFIG_YNN |
+   STEPCONFIG_AVG_16 | ts_dev->bit_yn |
STEPCONFIG_INM_ADCREFM | ST