Lines Matching refs:ts

64 static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg,  in st1232_ts_read_data()  argument
67 struct i2c_client *client = ts->client; in st1232_ts_read_data()
78 .buf = ts->read_buf, in st1232_ts_read_data()
90 static int st1232_ts_wait_ready(struct st1232_ts_data *ts) in st1232_ts_wait_ready() argument
96 error = st1232_ts_read_data(ts, REG_STATUS, 1); in st1232_ts_wait_ready()
98 switch (ts->read_buf[0]) { in st1232_ts_wait_ready()
111 static int st1232_ts_read_resolution(struct st1232_ts_data *ts, u16 *max_x, in st1232_ts_read_resolution() argument
118 error = st1232_ts_read_data(ts, REG_XY_RESOLUTION, 3); in st1232_ts_read_resolution()
122 buf = ts->read_buf; in st1232_ts_read_resolution()
130 static int st1232_ts_parse_and_report(struct st1232_ts_data *ts) in st1232_ts_parse_and_report() argument
132 struct input_dev *input = ts->input_dev; in st1232_ts_parse_and_report()
139 for (i = 0; i < ts->chip_info->max_fingers; i++) { in st1232_ts_parse_and_report()
140 u8 *buf = &ts->read_buf[i * 4]; in st1232_ts_parse_and_report()
147 &ts->prop, x, y); in st1232_ts_parse_and_report()
150 if (ts->chip_info->have_z) in st1232_ts_parse_and_report()
151 z[n_contacts] = ts->read_buf[i + 6]; in st1232_ts_parse_and_report()
163 if (ts->chip_info->have_z) in st1232_ts_parse_and_report()
175 struct st1232_ts_data *ts = dev_id; in st1232_ts_irq_handler() local
179 error = st1232_ts_read_data(ts, REG_XY_COORDINATES, ts->read_buf_len); in st1232_ts_irq_handler()
183 count = st1232_ts_parse_and_report(ts); in st1232_ts_irq_handler()
185 if (ts->low_latency_req.dev) { in st1232_ts_irq_handler()
186 dev_pm_qos_remove_request(&ts->low_latency_req); in st1232_ts_irq_handler()
187 ts->low_latency_req.dev = NULL; in st1232_ts_irq_handler()
189 } else if (!ts->low_latency_req.dev) { in st1232_ts_irq_handler()
191 dev_pm_qos_add_ancestor_request(&ts->client->dev, in st1232_ts_irq_handler()
192 &ts->low_latency_req, in st1232_ts_irq_handler()
200 static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron) in st1232_ts_power() argument
202 if (ts->reset_gpio) in st1232_ts_power()
203 gpiod_set_value_cansleep(ts->reset_gpio, !poweron); in st1232_ts_power()
227 struct st1232_ts_data *ts; in st1232_ts_probe() local
250 ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); in st1232_ts_probe()
251 if (!ts) in st1232_ts_probe()
254 ts->chip_info = match; in st1232_ts_probe()
257 ts->read_buf_len = ts->chip_info->max_fingers * 4; in st1232_ts_probe()
258 ts->read_buf = devm_kzalloc(&client->dev, ts->read_buf_len, GFP_KERNEL); in st1232_ts_probe()
259 if (!ts->read_buf) in st1232_ts_probe()
266 ts->client = client; in st1232_ts_probe()
267 ts->input_dev = input_dev; in st1232_ts_probe()
269 ts->reset_gpio = devm_gpiod_get_optional(&client->dev, NULL, in st1232_ts_probe()
271 if (IS_ERR(ts->reset_gpio)) { in st1232_ts_probe()
272 error = PTR_ERR(ts->reset_gpio); in st1232_ts_probe()
278 st1232_ts_power(ts, true); in st1232_ts_probe()
280 error = devm_add_action_or_reset(&client->dev, st1232_ts_power_off, ts); in st1232_ts_probe()
291 error = st1232_ts_wait_ready(ts); in st1232_ts_probe()
296 error = st1232_ts_read_resolution(ts, &max_x, &max_y); in st1232_ts_probe()
303 if (ts->chip_info->have_z) in st1232_ts_probe()
305 ts->chip_info->max_area, 0, 0); in st1232_ts_probe()
312 touchscreen_parse_properties(input_dev, true, &ts->prop); in st1232_ts_probe()
314 error = input_mt_init_slots(input_dev, ts->chip_info->max_fingers, in st1232_ts_probe()
325 client->name, ts); in st1232_ts_probe()
331 error = input_register_device(ts->input_dev); in st1232_ts_probe()
338 i2c_set_clientdata(client, ts); in st1232_ts_probe()
346 struct st1232_ts_data *ts = i2c_get_clientdata(client); in st1232_ts_suspend() local
351 st1232_ts_power(ts, false); in st1232_ts_suspend()
359 struct st1232_ts_data *ts = i2c_get_clientdata(client); in st1232_ts_resume() local
362 st1232_ts_power(ts, true); in st1232_ts_resume()