drivers/acpi/pmic/intel_pmic.c
Source file repositories/reference/linux-study-clean/drivers/acpi/pmic/intel_pmic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/pmic/intel_pmic.c- Extension
.c- Size
- 9571 bytes
- Lines
- 379
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/export.hlinux/acpi.hlinux/mfd/intel_soc_pmic.hlinux/regmap.hacpi/acpi_lpat.hintel_pmic.h
Detected Declarations
struct intel_pmic_regs_handler_ctxstruct intel_pmic_opregionfunction pmic_get_reg_bitfunction intel_pmic_power_handlerfunction pmic_read_tempfunction pmic_thermal_tempfunction pmic_thermal_auxfunction pmic_thermal_penfunction pmic_thermal_is_tempfunction pmic_thermal_is_auxfunction pmic_thermal_is_penfunction intel_pmic_thermal_handlerfunction scoped_guardfunction intel_pmic_regs_handlerfunction intel_pmic_install_opregion_handlerfunction VBTexport intel_pmic_install_opregion_handlerexport intel_soc_pmic_exec_mipi_pmic_seq_element
Annotated Snippet
struct intel_pmic_regs_handler_ctx {
unsigned int val;
u16 addr;
};
struct intel_pmic_opregion {
struct mutex lock;
struct acpi_lpat_conversion_table *lpat_table;
struct regmap *regmap;
const struct intel_pmic_opregion_data *data;
struct intel_pmic_regs_handler_ctx ctx;
};
static struct intel_pmic_opregion *intel_pmic_opregion;
static int pmic_get_reg_bit(int address, const struct pmic_table *table,
int count, int *reg, int *bit)
{
int i;
for (i = 0; i < count; i++) {
if (table[i].address == address) {
*reg = table[i].reg;
if (bit)
*bit = table[i].bit;
return 0;
}
}
return -ENOENT;
}
static acpi_status intel_pmic_power_handler(u32 function,
acpi_physical_address address, u32 bits, u64 *value64,
void *handler_context, void *region_context)
{
struct intel_pmic_opregion *opregion = region_context;
struct regmap *regmap = opregion->regmap;
const struct intel_pmic_opregion_data *d = opregion->data;
int reg, bit, result;
if (bits != 32 || !value64)
return AE_BAD_PARAMETER;
if (function == ACPI_WRITE && !(*value64 == 0 || *value64 == 1))
return AE_BAD_PARAMETER;
result = pmic_get_reg_bit(address, d->power_table,
d->power_table_count, ®, &bit);
if (result == -ENOENT)
return AE_BAD_PARAMETER;
guard(mutex)(&opregion->lock);
result = function == ACPI_READ ?
d->get_power(regmap, reg, bit, value64) :
d->update_power(regmap, reg, bit, *value64 == 1);
return result ? AE_ERROR : AE_OK;
}
static int pmic_read_temp(struct intel_pmic_opregion *opregion,
int reg, u64 *value)
{
int raw_temp, temp;
if (!opregion->data->get_raw_temp)
return -ENXIO;
raw_temp = opregion->data->get_raw_temp(opregion->regmap, reg);
if (raw_temp < 0)
return raw_temp;
if (!opregion->lpat_table) {
*value = raw_temp;
return 0;
}
temp = opregion->data->lpat_raw_to_temp(opregion->lpat_table, raw_temp);
if (temp < 0)
return temp;
*value = temp;
return 0;
}
static int pmic_thermal_temp(struct intel_pmic_opregion *opregion, int reg,
u32 function, u64 *value)
{
return function == ACPI_READ ?
pmic_read_temp(opregion, reg, value) : -EINVAL;
Annotation
- Immediate include surface: `linux/export.h`, `linux/acpi.h`, `linux/mfd/intel_soc_pmic.h`, `linux/regmap.h`, `acpi/acpi_lpat.h`, `intel_pmic.h`.
- Detected declarations: `struct intel_pmic_regs_handler_ctx`, `struct intel_pmic_opregion`, `function pmic_get_reg_bit`, `function intel_pmic_power_handler`, `function pmic_read_temp`, `function pmic_thermal_temp`, `function pmic_thermal_aux`, `function pmic_thermal_pen`, `function pmic_thermal_is_temp`, `function pmic_thermal_is_aux`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration 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.