[PATCH] More SMU commands

Benjamin Herrenschmidt benh at kernel.crashing.org
Mon Jan 8 12:12:10 EST 2007


> +#define SMU_CMD_POWER_EVENTS_COMMAND		0x8f
> +
> +/*
> + * Enables file server mode
> + *
> + * Meaning or use is unknown. Maybe this allows the machine to power up after
> + * AC loss.

Meaning and use are known :-) This defines events related to powering or
waking the machine up :-)

> + * Parameters:
> + *   2: always 0x00, meaning unknown
> + *   3: always 0x02, meaning unknown

Paremeters depend on the subcommand.

> + * Returns:
> + *   2 bytes
> + */
> +#define   SMU_CMD_POWER_EVENTS_SET_FILESERVER_MODE	0x01

Look at the corresponding PMU commands.

/* PMU PMU_POWER_EVENTS commands */
enum {
        PMU_PWR_GET_POWERUP_EVENTS      = 0x00,
        PMU_PWR_SET_POWERUP_EVENTS      = 0x01,
        PMU_PWR_CLR_POWERUP_EVENTS      = 0x02,
        PMU_PWR_GET_WAKEUP_EVENTS       = 0x03,
        PMU_PWR_SET_WAKEUP_EVENTS       = 0x04,
        PMU_PWR_CLR_WAKEUP_EVENTS       = 0x05,
};

(There might be others above 5 but that's the one I know about, they are
the same on the SMU).

The "POWERUP" events define events that can powerup the machine when
shut down. The "WAKEUP" events define events that can wake up the
machine when sleeping.

Both sets of commands are made of 3 base commands: GET, SET abd CLR. The
events are a 16 bits bit mask though from my experience, only the first
8 bits is ever used. GET reads the current mask afaik (though it might
not always work, I had issues in the past). SET enabled some events, CLR
disables some events.

The bit values for the events themselves aren't completly known, but
they seem to follow the same convention as the PMU, which is 

/* Power events wakeup bits */
enum {
        PMU_PWR_WAKEUP_KEY              = 0x01, /* Wake on key press */
        PMU_PWR_WAKEUP_AC_INSERT        = 0x02, /* Wake on AC adapter plug */
        PMU_PWR_WAKEUP_AC_CHANGE        = 0x04,
        PMU_PWR_WAKEUP_LID_OPEN         = 0x08,
        PMU_PWR_WAKEUP_RING             = 0x10,
};

So for example, a CLR with 0xff 0xff will clear all events. Then, a SET with
0x02 0x00 will enable "AC INSERT" event.

The way to enable file server mode is to enable POWERUP on the AC_INSERT
event.

Ben.






More information about the Linuxppc-dev mailing list