drivers/mfd/twl4030-power.c
Source file repositories/reference/linux-study-clean/drivers/mfd/twl4030-power.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/twl4030-power.c- Extension
.c- Size
- 26378 bytes
- Lines
- 969
- Domain
- Driver Families
- Bucket
- drivers/mfd
- 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/module.hlinux/pm.hlinux/mfd/twl.hlinux/platform_device.hlinux/property.hlinux/of.h
Detected Declarations
function twl4030_write_script_bytefunction twl4030_write_script_insfunction twl4030_write_scriptfunction twl4030_config_wakeup3_sequencefunction twl4030_config_wakeup12_sequencefunction twl4030_config_sleep_sequencefunction twl4030_config_warmreset_sequencefunction twl4030_configure_resourcefunction load_twl4030_scriptfunction twl4030_remove_scriptfunction twl4030_power_configure_scriptsfunction twl4030_patch_rconfigfunction twl4030_power_configure_resourcesfunction twl4030_starton_mask_and_setfunction twl4030_power_offfunction twl4030_power_use_powerofffunction twl4030_power_probe
Annotated Snippet
if (len == 1) {
err = twl4030_write_script_ins(address,
script->pmb_message,
script->delay,
END_OF_SCRIPT);
if (err)
break;
} else {
err = twl4030_write_script_ins(address,
script->pmb_message,
script->delay,
address + 1);
if (err)
break;
}
}
return err;
}
static int twl4030_config_wakeup3_sequence(u8 address)
{
int err;
u8 data;
/* Set SLEEP to ACTIVE SEQ address for P3 */
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, address, R_SEQ_ADD_S2A3);
if (err)
goto out;
/* P3 LVL_WAKEUP should be on LEVEL */
err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &data, R_P3_SW_EVENTS);
if (err)
goto out;
data |= PWR_LVL_WAKEUP;
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P3_SW_EVENTS);
out:
if (err)
pr_err("TWL4030 wakeup sequence for P3 config error\n");
return err;
}
static int
twl4030_config_wakeup12_sequence(const struct twl4030_power_data *pdata,
u8 address)
{
int err = 0;
u8 data;
/* Set SLEEP to ACTIVE SEQ address for P1 and P2 */
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, address, R_SEQ_ADD_S2A12);
if (err)
goto out;
/* P1/P2 LVL_WAKEUP should be on LEVEL */
err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &data, R_P1_SW_EVENTS);
if (err)
goto out;
data |= PWR_LVL_WAKEUP;
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P1_SW_EVENTS);
if (err)
goto out;
err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &data, R_P2_SW_EVENTS);
if (err)
goto out;
data |= PWR_LVL_WAKEUP;
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data, R_P2_SW_EVENTS);
if (err)
goto out;
if (pdata->ac_charger_quirk || of_machine_is_compatible("ti,omap3430-sdp") ||
of_machine_is_compatible("ti,omap3-ldp")) {
/* Disabling AC charger effect on sleep-active transitions */
err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &data,
R_CFG_P1_TRANSITION);
if (err)
goto out;
data &= ~STARTON_CHG;
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, data,
R_CFG_P1_TRANSITION);
if (err)
goto out;
}
out:
if (err)
pr_err("TWL4030 wakeup sequence for P1 and P2" \
"config error\n");
Annotation
- Immediate include surface: `linux/module.h`, `linux/pm.h`, `linux/mfd/twl.h`, `linux/platform_device.h`, `linux/property.h`, `linux/of.h`.
- Detected declarations: `function twl4030_write_script_byte`, `function twl4030_write_script_ins`, `function twl4030_write_script`, `function twl4030_config_wakeup3_sequence`, `function twl4030_config_wakeup12_sequence`, `function twl4030_config_sleep_sequence`, `function twl4030_config_warmreset_sequence`, `function twl4030_configure_resource`, `function load_twl4030_script`, `function twl4030_remove_script`.
- Atlas domain: Driver Families / drivers/mfd.
- 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.