OSDN Git Service

i2c: core: Allow 255 byte transfers for SMBus 3.x
authorMatt Johnston <matt@codeconstruct.com.au>
Mon, 15 Nov 2021 02:49:21 +0000 (10:49 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Nov 2021 14:11:24 +0000 (14:11 +0000)
commit13cae4a104d2b7205696229ba85d34cc035f8c84
tree087813184352ae3f0f9788a737dfbc13c02f9b5a
parentcc0be1ad686fb29a4d127948486f40b17fb34b50
i2c: core: Allow 255 byte transfers for SMBus 3.x

SMBus 3.0 increased the maximum block transfer size from 32 bytes to
255 bytes. We increase the size of struct i2c_smbus_data's block[]
member.

i2c_smbus_xfer() and i2c_smbus_xfer_emulated() now support 255 byte
block operations, other block functions remain limited to 32 bytes for
compatibility with existing callers.

We allow adapters to indicate support for the larger size with
I2C_FUNC_SMBUS_V3_BLOCK. Most emulated drivers should be able to use 255
byte blocks by replacing I2C_SMBUS_BLOCK_MAX with I2C_SMBUS_V3_BLOCK_MAX
though some will have hardware limitations that need testing.

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/i2c/i2c-core-smbus.c
include/linux/i2c.h
include/uapi/linux/i2c.h