drivers/media/platform/rockchip/rkcif/rkcif-capture-dvp.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/rockchip/rkcif/rkcif-capture-dvp.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/rockchip/rkcif/rkcif-capture-dvp.c
Extension
.c
Size
23657 bytes
Lines
866
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

if (stream->stopping) {
			rkcif_dvp_stop_streaming(stream);
			wake_up(&stream->wq_stopped);
			ret = IRQ_HANDLED;
			goto out;
		}

		if (lastline != stream->pix.height) {
			v4l2_err(&rkcif->v4l2_dev,
				 "bad frame, irq:%#x frmst:%#x size:%dx%d\n",
				 intstat, cif_frmst, lastpix, lastline);

			rkcif_dvp_reset_stream(rkcif);
		}

		rkcif_stream_pingpong(stream);

		ret = IRQ_HANDLED;
	}
out:
	return ret;
}

int rkcif_dvp_register(struct rkcif_device *rkcif)
{
	struct rkcif_interface *interface;
	unsigned int streams_num;
	int ret;

	if (!rkcif->match_data->dvp)
		return 0;

	interface = &rkcif->interfaces[RKCIF_DVP];
	interface->index = RKCIF_DVP;
	interface->type = RKCIF_IF_DVP;
	interface->in_fmts = rkcif->match_data->dvp->in_fmts;
	interface->in_fmts_num = rkcif->match_data->dvp->in_fmts_num;
	interface->set_crop = rkcif_dvp_set_crop;
	ret = rkcif_interface_register(rkcif, interface);
	if (ret)
		return ret;

	if (rkcif->match_data->dvp->setup)
		rkcif->match_data->dvp->setup(rkcif);

	streams_num = rkcif->match_data->dvp->has_ids ? 4 : 1;
	for (unsigned int i = 0; i < streams_num; i++) {
		struct rkcif_stream *stream = &interface->streams[i];

		stream->id = i;
		stream->interface = interface;
		stream->out_fmts = rkcif->match_data->dvp->out_fmts;
		stream->out_fmts_num = rkcif->match_data->dvp->out_fmts_num;
		stream->queue_buffer = rkcif_dvp_queue_buffer;
		stream->start_streaming = rkcif_dvp_start_streaming;
		stream->stop_streaming = rkcif_dvp_stop_streaming;

		ret = rkcif_stream_register(rkcif, stream);
		if (ret)
			goto err_streams_unregister;

		interface->streams_num++;
	}

	return 0;

err_streams_unregister:
	for (unsigned int i = 0; i < interface->streams_num; i++)
		rkcif_stream_unregister(&interface->streams[i]);

	rkcif_interface_unregister(interface);

	return ret;
}

void rkcif_dvp_unregister(struct rkcif_device *rkcif)
{
	struct rkcif_interface *interface;

	if (!rkcif->match_data->dvp)
		return;

	interface = &rkcif->interfaces[RKCIF_DVP];

	for (unsigned int i = 0; i < interface->streams_num; i++)
		rkcif_stream_unregister(&interface->streams[i]);

	rkcif_interface_unregister(interface);
}

Annotation

Implementation Notes