[<<][am335x][>>][..]
Wed Jun 13 20:23:30 EDT 2018

slave mode first draft, before kernel events

    if (omap->slave_mode) {
        if (stat & OMAP_I2C_STAT_RRDY) {
            uint8_t data = omap_i2c_read_reg(omap, OMAP_I2C_DATA_REG);
            dev_info(omap->dev, "slave: %04x RRDY, DATA_REG=%d\n", stat, data);
            omap_i2c_ack_stat(omap, OMAP_I2C_STAT_RRDY);
        }
        else if (stat & OMAP_I2C_STAT_XRDY) {
            uint8_t data = 123;
            dev_info(omap->dev, "slave: %04x XRDY, write DATA_REG=%d\n", stat, data);
            omap_i2c_write_reg(omap, OMAP_I2C_DATA_REG, data);
            omap_i2c_ack_stat(omap, OMAP_I2C_STAT_XRDY);
        }
        else if (stat & OMAP_I2C_STAT_ARDY) {
            dev_info(omap->dev, "slave: %04x ARDY, end slave_mode\n", stat);
            omap_i2c_ack_stat(omap, OMAP_I2C_STAT_ARDY);
            omap->slave_mode = 0;
        }
        else if (stat) {
            dev_info(omap->dev, "slave: %04x ???\n", stat);
            omap_i2c_ack_stat(omap, stat);
        }
        continue;
    }

So basically, send an event when XRDY is there, but if the backend
says there is nothing, don't ack the interrupt yet.




[Reply][About]
[<<][am335x][>>][..]