提交 195e610b 编写于 作者: G Guido Martínez 提交者: Dmitry Torokhov

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: NGuido Martínez <guido@vanguardiasur.com.ar>
Acked-by: NMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 c9eeb508
...@@ -726,7 +726,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad) ...@@ -726,7 +726,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
pull_mask |= val << (2 * (i & 0x3)); 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) ret |= adp5589_write(client, reg(ADP5585_RPULL_CONFIG_A)
+ (i >> 2), pull_mask); + (i >> 2), pull_mask);
pull_mask = 0; pull_mask = 0;
...@@ -746,7 +746,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad) ...@@ -746,7 +746,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
pull_mask |= val << (2 * (i & 0x3)); 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, ret |= adp5589_write(client,
reg(ADP5585_RPULL_CONFIG_C) + reg(ADP5585_RPULL_CONFIG_C) +
(i >> 2), pull_mask); (i >> 2), pull_mask);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册