drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Source file repositories/reference/linux-study-clean/drivers/thermal/intel/int340x_thermal/int3400_thermal.c

File Facts

System
Linux kernel
Corpus path
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
Extension
.c
Size
17120 bytes
Lines
714
Domain
Driver Families
Bucket
drivers/thermal
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 int3400_thermal_priv {
	struct acpi_device *adev;
	struct platform_device *pdev;
	struct thermal_zone_device *thermal;
	int art_count;
	struct art *arts;
	int trt_count;
	struct trt *trts;
	u32 uuid_bitmap;
	int rel_misc_dev_res;
	int current_uuid_index;
	char *data_vault;
	int odvp_count;
	int *odvp;
	u32 os_uuid_mask;
	int production_mode;
	struct odvp_attr *odvp_attrs;
};

static int evaluate_odvp(struct int3400_thermal_priv *priv);

struct odvp_attr {
	int odvp;
	struct int3400_thermal_priv *priv;
	struct device_attribute attr;
};

static BIN_ATTR_SIMPLE_RO(data_vault);

static ssize_t imok_store(struct device *dev, struct device_attribute *attr,
			  const char *buf, size_t count)
{
	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
	acpi_status status;
	int input, ret;

	ret = kstrtouint(buf, 10, &input);
	if (ret)
		return ret;
	status = acpi_execute_simple_method(priv->adev->handle, "IMOK", input);
	if (ACPI_FAILURE(status))
		return -EIO;

	return count;
}

static DEVICE_ATTR_WO(imok);

static struct attribute *imok_attr[] = {
	&dev_attr_imok.attr,
	NULL
};

static const struct attribute_group imok_attribute_group = {
	.attrs = imok_attr,
};

static ssize_t available_uuids_show(struct device *dev,
				    struct device_attribute *attr,
				    char *buf)
{
	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
	int i;
	int length = 0;

	if (!priv->uuid_bitmap)
		return sysfs_emit(buf, "UNKNOWN\n");

	for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) {
		if (priv->uuid_bitmap & (1 << i))
			length += sysfs_emit_at(buf, length, "%s\n", int3400_thermal_uuids[i]);
	}

	return length;
}

static ssize_t current_uuid_show(struct device *dev,
				 struct device_attribute *devattr, char *buf)
{
	struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
	int i, length = 0;

	if (priv->current_uuid_index >= 0)
		return sysfs_emit(buf, "%s\n",
			       int3400_thermal_uuids[priv->current_uuid_index]);

	for (i = 0; i <= INT3400_THERMAL_CRITICAL; i++) {
		if (priv->os_uuid_mask & BIT(i))
			length += sysfs_emit_at(buf, length, "%s\n", int3400_thermal_uuids[i]);
	}

Annotation

Implementation Notes