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

Commit e270051d authored by Len Brown's avatar Len Brown
Browse files

Pull battery-sbs-ac into release branch

parents a2883dfa d5b4a3d0
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ config ACPI_PROC_EVENT

config ACPI_AC
	tristate "AC Adapter"
	depends on X86
	depends on X86 && POWER_SUPPLY
	default y
	help
	  This driver adds support for the AC Adapter object, which indicates
@@ -97,7 +97,7 @@ config ACPI_AC

config ACPI_BATTERY
	tristate "Battery"
	depends on X86
	depends on X86 && POWER_SUPPLY
	default y
	help
	  This driver adds support for battery information through
@@ -350,12 +350,11 @@ config ACPI_HOTPLUG_MEMORY
		$>modprobe acpi_memhotplug 

config ACPI_SBS
	tristate "Smart Battery System (EXPERIMENTAL)"
	tristate "Smart Battery System"
	depends on X86
	depends on EXPERIMENTAL
	depends on POWER_SUPPLY
	help
	  This driver adds support for the Smart Battery System.
	  A "Smart Battery" is quite old and quite rare compared
	  to today's ACPI "Control Method" battery.
	  This driver adds support for the Smart Battery System, another
	  type of access to battery information, found on some laptops.

endif	# ACPI
+1 −0
Original line number Diff line number Diff line
@@ -60,3 +60,4 @@ obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY)	+= acpi_memhotplug.o
obj-y				+= cm_sbs.o
obj-$(CONFIG_ACPI_SBS)		+= sbs.o
obj-$(CONFIG_ACPI_SBS)		+= sbshc.o
+31 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/power_supply.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>

@@ -72,16 +73,37 @@ static struct acpi_driver acpi_ac_driver = {
};

struct acpi_ac {
	struct power_supply charger;
	struct acpi_device * device;
	unsigned long state;
};

#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);

static const struct file_operations acpi_ac_fops = {
	.open = acpi_ac_open_fs,
	.read = seq_read,
	.llseek = seq_lseek,
	.release = single_release,
};
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);
	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,
};

/* --------------------------------------------------------------------------
                               AC Adapter Management
@@ -208,6 +230,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
		acpi_bus_generate_netlink_event(device->pnp.device_class,
						  device->dev.bus_id, event,
						  (u32) ac->state);
		kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
		break;
	default:
		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -244,7 +267,12 @@ static int acpi_ac_add(struct acpi_device *device)
	result = acpi_ac_add_fs(device);
	if (result)
		goto end;

	ac->charger.name = acpi_device_bid(device);
	ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
	ac->charger.properties = ac_props;
	ac->charger.num_properties = ARRAY_SIZE(ac_props);
	ac->charger.get_property = get_ac_property;
	power_supply_register(&ac->device->dev, &ac->charger);
	status = acpi_install_notify_handler(device->handle,
					     ACPI_ALL_NOTIFY, acpi_ac_notify,
					     ac);
@@ -279,7 +307,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type)

	status = acpi_remove_notify_handler(device->handle,
					    ACPI_ALL_NOTIFY, acpi_ac_notify);

	if (ac->charger.dev)
		power_supply_unregister(&ac->charger);
	acpi_ac_remove_fs(device);

	kfree(ac);
+436 −602

File changed.

Preview size limit exceeded, changes collapsed.

+15 −8
Original line number Diff line number Diff line
@@ -284,15 +284,11 @@ DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);

extern int event_is_open;

int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
int acpi_bus_generate_proc_event4(const char *device_class, const char *bus_id, u8 type, int data)
{
	struct acpi_bus_event *event = NULL;
	struct acpi_bus_event *event;
	unsigned long flags = 0;


	if (!device)
		return -EINVAL;

	/* drop event on the floor if no one's listening */
	if (!event_is_open)
		return 0;
@@ -301,8 +297,8 @@ int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
	if (!event)
		return -ENOMEM;

	strcpy(event->device_class, device->pnp.device_class);
	strcpy(event->bus_id, device->pnp.bus_id);
	strcpy(event->device_class, device_class);
	strcpy(event->bus_id, bus_id);
	event->type = type;
	event->data = data;

@@ -313,6 +309,17 @@ int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
	wake_up_interruptible(&acpi_bus_event_queue);

	return 0;

}

EXPORT_SYMBOL_GPL(acpi_bus_generate_proc_event4);

int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
{
	if (!device)
		return -EINVAL;
	return acpi_bus_generate_proc_event4(device->pnp.device_class,
					     device->pnp.bus_id, type, data);
}

EXPORT_SYMBOL(acpi_bus_generate_proc_event);
Loading