/* Perform I2C write operation for mipi camera sensor.  */
static int32_t mipi_sensor_write_reg(uint32_t i2c_base, uint16_t reg, uint8_t pval)
/* Perform I2C write operation for mipi camera sensor.  */
static int32_t mipi_sensor_write_reg(uint32_t i2c_base, uint16_t reg, uint8_t pval)
{
    int ret = 0;
    struct imx_i2c_request rq = {0};
    reg = ((reg & 0x00FF) << 8) | ((reg & 0xFF00) >> 8);
    rq.ctl_addr = i2c_base;
    rq.dev_addr = MIPI_SENSOR_ADDR;
    rq.reg_addr = reg;
    rq.reg_addr_sz = 2;
    rq.buffer_sz = 1;
    rq.buffer = &pval;
    ret = i2c_xfer(&rq, I2C_WRITE);
    return ret;
}