drivers/staging/media/atomisp/pci/sh_css.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/sh_css.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/sh_css.c- Extension
.c- Size
- 260211 bytes
- Lines
- 9062
- 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
linux/mm.hlinux/slab.hlinux/string_choices.hlinux/vmalloc.hhmm.hatomisp_internal.hia_css.hsh_css_hrt.hia_css_buffer.hia_css_binary.hsh_css_internal.hsh_css_mipi.hsh_css_sp.hia_css_isys.hia_css_frame.hsh_css_defs.hsh_css_firmware.hsh_css_params.hsh_css_params_internal.hsh_css_param_shading.hia_css_refcount.hia_css_rmgr.hia_css_debug.hia_css_debug_pipe.hia_css_device_access.hdevice_access.hsh_css_legacy.hia_css_pipeline.hia_css_stream.hsh_css_stream_format.hia_css_pipe.hia_css_util.h
Detected Declarations
struct sh_css_stream_seedstruct sh_css_savestruct sh_css_hmm_buffer_recordenum ia_sh_css_modesfunction sh_css_pipe_free_shading_tablefunction verify_copy_out_frame_formatfunction ia_css_stream_input_format_bits_per_pixelfunction sh_css_config_input_network_2400function csi2_protocol_calculate_max_subpixels_per_linefunction sh_css_translate_stream_cfg_to_input_system_input_port_idfunction sh_css_translate_stream_cfg_to_input_system_input_port_typefunction sh_css_translate_stream_cfg_to_input_system_input_port_attrfunction sh_css_translate_stream_cfg_to_input_system_input_port_resolutionfunction sh_css_translate_stream_cfg_to_isys_stream_descrfunction sh_css_translate_binary_info_to_input_system_output_port_attrfunction sh_css_config_input_network_2401function stream_csi_rx_helperfunction stream_register_with_csi_rxfunction stream_unregister_with_csi_rxfunction start_binaryfunction start_copy_on_spfunction sh_css_binary_args_resetfunction start_pipefunction sh_css_invalidate_shading_tablesfunction enable_interruptsfunction sh_css_setup_spctrl_configfunction ia_css_unload_firmwarefunction ia_css_reset_defaultsfunction ia_css_load_firmwarefunction ia_css_initfunction ia_css_enable_isys_event_queuefunction map_sp_threadsfunction create_host_pipeline_structurefunction create_host_pipelinefunction init_pipe_defaultsfunction pipe_global_initfunction pipe_generate_pipe_numfunction pipe_release_pipe_numfunction create_pipefunction find_pipe_by_numfunction ia_css_pipe_destroyfunction ia_css_uninitfunction ia_css_irq_translatefunction ia_css_irq_enablefunction sh_css_get_sw_interrupt_valuefunction load_copy_binaryfunction alloc_continuous_framesfunction ia_css_alloc_continuous_frame_remain
Annotated Snippet
struct sh_css_stream_seed {
struct ia_css_stream **orig_stream;
struct ia_css_stream *stream;
struct ia_css_stream_config stream_config;
int num_pipes;
struct ia_css_pipe *pipes[IA_CSS_PIPE_ID_NUM];
struct ia_css_pipe **orig_pipes[IA_CSS_PIPE_ID_NUM];
struct ia_css_pipe_config pipe_config[IA_CSS_PIPE_ID_NUM];
};
#define MAX_ACTIVE_STREAMS 5
/*
* A global struct for save/restore to hold all the data that should
* sustain power-down: MMU base, IRQ type, env for routines, binary loaded FW
* and the stream seeds.
*/
struct sh_css_save {
enum ia_sh_css_modes mode;
u32 mmu_base; /* the last mmu_base */
enum ia_css_irq_type irq_type;
struct sh_css_stream_seed stream_seeds[MAX_ACTIVE_STREAMS];
struct ia_css_fw *loaded_fw; /* fw struct previously loaded */
struct ia_css_env driver_env; /* driver-supplied env copy */
};
static bool my_css_save_initialized; /* if my_css_save was initialized */
static struct sh_css_save my_css_save;
/*
* pqiao NOTICE: this is for css internal buffer recycling when stopping
* pipeline,
* this array is temporary and will be replaced by resource manager
*/
/* Taking the biggest Size for number of Elements */
#define MAX_HMM_BUFFER_NUM \
(SH_CSS_MAX_NUM_QUEUES * (IA_CSS_NUM_ELEMS_SP2HOST_BUFFER_QUEUE + 2))
struct sh_css_hmm_buffer_record {
bool in_use;
enum ia_css_buffer_type type;
struct ia_css_rmgr_vbuf_handle *h_vbuf;
hrt_address kernel_ptr;
};
static struct sh_css_hmm_buffer_record hmm_buffer_record[MAX_HMM_BUFFER_NUM];
#define GPIO_FLASH_PIN_MASK BIT(HIVE_GPIO_STROBE_TRIGGER_PIN)
/*
* Local prototypes
*/
static int
allocate_delay_frames(struct ia_css_pipe *pipe);
static int
sh_css_pipe_start(struct ia_css_stream *stream);
/*
* @brief Check if all "ia_css_pipe" instances in the target
* "ia_css_stream" instance have stopped.
*
* @param[in] stream Point to the target "ia_css_stream" instance.
*
* @return
* - true, if all "ia_css_pipe" instances in the target "ia_css_stream"
* instance have ben stopped.
* - false, otherwise.
*/
/* ISP 2401 */
static int
ia_css_pipe_check_format(struct ia_css_pipe *pipe,
enum ia_css_frame_format format);
/* ISP 2401 */
static void
ia_css_reset_defaults(struct sh_css *css);
static void
sh_css_init_host_sp_control_vars(void);
static int
set_num_primary_stages(unsigned int *num, enum ia_css_pipe_version version);
static bool
need_capture_pp(const struct ia_css_pipe *pipe);
static bool
Annotation
- Immediate include surface: `linux/mm.h`, `linux/slab.h`, `linux/string_choices.h`, `linux/vmalloc.h`, `hmm.h`, `atomisp_internal.h`, `ia_css.h`, `sh_css_hrt.h`.
- Detected declarations: `struct sh_css_stream_seed`, `struct sh_css_save`, `struct sh_css_hmm_buffer_record`, `enum ia_sh_css_modes`, `function sh_css_pipe_free_shading_table`, `function verify_copy_out_frame_format`, `function ia_css_stream_input_format_bits_per_pixel`, `function sh_css_config_input_network_2400`, `function csi2_protocol_calculate_max_subpixels_per_line`, `function sh_css_translate_stream_cfg_to_input_system_input_port_id`.
- 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.