drivers/staging/media/atomisp/pci/sh_css_mipi.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/sh_css_mipi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/sh_css_mipi.c- Extension
.c- Size
- 17467 bytes
- Lines
- 546
- 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_mipi.hsh_css_mipi.htype_support.hsystem_global.hia_css_err.hia_css_pipe.hia_css_stream_format.hsh_css_stream_format.hia_css_stream_public.hia_css_frame_public.hia_css_input_port.hia_css_debug.hsh_css_struct.hsh_css_defs.hsh_css_sp.hsw_event_global.h
Detected Declarations
function ia_css_mipi_frame_calculate_sizefunction mipi_initfunction sizesfunction allocate_mipi_framesfunction free_mipi_framesfunction send_mipi_frames
Annotated Snippet
if (my_css.mipi_frames[port][i]) {
ia_css_frame_free(my_css.mipi_frames[port][i]);
my_css.mipi_frames[port][i] = NULL;
}
/* check if new frame is needed */
if (i < my_css.num_mipi_frames[port]) {
/* allocate new frame */
err = ia_css_frame_allocate_with_buffer_size(
&my_css.mipi_frames[port][i],
my_css.mipi_frame_size[port] * HIVE_ISP_DDR_WORD_BYTES);
if (err) {
for (j = 0; j < i; j++) {
if (my_css.mipi_frames[port][j]) {
ia_css_frame_free(my_css.mipi_frames[port][j]);
my_css.mipi_frames[port][j] = NULL;
}
}
IA_CSS_ERROR("allocate_mipi_frames(%p, %d) exit: allocation failed.",
pipe, port);
return err;
}
}
if (info->metadata_info.size > 0) {
/* free previous metadata buffer */
if (my_css.mipi_metadata[port][i]) {
ia_css_metadata_free(my_css.mipi_metadata[port][i]);
my_css.mipi_metadata[port][i] = NULL;
}
/* check if need to allocate a new metadata buffer */
if (i < my_css.num_mipi_frames[port]) {
/* allocate new metadata buffer */
my_css.mipi_metadata[port][i] = ia_css_metadata_allocate(&info->metadata_info);
if (!my_css.mipi_metadata[port][i]) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_metadata(%p, %d) failed.\n",
pipe, port);
return err;
}
}
}
}
}
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit:\n", pipe);
return err;
}
int
free_mipi_frames(struct ia_css_pipe *pipe)
{
int err = -EINVAL;
unsigned int port;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"free_mipi_frames(%p) enter:\n", pipe);
/* assert(pipe != NULL); TEMP: TODO: Should be assert only. */
if (pipe) {
assert(pipe->stream);
if ((!pipe) || (!pipe->stream)) {
IA_CSS_ERROR("free_mipi_frames(%p) exit: pipe or stream is null.",
pipe);
return -EINVAL;
}
if (pipe->stream->config.mode != IA_CSS_INPUT_MODE_BUFFERED_SENSOR) {
IA_CSS_ERROR("free_mipi_frames(%p) exit: wrong mode.",
pipe);
return err;
}
port = (unsigned int)pipe->stream->config.source.port.port;
if (port >= N_CSI_PORTS) {
IA_CSS_ERROR("free_mipi_frames(%p, %d) exit: pipe port is not correct.",
pipe, port);
return err;
}
if (ref_count_mipi_allocation[port] > 0) {
if (!IS_ISP2401) {
assert(ref_count_mipi_allocation[port] == 1);
if (ref_count_mipi_allocation[port] != 1) {
IA_CSS_ERROR("free_mipi_frames(%p) exit: wrong ref_count (ref_count=%d).",
pipe, ref_count_mipi_allocation[port]);
return err;
}
}
Annotation
- Immediate include surface: `ia_css_mipi.h`, `sh_css_mipi.h`, `type_support.h`, `system_global.h`, `ia_css_err.h`, `ia_css_pipe.h`, `ia_css_stream_format.h`, `sh_css_stream_format.h`.
- Detected declarations: `function ia_css_mipi_frame_calculate_size`, `function mipi_init`, `function sizes`, `function allocate_mipi_frames`, `function free_mipi_frames`, `function send_mipi_frames`.
- 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.