drivers/media/platform/arm/mali-c55/mali-c55-params.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/arm/mali-c55/mali-c55-params.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/arm/mali-c55/mali-c55-params.c- Extension
.c- Size
- 32639 bytes
- Lines
- 941
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/media/arm/mali-c55-config.hlinux/pm_runtime.hmedia/media-entity.hmedia/v4l2-dev.hmedia/v4l2-event.hmedia/v4l2-fh.hmedia/v4l2-ioctl.hmedia/v4l2-isp.hmedia/videobuf2-core.hmedia/videobuf2-dma-contig.hmali-c55-common.hmali-c55-registers.h
Detected Declarations
function mali_c55_params_sensor_offsfunction mali_c55_params_aexp_histfunction mali_c55_params_aexp_hist_weightsfunction mali_c55_params_digital_gainfunction mali_c55_params_awb_gainsfunction mali_c55_params_awb_configfunction mali_c55_params_lsc_configfunction mali_c55_params_lsc_selectionfunction mali_c55_params_enum_fmt_meta_outfunction mali_c55_params_g_fmt_meta_outfunction mali_c55_params_querycapfunction mali_c55_params_queue_setupfunction mali_c55_params_buf_initfunction mali_c55_params_buf_cleanupfunction mali_c55_params_buf_preparefunction mali_c55_params_buf_queuefunction mali_c55_params_return_buffersfunction list_for_each_entry_safefunction mali_c55_params_start_streamingfunction mali_c55_params_stop_streamingfunction mali_c55_params_write_configfunction mali_c55_params_init_isp_configfunction mali_c55_unregister_paramsfunction mali_c55_register_params
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* ARM Mali-C55 ISP Driver - Configuration parameters output device
*
* Copyright (C) 2025 Ideas on Board Oy
*/
#include <linux/media/arm/mali-c55-config.h>
#include <linux/pm_runtime.h>
#include <media/media-entity.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fh.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-isp.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-dma-contig.h>
#include "mali-c55-common.h"
#include "mali-c55-registers.h"
/**
* union mali_c55_params_block - Generalisation of a parameter block
*
* This union allows the driver to treat a block as a generic pointer to this
* union and safely access the header and block-specific struct without having
* to resort to casting. The header member is accessed first, and the type field
* checked which allows the driver to determine which of the other members
* should be used. The data member at the end allows a pointer to an address
* within the data member of :c:type:`mali_c55_params_buffer` to initialise a
* union variable.
*
* @header: Pointer to the shared header struct embedded as the
* first member of all the possible other members (except
* @data). This member would be accessed first and the type
* field checked to determine which of the other members
* should be accessed.
* @sensor_offs: For header->type == MALI_C55_PARAM_BLOCK_SENSOR_OFFS
* @aexp_hist: For header->type == MALI_C55_PARAM_BLOCK_AEXP_HIST and
* header->type == MALI_C55_PARAM_BLOCK_AEXP_IHIST
* @aexp_weights: For header->type == MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS
* and header->type = MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS
* @digital_gain: For header->type == MALI_C55_PARAM_BLOCK_DIGITAL_GAIN
* @awb_gains: For header->type == MALI_C55_PARAM_BLOCK_AWB_GAINS and
* header->type = MALI_C55_PARAM_BLOCK_AWB_GAINS_AEXP
* @awb_config: For header->type == MALI_C55_PARAM_BLOCK_AWB_CONFIG
* @shading_config: For header->type == MALI_C55_PARAM_MESH_SHADING_CONFIG
* @shading_selection: For header->type == MALI_C55_PARAM_MESH_SHADING_SELECTION
* @data: Allows easy initialisation of a union variable with a
* pointer into a __u8 array.
*/
union mali_c55_params_block {
const struct v4l2_isp_params_block_header *header;
const struct mali_c55_params_sensor_off_preshading *sensor_offs;
const struct mali_c55_params_aexp_hist *aexp_hist;
const struct mali_c55_params_aexp_weights *aexp_weights;
const struct mali_c55_params_digital_gain *digital_gain;
const struct mali_c55_params_awb_gains *awb_gains;
const struct mali_c55_params_awb_config *awb_config;
const struct mali_c55_params_mesh_shading_config *shading_config;
const struct mali_c55_params_mesh_shading_selection *shading_selection;
const __u8 *data;
};
typedef void (*mali_c55_params_handler)(struct mali_c55 *mali_c55,
union mali_c55_params_block block);
#define to_mali_c55_params_buf(vbuf) \
container_of(vbuf, struct mali_c55_params_buf, vb)
static void mali_c55_params_sensor_offs(struct mali_c55 *mali_c55,
union mali_c55_params_block block)
{
const struct mali_c55_params_sensor_off_preshading *p;
__u32 global_offset;
p = block.sensor_offs;
if (block.header->flags & V4L2_ISP_PARAMS_FL_BLOCK_DISABLE) {
mali_c55_ctx_update_bits(mali_c55, MALI_C55_REG_BYPASS_3,
MALI_C55_REG_BYPASS_3_SENSOR_OFFSET_PRE_SH,
MALI_C55_REG_BYPASS_3_SENSOR_OFFSET_PRE_SH);
return;
}
if (!(p->chan00 || p->chan01 || p->chan10 || p->chan11))
return;
mali_c55_ctx_write(mali_c55, MALI_C55_REG_SENSOR_OFF_PRE_SHA_00,
p->chan00 & MALI_C55_SENSOR_OFF_PRE_SHA_MASK);
Annotation
- Immediate include surface: `linux/media/arm/mali-c55-config.h`, `linux/pm_runtime.h`, `media/media-entity.h`, `media/v4l2-dev.h`, `media/v4l2-event.h`, `media/v4l2-fh.h`, `media/v4l2-ioctl.h`, `media/v4l2-isp.h`.
- Detected declarations: `function mali_c55_params_sensor_offs`, `function mali_c55_params_aexp_hist`, `function mali_c55_params_aexp_hist_weights`, `function mali_c55_params_digital_gain`, `function mali_c55_params_awb_gains`, `function mali_c55_params_awb_config`, `function mali_c55_params_lsc_config`, `function mali_c55_params_lsc_selection`, `function mali_c55_params_enum_fmt_meta_out`, `function mali_c55_params_g_fmt_meta_out`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.