drivers/media/platform/rockchip/rkisp1/rkisp1-params.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
Extension
.c
Size
97122 bytes
Lines
2951
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

struct csm_coeffs {
		u16 limited[9];
		u16 full[9];
	};
	static const struct csm_coeffs rec601_coeffs = {
		.limited = {
			0x0021, 0x0042, 0x000d,
			0x01ed, 0x01db, 0x0038,
			0x0038, 0x01d1, 0x01f7,
		},
		.full = {
			0x0026, 0x004b, 0x000f,
			0x01ea, 0x01d6, 0x0040,
			0x0040, 0x01ca, 0x01f6,
		},
	};
	static const struct csm_coeffs rec709_coeffs = {
		.limited = {
			0x0018, 0x0050, 0x0008,
			0x01f3, 0x01d5, 0x0038,
			0x0038, 0x01cd, 0x01fb,
		},
		.full = {
			0x001b, 0x005c, 0x0009,
			0x01f1, 0x01cf, 0x0040,
			0x0040, 0x01c6, 0x01fa,
		},
	};
	static const struct csm_coeffs rec2020_coeffs = {
		.limited = {
			0x001d, 0x004c, 0x0007,
			0x01f0, 0x01d8, 0x0038,
			0x0038, 0x01cd, 0x01fb,
		},
		.full = {
			0x0022, 0x0057, 0x0008,
			0x01ee, 0x01d2, 0x0040,
			0x0040, 0x01c5, 0x01fb,
		},
	};
	static const struct csm_coeffs smpte240m_coeffs = {
		.limited = {
			0x0018, 0x004f, 0x000a,
			0x01f3, 0x01d5, 0x0038,
			0x0038, 0x01ce, 0x01fa,
		},
		.full = {
			0x001b, 0x005a, 0x000b,
			0x01f1, 0x01cf, 0x0040,
			0x0040, 0x01c7, 0x01f9,
		},
	};

	const struct csm_coeffs *coeffs;
	const u16 *csm;
	unsigned int i;

	switch (params->ycbcr_encoding) {
	case V4L2_YCBCR_ENC_601:
	default:
		coeffs = &rec601_coeffs;
		break;
	case V4L2_YCBCR_ENC_709:
		coeffs = &rec709_coeffs;
		break;
	case V4L2_YCBCR_ENC_BT2020:
		coeffs = &rec2020_coeffs;
		break;
	case V4L2_YCBCR_ENC_SMPTE240M:
		coeffs = &smpte240m_coeffs;
		break;
	}

	if (params->quantization == V4L2_QUANTIZATION_FULL_RANGE) {
		csm = coeffs->full;
		rkisp1_param_set_bits(params, RKISP1_CIF_ISP_CTRL,
				      RKISP1_CIF_ISP_CTRL_ISP_CSM_Y_FULL_ENA |
				      RKISP1_CIF_ISP_CTRL_ISP_CSM_C_FULL_ENA);
	} else {
		csm = coeffs->limited;
		rkisp1_param_clear_bits(params, RKISP1_CIF_ISP_CTRL,
					RKISP1_CIF_ISP_CTRL_ISP_CSM_Y_FULL_ENA |
					RKISP1_CIF_ISP_CTRL_ISP_CSM_C_FULL_ENA);
	}

	for (i = 0; i < 9; i++)
		rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_CC_COEFF_0 + i * 4,
			     csm[i]);
}

Annotation

Implementation Notes