Documentation/hwmon/hwmon-kernel-api.rst
Source file repositories/reference/linux-study-clean/Documentation/hwmon/hwmon-kernel-api.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/hwmon/hwmon-kernel-api.rst- Extension
.rst- Size
- 13645 bytes
- Lines
- 383
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct hwmon_chip_infostruct hwmon_opsstruct hwmon_channel_infostruct sensor_device_attributestruct sensor_device_attribute_2
Annotated Snippet
struct hwmon_chip_info {
const struct hwmon_ops *ops;
const struct hwmon_channel_info * const *info;
};
It contains the following fields:
* ops:
Pointer to device operations.
* info:
NULL-terminated list of device channel descriptors.
The list of hwmon operations is defined as::
struct hwmon_ops {
umode_t (*is_visible)(const void *, enum hwmon_sensor_types type,
u32 attr, int);
int (*read)(struct device *, enum hwmon_sensor_types type,
u32 attr, int, long *);
int (*write)(struct device *, enum hwmon_sensor_types type,
u32 attr, int, long);
};
It defines the following operations.
* is_visible:
Pointer to a function to return the file mode for each supported
attribute. This function is mandatory.
* read:
Pointer to a function for reading a value from the chip. This function
is optional, but must be provided if any readable attributes exist.
* write:
Pointer to a function for writing a value to the chip. This function is
optional, but must be provided if any writeable attributes exist.
Each sensor channel is described with struct hwmon_channel_info, which is
defined as follows::
struct hwmon_channel_info {
enum hwmon_sensor_types type;
u32 *config;
};
It contains following fields:
* type:
The hardware monitoring sensor type.
Supported sensor types are
================== ==================================================
hwmon_chip A virtual sensor type, used to describe attributes
which are not bound to a specific input or output
hwmon_temp Temperature sensor
hwmon_in Voltage sensor
hwmon_curr Current sensor
hwmon_power Power sensor
hwmon_energy Energy sensor
hwmon_energy64 Energy sensor, reported as 64-bit signed value
hwmon_humidity Humidity sensor
hwmon_fan Fan speed sensor
hwmon_pwm PWM control
================== ==================================================
* config:
Pointer to a 0-terminated list of configuration values for each
sensor of the given type. Each value is a combination of bit values
describing the attributes supposed by a single sensor.
Annotation
- Detected declarations: `struct hwmon_chip_info`, `struct hwmon_ops`, `struct hwmon_channel_info`, `struct sensor_device_attribute`, `struct sensor_device_attribute_2`.
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
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.