Re: [PATCH] i2c: mediatek: Add to support continuous mode

Qii Wang
2020-06-20T01:56:08Z

if these conditions are not met, Can these transfers work?

> + continue;
> + } else
> + break;
> + }
> + if (i >= num - 1) {
> + i2c->op = I2C_MASTER_CONTINUOUS_WR;
> + j = 0;
> + dma_multi_wr_buf = kzalloc(msgs->len * num, GFP_KERNEL);
> + if (!dma_multi_wr_buf) {
> + ret = -ENOMEM;
> + goto err_exit;
> + }
> + multi_msg->addr = msgs->addr;
> + multi_msg->len = msgs->len * num;
> + multi_msg->buf = dma_multi_wr_buf;
> + multi_msg->flags = 0;
> + while (j < num) {
> + memcpy(dma_multi_wr_buf + msgs->len * j,
> + msgs->buf, msgs->len);
> + j++;
> + msgs++;
> + }
> +
> + i2c->ignore_restart_irq = false;
> + ret = mtk_i2c_do_transfer(i2c, multi_msg, num, 0);
> + if (ret < 0)
> + goto err_exit;
> + ret = num;
> + goto err_exit;
> +
> + }
> + }
> +
> if (i2c->auto_restart && num >= 2 && i2c->speed_hz > I2C_MAX_FAST_MODE_FREQ)
> /* ignore the first restart irq after the master code,
> * otherwise the first transfer will be discarded.