drivers/soc/ti/smartreflex.c
Source file repositories/reference/linux-study-clean/drivers/soc/ti/smartreflex.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/ti/smartreflex.c- Extension
.c- Size
- 26944 bytes
- Lines
- 1005
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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 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/mod_devicetable.hlinux/interrupt.hlinux/clk.hlinux/io.hlinux/debugfs.hlinux/delay.hlinux/slab.hlinux/pm_runtime.hlinux/power/smartreflex.h
Detected Declarations
function sr_write_regfunction sr_modify_regfunction sr_read_regfunction list_for_each_entryfunction sr_interruptfunction sr_set_clk_lengthfunction sr_start_vddautocompfunction sr_stop_vddautocompfunction sr_late_initfunction sr_v1_disablefunction sr_v2_disablefunction sr_configure_errgenfunction sr_disable_errgenfunction sr_configure_minmaxfunction sr_enablefunction sr_disablefunction sr_register_classfunction omap_sr_enablefunction omap_sr_disablefunction omap_sr_disable_reset_voltfunction omap_sr_autocomp_showfunction omap_sr_autocomp_storefunction omap_sr_probefunction omap_sr_removefunction omap_sr_shutdownfunction sr_initfunction sr_exit
Annotated Snippet
switch (sr->ip_type) {
case SR_TYPE_V1:
sr_v1_disable(sr);
break;
case SR_TYPE_V2:
sr_v2_disable(sr);
break;
default:
dev_err(&sr->pdev->dev, "UNKNOWN IP type %d\n",
sr->ip_type);
}
}
clk_disable(sr->fck);
sr->enabled = 0;
}
/**
* sr_register_class() - API to register a smartreflex class parameters.
* @class_data: The structure containing various sr class specific data.
*
* This API is to be called by the smartreflex class driver to register itself
* with the smartreflex driver during init. Returns 0 on success else the
* error value.
*/
int sr_register_class(struct omap_sr_class_data *class_data)
{
struct omap_sr *sr_info;
if (!class_data) {
pr_warn("%s:, Smartreflex class data passed is NULL\n",
__func__);
return -EINVAL;
}
if (sr_class) {
pr_warn("%s: Smartreflex class driver already registered\n",
__func__);
return -EBUSY;
}
sr_class = class_data;
/*
* Call into late init to do initializations that require
* both sr driver and sr class driver to be initiallized.
*/
list_for_each_entry(sr_info, &sr_list, node)
sr_late_init(sr_info);
return 0;
}
/**
* omap_sr_enable() - API to enable SR clocks and to call into the
* registered smartreflex class enable API.
* @voltdm: VDD pointer to which the SR module to be configured belongs to.
*
* This API is to be called from the kernel in order to enable
* a particular smartreflex module. This API will do the initial
* configurations to turn on the smartreflex module and in turn call
* into the registered smartreflex class enable API.
*/
void omap_sr_enable(struct voltagedomain *voltdm)
{
struct omap_sr *sr = _sr_lookup(voltdm);
if (IS_ERR(sr)) {
pr_warn("%s: omap_sr struct for voltdm not found\n", __func__);
return;
}
if (!sr->autocomp_active)
return;
if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not registered\n",
__func__);
return;
}
sr_class->enable(sr);
}
/**
* omap_sr_disable() - API to disable SR without resetting the voltage
* processor voltage
* @voltdm: VDD pointer to which the SR module to be configured belongs to.
*
* This API is to be called from the kernel in order to disable
Annotation
- Immediate include surface: `linux/module.h`, `linux/mod_devicetable.h`, `linux/interrupt.h`, `linux/clk.h`, `linux/io.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/slab.h`.
- Detected declarations: `function sr_write_reg`, `function sr_modify_reg`, `function sr_read_reg`, `function list_for_each_entry`, `function sr_interrupt`, `function sr_set_clk_length`, `function sr_start_vddautocomp`, `function sr_stop_vddautocomp`, `function sr_late_init`, `function sr_v1_disable`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: source implementation candidate.
- 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.