• Luca Ceresoli's avatar
    media: imx274: consolidate per-mode data in imx274_frmfmt · 96a2c731
    Luca Ceresoli authored
    Data about the implemented readout modes is partially stored in
    imx274_formats[], the rest is scattered in several arrays. The latter
    are then accessed using the mode index, e.g.:
    
      min_frame_len[priv->mode_index]
    
    Consolidate all these data in imx274_formats[], and store a pointer to
    the selected mode (i.e. imx274_formats[priv->mode_index]) in the main
    device struct. This way code to use these data becomes more readable,
    e.g.:
    
      priv->mode->min_frame_len
    
    This removes lots of scaffolding code and keeps data about each mode
    in a unique place.
    
    Also remove a parameter to imx274_mode_regs() that is now unused.
    
    While this adds the mode pointer to the device struct, it does not
    remove the mode_index from it because mode_index is still used in two
    dev_dbg() calls.  This will be handled in a follow-up commit.
    Signed-off-by: default avatarLuca Ceresoli <luca@lucaceresoli.net>
    Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
    96a2c731
imx274.c 43 KB