drivers/platform/x86/dell/dell-wmi-ddv.c

Source file repositories/reference/linux-study-clean/drivers/platform/x86/dell/dell-wmi-ddv.c

File Facts

System
Linux kernel
Corpus path
drivers/platform/x86/dell/dell-wmi-ddv.c
Extension
.c
Size
28066 bytes
Lines
1124
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 fan_sensor_entry {
	u8 type;
	__le16 rpm;
} __packed;

struct thermal_sensor_entry {
	u8 type;
	s8 now;
	s8 min;
	s8 max;
	u8 unknown;
} __packed;

struct combined_channel_info {
	struct hwmon_channel_info info;
	u32 config[];
};

struct combined_chip_info {
	struct hwmon_chip_info chip;
	const struct hwmon_channel_info *info[];
};

struct dell_wmi_ddv_sensors {
	bool active;
	struct mutex lock;	/* protect caching */
	unsigned long timestamp;
	union acpi_object *obj;
	u64 entries;
};

struct dell_wmi_ddv_data {
	struct acpi_battery_hook hook;
	struct device_attribute eppid_attr;
	struct mutex translation_cache_lock;	/* Protects the translation cache */
	struct power_supply *translation_cache[DELL_DDV_NUM_BATTERIES];
	struct dell_wmi_ddv_sensors fans;
	struct dell_wmi_ddv_sensors temps;
	struct wmi_device *wdev;
};

static const char * const fan_labels[] = {
	"CPU Fan",
	"Chassis Motherboard Fan",
	"Video Fan",
	"Power Supply Fan",
	"Chipset Fan",
	"Memory Fan",
	"PCI Fan",
	"HDD Fan",
};

static const char * const fan_dock_labels[] = {
	"Docking Chassis/Motherboard Fan",
	"Docking Video Fan",
	"Docking Power Supply Fan",
	"Docking Chipset Fan",
};

static int dell_wmi_ddv_query_type(struct wmi_device *wdev, enum dell_ddv_method method, u32 arg,
				   union acpi_object **result, acpi_object_type type)
{
	struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL };
	const struct acpi_buffer in = {
		.length = sizeof(arg),
		.pointer = &arg,
	};
	union acpi_object *obj;
	acpi_status ret;

	ret = wmidev_evaluate_method(wdev, 0x0, method, &in, &out);
	if (ACPI_FAILURE(ret))
		return -EIO;

	obj = out.pointer;
	if (!obj)
		return -ENODATA;

	if (obj->type != type) {
		kfree(obj);
		return -ENOMSG;
	}

	*result = obj;

	return 0;
}

static int dell_wmi_ddv_query_integer(struct wmi_device *wdev, enum dell_ddv_method method,
				      u32 arg, u32 *res)

Annotation

Implementation Notes