Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344937
b: refs/heads/master
c: d1fb574
h: refs/heads/master
i:
  344935: 387a63d
v: v3
  • Loading branch information
Patil, Rachna authored and Samuel Ortiz committed Nov 5, 2012
1 parent d302243 commit b56f356
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 33f5cc605d28bd82be8a728090063203947158f3
refs/heads/master: d1fb57435c108b8dd66d7f47b4c60c1798dcae4c
25 changes: 13 additions & 12 deletions trunk/drivers/input/touchscreen/ti_tscadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
#define REG_CHARGEDELAY 0x060
#define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8))
#define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8))
#define REG_STEPCONFIG13 0x0C4
#define REG_STEPDELAY13 0x0C8
#define REG_STEPCONFIG14 0x0CC
#define REG_STEPDELAY14 0x0D0
#define REG_FIFO0CNT 0xE4
#define REG_FIFO1THR 0xF4
#define REG_FIFO0 0x100
Expand Down Expand Up @@ -134,6 +130,7 @@ struct tscadc {
unsigned int wires;
unsigned int x_plate_resistance;
bool pen_down;
int steps_to_configure;
};

static unsigned int tscadc_readl(struct tscadc *ts, unsigned int reg)
Expand All @@ -150,9 +147,10 @@ static void tscadc_writel(struct tscadc *tsc, unsigned int reg,
static void tscadc_step_config(struct tscadc *ts_dev)
{
unsigned int config;
int i;
int i, total_steps;

/* Configure the Step registers */
total_steps = 2 * ts_dev->steps_to_configure;

config = STEPCONFIG_MODE_HWSYNC |
STEPCONFIG_AVG_16 | STEPCONFIG_XPP;
Expand All @@ -170,7 +168,7 @@ static void tscadc_step_config(struct tscadc *ts_dev)
break;
}

for (i = 1; i < 7; i++) {
for (i = 1; i <= ts_dev->steps_to_configure; i++) {
tscadc_writel(ts_dev, REG_STEPCONFIG(i), config);
tscadc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY);
}
Expand All @@ -192,7 +190,7 @@ static void tscadc_step_config(struct tscadc *ts_dev)
break;
}

for (i = 7; i < 13; i++) {
for (i = (ts_dev->steps_to_configure + 1); i <= total_steps; i++) {
tscadc_writel(ts_dev, REG_STEPCONFIG(i), config);
tscadc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY);
}
Expand All @@ -211,12 +209,14 @@ static void tscadc_step_config(struct tscadc *ts_dev)
config = STEPCONFIG_MODE_HWSYNC |
STEPCONFIG_AVG_16 | STEPCONFIG_YPP |
STEPCONFIG_XNN | STEPCONFIG_INM_ADCREFM;
tscadc_writel(ts_dev, REG_STEPCONFIG13, config);
tscadc_writel(ts_dev, REG_STEPDELAY13, STEPCONFIG_OPENDLY);
tscadc_writel(ts_dev, REG_STEPCONFIG(total_steps + 1), config);
tscadc_writel(ts_dev, REG_STEPDELAY(total_steps + 1),
STEPCONFIG_OPENDLY);

config |= STEPCONFIG_INP_AN3 | STEPCONFIG_FIFO1;
tscadc_writel(ts_dev, REG_STEPCONFIG14, config);
tscadc_writel(ts_dev, REG_STEPDELAY14, STEPCONFIG_OPENDLY);
tscadc_writel(ts_dev, REG_STEPCONFIG(total_steps + 2), config);
tscadc_writel(ts_dev, REG_STEPDELAY(total_steps + 2),
STEPCONFIG_OPENDLY);

tscadc_writel(ts_dev, REG_SE, STPENB_STEPENB);
}
Expand Down Expand Up @@ -379,6 +379,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
ts_dev->irq = irq;
ts_dev->wires = pdata->wires;
ts_dev->x_plate_resistance = pdata->x_plate_resistance;
ts_dev->steps_to_configure = pdata->steps_to_configure;

res = request_mem_region(res->start, resource_size(res), pdev->name);
if (!res) {
Expand Down Expand Up @@ -447,7 +448,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev)
tscadc_idle_config(ts_dev);
tscadc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO1THRES);
tscadc_step_config(ts_dev);
tscadc_writel(ts_dev, REG_FIFO1THR, 6);
tscadc_writel(ts_dev, REG_FIFO1THR, ts_dev->steps_to_configure);

ctrl |= CNTRLREG_TSCSSENB;
tscadc_writel(ts_dev, REG_CTRL, ctrl);
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/input/ti_tscadc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
* i.e. 4/5/8 wire touchscreen support
* on the platform.
* @x_plate_resistance: X plate resistance.
* @steps_to_configure: The sequencer supports a total of
* 16 programmable steps.
* A step configured to read a single
* co-ordinate value, can be applied
* more number of times for better results.
*/

struct tsc_data {
int wires;
int x_plate_resistance;
int steps_to_configure;
};

#endif

0 comments on commit b56f356

Please sign in to comment.