diff options
| -rw-r--r-- | drivers/input/touchscreen/ti_am335x_tsc.c | 67 | ||||
| -rw-r--r-- | include/linux/mfd/ti_am335x_tscadc.h | 3 |
2 files changed, 33 insertions, 37 deletions
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index dfbb9fe6a270..0625c102a1d0 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c | |||
| @@ -173,11 +173,9 @@ static void titsc_step_config(struct titsc *ts_dev) | |||
| 173 | titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); | 173 | titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | /* Charge step configuration */ | 176 | /* Make CHARGECONFIG same as IDLECONFIG */ |
| 177 | config = ts_dev->bit_xp | ts_dev->bit_yn | | ||
| 178 | STEPCHARGE_RFP_XPUL | STEPCHARGE_RFM_XNUR | | ||
| 179 | STEPCHARGE_INM_AN1 | STEPCHARGE_INP(ts_dev->inp_yp); | ||
| 180 | 177 | ||
| 178 | config = titsc_readl(ts_dev, REG_IDLECONFIG); | ||
| 181 | titsc_writel(ts_dev, REG_CHARGECONFIG, config); | 179 | titsc_writel(ts_dev, REG_CHARGECONFIG, config); |
| 182 | titsc_writel(ts_dev, REG_CHARGEDELAY, CHARGEDLY_OPENDLY); | 180 | titsc_writel(ts_dev, REG_CHARGEDELAY, CHARGEDLY_OPENDLY); |
| 183 | 181 | ||
| @@ -261,12 +259,34 @@ static irqreturn_t titsc_irq(int irq, void *dev) | |||
| 261 | { | 259 | { |
| 262 | struct titsc *ts_dev = dev; | 260 | struct titsc *ts_dev = dev; |
| 263 | struct input_dev *input_dev = ts_dev->input; | 261 | struct input_dev *input_dev = ts_dev->input; |
| 264 | unsigned int status, irqclr = 0; | 262 | unsigned int fsm, status, irqclr = 0; |
| 265 | unsigned int x = 0, y = 0; | 263 | unsigned int x = 0, y = 0; |
| 266 | unsigned int z1, z2, z; | 264 | unsigned int z1, z2, z; |
| 267 | unsigned int fsm; | ||
| 268 | 265 | ||
| 269 | status = titsc_readl(ts_dev, REG_IRQSTATUS); | 266 | status = titsc_readl(ts_dev, REG_RAWIRQSTATUS); |
| 267 | if (status & IRQENB_HW_PEN) { | ||
| 268 | ts_dev->pen_down = true; | ||
| 269 | titsc_writel(ts_dev, REG_IRQWAKEUP, 0x00); | ||
| 270 | titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN); | ||
| 271 | irqclr |= IRQENB_HW_PEN; | ||
| 272 | } | ||
| 273 | |||
| 274 | if (status & IRQENB_PENUP) { | ||
| 275 | fsm = titsc_readl(ts_dev, REG_ADCFSM); | ||
| 276 | if (fsm == ADCFSM_STEPID) { | ||
| 277 | ts_dev->pen_down = false; | ||
| 278 | input_report_key(input_dev, BTN_TOUCH, 0); | ||
| 279 | input_report_abs(input_dev, ABS_PRESSURE, 0); | ||
| 280 | input_sync(input_dev); | ||
| 281 | } else { | ||
| 282 | ts_dev->pen_down = true; | ||
| 283 | } | ||
| 284 | irqclr |= IRQENB_PENUP; | ||
| 285 | } | ||
| 286 | |||
| 287 | if (status & IRQENB_EOS) | ||
| 288 | irqclr |= IRQENB_EOS; | ||
| 289 | |||
| 270 | /* | 290 | /* |
| 271 | * ADC and touchscreen share the IRQ line. | 291 | * ADC and touchscreen share the IRQ line. |
| 272 | * FIFO1 interrupts are used by ADC. Handle FIFO0 IRQs here only | 292 | * FIFO1 interrupts are used by ADC. Handle FIFO0 IRQs here only |
| @@ -297,37 +317,11 @@ static irqreturn_t titsc_irq(int irq, void *dev) | |||
| 297 | } | 317 | } |
| 298 | irqclr |= IRQENB_FIFO0THRES; | 318 | irqclr |= IRQENB_FIFO0THRES; |
| 299 | } | 319 | } |
| 300 | |||
| 301 | /* | ||
| 302 | * Time for sequencer to settle, to read | ||
| 303 | * correct state of the sequencer. | ||
| 304 | */ | ||
| 305 | udelay(SEQ_SETTLE); | ||
| 306 | |||
| 307 | status = titsc_readl(ts_dev, REG_RAWIRQSTATUS); | ||
| 308 | if (status & IRQENB_PENUP) { | ||
| 309 | /* Pen up event */ | ||
| 310 | fsm = titsc_readl(ts_dev, REG_ADCFSM); | ||
| 311 | if (fsm == ADCFSM_STEPID) { | ||
| 312 | ts_dev->pen_down = false; | ||
| 313 | input_report_key(input_dev, BTN_TOUCH, 0); | ||
| 314 | input_report_abs(input_dev, ABS_PRESSURE, 0); | ||
| 315 | input_sync(input_dev); | ||
| 316 | } else { | ||
| 317 | ts_dev->pen_down = true; | ||
| 318 | } | ||
| 319 | irqclr |= IRQENB_PENUP; | ||
| 320 | } | ||
| 321 | |||
| 322 | if (status & IRQENB_HW_PEN) { | ||
| 323 | |||
| 324 | titsc_writel(ts_dev, REG_IRQWAKEUP, 0x00); | ||
| 325 | titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN); | ||
| 326 | } | ||
| 327 | |||
| 328 | if (irqclr) { | 320 | if (irqclr) { |
| 329 | titsc_writel(ts_dev, REG_IRQSTATUS, irqclr); | 321 | titsc_writel(ts_dev, REG_IRQSTATUS, irqclr); |
| 330 | am335x_tsc_se_set_cache(ts_dev->mfd_tscadc, ts_dev->step_mask); | 322 | if (status & IRQENB_EOS) |
| 323 | am335x_tsc_se_set_cache(ts_dev->mfd_tscadc, | ||
| 324 | ts_dev->step_mask); | ||
| 331 | return IRQ_HANDLED; | 325 | return IRQ_HANDLED; |
| 332 | } | 326 | } |
| 333 | return IRQ_NONE; | 327 | return IRQ_NONE; |
| @@ -417,6 +411,7 @@ static int titsc_probe(struct platform_device *pdev) | |||
| 417 | } | 411 | } |
| 418 | 412 | ||
| 419 | titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES); | 413 | titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES); |
| 414 | titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_EOS); | ||
| 420 | err = titsc_config_wires(ts_dev); | 415 | err = titsc_config_wires(ts_dev); |
| 421 | if (err) { | 416 | if (err) { |
| 422 | dev_err(&pdev->dev, "wrong i/p wire configuration\n"); | 417 | dev_err(&pdev->dev, "wrong i/p wire configuration\n"); |
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h index e2e70053470e..3f4e994ace2b 100644 --- a/include/linux/mfd/ti_am335x_tscadc.h +++ b/include/linux/mfd/ti_am335x_tscadc.h | |||
| @@ -52,6 +52,7 @@ | |||
| 52 | 52 | ||
| 53 | /* IRQ enable */ | 53 | /* IRQ enable */ |
| 54 | #define IRQENB_HW_PEN BIT(0) | 54 | #define IRQENB_HW_PEN BIT(0) |
| 55 | #define IRQENB_EOS BIT(1) | ||
| 55 | #define IRQENB_FIFO0THRES BIT(2) | 56 | #define IRQENB_FIFO0THRES BIT(2) |
| 56 | #define IRQENB_FIFO0OVRRUN BIT(3) | 57 | #define IRQENB_FIFO0OVRRUN BIT(3) |
| 57 | #define IRQENB_FIFO0UNDRFLW BIT(4) | 58 | #define IRQENB_FIFO0UNDRFLW BIT(4) |
| @@ -107,7 +108,7 @@ | |||
| 107 | /* Charge delay */ | 108 | /* Charge delay */ |
| 108 | #define CHARGEDLY_OPEN_MASK (0x3FFFF << 0) | 109 | #define CHARGEDLY_OPEN_MASK (0x3FFFF << 0) |
| 109 | #define CHARGEDLY_OPEN(val) ((val) << 0) | 110 | #define CHARGEDLY_OPEN(val) ((val) << 0) |
| 110 | #define CHARGEDLY_OPENDLY CHARGEDLY_OPEN(1) | 111 | #define CHARGEDLY_OPENDLY CHARGEDLY_OPEN(0x400) |
| 111 | 112 | ||
| 112 | /* Control register */ | 113 | /* Control register */ |
| 113 | #define CNTRLREG_TSCSSENB BIT(0) | 114 | #define CNTRLREG_TSCSSENB BIT(0) |
