Lines Matching refs:w90p910_ts
49 struct w90p910_ts { struct
59 static void w90p910_report_event(struct w90p910_ts *w90p910_ts, bool down) in w90p910_report_event() argument
61 struct input_dev *dev = w90p910_ts->input; in w90p910_report_event()
65 __raw_readl(w90p910_ts->ts_reg + 0x0c)); in w90p910_report_event()
67 __raw_readl(w90p910_ts->ts_reg + 0x10)); in w90p910_report_event()
74 static void w90p910_prepare_x_reading(struct w90p910_ts *w90p910_ts) in w90p910_prepare_x_reading() argument
78 __raw_writel(ADC_TSC_X, w90p910_ts->ts_reg + 0x04); in w90p910_prepare_x_reading()
79 ctlreg = __raw_readl(w90p910_ts->ts_reg); in w90p910_prepare_x_reading()
82 __raw_writel(ctlreg, w90p910_ts->ts_reg); in w90p910_prepare_x_reading()
84 w90p910_ts->state = TS_WAIT_X_COORD; in w90p910_prepare_x_reading()
87 static void w90p910_prepare_y_reading(struct w90p910_ts *w90p910_ts) in w90p910_prepare_y_reading() argument
91 __raw_writel(ADC_TSC_Y, w90p910_ts->ts_reg + 0x04); in w90p910_prepare_y_reading()
92 ctlreg = __raw_readl(w90p910_ts->ts_reg); in w90p910_prepare_y_reading()
95 __raw_writel(ctlreg, w90p910_ts->ts_reg); in w90p910_prepare_y_reading()
97 w90p910_ts->state = TS_WAIT_Y_COORD; in w90p910_prepare_y_reading()
100 static void w90p910_prepare_next_packet(struct w90p910_ts *w90p910_ts) in w90p910_prepare_next_packet() argument
104 ctlreg = __raw_readl(w90p910_ts->ts_reg); in w90p910_prepare_next_packet()
107 __raw_writel(ctlreg, w90p910_ts->ts_reg); in w90p910_prepare_next_packet()
109 w90p910_ts->state = TS_WAIT_NEW_PACKET; in w90p910_prepare_next_packet()
114 struct w90p910_ts *w90p910_ts = dev_id; in w90p910_ts_interrupt() local
117 spin_lock_irqsave(&w90p910_ts->lock, flags); in w90p910_ts_interrupt()
119 switch (w90p910_ts->state) { in w90p910_ts_interrupt()
125 del_timer(&w90p910_ts->timer); in w90p910_ts_interrupt()
126 w90p910_prepare_x_reading(w90p910_ts); in w90p910_ts_interrupt()
131 w90p910_prepare_y_reading(w90p910_ts); in w90p910_ts_interrupt()
135 w90p910_report_event(w90p910_ts, true); in w90p910_ts_interrupt()
136 w90p910_prepare_next_packet(w90p910_ts); in w90p910_ts_interrupt()
137 mod_timer(&w90p910_ts->timer, jiffies + msecs_to_jiffies(100)); in w90p910_ts_interrupt()
144 spin_unlock_irqrestore(&w90p910_ts->lock, flags); in w90p910_ts_interrupt()
151 struct w90p910_ts *w90p910_ts = (struct w90p910_ts *) data; in w90p910_check_pen_up() local
154 spin_lock_irqsave(&w90p910_ts->lock, flags); in w90p910_check_pen_up()
156 if (w90p910_ts->state == TS_WAIT_NEW_PACKET && in w90p910_check_pen_up()
157 !(__raw_readl(w90p910_ts->ts_reg + 0x04) & ADC_DOWN)) { in w90p910_check_pen_up()
159 w90p910_report_event(w90p910_ts, false); in w90p910_check_pen_up()
162 spin_unlock_irqrestore(&w90p910_ts->lock, flags); in w90p910_check_pen_up()
167 struct w90p910_ts *w90p910_ts = input_get_drvdata(dev); in w90p910_open() local
171 clk_enable(w90p910_ts->clk); in w90p910_open()
173 __raw_writel(ADC_RST1, w90p910_ts->ts_reg); in w90p910_open()
175 __raw_writel(ADC_RST0, w90p910_ts->ts_reg); in w90p910_open()
179 val = __raw_readl(w90p910_ts->ts_reg + 0x04); in w90p910_open()
180 __raw_writel(val & TSC_FOURWIRE, w90p910_ts->ts_reg + 0x04); in w90p910_open()
181 __raw_writel(ADC_DELAY, w90p910_ts->ts_reg + 0x08); in w90p910_open()
183 w90p910_ts->state = TS_WAIT_NEW_PACKET; in w90p910_open()
187 val = __raw_readl(w90p910_ts->ts_reg); in w90p910_open()
189 __raw_writel(val, w90p910_ts->ts_reg); in w90p910_open()
196 struct w90p910_ts *w90p910_ts = input_get_drvdata(dev); in w90p910_close() local
201 spin_lock_irq(&w90p910_ts->lock); in w90p910_close()
203 w90p910_ts->state = TS_IDLE; in w90p910_close()
205 val = __raw_readl(w90p910_ts->ts_reg); in w90p910_close()
207 __raw_writel(val, w90p910_ts->ts_reg); in w90p910_close()
209 spin_unlock_irq(&w90p910_ts->lock); in w90p910_close()
212 del_timer_sync(&w90p910_ts->timer); in w90p910_close()
215 clk_disable(w90p910_ts->clk); in w90p910_close()
220 struct w90p910_ts *w90p910_ts; in w90x900ts_probe() local
225 w90p910_ts = kzalloc(sizeof(struct w90p910_ts), GFP_KERNEL); in w90x900ts_probe()
227 if (!w90p910_ts || !input_dev) { in w90x900ts_probe()
232 w90p910_ts->input = input_dev; in w90x900ts_probe()
233 w90p910_ts->state = TS_IDLE; in w90x900ts_probe()
234 spin_lock_init(&w90p910_ts->lock); in w90x900ts_probe()
235 setup_timer(&w90p910_ts->timer, w90p910_check_pen_up, in w90x900ts_probe()
236 (unsigned long)w90p910_ts); in w90x900ts_probe()
250 w90p910_ts->ts_reg = ioremap(res->start, resource_size(res)); in w90x900ts_probe()
251 if (!w90p910_ts->ts_reg) { in w90x900ts_probe()
256 w90p910_ts->clk = clk_get(&pdev->dev, NULL); in w90x900ts_probe()
257 if (IS_ERR(w90p910_ts->clk)) { in w90x900ts_probe()
258 err = PTR_ERR(w90p910_ts->clk); in w90x900ts_probe()
278 input_set_drvdata(input_dev, w90p910_ts); in w90x900ts_probe()
280 w90p910_ts->irq_num = platform_get_irq(pdev, 0); in w90x900ts_probe()
281 if (request_irq(w90p910_ts->irq_num, w90p910_ts_interrupt, in w90x900ts_probe()
282 IRQF_DISABLED, "w90p910ts", w90p910_ts)) { in w90x900ts_probe()
287 err = input_register_device(w90p910_ts->input); in w90x900ts_probe()
291 platform_set_drvdata(pdev, w90p910_ts); in w90x900ts_probe()
295 fail5: free_irq(w90p910_ts->irq_num, w90p910_ts); in w90x900ts_probe()
296 fail4: clk_put(w90p910_ts->clk); in w90x900ts_probe()
297 fail3: iounmap(w90p910_ts->ts_reg); in w90x900ts_probe()
300 kfree(w90p910_ts); in w90x900ts_probe()
306 struct w90p910_ts *w90p910_ts = platform_get_drvdata(pdev); in w90x900ts_remove() local
309 free_irq(w90p910_ts->irq_num, w90p910_ts); in w90x900ts_remove()
310 del_timer_sync(&w90p910_ts->timer); in w90x900ts_remove()
311 iounmap(w90p910_ts->ts_reg); in w90x900ts_remove()
313 clk_put(w90p910_ts->clk); in w90x900ts_remove()
318 input_unregister_device(w90p910_ts->input); in w90x900ts_remove()
319 kfree(w90p910_ts); in w90x900ts_remove()