Lines Matching full:ts

65 static int imagis_i2c_read_reg(struct imagis_ts *ts,  in imagis_i2c_read_reg()  argument
72 .addr = ts->client->addr, in imagis_i2c_read_reg()
77 .addr = ts->client->addr, in imagis_i2c_read_reg()
88 ret = i2c_transfer(ts->client->adapter, msg, ARRAY_SIZE(msg)); in imagis_i2c_read_reg()
95 dev_err(&ts->client->dev, in imagis_i2c_read_reg()
105 struct imagis_ts *ts = dev_id; in imagis_interrupt() local
111 error = imagis_i2c_read_reg(ts, ts->tdata->interrupt_msg_cmd, &intr_message); in imagis_interrupt()
113 dev_err(&ts->client->dev, in imagis_interrupt()
120 dev_err(&ts->client->dev, in imagis_interrupt()
129 if (ts->tdata->protocol_b) in imagis_interrupt()
130 error = imagis_i2c_read_reg(ts, in imagis_interrupt()
131 ts->tdata->touch_coord_cmd + (i * 4), in imagis_interrupt()
134 error = imagis_i2c_read_reg(ts, in imagis_interrupt()
135 ts->tdata->touch_coord_cmd, &finger_status); in imagis_interrupt()
137 dev_err(&ts->client->dev, in imagis_interrupt()
143 input_mt_slot(ts->input_dev, i); in imagis_interrupt()
144 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, in imagis_interrupt()
146 touchscreen_report_pos(ts->input_dev, &ts->prop, in imagis_interrupt()
150 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, in imagis_interrupt()
156 for (int i = 0; i < ts->num_keycodes; i++) in imagis_interrupt()
157 input_report_key(ts->input_dev, ts->keycodes[i], in imagis_interrupt()
160 input_mt_sync_frame(ts->input_dev); in imagis_interrupt()
161 input_sync(ts->input_dev); in imagis_interrupt()
169 struct imagis_ts *ts = _ts; in imagis_power_off() local
171 regulator_bulk_disable(ARRAY_SIZE(ts->supplies), ts->supplies); in imagis_power_off()
174 static int imagis_power_on(struct imagis_ts *ts) in imagis_power_on() argument
178 error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies); in imagis_power_on()
187 static int imagis_start(struct imagis_ts *ts) in imagis_start() argument
191 error = imagis_power_on(ts); in imagis_start()
195 enable_irq(ts->client->irq); in imagis_start()
200 static int imagis_stop(struct imagis_ts *ts) in imagis_stop() argument
202 disable_irq(ts->client->irq); in imagis_stop()
204 imagis_power_off(ts); in imagis_stop()
211 struct imagis_ts *ts = input_get_drvdata(dev); in imagis_input_open() local
213 return imagis_start(ts); in imagis_input_open()
218 struct imagis_ts *ts = input_get_drvdata(dev); in imagis_input_close() local
220 imagis_stop(ts); in imagis_input_close()
223 static int imagis_init_input_dev(struct imagis_ts *ts) in imagis_init_input_dev() argument
228 input_dev = devm_input_allocate_device(&ts->client->dev); in imagis_init_input_dev()
232 ts->input_dev = input_dev; in imagis_init_input_dev()
235 input_dev->phys = "input/ts"; in imagis_init_input_dev()
240 input_set_drvdata(input_dev, ts); in imagis_init_input_dev()
245 if (ts->tdata->touch_keys_supported) { in imagis_init_input_dev()
246 ts->num_keycodes = of_property_read_variable_u32_array( in imagis_init_input_dev()
247 ts->client->dev.of_node, "linux,keycodes", in imagis_init_input_dev()
248 ts->keycodes, 0, ARRAY_SIZE(ts->keycodes)); in imagis_init_input_dev()
249 if (ts->num_keycodes <= 0) { in imagis_init_input_dev()
250 ts->keycodes[0] = KEY_APPSELECT; in imagis_init_input_dev()
251 ts->keycodes[1] = KEY_BACK; in imagis_init_input_dev()
252 ts->num_keycodes = 2; in imagis_init_input_dev()
255 input_dev->keycodemax = ts->num_keycodes; in imagis_init_input_dev()
256 input_dev->keycodesize = sizeof(ts->keycodes[0]); in imagis_init_input_dev()
257 input_dev->keycode = ts->keycodes; in imagis_init_input_dev()
260 for (int i = 0; i < ts->num_keycodes; i++) in imagis_init_input_dev()
261 input_set_capability(input_dev, EV_KEY, ts->keycodes[i]); in imagis_init_input_dev()
263 touchscreen_parse_properties(input_dev, true, &ts->prop); in imagis_init_input_dev()
264 if (!ts->prop.max_x || !ts->prop.max_y) { in imagis_init_input_dev()
265 dev_err(&ts->client->dev, in imagis_init_input_dev()
274 dev_err(&ts->client->dev, in imagis_init_input_dev()
281 dev_err(&ts->client->dev, in imagis_init_input_dev()
289 static int imagis_init_regulators(struct imagis_ts *ts) in imagis_init_regulators() argument
291 struct i2c_client *client = ts->client; in imagis_init_regulators()
293 ts->supplies[0].supply = "vdd"; in imagis_init_regulators()
294 ts->supplies[1].supply = "vddio"; in imagis_init_regulators()
296 ARRAY_SIZE(ts->supplies), in imagis_init_regulators()
297 ts->supplies); in imagis_init_regulators()
303 struct imagis_ts *ts; in imagis_probe() local
306 ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); in imagis_probe()
307 if (!ts) in imagis_probe()
310 ts->client = i2c; in imagis_probe()
312 ts->tdata = device_get_match_data(dev); in imagis_probe()
313 if (!ts->tdata) { in imagis_probe()
318 error = imagis_init_regulators(ts); in imagis_probe()
324 error = imagis_power_on(ts); in imagis_probe()
330 error = devm_add_action_or_reset(dev, imagis_power_off, ts); in imagis_probe()
336 error = imagis_i2c_read_reg(ts, ts->tdata->whoami_cmd, &chip_id); in imagis_probe()
342 if (chip_id != ts->tdata->whoami_val) { in imagis_probe()
350 "imagis-touchscreen", ts); in imagis_probe()
357 error = imagis_init_input_dev(ts); in imagis_probe()
367 struct imagis_ts *ts = i2c_get_clientdata(client); in imagis_suspend() local
370 mutex_lock(&ts->input_dev->mutex); in imagis_suspend()
372 if (input_device_enabled(ts->input_dev)) in imagis_suspend()
373 retval = imagis_stop(ts); in imagis_suspend()
375 mutex_unlock(&ts->input_dev->mutex); in imagis_suspend()
383 struct imagis_ts *ts = i2c_get_clientdata(client); in imagis_resume() local
386 mutex_lock(&ts->input_dev->mutex); in imagis_resume()
388 if (input_device_enabled(ts->input_dev)) in imagis_resume()
389 retval = imagis_start(ts); in imagis_resume()
391 mutex_unlock(&ts->input_dev->mutex); in imagis_resume()