drivers/media/platform/samsung/s5p-mfc/s5p_mfc_pm.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_pm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_pm.c- Extension
.c- Size
- 2242 bytes
- Lines
- 106
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/err.hlinux/platform_device.hlinux/pm_runtime.hs5p_mfc_common.hs5p_mfc_debug.hs5p_mfc_pm.h
Detected Declarations
function Copyrightfunction s5p_mfc_final_pmfunction s5p_mfc_clock_onfunction s5p_mfc_clock_offfunction s5p_mfc_power_onfunction s5p_mfc_power_off
Annotated Snippet
if (IS_ERR(pm->clocks[i])) {
/* additional clocks are optional */
if (i && PTR_ERR(pm->clocks[i]) == -ENOENT) {
pm->clocks[i] = NULL;
continue;
}
mfc_err("Failed to get clock: %s\n",
pm->clk_names[i]);
return PTR_ERR(pm->clocks[i]);
}
}
if (dev->variant->use_clock_gating)
pm->clock_gate = pm->clocks[0];
pm_runtime_enable(pm->device);
return 0;
}
void s5p_mfc_final_pm(struct s5p_mfc_dev *dev)
{
pm_runtime_disable(dev->pm.device);
}
int s5p_mfc_clock_on(struct s5p_mfc_dev *dev)
{
return clk_enable(dev->pm.clock_gate);
}
void s5p_mfc_clock_off(struct s5p_mfc_dev *dev)
{
clk_disable(dev->pm.clock_gate);
}
int s5p_mfc_power_on(struct s5p_mfc_dev *dev)
{
int i, ret = 0;
ret = pm_runtime_resume_and_get(dev->pm.device);
if (ret < 0)
return ret;
/* clock control */
for (i = 0; i < dev->pm.num_clocks; i++) {
ret = clk_prepare_enable(dev->pm.clocks[i]);
if (ret < 0) {
mfc_err("clock prepare failed for clock: %s\n",
dev->pm.clk_names[i]);
goto err;
}
}
/* prepare for software clock gating */
clk_disable(dev->pm.clock_gate);
return 0;
err:
while (--i >= 0)
clk_disable_unprepare(dev->pm.clocks[i]);
pm_runtime_put(dev->pm.device);
return ret;
}
int s5p_mfc_power_off(struct s5p_mfc_dev *dev)
{
int i;
/* finish software clock gating */
clk_enable(dev->pm.clock_gate);
for (i = 0; i < dev->pm.num_clocks; i++)
clk_disable_unprepare(dev->pm.clocks[i]);
return pm_runtime_put_sync(dev->pm.device);
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/err.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `s5p_mfc_common.h`, `s5p_mfc_debug.h`, `s5p_mfc_pm.h`.
- Detected declarations: `function Copyright`, `function s5p_mfc_final_pm`, `function s5p_mfc_clock_on`, `function s5p_mfc_clock_off`, `function s5p_mfc_power_on`, `function s5p_mfc_power_off`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
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.