• Dongchun Zhu's avatar
    media: i2c: ov5695: Fix power on and off sequences · f1a64f56
    Dongchun Zhu authored
    From the measured hardware signal, OV5695 reset pin goes high for a
    short period of time during boot-up. From the sensor specification, the
    reset pin is active low and the DT binding defines the pin as active
    low, which means that the values set by the driver are inverted and thus
    the value requested in probe ends up high.
    
    Fix it by changing probe to request the reset GPIO initialized to high,
    which makes the initial state of the physical signal low.
    
    In addition, DOVDD rising must occur before DVDD rising from spec., but
    regulator_bulk_enable() API enables all the regulators asynchronously.
    Use an explicit loops of regulator_enable() instead.
    
    For power off sequence, it is required that DVDD falls first. Given the
    bulk API does not give any guarantee about the order of regulators,
    change the driver to use regulator_disable() instead.
    
    The sensor also requires a delay between reset high and first I2C
    transaction, which was assumed to be 8192 XVCLK cycles, but 1ms is
    recommended by the vendor. Fix this as well.
    Signed-off-by: default avatarDongchun Zhu <dongchun.zhu@mediatek.com>
    Signed-off-by: default avatarTomasz Figa <tfiga@chromium.org>
    Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    f1a64f56
ov5695.c 29.9 KB