Lines Matching refs:touch
230 static inline void set_scan_rate(struct synaptics_i2c *touch, int scan_rate) in set_scan_rate() argument
232 touch->scan_ms = MSEC_PER_SEC / scan_rate; in set_scan_rate()
233 touch->scan_rate_param = scan_rate; in set_scan_rate()
335 static bool synaptics_i2c_get_input(struct synaptics_i2c *touch) in synaptics_i2c_get_input() argument
337 struct input_dev *input = touch->input; in synaptics_i2c_get_input()
343 if (synaptics_i2c_check_error(touch->client)) in synaptics_i2c_get_input()
347 data = synaptics_i2c_reg_get(touch->client, DATA_REG0); in synaptics_i2c_get_input()
354 xy_delta = synaptics_i2c_word_get(touch->client, REL_X_REG) & 0xffff; in synaptics_i2c_get_input()
373 struct synaptics_i2c *touch = dev_id; in synaptics_i2c_irq() local
375 mod_delayed_work(system_wq, &touch->dwork, 0); in synaptics_i2c_irq()
380 static void synaptics_i2c_check_params(struct synaptics_i2c *touch) in synaptics_i2c_check_params() argument
384 if (scan_rate != touch->scan_rate_param) in synaptics_i2c_check_params()
385 set_scan_rate(touch, scan_rate); in synaptics_i2c_check_params()
387 if (no_decel != touch->no_decel_param) { in synaptics_i2c_check_params()
388 touch->no_decel_param = no_decel; in synaptics_i2c_check_params()
392 if (no_filter != touch->no_filter_param) { in synaptics_i2c_check_params()
393 touch->no_filter_param = no_filter; in synaptics_i2c_check_params()
397 if (reduce_report != touch->reduce_report_param) { in synaptics_i2c_check_params()
398 touch->reduce_report_param = reduce_report; in synaptics_i2c_check_params()
403 synaptics_i2c_reset_config(touch->client); in synaptics_i2c_check_params()
407 static unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch, in synaptics_i2c_adjust_delay() argument
413 delay = touch->scan_ms; in synaptics_i2c_adjust_delay()
415 touch->no_data_count = 0; in synaptics_i2c_adjust_delay()
417 nodata_count_thres = NO_DATA_THRES / touch->scan_ms; in synaptics_i2c_adjust_delay()
418 if (touch->no_data_count < nodata_count_thres) in synaptics_i2c_adjust_delay()
419 touch->no_data_count++; in synaptics_i2c_adjust_delay()
434 struct synaptics_i2c *touch = in synaptics_i2c_work_handler() local
438 synaptics_i2c_check_params(touch); in synaptics_i2c_work_handler()
440 have_data = synaptics_i2c_get_input(touch); in synaptics_i2c_work_handler()
441 delay = synaptics_i2c_adjust_delay(touch, have_data); in synaptics_i2c_work_handler()
451 mod_delayed_work(system_wq, &touch->dwork, delay); in synaptics_i2c_work_handler()
456 struct synaptics_i2c *touch = input_get_drvdata(input); in synaptics_i2c_open() local
459 ret = synaptics_i2c_reset_config(touch->client); in synaptics_i2c_open()
464 mod_delayed_work(system_wq, &touch->dwork, in synaptics_i2c_open()
472 struct synaptics_i2c *touch = input_get_drvdata(input); in synaptics_i2c_close() local
475 synaptics_i2c_reg_set(touch->client, INTERRUPT_EN_REG, 0); in synaptics_i2c_close()
477 cancel_delayed_work_sync(&touch->dwork); in synaptics_i2c_close()
480 synaptics_i2c_reg_set(touch->client, DEV_CONTROL_REG, DEEP_SLEEP); in synaptics_i2c_close()
483 static void synaptics_i2c_set_input_params(struct synaptics_i2c *touch) in synaptics_i2c_set_input_params() argument
485 struct input_dev *input = touch->input; in synaptics_i2c_set_input_params()
487 input->name = touch->client->name; in synaptics_i2c_set_input_params()
488 input->phys = touch->client->adapter->name; in synaptics_i2c_set_input_params()
490 input->id.version = synaptics_i2c_word_get(touch->client, in synaptics_i2c_set_input_params()
492 input->dev.parent = &touch->client->dev; in synaptics_i2c_set_input_params()
495 input_set_drvdata(input, touch); in synaptics_i2c_set_input_params()
509 struct synaptics_i2c *touch; in synaptics_i2c_touch_create() local
511 touch = kzalloc(sizeof(struct synaptics_i2c), GFP_KERNEL); in synaptics_i2c_touch_create()
512 if (!touch) in synaptics_i2c_touch_create()
515 touch->client = client; in synaptics_i2c_touch_create()
516 touch->no_decel_param = no_decel; in synaptics_i2c_touch_create()
517 touch->scan_rate_param = scan_rate; in synaptics_i2c_touch_create()
518 set_scan_rate(touch, scan_rate); in synaptics_i2c_touch_create()
519 INIT_DELAYED_WORK(&touch->dwork, synaptics_i2c_work_handler); in synaptics_i2c_touch_create()
521 return touch; in synaptics_i2c_touch_create()
528 struct synaptics_i2c *touch; in synaptics_i2c_probe() local
530 touch = synaptics_i2c_touch_create(client); in synaptics_i2c_probe()
531 if (!touch) in synaptics_i2c_probe()
541 touch->input = input_allocate_device(); in synaptics_i2c_probe()
542 if (!touch->input) { in synaptics_i2c_probe()
547 synaptics_i2c_set_input_params(touch); in synaptics_i2c_probe()
550 dev_dbg(&touch->client->dev, in synaptics_i2c_probe()
551 "Requesting IRQ: %d\n", touch->client->irq); in synaptics_i2c_probe()
553 ret = request_irq(touch->client->irq, synaptics_i2c_irq, in synaptics_i2c_probe()
555 DRIVER_NAME, touch); in synaptics_i2c_probe()
557 dev_warn(&touch->client->dev, in synaptics_i2c_probe()
561 synaptics_i2c_reg_set(touch->client, in synaptics_i2c_probe()
567 dev_dbg(&touch->client->dev, in synaptics_i2c_probe()
571 ret = input_register_device(touch->input); in synaptics_i2c_probe()
578 i2c_set_clientdata(client, touch); in synaptics_i2c_probe()
583 input_free_device(touch->input); in synaptics_i2c_probe()
585 kfree(touch); in synaptics_i2c_probe()
592 struct synaptics_i2c *touch = i2c_get_clientdata(client); in synaptics_i2c_remove() local
595 free_irq(client->irq, touch); in synaptics_i2c_remove()
597 input_unregister_device(touch->input); in synaptics_i2c_remove()
598 kfree(touch); in synaptics_i2c_remove()
604 struct synaptics_i2c *touch = i2c_get_clientdata(client); in synaptics_i2c_suspend() local
606 cancel_delayed_work_sync(&touch->dwork); in synaptics_i2c_suspend()
609 synaptics_i2c_reg_set(touch->client, DEV_CONTROL_REG, DEEP_SLEEP); in synaptics_i2c_suspend()
618 struct synaptics_i2c *touch = i2c_get_clientdata(client); in synaptics_i2c_resume() local
624 mod_delayed_work(system_wq, &touch->dwork, in synaptics_i2c_resume()