diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-12-09 22:55:11 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-12-09 22:55:11 +0000 |
commit | 6722e34abb48d61ddb47393df0b32ac360687ccd (patch) | |
tree | 5e293ac9812faade8720bef8059b6e2df394444a /sys/arch/macppc | |
parent | 21d517dcf1f270c0eec90f094e0cec77444e2261 (diff) |
Add support for cpu voltage slewing.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/dev/smu.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/arch/macppc/dev/smu.c b/sys/arch/macppc/dev/smu.c index 389a3754c35..d9a0219ccd9 100644 --- a/sys/arch/macppc/dev/smu.c +++ b/sys/arch/macppc/dev/smu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smu.c,v 1.8 2005/11/19 02:18:00 pedro Exp $ */ +/* $OpenBSD: smu.c,v 1.9 2005/12/09 22:55:10 kettenis Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -25,6 +25,7 @@ #include <sys/sensors.h> #include <machine/autoconf.h> +#include <machine/cpu.h> #include <dev/clock_subr.h> #include <dev/i2c/i2cvar.h> @@ -123,6 +124,9 @@ struct smu_cmd { #define SMU_I2C_NORMAL 0x01 #define SMU_I2C_COMBINED 0x02 +/* Power Management */ +#define SMU_POWER 0xaa + /* Miscellaneous */ #define SMU_MISC 0xee #define SMU_MISC_GET_DATA 0x02 @@ -143,6 +147,8 @@ void smu_i2c_release_bus(void *, int); int smu_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t, void *buf, size_t, int); +void smu_slew_voltage(u_int); + #define GPIO_DDR 0x04 /* Data direction */ #define GPIO_DDR_OUTPUT 0x04 /* Output */ #define GPIO_DDR_INPUT 0x00 /* Input */ @@ -333,6 +339,8 @@ smu_attach(struct device *parent, struct device *self, void *aux) sensor_task_register(sc, smu_refresh_sensors, 5); printf("\n"); + ppc64_slew_voltage = smu_slew_voltage; + sc->sc_i2c_tag.ic_cookie = sc; sc->sc_i2c_tag.ic_acquire_bus = smu_i2c_acquire_bus; sc->sc_i2c_tag.ic_release_bus = smu_i2c_release_bus; @@ -668,3 +676,19 @@ smu_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr, memcpy(buf, &cmd->data[1], len); return (0); } + +void +smu_slew_voltage(u_int freq_scale) +{ + struct smu_softc *sc = smu_cd.cd_devs[0]; + struct smu_cmd *cmd = (struct smu_cmd *)sc->sc_cmd; + + cmd->cmd = SMU_POWER; + cmd->len = 8; + memcpy(cmd->data, "VSLEW", 5); + cmd->data[5] = 0xff; + cmd->data[6] = 1; + cmd->data[7] = freq_scale; + + smu_do_cmd(sc, 250); +} |