drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c- Extension
.c- Size
- 19977 bytes
- Lines
- 772
- 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/clk.hlinux/module.hlinux/of.hlinux/phy/phy.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hlinux/reset.hmedia/mipi-csi2.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hsun6i_mipi_csi2.hsun6i_mipi_csi2_reg.h
Detected Declarations
function sun6i_mipi_csi2_format_findfunction sun6i_mipi_csi2_enablefunction sun6i_mipi_csi2_disablefunction sun6i_mipi_csi2_configurefunction sun6i_mipi_csi2_s_streamfunction sun6i_mipi_csi2_mbus_format_preparefunction sun6i_mipi_csi2_init_statefunction sun6i_mipi_csi2_enum_mbus_codefunction sun6i_mipi_csi2_get_fmtfunction sun6i_mipi_csi2_set_fmtfunction sun6i_mipi_csi2_notifier_boundfunction sun6i_mipi_csi2_bridge_source_setupfunction sun6i_mipi_csi2_bridge_setupfunction sun6i_mipi_csi2_bridge_cleanupfunction sun6i_mipi_csi2_suspendfunction sun6i_mipi_csi2_resumefunction sun6i_mipi_csi2_resources_setupfunction sun6i_mipi_csi2_resources_cleanupfunction sun6i_mipi_csi2_probefunction sun6i_mipi_csi2_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2020-2022 Bootlin
* Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
*/
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/reset.h>
#include <media/mipi-csi2.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include "sun6i_mipi_csi2.h"
#include "sun6i_mipi_csi2_reg.h"
/* Format */
static const struct sun6i_mipi_csi2_format sun6i_mipi_csi2_formats[] = {
{
.mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8,
.data_type = MIPI_CSI2_DT_RAW8,
.bpp = 8,
},
{
.mbus_code = MEDIA_BUS_FMT_SGBRG8_1X8,
.data_type = MIPI_CSI2_DT_RAW8,
.bpp = 8,
},
{
.mbus_code = MEDIA_BUS_FMT_SGRBG8_1X8,
.data_type = MIPI_CSI2_DT_RAW8,
.bpp = 8,
},
{
.mbus_code = MEDIA_BUS_FMT_SRGGB8_1X8,
.data_type = MIPI_CSI2_DT_RAW8,
.bpp = 8,
},
{
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
.data_type = MIPI_CSI2_DT_RAW10,
.bpp = 10,
},
{
.mbus_code = MEDIA_BUS_FMT_SGBRG10_1X10,
.data_type = MIPI_CSI2_DT_RAW10,
.bpp = 10,
},
{
.mbus_code = MEDIA_BUS_FMT_SGRBG10_1X10,
.data_type = MIPI_CSI2_DT_RAW10,
.bpp = 10,
},
{
.mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10,
.data_type = MIPI_CSI2_DT_RAW10,
.bpp = 10,
},
};
static const struct sun6i_mipi_csi2_format *
sun6i_mipi_csi2_format_find(u32 mbus_code)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(sun6i_mipi_csi2_formats); i++)
if (sun6i_mipi_csi2_formats[i].mbus_code == mbus_code)
return &sun6i_mipi_csi2_formats[i];
return NULL;
}
/* Controller */
static void sun6i_mipi_csi2_enable(struct sun6i_mipi_csi2_device *csi2_dev)
{
struct regmap *regmap = csi2_dev->regmap;
regmap_update_bits(regmap, SUN6I_MIPI_CSI2_CTL_REG,
SUN6I_MIPI_CSI2_CTL_EN, SUN6I_MIPI_CSI2_CTL_EN);
}
static void sun6i_mipi_csi2_disable(struct sun6i_mipi_csi2_device *csi2_dev)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/of.h`, `linux/phy/phy.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/reset.h`.
- Detected declarations: `function sun6i_mipi_csi2_format_find`, `function sun6i_mipi_csi2_enable`, `function sun6i_mipi_csi2_disable`, `function sun6i_mipi_csi2_configure`, `function sun6i_mipi_csi2_s_stream`, `function sun6i_mipi_csi2_mbus_format_prepare`, `function sun6i_mipi_csi2_init_state`, `function sun6i_mipi_csi2_enum_mbus_code`, `function sun6i_mipi_csi2_get_fmt`, `function sun6i_mipi_csi2_set_fmt`.
- 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.