Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * ACPI Time and Alarm (TAD) Device Driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2018 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * This driver is based on Section 9.18 of the ACPI 6.2 specification revision.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * It only supports the system wakeup capabilities of the TAD.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * Provided are sysfs attributes, available under the TAD platform device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * allowing user space to manage the AC and DC wakeup timers of the TAD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * set and read their values, set and check their expire timer wake policies,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * check and clear their status and check the capabilities of the TAD reported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * by AML.  The DC timer attributes are only present if the TAD supports a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * separate DC alarm timer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * The wakeup events handling and power management of the TAD is expected to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * be taken care of by the ACPI PM domain attached to its platform device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/pm_runtime.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/suspend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) MODULE_LICENSE("GPL v2");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) MODULE_AUTHOR("Rafael J. Wysocki");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) /* ACPI TAD capability flags (ACPI 6.2, Section 9.18.2) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define ACPI_TAD_AC_WAKE	BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define ACPI_TAD_DC_WAKE	BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define ACPI_TAD_RT		BIT(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define ACPI_TAD_RT_IN_MS	BIT(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define ACPI_TAD_S4_S5__GWS	BIT(4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define ACPI_TAD_AC_S4_WAKE	BIT(5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define ACPI_TAD_AC_S5_WAKE	BIT(6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define ACPI_TAD_DC_S4_WAKE	BIT(7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define ACPI_TAD_DC_S5_WAKE	BIT(8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) /* ACPI TAD alarm timer selection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define ACPI_TAD_AC_TIMER	(u32)0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define ACPI_TAD_DC_TIMER	(u32)1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) /* Special value for disabled timer or expired timer wake policy. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define ACPI_TAD_WAKE_DISABLED	(~(u32)0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) struct acpi_tad_driver_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	u32 capabilities;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) struct acpi_tad_rt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	u16 year;  /* 1900 - 9999 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	u8 month;  /* 1 - 12 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	u8 day;    /* 1 - 31 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	u8 hour;   /* 0 - 23 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	u8 minute; /* 0 - 59 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	u8 second; /* 0 - 59 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	u8 valid;  /* 0 (failed) or 1 (success) for reads, 0 for writes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	u16 msec;  /* 1 - 1000 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	s16 tz;    /* -1440 to 1440 or 2047 (unspecified) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	u8 daylight;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	u8 padding[3]; /* must be 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) static int acpi_tad_set_real_time(struct device *dev, struct acpi_tad_rt *rt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	acpi_handle handle = ACPI_HANDLE(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	union acpi_object args[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		{ .type = ACPI_TYPE_BUFFER, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct acpi_object_list arg_list = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		.pointer = args,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		.count = ARRAY_SIZE(args),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	unsigned long long retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	if (rt->year < 1900 || rt->year > 9999 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	    rt->month < 1 || rt->month > 12 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	    rt->hour > 23 || rt->minute > 59 || rt->second > 59 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	    rt->tz < -1440 || (rt->tz > 1440 && rt->tz != 2047) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	    rt->daylight > 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		return -ERANGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	args[0].buffer.pointer = (u8 *)rt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	args[0].buffer.length = sizeof(*rt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	pm_runtime_get_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	status = acpi_evaluate_integer(handle, "_SRT", &arg_list, &retval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	pm_runtime_put_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	if (ACPI_FAILURE(status) || retval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static int acpi_tad_get_real_time(struct device *dev, struct acpi_tad_rt *rt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	acpi_handle handle = ACPI_HANDLE(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	union acpi_object *out_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	struct acpi_tad_rt *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	int ret = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	pm_runtime_get_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	status = acpi_evaluate_object(handle, "_GRT", NULL, &output);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	pm_runtime_put_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	out_obj = output.pointer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	if (out_obj->type != ACPI_TYPE_BUFFER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	if (out_obj->buffer.length != sizeof(*rt))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	data = (struct acpi_tad_rt *)(out_obj->buffer.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	if (!data->valid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	memcpy(rt, data, sizeof(*rt));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) out_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	ACPI_FREE(output.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) static char *acpi_tad_rt_next_field(char *s, int *val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	char *p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	p = strchr(s, ':');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	if (!p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	*p = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	if (kstrtoint(s, 10, val))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	return p + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static ssize_t time_store(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			  const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	struct acpi_tad_rt rt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	char *str, *s;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	int val, ret = -ENODATA;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	str = kmemdup_nul(buf, count, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	if (!str)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	s = acpi_tad_rt_next_field(str, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	if (!s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	rt.year = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	s = acpi_tad_rt_next_field(s, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	if (!s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	rt.month = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	s = acpi_tad_rt_next_field(s, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	if (!s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	rt.day = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	s = acpi_tad_rt_next_field(s, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	if (!s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	rt.hour = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	s = acpi_tad_rt_next_field(s, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	if (!s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	rt.minute = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	s = acpi_tad_rt_next_field(s, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	if (!s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	rt.second = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	s = acpi_tad_rt_next_field(s, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	if (!s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	rt.tz = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	if (kstrtoint(s, 10, &val))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	rt.daylight = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	rt.valid = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	rt.msec = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	memset(rt.padding, 0, 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	ret = acpi_tad_set_real_time(dev, &rt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) out_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	kfree(str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	return ret ? ret : count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) static ssize_t time_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 			 char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	struct acpi_tad_rt rt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	ret = acpi_tad_get_real_time(dev, &rt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	return sprintf(buf, "%u:%u:%u:%u:%u:%u:%d:%u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		       rt.year, rt.month, rt.day, rt.hour, rt.minute, rt.second,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 		       rt.tz, rt.daylight);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) static DEVICE_ATTR_RW(time);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) static struct attribute *acpi_tad_time_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	&dev_attr_time.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) static const struct attribute_group acpi_tad_time_attr_group = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	.attrs	= acpi_tad_time_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) static int acpi_tad_wake_set(struct device *dev, char *method, u32 timer_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 			     u32 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	acpi_handle handle = ACPI_HANDLE(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	union acpi_object args[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		{ .type = ACPI_TYPE_INTEGER, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 		{ .type = ACPI_TYPE_INTEGER, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	struct acpi_object_list arg_list = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 		.pointer = args,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		.count = ARRAY_SIZE(args),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	unsigned long long retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	args[0].integer.value = timer_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	args[1].integer.value = value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	pm_runtime_get_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	status = acpi_evaluate_integer(handle, method, &arg_list, &retval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	pm_runtime_put_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	if (ACPI_FAILURE(status) || retval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) static int acpi_tad_wake_write(struct device *dev, const char *buf, char *method,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 			       u32 timer_id, const char *specval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	u32 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	if (sysfs_streq(buf, specval)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		value = ACPI_TAD_WAKE_DISABLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 		int ret = kstrtou32(buf, 0, &value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 		if (value == ACPI_TAD_WAKE_DISABLED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 			return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	return acpi_tad_wake_set(dev, method, timer_id, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) static ssize_t acpi_tad_wake_read(struct device *dev, char *buf, char *method,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 				  u32 timer_id, const char *specval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	acpi_handle handle = ACPI_HANDLE(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	union acpi_object args[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 		{ .type = ACPI_TYPE_INTEGER, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	struct acpi_object_list arg_list = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 		.pointer = args,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 		.count = ARRAY_SIZE(args),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	unsigned long long retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	args[0].integer.value = timer_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	pm_runtime_get_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	status = acpi_evaluate_integer(handle, method, &arg_list, &retval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	pm_runtime_put_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	if ((u32)retval == ACPI_TAD_WAKE_DISABLED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 		return sprintf(buf, "%s\n", specval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	return sprintf(buf, "%u\n", (u32)retval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) static const char *alarm_specval = "disabled";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) static int acpi_tad_alarm_write(struct device *dev, const char *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 				u32 timer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	return acpi_tad_wake_write(dev, buf, "_STV", timer_id, alarm_specval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) static ssize_t acpi_tad_alarm_read(struct device *dev, char *buf, u32 timer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	return acpi_tad_wake_read(dev, buf, "_TIV", timer_id, alarm_specval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) static const char *policy_specval = "never";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) static int acpi_tad_policy_write(struct device *dev, const char *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 				 u32 timer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	return acpi_tad_wake_write(dev, buf, "_STP", timer_id, policy_specval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) static ssize_t acpi_tad_policy_read(struct device *dev, char *buf, u32 timer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	return acpi_tad_wake_read(dev, buf, "_TIP", timer_id, policy_specval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) static int acpi_tad_clear_status(struct device *dev, u32 timer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	acpi_handle handle = ACPI_HANDLE(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	union acpi_object args[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 		{ .type = ACPI_TYPE_INTEGER, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	struct acpi_object_list arg_list = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 		.pointer = args,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		.count = ARRAY_SIZE(args),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	unsigned long long retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	args[0].integer.value = timer_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	pm_runtime_get_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	status = acpi_evaluate_integer(handle, "_CWS", &arg_list, &retval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	pm_runtime_put_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	if (ACPI_FAILURE(status) || retval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) static int acpi_tad_status_write(struct device *dev, const char *buf, u32 timer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	int ret, value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	ret = kstrtoint(buf, 0, &value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	if (value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	return acpi_tad_clear_status(dev, timer_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) static ssize_t acpi_tad_status_read(struct device *dev, char *buf, u32 timer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	acpi_handle handle = ACPI_HANDLE(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	union acpi_object args[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 		{ .type = ACPI_TYPE_INTEGER, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	struct acpi_object_list arg_list = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 		.pointer = args,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 		.count = ARRAY_SIZE(args),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	unsigned long long retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	args[0].integer.value = timer_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	pm_runtime_get_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	status = acpi_evaluate_integer(handle, "_GWS", &arg_list, &retval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	pm_runtime_put_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	return sprintf(buf, "0x%02X\n", (u32)retval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) static ssize_t caps_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 			 char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 	struct acpi_tad_driver_data *dd = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 	return sprintf(buf, "0x%02X\n", dd->capabilities);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) static DEVICE_ATTR_RO(caps);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) static ssize_t ac_alarm_store(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 			      const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 	int ret = acpi_tad_alarm_write(dev, buf, ACPI_TAD_AC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 	return ret ? ret : count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) static ssize_t ac_alarm_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 			     char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	return acpi_tad_alarm_read(dev, buf, ACPI_TAD_AC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) static DEVICE_ATTR_RW(ac_alarm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) static ssize_t ac_policy_store(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 			       const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 	int ret = acpi_tad_policy_write(dev, buf, ACPI_TAD_AC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 	return ret ? ret : count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) static ssize_t ac_policy_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 			      char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 	return acpi_tad_policy_read(dev, buf, ACPI_TAD_AC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) static DEVICE_ATTR_RW(ac_policy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) static ssize_t ac_status_store(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 			       const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 	int ret = acpi_tad_status_write(dev, buf, ACPI_TAD_AC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 	return ret ? ret : count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) static ssize_t ac_status_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 			      char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 	return acpi_tad_status_read(dev, buf, ACPI_TAD_AC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) static DEVICE_ATTR_RW(ac_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) static struct attribute *acpi_tad_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 	&dev_attr_caps.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 	&dev_attr_ac_alarm.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 	&dev_attr_ac_policy.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 	&dev_attr_ac_status.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 	NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) static const struct attribute_group acpi_tad_attr_group = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	.attrs	= acpi_tad_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) static ssize_t dc_alarm_store(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 			      const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 	int ret = acpi_tad_alarm_write(dev, buf, ACPI_TAD_DC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	return ret ? ret : count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) static ssize_t dc_alarm_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 			     char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	return acpi_tad_alarm_read(dev, buf, ACPI_TAD_DC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) static DEVICE_ATTR_RW(dc_alarm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) static ssize_t dc_policy_store(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 			       const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 	int ret = acpi_tad_policy_write(dev, buf, ACPI_TAD_DC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 	return ret ? ret : count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) static ssize_t dc_policy_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 			      char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	return acpi_tad_policy_read(dev, buf, ACPI_TAD_DC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) static DEVICE_ATTR_RW(dc_policy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) static ssize_t dc_status_store(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 			       const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 	int ret = acpi_tad_status_write(dev, buf, ACPI_TAD_DC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 	return ret ? ret : count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) static ssize_t dc_status_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 			      char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	return acpi_tad_status_read(dev, buf, ACPI_TAD_DC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) static DEVICE_ATTR_RW(dc_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) static struct attribute *acpi_tad_dc_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 	&dev_attr_dc_alarm.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 	&dev_attr_dc_policy.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 	&dev_attr_dc_status.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 	NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) static const struct attribute_group acpi_tad_dc_attr_group = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 	.attrs	= acpi_tad_dc_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) static int acpi_tad_disable_timer(struct device *dev, u32 timer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	return acpi_tad_wake_set(dev, "_STV", timer_id, ACPI_TAD_WAKE_DISABLED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) static int acpi_tad_remove(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 	struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 	struct acpi_tad_driver_data *dd = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 	device_init_wakeup(dev, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	pm_runtime_get_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 	if (dd->capabilities & ACPI_TAD_DC_WAKE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 		sysfs_remove_group(&dev->kobj, &acpi_tad_dc_attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 	sysfs_remove_group(&dev->kobj, &acpi_tad_attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 	acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 	if (dd->capabilities & ACPI_TAD_DC_WAKE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 		acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 		acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	pm_runtime_put_sync(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 	pm_runtime_disable(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) static int acpi_tad_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 	acpi_handle handle = ACPI_HANDLE(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 	struct acpi_tad_driver_data *dd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 	acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	unsigned long long caps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	 * Initialization failure messages are mostly about firmware issues, so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	 * print them at the "info" level.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	status = acpi_evaluate_integer(handle, "_GCP", NULL, &caps);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 	if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 		dev_info(dev, "Unable to get capabilities\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 	if (!(caps & ACPI_TAD_AC_WAKE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 		dev_info(dev, "Unsupported capabilities\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 	if (!acpi_has_method(handle, "_PRW")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 		dev_info(dev, "Missing _PRW\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 	dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 	if (!dd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 	dd->capabilities = caps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 	dev_set_drvdata(dev, dd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 	 * Assume that the ACPI PM domain has been attached to the device and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 	 * simply enable system wakeup and runtime PM and put the device into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) 	 * runtime suspend.  Everything else should be taken care of by the ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 	 * PM domain callbacks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 	device_init_wakeup(dev, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 	dev_pm_set_driver_flags(dev, DPM_FLAG_SMART_SUSPEND |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 				     DPM_FLAG_MAY_SKIP_RESUME);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) 	 * The platform bus type layer tells the ACPI PM domain powers up the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 	 * device, so set the runtime PM status of it to "active".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) 	pm_runtime_set_active(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) 	pm_runtime_enable(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 	pm_runtime_suspend(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 	ret = sysfs_create_group(&dev->kobj, &acpi_tad_attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 	if (caps & ACPI_TAD_DC_WAKE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 		ret = sysfs_create_group(&dev->kobj, &acpi_tad_dc_attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 			goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 	if (caps & ACPI_TAD_RT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 		ret = sysfs_create_group(&dev->kobj, &acpi_tad_time_attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 			goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) fail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 	acpi_tad_remove(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) static const struct acpi_device_id acpi_tad_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) 	{"ACPI000E", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) static struct platform_driver acpi_tad_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 		.name = "acpi-tad",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 		.acpi_match_table = acpi_tad_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 	.probe = acpi_tad_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 	.remove = acpi_tad_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) MODULE_DEVICE_TABLE(acpi, acpi_tad_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) module_platform_driver(acpi_tad_driver);