include/linux/regmap.h
Source file repositories/reference/linux-study-clean/include/linux/regmap.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/regmap.h- Extension
.h- Size
- 76478 bytes
- Lines
- 2166
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bug.hlinux/cleanup.hlinux/delay.hlinux/err.hlinux/fwnode.hlinux/iopoll.hlinux/ktime.hlinux/list.hlinux/lockdep.hlinux/rbtree.h
Detected Declarations
struct modulestruct clkstruct devicestruct device_nodestruct fsi_devicestruct i2c_clientstruct i3c_devicestruct irq_domainstruct mdio_devicestruct slim_devicestruct spi_devicestruct spmi_devicestruct regmapstruct regmap_range_cfgstruct regmap_fieldstruct snd_ac97struct sdw_slavestruct reg_defaultstruct reg_sequencestruct regmap_rangestruct regmap_access_tablestruct regmap_configstruct regmap_range_cfgstruct regmap_sdw_mbq_cfgstruct regmap_asyncstruct regmap_busstruct reg_fieldstruct regmap_irq_typestruct regmap_irqstruct regmap_irq_sub_irq_mapstruct regmap_irq_chip_datastruct regmap_irq_chipenum regcache_typeenum regmap_endianfunction regmap_update_bitsfunction regmap_update_bits_asyncfunction regmap_update_bits_checkfunction regmap_update_bits_check_asyncfunction regmap_write_bitsfunction regmap_default_zero_cbfunction regmap_reg_in_rangefunction regmap_set_bitsfunction regmap_clear_bitsfunction regmap_assign_bitsfunction regmap_field_writefunction regmap_field_force_writefunction regmap_field_update_bitsfunction regmap_field_set_bits
Annotated Snippet
struct reg_default {
unsigned int reg;
unsigned int def;
};
/**
* struct reg_sequence - An individual write from a sequence of writes.
*
* @reg: Register address.
* @def: Register value.
* @delay_us: Delay to be applied after the register write in microseconds
*
* Register/value pairs for sequences of writes with an optional delay in
* microseconds to be applied after each write.
*/
struct reg_sequence {
unsigned int reg;
unsigned int def;
unsigned int delay_us;
};
#define REG_SEQ(_reg, _def, _delay_us) { \
.reg = _reg, \
.def = _def, \
.delay_us = _delay_us, \
}
#define REG_SEQ0(_reg, _def) REG_SEQ(_reg, _def, 0)
/**
* regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
*
* @map: Regmap to read from
* @addr: Address to poll
* @val: Unsigned integer variable to read the value into
* @cond: Break condition (usually involving @val)
* @sleep_us: Maximum time to sleep between reads in us (0 tight-loops). Please
* read usleep_range() function description for details and
* limitations.
* @timeout_us: Timeout in us, 0 means never timeout
*
* This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
*
* Returns: 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
* error return value in case of a error read. In the two former cases,
* the last read value at @addr is stored in @val. Must not be called
* from atomic context if sleep_us or timeout_us are used.
*/
#define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
({ \
int __ret, __tmp; \
__tmp = read_poll_timeout(regmap_read, __ret, __ret || (cond), \
sleep_us, timeout_us, false, (map), (addr), &(val)); \
__ret ?: __tmp; \
})
/**
* regmap_read_poll_timeout_atomic - Poll until a condition is met or a timeout occurs
*
* @map: Regmap to read from
* @addr: Address to poll
* @val: Unsigned integer variable to read the value into
* @cond: Break condition (usually involving @val)
* @delay_us: Time to udelay between reads in us (0 tight-loops). Please
* read udelay() function description for details and
* limitations.
* @timeout_us: Timeout in us, 0 means never timeout
*
* This is modelled after the readx_poll_timeout_atomic macros in linux/iopoll.h.
*
* Note: In general regmap cannot be used in atomic context. If you want to use
* this macro then first setup your regmap for atomic use (flat or no cache
* and MMIO regmap).
*
* Returns: 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
* error return value in case of a error read. In the two former cases,
* the last read value at @addr is stored in @val.
*/
#define regmap_read_poll_timeout_atomic(map, addr, val, cond, delay_us, timeout_us) \
({ \
u64 __timeout_us = (timeout_us); \
unsigned long __delay_us = (delay_us); \
ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
int __ret; \
for (;;) { \
__ret = regmap_read((map), (addr), &(val)); \
if (__ret) \
break; \
if (cond) \
break; \
if ((__timeout_us) && \
Annotation
- Immediate include surface: `linux/bug.h`, `linux/cleanup.h`, `linux/delay.h`, `linux/err.h`, `linux/fwnode.h`, `linux/iopoll.h`, `linux/ktime.h`, `linux/list.h`.
- Detected declarations: `struct module`, `struct clk`, `struct device`, `struct device_node`, `struct fsi_device`, `struct i2c_client`, `struct i3c_device`, `struct irq_domain`, `struct mdio_device`, `struct slim_device`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.