mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
Merge branches 'acpi-battery' and 'acpi-video'
* acpi-battery: ACPI / AC: recheck adapter status upon battery status changes ACPI / battery: call ACPI notifier chain in acpi_battery_notify ACPI / battery: move some ACPI_BATTERY_* definitions to header * acpi-video: video / output: Drop display output class support fujitsu-laptop: Drop unneeded include acer-wmi: Stop selecting VIDEO_OUTPUT_CONTROL ACPI / gpu / drm: Stop selecting VIDEO_OUTPUT_CONTROL ACPI / video: fix ACPI_VIDEO dependencies
This commit is contained in:
commit
94a81caca3
14 changed files with 41 additions and 211 deletions
|
|
@ -102,7 +102,7 @@ config ACPI_BUTTON
|
|||
|
||||
config ACPI_VIDEO
|
||||
tristate "Video"
|
||||
depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL
|
||||
depends on X86 && BACKLIGHT_CLASS_DEVICE
|
||||
depends on INPUT
|
||||
select THERMAL
|
||||
help
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/power_supply.h>
|
||||
#include <linux/acpi.h>
|
||||
#include "battery.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
|
|
@ -57,6 +58,7 @@ struct acpi_ac {
|
|||
struct power_supply charger;
|
||||
struct platform_device *pdev;
|
||||
unsigned long long state;
|
||||
struct notifier_block battery_nb;
|
||||
};
|
||||
|
||||
#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger)
|
||||
|
|
@ -152,6 +154,26 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
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
|
||||
* notifcations are triggered when battery starts charging or
|
||||
* 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;
|
||||
}
|
||||
|
||||
static int thinkpad_e530_quirk(const struct dmi_system_id *d)
|
||||
{
|
||||
ac_sleep_before_get_state_ms = 1000;
|
||||
|
|
@ -215,6 +237,8 @@ static int acpi_ac_probe(struct platform_device *pdev)
|
|||
acpi_device_name(adev), acpi_device_bid(adev),
|
||||
ac->state ? "on-line" : "off-line");
|
||||
|
||||
ac->battery_nb.notifier_call = acpi_ac_battery_notify;
|
||||
register_acpi_notifier(&ac->battery_nb);
|
||||
end:
|
||||
if (result)
|
||||
kfree(ac);
|
||||
|
|
@ -261,6 +285,7 @@ static int acpi_ac_remove(struct platform_device *pdev)
|
|||
ac = platform_get_drvdata(pdev);
|
||||
if (ac->charger.dev)
|
||||
power_supply_unregister(&ac->charger);
|
||||
unregister_acpi_notifier(&ac->battery_nb);
|
||||
|
||||
kfree(ac);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,15 +39,13 @@
|
|||
#include <linux/acpi.h>
|
||||
#include <linux/power_supply.h>
|
||||
|
||||
#include "battery.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
|
||||
|
||||
#define ACPI_BATTERY_CLASS "battery"
|
||||
#define ACPI_BATTERY_DEVICE_NAME "Battery"
|
||||
#define ACPI_BATTERY_NOTIFY_STATUS 0x80
|
||||
#define ACPI_BATTERY_NOTIFY_INFO 0x81
|
||||
#define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82
|
||||
|
||||
/* Battery power unit: 0 means mW, 1 means mA */
|
||||
#define ACPI_BATTERY_POWER_UNIT_MA 1
|
||||
|
|
@ -736,6 +734,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
|
|||
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
||||
dev_name(&device->dev), event,
|
||||
acpi_battery_present(battery));
|
||||
acpi_notifier_call_chain(device, event, acpi_battery_present(battery));
|
||||
/* acpi_battery_update could remove power_supply object */
|
||||
if (old && battery->bat.dev)
|
||||
power_supply_changed(&battery->bat);
|
||||
|
|
|
|||
10
drivers/acpi/battery.h
Normal file
10
drivers/acpi/battery.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __ACPI_BATTERY_H
|
||||
#define __ACPI_BATTERY_H
|
||||
|
||||
#define ACPI_BATTERY_CLASS "battery"
|
||||
|
||||
#define ACPI_BATTERY_NOTIFY_STATUS 0x80
|
||||
#define ACPI_BATTERY_NOTIFY_INFO 0x81
|
||||
#define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82
|
||||
|
||||
#endif
|
||||
|
|
@ -37,12 +37,12 @@
|
|||
#include <linux/power_supply.h>
|
||||
|
||||
#include "sbshc.h"
|
||||
#include "battery.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define ACPI_SBS_CLASS "sbs"
|
||||
#define ACPI_AC_CLASS "ac_adapter"
|
||||
#define ACPI_BATTERY_CLASS "battery"
|
||||
#define ACPI_SBS_DEVICE_NAME "Smart Battery System"
|
||||
#define ACPI_SBS_FILE_INFO "info"
|
||||
#define ACPI_SBS_FILE_STATE "state"
|
||||
|
|
|
|||
Loading…
Reference in a new issue