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

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

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/renesas/vsp1/vsp1_pipe.c
Extension
.c
Size
22726 bytes
Lines
686
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

vsp1_for_each_format(info, vsp1_video_gen2_formats) {
			if (info->fourcc == fourcc)
				return info;
		}
	}

	if (vsp1_feature(vsp1, VSP1_HAS_HSIT)) {
		vsp1_for_each_format(info, vsp1_video_hsit_formats) {
			if (info->fourcc == fourcc)
				return info;
		}
	}

	return NULL;
}

/**
 * vsp1_get_format_info_by_index - Enumerate format information
 * @vsp1: the VSP1 device
 * @index: the format index
 * @code: media bus code to limit enumeration
 *
 * Return a pointer to the format information structure corresponding to the
 * given index, or NULL if the index exceeds the supported formats list. If the
 * @code parameter is not zero, only formats compatible with the media bus code
 * will be enumerated.
 */
const struct vsp1_format_info *
vsp1_get_format_info_by_index(struct vsp1_device *vsp1, unsigned int index,
			      u32 code)
{
	if (!code) {
		if (index < ARRAY_SIZE(vsp1_video_formats))
			return &vsp1_video_formats[index];

		if (vsp1->info->gen == 2) {
			index -= ARRAY_SIZE(vsp1_video_formats);
			if (index < ARRAY_SIZE(vsp1_video_gen2_formats))
				return &vsp1_video_gen2_formats[index];
		}

		if (vsp1_feature(vsp1, VSP1_HAS_HSIT)) {
			index -= ARRAY_SIZE(vsp1_video_gen2_formats);
			if (index < ARRAY_SIZE(vsp1_video_hsit_formats))
				return &vsp1_video_hsit_formats[index];
		}

		return NULL;
	}

	vsp1_for_each_format(info, vsp1_video_formats) {
		if (info->mbus == code) {
			if (!index)
				return info;
			index--;
		}
	}

	if (vsp1->info->gen == 2) {
		vsp1_for_each_format(info, vsp1_video_gen2_formats) {
			if (info->mbus == code) {
				if (!index)
					return info;
				index--;
			}
		}
	}

	if (vsp1_feature(vsp1, VSP1_HAS_HSIT)) {
		vsp1_for_each_format(info, vsp1_video_hsit_formats) {
			if (info->mbus == code) {
				if (!index)
					return info;
				index--;
			}
		}
	}

	return NULL;
}

/**
 * vsp1_adjust_color_space - Adjust color space fields in a format
 * @code: the media bus code
 * @colorspace: the colorspace
 * @xfer_func: the transfer function
 * @encoding: the encoding
 * @quantization: the quantization
 *
 * This function adjusts all color space fields of a video device of subdev

Annotation

Implementation Notes