acpi_tad.c 16 KB

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