X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Finput%2Ftouchscreen%2Fcorgi_ts.c;h=a22576779acdc3c7e79c4148ca3cf89c358e0261;hb=29591b92e19f409d5ad4c099c2b7b5ea56f50dfa;hp=d2f9759cd3ed12ed1dbeff4d4c30fbab37145b6e;hpb=a8c4c20dfa8b28a3c99e33c639d9c2ea5657741e;p=linux-2.6-omap-h63xx.git diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c index d2f9759cd3e..a22576779ac 100644 --- a/drivers/input/touchscreen/corgi_ts.c +++ b/drivers/input/touchscreen/corgi_ts.c @@ -17,11 +17,12 @@ #include #include #include -//#include +#include #include #include #include +#include #define PWR_MODE_ACTIVE 0 @@ -74,10 +75,10 @@ extern unsigned int get_clk_frequency_khz(int info); static unsigned long calc_waittime(struct corgi_ts *corgi_ts) { - unsigned long hsync_len = corgi_ts->machinfo->get_hsync_len(); + unsigned long hsync_invperiod = corgi_ts->machinfo->get_hsync_invperiod(); - if (hsync_len) - return get_clk_frequency_khz(0)*1000/hsync_len; + if (hsync_invperiod) + return get_clk_frequency_khz(0)*1000/hsync_invperiod; else return 0; } @@ -114,7 +115,7 @@ static int sync_receive_data_send_cmd(struct corgi_ts *corgi_ts, int doRecive, i if (timer2-timer1 > wait_time) { /* too slow - timeout, try again */ corgi_ts->machinfo->wait_hsync(); - /* get OSCR */ + /* get CCNT */ CCNT(timer1); /* Wait after HSync */ CCNT(timer2); @@ -173,30 +174,31 @@ static int read_xydata(struct corgi_ts *corgi_ts) return 1; } -static void new_data(struct corgi_ts *corgi_ts, struct pt_regs *regs) +static void new_data(struct corgi_ts *corgi_ts) { + struct input_dev *dev = corgi_ts->input; + if (corgi_ts->power_mode != PWR_MODE_ACTIVE) return; if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0) return; - input_regs(corgi_ts->input, regs); - input_report_abs(corgi_ts->input, ABS_X, corgi_ts->tc.x); - input_report_abs(corgi_ts->input, ABS_Y, corgi_ts->tc.y); - input_report_abs(corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure); - input_report_key(corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0)); - input_sync(corgi_ts->input); + input_report_abs(dev, ABS_X, corgi_ts->tc.x); + input_report_abs(dev, ABS_Y, corgi_ts->tc.y); + input_report_abs(dev, ABS_PRESSURE, corgi_ts->tc.pressure); + input_report_key(dev, BTN_TOUCH, corgi_ts->pendown); + input_sync(dev); } -static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_regs *regs) +static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer) { if ((GPLR(IRQ_TO_GPIO(corgi_ts->irq_gpio)) & GPIO_bit(IRQ_TO_GPIO(corgi_ts->irq_gpio))) == 0) { /* Disable Interrupt */ set_irq_type(corgi_ts->irq_gpio, IRQT_NOEDGE); if (read_xydata(corgi_ts)) { corgi_ts->pendown = 1; - new_data(corgi_ts, regs); + new_data(corgi_ts); } mod_timer(&corgi_ts->timer, jiffies + HZ / 100); } else { @@ -208,7 +210,7 @@ static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_ if (corgi_ts->pendown) { corgi_ts->tc.pressure = 0; - new_data(corgi_ts, regs); + new_data(corgi_ts); } /* Enable Falling Edge */ @@ -220,13 +222,15 @@ static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_ static void corgi_ts_timer(unsigned long data) { struct corgi_ts *corgits_data = (struct corgi_ts *) data; - ts_interrupt_main(corgits_data, 1, NULL); + + ts_interrupt_main(corgits_data, 1); } -static irqreturn_t ts_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t ts_interrupt(int irq, void *dev_id) { struct corgi_ts *corgits_data = dev_id; - ts_interrupt_main(corgits_data, 0, regs); + + ts_interrupt_main(corgits_data, 0); return IRQ_HANDLED; } @@ -238,7 +242,7 @@ static int corgits_suspend(struct platform_device *dev, pm_message_t state) if (corgi_ts->pendown) { del_timer_sync(&corgi_ts->timer); corgi_ts->tc.pressure = 0; - new_data(corgi_ts, NULL); + new_data(corgi_ts); corgi_ts->pendown = 0; } corgi_ts->power_mode = PWR_MODE_SUSPEND; @@ -273,7 +277,7 @@ static int __init corgits_probe(struct platform_device *pdev) corgi_ts = kzalloc(sizeof(struct corgi_ts), GFP_KERNEL); input_dev = input_allocate_device(); if (!corgi_ts || !input_dev) - goto fail; + goto fail1; platform_set_drvdata(pdev, corgi_ts); @@ -282,7 +286,7 @@ static int __init corgits_probe(struct platform_device *pdev) if (corgi_ts->irq_gpio < 0) { err = -ENODEV; - goto fail; + goto fail1; } corgi_ts->input = input_dev; @@ -297,11 +301,10 @@ static int __init corgits_probe(struct platform_device *pdev) input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0002; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &pdev->dev; - input_dev->private = corgi_ts; + input_dev->dev.parent = &pdev->dev; - input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); + input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0); input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0); input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0); @@ -320,10 +323,12 @@ static int __init corgits_probe(struct platform_device *pdev) if (request_irq(corgi_ts->irq_gpio, ts_interrupt, IRQF_DISABLED, "ts", corgi_ts)) { err = -EBUSY; - goto fail; + goto fail1; } - input_register_device(corgi_ts->input); + err = input_register_device(corgi_ts->input); + if (err) + goto fail2; corgi_ts->power_mode = PWR_MODE_ACTIVE; @@ -332,17 +337,17 @@ static int __init corgits_probe(struct platform_device *pdev) return 0; - fail: input_free_device(input_dev); + fail2: free_irq(corgi_ts->irq_gpio, corgi_ts); + fail1: input_free_device(input_dev); kfree(corgi_ts); return err; - } static int corgits_remove(struct platform_device *pdev) { struct corgi_ts *corgi_ts = platform_get_drvdata(pdev); - free_irq(corgi_ts->irq_gpio, NULL); + free_irq(corgi_ts->irq_gpio, corgi_ts); del_timer_sync(&corgi_ts->timer); corgi_ts->machinfo->put_hsync(); input_unregister_device(corgi_ts->input);