Skip to content

Commit 1696566

Browse files
jwrdegoedejic23
authored andcommitted
iio: accel: mxc6255: Fix chip-id check
The initial commit adding support for the mxc6225 assumed the mxc6225 has a chip-id of 0xe5 based on testing on a single Allwinner A23 tablet with a mxc6225. Testing on a bunch of other Allwinner tablets have shown that the chip-id for the mxc6225 is not constant. A datasheet for the MXC6255 which I've found online says that bits 7 and 6 of the chip-id register are undefined (for the mxc6255), testing on 5 different tablets with a mxc6225 has found the following ids: 0x25, 0x45, 0x65, 0x85, 0xe5. So it seems that for the mxc6225 bits 7, 6 and 5 of the chip-id register are undefined. This commit adjusts the chip-id check so that the mxc6255 driver properly recognizes the mxc6225 in all these tablets. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 7ba4b88 commit 1696566

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

‎drivers/iio/accel/mxc6255.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#define MXC6255_REG_YOUT 0x01
2727
#define MXC6255_REG_CHIP_ID 0x08
2828

29-
#define MXC6225_CHIP_ID 0xe5
3029
#define MXC6255_CHIP_ID 0x05
3130

3231
/*
@@ -155,11 +154,7 @@ static int mxc6255_probe(struct i2c_client *client,
155154
return ret;
156155
}
157156

158-
switch (chip_id) {
159-
case MXC6225_CHIP_ID:
160-
case MXC6255_CHIP_ID:
161-
break;
162-
default:
157+
if ((chip_id & 0x1f) != MXC6255_CHIP_ID) {
163158
dev_err(&client->dev, "Invalid chip id %x\n", chip_id);
164159
return -ENODEV;
165160
}

0 commit comments

Comments
 (0)