34#include <sys/module.h>
35#include <sys/callout.h>
39#include <sys/kernel.h>
40#include <sys/kthread.h>
41#include <sys/limits.h>
42#include <sys/reboot.h>
44#include <sys/sysctl.h>
45#include <sys/unistd.h>
47#include <machine/bus.h>
48#include <machine/md_var.h>
53#include <dev/ofw/openfirm.h>
54#include <dev/ofw/ofw_bus.h>
55#include <powerpc/powermac/powermac_thermal.h>
112 device_printf(
dev,
"iicbus write failed\n");
115 pause(
"adm1030_write_byte", hz);
122 const char *name, *compatible;
125 phandle_t thermostat;
127 name = ofw_bus_get_name(
dev);
128 compatible = ofw_bus_get_compat(
dev);
129 handle = ofw_bus_get_node(
dev);
134 if (strcmp(name,
"fan") != 0 || strcmp(compatible,
"adm1030") != 0)
138 if (OF_getprop(handle,
"platform-getTemp", &thermostat,
sizeof(thermostat)) < 0)
141 sc = device_get_softc(
dev);
145 device_set_desc(
dev,
"G4 MDD Fan driver");
154 struct sysctl_ctx_list *ctx;
155 struct sysctl_oid *tree;
157 sc = device_get_softc(
dev);
167 if (config_intrhook_establish(&sc->
enum_hook) != 0)
170 ctx = device_get_sysctl_ctx(
dev);
171 tree = device_get_sysctl_tree(
dev);
172 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"pwm",
173 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
dev,
184 device_t
dev = (device_t) xdev;
186 sc = device_get_softc(
dev);
195 sc->
fan.max_rpm = 0x0F;
196 sc->
fan.default_rpm = 2;
198 strcpy(sc->
fan.name,
"MDD Case fan");
202 config_intrhook_disestablish(&sc->
enum_hook);
204 pmac_thermal_fan_register(&sc->
fan);
230 sc = device_get_softc(adm1030);
234 error = sysctl_handle_int(oidp, &pwm, 0, req);
236 if (error || !req->newptr)
static int adm1030_probe(device_t)
static int adm1030_set(struct adm1030_softc *fan, int pwm)
static int adm1030_sysctl(SYSCTL_HANDLER_ARGS)
static int adm1030_attach(device_t)
static driver_t adm1030_driver
static int adm1030_write_byte(device_t dev, uint32_t addr, uint8_t reg, uint8_t buf)
DRIVER_MODULE(adm1030, iicbus, adm1030_driver, adm1030_devclass, 0, 0)
static devclass_t adm1030_devclass
static void adm1030_start(void *xdev)
static device_method_t adm1030_methods[]
int iicbus_transfer(device_t bus, struct iic_msg *msgs, uint32_t nmsgs)
struct intr_config_hook enum_hook