forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/arch/x86/platform/olpc/olpc-xo1-sci.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Support for OLPC XO-1 System Control Interrupts (SCI)
34 *
45 * Copyright (C) 2010 One Laptop per Child
56 * Copyright (C) 2006 Red Hat, Inc.
67 * Copyright (C) 2006 Advanced Micro Devices, Inc.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
128 */
139
1410 #include <linux/cs5535.h>
....@@ -19,7 +15,6 @@
1915 #include <linux/platform_device.h>
2016 #include <linux/pm.h>
2117 #include <linux/pm_wakeup.h>
22
-#include <linux/mfd/core.h>
2318 #include <linux/power_supply.h>
2419 #include <linux/suspend.h>
2520 #include <linux/workqueue.h>
....@@ -57,7 +52,7 @@
5752
5853 static void battery_status_changed(void)
5954 {
60
- struct power_supply *psy = power_supply_get_by_name("olpc-battery");
55
+ struct power_supply *psy = power_supply_get_by_name("olpc_battery");
6156
6257 if (psy) {
6358 power_supply_changed(psy);
....@@ -67,7 +62,7 @@
6762
6863 static void ac_status_changed(void)
6964 {
70
- struct power_supply *psy = power_supply_get_by_name("olpc-ac");
65
+ struct power_supply *psy = power_supply_get_by_name("olpc_ac");
7166
7267 if (psy) {
7368 power_supply_changed(psy);
....@@ -85,7 +80,7 @@
8580 return;
8681 }
8782
88
- if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state)
83
+ if (test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == !!state)
8984 return; /* Nothing new to report. */
9085
9186 input_report_switch(ebook_switch_idev, SW_TABLET_MODE, state);
....@@ -109,7 +104,7 @@
109104 * the edge detector hookup on the gpio inputs on the geode is
110105 * odd, to say the least. See http://dev.laptop.org/ticket/5703
111106 * for details, but in a nutshell: we don't use the edge
112
- * detectors. instead, we make use of an anomoly: with the both
107
+ * detectors. instead, we make use of an anomaly: with the both
113108 * edge detectors turned off, we still get an edge event on a
114109 * positive edge transition. to take advantage of this, we use the
115110 * front-end inverter to ensure that that's the edge we're always
....@@ -160,6 +155,12 @@
160155 }
161156 static DEVICE_ATTR(lid_wake_mode, S_IWUSR | S_IRUGO, lid_wake_mode_show,
162157 lid_wake_mode_set);
158
+
159
+static struct attribute *lid_attrs[] = {
160
+ &dev_attr_lid_wake_mode.attr,
161
+ NULL,
162
+};
163
+ATTRIBUTE_GROUPS(lid);
163164
164165 /*
165166 * Process all items in the EC's SCI queue.
....@@ -514,17 +515,8 @@
514515 goto err_register;
515516 }
516517
517
- r = device_create_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
518
- if (r) {
519
- dev_err(&pdev->dev, "failed to create wake mode attr: %d\n", r);
520
- goto err_create_attr;
521
- }
522
-
523518 return 0;
524519
525
-err_create_attr:
526
- input_unregister_device(lid_switch_idev);
527
- lid_switch_idev = NULL;
528520 err_register:
529521 input_free_device(lid_switch_idev);
530522 return r;
....@@ -532,7 +524,6 @@
532524
533525 static void free_lid_switch(void)
534526 {
535
- device_remove_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
536527 input_unregister_device(lid_switch_idev);
537528 }
538529
....@@ -544,10 +535,6 @@
544535 /* don't run on non-XOs */
545536 if (!machine_is_olpc())
546537 return -ENODEV;
547
-
548
- r = mfd_cell_enable(pdev);
549
- if (r)
550
- return r;
551538
552539 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
553540 if (!res) {
....@@ -613,7 +600,6 @@
613600
614601 static int xo1_sci_remove(struct platform_device *pdev)
615602 {
616
- mfd_cell_disable(pdev);
617603 free_irq(sci_irq, pdev);
618604 cancel_work_sync(&sci_work);
619605 free_ec_sci();
....@@ -628,6 +614,7 @@
628614 static struct platform_driver xo1_sci_driver = {
629615 .driver = {
630616 .name = "olpc-xo1-sci-acpi",
617
+ .dev_groups = lid_groups,
631618 },
632619 .probe = xo1_sci_probe,
633620 .remove = xo1_sci_remove,