]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
iio: hid-sensor-trigger: Don't touch sensors unless user space requests
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 11 Oct 2017 16:35:01 +0000 (09:35 -0700)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 14 Oct 2017 18:29:50 +0000 (19:29 +0100)
commitad7532cefd11d11a0814a75fb814c205ee3d9d4c
treeee5da70a1f2f53961a27bb1e42b7924c1e4b7c1e
parent446b3217a96c456ab8796605fbb3ce379b03a504
iio: hid-sensor-trigger: Don't touch sensors unless user space requests

One of the user complained that on his system Thinkpad Yoga S1, with
commit f1664eaacec3 ("iio: hid-sensor-trigger: Fix the race with user
space powering up sensors") causes the system to resume immediately
on suspend (S3 operation). On this system the sensor hub is on USB
and is a wake up device from S3. So if any sensor sends data on
motion, the system will wake up. This can be a legitimate use case
to wake up device motion, but that needs proper user space support
to set right thresholds.

In fact the above commit didn't cause this regression, but any operation
which cause sensors to wake up would have caused the same issue. So if
user reads the raw sensor data, same issue occurs, with or without this
commit. Only difference is that the above commit by default will trigger
a power up and power down of sensors as part of runtime pm enable
(runtime enable will cause a runtime resume callback followed by
runtime_suspend callback). Previously user has to do some action on
sensors.

On investigation it was observed that the current driver correctly
changing the state of all sensors to power off but then also some sensor
will still send some data. Only option is to never power up any sensor.

Only good option is to:
- Using sysfs interface disable USB as a wakeup device (This will not
need any driver change)

Since some user don't care about sensors. So for those users this change
brings back old functionality. As long as they don't cause any operation
to power up sensors (like raw read or start iio-sensor-proxy service),
the sensors will not be to touched. This is done by delaying run time
enable till user space does some operation with sensors.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=196853
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
include/linux/hid-sensor-hub.h