drivers/media/platform/microchip/microchip-isc-base.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/microchip/microchip-isc-base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/microchip/microchip-isc-base.c- Extension
.c- Size
- 55208 bytes
- Lines
- 1971
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/interrupt.hlinux/math64.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hlinux/videodev2.hlinux/atmel-isc-media.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-image-sizes.hmedia/v4l2-ioctl.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.hmedia/videobuf2-dma-contig.hmicrochip-isc-regs.hmicrochip-isc.h
Detected Declarations
function Controllerfunction isc_update_awb_ctrlsfunction isc_reset_awb_ctrlsfunction isc_queue_setupfunction isc_buffer_preparefunction isc_crop_pfefunction busfunction isc_start_dmafunction isc_set_pipelinefunction isc_update_profilefunction isc_set_histogramfunction isc_configurefunction isc_prepare_streamingfunction isc_start_streamingfunction isc_unprepare_streamingfunction isc_stop_streamingfunction isc_buffer_queuefunction vb2_start_streaming_calledfunction isc_querycapfunction isc_enum_fmt_vid_capfunction isc_g_fmt_vid_capfunction isc_try_validate_formatsfunction isc_try_configure_rlp_dmafunction isc_try_configure_pipelinefunction isc_try_fmtfunction isc_set_fmtfunction isc_link_validatefunction isc_s_fmt_vid_capfunction isc_try_fmt_vid_capfunction isc_enum_inputfunction isc_g_inputfunction isc_s_inputfunction isc_g_parmfunction isc_s_parmfunction isc_enum_framesizesfunction isc_openfunction isc_releasefunction microchip_isc_interruptfunction isc_hist_countfunction isc_wb_updatefunction isc_awb_workfunction isc_s_ctrlfunction isc_s_awb_ctrlfunction isc_g_volatile_awb_ctrlfunction isc_ctrl_initfunction isc_async_boundfunction isc_async_unbindfunction isc_set_default_fmt
Annotated Snippet
vb2_start_streaming_called(vb->vb2_queue)) {
isc->cur_frm = buf;
isc_start_dma(isc);
} else {
list_add_tail(&buf->list, &isc->dma_queue);
}
spin_unlock_irqrestore(&isc->dma_queue_lock, flags);
}
static const struct vb2_ops isc_vb2_ops = {
.queue_setup = isc_queue_setup,
.buf_prepare = isc_buffer_prepare,
.start_streaming = isc_start_streaming,
.stop_streaming = isc_stop_streaming,
.buf_queue = isc_buffer_queue,
.prepare_streaming = isc_prepare_streaming,
.unprepare_streaming = isc_unprepare_streaming,
};
static int isc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
strscpy(cap->driver, "microchip-isc", sizeof(cap->driver));
strscpy(cap->card, "Microchip Image Sensor Controller", sizeof(cap->card));
return 0;
}
static int isc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
struct isc_device *isc = video_drvdata(file);
u32 index = f->index;
u32 i, supported_index = 0;
struct isc_format *fmt;
/*
* If we are not asked a specific mbus_code, we have to report all
* the formats that we can output.
*/
if (!f->mbus_code) {
if (index >= isc->controller_formats_size)
return -EINVAL;
f->pixelformat = isc->controller_formats[index].fourcc;
return 0;
}
/*
* If a specific mbus_code is requested, check if we support
* this mbus_code as input for the ISC.
* If it's supported, then we report the corresponding pixelformat
* as first possible option for the ISC.
* E.g. mbus MEDIA_BUS_FMT_YUYV8_2X8 and report
* 'YUYV' (YUYV 4:2:2)
*/
fmt = isc_find_format_by_code(isc, f->mbus_code, &i);
if (!fmt)
return -EINVAL;
if (!index) {
f->pixelformat = fmt->fourcc;
return 0;
}
supported_index++;
/* If the index is not raw, we don't have anymore formats to report */
if (!ISC_IS_FORMAT_RAW(f->mbus_code))
return -EINVAL;
/*
* We are asked for a specific mbus code, which is raw.
* We have to search through the formats we can convert to.
* We have to skip the raw formats, we cannot convert to raw.
* E.g. 'AR12' (16-bit ARGB 4-4-4-4), 'AR15' (16-bit ARGB 1-5-5-5), etc.
*/
for (i = 0; i < isc->controller_formats_size; i++) {
if (isc->controller_formats[i].raw)
continue;
if (index == supported_index) {
f->pixelformat = isc->controller_formats[i].fourcc;
return 0;
}
supported_index++;
}
return -EINVAL;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/interrupt.h`, `linux/math64.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`, `linux/pm_runtime.h`.
- Detected declarations: `function Controller`, `function isc_update_awb_ctrls`, `function isc_reset_awb_ctrls`, `function isc_queue_setup`, `function isc_buffer_prepare`, `function isc_crop_pfe`, `function bus`, `function isc_start_dma`, `function isc_set_pipeline`, `function isc_update_profile`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.