drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h

Source file repositories/reference/linux-study-clean/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h
Extension
.h
Size
7522 bytes
Lines
218
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct dcmipp_ent_device {
	struct media_entity *ent;
	struct media_pad *pads;

	/* Parallel input device */
	struct v4l2_mbus_config_parallel bus;
	enum v4l2_mbus_type bus_type;
	irq_handler_t handler;
	irqreturn_t handler_ret;
	irq_handler_t thread_fn;
};

/**
 * dcmipp_pads_init - initialize pads
 *
 * @num_pads:	number of pads to initialize
 * @pads_flags:	flags to use in each pad
 *
 * Helper functions to allocate/initialize pads
 */
struct media_pad *dcmipp_pads_init(u16 num_pads,
				   const unsigned long *pads_flags);

/**
 * dcmipp_pads_cleanup - free pads
 *
 * @pads: pointer to the pads
 *
 * Helper function to free the pads initialized with dcmipp_pads_init
 */
static inline void dcmipp_pads_cleanup(struct media_pad *pads)
{
	kfree(pads);
}

/**
 * dcmipp_ent_sd_register - initialize and register a subdev node
 *
 * @ved:	the dcmipp_ent_device struct to be initialize
 * @sd:		the v4l2_subdev struct to be initialize and registered
 * @v4l2_dev:	the v4l2 device to register the v4l2_subdev
 * @name:	name of the sub-device. Please notice that the name must be
 *		unique.
 * @function:	media entity function defined by MEDIA_ENT_F_* macros
 * @num_pads:	number of pads to initialize
 * @pads_flag:	flags to use in each pad
 * @sd_int_ops:	pointer to &struct v4l2_subdev_internal_ops
 * @sd_ops:	pointer to &struct v4l2_subdev_ops.
 * @handler:	func pointer of the irq handler
 * @thread_fn:	func pointer of the threaded irq handler
 *
 * Helper function initialize and register the struct dcmipp_ent_device and
 * struct v4l2_subdev which represents a subdev node in the topology
 */
int dcmipp_ent_sd_register(struct dcmipp_ent_device *ved,
			   struct v4l2_subdev *sd,
			   struct v4l2_device *v4l2_dev,
			   const char *const name,
			   u32 function,
			   u16 num_pads,
			   const unsigned long *pads_flag,
			   const struct v4l2_subdev_internal_ops *sd_int_ops,
			   const struct v4l2_subdev_ops *sd_ops,
			   irq_handler_t handler,
			   irq_handler_t thread_fn);

/**
 * dcmipp_ent_sd_unregister - cleanup and unregister a subdev node
 *
 * @ved:	the dcmipp_ent_device struct to be cleaned up
 * @sd:		the v4l2_subdev struct to be unregistered
 *
 * Helper function cleanup and unregister the struct dcmipp_ent_device and
 * struct v4l2_subdev which represents a subdev node in the topology
 */
void dcmipp_ent_sd_unregister(struct dcmipp_ent_device *ved,
			      struct v4l2_subdev *sd);

#define reg_write(device, reg, val) \
	(__reg_write((device)->dev, (device)->regs, (reg), (val)))
#define reg_read(device, reg) \
	(__reg_read((device)->dev, (device)->regs, (reg)))
#define reg_set(device, reg, mask) \
	(__reg_set((device)->dev, (device)->regs, (reg), (mask)))
#define reg_clear(device, reg, mask) \
	(__reg_clear((device)->dev, (device)->regs, (reg), (mask)))

static inline u32 __reg_read(struct device *dev, void __iomem *base, u32 reg)
{
	u32 val = readl_relaxed(base + reg);

Annotation

Implementation Notes