i2c: lpi2c: Avoid calling clk_get_rate during transfer
authorAlexander Stein <alexander.stein@ew.tq-group.com>
Mon, 22 Apr 2024 11:36:29 +0000 (13:36 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Sun, 5 May 2024 22:56:31 +0000 (00:56 +0200)
commit4268254a39484fc11ba991ae148bacbe75d9cc0a
treeb3555d6d36f8f12ce3dc5829dc88bfbed1882833
parent355b1513b1e97b6cef84b786c6480325dfd3753d
i2c: lpi2c: Avoid calling clk_get_rate during transfer

Instead of repeatedly calling clk_get_rate for each transfer, lock
the clock rate and cache the value.
A deadlock has been observed while adding tlv320aic32x4 audio codec to
the system. When this clock provider adds its clock, the clk mutex is
locked already, it needs to access i2c, which in return needs the mutex
for clk_get_rate as well.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-imx-lpi2c.c