linux-image-2.6.24-21-generic_2.6.24-21.40_i386.deb - tuning suggestions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

linux-image-2.6.24-21-generic_2.6.24-21.40_i386.deb - tuning suggestions

Jonas Petersson-2
Hi,

I just installed 2.6.24-21-generic and was pleasently surprised that a
number of MacBookPro Penryn specific stuff was already included.

As you are almost there, may I point out a few tiny things more that I
imagine are more or less critical for MacBookPro Penryn users?


* Apply applesmc-retry-when-accessing-keys.patch from
http://mactel-linux.svn.sourceforge.net/viewvc/mactel-linux/trunk/kernel/mactel-patches-2.6.24/

Without it applesmc sensors are not really useful as half the time
readings will fail. And while you are there, also apply
applesmc-remove-debugging-messages.patch to make dmesg useful again.

(The other patches on mactel seem less critical)

* drivers/hwmon/coretemp.c on line 374 - also permit:

                (c->x86_model == 0x17)

Without this adjustment, coretemp will not load.

                        Best / Jonas

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: linux-image-2.6.24-21-generic_2.6.24-21.40_i386.deb - tuning suggestions

Tim Gardner-2
Jonas Petersson wrote:

> Hi,
>
> I just installed 2.6.24-21-generic and was pleasently surprised that a
> number of MacBookPro Penryn specific stuff was already included.
>
> As you are almost there, may I point out a few tiny things more that I
> imagine are more or less critical for MacBookPro Penryn users?
>
>
> * Apply applesmc-retry-when-accessing-keys.patch from
> http://mactel-linux.svn.sourceforge.net/viewvc/mactel-linux/trunk/kernel/mactel-patches-2.6.24/
>
> Without it applesmc sensors are not really useful as half the time
> readings will fail. And while you are there, also apply
> applesmc-remove-debugging-messages.patch to make dmesg useful again.
>
> (The other patches on mactel seem less critical)
>
> * drivers/hwmon/coretemp.c on line 374 - also permit:
>
> (c->x86_model == 0x17)
>
> Without this adjustment, coretemp will not load.
>
> Best / Jonas
>

Since you have the hardware to experiment with, how about _you_ build
the kernel you are happy with and then attach those working patches in
an email to this list.

In order to satisfy Hardy SRU policies, these patches have to provably
solve an issue.

rtg
--
Tim Gardner [hidden email]

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

MacBookPro Penryn support for coretemp and applesmc

Jonas Petersson-2
Tim Gardner skrev:
> [...]
>
> Your original email was a little vague about what patches you wanted.
> Please reply to [hidden email] and attach the patches that
> you've _actually_ applied and tested. Also please include the provenance
> of the patch, though I assume they will all come from the mactel site.

Attached you will find three files: The two applesmc patches that will
retry sensor calls as well as remove all the debugging from dmesg&co -
these are downloaded from the mactel site inthe 2.6.24 directory.

I have also attached the tiny patch for coretemp which is simply one
line extracted from more recent kernels which makes the module recognize
the CPU in the MacBookPro Penryn.

I've successfully used them for two weeks (when I installed Hardy on my
MBP 4,1).

> Is there a reason these patches are not upstream?

No idea. The first two have been around on the site for ages and the
coretemp one is a very simple backport.

> A more informative subject would also help capture the attention of
> those who are interested in MacIntosh stuff.

Hope this helps.

                Thanks / Jonas

From: Jonas Petersson <[hidden email]>

Permit the CPU for the MacBook Pro 4,1 (Penryn) to be recognized by
coretemp. -- Intel(R) Core(TM)2 Duo CPU     T9300  @ 2.50GHz
---

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c~
index 156535d..3ee60d2 100644
--- a/usr/src/linux-source-2.6.24-20/drivers/hwmon/coretemp.c-org
+++ b/usr/src/linux-source-2.6.24-20/drivers/hwmon/coretemp.c
@@ -371,7 +371,7 @@ static int __init coretemp_init(void)
  /* check if family 6, models e, f, 16 */
  if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
     !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
- (c->x86_model == 0x16))) {
+                       (c->x86_model == 0x16) || (c->x86_model == 0x17))) {
 
  /* supported CPU not found, but report the unknown
    family 6 CPU */

commit f9b12606e452b43114836f7a75e6ed41738d78dc

From: Nicolas Boichat <[hidden email]>

Retry up to 200 ms when reading or writing keys.
---

 drivers/hwmon/applesmc.c |   69 +++++++++++++++++++++++++++++++---------------
 1 files changed, 47 insertions(+), 22 deletions(-)


diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 939e5ea..3c8b112 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -117,6 +117,9 @@ static const char* fan_speed_keys[] = {
 #define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */
 #define INIT_WAIT_MSECS 50 /* ... in 50ms increments */
 
+#define ACCESS_TIMEOUT_MSECS 500 /* wait up to 500ms when accessing a key */
+#define ACCESS_WAIT_MSECS 5 /* ... in 5ms increments */
+
 #define APPLESMC_POLL_INTERVAL 50 /* msecs */
 #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
 #define APPLESMC_INPUT_FLAT 4
@@ -191,12 +194,13 @@ static int __wait_status(u8 val)
 
 /*
  * applesmc_read_key - reads len bytes from a given key, and put them in buffer.
+ * Tries up to ACCESS_WAIT_MSECS to read the value.
  * Returns zero on success or a negative error on failure. Callers must
  * hold applesmc_lock.
  */
 static int applesmc_read_key(const char* key, u8* buffer, u8 len)
 {
- int i;
+ int i, total, ret;
 
  if (len > APPLESMC_MAX_DATA_LENGTH) {
  printk(KERN_ERR "applesmc_read_key: cannot read more than "
@@ -204,33 +208,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
  return -EINVAL;
  }
 
- outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
- if (__wait_status(0x0c))
- return -EIO;
+ for (total = ACCESS_TIMEOUT_MSECS; total > 0;
+ total -= ACCESS_WAIT_MSECS) {
+ ret = 0;
+ outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
+ if (__wait_status(0x0c)) {
+ ret = -EIO;
+ goto wait_fail;
+ }
 
- for (i = 0; i < 4; i++) {
- outb(key[i], APPLESMC_DATA_PORT);
- if (__wait_status(0x04))
- return -EIO;
- }
- if (debug)
- printk(KERN_DEBUG "<%s", key);
+ for (i = 0; i < 4; i++) {
+ outb(key[i], APPLESMC_DATA_PORT);
+ if (__wait_status(0x04)) {
+ ret = -EIO;
+ goto wait_fail;
+ }
+ }
+ if (debug)
+ printk(KERN_DEBUG "<%s", key);
 
- outb(len, APPLESMC_DATA_PORT);
- if (debug)
- printk(KERN_DEBUG ">%x", len);
+ outb(len, APPLESMC_DATA_PORT);
+ if (debug)
+ printk(KERN_DEBUG ">%x", len);
 
- for (i = 0; i < len; i++) {
- if (__wait_status(0x05))
- return -EIO;
- buffer[i] = inb(APPLESMC_DATA_PORT);
+ for (i = 0; i < len; i++) {
+ if (__wait_status(0x05)) {
+ ret = -EIO;
+ goto wait_fail;
+ }
+ buffer[i] = inb(APPLESMC_DATA_PORT);
+ if (debug)
+ printk(KERN_DEBUG "<%x", buffer[i]);
+ }
  if (debug)
- printk(KERN_DEBUG "<%x", buffer[i]);
+ printk(KERN_DEBUG "\n");
+
+ break;
+
+wait_fail:
+ msleep(ACCESS_WAIT_MSECS);
+ continue;
  }
- if (debug)
- printk(KERN_DEBUG "\n");
 
- return 0;
+ if (total != ACCESS_TIMEOUT_MSECS) {
+ printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
+ ACCESS_TIMEOUT_MSECS-total);
+ }
+
+ return ret;
 }
 
 /*

Remove debugging messages.

From: Nicolas Boichat <[hidden email]>


---

 drivers/hwmon/applesmc.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)


diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 3b09cdb..25204b4 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -133,7 +133,8 @@ struct dmi_match_data {
  int temperature_set;
 };
 
-static const int debug;
+static int debug = 0;
+module_param(debug, int, S_IRUGO|S_IWUSR);
 static struct platform_device *pdev;
 static s16 rest_x;
 static s16 rest_y;
@@ -172,7 +173,7 @@ static int __wait_status(u8 val)
 
  for (i = 0; i < 200; i++) {
  if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == val) {
- if (debug)
+ if (debug >= 9)
  printk(KERN_DEBUG
  "Waited %d us for status %x\n",
  i*10, val);
@@ -181,7 +182,8 @@ static int __wait_status(u8 val)
  udelay(10);
  }
 
- printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
+ if (debug >= 1)
+ printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
  val, inb(APPLESMC_CMD_PORT));
 
  return -EIO;
@@ -219,11 +221,11 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
  goto wait_fail;
  }
  }
- if (debug)
+ if (debug >= 9)
  printk(KERN_DEBUG "<%s", key);
 
  outb(len, APPLESMC_DATA_PORT);
- if (debug)
+ if (debug >= 9)
  printk(KERN_DEBUG ">%x", len);
 
  for (i = 0; i < len; i++) {
@@ -232,22 +234,16 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
  goto wait_fail;
  }
  buffer[i] = inb(APPLESMC_DATA_PORT);
- if (debug)
+ if (debug >= 9)
  printk(KERN_DEBUG "<%x", buffer[i]);
  }
- if (debug)
+ if (debug >= 9)
  printk(KERN_DEBUG "\n");
 
  break;
 
 wait_fail:
  msleep(ACCESS_WAIT_MSECS);
- continue;
- }
-
- if (total != ACCESS_TIMEOUT_MSECS) {
- printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
- ACCESS_TIMEOUT_MSECS-total);
  }
 
  return ret;
@@ -399,7 +395,7 @@ static int applesmc_device_init(void)
  mutex_lock(&applesmc_lock);
 
  for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
- if (debug)
+ if (debug >= 9)
  printk(KERN_DEBUG "applesmc try %d\n", total);
  if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
  (buffer[0] != 0x00 || buffer[1] != 0x00)) {

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team