drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_params.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_params.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_params.c- Extension
.c- Size
- 16173 bytes
- Lines
- 567
- 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.
- 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
media/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmedia/v4l2-mc.hmedia/videobuf2-vmalloc.hmedia/videobuf2-v4l2.hsun6i_isp.hsun6i_isp_params.hsun6i_isp_reg.huapi/sun6i-isp-config.h
Detected Declarations
function sun6i_isp_params_configure_obfunction sun6i_isp_params_configure_aefunction sun6i_isp_params_configure_bayerfunction sun6i_isp_params_configure_wbfunction sun6i_isp_params_configure_basefunction sun6i_isp_params_configure_bdnffunction sun6i_isp_params_configure_modulesfunction sun6i_isp_params_configurefunction sun6i_isp_params_state_cleanupfunction list_for_each_entryfunction sun6i_isp_params_state_updatefunction sun6i_isp_params_state_completefunction sun6i_isp_params_queue_setupfunction sun6i_isp_params_buffer_preparefunction sun6i_isp_params_buffer_queuefunction sun6i_isp_params_start_streamingfunction sun6i_isp_params_stop_streamingfunction sun6i_isp_params_querycapfunction sun6i_isp_params_enum_fmtfunction sun6i_isp_params_g_fmtfunction sun6i_isp_params_setupfunction sun6i_isp_params_cleanup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2021-2022 Bootlin
* Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
*/
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mc.h>
#include <media/videobuf2-vmalloc.h>
#include <media/videobuf2-v4l2.h>
#include "sun6i_isp.h"
#include "sun6i_isp_params.h"
#include "sun6i_isp_reg.h"
#include "uapi/sun6i-isp-config.h"
/* Params */
static const struct sun6i_isp_params_config sun6i_isp_params_config_default = {
.modules_used = SUN6I_ISP_MODULE_BAYER,
.bayer = {
.offset_r = 32,
.offset_gr = 32,
.offset_gb = 32,
.offset_b = 32,
.gain_r = 256,
.gain_gr = 256,
.gain_gb = 256,
.gain_b = 256,
},
.bdnf = {
.in_dis_min = 8,
.in_dis_max = 16,
.coefficients_g = { 15, 4, 1 },
.coefficients_rb = { 15, 4 },
},
};
static void sun6i_isp_params_configure_ob(struct sun6i_isp_device *isp_dev)
{
unsigned int width, height;
sun6i_isp_proc_dimensions(isp_dev, &width, &height);
sun6i_isp_load_write(isp_dev, SUN6I_ISP_OB_SIZE_REG,
SUN6I_ISP_OB_SIZE_WIDTH(width) |
SUN6I_ISP_OB_SIZE_HEIGHT(height));
sun6i_isp_load_write(isp_dev, SUN6I_ISP_OB_VALID_REG,
SUN6I_ISP_OB_VALID_WIDTH(width) |
SUN6I_ISP_OB_VALID_HEIGHT(height));
sun6i_isp_load_write(isp_dev, SUN6I_ISP_OB_SRC0_VALID_START_REG,
SUN6I_ISP_OB_SRC0_VALID_START_HORZ(0) |
SUN6I_ISP_OB_SRC0_VALID_START_VERT(0));
}
static void sun6i_isp_params_configure_ae(struct sun6i_isp_device *isp_dev)
{
/* These are default values that need to be set to get an output. */
sun6i_isp_load_write(isp_dev, SUN6I_ISP_AE_CFG_REG,
SUN6I_ISP_AE_CFG_LOW_BRI_TH(0xff) |
SUN6I_ISP_AE_CFG_HORZ_NUM(8) |
SUN6I_ISP_AE_CFG_HIGH_BRI_TH(0xf00) |
SUN6I_ISP_AE_CFG_VERT_NUM(8));
}
static void
sun6i_isp_params_configure_bayer(struct sun6i_isp_device *isp_dev,
const struct sun6i_isp_params_config *config)
{
const struct sun6i_isp_params_config_bayer *bayer = &config->bayer;
sun6i_isp_load_write(isp_dev, SUN6I_ISP_BAYER_OFFSET0_REG,
SUN6I_ISP_BAYER_OFFSET0_R(bayer->offset_r) |
SUN6I_ISP_BAYER_OFFSET0_GR(bayer->offset_gr));
sun6i_isp_load_write(isp_dev, SUN6I_ISP_BAYER_OFFSET1_REG,
SUN6I_ISP_BAYER_OFFSET1_GB(bayer->offset_gb) |
SUN6I_ISP_BAYER_OFFSET1_B(bayer->offset_b));
sun6i_isp_load_write(isp_dev, SUN6I_ISP_BAYER_GAIN0_REG,
Annotation
- Immediate include surface: `media/v4l2-device.h`, `media/v4l2-event.h`, `media/v4l2-ioctl.h`, `media/v4l2-mc.h`, `media/videobuf2-vmalloc.h`, `media/videobuf2-v4l2.h`, `sun6i_isp.h`, `sun6i_isp_params.h`.
- Detected declarations: `function sun6i_isp_params_configure_ob`, `function sun6i_isp_params_configure_ae`, `function sun6i_isp_params_configure_bayer`, `function sun6i_isp_params_configure_wb`, `function sun6i_isp_params_configure_base`, `function sun6i_isp_params_configure_bdnf`, `function sun6i_isp_params_configure_modules`, `function sun6i_isp_params_configure`, `function sun6i_isp_params_state_cleanup`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/staging.
- 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.