Commit 7f4054836d811c650c51f9c93088f8ebd61b0020
1 parent
a5cb2366fb
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Revert "Input: atmel_mxt_ts - use deep sleep mode when stopped"
This reverts commit 9d469d033d135d80742a4e39e6bbb4519dd5eee1. It breaks the Chromebook Pixel touchpad (and touchscreen). Reported-by: Dirk Hohndel <dirk@hohndel.org> Bisected-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Nick Dyer <nick.dyer@itdev.co.uk> Cc: Benson Leung <bleung@chromium.org> Cc: Yufeng Shen <miletus@chromium.org> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: stable@vger.kernel.org # v3.16+ Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 26 additions and 73 deletions Side-by-side Diff
drivers/input/touchscreen/atmel_mxt_ts.c
... | ... | @@ -99,14 +99,10 @@ |
99 | 99 | #define MXT_T6_STATUS_COMSERR (1 << 2) |
100 | 100 | |
101 | 101 | /* MXT_GEN_POWER_T7 field */ |
102 | -struct t7_config { | |
103 | - u8 idle; | |
104 | - u8 active; | |
105 | -} __packed; | |
102 | +#define MXT_POWER_IDLEACQINT 0 | |
103 | +#define MXT_POWER_ACTVACQINT 1 | |
104 | +#define MXT_POWER_ACTV2IDLETO 2 | |
106 | 105 | |
107 | -#define MXT_POWER_CFG_RUN 0 | |
108 | -#define MXT_POWER_CFG_DEEPSLEEP 1 | |
109 | - | |
110 | 106 | /* MXT_GEN_ACQUIRE_T8 field */ |
111 | 107 | #define MXT_ACQUIRE_CHRGTIME 0 |
112 | 108 | #define MXT_ACQUIRE_TCHDRIFT 2 |
... | ... | @@ -117,6 +113,7 @@ |
117 | 113 | #define MXT_ACQUIRE_ATCHCALSTHR 7 |
118 | 114 | |
119 | 115 | /* MXT_TOUCH_MULTI_T9 field */ |
116 | +#define MXT_TOUCH_CTRL 0 | |
120 | 117 | #define MXT_T9_ORIENT 9 |
121 | 118 | #define MXT_T9_RANGE 18 |
122 | 119 | |
... | ... | @@ -256,7 +253,6 @@ |
256 | 253 | bool update_input; |
257 | 254 | u8 last_message_count; |
258 | 255 | u8 num_touchids; |
259 | - struct t7_config t7_cfg; | |
260 | 256 | |
261 | 257 | /* Cached parameters from object table */ |
262 | 258 | u16 T5_address; |
... | ... | @@ -672,6 +668,20 @@ |
672 | 668 | data->t6_status = status; |
673 | 669 | } |
674 | 670 | |
671 | +static int mxt_write_object(struct mxt_data *data, | |
672 | + u8 type, u8 offset, u8 val) | |
673 | +{ | |
674 | + struct mxt_object *object; | |
675 | + u16 reg; | |
676 | + | |
677 | + object = mxt_get_object(data, type); | |
678 | + if (!object || offset >= mxt_obj_size(object)) | |
679 | + return -EINVAL; | |
680 | + | |
681 | + reg = object->start_address; | |
682 | + return mxt_write_reg(data->client, reg + offset, val); | |
683 | +} | |
684 | + | |
675 | 685 | static void mxt_input_button(struct mxt_data *data, u8 *message) |
676 | 686 | { |
677 | 687 | struct input_dev *input = data->input_dev; |
... | ... | @@ -1742,60 +1752,6 @@ |
1742 | 1752 | return error; |
1743 | 1753 | } |
1744 | 1754 | |
1745 | -static int mxt_set_t7_power_cfg(struct mxt_data *data, u8 sleep) | |
1746 | -{ | |
1747 | - struct device *dev = &data->client->dev; | |
1748 | - int error; | |
1749 | - struct t7_config *new_config; | |
1750 | - struct t7_config deepsleep = { .active = 0, .idle = 0 }; | |
1751 | - | |
1752 | - if (sleep == MXT_POWER_CFG_DEEPSLEEP) | |
1753 | - new_config = &deepsleep; | |
1754 | - else | |
1755 | - new_config = &data->t7_cfg; | |
1756 | - | |
1757 | - error = __mxt_write_reg(data->client, data->T7_address, | |
1758 | - sizeof(data->t7_cfg), new_config); | |
1759 | - if (error) | |
1760 | - return error; | |
1761 | - | |
1762 | - dev_dbg(dev, "Set T7 ACTV:%d IDLE:%d\n", | |
1763 | - new_config->active, new_config->idle); | |
1764 | - | |
1765 | - return 0; | |
1766 | -} | |
1767 | - | |
1768 | -static int mxt_init_t7_power_cfg(struct mxt_data *data) | |
1769 | -{ | |
1770 | - struct device *dev = &data->client->dev; | |
1771 | - int error; | |
1772 | - bool retry = false; | |
1773 | - | |
1774 | -recheck: | |
1775 | - error = __mxt_read_reg(data->client, data->T7_address, | |
1776 | - sizeof(data->t7_cfg), &data->t7_cfg); | |
1777 | - if (error) | |
1778 | - return error; | |
1779 | - | |
1780 | - if (data->t7_cfg.active == 0 || data->t7_cfg.idle == 0) { | |
1781 | - if (!retry) { | |
1782 | - dev_dbg(dev, "T7 cfg zero, resetting\n"); | |
1783 | - mxt_soft_reset(data); | |
1784 | - retry = true; | |
1785 | - goto recheck; | |
1786 | - } else { | |
1787 | - dev_dbg(dev, "T7 cfg zero after reset, overriding\n"); | |
1788 | - data->t7_cfg.active = 20; | |
1789 | - data->t7_cfg.idle = 100; | |
1790 | - return mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN); | |
1791 | - } | |
1792 | - } | |
1793 | - | |
1794 | - dev_dbg(dev, "Initialized power cfg: ACTV %d, IDLE %d\n", | |
1795 | - data->t7_cfg.active, data->t7_cfg.idle); | |
1796 | - return 0; | |
1797 | -} | |
1798 | - | |
1799 | 1755 | static int mxt_configure_objects(struct mxt_data *data, |
1800 | 1756 | const struct firmware *cfg) |
1801 | 1757 | { |
... | ... | @@ -1809,12 +1765,6 @@ |
1809 | 1765 | dev_warn(dev, "Error %d updating config\n", error); |
1810 | 1766 | } |
1811 | 1767 | |
1812 | - error = mxt_init_t7_power_cfg(data); | |
1813 | - if (error) { | |
1814 | - dev_err(dev, "Failed to initialize power cfg\n"); | |
1815 | - return error; | |
1816 | - } | |
1817 | - | |
1818 | 1768 | error = mxt_initialize_t9_input_device(data); |
1819 | 1769 | if (error) |
1820 | 1770 | return error; |
1821 | 1771 | |
... | ... | @@ -2093,15 +2043,16 @@ |
2093 | 2043 | |
2094 | 2044 | static void mxt_start(struct mxt_data *data) |
2095 | 2045 | { |
2096 | - mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN); | |
2097 | - | |
2098 | - /* Recalibrate since chip has been in deep sleep */ | |
2099 | - mxt_t6_command(data, MXT_COMMAND_CALIBRATE, 1, false); | |
2046 | + /* Touch enable */ | |
2047 | + mxt_write_object(data, | |
2048 | + MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0x83); | |
2100 | 2049 | } |
2101 | 2050 | |
2102 | 2051 | static void mxt_stop(struct mxt_data *data) |
2103 | 2052 | { |
2104 | - mxt_set_t7_power_cfg(data, MXT_POWER_CFG_DEEPSLEEP); | |
2053 | + /* Touch disable */ | |
2054 | + mxt_write_object(data, | |
2055 | + MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0); | |
2105 | 2056 | } |
2106 | 2057 | |
2107 | 2058 | static int mxt_input_open(struct input_dev *dev) |
... | ... | @@ -2265,6 +2216,8 @@ |
2265 | 2216 | struct i2c_client *client = to_i2c_client(dev); |
2266 | 2217 | struct mxt_data *data = i2c_get_clientdata(client); |
2267 | 2218 | struct input_dev *input_dev = data->input_dev; |
2219 | + | |
2220 | + mxt_soft_reset(data); | |
2268 | 2221 | |
2269 | 2222 | mutex_lock(&input_dev->mutex); |
2270 | 2223 |