Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94a81cac authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -102,7 +102,7 @@ config ACPI_BUTTON


config ACPI_VIDEO
config ACPI_VIDEO
	tristate "Video"
	tristate "Video"
	depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL
	depends on X86 && BACKLIGHT_CLASS_DEVICE
	depends on INPUT
	depends on INPUT
	select THERMAL
	select THERMAL
	help
	help
+25 −0
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/power_supply.h>
#include <linux/acpi.h>
#include <linux/acpi.h>
#include "battery.h"


#define PREFIX "ACPI: "
#define PREFIX "ACPI: "


@@ -57,6 +58,7 @@ struct acpi_ac {
	struct power_supply charger;
	struct power_supply charger;
	struct platform_device *pdev;
	struct platform_device *pdev;
	unsigned long long state;
	unsigned long long state;
	struct notifier_block battery_nb;
};
};


#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger)
#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;
	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)
static int thinkpad_e530_quirk(const struct dmi_system_id *d)
{
{
	ac_sleep_before_get_state_ms = 1000;
	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),
	       acpi_device_name(adev), acpi_device_bid(adev),
	       ac->state ? "on-line" : "off-line");
	       ac->state ? "on-line" : "off-line");


	ac->battery_nb.notifier_call = acpi_ac_battery_notify;
	register_acpi_notifier(&ac->battery_nb);
end:
end:
	if (result)
	if (result)
		kfree(ac);
		kfree(ac);
@@ -261,6 +285,7 @@ static int acpi_ac_remove(struct platform_device *pdev)
	ac = platform_get_drvdata(pdev);
	ac = platform_get_drvdata(pdev);
	if (ac->charger.dev)
	if (ac->charger.dev)
		power_supply_unregister(&ac->charger);
		power_supply_unregister(&ac->charger);
	unregister_acpi_notifier(&ac->battery_nb);


	kfree(ac);
	kfree(ac);


+3 −4
Original line number Original line Diff line number Diff line
@@ -39,15 +39,13 @@
#include <linux/acpi.h>
#include <linux/acpi.h>
#include <linux/power_supply.h>
#include <linux/power_supply.h>


#include "battery.h"

#define PREFIX "ACPI: "
#define PREFIX "ACPI: "


#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF


#define ACPI_BATTERY_CLASS		"battery"
#define ACPI_BATTERY_DEVICE_NAME	"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 */
/* Battery power unit: 0 means mW, 1 means mA */
#define ACPI_BATTERY_POWER_UNIT_MA	1
#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,
	acpi_bus_generate_netlink_event(device->pnp.device_class,
					dev_name(&device->dev), event,
					dev_name(&device->dev), event,
					acpi_battery_present(battery));
					acpi_battery_present(battery));
	acpi_notifier_call_chain(device, event, acpi_battery_present(battery));
	/* acpi_battery_update could remove power_supply object */
	/* acpi_battery_update could remove power_supply object */
	if (old && battery->bat.dev)
	if (old && battery->bat.dev)
		power_supply_changed(&battery->bat);
		power_supply_changed(&battery->bat);

drivers/acpi/battery.h

0 → 100644
+10 −0
Original line number Original line Diff line number Diff line
#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
+1 −1
Original line number Original line Diff line number Diff line
@@ -37,12 +37,12 @@
#include <linux/power_supply.h>
#include <linux/power_supply.h>


#include "sbshc.h"
#include "sbshc.h"
#include "battery.h"


#define PREFIX "ACPI: "
#define PREFIX "ACPI: "


#define ACPI_SBS_CLASS			"sbs"
#define ACPI_SBS_CLASS			"sbs"
#define ACPI_AC_CLASS			"ac_adapter"
#define ACPI_AC_CLASS			"ac_adapter"
#define ACPI_BATTERY_CLASS		"battery"
#define ACPI_SBS_DEVICE_NAME		"Smart Battery System"
#define ACPI_SBS_DEVICE_NAME		"Smart Battery System"
#define ACPI_SBS_FILE_INFO		"info"
#define ACPI_SBS_FILE_INFO		"info"
#define ACPI_SBS_FILE_STATE		"state"
#define ACPI_SBS_FILE_STATE		"state"
Loading