STATE_IDLE,
STATE_READ,
STATE_WRITE,
- STATE_STOP,
};
/**
if (write)
meson_i2c_put_data(i2c, i2c->msg->buf + i2c->pos, i2c->count);
-}
-
-static void meson_i2c_stop(struct meson_i2c *i2c)
-{
- dev_dbg(i2c->dev, "%s: last %d\n", __func__, i2c->last);
- if (i2c->last) {
- i2c->state = STATE_STOP;
+ if (i2c->last && i2c->pos + i2c->count >= i2c->msg->len)
meson_i2c_add_token(i2c, TOKEN_STOP);
- } else {
- i2c->state = STATE_IDLE;
- complete(&i2c->done);
- }
}
static irqreturn_t meson_i2c_irq(int irqno, void *dev_id)
}
if (i2c->pos >= i2c->msg->len) {
- meson_i2c_stop(i2c);
+ i2c->state = STATE_IDLE;
+ complete(&i2c->done);
break;
}
i2c->pos += i2c->count;
if (i2c->pos >= i2c->msg->len) {
- meson_i2c_stop(i2c);
+ i2c->state = STATE_IDLE;
+ complete(&i2c->done);
break;
}
meson_i2c_prepare_xfer(i2c);
break;
- case STATE_STOP:
- i2c->state = STATE_IDLE;
- complete(&i2c->done);
- break;
}
out: