drivers/media/platform/samsung/exynos4-is/fimc-isp.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/exynos4-is/fimc-isp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/exynos4-is/fimc-isp.c- Extension
.c- Size
- 20401 bytes
- Lines
- 788
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/errno.hlinux/kernel.hlinux/list.hlinux/module.hlinux/platform_device.hlinux/printk.hlinux/pm_runtime.hlinux/slab.hlinux/types.hmedia/v4l2-device.hmedia-dev.hfimc-isp-video.hfimc-is-command.hfimc-is-param.hfimc-is-regs.hfimc-is.h
Detected Declarations
function fimc_isp_irq_handlerfunction fimc_is_link_setupfunction fimc_is_subdev_enum_mbus_codefunction fimc_isp_subdev_get_fmtfunction __isp_subdev_try_formatfunction fimc_isp_subdev_set_fmtfunction fimc_isp_subdev_s_streamfunction fimc_isp_subdev_s_powerfunction fimc_isp_subdev_openfunction fimc_isp_subdev_registeredfunction fimc_isp_subdev_unregisteredfunction __ctrl_set_white_balancefunction __ctrl_set_aewb_lockfunction __ctrl_set_isofunction __ctrl_set_meteringfunction __ctrl_set_afcfunction __ctrl_set_image_effectfunction fimc_is_s_ctrlfunction __isp_subdev_set_default_formatfunction fimc_isp_subdev_createfunction fimc_isp_subdev_destroy
Annotated Snippet
if (fmt->pad == FIMC_ISP_SD_PAD_SRC_FIFO) {
mf->colorspace = V4L2_COLORSPACE_JPEG;
mf->code = MEDIA_BUS_FMT_YUV10_1X30;
}
}
mutex_unlock(&isp->subdev_lock);
isp_dbg(1, sd, "%s: pad%d: fmt: 0x%x, %dx%d\n", __func__,
fmt->pad, mf->code, mf->width, mf->height);
return 0;
}
static void __isp_subdev_try_format(struct fimc_isp *isp,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{
struct v4l2_mbus_framefmt *mf = &fmt->format;
struct v4l2_mbus_framefmt *format;
mf->colorspace = V4L2_COLORSPACE_SRGB;
if (fmt->pad == FIMC_ISP_SD_PAD_SINK) {
v4l_bound_align_image(&mf->width, FIMC_ISP_SINK_WIDTH_MIN,
FIMC_ISP_SINK_WIDTH_MAX, 0,
&mf->height, FIMC_ISP_SINK_HEIGHT_MIN,
FIMC_ISP_SINK_HEIGHT_MAX, 0, 0);
mf->code = MEDIA_BUS_FMT_SGRBG10_1X10;
} else {
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
format = v4l2_subdev_state_get_format(sd_state,
FIMC_ISP_SD_PAD_SINK);
else
format = &isp->sink_fmt;
/* Allow changing format only on sink pad */
mf->width = format->width - FIMC_ISP_CAC_MARGIN_WIDTH;
mf->height = format->height - FIMC_ISP_CAC_MARGIN_HEIGHT;
if (fmt->pad == FIMC_ISP_SD_PAD_SRC_FIFO) {
mf->code = MEDIA_BUS_FMT_YUV10_1X30;
mf->colorspace = V4L2_COLORSPACE_JPEG;
} else {
mf->code = format->code;
}
}
}
static int fimc_isp_subdev_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{
struct fimc_isp *isp = v4l2_get_subdevdata(sd);
struct fimc_is *is = fimc_isp_to_is(isp);
struct v4l2_mbus_framefmt *mf = &fmt->format;
int ret = 0;
isp_dbg(1, sd, "%s: pad%d: code: 0x%x, %dx%d\n",
__func__, fmt->pad, mf->code, mf->width, mf->height);
mutex_lock(&isp->subdev_lock);
__isp_subdev_try_format(isp, sd_state, fmt);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
mf = v4l2_subdev_state_get_format(sd_state, fmt->pad);
*mf = fmt->format;
/* Propagate format to the source pads */
if (fmt->pad == FIMC_ISP_SD_PAD_SINK) {
struct v4l2_subdev_format format = *fmt;
unsigned int pad;
for (pad = FIMC_ISP_SD_PAD_SRC_FIFO;
pad < FIMC_ISP_SD_PADS_NUM; pad++) {
format.pad = pad;
__isp_subdev_try_format(isp, sd_state,
&format);
mf = v4l2_subdev_state_get_format(sd_state,
pad);
*mf = format.format;
}
}
} else {
if (!media_entity_is_streaming(&sd->entity)) {
if (fmt->pad == FIMC_ISP_SD_PAD_SINK) {
struct v4l2_subdev_format format = *fmt;
isp->sink_fmt = *mf;
Annotation
- Immediate include surface: `linux/device.h`, `linux/errno.h`, `linux/kernel.h`, `linux/list.h`, `linux/module.h`, `linux/platform_device.h`, `linux/printk.h`, `linux/pm_runtime.h`.
- Detected declarations: `function fimc_isp_irq_handler`, `function fimc_is_link_setup`, `function fimc_is_subdev_enum_mbus_code`, `function fimc_isp_subdev_get_fmt`, `function __isp_subdev_try_format`, `function fimc_isp_subdev_set_fmt`, `function fimc_isp_subdev_s_stream`, `function fimc_isp_subdev_s_power`, `function fimc_isp_subdev_open`, `function fimc_isp_subdev_registered`.
- 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.