drivers/media/platform/qcom/camss/camss-ispif.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/camss/camss-ispif.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/camss/camss-ispif.c- Extension
.c- Size
- 39517 bytes
- Lines
- 1462
- 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.
- 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/clk.hlinux/completion.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/kernel.hlinux/mutex.hlinux/platform_device.hlinux/pm_runtime.hmedia/media-entity.hmedia/v4l2-device.hmedia/v4l2-subdev.hcamss-ispif.hcamss.h
Detected Declarations
enum ispif_intf_cmdfunction ispif_isr_8x96function ispif_isr_8x16function ispif_vfe_resetfunction ispif_resetfunction ispif_set_powerfunction ispif_select_clk_muxfunction ispif_validate_intf_statusfunction ispif_wait_for_stopfunction ispif_select_csidfunction ispif_select_cidfunction ispif_config_irqfunction ispif_config_packfunction ispif_set_intf_cmdfunction ispif_set_streamfunction __ispif_get_formatfunction ispif_try_formatfunction ispif_enum_mbus_codefunction ispif_enum_frame_sizefunction ispif_get_formatfunction ispif_set_formatfunction ispif_init_formatsfunction msm_ispif_subdev_initfunction ispif_get_intffunction ispif_get_vfe_idfunction ispif_get_vfe_line_idfunction ispif_link_setupfunction msm_ispif_register_entitiesfunction msm_ispif_unregister_entities
Annotated Snippet
if (ispif->power_count) {
/* Power is already on */
ispif->power_count++;
goto exit;
}
ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
goto exit;
ret = camss_enable_clocks(ispif->nclocks, ispif->clock, dev);
if (ret < 0) {
pm_runtime_put_sync(dev);
goto exit;
}
ret = ispif_reset(ispif, line->vfe_id);
if (ret < 0) {
pm_runtime_put_sync(dev);
camss_disable_clocks(ispif->nclocks, ispif->clock);
goto exit;
}
ispif->intf_cmd[line->vfe_id].cmd_0 = CMD_ALL_NO_CHANGE;
ispif->intf_cmd[line->vfe_id].cmd_1 = CMD_ALL_NO_CHANGE;
ispif->power_count++;
} else {
if (ispif->power_count == 0) {
dev_err(dev, "ispif power off on power_count == 0\n");
goto exit;
} else if (ispif->power_count == 1) {
camss_disable_clocks(ispif->nclocks, ispif->clock);
pm_runtime_put_sync(dev);
}
ispif->power_count--;
}
exit:
mutex_unlock(&ispif->power_lock);
return ret;
}
/*
* ispif_select_clk_mux - Select clock for PIX/RDI interface
* @ispif: ISPIF device
* @intf: VFE interface
* @csid: CSID HW module id
* @vfe: VFE HW module id
* @enable: enable or disable the selected clock
*/
static void ispif_select_clk_mux(struct ispif_device *ispif,
enum ispif_intf intf, u8 csid,
u8 vfe, u8 enable)
{
u32 val;
switch (intf) {
case PIX0:
val = readl_relaxed(ispif->base_clk_mux + CSI_PIX_CLK_MUX_SEL);
val &= ~(0xf << (vfe * 8));
if (enable)
val |= (csid << (vfe * 8));
writel_relaxed(val, ispif->base_clk_mux + CSI_PIX_CLK_MUX_SEL);
break;
case RDI0:
val = readl_relaxed(ispif->base_clk_mux + CSI_RDI_CLK_MUX_SEL);
val &= ~(0xf << (vfe * 12));
if (enable)
val |= (csid << (vfe * 12));
writel_relaxed(val, ispif->base_clk_mux + CSI_RDI_CLK_MUX_SEL);
break;
case PIX1:
val = readl_relaxed(ispif->base_clk_mux + CSI_PIX_CLK_MUX_SEL);
val &= ~(0xf << (4 + (vfe * 8)));
if (enable)
val |= (csid << (4 + (vfe * 8)));
writel_relaxed(val, ispif->base_clk_mux + CSI_PIX_CLK_MUX_SEL);
break;
case RDI1:
val = readl_relaxed(ispif->base_clk_mux + CSI_RDI_CLK_MUX_SEL);
val &= ~(0xf << (4 + (vfe * 12)));
if (enable)
val |= (csid << (4 + (vfe * 12)));
writel_relaxed(val, ispif->base_clk_mux + CSI_RDI_CLK_MUX_SEL);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/completion.h`, `linux/interrupt.h`, `linux/io.h`, `linux/iopoll.h`, `linux/kernel.h`, `linux/mutex.h`, `linux/platform_device.h`.
- Detected declarations: `enum ispif_intf_cmd`, `function ispif_isr_8x96`, `function ispif_isr_8x16`, `function ispif_vfe_reset`, `function ispif_reset`, `function ispif_set_power`, `function ispif_select_clk_mux`, `function ispif_validate_intf_status`, `function ispif_wait_for_stop`, `function ispif_select_csid`.
- 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.
- 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.