platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure
authorPatryk Duda <pdk@semihalf.com>
Tue, 2 Aug 2022 15:41:28 +0000 (17:41 +0200)
committerTzung-Bi Shih <tzungbi@kernel.org>
Mon, 15 Aug 2022 03:24:49 +0000 (03:24 +0000)
commitf74c7557ed0d321947e8bb4e9d47c1013f8b2227
treeb3192982b32662922752d8608f7e6cec32202d68
parent568035b01cfb107af8d2e4bd2fb9aea22cf5b868
platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure

Some EC based devices (e.g. Fingerpint MCU) can jump to RO part of the
firmware (intentionally or due to device reboot). The RO part doesn't
change during the device lifecycle, so it won't support newer version
of EC_CMD_GET_NEXT_EVENT command.

Function cros_ec_query_all() is responsible for finding maximum
supported MKBP event version. It's usually called when the device is
running RW part of the firmware, so the command version can be
potentially higher than version supported by the RO.

The problem was fixed by updating maximum supported version when the
device returns EC_RES_INVALID_VERSION (mapped to -ENOPROTOOPT). That way
the kernel will use highest common version supported by RO and RW.

Fixes: 3300fdd630d4 ("platform/chrome: cros_ec: handle MKBP more events flag")
Cc: <stable@vger.kernel.org> # 5.10+
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220802154128.21175-1-pdk@semihalf.com
drivers/platform/chrome/cros_ec_proto.c