]> Gentwo Git Trees - linux/.git/commitdiff
platform/chrome: sensorhub: Support devices without FIFO_INT_ENABLE
authorDiogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Wed, 12 Nov 2025 16:00:12 +0000 (16:00 +0000)
committerTzung-Bi Shih <tzungbi@kernel.org>
Fri, 14 Nov 2025 02:57:32 +0000 (02:57 +0000)
Some devices (such as Smaug) report having MOTION_SENSE_FIFO but do not
support controlling the behaviour of the FIFO interrupt via the
FIFO_INT_ENABLE command and in these cases the interrupt is always
enabled. However, currently the code assumes that if MOTION_SENSE_FIFO
is supported then so is FIFO_INT_ENABLE, and when it tries to enable
the interrupt via this command and an unsupported device reports a
failure it then propagates this into failing the sensors probe.

Interpret the return value -EINVAL as a device where FIFO_INT_ENABLE is
not present and the interrupt is always enabled.

Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Link: https://lore.kernel.org/r/20251112-diogo-smaug_ec_sensorhub-v1-1-f71d4e9eb9d4@tecnico.ulisboa.pt
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_sensorhub_ring.c

index 1205219515d67c8ce999e5df4171c5dd1d1d28c7..a10579144c34b3f7668b4552981508639015e4ba 100644 (file)
@@ -129,6 +129,17 @@ int cros_ec_sensorhub_ring_fifo_enable(struct cros_ec_sensorhub *sensorhub,
        /* We expect to receive a payload of 4 bytes, ignore. */
        if (ret > 0)
                ret = 0;
+       /*
+        * Some platforms (such as Smaug) don't support the FIFO_INT_ENABLE
+        * command and the interrupt is always enabled.  In the case, it
+        * returns -EINVAL.
+        *
+        * N.B: there is no danger of -EINVAL meaning any other invalid
+        * parameter since fifo_int_enable.enable is a bool and can never
+        * be in an invalid range.
+        */
+       else if (ret == -EINVAL)
+               ret = 0;
 
        return ret;
 }