Lines Matching +full:debounce +full:- +full:ms
2 * Touchscreen driver for the TS-4800 board
4 * Copyright (c) 2015 - Savoir-faire Linux
21 /* polling interval in ms */
26 /* sensor values are 12-bit wide */
27 #define MAX_12BIT ((1 << 12) - 1)
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()
125 if (IS_ERR(ts->regmap)) { in ts4800_parse_dt()
127 return PTR_ERR(ts->regmap); in ts4800_parse_dt()
136 ts->reg = reg; in ts4800_parse_dt()
144 ts->bit = BIT(bit); in ts4800_parse_dt()
155 ts = devm_kzalloc(&pdev->dev, sizeof(*ts), GFP_KERNEL); in ts4800_ts_probe()
157 return -ENOMEM; in ts4800_ts_probe()
163 ts->base = devm_platform_ioremap_resource(pdev, 0); in ts4800_ts_probe()
164 if (IS_ERR(ts->base)) in ts4800_ts_probe()
165 return PTR_ERR(ts->base); in ts4800_ts_probe()
167 input_dev = devm_input_allocate_device(&pdev->dev); in ts4800_ts_probe()
169 return -ENOMEM; in ts4800_ts_probe()
171 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&pdev->dev)); in ts4800_ts_probe()
172 ts->input = input_dev; in ts4800_ts_probe()
173 ts->dev = &pdev->dev; in ts4800_ts_probe()
177 input_dev->name = "TS-4800 Touchscreen"; in ts4800_ts_probe()
178 input_dev->phys = ts->phys; in ts4800_ts_probe()
180 input_dev->open = ts4800_ts_open; in ts4800_ts_probe()
181 input_dev->close = ts4800_ts_close; in ts4800_ts_probe()
189 dev_err(&pdev->dev, "Unable to set up polling: %d\n", error); in ts4800_ts_probe()
197 dev_err(&pdev->dev, in ts4800_ts_probe()
206 { .compatible = "technologic,ts4800-ts", },
213 .name = "ts4800-ts",
221 MODULE_DESCRIPTION("TS-4800 Touchscreen Driver");