sys/power.h: enum power_sstate_transition
Turn POWER_SLEEP_STATE_* defines into enum power_sstate_transition. Reviewed by: markj Approved by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52497
This commit is contained in:
@@ -1447,8 +1447,13 @@ acpi_ibm_eventhandler(struct acpi_ibm_softc *sc, int arg)
|
||||
|
||||
ACPI_SERIAL_BEGIN(ibm);
|
||||
switch (arg) {
|
||||
/*
|
||||
* XXX "Suspend-to-RAM" here is as opposed to suspend-to-disk, but it is
|
||||
* fine if our suspend sleep state transition request puts us in s2idle
|
||||
* instead of suspend-to-RAM.
|
||||
*/
|
||||
case IBM_EVENT_SUSPEND_TO_RAM:
|
||||
power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
|
||||
power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
|
||||
break;
|
||||
|
||||
case IBM_EVENT_BLUETOOTH:
|
||||
|
||||
@@ -3987,10 +3987,10 @@ scgetc(sc_softc_t *sc, u_int flags, struct sc_cnstate *sp)
|
||||
break;
|
||||
|
||||
case SUSP:
|
||||
power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
|
||||
power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
|
||||
break;
|
||||
case STBY:
|
||||
power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
|
||||
power_pm_suspend(POWER_SSTATE_TRANSITION_STANDBY);
|
||||
break;
|
||||
|
||||
case DBG:
|
||||
|
||||
@@ -804,11 +804,11 @@ vt_machine_kbdevent(struct vt_device *vd, int c)
|
||||
return (1);
|
||||
case SPCLKEY | STBY: /* XXX Not present in kbdcontrol parser. */
|
||||
/* Put machine into Stand-By mode. */
|
||||
power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
|
||||
power_pm_suspend(POWER_SSTATE_TRANSITION_STANDBY);
|
||||
return (1);
|
||||
case SPCLKEY | SUSP: /* kbdmap(5) keyword `susp`. */
|
||||
/* Suspend machine. */
|
||||
power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
|
||||
power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
@@ -176,25 +176,26 @@ power_pm_get_type(void)
|
||||
}
|
||||
|
||||
void
|
||||
power_pm_suspend(int state)
|
||||
power_pm_suspend(enum power_sstate_transition trans)
|
||||
{
|
||||
enum power_stype stype;
|
||||
|
||||
if (power_pm_fn == NULL)
|
||||
return;
|
||||
|
||||
switch (state) {
|
||||
case POWER_SLEEP_STATE_STANDBY:
|
||||
switch (trans) {
|
||||
case POWER_SSTATE_TRANSITION_STANDBY:
|
||||
stype = power_standby_stype;
|
||||
break;
|
||||
case POWER_SLEEP_STATE_SUSPEND:
|
||||
case POWER_SSTATE_TRANSITION_SUSPEND:
|
||||
stype = power_suspend_stype;
|
||||
break;
|
||||
case POWER_SLEEP_STATE_HIBERNATE:
|
||||
case POWER_SSTATE_TRANSITION_HIBERNATE:
|
||||
stype = power_hibernate_stype;
|
||||
break;
|
||||
default:
|
||||
printf("%s: unknown sleep state %d\n", __func__, state);
|
||||
printf("%s: unknown sleep state transition %d\n", __func__,
|
||||
trans);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+10
-8
@@ -45,22 +45,24 @@
|
||||
#define POWER_CMD_SUSPEND 0x00
|
||||
|
||||
/*
|
||||
* Sleep state.
|
||||
* Sleep state transition requests.
|
||||
*
|
||||
* These are high-level sleep states that the system can enter. They map to
|
||||
* a specific generic sleep type (enum power_stype).
|
||||
*/
|
||||
#define POWER_SLEEP_STATE_STANDBY 0x00
|
||||
#define POWER_SLEEP_STATE_SUSPEND 0x01
|
||||
#define POWER_SLEEP_STATE_HIBERNATE 0x02
|
||||
enum power_sstate_transition {
|
||||
POWER_SSTATE_TRANSITION_STANDBY,
|
||||
POWER_SSTATE_TRANSITION_SUSPEND,
|
||||
POWER_SSTATE_TRANSITION_HIBERNATE,
|
||||
};
|
||||
|
||||
/*
|
||||
* Sleep type.
|
||||
*
|
||||
* These are the specific generic methods of entering a sleep state. E.g.
|
||||
* POWER_SLEEP_STATE_SUSPEND could be set to enter either suspend-to-RAM (which
|
||||
* is S3 on ACPI systems), or suspend-to-idle (S0ix on ACPI systems). This
|
||||
* would be done through the kern.power.suspend sysctl.
|
||||
* POWER_SSTATE_TRANSITION_SUSPEND could be set to enter either suspend-to-RAM
|
||||
* (which is S3 on ACPI systems), or suspend-to-idle (S0ix on ACPI systems).
|
||||
* This would be done through the kern.power.suspend sysctl.
|
||||
*/
|
||||
enum power_stype {
|
||||
POWER_STYPE_AWAKE,
|
||||
@@ -94,7 +96,7 @@ extern int power_pm_register(u_int _pm_type, power_pm_fn_t _pm_fn,
|
||||
void *_pm_arg,
|
||||
bool _pm_supported[static POWER_STYPE_COUNT]);
|
||||
extern u_int power_pm_get_type(void);
|
||||
extern void power_pm_suspend(int);
|
||||
extern void power_pm_suspend(enum power_sstate_transition _trans);
|
||||
|
||||
/*
|
||||
* System power API.
|
||||
|
||||
Reference in New Issue
Block a user