Skip to content

Commit 94a3c35

Browse files
spandruvadadlezcano
authored andcommitted
thermal: int340x: Add keep alive response method
When firmware requests keep alive response, send an event to user space to confirm by using imok sysfs entry. Create a new sysf entry called "imok". User space can write an integer, which results in execution of IMOK ACPI method of INT3400 thermal zone device. This results in sending response to firmware request for keep alive. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200915223650.406046-4-srinivas.pandruvada@linux.intel.com
1 parent 8805231 commit 94a3c35

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#define INT3400_THERMAL_TABLE_CHANGED 0x83
1616
#define INT3400_ODVP_CHANGED 0x88
17+
#define INT3400_KEEP_ALIVE 0xA0
1718

1819
enum int3400_thermal_uuid {
1920
INT3400_THERMAL_PASSIVE_1,
@@ -83,8 +84,33 @@ static struct bin_attribute *data_attributes[] = {
8384
NULL,
8485
};
8586

87+
static ssize_t imok_store(struct device *dev, struct device_attribute *attr,
88+
const char *buf, size_t count)
89+
{
90+
struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
91+
acpi_status status;
92+
int input, ret;
93+
94+
ret = kstrtouint(buf, 10, &input);
95+
if (ret)
96+
return ret;
97+
status = acpi_execute_simple_method(priv->adev->handle, "IMOK", input);
98+
if (ACPI_FAILURE(status))
99+
return -EIO;
100+
101+
return count;
102+
}
103+
104+
static DEVICE_ATTR_WO(imok);
105+
106+
static struct attribute *imok_attr[] = {
107+
&dev_attr_imok.attr,
108+
NULL
109+
};
110+
86111
static const struct attribute_group data_attribute_group = {
87112
.bin_attrs = data_attributes,
113+
.attrs = imok_attr,
88114
};
89115

90116
static ssize_t available_uuids_show(struct device *dev,
@@ -358,6 +384,9 @@ static void int3400_notify(acpi_handle handle,
358384
case INT3400_THERMAL_TABLE_CHANGED:
359385
therm_event = THERMAL_TABLE_CHANGED;
360386
break;
387+
case INT3400_KEEP_ALIVE:
388+
therm_event = THERMAL_EVENT_KEEP_ALIVE;
389+
break;
361390
case INT3400_ODVP_CHANGED:
362391
evaluate_odvp(priv);
363392
therm_event = THERMAL_DEVICE_POWER_CAPABILITY_CHANGED;

0 commit comments

Comments
 (0)