drivers/media/platform/qcom/venus/pm_helpers.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/venus/pm_helpers.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/venus/pm_helpers.c- Extension
.c- Size
- 29127 bytes
- Lines
- 1339
- 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/clk.hlinux/interconnect.hlinux/iopoll.hlinux/kernel.hlinux/pm_domain.hlinux/pm_opp.hlinux/pm_runtime.hlinux/reset.hlinux/types.hmedia/v4l2-mem2mem.hcore.hhfi_parser.hhfi_venus_io.hpm_helpers.hhfi_platform.h
Detected Declarations
function core_clks_getfunction core_clks_enablefunction core_clks_disablefunction core_clks_set_ratefunction vcodec_clks_getfunction vcodec_clks_enablefunction vcodec_clks_disablefunction load_per_instancefunction load_per_typefunction list_for_each_entryfunction mbs_to_bwfunction load_scale_bwfunction list_for_each_entryfunction load_scale_v1function vcodec_domains_get_v1function core_get_v1function vcodec_domains_enablefunction vcodec_domains_disablefunction vcodec_domains_set_hwfunction core_put_v1function vcodec_control_v3function vdec_get_v3function vdec_power_v3function venc_get_v3function venc_power_v3function vcodec_control_v4function poweroff_coreidfunction poweron_coreidfunction power_save_mode_enablefunction move_core_to_power_save_modefunction min_loaded_corefunction list_for_each_entryfunction decide_corefunction acquire_corefunction release_corefunction coreid_power_v4function vdec_get_v4function vdec_put_v4function vdec_power_v4function venc_get_v4function venc_put_v4function venc_power_v4function vcodec_domains_get_v4function of_device_is_compatiblefunction core_resets_resetfunction core_resets_getfunction core_get_v4function core_put_v4
Annotated Snippet
if (IS_V6(core) || (IS_V4(core) && is_lite(core))) {
ret = clk_set_rate(core->clks[i], freq);
if (ret)
goto err;
}
ret = clk_prepare_enable(core->clks[i]);
if (ret)
goto err;
}
return 0;
err:
while (i--)
clk_disable_unprepare(core->clks[i]);
return ret;
}
static void core_clks_disable(struct venus_core *core)
{
const struct venus_resources *res = core->res;
unsigned int i = res->clks_num;
while (i--)
clk_disable_unprepare(core->clks[i]);
}
static int core_clks_set_rate(struct venus_core *core, unsigned long freq)
{
const struct venus_resources *res = core->res;
int ret, i;
ret = dev_pm_opp_set_rate(core->dev, freq);
if (ret)
return ret;
if (!res->vcodec_clks_num)
goto set_rates;
for (i = 0; i < res->vcodec_clks_num; i++) {
ret = clk_set_rate(core->vcodec_clks[i], freq);
if (ret)
return ret;
}
set_rates:
ret = clk_set_rate(core->vcodec0_clks[0], freq);
if (ret)
return ret;
ret = clk_set_rate(core->vcodec1_clks[0], freq);
if (ret)
return ret;
return 0;
}
static int vcodec_clks_get(struct venus_core *core, struct device *dev,
struct clk **clks, const char * const *id)
{
const struct venus_resources *res = core->res;
unsigned int i;
for (i = 0; i < res->vcodec_clks_num; i++) {
if (!id[i])
continue;
clks[i] = devm_clk_get(dev, id[i]);
if (IS_ERR(clks[i]))
return PTR_ERR(clks[i]);
}
return 0;
}
static int vcodec_clks_enable(struct venus_core *core, struct clk **clks)
{
const struct venus_resources *res = core->res;
unsigned int i;
int ret;
for (i = 0; i < res->vcodec_clks_num; i++) {
ret = clk_prepare_enable(clks[i]);
if (ret)
goto err;
}
return 0;
err:
while (i--)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/interconnect.h`, `linux/iopoll.h`, `linux/kernel.h`, `linux/pm_domain.h`, `linux/pm_opp.h`, `linux/pm_runtime.h`, `linux/reset.h`.
- Detected declarations: `function core_clks_get`, `function core_clks_enable`, `function core_clks_disable`, `function core_clks_set_rate`, `function vcodec_clks_get`, `function vcodec_clks_enable`, `function vcodec_clks_disable`, `function load_per_instance`, `function load_per_type`, `function list_for_each_entry`.
- 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.