Lines Matching +full:input +full:- +full:debounce

2  * Touchscreen driver for the TS-4800 board
4 * Copyright (c) 2015 - Savoir-faire Linux
12 #include <linux/input.h>
26 /* sensor values are 12-bit wide */
27 #define MAX_12BIT ((1 << 12) - 1)
35 struct input_dev *input; member
45 int debounce; member
53 ts->pendown = false; in ts4800_ts_open()
54 ts->debounce = DEBOUNCE_COUNT; in ts4800_ts_open()
56 error = regmap_update_bits(ts->regmap, ts->reg, ts->bit, ts->bit); in ts4800_ts_open()
58 dev_warn(ts->dev, "Failed to enable touchscreen: %d\n", error); in ts4800_ts_open()
70 ret = regmap_update_bits(ts->regmap, ts->reg, ts->bit, 0); in ts4800_ts_close()
72 dev_warn(ts->dev, "Failed to disable touchscreen\n"); in ts4800_ts_close()
79 u16 last_x = readw(ts->base + X_OFFSET); in ts4800_ts_poll()
80 u16 last_y = readw(ts->base + Y_OFFSET); in ts4800_ts_poll()
84 if (ts->debounce) { in ts4800_ts_poll()
85 ts->debounce--; in ts4800_ts_poll()
89 if (!ts->pendown) { in ts4800_ts_poll()
91 ts->pendown = true; in ts4800_ts_poll()
100 } else if (ts->pendown) { in ts4800_ts_poll()
101 ts->pendown = false; in ts4800_ts_poll()
102 ts->debounce = DEBOUNCE_COUNT; in ts4800_ts_poll()
111 struct device *dev = &pdev->dev; in ts4800_parse_dt()
112 struct device_node *np = dev->of_node; in ts4800_parse_dt()
120 return -ENODEV; in ts4800_parse_dt()
123 ts->regmap = syscon_node_to_regmap(syscon_np); in ts4800_parse_dt()
124 if (IS_ERR(ts->regmap)) { in ts4800_parse_dt()
126 return PTR_ERR(ts->regmap); in ts4800_parse_dt()
135 ts->reg = reg; in ts4800_parse_dt()
143 ts->bit = BIT(bit); in ts4800_parse_dt()
154 ts = devm_kzalloc(&pdev->dev, sizeof(*ts), GFP_KERNEL); in ts4800_ts_probe()
156 return -ENOMEM; in ts4800_ts_probe()
162 ts->base = devm_platform_ioremap_resource(pdev, 0); in ts4800_ts_probe()
163 if (IS_ERR(ts->base)) in ts4800_ts_probe()
164 return PTR_ERR(ts->base); in ts4800_ts_probe()
166 input_dev = devm_input_allocate_device(&pdev->dev); in ts4800_ts_probe()
168 return -ENOMEM; in ts4800_ts_probe()
170 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&pdev->dev)); in ts4800_ts_probe()
171 ts->input = input_dev; in ts4800_ts_probe()
172 ts->dev = &pdev->dev; in ts4800_ts_probe()
176 input_dev->name = "TS-4800 Touchscreen"; in ts4800_ts_probe()
177 input_dev->phys = ts->phys; in ts4800_ts_probe()
179 input_dev->open = ts4800_ts_open; in ts4800_ts_probe()
180 input_dev->close = ts4800_ts_close; in ts4800_ts_probe()
188 dev_err(&pdev->dev, "Unable to set up polling: %d\n", error); in ts4800_ts_probe()
196 dev_err(&pdev->dev, in ts4800_ts_probe()
197 "Unable to register input device: %d\n", error); in ts4800_ts_probe()
205 { .compatible = "technologic,ts4800-ts", },
212 .name = "ts4800-ts",
220 MODULE_DESCRIPTION("TS-4800 Touchscreen Driver");