STRUCT I2C_BUS_RECOVERY_INFO(9)
β¨ struct i2c_bus_recovery_info β¨
Okay so bestie, this is the kernel API manual for struct i2c_bus_recovery_info β it's literally the whole vibe for I2C bus recovery info π
. If your I2C bus is acting up and needs a glow-up, this struct is the main character energy you need. Let's get into it fr fr.
πΈ NAME πΈ
struct i2c_bus_recovery_info β I2C bus recovery information π
π¦ SYNOPSIS π¦
struct i2c_bus_recovery_info {
int (*recover_bus)(struct i2c_adapter *adap);
int (*get_scl)(struct i2c_adapter *adap);
void (*set_scl)(struct i2c_adapter *adap, int val);
int (*get_sda)(struct i2c_adapter *adap);
void (*set_sda)(struct i2c_adapter *adap, int val);
int (*get_bus_free)(struct i2c_adapter *adap);
void (*prepare_recovery)(struct i2c_adapter *adap);
void (*unprepare_recovery)(struct i2c_adapter *adap);
struct gpio_desc *scl_gpiod;
struct gpio_desc *sda_gpiod;
struct pinctrl *pinctrl;
struct pinctrl_state *pins_default;
struct pinctrl_state *pins_gpio;
};
π Members π
Let's do a little member-by-member tour, because each one is iconic in its own way π
recover_busβ the actual recover routine, the star of the show. You either pass in your driver's ownrecover_busroutine, or you go withi2c_generic_scl_recovery. Slay.get_sclβ this one gets the current value of the SCL line, like checking the temperature of the situation. It's mandatory for generic SCL recovery. And for generic GPIO recovery? It gets populated internally, no cap. π«Άset_sclβ sets and clears the SCL line. Mandatory for generic SCL recovery, bestie. Populated internally for generic GPIO recovery. It's giving "I handle my own business."get_sdaβ grabs the current value of the SDA line. This orset_sdais mandatory for generic SCL recovery. Ifsda_gpiois a valid GPIO, it gets populated internally for generic GPIO recovery. π«set_sdaβ sets and clears the SDA line. This orget_sdais mandatory for generic SCL recovery. Populated internally ifsda_gpiois a valid GPIO, for generic GPIO recovery. Periodt.get_bus_freeβ returns the bus free state as seen from the IP core, for when it has more complex internal logic than just reading SDA. Totally optional, lowkey. πprepare_recoveryβ this gets called before starting recovery. Your platform can configure padmux here for the SDA/SCL line, or whatever else they want. Do your little pre-game ritual πunprepare_recoveryβ called after completing recovery. Platform may configure padmux here for SDA/SCL line, or anything else they want. The post-game debrief, if you will β¨scl_gpiodβ thegpiodof the SCL line. Only required for GPIO recovery, bestie.sda_gpiodβ thegpiodof the SDA line. Again, only required for GPIO recovery.pinctrlβ the pinctrl used by GPIO recovery to change the state of the I2C pins. Optional, no pressure πpins_defaultβ default pinctrl state of SCL/SDA lines when they're assigned to the I2C bus. Optional. It gets populated internally for GPIO recovery if a state namedPINCTRL_STATE_DEFAULTis found andpinctrlis valid. πpins_gpioβ recovery pinctrl state of SCL/SDA lines when they're used as GPIOs. Optional. Populated internally for GPIO recovery if this state is called"gpio"or"recovery"andpinctrlis valid. Obsessed with the flexibility ngl.
π₯ SEE ALSO π₯
Kernel file ./include/linux/i2c.h β plus the whole friend group:
i2c_master_recv(9), i2c_master_recv_dmasafe(9), i2c_master_send(9), i2c_master_send_dmasafe(9), struct i2c_device_identity(9), enum i2c_driver_flags(9), struct i2c_driver(9), struct i2c_client(9), struct i2c_board_info(9), I2C_BOARD_INFO(9), struct i2c_algorithm(9), struct i2c_lock_operations(9), struct i2c_timings(9), struct i2c_adapter_quirks(9), i2c_lock_bus(9), i2c_trylock_bus(9), i2c_unlock_bus(9), i2c_mark_adapter_suspended(9), i2c_mark_adapter_resumed(9), i2c_check_quirks(9), module_i2c_driver(9), builtin_i2c_driver(9)
Fr fr, if you're doing I2C bus recovery, this struct is your bestie. Don't skip the mandatory members or the vibe check will fail π
Okay that's the whole page, bestie! This came from ./include/linux, October 2026 edition β and yes, it's literally titled struct i2c_b...ecovery_info(9) in the footer because the terminal was being dramatic and truncating. Iconic behavior honestly π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms