drivers/media/platform/ti/omap3isp/ispccdc.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/omap3isp/ispccdc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/ti/omap3isp/ispccdc.c- Extension
.c- Size
- 78359 bytes
- Lines
- 2765
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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.
- 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/module.hlinux/uaccess.hlinux/delay.hlinux/device.hlinux/dma-mapping.hlinux/mm.hlinux/sched.hlinux/slab.hmedia/v4l2-event.hisp.hispreg.hispccdc.h
Detected Declarations
function isp_reg_readlfunction omap3isp_ccdc_busyfunction ccdc_lsc_validate_configfunction ccdc_lsc_program_tablefunction ccdc_lsc_setup_regsfunction ccdc_lsc_wait_prefetchfunction __ccdc_lsc_enablefunction ccdc_lsc_busyfunction __ccdc_lsc_configurefunction ccdc_lsc_error_handlerfunction ccdc_lsc_free_requestfunction ccdc_lsc_free_queuefunction ccdc_lsc_free_table_workfunction ccdc_lsc_configfunction ccdc_lsc_is_configuredfunction ccdc_lsc_enablefunction ccdc_configure_clampfunction ccdc_configure_fpcfunction ccdc_configure_black_compfunction ccdc_configure_lpffunction ccdc_configure_alawfunction ccdc_config_imgattrfunction ccdc_configfunction ccdc_apply_controlsfunction omap3isp_ccdc_restore_contextfunction ccdc_config_vpfunction ccdc_config_outlineoffsetfunction ccdc_set_outaddrfunction omap3isp_ccdc_max_ratefunction ccdc_config_sync_iffunction ccdc_configurefunction __ccdc_lsc_configurefunction __ccdc_enablefunction ccdc_disablefunction ccdc_enablefunction ccdc_sbl_busyfunction ccdc_sbl_wait_idlefunction ccdc_handle_stoppingfunction ccdc_hs_vs_isrfunction ccdc_lsc_isrfunction ccdc_has_all_fieldsfunction ccdc_isr_bufferfunction ccdc_vd0_isrfunction ccdc_vd1_isrfunction receivedfunction omap3isp_ccdc_isrfunction ccdc_video_queuefunction ccdc_ioctl
Annotated Snippet
if (ccdc_lsc_wait_prefetch(ccdc) < 0) {
isp_reg_clr(isp, OMAP3_ISP_IOMEM_CCDC,
ISPCCDC_LSC_CONFIG, ISPCCDC_LSC_ENABLE);
ccdc->lsc.state = LSC_STATE_STOPPED;
dev_warn(to_device(ccdc), "LSC prefetch timeout\n");
return -ETIMEDOUT;
}
ccdc->lsc.state = LSC_STATE_RUNNING;
} else {
ccdc->lsc.state = LSC_STATE_STOPPING;
}
return 0;
}
static int ccdc_lsc_busy(struct isp_ccdc_device *ccdc)
{
struct isp_device *isp = to_isp_device(ccdc);
return isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_LSC_CONFIG) &
ISPCCDC_LSC_BUSY;
}
/*
* __ccdc_lsc_configure - Apply a new configuration to the LSC engine
* @ccdc: Pointer to ISP CCDC device
* @req: New configuration request
*/
static int __ccdc_lsc_configure(struct isp_ccdc_device *ccdc,
struct ispccdc_lsc_config_req *req)
{
if (!req->enable)
return -EINVAL;
if (ccdc_lsc_validate_config(ccdc, &req->config) < 0) {
dev_dbg(to_device(ccdc), "Discard LSC configuration\n");
return -EINVAL;
}
if (ccdc_lsc_busy(ccdc))
return -EBUSY;
ccdc_lsc_setup_regs(ccdc, &req->config);
ccdc_lsc_program_table(ccdc, req->table.dma);
return 0;
}
/*
* ccdc_lsc_error_handler - Handle LSC prefetch error scenario.
* @ccdc: Pointer to ISP CCDC device.
*
* Disables LSC, and defers enablement to shadow registers update time.
*/
static void ccdc_lsc_error_handler(struct isp_ccdc_device *ccdc)
{
struct isp_device *isp = to_isp_device(ccdc);
/*
* From OMAP3 TRM: When this event is pending, the module
* goes into transparent mode (output =input). Normal
* operation can be resumed at the start of the next frame
* after:
* 1) Clearing this event
* 2) Disabling the LSC module
* 3) Enabling it
*/
isp_reg_clr(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_LSC_CONFIG,
ISPCCDC_LSC_ENABLE);
ccdc->lsc.state = LSC_STATE_STOPPED;
}
static void ccdc_lsc_free_request(struct isp_ccdc_device *ccdc,
struct ispccdc_lsc_config_req *req)
{
struct isp_device *isp = to_isp_device(ccdc);
if (req == NULL)
return;
if (req->table.addr) {
sg_free_table(&req->table.sgt);
dma_free_coherent(isp->dev, req->config.size, req->table.addr,
req->table.dma);
}
kfree(req);
}
static void ccdc_lsc_free_queue(struct isp_ccdc_device *ccdc,
struct list_head *queue)
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/uaccess.h`, `linux/delay.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/mm.h`, `linux/sched.h`, `linux/slab.h`.
- Detected declarations: `function isp_reg_readl`, `function omap3isp_ccdc_busy`, `function ccdc_lsc_validate_config`, `function ccdc_lsc_program_table`, `function ccdc_lsc_setup_regs`, `function ccdc_lsc_wait_prefetch`, `function __ccdc_lsc_enable`, `function ccdc_lsc_busy`, `function __ccdc_lsc_configure`, `function ccdc_lsc_error_handler`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.