Skip to content

Commit 46f7589

Browse files
jlabundygregkh
authored andcommitted
Input: iqs7222 - explicitly define number of external channels
commit 63f4970 upstream. The number of external channels is assumed to be a multiple of 10, but this is not the case for IQS7222D. As a result, some CRx pins are wrongly prevented from being assigned to some channels. Address this problem by explicitly defining the number of external channels for cases in which the number of external channels is not equal to the total number of available channels. Fixes: dd24e20 ("Input: iqs7222 - add support for Azoteq IQS7222D") Signed-off-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/aGHVf6HkyFZrzTPy@nixie71 Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent dbdd2a2 commit 46f7589

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/input/misc/iqs7222.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ struct iqs7222_dev_desc {
301301
int allow_offset;
302302
int event_offset;
303303
int comms_offset;
304+
int ext_chan;
304305
bool legacy_gesture;
305306
struct iqs7222_reg_grp_desc reg_grps[IQS7222_NUM_REG_GRPS];
306307
};
@@ -315,6 +316,7 @@ static const struct iqs7222_dev_desc iqs7222_devs[] = {
315316
.allow_offset = 9,
316317
.event_offset = 10,
317318
.comms_offset = 12,
319+
.ext_chan = 10,
318320
.reg_grps = {
319321
[IQS7222_REG_GRP_STAT] = {
320322
.base = IQS7222_SYS_STATUS,
@@ -373,6 +375,7 @@ static const struct iqs7222_dev_desc iqs7222_devs[] = {
373375
.allow_offset = 9,
374376
.event_offset = 10,
375377
.comms_offset = 12,
378+
.ext_chan = 10,
376379
.legacy_gesture = true,
377380
.reg_grps = {
378381
[IQS7222_REG_GRP_STAT] = {
@@ -2244,7 +2247,7 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222,
22442247
const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc;
22452248
struct i2c_client *client = iqs7222->client;
22462249
int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row;
2247-
int ext_chan = rounddown(num_chan, 10);
2250+
int ext_chan = dev_desc->ext_chan ? : num_chan;
22482251
int error, i;
22492252
u16 *chan_setup = iqs7222->chan_setup[chan_index];
22502253
u16 *sys_setup = iqs7222->sys_setup;
@@ -2448,7 +2451,7 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222,
24482451
const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc;
24492452
struct i2c_client *client = iqs7222->client;
24502453
int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row;
2451-
int ext_chan = rounddown(num_chan, 10);
2454+
int ext_chan = dev_desc->ext_chan ? : num_chan;
24522455
int count, error, reg_offset, i;
24532456
u16 *event_mask = &iqs7222->sys_setup[dev_desc->event_offset];
24542457
u16 *sldr_setup = iqs7222->sldr_setup[sldr_index];

0 commit comments

Comments
 (0)