drivers/i2c/busses/i2c-stm32f7.c
Source file repositories/reference/linux-study-clean/drivers/i2c/busses/i2c-stm32f7.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i2c/busses/i2c-stm32f7.c- Extension
.c- Size
- 68845 bytes
- Lines
- 2530
- Domain
- Driver Families
- Bucket
- drivers/i2c
- 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/clk.hlinux/delay.hlinux/err.hlinux/i2c.hlinux/i2c-smbus.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_platform.hlinux/platform_device.hlinux/pinctrl/consumer.hlinux/pm_runtime.hlinux/pm_wakeirq.hlinux/regmap.hlinux/reset.hlinux/slab.hlinux/string_choices.hi2c-stm32.h
Detected Declarations
struct stm32f7_i2c_regsstruct stm32f7_i2c_specstruct stm32f7_i2c_setupstruct stm32f7_i2c_timingsstruct stm32f7_i2c_msgstruct stm32f7_i2c_alertstruct stm32f7_i2c_devfunction stm32f7_i2c_set_bitsfunction stm32f7_i2c_clr_bitsfunction stm32f7_i2c_disable_irqfunction stm32f7_i2c_compute_timingfunction stm32f7_get_lower_ratefunction stm32f7_i2c_setup_timingfunction stm32f7_i2c_disable_dma_reqfunction stm32f7_i2c_dma_callbackfunction stm32f7_i2c_hw_configfunction stm32f7_i2c_write_tx_datafunction stm32f7_i2c_read_rx_datafunction stm32f7_i2c_reloadfunction stm32f7_i2c_smbus_reloadfunction stm32f7_i2c_release_busfunction stm32f7_i2c_wait_free_busfunction stm32f7_i2c_xfer_msgfunction stm32f7_i2c_smbus_xfer_msgfunction stm32f7_i2c_smbus_rep_startfunction stm32f7_i2c_smbus_check_pecfunction stm32f7_i2c_is_addr_matchfunction stm32f7_i2c_slave_startfunction stm32f7_i2c_slave_addrfunction stm32f7_i2c_get_slave_idfunction stm32f7_i2c_get_free_slave_idfunction stm32f7_i2c_is_slave_registeredfunction stm32f7_i2c_is_slave_busyfunction stm32f7_i2c_slave_isr_eventfunction stm32f7_i2c_handle_isr_errsfunction stm32f7_i2c_isr_eventfunction stm32f7_i2c_isr_event_threadfunction stm32f7_i2c_isr_error_threadfunction stm32f7_i2c_wait_pollingfunction stm32f7_i2c_xfer_corefunction stm32f7_i2c_xferfunction stm32f7_i2c_xfer_atomicfunction stm32f7_i2c_smbus_xferfunction stm32f7_i2c_enable_wakeupfunction stm32f7_i2c_reg_slavefunction stm32f7_i2c_unreg_slavefunction stm32f7_i2c_write_fm_plus_bitsfunction stm32f7_i2c_setup_fm_plus_bits
Annotated Snippet
struct stm32f7_i2c_regs {
u32 cr1;
u32 cr2;
u32 oar1;
u32 oar2;
u32 tmgr;
};
/**
* struct stm32f7_i2c_spec - private i2c specification timing
* @rate: I2C bus speed (Hz)
* @fall_max: Max fall time of both SDA and SCL signals (ns)
* @rise_max: Max rise time of both SDA and SCL signals (ns)
* @hddat_min: Min data hold time (ns)
* @vddat_max: Max data valid time (ns)
* @sudat_min: Min data setup time (ns)
* @l_min: Min low period of the SCL clock (ns)
* @h_min: Min high period of the SCL clock (ns)
*/
struct stm32f7_i2c_spec {
u32 rate;
u32 fall_max;
u32 rise_max;
u32 hddat_min;
u32 vddat_max;
u32 sudat_min;
u32 l_min;
u32 h_min;
};
/**
* struct stm32f7_i2c_setup - private I2C timing setup parameters
* @speed_freq: I2C speed frequency (Hz)
* @clock_src: I2C clock source frequency (Hz)
* @rise_time: Rise time (ns)
* @fall_time: Fall time (ns)
* @fmp_clr_offset: Fast Mode Plus clear register offset from set register
* @single_it_line: Only a single IT line is used for both events/errors
* @fmp_cr1_bit: Fast Mode Plus control is done via a bit in CR1
*/
struct stm32f7_i2c_setup {
u32 speed_freq;
u32 clock_src;
u32 rise_time;
u32 fall_time;
u32 fmp_clr_offset;
bool single_it_line;
bool fmp_cr1_bit;
};
/**
* struct stm32f7_i2c_timings - private I2C output parameters
* @node: List entry
* @presc: Prescaler value
* @scldel: Data setup time
* @sdadel: Data hold time
* @sclh: SCL high period (master mode)
* @scll: SCL low period (master mode)
*/
struct stm32f7_i2c_timings {
struct list_head node;
u8 presc;
u8 scldel;
u8 sdadel;
u8 sclh;
u8 scll;
};
/**
* struct stm32f7_i2c_msg - client specific data
* @addr: 8-bit or 10-bit slave addr, including r/w bit
* @count: number of bytes to be transferred
* @buf: data buffer
* @result: result of the transfer
* @stop: last I2C msg to be sent, i.e. STOP to be generated
* @smbus: boolean to know if the I2C IP is used in SMBus mode
* @size: type of SMBus protocol
* @read_write: direction of SMBus protocol
* SMBus block read and SMBus block write - block read process call protocols
* @smbus_buf: buffer to be used for SMBus protocol transfer. It will
* contain a maximum of 32 bytes of data + byte command + byte count + PEC
* This buffer has to be 32-bit aligned to be compliant with memory address
* register in DMA mode.
*/
struct stm32f7_i2c_msg {
u16 addr;
u32 count;
u8 *buf;
int result;
bool stop;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/err.h`, `linux/i2c.h`, `linux/i2c-smbus.h`, `linux/interrupt.h`, `linux/io.h`, `linux/iopoll.h`.
- Detected declarations: `struct stm32f7_i2c_regs`, `struct stm32f7_i2c_spec`, `struct stm32f7_i2c_setup`, `struct stm32f7_i2c_timings`, `struct stm32f7_i2c_msg`, `struct stm32f7_i2c_alert`, `struct stm32f7_i2c_dev`, `function stm32f7_i2c_set_bits`, `function stm32f7_i2c_clr_bits`, `function stm32f7_i2c_disable_irq`.
- Atlas domain: Driver Families / drivers/i2c.
- 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.