Lines Matching refs:ts

171 static int bu21013_read_block_data(struct bu21013_ts *ts, u8 *buf)  in bu21013_read_block_data()  argument
176 ret = i2c_smbus_read_i2c_block_data(ts->client, in bu21013_read_block_data()
186 static int bu21013_do_touch_report(struct bu21013_ts *ts) in bu21013_do_touch_report() argument
188 struct input_dev *input = ts->in_dev; in bu21013_do_touch_report()
196 if (bu21013_read_block_data(ts, buf) < 0) in bu21013_do_touch_report()
213 &ts->props, x, y); in bu21013_do_touch_report()
238 struct bu21013_ts *ts = device_data; in bu21013_gpio_irq() local
243 error = bu21013_do_touch_report(ts); in bu21013_gpio_irq()
245 dev_err(&ts->client->dev, "%s failed\n", __func__); in bu21013_gpio_irq()
249 if (unlikely(ts->touch_stopped)) in bu21013_gpio_irq()
252 keep_polling = ts->int_gpiod ? in bu21013_gpio_irq()
253 gpiod_get_value(ts->int_gpiod) : false; in bu21013_gpio_irq()
261 static int bu21013_init_chip(struct bu21013_ts *ts) in bu21013_init_chip() argument
263 struct i2c_client *client = ts->client; in bu21013_init_chip()
395 struct bu21013_ts *ts = _ts; in bu21013_power_off() local
397 regulator_disable(ts->regulator); in bu21013_power_off()
402 struct bu21013_ts *ts = _ts; in bu21013_disable_chip() local
404 gpiod_set_value(ts->cs_gpiod, 0); in bu21013_disable_chip()
409 struct bu21013_ts *ts; in bu21013_probe() local
427 ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); in bu21013_probe()
428 if (!ts) in bu21013_probe()
431 ts->client = client; in bu21013_probe()
433 ts->x_flip = device_property_read_bool(dev, "rohm,flip-x"); in bu21013_probe()
434 ts->y_flip = device_property_read_bool(dev, "rohm,flip-y"); in bu21013_probe()
441 ts->in_dev = in_dev; in bu21013_probe()
442 input_set_drvdata(in_dev, ts); in bu21013_probe()
454 touchscreen_parse_properties(in_dev, true, &ts->props); in bu21013_probe()
457 if (!ts->props.invert_x && in bu21013_probe()
464 if (!ts->props.invert_y && in bu21013_probe()
479 ts->regulator = devm_regulator_get(dev, "avdd"); in bu21013_probe()
480 if (IS_ERR(ts->regulator)) { in bu21013_probe()
482 return PTR_ERR(ts->regulator); in bu21013_probe()
485 error = regulator_enable(ts->regulator); in bu21013_probe()
491 error = devm_add_action_or_reset(dev, bu21013_power_off, ts); in bu21013_probe()
498 ts->cs_gpiod = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in bu21013_probe()
499 if (IS_ERR(ts->cs_gpiod)) in bu21013_probe()
500 return dev_err_probe(dev, PTR_ERR(ts->cs_gpiod), "failed to get CS GPIO\n"); in bu21013_probe()
502 gpiod_set_consumer_name(ts->cs_gpiod, "BU21013 CS"); in bu21013_probe()
504 error = devm_add_action_or_reset(dev, bu21013_disable_chip, ts); in bu21013_probe()
511 ts->int_gpiod = devm_gpiod_get_optional(dev, "touch", GPIOD_IN); in bu21013_probe()
512 error = PTR_ERR_OR_ZERO(ts->int_gpiod); in bu21013_probe()
516 if (ts->int_gpiod) in bu21013_probe()
517 gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT"); in bu21013_probe()
520 error = bu21013_init_chip(ts); in bu21013_probe()
527 IRQF_ONESHOT, DRIVER_TP, ts); in bu21013_probe()
539 i2c_set_clientdata(client, ts); in bu21013_probe()
546 struct bu21013_ts *ts = i2c_get_clientdata(client); in bu21013_remove() local
549 ts->touch_stopped = true; in bu21013_remove()
556 struct bu21013_ts *ts = i2c_get_clientdata(client); in bu21013_suspend() local
558 ts->touch_stopped = true; in bu21013_suspend()
563 regulator_disable(ts->regulator); in bu21013_suspend()
571 struct bu21013_ts *ts = i2c_get_clientdata(client); in bu21013_resume() local
575 error = regulator_enable(ts->regulator); in bu21013_resume()
582 error = bu21013_init_chip(ts); in bu21013_resume()
590 ts->touch_stopped = false; in bu21013_resume()