• Eugen Hristev's avatar
    media: i2c: imx274: fix s_frame_interval runtime resume not requested · da653498
    Eugen Hristev authored
    pm_runtime_resume_and_get should be called when the s_frame_interval
    is called.
    
    The driver will try to access device registers to configure VMAX, coarse
    time and exposure.
    
    Currently if the runtime is not resumed, this fails:
     # media-ctl -d /dev/media0 --set-v4l2 '"IMX274 1-001a":0[fmt:SRGGB10_1X10/3840x2
    160@1/10]'
    
    IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 3840x2160, goodness 0
    IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1920x1080, goodness -3000
    IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x720, goodness -4000
    IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x540, goodness -4180
    IMX274 1-001a: __imx274_change_compose: selected 1x1 binning
    IMX274 1-001a: imx274_set_frame_interval: input frame interval = 1 / 10
    IMX274 1-001a: imx274_read_mbreg : addr 0x300e, val=0x1 (2 bytes)
    IMX274 1-001a: imx274_set_frame_interval : register SVR = 1
    IMX274 1-001a: imx274_read_mbreg : addr 0x30f6, val=0x6a8 (2 bytes)
    IMX274 1-001a: imx274_set_frame_interval : register HMAX = 1704
    IMX274 1-001a: imx274_set_frame_length : input length = 2112
    IMX274 1-001a: imx274_write_mbreg : i2c bulk write failed, 30f8 = 884 (3 bytes)
    IMX274 1-001a: imx274_set_frame_length error = -121
    IMX274 1-001a: imx274_set_frame_interval error = -121
    Unable to setup formats: Remote I/O error (121)
    
    The device is not resumed thus the remote I/O error.
    
    Setting the frame interval works at streaming time, because
    pm_runtime_resume_and_get is called at s_stream time before sensor setup.
    The failure happens when only the s_frame_interval is called separately
    independently on streaming time.
    
    Fixes: ad97bc37 ("media: i2c: imx274: Add IMX274 power on and off sequence")
    Signed-off-by: default avatarEugen Hristev <eugen.hristev@microchip.com>
    Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    da653498
imx274.c 51.7 KB