Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i2c: mediatek: disable zero-length transfers for mt8183

Quoting from mt8183 datasheet, the number of transfers to be
transferred in one transaction should be set to bigger than 1,
so we should forbid zero-length transfer and update functionality.

Reported-by: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Qii Wang <qii.wang@mediatek.com>
[wsa: shortened commit message a little]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

authored by

Hsin-Yi Wang and committed by
Wolfram Sang
abf4923e b3d604d4

+10 -1
+10 -1
drivers/i2c/busses/i2c-mt65xx.c
··· 234 234 .max_num_msgs = 255, 235 235 }; 236 236 237 + static const struct i2c_adapter_quirks mt8183_i2c_quirks = { 238 + .flags = I2C_AQ_NO_ZERO_LEN, 239 + }; 240 + 237 241 static const struct mtk_i2c_compatible mt2712_compat = { 238 242 .regs = mt_i2c_regs_v1, 239 243 .pmic_i2c = 0, ··· 302 298 }; 303 299 304 300 static const struct mtk_i2c_compatible mt8183_compat = { 301 + .quirks = &mt8183_i2c_quirks, 305 302 .regs = mt_i2c_regs_v2, 306 303 .pmic_i2c = 0, 307 304 .dcm = 0, ··· 875 870 876 871 static u32 mtk_i2c_functionality(struct i2c_adapter *adap) 877 872 { 878 - return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 873 + if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN) 874 + return I2C_FUNC_I2C | 875 + (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK); 876 + else 877 + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 879 878 } 880 879 881 880 static const struct i2c_algorithm mtk_i2c_algorithm = {