Skip to content

Commit abf4923

Browse files
hsinyi527Wolfram Sang
authored andcommitted
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 <[email protected]> Signed-off-by: Hsin-Yi Wang <[email protected]> Reviewed-by: Qii Wang <[email protected]> [wsa: shortened commit message a little] Signed-off-by: Wolfram Sang <[email protected]>
1 parent b3d604d commit abf4923

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/i2c/busses/i2c-mt65xx.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ static const struct i2c_adapter_quirks mt7622_i2c_quirks = {
234234
.max_num_msgs = 255,
235235
};
236236

237+
static const struct i2c_adapter_quirks mt8183_i2c_quirks = {
238+
.flags = I2C_AQ_NO_ZERO_LEN,
239+
};
240+
237241
static const struct mtk_i2c_compatible mt2712_compat = {
238242
.regs = mt_i2c_regs_v1,
239243
.pmic_i2c = 0,
@@ -298,6 +302,7 @@ static const struct mtk_i2c_compatible mt8173_compat = {
298302
};
299303

300304
static const struct mtk_i2c_compatible mt8183_compat = {
305+
.quirks = &mt8183_i2c_quirks,
301306
.regs = mt_i2c_regs_v2,
302307
.pmic_i2c = 0,
303308
.dcm = 0,
@@ -870,7 +875,11 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id)
870875

871876
static u32 mtk_i2c_functionality(struct i2c_adapter *adap)
872877
{
873-
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
878+
if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN)
879+
return I2C_FUNC_I2C |
880+
(I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
881+
else
882+
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
874883
}
875884

876885
static const struct i2c_algorithm mtk_i2c_algorithm = {

0 commit comments

Comments
 (0)