• Jacopo Mondi's avatar
    media: i2c: ov5670: Handle RO controls in set_ctrl · c5b6f99c
    Jacopo Mondi authored
    The ov5670 driver registers three controls as read-only:
    - V4L2_CID_PIXEL_RATE
    - V4L2_CID_LINK_FREQ
    - V4L2_CID_HBLANK
    
    The driver updates the range of HBLANK with __v4l2_ctrl_modify_range()
    and updates the values of PIXEL_RATE and LINK_FREQ with an
    explicit call to __v4l2_ctrl_s_ctrl() in ov5670_set_pad_format() time.
    
    This causes the .set_ctrl handler to be called on these controls
    causing a non-fatal warning to be emitted:
    
    	ov5670_set_ctrl Unhandled id:0x9e0902, val:0x824
    
    This is currently only critical for HBLANK, as LINK_FREQ and PIXEL_RATE
    currently only support a single value, and the v4l2-ctrl framework skips
    calling .set_ctrl() if the current control value is not changed.
    
    Expand the ov5670_set_ctrl() callback to handle the above controls
    to remove the above warning and defend against future expansions
    of the supported pixel rates and link frequencies.
    
    Also be stricter and return an error value if a control is actually not
    handled.
    Reported-by: default avatarLuca Weiss <luca@z3ntu.xyz>
    Signed-off-by: default avatarJacopo Mondi <jacopo.mondi@ideasonboard.com>
    Tested-by: default avatarLuca Weiss <luca@z3ntu.xyz>
    Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
    c5b6f99c
ov5670.c 56.8 KB