Lines Matching refs:ts
66 static int himax_read_config(struct himax_ts_data *ts, u32 address, u32 *dst) in himax_read_config() argument
70 error = regmap_write(ts->regmap, HIMAX_REG_CFG_SET_ADDR, address); in himax_read_config()
74 error = regmap_write(ts->regmap, HIMAX_REG_CFG_INIT_READ, 0x0); in himax_read_config()
78 error = regmap_read(ts->regmap, HIMAX_REG_CFG_READ_VALUE, dst); in himax_read_config()
85 static void himax_reset(struct himax_ts_data *ts) in himax_reset() argument
87 gpiod_set_value_cansleep(ts->gpiod_rst, 1); in himax_reset()
91 gpiod_set_value_cansleep(ts->gpiod_rst, 0); in himax_reset()
100 static int himax_read_product_id(struct himax_ts_data *ts, u32 *product_id) in himax_read_product_id() argument
104 error = himax_read_config(ts, HIMAX_CFG_PRODUCT_ID, product_id); in himax_read_product_id()
112 static int himax_check_product_id(struct himax_ts_data *ts) in himax_check_product_id() argument
117 error = himax_read_product_id(ts, &product_id); in himax_check_product_id()
121 dev_dbg(&ts->client->dev, "Product id: %x\n", product_id); in himax_check_product_id()
128 dev_err(&ts->client->dev, in himax_check_product_id()
134 static int himax_input_register(struct himax_ts_data *ts) in himax_input_register() argument
138 ts->input_dev = devm_input_allocate_device(&ts->client->dev); in himax_input_register()
139 if (!ts->input_dev) { in himax_input_register()
140 dev_err(&ts->client->dev, "Failed to allocate input device\n"); in himax_input_register()
144 ts->input_dev->name = "Himax Touchscreen"; in himax_input_register()
146 input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_X); in himax_input_register()
147 input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_Y); in himax_input_register()
148 input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 200, 0, 0); in himax_input_register()
149 input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 200, 0, 0); in himax_input_register()
151 touchscreen_parse_properties(ts->input_dev, true, &ts->props); in himax_input_register()
153 error = input_mt_init_slots(ts->input_dev, HIMAX_MAX_POINTS, in himax_input_register()
156 dev_err(&ts->client->dev, in himax_input_register()
161 error = input_register_device(ts->input_dev); in himax_input_register()
163 dev_err(&ts->client->dev, in himax_input_register()
179 static bool himax_process_event_point(struct himax_ts_data *ts, in himax_process_event_point() argument
191 input_mt_slot(ts->input_dev, point_index); in himax_process_event_point()
192 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); in himax_process_event_point()
193 touchscreen_report_pos(ts->input_dev, &ts->props, x, y, true); in himax_process_event_point()
194 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w); in himax_process_event_point()
195 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w); in himax_process_event_point()
199 static void himax_process_event(struct himax_ts_data *ts, in himax_process_event() argument
206 if (himax_process_event_point(ts, event, i)) in himax_process_event()
210 input_mt_sync_frame(ts->input_dev); in himax_process_event()
211 input_sync(ts->input_dev); in himax_process_event()
214 static bool himax_verify_checksum(struct himax_ts_data *ts, in himax_verify_checksum() argument
225 dev_err(&ts->client->dev, "Wrong event checksum: %04x\n", in himax_verify_checksum()
233 static int himax_handle_input(struct himax_ts_data *ts) in himax_handle_input() argument
238 error = regmap_raw_read(ts->regmap, HIMAX_REG_READ_EVENT, &event, in himax_handle_input()
241 dev_err(&ts->client->dev, "Failed to read input event: %d\n", in himax_handle_input()
250 if (himax_verify_checksum(ts, &event)) in himax_handle_input()
251 himax_process_event(ts, &event); in himax_handle_input()
259 struct himax_ts_data *ts = dev_id; in himax_irq_handler() local
261 error = himax_handle_input(ts); in himax_irq_handler()
272 struct himax_ts_data *ts; in himax_probe() local
279 ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); in himax_probe()
280 if (!ts) in himax_probe()
283 i2c_set_clientdata(client, ts); in himax_probe()
284 ts->client = client; in himax_probe()
286 ts->regmap = devm_regmap_init_i2c(client, &himax_regmap_config); in himax_probe()
287 error = PTR_ERR_OR_ZERO(ts->regmap); in himax_probe()
293 ts->gpiod_rst = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in himax_probe()
294 error = PTR_ERR_OR_ZERO(ts->gpiod_rst); in himax_probe()
300 himax_reset(ts); in himax_probe()
302 error = himax_check_product_id(ts); in himax_probe()
306 error = himax_input_register(ts); in himax_probe()
312 client->name, ts); in himax_probe()
321 struct himax_ts_data *ts = dev_get_drvdata(dev); in himax_suspend() local
323 disable_irq(ts->client->irq); in himax_suspend()
329 struct himax_ts_data *ts = dev_get_drvdata(dev); in himax_resume() local
331 enable_irq(ts->client->irq); in himax_resume()