Lines Matching +full:tp +full:- +full:sensitive +full:- +full:adjust
4 * Copyright (C) 2013 - 2014 Hans de Goede <hdegoede@redhat.com>
21 * The sun4i-ts controller is capable of detecting a second touch, but when a
27 * open / close movement, and then reports emulated multi-touch events around
28 * the last touch coordinate (as the dual-touch coordinates are worthless).
34 * s.a. A20 User Manual "1.15 TP" (Documentation/arm/sunxi/README)
131 x = readl(ts->base + TP_DATA); in sun4i_ts_irq_handle_input()
132 y = readl(ts->base + TP_DATA); in sun4i_ts_irq_handle_input()
134 if (!ts->ignore_fifo_data) { in sun4i_ts_irq_handle_input()
135 input_report_abs(ts->input, ABS_X, x); in sun4i_ts_irq_handle_input()
136 input_report_abs(ts->input, ABS_Y, y); in sun4i_ts_irq_handle_input()
142 input_report_key(ts->input, BTN_TOUCH, 1); in sun4i_ts_irq_handle_input()
143 input_sync(ts->input); in sun4i_ts_irq_handle_input()
145 ts->ignore_fifo_data = false; in sun4i_ts_irq_handle_input()
150 ts->ignore_fifo_data = true; in sun4i_ts_irq_handle_input()
151 input_report_key(ts->input, BTN_TOUCH, 0); in sun4i_ts_irq_handle_input()
152 input_sync(ts->input); in sun4i_ts_irq_handle_input()
161 reg_val = readl(ts->base + TP_INT_FIFOS); in sun4i_ts_irq()
164 ts->temp_data = readl(ts->base + TEMP_DATA); in sun4i_ts_irq()
166 if (ts->input) in sun4i_ts_irq()
169 writel(reg_val, ts->base + TP_INT_FIFOS); in sun4i_ts_irq()
180 TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC); in sun4i_ts_open()
190 writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); in sun4i_ts_close()
196 if (ts->temp_data == -1) in sun4i_get_temp()
197 return -EAGAIN; in sun4i_get_temp()
199 *temp = ts->temp_data * ts->temp_step - ts->temp_offset; in sun4i_get_temp()
246 struct device *dev = &pdev->dev; in sun4i_ts_probe()
247 struct device_node *np = dev->of_node; in sun4i_ts_probe()
258 return -ENOMEM; in sun4i_ts_probe()
260 ts->dev = dev; in sun4i_ts_probe()
261 ts->ignore_fifo_data = true; in sun4i_ts_probe()
262 ts->temp_data = -1; in sun4i_ts_probe()
263 if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts")) { in sun4i_ts_probe()
264 /* Allwinner SDK has temperature (C) = (value / 6) - 271 */ in sun4i_ts_probe()
265 ts->temp_offset = 271000; in sun4i_ts_probe()
266 ts->temp_step = 167; in sun4i_ts_probe()
267 } else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) { in sun4i_ts_probe()
272 * temp_step from 0.096 - 0.170 and temp_offset from 176 - 331. in sun4i_ts_probe()
274 ts->temp_offset = 257000; in sun4i_ts_probe()
275 ts->temp_step = 133; in sun4i_ts_probe()
280 * which is designed by X-Powers, an affiliate of Allwinner: in sun4i_ts_probe()
282 * temperature (C) = (value * 0.1) - 144.7 in sun4i_ts_probe()
288 ts->temp_offset = 144700; in sun4i_ts_probe()
289 ts->temp_step = 100; in sun4i_ts_probe()
292 ts_attached = of_property_read_bool(np, "allwinner,ts-attached"); in sun4i_ts_probe()
294 ts->input = devm_input_allocate_device(dev); in sun4i_ts_probe()
295 if (!ts->input) in sun4i_ts_probe()
296 return -ENOMEM; in sun4i_ts_probe()
298 ts->input->name = pdev->name; in sun4i_ts_probe()
299 ts->input->phys = "sun4i_ts/input0"; in sun4i_ts_probe()
300 ts->input->open = sun4i_ts_open; in sun4i_ts_probe()
301 ts->input->close = sun4i_ts_close; in sun4i_ts_probe()
302 ts->input->id.bustype = BUS_HOST; in sun4i_ts_probe()
303 ts->input->id.vendor = 0x0001; in sun4i_ts_probe()
304 ts->input->id.product = 0x0001; in sun4i_ts_probe()
305 ts->input->id.version = 0x0100; in sun4i_ts_probe()
306 ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); in sun4i_ts_probe()
307 __set_bit(BTN_TOUCH, ts->input->keybit); in sun4i_ts_probe()
308 input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); in sun4i_ts_probe()
309 input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); in sun4i_ts_probe()
310 input_set_drvdata(ts->input, ts); in sun4i_ts_probe()
313 ts->base = devm_ioremap_resource(dev, in sun4i_ts_probe()
315 if (IS_ERR(ts->base)) in sun4i_ts_probe()
316 return PTR_ERR(ts->base); in sun4i_ts_probe()
318 ts->irq = platform_get_irq(pdev, 0); in sun4i_ts_probe()
319 error = devm_request_irq(dev, ts->irq, sun4i_ts_irq, 0, "sun4i-ts", ts); in sun4i_ts_probe()
328 ts->base + TP_CTRL0); in sun4i_ts_probe()
334 of_property_read_u32(np, "allwinner,tp-sensitive-adjust", in sun4i_ts_probe()
337 ts->base + TP_CTRL2); in sun4i_ts_probe()
343 of_property_read_u32(np, "allwinner,filter-type", &filter_type); in sun4i_ts_probe()
344 writel(FILTER_EN(1) | FILTER_TYPE(filter_type), ts->base + TP_CTRL3); in sun4i_ts_probe()
347 writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR); in sun4i_ts_probe()
351 * finally enable tp mode. in sun4i_ts_probe()
354 if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts")) in sun4i_ts_probe()
358 writel(reg, ts->base + TP_CTRL1); in sun4i_ts_probe()
361 * The thermal core does not register hwmon devices for DT-based in sun4i_ts_probe()
364 hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts", in sun4i_ts_probe()
369 thermal = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, in sun4i_ts_probe()
374 writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); in sun4i_ts_probe()
377 error = input_register_device(ts->input); in sun4i_ts_probe()
379 writel(0, ts->base + TP_INT_FIFOC); in sun4i_ts_probe()
393 if (ts->input) in sun4i_ts_remove()
394 input_unregister_device(ts->input); in sun4i_ts_remove()
397 writel(0, ts->base + TP_INT_FIFOC); in sun4i_ts_remove()
403 { .compatible = "allwinner,sun4i-a10-ts", },
404 { .compatible = "allwinner,sun5i-a13-ts", },
405 { .compatible = "allwinner,sun6i-a31-ts", },
412 .name = "sun4i-ts",