Lines Matching full:ts
64 int (*check_id)(struct himax_ts_data *ts);
65 int (*read_events)(struct himax_ts_data *ts, struct himax_event *event,
84 static int himax_bus_enable_burst(struct himax_ts_data *ts) in himax_bus_enable_burst() argument
88 error = regmap_write(ts->regmap, HIMAX_AHB_ADDR_CONTI, in himax_bus_enable_burst()
93 error = regmap_write(ts->regmap, HIMAX_AHB_ADDR_INCR4, in himax_bus_enable_burst()
101 static int himax_bus_read(struct himax_ts_data *ts, u32 address, void *dst, in himax_bus_read() argument
107 error = himax_bus_enable_burst(ts); in himax_bus_read()
112 error = regmap_write(ts->regmap, HIMAX_AHB_ADDR_BYTE_0, address); in himax_bus_read()
116 error = regmap_write(ts->regmap, HIMAX_AHB_ADDR_ACCESS_DIRECTION, in himax_bus_read()
122 error = regmap_noinc_read(ts->regmap, HIMAX_AHB_ADDR_RDATA_BYTE_0, in himax_bus_read()
125 error = regmap_read(ts->regmap, HIMAX_AHB_ADDR_RDATA_BYTE_0, in himax_bus_read()
133 static void himax_reset(struct himax_ts_data *ts) in himax_reset() argument
135 gpiod_set_value_cansleep(ts->gpiod_rst, 1); in himax_reset()
139 gpiod_set_value_cansleep(ts->gpiod_rst, 0); in himax_reset()
148 static int himax_read_product_id(struct himax_ts_data *ts, u32 *product_id) in himax_read_product_id() argument
152 error = himax_bus_read(ts, HIMAX_REG_ADDR_ICID, product_id, in himax_read_product_id()
161 static int himax_check_product_id(struct himax_ts_data *ts) in himax_check_product_id() argument
166 error = himax_read_product_id(ts, &product_id); in himax_check_product_id()
170 dev_dbg(&ts->client->dev, "Product id: %x\n", product_id); in himax_check_product_id()
172 if (product_id == ts->chip->id) in himax_check_product_id()
175 dev_err(&ts->client->dev, "Unknown product id: %x\n", in himax_check_product_id()
180 static int himax_input_register(struct himax_ts_data *ts) in himax_input_register() argument
184 ts->input_dev = devm_input_allocate_device(&ts->client->dev); in himax_input_register()
185 if (!ts->input_dev) { in himax_input_register()
186 dev_err(&ts->client->dev, "Failed to allocate input device\n"); in himax_input_register()
190 ts->input_dev->name = "Himax Touchscreen"; in himax_input_register()
192 input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_X); in himax_input_register()
193 input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_Y); in himax_input_register()
194 input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 200, 0, 0); in himax_input_register()
195 input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 200, 0, 0); in himax_input_register()
197 touchscreen_parse_properties(ts->input_dev, true, &ts->props); in himax_input_register()
199 error = input_mt_init_slots(ts->input_dev, HIMAX_MAX_POINTS, in himax_input_register()
202 dev_err(&ts->client->dev, in himax_input_register()
207 error = input_register_device(ts->input_dev); in himax_input_register()
209 dev_err(&ts->client->dev, in himax_input_register()
225 static bool himax_process_event_point(struct himax_ts_data *ts, in himax_process_event_point() argument
237 input_mt_slot(ts->input_dev, point_index); in himax_process_event_point()
238 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); in himax_process_event_point()
239 touchscreen_report_pos(ts->input_dev, &ts->props, x, y, true); in himax_process_event_point()
240 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w); in himax_process_event_point()
241 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w); in himax_process_event_point()
245 static void himax_process_event(struct himax_ts_data *ts, in himax_process_event() argument
252 if (himax_process_event_point(ts, event, i)) in himax_process_event()
256 input_mt_sync_frame(ts->input_dev); in himax_process_event()
257 input_sync(ts->input_dev); in himax_process_event()
260 static bool himax_verify_checksum(struct himax_ts_data *ts, in himax_verify_checksum() argument
271 dev_err(&ts->client->dev, "Wrong event checksum: %04x\n", in himax_verify_checksum()
279 static int himax_read_events(struct himax_ts_data *ts, in himax_read_events() argument
282 return regmap_raw_read(ts->regmap, HIMAX_AHB_ADDR_EVENT_STACK, event, in himax_read_events()
286 static int hx83100a_read_events(struct himax_ts_data *ts, in hx83100a_read_events() argument
289 return himax_bus_read(ts, HX83100A_REG_FW_EVENT_STACK, event, length); in hx83100a_read_events()
292 static int himax_handle_input(struct himax_ts_data *ts) in himax_handle_input() argument
297 error = ts->chip->read_events(ts, &event, sizeof(event)); in himax_handle_input()
299 dev_err(&ts->client->dev, "Failed to read input event: %d\n", in himax_handle_input()
308 if (himax_verify_checksum(ts, &event)) in himax_handle_input()
309 himax_process_event(ts, &event); in himax_handle_input()
317 struct himax_ts_data *ts = dev_id; in himax_irq_handler() local
319 error = himax_handle_input(ts); in himax_irq_handler()
330 struct himax_ts_data *ts; in himax_probe() local
337 ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); in himax_probe()
338 if (!ts) in himax_probe()
341 i2c_set_clientdata(client, ts); in himax_probe()
342 ts->client = client; in himax_probe()
343 ts->chip = i2c_get_match_data(client); in himax_probe()
345 ts->regmap = devm_regmap_init_i2c(client, &himax_regmap_config); in himax_probe()
346 error = PTR_ERR_OR_ZERO(ts->regmap); in himax_probe()
352 ts->gpiod_rst = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in himax_probe()
353 error = PTR_ERR_OR_ZERO(ts->gpiod_rst); in himax_probe()
359 himax_reset(ts); in himax_probe()
361 if (ts->chip->check_id) { in himax_probe()
362 error = himax_check_product_id(ts); in himax_probe()
367 error = himax_input_register(ts); in himax_probe()
373 client->name, ts); in himax_probe()
382 struct himax_ts_data *ts = dev_get_drvdata(dev); in himax_suspend() local
384 disable_irq(ts->client->irq); in himax_suspend()
390 struct himax_ts_data *ts = dev_get_drvdata(dev); in himax_resume() local
392 enable_irq(ts->client->irq); in himax_resume()
428 .name = "Himax-hx83112b-TS",