#define pr_fmt(fmt) …
#include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/suspend.h>
#include <linux/types.h>
#include <linux/unaligned.h>
#include <linux/acpi.h>
#include <linux/power_supply.h>
#include <acpi/battery.h>
#define ACPI_BATTERY_VALUE_UNKNOWN …
#define ACPI_BATTERY_CAPACITY_VALID(capacity) …
#define ACPI_BATTERY_DEVICE_NAME …
#define ACPI_BATTERY_POWER_UNIT_MA …
#define ACPI_BATTERY_STATE_DISCHARGING …
#define ACPI_BATTERY_STATE_CHARGING …
#define ACPI_BATTERY_STATE_CRITICAL …
#define ACPI_BATTERY_STATE_CHARGE_LIMITING …
#define MAX_STRING_LENGTH …
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static int battery_bix_broken_package;
static int battery_notification_delay_ms;
static int battery_ac_is_broken;
static unsigned int cache_time = …;
module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(…) …;
static const struct acpi_device_id battery_device_ids[] = …;
MODULE_DEVICE_TABLE(acpi, battery_device_ids);
enum { … };
struct acpi_battery { … };
#define to_acpi_battery(x) …
static inline int acpi_battery_present(struct acpi_battery *battery)
{ … }
static int acpi_battery_technology(struct acpi_battery *battery)
{ … }
static int acpi_battery_get_state(struct acpi_battery *battery);
static int acpi_battery_is_charged(struct acpi_battery *battery)
{ … }
static bool acpi_battery_is_degraded(struct acpi_battery *battery)
{ … }
static int acpi_battery_handle_discharging(struct acpi_battery *battery)
{ … }
static int acpi_battery_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static const enum power_supply_property charge_battery_props[] = …;
static const enum power_supply_property charge_battery_full_cap_broken_props[] = …;
static const enum power_supply_property energy_battery_props[] = …;
static const enum power_supply_property energy_battery_full_cap_broken_props[] = …;
struct acpi_offsets { … };
static const struct acpi_offsets state_offsets[] = …;
static const struct acpi_offsets info_offsets[] = …;
static const struct acpi_offsets extended_info_offsets[] = …;
static int extract_package(struct acpi_battery *battery,
union acpi_object *package,
const struct acpi_offsets *offsets, int num)
{ … }
static int acpi_battery_get_status(struct acpi_battery *battery)
{ … }
static int extract_battery_info(const int use_bix,
struct acpi_battery *battery,
const struct acpi_buffer *buffer)
{ … }
static int acpi_battery_get_info(struct acpi_battery *battery)
{ … }
static int acpi_battery_get_state(struct acpi_battery *battery)
{ … }
static int acpi_battery_set_alarm(struct acpi_battery *battery)
{ … }
static int acpi_battery_init_alarm(struct acpi_battery *battery)
{ … }
static ssize_t acpi_battery_alarm_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t acpi_battery_alarm_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static struct device_attribute alarm_attr = …;
static struct attribute *acpi_battery_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static LIST_HEAD(acpi_battery_list);
static LIST_HEAD(battery_hook_list);
static DEFINE_MUTEX(hook_mutex);
static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook)
{ … }
void battery_hook_unregister(struct acpi_battery_hook *hook)
{ … }
EXPORT_SYMBOL_GPL(…);
void battery_hook_register(struct acpi_battery_hook *hook)
{ … }
EXPORT_SYMBOL_GPL(…);
static void devm_battery_hook_unregister(void *data)
{ … }
int devm_battery_hook_register(struct device *dev, struct acpi_battery_hook *hook)
{ … }
EXPORT_SYMBOL_GPL(…);
static void battery_hook_add_battery(struct acpi_battery *battery)
{ … }
static void battery_hook_remove_battery(struct acpi_battery *battery)
{ … }
static void __exit battery_hook_exit(void)
{ … }
static int sysfs_add_battery(struct acpi_battery *battery)
{ … }
static void sysfs_remove_battery(struct acpi_battery *battery)
{ … }
static void find_battery(const struct dmi_header *dm, void *private)
{ … }
static void acpi_battery_quirks(struct acpi_battery *battery)
{ … }
static int acpi_battery_update(struct acpi_battery *battery, bool resume)
{ … }
static void acpi_battery_refresh(struct acpi_battery *battery)
{ … }
static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
{ … }
static int battery_notify(struct notifier_block *nb,
unsigned long mode, void *_unused)
{ … }
static int __init
battery_bix_broken_package_quirk(const struct dmi_system_id *d)
{ … }
static int __init
battery_notification_delay_quirk(const struct dmi_system_id *d)
{ … }
static int __init
battery_ac_is_broken_quirk(const struct dmi_system_id *d)
{ … }
static const struct dmi_system_id bat_dmi_table[] __initconst = …;
static int acpi_battery_update_retry(struct acpi_battery *battery)
{ … }
static int acpi_battery_add(struct acpi_device *device)
{ … }
static void acpi_battery_remove(struct acpi_device *device)
{ … }
#ifdef CONFIG_PM_SLEEP
static int acpi_battery_resume(struct device *dev)
{ … }
#else
#define acpi_battery_resume …
#endif
static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
static struct acpi_driver acpi_battery_driver = …;
static int __init acpi_battery_init(void)
{ … }
static void __exit acpi_battery_exit(void)
{ … }
module_init(…) …;
module_exit(acpi_battery_exit);