Message ID | 20210521171418.393871-9-hdegoede@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | iio: accel: bmc150: Add support for yoga's with dual accelerometers with an ACPI HID of DUAL250E | expand |
On Fri, May 21, 2021 at 11:23 PM Hans de Goede <hdegoede@redhat.com> wrote: > > Some Yoga laptops with 1 accelerometer in the display and 1 in the base, > use an ACPI HID of DUAL250E instead of BOSC0200. > > Set the iio-device's label for DUAL250E devices to a value indicating which > sensor is which, mirroring how we do this for BOSC0200 dual sensor devices. > > Note the DUAL250E fwnode unfortunately does not include a mount-matrix. > + /* Special case for devices with a "DUAL250E" HID */ > + if (adev && acpi_dev_hid_uid_match(adev, "DUAL250E", NULL)) { > + if (strcmp(dev_name(dev), "i2c-DUAL250E:base") == 0) > + label = "accel-base"; > + else > + label = "accel-display"; > + > + indio_dev->label = label; > + return false; /* DUAL250E fwnodes have no mount matrix info */ > + } > + > if (!adev || !acpi_dev_hid_uid_match(adev, "BOSC0200", NULL)) > return false; This sounds to me like _apply_orientation_generic() ... _apply_orientation_dual250e() _apply_orientation() if () return _apply_orientation_generic() if () return _apply_orientation_dual250e return false; -- With Best Regards, Andy Shevchenko
Hi, On 5/22/21 8:34 PM, Andy Shevchenko wrote: > On Fri, May 21, 2021 at 11:23 PM Hans de Goede <hdegoede@redhat.com> wrote: >> >> Some Yoga laptops with 1 accelerometer in the display and 1 in the base, >> use an ACPI HID of DUAL250E instead of BOSC0200. >> >> Set the iio-device's label for DUAL250E devices to a value indicating which >> sensor is which, mirroring how we do this for BOSC0200 dual sensor devices. >> >> Note the DUAL250E fwnode unfortunately does not include a mount-matrix. > >> + /* Special case for devices with a "DUAL250E" HID */ >> + if (adev && acpi_dev_hid_uid_match(adev, "DUAL250E", NULL)) { >> + if (strcmp(dev_name(dev), "i2c-DUAL250E:base") == 0) >> + label = "accel-base"; >> + else >> + label = "accel-display"; >> + >> + indio_dev->label = label; >> + return false; /* DUAL250E fwnodes have no mount matrix info */ >> + } >> + >> if (!adev || !acpi_dev_hid_uid_match(adev, "BOSC0200", NULL)) >> return false; > > > This sounds to me like > > _apply_orientation_generic() > ... > > _apply_orientation_dual250e() > > > _apply_orientation() > > if () > return _apply_orientation_generic() > > if () > return _apply_orientation_dual250e > > return false; Good point, I'll give that a try for v2 and see if I like the end result of that. If it turns out to be a bit ugly I'll just stick with what is in v1. Regards, Hans
diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index 932007895f18..08966ee82e43 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c @@ -397,6 +397,17 @@ static bool bmc150_apply_acpi_orientation(struct device *dev, acpi_status status; int i, j, val[3]; + /* Special case for devices with a "DUAL250E" HID */ + if (adev && acpi_dev_hid_uid_match(adev, "DUAL250E", NULL)) { + if (strcmp(dev_name(dev), "i2c-DUAL250E:base") == 0) + label = "accel-base"; + else + label = "accel-display"; + + indio_dev->label = label; + return false; /* DUAL250E fwnodes have no mount matrix info */ + } + if (!adev || !acpi_dev_hid_uid_match(adev, "BOSC0200", NULL)) return false;
Some Yoga laptops with 1 accelerometer in the display and 1 in the base, use an ACPI HID of DUAL250E instead of BOSC0200. Set the iio-device's label for DUAL250E devices to a value indicating which sensor is which, mirroring how we do this for BOSC0200 dual sensor devices. Note the DUAL250E fwnode unfortunately does not include a mount-matrix. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/iio/accel/bmc150-accel-core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)