include/linux/i2c-of-prober.h
Source file repositories/reference/linux-study-clean/include/linux/i2c-of-prober.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/i2c-of-prober.h- Extension
.h- Size
- 5062 bytes
- Lines
- 141
- 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/kconfig.hlinux/types.h
Detected Declarations
struct devicestruct device_nodestruct i2c_of_probe_opsstruct i2c_of_probe_cfgstruct i2c_of_probe_simple_optsstruct gpio_descstruct regulatorstruct i2c_of_probe_simple_ctx
Annotated Snippet
struct i2c_of_probe_ops {
/**
* @enable: Retrieve and enable resources so that the components respond to probes.
*
* It is OK for this callback to return -EPROBE_DEFER since the intended use includes
* retrieving resources and enables them. Resources should be reverted to their initial
* state and released before returning if this fails.
*/
int (*enable)(struct device *dev, struct device_node *bus_node, void *data);
/**
* @cleanup_early: Release exclusive resources prior to calling probe() on a
* detected component.
*
* Only called if a matching component is actually found. If none are found,
* resources that would have been released in this callback should be released in
* @free_resourcs_late instead.
*/
void (*cleanup_early)(struct device *dev, void *data);
/**
* @cleanup: Opposite of @enable to balance refcounts and free resources after probing.
*
* Should check if resources were already freed by @cleanup_early.
*/
void (*cleanup)(struct device *dev, void *data);
};
/**
* struct i2c_of_probe_cfg - I2C OF component prober configuration
* @ops: Callbacks for the prober to use.
* @type: A string to match the device node name prefix to probe for.
*/
struct i2c_of_probe_cfg {
const struct i2c_of_probe_ops *ops;
const char *type;
};
#if IS_ENABLED(CONFIG_OF_DYNAMIC)
int i2c_of_probe_component(struct device *dev, const struct i2c_of_probe_cfg *cfg, void *ctx);
/**
* DOC: I2C OF component prober simple helpers
*
* Components such as trackpads are commonly connected to a devices baseboard
* with a 6-pin ribbon cable. That gives at most one voltage supply and one
* GPIO (commonly a "enable" or "reset" line) besides the I2C bus, interrupt
* pin, and common ground. Touchscreens, while integrated into the display
* panel's connection, typically have the same set of connections.
*
* A simple set of helpers are provided here for use with the I2C OF component
* prober. This implementation targets such components, allowing for at most
* one regulator supply.
*
* The following helpers are provided:
* * i2c_of_probe_simple_enable()
* * i2c_of_probe_simple_cleanup_early()
* * i2c_of_probe_simple_cleanup()
*/
/**
* struct i2c_of_probe_simple_opts - Options for simple I2C component prober callbacks
* @res_node_compatible: Compatible string of device node to retrieve resources from.
* @supply_name: Name of regulator supply.
* @gpio_name: Name of GPIO. NULL if no GPIO line is used. Empty string ("") if GPIO
* line is unnamed.
* @post_power_on_delay_ms: Delay after regulators are powered on. Passed to msleep().
* @post_gpio_config_delay_ms: Delay after GPIO is configured. Passed to msleep().
* @gpio_assert_to_enable: %true if GPIO should be asserted, i.e. set to logical high,
* to enable the component.
*
* This describes power sequences common for the class of components supported by the
* simple component prober:
* * @gpio_name is configured to the non-active setting according to @gpio_assert_to_enable.
* * @supply_name regulator supply is enabled.
* * Wait for @post_power_on_delay_ms to pass.
* * @gpio_name is configured to the active setting according to @gpio_assert_to_enable.
* * Wait for @post_gpio_config_delay_ms to pass.
*/
struct i2c_of_probe_simple_opts {
const char *res_node_compatible;
const char *supply_name;
const char *gpio_name;
unsigned int post_power_on_delay_ms;
unsigned int post_gpio_config_delay_ms;
bool gpio_assert_to_enable;
};
struct gpio_desc;
Annotation
- Immediate include surface: `linux/kconfig.h`, `linux/types.h`.
- Detected declarations: `struct device`, `struct device_node`, `struct i2c_of_probe_ops`, `struct i2c_of_probe_cfg`, `struct i2c_of_probe_simple_opts`, `struct gpio_desc`, `struct regulator`, `struct i2c_of_probe_simple_ctx`.
- 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.