Skip to content

Commit e6148fe

Browse files
jwrdegoedeJonathan Cameron
authored andcommitted
iio: accel: bmc150: Set label based on accel-location for ACPI DUAL250E fwnodes
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> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210523170103.176958-10-hdegoede@redhat.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 61ddd0a commit e6148fe

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎drivers/iio/accel/bmc150-accel-core.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,19 @@ static bool bmc150_apply_bosc0200_acpi_orientation(struct device *dev,
450450
return false;
451451
}
452452

453+
static bool bmc150_apply_dual250e_acpi_orientation(struct device *dev,
454+
struct iio_mount_matrix *orientation)
455+
{
456+
struct iio_dev *indio_dev = dev_get_drvdata(dev);
457+
458+
if (strcmp(dev_name(dev), "i2c-DUAL250E:base") == 0)
459+
indio_dev->label = "accel-base";
460+
else
461+
indio_dev->label = "accel-display";
462+
463+
return false; /* DUAL250E fwnodes have no mount matrix info */
464+
}
465+
453466
static bool bmc150_apply_acpi_orientation(struct device *dev,
454467
struct iio_mount_matrix *orientation)
455468
{
@@ -458,6 +471,9 @@ static bool bmc150_apply_acpi_orientation(struct device *dev,
458471
if (adev && acpi_dev_hid_uid_match(adev, "BOSC0200", NULL))
459472
return bmc150_apply_bosc0200_acpi_orientation(dev, orientation);
460473

474+
if (adev && acpi_dev_hid_uid_match(adev, "DUAL250E", NULL))
475+
return bmc150_apply_dual250e_acpi_orientation(dev, orientation);
476+
461477
return false;
462478
}
463479
#else

0 commit comments

Comments
 (0)