Lines Matching +full:event +full:- +full:touch

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
20 #define MC13783_TS_NAME "mc13783-ts"
38 struct mc13xxx_ts_platform_data *touch; member
45 mc13xxx_irq_ack(priv->mc13xxx, irq); in mc13783_ts_handler()
53 schedule_delayed_work(&priv->work, 0); in mc13783_ts_handler()
69 struct input_dev *idev = priv->idev; in mc13783_ts_report_sample()
74 * the values are 10-bit wide only, but the two least significant in mc13783_ts_report_sample()
77 x0 = priv->sample[0] & 0xfff; in mc13783_ts_report_sample()
78 x1 = priv->sample[1] & 0xfff; in mc13783_ts_report_sample()
79 x2 = priv->sample[2] & 0xfff; in mc13783_ts_report_sample()
80 y0 = priv->sample[3] & 0xfff; in mc13783_ts_report_sample()
81 y1 = (priv->sample[0] >> 12) & 0xfff; in mc13783_ts_report_sample()
82 y2 = (priv->sample[1] >> 12) & 0xfff; in mc13783_ts_report_sample()
83 cr0 = (priv->sample[2] >> 12) & 0xfff; in mc13783_ts_report_sample()
84 cr1 = (priv->sample[3] >> 12) & 0xfff; in mc13783_ts_report_sample()
86 dev_dbg(&idev->dev, in mc13783_ts_report_sample()
96 (x2 - x0 < sample_tolerance && in mc13783_ts_report_sample()
97 y2 - y0 < sample_tolerance)) { in mc13783_ts_report_sample()
103 dev_dbg(&idev->dev, "report (%d, %d, %d)\n", in mc13783_ts_report_sample()
104 x1, y1, 0x1000 - cr0); in mc13783_ts_report_sample()
105 schedule_delayed_work(&priv->work, HZ / 50); in mc13783_ts_report_sample()
107 dev_dbg(&idev->dev, "report release\n"); in mc13783_ts_report_sample()
111 cr0 ? 0x1000 - cr0 : cr0); in mc13783_ts_report_sample()
115 dev_dbg(&idev->dev, "discard event\n"); in mc13783_ts_report_sample()
126 if (mc13xxx_adc_do_conversion(priv->mc13xxx, in mc13783_ts_work()
128 priv->touch->ato, priv->touch->atox, in mc13783_ts_work()
129 priv->sample) == 0) in mc13783_ts_work()
138 mc13xxx_lock(priv->mc13xxx); in mc13783_ts_open()
140 mc13xxx_irq_ack(priv->mc13xxx, MC13XXX_IRQ_TS); in mc13783_ts_open()
142 ret = mc13xxx_irq_request(priv->mc13xxx, MC13XXX_IRQ_TS, in mc13783_ts_open()
147 ret = mc13xxx_reg_rmw(priv->mc13xxx, MC13XXX_ADC0, in mc13783_ts_open()
150 mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_TS, priv); in mc13783_ts_open()
152 mc13xxx_unlock(priv->mc13xxx); in mc13783_ts_open()
160 mc13xxx_lock(priv->mc13xxx); in mc13783_ts_close()
161 mc13xxx_reg_rmw(priv->mc13xxx, MC13XXX_ADC0, in mc13783_ts_close()
163 mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_TS, priv); in mc13783_ts_close()
164 mc13xxx_unlock(priv->mc13xxx); in mc13783_ts_close()
166 cancel_delayed_work_sync(&priv->work); in mc13783_ts_close()
173 int ret = -ENOMEM; in mc13783_ts_probe()
180 INIT_DELAYED_WORK(&priv->work, mc13783_ts_work); in mc13783_ts_probe()
181 priv->mc13xxx = dev_get_drvdata(pdev->dev.parent); in mc13783_ts_probe()
182 priv->idev = idev; in mc13783_ts_probe()
183 priv->touch = dev_get_platdata(&pdev->dev); in mc13783_ts_probe()
184 if (!priv->touch) { in mc13783_ts_probe()
185 dev_err(&pdev->dev, "missing platform data\n"); in mc13783_ts_probe()
186 ret = -ENODEV; in mc13783_ts_probe()
190 idev->name = MC13783_TS_NAME; in mc13783_ts_probe()
191 idev->dev.parent = &pdev->dev; in mc13783_ts_probe()
193 idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in mc13783_ts_probe()
194 idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); in mc13783_ts_probe()
199 idev->open = mc13783_ts_open; in mc13783_ts_probe()
200 idev->close = mc13783_ts_close; in mc13783_ts_probe()
204 ret = input_register_device(priv->idev); in mc13783_ts_probe()
206 dev_err(&pdev->dev, in mc13783_ts_probe()
224 input_unregister_device(priv->idev); in mc13783_ts_remove()