diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2011-08-24 02:00:41 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-08-24 02:08:06 -0400 |
commit | 85615476e2039d2567075d7949a30f0c204f8103 (patch) | |
tree | 6291f0d9b4b851bfc50bdbba924fb646135c5867 /drivers/input/mouse | |
parent | 7afdb842d9fa8cd62c33e76a1efc62c59772216d (diff) |
Input: synaptics - refactor initialization of abs position axes
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/synaptics.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 34bcc1fc59fd..8e9360ab4ec4 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -712,39 +712,38 @@ static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse) | |||
712 | /***************************************************************************** | 712 | /***************************************************************************** |
713 | * Driver initialization/cleanup functions | 713 | * Driver initialization/cleanup functions |
714 | ****************************************************************************/ | 714 | ****************************************************************************/ |
715 | static void set_abs_position_params(struct input_dev *dev, | ||
716 | struct synaptics_data *priv, int x_code, | ||
717 | int y_code) | ||
718 | { | ||
719 | int x_min = priv->x_min ?: XMIN_NOMINAL; | ||
720 | int x_max = priv->x_max ?: XMAX_NOMINAL; | ||
721 | int y_min = priv->y_min ?: YMIN_NOMINAL; | ||
722 | int y_max = priv->y_max ?: YMAX_NOMINAL; | ||
723 | int fuzz = SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) ? | ||
724 | SYN_REDUCED_FILTER_FUZZ : 0; | ||
725 | |||
726 | input_set_abs_params(dev, x_code, x_min, x_max, fuzz, 0); | ||
727 | input_set_abs_params(dev, y_code, y_min, y_max, fuzz, 0); | ||
728 | input_abs_set_res(dev, x_code, priv->x_res); | ||
729 | input_abs_set_res(dev, y_code, priv->y_res); | ||
730 | } | ||
731 | |||
715 | static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | 732 | static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) |
716 | { | 733 | { |
717 | int i; | 734 | int i; |
718 | int fuzz = SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) ? | ||
719 | SYN_REDUCED_FILTER_FUZZ : 0; | ||
720 | 735 | ||
721 | __set_bit(INPUT_PROP_POINTER, dev->propbit); | 736 | __set_bit(INPUT_PROP_POINTER, dev->propbit); |
722 | 737 | ||
723 | __set_bit(EV_ABS, dev->evbit); | 738 | __set_bit(EV_ABS, dev->evbit); |
724 | input_set_abs_params(dev, ABS_X, | 739 | set_abs_position_params(dev, priv, ABS_X, ABS_Y); |
725 | priv->x_min ?: XMIN_NOMINAL, | ||
726 | priv->x_max ?: XMAX_NOMINAL, | ||
727 | fuzz, 0); | ||
728 | input_set_abs_params(dev, ABS_Y, | ||
729 | priv->y_min ?: YMIN_NOMINAL, | ||
730 | priv->y_max ?: YMAX_NOMINAL, | ||
731 | fuzz, 0); | ||
732 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); | 740 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); |
733 | 741 | ||
734 | if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) { | 742 | if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) { |
735 | __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); | 743 | __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); |
736 | input_mt_init_slots(dev, 2); | 744 | input_mt_init_slots(dev, 2); |
737 | input_set_abs_params(dev, ABS_MT_POSITION_X, | 745 | set_abs_position_params(dev, priv, ABS_MT_POSITION_X, |
738 | priv->x_min ?: XMIN_NOMINAL, | 746 | ABS_MT_POSITION_Y); |
739 | priv->x_max ?: XMAX_NOMINAL, | ||
740 | fuzz, 0); | ||
741 | input_set_abs_params(dev, ABS_MT_POSITION_Y, | ||
742 | priv->y_min ?: YMIN_NOMINAL, | ||
743 | priv->y_max ?: YMAX_NOMINAL, | ||
744 | fuzz, 0); | ||
745 | |||
746 | input_abs_set_res(dev, ABS_MT_POSITION_X, priv->x_res); | ||
747 | input_abs_set_res(dev, ABS_MT_POSITION_Y, priv->y_res); | ||
748 | } | 747 | } |
749 | 748 | ||
750 | if (SYN_CAP_PALMDETECT(priv->capabilities)) | 749 | if (SYN_CAP_PALMDETECT(priv->capabilities)) |
@@ -777,9 +776,6 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
777 | __clear_bit(REL_X, dev->relbit); | 776 | __clear_bit(REL_X, dev->relbit); |
778 | __clear_bit(REL_Y, dev->relbit); | 777 | __clear_bit(REL_Y, dev->relbit); |
779 | 778 | ||
780 | input_abs_set_res(dev, ABS_X, priv->x_res); | ||
781 | input_abs_set_res(dev, ABS_Y, priv->y_res); | ||
782 | |||
783 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | 779 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { |
784 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); | 780 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); |
785 | /* Clickpads report only left button */ | 781 | /* Clickpads report only left button */ |