public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [PATCH] ppc64: Start the FCU in therm_pm72.c
Date: Tue, 03 Aug 2004 17:59:04 +1000	[thread overview]
Message-ID: <1091519944.7394.153.camel@gaston> (raw)

Some G5 recent powermacs start with the fan control unit (FCU) disabled,
by the firmware, causing the thermal control driver to break. We have to
enable it before starting the feedback loops that set the fan speeds. 
This patch adds the code to start the FCU.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

diff -urN linux-2.5/drivers/macintosh/therm_pm72.c ppc64/drivers/macintosh/therm_pm72.c
--- linux-2.5/drivers/macintosh/therm_pm72.c	2004-05-20 08:06:38.000000000 +1000
+++ ppc64/drivers/macintosh/therm_pm72.c	2004-08-03 16:28:50.005908096 +1000
@@ -317,6 +317,20 @@
 	return nw;
 }
 
+static int start_fcu(void)
+{
+	unsigned char buf = 0xff;
+	int rc;
+
+	rc = fan_write_reg(0xe, &buf, 1);
+	if (rc < 0)
+		return -EIO;
+	rc = fan_write_reg(0x2e, &buf, 1);
+	if (rc < 0)
+		return -EIO;
+	return 0;
+}
+
 static int set_rpm_fan(int fan, int rpm)
 {
 	unsigned char buf[2];
@@ -1011,6 +1025,12 @@
 
 	down(&driver_lock);
 
+	if (start_fcu() < 0) {
+		printk(KERN_ERR "kfand: failed to start FCU\n");
+		up(&driver_lock);
+		goto out;
+	}
+
 	/* Set the PCI fan once for now */
 	set_pwm_fan(SLOTS_FAN_PWM_ID, SLOTS_FAN_DEFAULT_PWM);
 
@@ -1057,6 +1077,7 @@
 			schedule_timeout(HZ - elapsed);
 	}
 
+ out:
 	DBG("main_control_loop ended\n");
 
 	ctrl_task = 0;
-- 
Benjamin Herrenschmidt <benh@kernel.crashing.org>


                 reply	other threads:[~2004-08-03  8:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1091519944.7394.153.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox