linux-stable/drivers/i2c
Gregor Herburger 10b7a33c5d i2c: ocores: generate stop condition after timeout in polling mode
[ Upstream commit f8160d3b35 ]

In polling mode, no stop condition is generated after a timeout. This
causes SCL to remain low and thereby block the bus. If this happens
during a transfer it can cause slaves to misinterpret the subsequent
transfer and return wrong values.

To solve this, pass the ETIMEDOUT error up from ocores_process_polling()
instead of setting STATE_ERROR directly. The caller is adjusted to call
ocores_process_timeout() on error both in polling and in IRQ mode, which
will set STATE_ERROR and generate a stop condition.

Fixes: 69c8c0c0ef ("i2c: ocores: add polling interface")
Signed-off-by: Gregor Herburger <gregor.herburger@tq-group.com>
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Federico Vaga <federico.vaga@cern.ch>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:10:28 +02:00
..
algos
busses i2c: ocores: generate stop condition after timeout in polling mode 2023-04-20 12:10:28 +02:00
muxes i2c: mux: reg: check return value after calling platform_get_resource() 2023-01-14 10:16:00 +01:00
i2c-boardinfo.c
i2c-core-acpi.c i2c: acpi: fix resource leak in reconfiguration device addition 2021-10-13 10:04:29 +02:00
i2c-core-base.c i2c: Fix a potential use after free 2022-08-21 15:15:40 +02:00
i2c-core-of.c
i2c-core-slave.c
i2c-core-smbus.c
i2c-core.h
i2c-dev.c i2c: validate user data in compat ioctl 2022-01-05 12:40:32 +01:00
i2c-mux.c
i2c-slave-eeprom.c
i2c-slave-testunit.c
i2c-smbus.c
i2c-stub.c
Kconfig
Makefile