2019-05-27 14:55:06 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2021-03-27 11:47:01 +08:00
|
|
|
* acpi_ac.c - ACPI AC Adapter Driver (Revision: 27)
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
|
|
|
|
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
|
|
|
|
*/
|
|
|
|
|
2021-02-04 02:43:17 +08:00
|
|
|
#define pr_fmt(fmt) "ACPI: AC: " fmt
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/types.h>
|
2013-05-08 15:28:46 +08:00
|
|
|
#include <linux/dmi.h>
|
|
|
|
#include <linux/delay.h>
|
2013-09-25 20:39:45 +08:00
|
|
|
#include <linux/platform_device.h>
|
2007-09-26 23:44:06 +08:00
|
|
|
#include <linux/power_supply.h>
|
2013-12-03 08:49:16 +08:00
|
|
|
#include <linux/acpi.h>
|
2018-02-07 22:58:13 +08:00
|
|
|
#include <acpi/battery.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define ACPI_AC_CLASS "ac_adapter"
|
|
|
|
#define ACPI_AC_DEVICE_NAME "AC Adapter"
|
|
|
|
#define ACPI_AC_FILE_STATE "state"
|
|
|
|
#define ACPI_AC_NOTIFY_STATUS 0x80
|
|
|
|
#define ACPI_AC_STATUS_OFFLINE 0x00
|
|
|
|
#define ACPI_AC_STATUS_ONLINE 0x01
|
|
|
|
#define ACPI_AC_STATUS_UNKNOWN 0xFF
|
|
|
|
|
2007-02-13 11:42:12 +08:00
|
|
|
MODULE_AUTHOR("Paul Diefenbaugh");
|
2007-02-13 12:50:02 +08:00
|
|
|
MODULE_DESCRIPTION("ACPI AC Adapter Driver");
|
2005-04-17 06:20:36 +08:00
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
2014-07-07 07:13:46 +08:00
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
static int acpi_ac_add(struct acpi_device *device);
|
|
|
|
static int acpi_ac_remove(struct acpi_device *device);
|
|
|
|
static void acpi_ac_notify(struct acpi_device *device, u32 event);
|
|
|
|
|
2017-04-19 20:02:11 +08:00
|
|
|
struct acpi_ac_bl {
|
|
|
|
const char *hid;
|
|
|
|
int hrv;
|
|
|
|
};
|
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
static const struct acpi_device_id ac_device_ids[] = {
|
|
|
|
{"ACPI0003", 0},
|
|
|
|
{"", 0},
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(acpi, ac_device_ids);
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
|
|
static int acpi_ac_resume(struct device *dev);
|
|
|
|
#endif
|
|
|
|
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
|
|
|
|
|
2013-05-08 15:28:46 +08:00
|
|
|
static int ac_sleep_before_get_state_ms;
|
2021-10-25 06:04:45 +08:00
|
|
|
static int ac_only;
|
2013-05-08 15:28:46 +08:00
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
static struct acpi_driver acpi_ac_driver = {
|
|
|
|
.name = "ac",
|
|
|
|
.class = ACPI_AC_CLASS,
|
|
|
|
.ids = ac_device_ids,
|
|
|
|
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
|
|
|
|
.ops = {
|
|
|
|
.add = acpi_ac_add,
|
|
|
|
.remove = acpi_ac_remove,
|
|
|
|
.notify = acpi_ac_notify,
|
|
|
|
},
|
|
|
|
.drv.pm = &acpi_ac_pm,
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct acpi_ac {
|
2015-03-12 15:44:11 +08:00
|
|
|
struct power_supply *charger;
|
|
|
|
struct power_supply_desc charger_desc;
|
2021-03-27 11:47:01 +08:00
|
|
|
struct acpi_device *device;
|
2008-10-10 14:22:59 +08:00
|
|
|
unsigned long long state;
|
2014-03-12 01:58:48 +08:00
|
|
|
struct notifier_block battery_nb;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2015-03-12 15:44:11 +08:00
|
|
|
#define to_acpi_ac(x) power_supply_get_drvdata(x)
|
2007-09-26 23:44:06 +08:00
|
|
|
|
2021-03-27 11:47:01 +08:00
|
|
|
/* AC Adapter Management */
|
2005-08-05 12:44:28 +08:00
|
|
|
static int acpi_ac_get_state(struct acpi_ac *ac)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2014-05-07 10:18:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
|
|
|
|
if (!ac)
|
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2021-10-25 06:04:45 +08:00
|
|
|
if (ac_only) {
|
|
|
|
ac->state = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL,
|
2013-09-25 20:39:45 +08:00
|
|
|
&ac->state);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2021-02-04 02:43:17 +08:00
|
|
|
acpi_handle_info(ac->device->handle,
|
|
|
|
"Error reading AC Adapter state: %s\n",
|
|
|
|
acpi_format_exception(status));
|
2005-04-17 06:20:36 +08:00
|
|
|
ac->state = ACPI_AC_STATUS_UNKNOWN;
|
2006-06-27 12:41:40 +08:00
|
|
|
return -ENODEV;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2021-03-27 11:47:01 +08:00
|
|
|
/* sysfs I/F */
|
2010-12-08 10:40:45 +08:00
|
|
|
static int get_ac_property(struct power_supply *psy,
|
|
|
|
enum power_supply_property psp,
|
|
|
|
union power_supply_propval *val)
|
|
|
|
{
|
|
|
|
struct acpi_ac *ac = to_acpi_ac(psy);
|
|
|
|
|
|
|
|
if (!ac)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
if (acpi_ac_get_state(ac))
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
switch (psp) {
|
|
|
|
case POWER_SUPPLY_PROP_ONLINE:
|
|
|
|
val->intval = ac->state;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum power_supply_property ac_props[] = {
|
|
|
|
POWER_SUPPLY_PROP_ONLINE,
|
|
|
|
};
|
|
|
|
|
2021-03-27 11:47:01 +08:00
|
|
|
/* Driver Model */
|
2014-05-07 10:18:28 +08:00
|
|
|
static void acpi_ac_notify(struct acpi_device *device, u32 event)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2014-05-07 10:18:28 +08:00
|
|
|
struct acpi_ac *ac = acpi_driver_data(device);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!ac)
|
2006-06-27 12:41:40 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
switch (event) {
|
2008-06-14 13:26:37 +08:00
|
|
|
default:
|
2021-02-04 02:43:17 +08:00
|
|
|
acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n",
|
|
|
|
event);
|
2020-07-08 04:09:37 +08:00
|
|
|
fallthrough;
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_AC_NOTIFY_STATUS:
|
2004-08-19 13:26:00 +08:00
|
|
|
case ACPI_NOTIFY_BUS_CHECK:
|
|
|
|
case ACPI_NOTIFY_DEVICE_CHECK:
|
2013-05-08 15:28:46 +08:00
|
|
|
/*
|
|
|
|
* A buggy BIOS may notify AC first and then sleep for
|
|
|
|
* a specific time before doing actual operations in the
|
|
|
|
* EC event handler (_Qxx). This will cause the AC state
|
|
|
|
* reported by the ACPI event to be incorrect, so wait for a
|
|
|
|
* specific time for the EC event handler to make progress.
|
|
|
|
*/
|
|
|
|
if (ac_sleep_before_get_state_ms > 0)
|
|
|
|
msleep(ac_sleep_before_get_state_ms);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
acpi_ac_get_state(ac);
|
2014-05-07 10:18:28 +08:00
|
|
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
|
|
|
dev_name(&device->dev), event,
|
|
|
|
(u32) ac->state);
|
|
|
|
acpi_notifier_call_chain(device, event, (u32) ac->state);
|
2015-03-12 15:44:11 +08:00
|
|
|
kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-12 01:58:48 +08:00
|
|
|
static int acpi_ac_battery_notify(struct notifier_block *nb,
|
|
|
|
unsigned long action, void *data)
|
|
|
|
{
|
|
|
|
struct acpi_ac *ac = container_of(nb, struct acpi_ac, battery_nb);
|
|
|
|
struct acpi_bus_event *event = (struct acpi_bus_event *)data;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* On HP Pavilion dv6-6179er AC status notifications aren't triggered
|
|
|
|
* when adapter is plugged/unplugged. However, battery status
|
2021-03-13 09:55:35 +08:00
|
|
|
* notifications are triggered when battery starts charging or
|
2014-03-12 01:58:48 +08:00
|
|
|
* discharging. Re-reading AC status triggers lost AC notifications,
|
|
|
|
* if AC status has changed.
|
|
|
|
*/
|
|
|
|
if (strcmp(event->device_class, ACPI_BATTERY_CLASS) == 0 &&
|
|
|
|
event->type == ACPI_BATTERY_NOTIFY_STATUS)
|
|
|
|
acpi_ac_get_state(ac);
|
|
|
|
|
|
|
|
return NOTIFY_OK;
|
|
|
|
}
|
|
|
|
|
2018-04-18 20:04:40 +08:00
|
|
|
static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
|
2013-05-08 15:28:46 +08:00
|
|
|
{
|
|
|
|
ac_sleep_before_get_state_ms = 1000;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-25 06:04:45 +08:00
|
|
|
static int __init ac_only_quirk(const struct dmi_system_id *d)
|
|
|
|
{
|
|
|
|
ac_only = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-02-23 22:29:40 +08:00
|
|
|
/* Please keep this list alphabetically sorted */
|
2018-04-18 20:04:40 +08:00
|
|
|
static const struct dmi_system_id ac_dmi_table[] __initconst = {
|
2021-10-25 06:04:45 +08:00
|
|
|
{
|
|
|
|
/* Kodlix GK45 returning incorrect state */
|
|
|
|
.callback = ac_only_quirk,
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "GK45"),
|
2013-05-08 15:28:46 +08:00
|
|
|
},
|
|
|
|
},
|
2018-04-18 20:04:40 +08:00
|
|
|
{
|
2020-02-23 22:29:40 +08:00
|
|
|
/* Lenovo Thinkpad e530, see comment in acpi_ac_notify() */
|
|
|
|
.callback = thinkpad_e530_quirk,
|
2018-04-18 20:04:40 +08:00
|
|
|
.matches = {
|
2020-02-23 22:29:40 +08:00
|
|
|
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
|
|
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
|
2018-04-18 20:04:40 +08:00
|
|
|
},
|
|
|
|
},
|
2013-05-08 15:28:46 +08:00
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
static int acpi_ac_add(struct acpi_device *device)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2015-03-12 15:44:11 +08:00
|
|
|
struct power_supply_config psy_cfg = {};
|
2005-08-05 12:44:28 +08:00
|
|
|
int result = 0;
|
|
|
|
struct acpi_ac *ac = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
if (!device)
|
|
|
|
return -EINVAL;
|
2013-09-25 20:39:45 +08:00
|
|
|
|
2006-12-20 04:56:11 +08:00
|
|
|
ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!ac)
|
2006-06-27 12:41:40 +08:00
|
|
|
return -ENOMEM;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
ac->device = device;
|
|
|
|
strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
|
|
|
|
strcpy(acpi_device_class(device), ACPI_AC_CLASS);
|
|
|
|
device->driver_data = ac;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
result = acpi_ac_get_state(ac);
|
|
|
|
if (result)
|
|
|
|
goto end;
|
|
|
|
|
2015-03-12 15:44:11 +08:00
|
|
|
psy_cfg.drv_data = ac;
|
|
|
|
|
|
|
|
ac->charger_desc.name = acpi_device_bid(device);
|
|
|
|
ac->charger_desc.type = POWER_SUPPLY_TYPE_MAINS;
|
|
|
|
ac->charger_desc.properties = ac_props;
|
|
|
|
ac->charger_desc.num_properties = ARRAY_SIZE(ac_props);
|
|
|
|
ac->charger_desc.get_property = get_ac_property;
|
|
|
|
ac->charger = power_supply_register(&ac->device->dev,
|
|
|
|
&ac->charger_desc, &psy_cfg);
|
|
|
|
if (IS_ERR(ac->charger)) {
|
|
|
|
result = PTR_ERR(ac->charger);
|
2012-07-20 13:29:16 +08:00
|
|
|
goto end;
|
2015-03-12 15:44:11 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2021-02-04 02:43:17 +08:00
|
|
|
pr_info("%s [%s] (%s)\n", acpi_device_name(device),
|
|
|
|
acpi_device_bid(device), ac->state ? "on-line" : "off-line");
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-03-12 01:58:48 +08:00
|
|
|
ac->battery_nb.notifier_call = acpi_ac_battery_notify;
|
|
|
|
register_acpi_notifier(&ac->battery_nb);
|
2013-10-12 21:04:48 +08:00
|
|
|
end:
|
2021-03-27 11:47:01 +08:00
|
|
|
if (result)
|
2005-04-17 06:20:36 +08:00
|
|
|
kfree(ac);
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return result;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-08-10 05:00:02 +08:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2012-06-28 05:26:35 +08:00
|
|
|
static int acpi_ac_resume(struct device *dev)
|
2007-11-15 09:00:39 +08:00
|
|
|
{
|
|
|
|
struct acpi_ac *ac;
|
2021-03-27 11:47:01 +08:00
|
|
|
unsigned int old_state;
|
2012-06-28 05:26:35 +08:00
|
|
|
|
|
|
|
if (!dev)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
ac = acpi_driver_data(to_acpi_device(dev));
|
2012-06-28 05:26:35 +08:00
|
|
|
if (!ac)
|
2007-11-15 09:00:39 +08:00
|
|
|
return -EINVAL;
|
2012-06-28 05:26:35 +08:00
|
|
|
|
2007-11-15 09:00:39 +08:00
|
|
|
old_state = ac->state;
|
|
|
|
if (acpi_ac_get_state(ac))
|
|
|
|
return 0;
|
|
|
|
if (old_state != ac->state)
|
2015-03-12 15:44:11 +08:00
|
|
|
kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
|
2007-11-15 09:00:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2014-02-13 11:19:05 +08:00
|
|
|
#else
|
|
|
|
#define acpi_ac_resume NULL
|
2012-08-10 05:00:02 +08:00
|
|
|
#endif
|
2007-11-15 09:00:39 +08:00
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
static int acpi_ac_remove(struct acpi_device *device)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2014-05-07 10:18:28 +08:00
|
|
|
struct acpi_ac *ac = NULL;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
if (!device || !acpi_driver_data(device))
|
2006-06-27 12:41:40 +08:00
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
ac = acpi_driver_data(device);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2015-03-12 15:44:11 +08:00
|
|
|
power_supply_unregister(ac->charger);
|
2014-03-12 01:58:48 +08:00
|
|
|
unregister_acpi_notifier(&ac->battery_nb);
|
2013-09-25 20:39:45 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
kfree(ac);
|
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static int __init acpi_ac_init(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-07-01 23:36:54 +08:00
|
|
|
int result;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-08-15 13:37:22 +08:00
|
|
|
if (acpi_disabled)
|
|
|
|
return -ENODEV;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2021-12-31 03:31:19 +08:00
|
|
|
if (acpi_quirk_skip_acpi_ac_and_battery())
|
|
|
|
return -ENODEV;
|
2018-04-18 20:04:40 +08:00
|
|
|
|
2021-12-31 03:31:19 +08:00
|
|
|
dmi_check_system(ac_dmi_table);
|
2017-04-19 20:02:11 +08:00
|
|
|
|
2014-05-07 10:18:28 +08:00
|
|
|
result = acpi_bus_register_driver(&acpi_ac_driver);
|
2021-03-27 11:47:01 +08:00
|
|
|
if (result < 0)
|
2006-06-27 12:41:40 +08:00
|
|
|
return -ENODEV;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-06-27 12:41:40 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
static void __exit acpi_ac_exit(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2014-05-07 10:18:28 +08:00
|
|
|
acpi_bus_unregister_driver(&acpi_ac_driver);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
module_init(acpi_ac_init);
|
|
|
|
module_exit(acpi_ac_exit);
|