28 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/slab.h>
34 #include <linux/types.h>
40 #define GUID "C364AC71-36DB-495A-8494-B439D472A505"
42 #define TC1100_INSTANCE_WIRELESS 1
43 #define TC1100_INSTANCE_JOGDIAL 2
48 MODULE_ALIAS(
"wmi:C364AC71-36DB-495A-8494-B439D472A505");
63 static int get_state(
u32 *
out,
u8 instance)
92 *out = (tmp == 3) ? 1 : 0;
95 *out = (tmp == 1) ? 0 : 1;
102 static int set_state(
u32 *
in,
u8 instance)
116 value = (*in) ? 1 : 2;
119 value = (*in) ? 0 : 1;
142 #define show_set_bool(value, instance) \
144 show_bool_##value(struct device *dev, struct device_attribute *attr, \
148 acpi_status status = get_state(&result, instance); \
149 if (ACPI_SUCCESS(status)) \
150 return sprintf(buf, "%d\n", result); \
151 return sprintf(buf, "Read error\n"); \
155 set_bool_##value(struct device *dev, struct device_attribute *attr, \
156 const char *buf, size_t count) \
158 u32 tmp = simple_strtoul(buf, NULL, 10); \
159 acpi_status status = set_state(&tmp, instance); \
160 if (ACPI_FAILURE(status)) \
164 static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, \
165 show_bool_##value, set_bool_##value);
170 static struct attribute *tc1100_attributes[] = {
171 &dev_attr_wireless.attr,
172 &dev_attr_jogdial.attr,
177 .attrs = tc1100_attributes,
198 static int tc1100_suspend(
struct device *
dev)
213 static int tc1100_resume(
struct device *dev)
228 static const struct dev_pm_ops tc1100_pm_ops = {
230 .resume = tc1100_resume,
231 .freeze = tc1100_suspend,
232 .restore = tc1100_resume,
238 .name =
"tc1100-wmi",
241 .pm = &tc1100_pm_ops,
247 static int __init tc1100_init(
void)
266 pr_info(
"HP Compaq TC1100 Tablet WMI Extras loaded\n");
276 static void __exit tc1100_exit(
void)