]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
iio: cros_ec: Set Gyroscope default frequency to 25Hz
authorGwendal Grignou <gwendal@chromium.org>
Tue, 28 Jul 2020 20:48:25 +0000 (13:48 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Sep 2020 11:47:49 +0000 (13:47 +0200)
commit 336306790b2bbf7ce837625fa3b24ba724d05838 upstream.

BMI160 Minimium gyroscope frequency in normal mode is 25Hz.
When older EC firmware do not report their sensors frequencies,
use 25Hz as the minimum for gyroscope to be sure it works on BMI160.

Fixes: ae7b02ad2f32d ("iio: common: cros_ec_sensors: Expose cros_ec_sensors frequency range via iio sysfs")
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c

index d2609e6feda4d8c7ee95c47620a194a187f2313a..b4f394f05863613ab3b63ce75ef1643675249495 100644 (file)
@@ -57,10 +57,13 @@ static void get_default_min_max_freq(enum motionsensor_type type,
 {
        switch (type) {
        case MOTIONSENSE_TYPE_ACCEL:
-       case MOTIONSENSE_TYPE_GYRO:
                *min_freq = 12500;
                *max_freq = 100000;
                break;
+       case MOTIONSENSE_TYPE_GYRO:
+               *min_freq = 25000;
+               *max_freq = 100000;
+               break;
        case MOTIONSENSE_TYPE_MAG:
                *min_freq = 5000;
                *max_freq = 25000;