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

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

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/atomisp/pci/sh_css_metrics.c
Extension
.c
Size
2863 bytes
Lines
146
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

// SPDX-License-Identifier: GPL-2.0
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 */

#include "assert_support.h"
#include "sh_css_metrics.h"

#include "sp.h"
#include "isp.h"

#include "sh_css_internal.h"

#define MULTIPLE_PCS 0
#define SUSPEND      0
#define NOF_PCS      1
#define RESUME_MASK  0x8
#define STOP_MASK    0x0

static bool pc_histogram_enabled;
static struct sh_css_pc_histogram *isp_histogram;
static struct sh_css_pc_histogram *sp_histogram;

struct sh_css_metrics sh_css_metrics;

void
sh_css_metrics_start_frame(void)
{
	sh_css_metrics.frame_metrics.num_frames++;
}

static void
clear_histogram(struct sh_css_pc_histogram *histogram)
{
	unsigned int i;

	assert(histogram);

	for (i = 0; i < histogram->length; i++) {
		histogram->run[i] = 0;
		histogram->stall[i] = 0;
		histogram->msink[i] = 0xFFFF;
	}
}

void
sh_css_metrics_enable_pc_histogram(bool enable)
{
	pc_histogram_enabled = enable;
}

static void
make_histogram(struct sh_css_pc_histogram *histogram, unsigned int length)
{
	assert(histogram);

	if (histogram->length)
		return;
	if (histogram->run)
		return;
	histogram->run = kvmalloc(length * sizeof(*histogram->run),
				  GFP_KERNEL);
	if (!histogram->run)
		return;
	histogram->stall = kvmalloc(length * sizeof(*histogram->stall),
				    GFP_KERNEL);
	if (!histogram->stall)
		return;
	histogram->msink = kvmalloc(length * sizeof(*histogram->msink),
				    GFP_KERNEL);
	if (!histogram->msink)
		return;

	histogram->length = length;
	clear_histogram(histogram);
}

static void
insert_binary_metrics(struct sh_css_binary_metrics **l,
		      struct sh_css_binary_metrics *metrics)
{
	assert(l);
	assert(*l);
	assert(metrics);

	for (; *l; l = &(*l)->next)
		if (*l == metrics)
			return;

Annotation

Implementation Notes