aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/accel
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2022-04-27 12:08:04 -0700
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-06-11 14:35:26 +0100
commit7cbb6681d7e5b88688234ad370e027a9346ff7a9 (patch)
tree09dddb1df50413005ce43054c96efef798a2b67f /drivers/iio/accel
parentiio: ABI: Add a new location label (diff)
downloadlinux-dev-7cbb6681d7e5b88688234ad370e027a9346ff7a9.tar.xz
linux-dev-7cbb6681d7e5b88688234ad370e027a9346ff7a9.zip
iio: common: cros_ec_sensors: Add label attribute
When sensor location is known, populate iio sysfs "label" attribute: * "accel-base" : the sensor is in the base of the convertible (2-1) device. * "accel-display" : the sensor is in the lid/display plane of the device. * "accel-camera" : the sensor is in the swivel camera subassembly. The non-standard |location| attribute is removed, the field |loc| in cros_ec_sensors_core_state is removed. It apply to standalone accelerometer as well as IMU (accelerometer + gyroscope) and sensors where the location is known (light). Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Link: https://lore.kernel.org/r/20220427190804.961697-3-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/accel')
-rw-r--r--drivers/iio/accel/cros_ec_accel_legacy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/cros_ec_accel_legacy.c
index b6f3471b62dc..1c0171f26e99 100644
--- a/drivers/iio/accel/cros_ec_accel_legacy.c
+++ b/drivers/iio/accel/cros_ec_accel_legacy.c
@@ -230,7 +230,7 @@ static int cros_ec_accel_legacy_probe(struct platform_device *pdev)
indio_dev->channels = cros_ec_accel_legacy_channels;
indio_dev->num_channels = ARRAY_SIZE(cros_ec_accel_legacy_channels);
/* The lid sensor needs to be presented inverted. */
- if (state->loc == MOTIONSENSE_LOC_LID) {
+ if (!strcmp(indio_dev->label, "accel-display")) {
state->sign[CROS_EC_SENSOR_X] = -1;
state->sign[CROS_EC_SENSOR_Z] = -1;
}