Lines Matching +full:pen +full:- +full:up
1 // SPDX-License-Identifier: GPL-2.0-only
60 struct spi_device *spi = ts_data->spi; in surface3_spi_read()
62 memset(ts_data->rd_buf, 0, sizeof(ts_data->rd_buf)); in surface3_spi_read()
63 return spi_read(spi, ts_data->rd_buf, sizeof(ts_data->rd_buf)); in surface3_spi_read()
69 int st = finger->status & 0x01; in surface3_spi_report_touch()
72 slot = input_mt_get_slot_by_key(ts_data->input_dev, in surface3_spi_report_touch()
73 get_unaligned_le16(&finger->tracking_id)); in surface3_spi_report_touch()
77 input_mt_slot(ts_data->input_dev, slot); in surface3_spi_report_touch()
78 input_mt_report_slot_state(ts_data->input_dev, MT_TOOL_FINGER, st); in surface3_spi_report_touch()
80 input_report_abs(ts_data->input_dev, in surface3_spi_report_touch()
82 get_unaligned_le16(&finger->x)); in surface3_spi_report_touch()
83 input_report_abs(ts_data->input_dev, in surface3_spi_report_touch()
85 get_unaligned_le16(&finger->y)); in surface3_spi_report_touch()
86 input_report_abs(ts_data->input_dev, in surface3_spi_report_touch()
88 get_unaligned_le16(&finger->width)); in surface3_spi_report_touch()
89 input_report_abs(ts_data->input_dev, in surface3_spi_report_touch()
91 get_unaligned_le16(&finger->height)); in surface3_spi_report_touch()
107 * - touch present: 0xe7 in surface3_spi_process_touch()
108 * - touch released: 0xe4 in surface3_spi_process_touch()
109 * - nothing valuable: 0xff in surface3_spi_process_touch()
111 if (finger->status & 0x10) in surface3_spi_process_touch()
117 input_mt_sync_frame(ts_data->input_dev); in surface3_spi_process_touch()
118 input_sync(ts_data->input_dev); in surface3_spi_process_touch()
122 struct surface3_ts_data_pen *pen) in surface3_spi_report_pen() argument
124 struct input_dev *dev = ts_data->pen_input_dev; in surface3_spi_report_pen()
125 int st = pen->status; in surface3_spi_report_pen()
131 if (ts_data->pen_tool != tool) { in surface3_spi_report_pen()
132 input_report_key(dev, ts_data->pen_tool, 0); in surface3_spi_report_pen()
134 ts_data->pen_tool = tool; in surface3_spi_report_pen()
139 input_report_key(dev, ts_data->pen_tool, prox); in surface3_spi_report_pen()
148 get_unaligned_le16(&pen->x)); in surface3_spi_report_pen()
151 get_unaligned_le16(&pen->y)); in surface3_spi_report_pen()
154 get_unaligned_le16(&pen->pressure)); in surface3_spi_report_pen()
160 struct surface3_ts_data_pen *pen; in surface3_spi_process_pen() local
162 pen = (struct surface3_ts_data_pen *)&data[15]; in surface3_spi_process_pen()
164 surface3_spi_report_pen(ts_data, pen); in surface3_spi_process_pen()
165 input_sync(ts_data->pen_input_dev); in surface3_spi_process_pen()
173 u8 *data = ts_data->rd_buf; in surface3_spi_process()
176 dev_err(&ts_data->spi->dev, in surface3_spi_process()
188 dev_err(&ts_data->spi->dev, in surface3_spi_process()
202 dev_dbg(&data->spi->dev, "%s received -> %*ph\n", in surface3_spi_irq_handler()
203 __func__, SURFACE3_PACKET_SIZE, data->rd_buf); in surface3_spi_irq_handler()
211 gpiod_set_value(data->gpiod_rst[0], on); in surface3_spi_power()
212 gpiod_set_value(data->gpiod_rst[1], on); in surface3_spi_power()
218 * surface3_spi_get_gpio_config - Get GPIO config from ACPI/DT
228 dev = &data->spi->dev; in surface3_spi_get_gpio_config()
237 data->gpiod_rst[i] = gpiod; in surface3_spi_get_gpio_config()
248 input = devm_input_allocate_device(&data->spi->dev); in surface3_spi_create_touch_input()
250 return -ENOMEM; in surface3_spi_create_touch_input()
252 data->input_dev = input; in surface3_spi_create_touch_input()
262 input->name = "Surface3 SPI Capacitive TouchScreen"; in surface3_spi_create_touch_input()
263 input->phys = "input/ts"; in surface3_spi_create_touch_input()
264 input->id.bustype = BUS_SPI; in surface3_spi_create_touch_input()
265 input->id.vendor = 0x045e; /* Microsoft */ in surface3_spi_create_touch_input()
266 input->id.product = 0x0001; in surface3_spi_create_touch_input()
267 input->id.version = 0x0000; in surface3_spi_create_touch_input()
271 dev_err(&data->spi->dev, in surface3_spi_create_touch_input()
284 input = devm_input_allocate_device(&data->spi->dev); in surface3_spi_create_pen_input()
286 return -ENOMEM; in surface3_spi_create_pen_input()
288 data->pen_input_dev = input; in surface3_spi_create_pen_input()
289 data->pen_tool = BTN_TOOL_PEN; in surface3_spi_create_pen_input()
291 __set_bit(INPUT_PROP_DIRECT, input->propbit); in surface3_spi_create_pen_input()
292 __set_bit(INPUT_PROP_POINTER, input->propbit); in surface3_spi_create_pen_input()
303 input->name = "Surface3 SPI Pen Input"; in surface3_spi_create_pen_input()
304 input->phys = "input/ts"; in surface3_spi_create_pen_input()
305 input->id.bustype = BUS_SPI; in surface3_spi_create_pen_input()
306 input->id.vendor = 0x045e; /* Microsoft */ in surface3_spi_create_pen_input()
307 input->id.product = 0x0002; in surface3_spi_create_pen_input()
308 input->id.version = 0x0000; in surface3_spi_create_pen_input()
312 dev_err(&data->spi->dev, in surface3_spi_create_pen_input()
325 /* Set up SPI*/ in surface3_spi_probe()
326 spi->bits_per_word = 8; in surface3_spi_probe()
327 spi->mode = SPI_MODE_0; in surface3_spi_probe()
332 data = devm_kzalloc(&spi->dev, sizeof(*data), GFP_KERNEL); in surface3_spi_probe()
334 return -ENOMEM; in surface3_spi_probe()
336 data->spi = spi; in surface3_spi_probe()
355 error = devm_request_threaded_irq(&spi->dev, spi->irq, in surface3_spi_probe()
358 "Surface3-irq", data); in surface3_spi_probe()
370 disable_irq(data->spi->irq); in surface3_spi_suspend()
384 enable_irq(data->spi->irq); in surface3_spi_resume()
403 .name = "Surface3-spi",