summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorGuido Martínez <guido@vanguardiasur.com.ar>2015-05-06 16:33:40 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-05-06 16:39:28 -0700
commit195e610bf7104d0dbe7e420e361dfb154694691d (patch)
tree1722d2171f77e8d29ee3f2d541cd994a64625369 /drivers/input
parentc9eeb5084b27ffede2709e8775827729d0c7c46c (diff)
Input: adp5589-keys - fix pull mask setting
The pull mask is created by looping each row (column) and building an 8-bit integer with the configuration. It is written byte-by-byte, when we reach the end of the rows (columns) or we're at the 3rd line (which finishes the first byte, since each pin is 2bits on the mask). However, this only works if we have at most 8 pins (2 bytes), which is not the case for the ADP5589. So, write the byte at each boundary (every 4 rows/columns). Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/adp5589-keys.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index a45267729dfc..50bc0a0c598b 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -726,7 +726,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
pull_mask |= val << (2 * (i & 0x3));
- if (i == 3 || i == kpad->var->max_row_num) {
+ if (i % 4 == 3 || i == kpad->var->max_row_num) {
ret |= adp5589_write(client, reg(ADP5585_RPULL_CONFIG_A)
+ (i >> 2), pull_mask);
pull_mask = 0;
@@ -746,7 +746,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
pull_mask |= val << (2 * (i & 0x3));
- if (i == 3 || i == kpad->var->max_col_num) {
+ if (i % 4 == 3 || i == kpad->var->max_col_num) {
ret |= adp5589_write(client,
reg(ADP5585_RPULL_CONFIG_C) +
(i >> 2), pull_mask);