drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_proc.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_proc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_proc.c- Extension
.c- Size
- 14950 bytes
- Lines
- 582
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pm_runtime.hlinux/regmap.hmedia/v4l2-device.hmedia/v4l2-fwnode.hsun6i_isp.hsun6i_isp_capture.hsun6i_isp_params.hsun6i_isp_proc.hsun6i_isp_reg.h
Detected Declarations
function sun6i_isp_proc_dimensionsfunction sun6i_isp_proc_irq_enablefunction sun6i_isp_proc_irq_disablefunction sun6i_isp_proc_irq_clearfunction sun6i_isp_proc_enablefunction sun6i_isp_proc_disablefunction sun6i_isp_proc_configurefunction sun6i_isp_proc_s_streamfunction sun6i_isp_proc_mbus_format_preparefunction sun6i_isp_proc_init_statefunction sun6i_isp_proc_enum_mbus_codefunction sun6i_isp_proc_get_fmtfunction sun6i_isp_proc_set_fmtfunction sun6i_isp_proc_linkfunction sun6i_isp_proc_notifier_boundfunction sun6i_isp_proc_notifier_completefunction sun6i_isp_proc_source_setupfunction sun6i_isp_proc_setupfunction sun6i_isp_proc_cleanup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2021-2022 Bootlin
* Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
*/
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include "sun6i_isp.h"
#include "sun6i_isp_capture.h"
#include "sun6i_isp_params.h"
#include "sun6i_isp_proc.h"
#include "sun6i_isp_reg.h"
/* Helpers */
void sun6i_isp_proc_dimensions(struct sun6i_isp_device *isp_dev,
unsigned int *width, unsigned int *height)
{
if (width)
*width = isp_dev->proc.mbus_format.width;
if (height)
*height = isp_dev->proc.mbus_format.height;
}
/* Format */
static const struct sun6i_isp_proc_format sun6i_isp_proc_formats[] = {
{
.mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8,
.input_format = SUN6I_ISP_INPUT_FMT_RAW_BGGR,
},
{
.mbus_code = MEDIA_BUS_FMT_SGBRG8_1X8,
.input_format = SUN6I_ISP_INPUT_FMT_RAW_GBRG,
},
{
.mbus_code = MEDIA_BUS_FMT_SGRBG8_1X8,
.input_format = SUN6I_ISP_INPUT_FMT_RAW_GRBG,
},
{
.mbus_code = MEDIA_BUS_FMT_SRGGB8_1X8,
.input_format = SUN6I_ISP_INPUT_FMT_RAW_RGGB,
},
{
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
.input_format = SUN6I_ISP_INPUT_FMT_RAW_BGGR,
},
{
.mbus_code = MEDIA_BUS_FMT_SGBRG10_1X10,
.input_format = SUN6I_ISP_INPUT_FMT_RAW_GBRG,
},
{
.mbus_code = MEDIA_BUS_FMT_SGRBG10_1X10,
.input_format = SUN6I_ISP_INPUT_FMT_RAW_GRBG,
},
{
.mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10,
.input_format = SUN6I_ISP_INPUT_FMT_RAW_RGGB,
},
};
const struct sun6i_isp_proc_format *sun6i_isp_proc_format_find(u32 mbus_code)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(sun6i_isp_proc_formats); i++)
if (sun6i_isp_proc_formats[i].mbus_code == mbus_code)
return &sun6i_isp_proc_formats[i];
return NULL;
}
/* Processor */
static void sun6i_isp_proc_irq_enable(struct sun6i_isp_device *isp_dev)
{
struct regmap *regmap = isp_dev->regmap;
regmap_write(regmap, SUN6I_ISP_FE_INT_EN_REG,
SUN6I_ISP_FE_INT_EN_FINISH |
SUN6I_ISP_FE_INT_EN_START |
SUN6I_ISP_FE_INT_EN_PARA_SAVE |
SUN6I_ISP_FE_INT_EN_PARA_LOAD |
SUN6I_ISP_FE_INT_EN_SRC0_FIFO |
SUN6I_ISP_FE_INT_EN_ROT_FINISH);
Annotation
- Immediate include surface: `linux/pm_runtime.h`, `linux/regmap.h`, `media/v4l2-device.h`, `media/v4l2-fwnode.h`, `sun6i_isp.h`, `sun6i_isp_capture.h`, `sun6i_isp_params.h`, `sun6i_isp_proc.h`.
- Detected declarations: `function sun6i_isp_proc_dimensions`, `function sun6i_isp_proc_irq_enable`, `function sun6i_isp_proc_irq_disable`, `function sun6i_isp_proc_irq_clear`, `function sun6i_isp_proc_enable`, `function sun6i_isp_proc_disable`, `function sun6i_isp_proc_configure`, `function sun6i_isp_proc_s_stream`, `function sun6i_isp_proc_mbus_format_prepare`, `function sun6i_isp_proc_init_state`.
- 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.