Lines Matching refs:ts

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