drivers/staging/media/atomisp/pci/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c- Extension
.c- Size
- 9865 bytes
- Lines
- 373
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ia_css_types.hsh_css_defs.hia_css_debug.hsh_css_frac.hassert_support.hbh/bh_2/ia_css_bh.host.hia_css_s3a.host.h
Detected Declarations
function ia_css_s3a_configurefunction ia_css_ae_encodefunction ia_css_awb_encodefunction ia_css_af_encodefunction ia_css_s3a_encodefunction ia_css_process_s3afunction ia_css_ae_dumpfunction ia_css_awb_dumpfunction ia_css_af_dumpfunction ia_css_s3a_dumpfunction ia_css_s3a_debug_dtracefunction ia_css_s3a_hmem_decodefunction ia_css_s3a_dmem_decodefunction merge_hi_lo_14function ia_css_s3a_vmem_decode
Annotated Snippet
if (sum_g != sum_r || sum_b != sum_r || sum_y != sum_r) {
/* histogram is invalid */
return;
}
}
#endif
/*
* Limit the histogram area only to 3A area.
* In DSP, the histogram of 0 is incremented for pixels
* which are outside of 3A area. That amount should be subtracted here.
* hist[0] = hist[0] - ((sum of all hist[]) - (pixel count for 3A area))
*/
diff = sum_r - count_for_3a;
out_ptr[0].r -= diff;
out_ptr[0].g -= diff;
out_ptr[0].b -= diff;
out_ptr[0].y -= diff;
}
void
ia_css_s3a_dmem_decode(
struct ia_css_3a_statistics *host_stats,
const struct ia_css_3a_output *isp_stats)
{
int isp_width, host_width, height, i;
struct ia_css_3a_output *host_ptr;
assert(host_stats);
assert(host_stats->data);
assert(isp_stats);
isp_width = host_stats->grid.aligned_width;
host_width = host_stats->grid.width;
height = host_stats->grid.height;
host_ptr = host_stats->data;
/* Getting 3A statistics from DMEM does not involve any
* transformation (like the VMEM version), we just copy the data
* using a different output width. */
for (i = 0; i < height; i++) {
memcpy(host_ptr, isp_stats, host_width * sizeof(*host_ptr));
isp_stats += isp_width;
host_ptr += host_width;
}
}
/* MW: this is an ISP function */
static inline int
merge_hi_lo_14(unsigned short hi, unsigned short lo)
{
int val = (int)((((unsigned int)hi << 14) & 0xfffc000) |
((unsigned int)lo & 0x3fff));
return val;
}
void
ia_css_s3a_vmem_decode(
struct ia_css_3a_statistics *host_stats,
const u16 *isp_stats_hi,
const uint16_t *isp_stats_lo)
{
int out_width, out_height, chunk, rest, kmax, y, x, k, elm_start, elm, ofs;
const u16 *hi, *lo;
struct ia_css_3a_output *output;
assert(host_stats);
assert(host_stats->data);
assert(isp_stats_hi);
assert(isp_stats_lo);
output = host_stats->data;
out_width = host_stats->grid.width;
out_height = host_stats->grid.height;
hi = isp_stats_hi;
lo = isp_stats_lo;
chunk = ISP_VEC_NELEMS >> host_stats->grid.deci_factor_log2;
chunk = max(chunk, 1);
for (y = 0; y < out_height; y++) {
elm_start = y * ISP_S3ATBL_HI_LO_STRIDE;
rest = out_width;
x = 0;
while (x < out_width) {
kmax = (rest > chunk) ? chunk : rest;
ofs = y * out_width + x;
elm = elm_start + x * sizeof(*output) / sizeof(int32_t);
for (k = 0; k < kmax; k++, elm++) {
output[ofs + k].ae_y = merge_hi_lo_14(
Annotation
- Immediate include surface: `ia_css_types.h`, `sh_css_defs.h`, `ia_css_debug.h`, `sh_css_frac.h`, `assert_support.h`, `bh/bh_2/ia_css_bh.host.h`, `ia_css_s3a.host.h`.
- Detected declarations: `function ia_css_s3a_configure`, `function ia_css_ae_encode`, `function ia_css_awb_encode`, `function ia_css_af_encode`, `function ia_css_s3a_encode`, `function ia_css_process_s3a`, `function ia_css_ae_dump`, `function ia_css_awb_dump`, `function ia_css_af_dump`, `function ia_css_s3a_dump`.
- 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.