drivers/platform/x86/lenovo/wmi-capdata.h

Source file repositories/reference/linux-study-clean/drivers/platform/x86/lenovo/wmi-capdata.h

File Facts

System
Linux kernel
Corpus path
drivers/platform/x86/lenovo/wmi-capdata.h
Extension
.h
Size
2336 bytes
Lines
86
Domain
Driver Families
Bucket
drivers/platform
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct capdata00 {
	u32 id;
	u32 supported;
	u32 default_value;
};

struct capdata01 {
	u32 id;
	u32 supported;
	u32 default_value;
	u32 step;
	u32 min_value;
	u32 max_value;
};

struct capdata_fan {
	u32 id;
	u32 min_rpm;
	u32 max_rpm;
};

typedef void (*cd_list_cb_t)(struct device *master_dev, struct cd_list *cd_list);

struct lwmi_cd_binder {
	struct cd_list *cd00_list;
	struct cd_list *cd01_list;
	/*
	 * May be called during or after the bind callback.
	 * Will be called with NULL if capdata_fan does not exist.
	 * The pointer is only valid in the callback; never keep it for later use!
	 */
	cd_list_cb_t cd_fan_list_cb;
};

/**
 * lwmi_attr_id() - Formats a capability data attribute ID
 * @dev_id: The u8 corresponding to the device ID.
 * @feat_id: The u8 corresponding to the feature ID on the device.
 * @mode_id: The u8 corresponding to the wmi-gamezone mode for set/get.
 * @type_id: The u8 corresponding to the sub-device.
 *
 * Return: encoded capability data attribute ID.
 */
static inline u32 lwmi_attr_id(u8 dev_id, u8 feat_id, u8 mode_id, u8 type_id)
{
	return (FIELD_PREP(LWMI_ATTR_DEV_ID_MASK, dev_id)   |
		FIELD_PREP(LWMI_ATTR_FEAT_ID_MASK, feat_id) |
		FIELD_PREP(LWMI_ATTR_MODE_ID_MASK, mode_id) |
		FIELD_PREP(LWMI_ATTR_TYPE_ID_MASK, type_id));
}

void lwmi_cd_match_add_all(struct device *master, struct component_match **matchptr);
int lwmi_cd00_get_data(struct cd_list *list, u32 attribute_id, struct capdata00 *output);
int lwmi_cd01_get_data(struct cd_list *list, u32 attribute_id, struct capdata01 *output);
int lwmi_cd_fan_get_data(struct cd_list *list, u32 attribute_id, struct capdata_fan *output);

#endif /* !_LENOVO_WMI_CAPDATA_H_ */

Annotation

Implementation Notes