drivers/media/platform/amlogic/c3/isp/c3-isp-resizer.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/amlogic/c3/isp/c3-isp-resizer.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/amlogic/c3/isp/c3-isp-resizer.c
Extension
.c
Size
26178 bytes
Lines
893
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 c3_isp_rsz_format_info {
	u32 mbus_code;
	u32 pads;
	bool is_raw;
};

static const struct c3_isp_rsz_format_info c3_isp_rsz_fmts[] = {
	/* RAW formats */
	{
		.mbus_code	= MEDIA_BUS_FMT_SBGGR16_1X16,
		.pads		= BIT(C3_ISP_RSZ_PAD_SINK)
				| BIT(C3_ISP_RSZ_PAD_SOURCE),
		.is_raw = true,
	}, {
		.mbus_code	= MEDIA_BUS_FMT_SGBRG16_1X16,
		.pads		= BIT(C3_ISP_RSZ_PAD_SINK)
				| BIT(C3_ISP_RSZ_PAD_SOURCE),
		.is_raw = true,
	}, {
		.mbus_code	= MEDIA_BUS_FMT_SGRBG16_1X16,
		.pads		= BIT(C3_ISP_RSZ_PAD_SINK)
				| BIT(C3_ISP_RSZ_PAD_SOURCE),
		.is_raw = true,
	}, {
		.mbus_code	= MEDIA_BUS_FMT_SRGGB16_1X16,
		.pads		= BIT(C3_ISP_RSZ_PAD_SINK)
				| BIT(C3_ISP_RSZ_PAD_SOURCE),
		.is_raw = true,
	},
	/* YUV formats */
	{
		.mbus_code	= MEDIA_BUS_FMT_YUV10_1X30,
		.pads		= BIT(C3_ISP_RSZ_PAD_SINK)
				| BIT(C3_ISP_RSZ_PAD_SOURCE),
		.is_raw = false,
	},
};

/*
 * struct c3_isp_pps_io_size - ISP scaler input and output size
 *
 * @thsize: input horizontal size of after preprocessing
 * @tvsize: input vertical size of after preprocessing
 * @ohsize: output horizontal size
 * @ovsize: output vertical size
 * @ihsize: input horizontal size
 * @max_hsize: maximum horizontal size
 */
struct c3_isp_pps_io_size {
	u32 thsize;
	u32 tvsize;
	u32 ohsize;
	u32 ovsize;
	u32 ihsize;
	u32 max_hsize;
};

/* The normal parameters of pps module */
static const int c3_isp_pps_lut[C3_ISP_PPS_LUT_H_NUM][4] =  {
	{  0, 511,   0,   0}, { -5, 511,   5,   0}, {-10, 511,  11,   0},
	{-14, 510,  17,  -1}, {-18, 508,  23,  -1}, {-22, 506,  29,  -1},
	{-25, 503,  36,  -2}, {-28, 500,  43,  -3}, {-32, 496,  51,  -3},
	{-34, 491,  59,  -4}, {-37, 487,  67,  -5}, {-39, 482,  75,  -6},
	{-41, 476,  84,  -7}, {-42, 470,  92,  -8}, {-44, 463, 102,  -9},
	{-45, 456, 111, -10}, {-45, 449, 120, -12}, {-47, 442, 130, -13},
	{-47, 434, 140, -15}, {-47, 425, 151, -17}, {-47, 416, 161, -18},
	{-47, 407, 172, -20}, {-47, 398, 182, -21}, {-47, 389, 193, -23},
	{-46, 379, 204, -25}, {-45, 369, 215, -27}, {-44, 358, 226, -28},
	{-43, 348, 237, -30}, {-43, 337, 249, -31}, {-41, 326, 260, -33},
	{-40, 316, 271, -35}, {-39, 305, 282, -36}, {-37, 293, 293, -37}
};

static const struct c3_isp_rsz_format_info
*rsz_find_format_by_code(u32 code, u32 pad)
{
	for (unsigned int i = 0; i < ARRAY_SIZE(c3_isp_rsz_fmts); i++) {
		const struct c3_isp_rsz_format_info *info = &c3_isp_rsz_fmts[i];

		if (info->mbus_code == code && info->pads & BIT(pad))
			return info;
	}

	return NULL;
}

static const struct c3_isp_rsz_format_info
*rsz_find_format_by_index(u32 index, u32 pad)
{
	for (unsigned int i = 0; i < ARRAY_SIZE(c3_isp_rsz_fmts); i++) {
		const struct c3_isp_rsz_format_info *info = &c3_isp_rsz_fmts[i];

Annotation

Implementation Notes