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

Merge branch 'acpi-dev-pm'

* acpi-dev-pm:
  ACPI / PM: Allow attach/detach routines to change device power states
  ACPI / PM: Introduce os_accessible flag for power_state
  ACPI / PM: Add check preventing transitioning to non-D0 state from D3.
  ACPI / PM: Fix build problem when CONFIG_ACPI or CONFIG_PM is not set
  ACPI / PM: Fix build problem related to acpi_target_system_state()
  ACPI / PM: Provide ACPI PM callback routines for subsystems
  ACPI / PM: Move device PM functions related to sleep states
  ACPI / PM: Provide device PM functions operating on struct acpi_device
  ACPI / PM: Split device wakeup management routines
  ACPI / PM: Move runtime remote wakeup setup routine to device_pm.c
  ACPI / PM: Move device power state selection routine to device_pm.c
  ACPI / PM: Move routines for adding/removing device wakeup notifiers
  ACPI / PM: Fix device PM kernedoc comments and #ifdefs
parents c8b68171 b88ce2a4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -21,9 +21,10 @@ obj-y += acpi.o \
acpi-y				+= osl.o utils.o reboot.o
acpi-y				+= nvs.o

# sleep related files
# Power management related files
acpi-y				+= wakeup.o
acpi-y				+= sleep.o
acpi-$(CONFIG_PM)		+= device_pm.o
acpi-$(CONFIG_ACPI_SLEEP)	+= proc.o


+18 −3
Original line number Diff line number Diff line
@@ -257,7 +257,15 @@ static int __acpi_bus_get_power(struct acpi_device *device, int *state)
}


static int __acpi_bus_set_power(struct acpi_device *device, int state)
/**
 * acpi_device_set_power - Set power state of an ACPI device.
 * @device: Device to set the power state of.
 * @state: New power state to set.
 *
 * Callers must ensure that the device is power manageable before using this
 * function.
 */
int acpi_device_set_power(struct acpi_device *device, int state)
{
	int result = 0;
	acpi_status status = AE_OK;
@@ -298,6 +306,12 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state)
	 * a lower-powered state.
	 */
	if (state < device->power.state) {
		if (device->power.state >= ACPI_STATE_D3_HOT &&
		    state != ACPI_STATE_D0) {
			printk(KERN_WARNING PREFIX
			      "Cannot transition to non-D0 state from D3\n");
			return -ENODEV;
		}
		if (device->power.flags.power_resources) {
			result = acpi_power_transition(device, state);
			if (result)
@@ -341,6 +355,7 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state)

	return result;
}
EXPORT_SYMBOL(acpi_device_set_power);


int acpi_bus_set_power(acpi_handle handle, int state)
@@ -359,7 +374,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
		return -ENODEV;
	}

	return __acpi_bus_set_power(device, state);
	return acpi_device_set_power(device, state);
}
EXPORT_SYMBOL(acpi_bus_set_power);

@@ -402,7 +417,7 @@ int acpi_bus_update_power(acpi_handle handle, int *state_p)
	if (result)
		return result;

	result = __acpi_bus_set_power(device, state);
	result = acpi_device_set_power(device, state);
	if (!result && state_p)
		*state_p = state;

+668 −0

File added.

Preview size limit exceeded, changes collapsed.

+8 −1
Original line number Diff line number Diff line
@@ -965,8 +965,10 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
		 * D3hot is only valid if _PR3 present.
		 */
		if (ps->resources.count ||
		    (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT))
		    (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT)) {
			ps->flags.valid = 1;
			ps->flags.os_accessible = 1;
		}

		ps->power = -1;	/* Unknown - driver assigned */
		ps->latency = -1;	/* Unknown - driver assigned */
@@ -982,6 +984,11 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
	if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set)
		device->power.states[ACPI_STATE_D3_COLD].flags.explicit_set = 1;

	/* Presence of _PS3 or _PRx means we can put the device into D3 cold */
	if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set ||
			device->power.flags.power_resources)
		device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1;

	acpi_bus_init_power(device);

	return 0;
+6 −185

File changed.

Preview size limit exceeded, changes collapsed.

Loading