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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
assert_support.hsh_css_metrics.hsp.hisp.hsh_css_internal.h
Detected Declarations
function sh_css_metrics_start_framefunction clear_histogramfunction sh_css_metrics_enable_pc_histogramfunction make_histogramfunction insert_binary_metricsfunction sh_css_metrics_start_binaryfunction sh_css_metrics_sample_pcs
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
- Immediate include surface: `assert_support.h`, `sh_css_metrics.h`, `sp.h`, `isp.h`, `sh_css_internal.h`.
- Detected declarations: `function sh_css_metrics_start_frame`, `function clear_histogram`, `function sh_css_metrics_enable_pc_histogram`, `function make_histogram`, `function insert_binary_metrics`, `function sh_css_metrics_start_binary`, `function sh_css_metrics_sample_pcs`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.