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

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

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c
Extension
.c
Size
22956 bytes
Lines
916
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_mipi_stop_streaming(stream);
					wake_up(&stream->wq_stopped);
					continue;
				}

				rkcif_stream_pingpong(stream);
			}
		}
	}

	return ret;
}

int rkcif_mipi_register(struct rkcif_device *rkcif)
{
	int ret;

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

	for (unsigned int i = 0; i < rkcif->match_data->mipi->mipi_num; i++) {
		enum rkcif_interface_index index = RKCIF_MIPI_BASE + i;
		struct rkcif_interface *interface = &rkcif->interfaces[index];

		interface->index = index;
		interface->type = RKCIF_IF_MIPI;
		interface->in_fmts = mipi_in_fmts;
		interface->in_fmts_num = ARRAY_SIZE(mipi_in_fmts);
		interface->set_crop = rkcif_mipi_set_crop;
		interface->streams_num = 0;
		ret = rkcif_interface_register(rkcif, interface);
		if (ret)
			continue;

		for (unsigned int j = 0; j < RKCIF_ID_MAX; j++) {
			struct rkcif_stream *stream = &interface->streams[j];

			stream->id = j;
			stream->interface = interface;
			stream->out_fmts = mipi_out_fmts;
			stream->out_fmts_num = ARRAY_SIZE(mipi_out_fmts);
			stream->queue_buffer = rkcif_mipi_queue_buffer;
			stream->start_streaming = rkcif_mipi_start_streaming;
			stream->stop_streaming = rkcif_mipi_stop_streaming;
			ret = rkcif_stream_register(rkcif, stream);
			if (ret)
				goto err;
			interface->streams_num++;
		}
	}

	return 0;

err:
	for (unsigned int i = 0; i < rkcif->match_data->mipi->mipi_num; i++) {
		enum rkcif_interface_index index = RKCIF_MIPI_BASE + i;
		struct rkcif_interface *interface = &rkcif->interfaces[index];

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

		rkcif_interface_unregister(interface);
	}
	return ret;
}

void rkcif_mipi_unregister(struct rkcif_device *rkcif)
{
	if (!rkcif->match_data->mipi)
		return;

	for (unsigned int i = 0; i < rkcif->match_data->mipi->mipi_num; i++) {
		enum rkcif_interface_index index = RKCIF_MIPI_BASE + i;
		struct rkcif_interface *interface = &rkcif->interfaces[index];

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

		rkcif_interface_unregister(interface);
	}
}

Annotation

Implementation Notes