/* * Create our own symbols for the supported buffer modes, but, for now, * base them entirely on which videobuf2 options have been selected.
*/ #if IS_ENABLED(CONFIG_VIDEOBUF2_VMALLOC) #define MCAM_MODE_VMALLOC 1 #endif
#if !defined(MCAM_MODE_VMALLOC) && !defined(MCAM_MODE_DMA_CONTIG) && \
!defined(MCAM_MODE_DMA_SG) #error One of the vb2 buffer modes must be selected in the config #endif
enum mcam_state {
S_NOTREADY, /* Not yet initialized */
S_IDLE, /* Just hanging around */
S_FLAKED, /* Some sort of problem */
S_STREAMING, /* Streaming data */
S_BUFWAIT /* streaming requested but no buffers yet */
}; #define MAX_DMA_BUFS 3
/* * Different platforms work best with different buffer modes, so we * let the platform pick.
*/ enum mcam_buffer_mode {
B_vmalloc = 0,
B_DMA_contig = 1,
B_DMA_sg = 2
};
enum mcam_chip_id {
MCAM_CAFE,
MCAM_ARMADA610,
};
/* * Is a given buffer mode supported by the current kernel configuration?
*/ staticinlineint mcam_buffer_mode_supported(enum mcam_buffer_mode mode)
{ switch (mode) { #ifdef MCAM_MODE_VMALLOC case B_vmalloc: #endif #ifdef MCAM_MODE_DMA_CONTIG case B_DMA_contig: #endif #ifdef MCAM_MODE_DMA_SG case B_DMA_sg: #endif return 1; default: return 0;
}
}
/* * A description of one of our devices. * Locking: controlled by s_mutex. Certain fields, however, require * the dev_lock spinlock; they are marked as such by comments. * dev_lock is also required for access to device registers.
*/ struct mcam_camera { /* * These fields should be set by the platform code prior to * calling mcam_register().
*/ unsignedchar __iomem *regs; unsigned regs_size; /* size in bytes of the register space */
spinlock_t dev_lock; struct device *dev; /* For messages, dma alloc */ enum mcam_chip_id chip_id; enum mcam_buffer_mode buffer_mode;
int mclk_src; /* which clock source the mclk derives from */ int mclk_div; /* Clock Divider Value for MCLK */
enum v4l2_mbus_type bus_type; /* MIPI support */ /* The dphy config value, allocated in board file * dphy[0]: DPHY3 * dphy[1]: DPHY5 * dphy[2]: DPHY6
*/ int *dphy; bool mipi_enabled; /* flag whether mipi is enabled already */ int lane; /* lane number */
/* clock tree support */ struct clk *clk[NR_MCAM_CLK]; struct clk_hw mclk_hw; struct clk *mclk;
/* * Callbacks from the core to the platform code.
*/ int (*plat_power_up) (struct mcam_camera *cam); void (*plat_power_down) (struct mcam_camera *cam); void (*calc_dphy) (struct mcam_camera *cam);
/* * Everything below here is private to the mcam core and * should not be touched by the platform code.
*/ struct v4l2_device v4l2_dev; struct v4l2_ctrl_handler ctrl_handler; enum mcam_state state; unsignedlong flags; /* Buffer status, mainly (dev_lock) */
/* Mode-specific ops, set at open time */ void (*dma_setup)(struct mcam_camera *cam); void (*frame_complete)(struct mcam_camera *cam, int frame);
/* Current operating parameters */ struct v4l2_pix_format pix_format;
u32 mbus_code;
/* Locks */ struct mutex s_mutex; /* Access to this structure */
};
/* * Register I/O functions. These are here because the platform code * may legitimately need to mess with the register space.
*/ /* * Device register I/O
*/ staticinlinevoid mcam_reg_write(struct mcam_camera *cam, unsignedint reg, unsignedint val)
{
iowrite32(val, cam->regs + reg);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.