Hi,
On 30-10-18 15:47, Andy Shevchenko wrote:
On some laptops the ACPI device with BOSC0200 _HID is representing
two accelerometers under one node.
We add an ID to the I2C multi instantiate list to enumerate
all I2C slaves correctly.
I believe that overall the approach here is correct, but I've
several (at least 4 different models) devices which use the
BOSC0200 _HID but with only 1 accelerometer / 1 I2cSerialBus
resource in the _CRS table.
So I believe that you need to add a new optional bool to
struct i2c_inst_data and ignore i2c_acpi_new_device()
returning NULL when this is set (and set it for the second
accelerometer).
i2c_unregister_device can handle NULL, so some entries
of the multi->clients[i] array ending up as NULL is not
a problem.
Hmm, I have just realized that there is another issue
which is a real problem, we have stuff like this:
[hans@shalem linux]$ ack BOSC0200 /lib/udev/hwdb.d/60-sensor.hwdb
sensor:modalias:acpi:BOSC0200*:dmi:*:svnHampoo:pnD2D3_Vi8A1:*
sensor:modalias:acpi:BOSC0200*:dmi:*:svnHampoo:pnX1D3_C806N:*
sensor:modalias:acpi:BOSC0200*:dmi:*:svn*CHUWIINNOVATIONANDTECHNOLOGY*:pnHi10protablet:*
sensor:modalias:acpi:BOSC0200*:dmi:*:svnHampoo:pnP02BD6_HI-122LP:*
# match the entire dmi-alias, assuming that the use of a BOSC0200 +
sensor:modalias:acpi:BOSC0200*:dmi:bvnAmericanMegatrendsInc.:bvr5.11:bd05/07/2016:svnDefaultstring:pnDefaultstring:pvrDefaultstring:rvnHampoo:rnCherryTrailCR:rvrDefaultstring:cvnDefaultstring:ct3:cvrDefaultstring:
sensor:modalias:acpi:BOSC0200*:dmi:bvnAmericanMegatrendsInc.:bvr5.11:bd05/28/2016:svnDefaultstring:pnDefaultstring:pvrDefaultstring:rvnHampoo:rnCherryTrailCR:rvrDefaultstring:cvnDefaultstring:ct3:cvrDefaultstring:
sensor:modalias:acpi:BOSC0200*:dmi:bvnINSYDECorp.:bvrjumperx.T87.KFBNEE*
sensor:modalias:acpi:BOSC0200*:dmi:*:svnJumper:pnEZpad:*:rvr.A006:*
sensor:modalias:acpi:BOSC0200:BOSC0200:dmi:*ThinkPadYoga11e3rdGen*
sensor:modalias:acpi:*BOSC0200*:dmi:*:svnLENOVO*:pn80XF:*
sensor:modalias:acpi:*BOSC0200*:dmi:*:svnLENOVO*:pn80XE:*
sensor:modalias:acpi:BOSC0200*:dmi:*:svnLINX*:pnLINX1010B:*
And using i2c-multi-instantiate will change the modalias from
acpi:BOSC0200 to i2c:bmc150_accel breaking this.
One way to fix this would be making sure we only use an
i2c:bmc150_accel modalias for the second device. This will
also allow differentiating between the 2 in hwdb quirks for
devices with 2 accelerometers. But the way we currently
generate modalias-es does not allow doing this in an
easy way. Making this possible will require some changes to
show_modalias() and i2c_device_uevent() in
drivers/i2c/i2c-core-base.c