Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cd32099 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt
Browse files

powerpc/powermac: New windfarm driver for PowerMac G5 (AGP) and Xserve G5



This replaces the old therm_pm72 using the same windfarm infrastructure
that was used for other PowerMac G5 models. The fan speeds and sensors
should now be visible in the same location in sysfs.

The driver is split into separate core modules for PowerMac7,2 (and 7,3)
and RackMac3,1, with a lot of the shared code now in the separate sensor
and control modules.

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent a78a4a03
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -204,12 +204,15 @@ config THERM_ADT746X
	  better fan behaviour by default, and some manual control.

config THERM_PM72
	tristate "Support for thermal management on PowerMac G5"
	tristate "Support for thermal management on PowerMac G5 (AGP)"
	depends on I2C && I2C_POWERMAC && PPC_PMAC64
	default n
	help
	  This driver provides thermostat and fan control for the desktop
	  G5 machines.

	  This is deprecated, use windfarm instead.

config WINDFARM
	tristate "New PowerMac thermal control infrastructure"
	depends on PPC
@@ -221,6 +224,22 @@ config WINDFARM_PM81
	help
	  This driver provides thermal control for the iMacG5

config WINDFARM_PM72
	tristate "Support for thermal management on PowerMac G5 (AGP)"
	depends on WINDFARM && I2C && CPU_FREQ_PMAC64 && ADB_PMU
	select I2C_POWERMAC
	help
	  This driver provides thermal control for the PowerMac G5
	  "AGP" variants (PowerMac 7,2 and 7,3)

config WINDFARM_RM31
	tristate "Support for thermal management on Xserve G5"
	depends on WINDFARM && I2C && CPU_FREQ_PMAC64 && ADB_PMU
	select I2C_POWERMAC
	help
	  This driver provides thermal control for the Xserve G5
	  (RackMac3,1)

config WINDFARM_PM91
	tristate "Support for thermal management on PowerMac9,1"
	depends on WINDFARM && I2C && CPU_FREQ_PMAC64 && PMAC_SMU
+14 −0
Original line number Diff line number Diff line
@@ -29,6 +29,20 @@ obj-$(CONFIG_THERM_PM72) += therm_pm72.o
obj-$(CONFIG_THERM_WINDTUNNEL)	+= therm_windtunnel.o
obj-$(CONFIG_THERM_ADT746X)	+= therm_adt746x.o
obj-$(CONFIG_WINDFARM)	        += windfarm_core.o
obj-$(CONFIG_WINDFARM_PM72)     += windfarm_fcu_controls.o \
				   windfarm_ad7417_sensor.o \
				   windfarm_lm75_sensor.o \
				   windfarm_max6690_sensor.o \
				   windfarm_pid.o \
				   windfarm_cpufreq_clamp.o \
				   windfarm_pm72.o
obj-$(CONFIG_WINDFARM_RM31)     += windfarm_fcu_controls.o \
				   windfarm_ad7417_sensor.o \
				   windfarm_lm75_sensor.o \
				   windfarm_lm87_sensor.o \
				   windfarm_pid.o \
				   windfarm_cpufreq_clamp.o \
				   windfarm_rm31.o
obj-$(CONFIG_WINDFARM_PM81)     += windfarm_smu_controls.o \
				   windfarm_smu_sensors.o \
				   windfarm_lm75_sensor.o windfarm_pid.o \
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#include <linux/device.h>

/* Display a 16.16 fixed point value */
#define FIX32TOPRINT(f)	((f) >> 16),((((f) & 0xffff) * 1000) >> 16)
#define FIX32TOPRINT(f)	(((s32)(f)) >> 16),(((((s32)(f)) & 0xffff) * 1000) >> 16)

/*
 * Control objects
@@ -41,6 +41,7 @@ struct wf_control {
	int				type;
	struct kref			ref;
	struct device_attribute		attr;
	void				*priv;
};

#define WF_CONTROL_TYPE_GENERIC		0
+4 −6
Original line number Diff line number Diff line
@@ -169,8 +169,11 @@ static ssize_t wf_show_control(struct device *dev,
	int err;

	err = ctrl->ops->get_value(ctrl, &val);
	if (err < 0)
	if (err < 0) {
		if (err == -EFAULT)
			return sprintf(buf, "<HW FAULT>\n");
		return err;
	}
	switch(ctrl->type) {
	case WF_CONTROL_RPM_FAN:
		typestr = " RPM";
@@ -481,11 +484,6 @@ static int __init windfarm_core_init(void)
{
	DBG("wf: core loaded\n");

	/* Don't register on old machines that use therm_pm72 for now */
	if (of_machine_is_compatible("PowerMac7,2") ||
	    of_machine_is_compatible("PowerMac7,3") ||
	    of_machine_is_compatible("RackMac3,1"))
		return -ENODEV;
	platform_device_register(&wf_platform_device);
	return 0;
}
+0 −6
Original line number Diff line number Diff line
@@ -75,12 +75,6 @@ static int __init wf_cpufreq_clamp_init(void)
{
	struct wf_control *clamp;

	/* Don't register on old machines that use therm_pm72 for now */
	if (of_machine_is_compatible("PowerMac7,2") ||
	    of_machine_is_compatible("PowerMac7,3") ||
	    of_machine_is_compatible("RackMac3,1"))
		return -ENODEV;

	clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL);
	if (clamp == NULL)
		return -ENOMEM;
Loading