drivers/media/platform/qcom/camss/camss-format.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/camss/camss-format.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/qcom/camss/camss-format.c
Extension
.c
Size
2543 bytes
Lines
106
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 (req_code) {
			if (req_code == code[i])
				return req_code;
		} else {
			if (i == index)
				return code[i];
		}
	}

	return code[0];
}

/*
 * camss_format_find_format - Find a format in an array
 * @code: media bus format code
 * @pixelformat: V4L2 pixel format FCC identifier
 * @formats: a pointer to formats array
 * @nformats: size of @formats array
 *
 * Return index of a format or a negative error code otherwise
 */
int camss_format_find_format(u32 code, u32 pixelformat, const struct camss_format_info *formats,
			     unsigned int nformats)
{
	unsigned int i;

	for (i = 0; i < nformats; i++) {
		if (formats[i].code == code &&
		    formats[i].pixelformat == pixelformat)
			return i;
	}

	for (i = 0; i < nformats; i++) {
		if (formats[i].code == code)
			return i;
	}

	return -EINVAL;
}

Annotation

Implementation Notes