• Jonathan Corbet's avatar
    [media] marvell-cam: Allow selection of supported buffer modes · 7498469f
    Jonathan Corbet authored
    The Marvell camera core can support all three videobuf2 buffer modes, which
    is slick, but it also requires that all three modes be built and present,
    even though only one is likely to be used.  This patch allows the supported
    modes to be selected at configuration time, reducing the footprint of the
    driver.  Prior to this patch, the MMP camera driver looked like this:
    
    mmp_camera             19092  0
    videobuf2_core         15542  1 mmp_camera
    videobuf2_dma_sg        3173  1 mmp_camera
    videobuf2_dma_contig     2188  1 mmp_camera
    videobuf2_vmalloc       1718  1 mmp_camera
    videobuf2_memops        2100  3 videobuf2_dma_sg,videobuf2_dma_contig,videobuf2_vmalloc
    
    Afterward, instead, with scatter/gather only configured:
    
    mmp_camera             16021  0
    videobuf2_core         15542  1 mmp_camera
    videobuf2_dma_sg        3173  1 mmp_camera
    videobuf2_memops        2100  1 videobuf2_dma_sg
    
    The total goes from 43,813 bytes to 36,836.
    
    The emphasis has been on simplicity and minimal #ifdef use rather than on
    squeezing out every possible byte of code.  For configuration, the driver
    simply looks at which videobuf2 modes have been configured in and supports
    them all; it's simplistic but should be good enough.
    
    The cafe driver is set to support vmalloc and dma-contig; mmp supports only
    dma-sg, since that's the only mode that really makes sense to use.
    Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
    7498469f
mcam-core.c 45.6 KB