drivers/media/platform/renesas/vsp1/vsp1_vspx.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/vsp1/vsp1_vspx.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/renesas/vsp1/vsp1_vspx.c
Extension
.c
Size
17261 bytes
Lines
635
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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 vsp1_vspx_pipeline {
	struct vsp1_pipeline pipe;
	struct vsp1_partition partition;

	/*
	 * Protects the streaming start/stop sequences.
	 *
	 * The start/stop sequences cannot be locked with the 'lock' spinlock
	 * as they acquire mutexes when handling the pm runtime and the vsp1
	 * pipe start/stop operations. Provide a dedicated mutex for this
	 * reason.
	 */
	struct mutex mutex;

	/*
	 * Protects the enable flag.
	 *
	 * The enabled flag is contended between the start/stop streaming
	 * routines and the job_run one, which cannot take a mutex as it is
	 * called from the ISP irq context.
	 */
	spinlock_t lock;
	bool enabled;

	void (*vspx_frame_end)(void *frame_end_data);
	void *frame_end_data;
};

static inline struct vsp1_vspx_pipeline *
to_vsp1_vspx_pipeline(struct vsp1_pipeline *pipe)
{
	return container_of(pipe, struct vsp1_vspx_pipeline, pipe);
}

/*
 * struct vsp1_vspx - VSPX device
 * @vsp1: the VSP1 device
 * @pipe: the VSPX pipeline
 */
struct vsp1_vspx {
	struct vsp1_device *vsp1;
	struct vsp1_vspx_pipeline pipe;
};

/* Apply the given width, height and fourcc to the RWPF's subdevice */
static int vsp1_vspx_rwpf_set_subdev_fmt(struct vsp1_device *vsp1,
					 struct vsp1_rwpf *rwpf,
					 u32 isp_fourcc,
					 unsigned int width,
					 unsigned int height)
{
	struct vsp1_entity *ent = &rwpf->entity;
	struct v4l2_subdev_format format = {};
	u32 vspx_fourcc;

	switch (isp_fourcc) {
	case V4L2_PIX_FMT_GREY:
		/* 8 bit RAW Bayer image. */
		vspx_fourcc = V4L2_PIX_FMT_RGB332;
		break;
	case V4L2_PIX_FMT_Y10:
	case V4L2_PIX_FMT_Y12:
	case V4L2_PIX_FMT_Y16:
		/* 10, 12 and 16 bit RAW Bayer image. */
		vspx_fourcc = V4L2_PIX_FMT_RGB565;
		break;
	case V4L2_META_FMT_GENERIC_8:
		/* ConfigDMA parameters buffer. */
		vspx_fourcc = V4L2_PIX_FMT_XBGR32;
		break;
	default:
		return -EINVAL;
	}

	rwpf->fmtinfo = vsp1_get_format_info(vsp1, vspx_fourcc);

	format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
	format.pad = RWPF_PAD_SINK;
	format.format.width = width;
	format.format.height = height;
	format.format.field = V4L2_FIELD_NONE;
	format.format.code = rwpf->fmtinfo->mbus;

	return v4l2_subdev_call(&ent->subdev, pad, set_fmt, NULL, &format);
}

/* Configure the RPF->IIF->WPF pipeline for ConfigDMA or RAW image transfer. */
static int vsp1_vspx_pipeline_configure(struct vsp1_device *vsp1,
					dma_addr_t addr, u32 isp_fourcc,
					unsigned int width, unsigned int height,

Annotation

Implementation Notes