drivers/staging/media/atomisp/pci/sh_css_param_dvs.c

Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/atomisp/pci/sh_css_param_dvs.c
Extension
.c
Size
8743 bytes
Lines
276
Domain
Driver Families
Bucket
drivers/staging
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 (dvs_config_src) {
			dvs_config->width_y = width_y = dvs_config_src->width_y;
			dvs_config->height_y = height_y = dvs_config_src->height_y;
			dvs_config->width_uv = width_uv = dvs_config_src->width_uv;
			dvs_config->height_uv = height_uv = dvs_config_src->height_uv;
			IA_CSS_LOG("alloc_dvs_6axis_table Y: W %d H %d", width_y, height_y);
		} else if (frame_res) {
			dvs_config->width_y = width_y = DVS_TABLE_IN_BLOCKDIM_X_LUMA(frame_res->width);
			dvs_config->height_y = height_y = DVS_TABLE_IN_BLOCKDIM_Y_LUMA(
							      frame_res->height);
			dvs_config->width_uv = width_uv = DVS_TABLE_IN_BLOCKDIM_X_CHROMA(
							      frame_res->width /
							      2); /* UV = Y/2, depens on colour format YUV 4.2.0*/
			dvs_config->height_uv = height_uv = DVS_TABLE_IN_BLOCKDIM_Y_CHROMA(
								frame_res->height /
								2);/* UV = Y/2, depens on colour format YUV 4.2.0*/
			IA_CSS_LOG("alloc_dvs_6axis_table Y: W %d H %d", width_y, height_y);
		}

		/* Generate Y buffers  */
		dvs_config->xcoords_y = kvmalloc(array3_size(width_y, height_y, sizeof(uint32_t)),
						 GFP_KERNEL);
		if (!dvs_config->xcoords_y) {
			IA_CSS_ERROR("out of memory");
			err = -ENOMEM;
			goto exit;
		}

		dvs_config->ycoords_y = kvmalloc(array3_size(width_y, height_y, sizeof(uint32_t)),
						 GFP_KERNEL);
		if (!dvs_config->ycoords_y) {
			IA_CSS_ERROR("out of memory");
			err = -ENOMEM;
			goto exit;
		}

		/* Generate UV buffers  */
		IA_CSS_LOG("UV W %d H %d", width_uv, height_uv);

		dvs_config->xcoords_uv = kvmalloc(array3_size(width_uv, height_uv,
							      sizeof(uint32_t)),
						  GFP_KERNEL);
		if (!dvs_config->xcoords_uv) {
			IA_CSS_ERROR("out of memory");
			err = -ENOMEM;
			goto exit;
		}

		dvs_config->ycoords_uv = kvmalloc(array3_size(width_uv, height_uv,
							      sizeof(uint32_t)),
						  GFP_KERNEL);
		if (!dvs_config->ycoords_uv) {
			IA_CSS_ERROR("out of memory");
			err = -ENOMEM;
		}
exit:
		if (err) {
			free_dvs_6axis_table(
			    &dvs_config); /* we might have allocated some memory, release this */
			dvs_config = NULL;
		}
	}

	IA_CSS_LEAVE("dvs_config=%p", dvs_config);
	return dvs_config;
}

static void
init_dvs_6axis_table_from_default(struct ia_css_dvs_6axis_config *dvs_config,
				  const struct ia_css_resolution *dvs_offset)
{
	unsigned int x, y;
	unsigned int width_y = dvs_config->width_y;
	unsigned int height_y = dvs_config->height_y;
	unsigned int width_uv = dvs_config->width_uv;
	unsigned int height_uv = dvs_config->height_uv;

	IA_CSS_LOG("Env_X=%d, Env_Y=%d, width_y=%d, height_y=%d",
		   dvs_offset->width, dvs_offset->height, width_y, height_y);
	for (y = 0; y < height_y; y++) {
		for (x = 0; x < width_y; x++) {
			dvs_config->xcoords_y[y * width_y + x] =  (dvs_offset->width + x *
				DVS_BLOCKDIM_X) << DVS_COORD_FRAC_BITS;
		}
	}

	for (y = 0; y < height_y; y++) {
		for (x = 0; x < width_y; x++) {
			dvs_config->ycoords_y[y * width_y + x] =  (dvs_offset->height + y *
				DVS_BLOCKDIM_Y_LUMA) << DVS_COORD_FRAC_BITS;

Annotation

Implementation Notes