]> www.infradead.org Git - users/jedix/linux-maple.git/commit
i2c: rtl9300: Add missing count byte for SMBus Block Ops
authorSven Eckelmann <sven@narfation.org>
Sun, 10 Aug 2025 18:05:16 +0000 (20:05 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 19 Aug 2025 21:21:03 +0000 (20:21 -0100)
commit82b350dd8185ce790e61555c436f90b6501af23c
tree7cf242e4b00eaa58f7d45a963ee3f2190e3fc2c6
parentceee7776c010c5f09d30985c9e5223b363a6172a
i2c: rtl9300: Add missing count byte for SMBus Block Ops

The expected on-wire format of an SMBus Block Write is

  S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P

Everything starting from the Count byte is provided by the I2C subsystem in
the array data->block. But the driver was skipping the Count byte
(data->block[0]) when sending it to the RTL93xx I2C controller.

Only the actual data could be seen on the wire:

  S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P

This wire format is not SMBus Block Write compatible but matches the format
of an I2C Block Write. Simply adding the count byte to the buffer for the
I2C controller is enough to fix the transmission.

This also affects read because the I2C controller must receive the count
byte + $count * data bytes.

Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Cc: <stable@vger.kernel.org> # v6.13+
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250810-i2c-rtl9300-multi-byte-v5-4-cd9dca0db722@narfation.org
drivers/i2c/busses/i2c-rtl9300.c