Revision: 133
http://svn.sourceforge.net/mactel-linux/?rev=133&view=rev
Author: nboichat
Date: 2007-06-27 06:14:46 -0700 (Wed, 27 Jun 2007)
Log Message:
-----------
Fix Macbook temperature readings.
Fix some patches using checkpatch.pl
Modified Paths:
--------------
trunk/kernel/mactel-patches-2.6.22/appleir.patch
trunk/kernel/mactel-patches-2.6.22/applesmc-use-input-polldev.patch
trunk/kernel/mactel-patches-2.6.22/applesmc_int.patch
trunk/kernel/mactel-patches-2.6.22/series
Added Paths:
-----------
trunk/kernel/mactel-patches-2.6.22/applesmc-add-macbook-temperature-keys.patch
Modified: trunk/kernel/mactel-patches-2.6.22/appleir.patch
===================================================================
--- trunk/kernel/mactel-patches-2.6.22/appleir.patch 2007-06-24 09:03:48 UTC
(rev 132)
+++ trunk/kernel/mactel-patches-2.6.22/appleir.patch 2007-06-27 13:14:46 UTC
(rev 133)
@@ -44,7 +44,7 @@
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
diff --git a/drivers/input/misc/appleir.c b/drivers/input/misc/appleir.c
new file mode 100644
-index 0000000..170cee6
+index 0000000..3ff46fc
--- /dev/null
+++ b/drivers/input/misc/appleir.c
@@ -0,0 +1,379 @@
@@ -110,7 +110,7 @@
+
+
+static struct usb_device_id appleir_ids[] = {
-+ {
++ {
+ USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR),
+ .driver_info = 0
+ },
@@ -145,7 +145,7 @@
+};
+
+static void dump_packet(struct appleir *appleir, char *msg,
-+ uint8_t * data, int len)
++ uint8_t *data, int len)
+{
+ int i;
+
@@ -184,7 +184,7 @@
+
+static void key_up_tick(unsigned long data)
+{
-+ struct appleir *apple_ir = (struct appleir*)data;
++ struct appleir *apple_ir = (struct appleir *)data;
+
+ if (apple_ir->current_key) {
+ key_up(apple_ir, apple_ir->current_key);
@@ -205,7 +205,7 @@
+ return;
+
+ if (!memcmp(data, keydown, sizeof(keydown))) {
-+ /*
++ /*
+ * If we already have a key down, take it up before marking
+ * this one down.
+ */
@@ -416,7 +416,7 @@
+ if (retval)
+ goto out;
+ info(DRIVER_VERSION ":" DRIVER_DESC);
-+ out:
++out:
+ return retval;
+}
+
Added:
trunk/kernel/mactel-patches-2.6.22/applesmc-add-macbook-temperature-keys.patch
===================================================================
---
trunk/kernel/mactel-patches-2.6.22/applesmc-add-macbook-temperature-keys.patch
(rev 0)
+++
trunk/kernel/mactel-patches-2.6.22/applesmc-add-macbook-temperature-keys.patch
2007-06-27 13:14:46 UTC (rev 133)
@@ -0,0 +1,46 @@
+Fix AppleSMC registers on non-pro Macbooks.
+
+From: Martin Szulecki <[EMAIL PROTECTED]>
+
+
+---
+
+ drivers/hwmon/applesmc.c | 14 +++++++++-----
+ 1 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
+index eb81a64..232cbad 100644
+--- a/drivers/hwmon/applesmc.c
++++ b/drivers/hwmon/applesmc.c
+@@ -79,11 +79,15 @@
+
+ /*
+ * Temperature sensors keys (sp78 - 2 bytes).
+- * First set for Macbook(Pro), second for Macmini.
+ */
+ static const char* temperature_sensors_sets[][13] = {
++/* Set 0: Macbook Pro */
+ { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
+ "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
++/* Set 1: Macbook set */
++ { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
++ "Th1H", "Ts0P", NULL },
++/* Set 2: Macmini set */
+ { "TC0D", "TC0P", NULL }
+ };
+
+@@ -1129,10 +1133,10 @@ static void applesmc_release_accelerometer(void)
+ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
+ /* MacBook Pro: accelerometer, backlight and temperature set 0 */
+ { .accelerometer = 1, .light = 1, .temperature_set = 0 },
+-/* MacBook: accelerometer and temperature set 0 */
+- { .accelerometer = 1, .light = 0, .temperature_set = 0 },
+-/* MacBook: temperature set 1 */
+- { .accelerometer = 0, .light = 0, .temperature_set = 1 }
++/* MacBook: accelerometer and temperature set 1 */
++ { .accelerometer = 1, .light = 0, .temperature_set = 1 },
++/* MacMini: temperature set 2 */
++ { .accelerometer = 0, .light = 0, .temperature_set = 2 }
+ };
+
+ /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
Modified: trunk/kernel/mactel-patches-2.6.22/applesmc-use-input-polldev.patch
===================================================================
--- trunk/kernel/mactel-patches-2.6.22/applesmc-use-input-polldev.patch
2007-06-24 09:03:48 UTC (rev 132)
+++ trunk/kernel/mactel-patches-2.6.22/applesmc-use-input-polldev.patch
2007-06-27 13:14:46 UTC (rev 133)
@@ -26,7 +26,7 @@
help
This driver provides support for the Apple System Management
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index e523851..ff56afd 100644
+index fd1281f..eb81a64 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -28,7 +28,7 @@
@@ -38,7 +38,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/timer.h>
-@@ -67,9 +67,9 @@
+@@ -59,9 +59,9 @@
#define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */
#define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */
@@ -50,7 +50,7 @@
#define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */
#define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */
-@@ -120,7 +120,7 @@ static const char* fan_speed_keys[] = {
+@@ -99,7 +99,7 @@ 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 */
@@ -59,7 +59,7 @@
#define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
#define APPLESMC_INPUT_FLAT 4
-@@ -142,8 +142,7 @@ static const int debug;
+@@ -121,8 +121,7 @@ static const int debug;
static struct platform_device *pdev;
static s16 rest_x;
static s16 rest_y;
@@ -69,7 +69,7 @@
static struct class_device *hwmon_class_dev;
/* Indicates whether this computer has an accelerometer. */
-@@ -155,7 +154,7 @@ static unsigned int applesmc_light;
+@@ -134,7 +133,7 @@ static unsigned int applesmc_light;
/* Indicates which temperature sensors set to use. */
static unsigned int applesmc_temperature_set;
@@ -78,7 +78,7 @@
/*
* Last index written to key_at_index sysfs file, and value to use for all
other
-@@ -593,27 +592,12 @@ static void applesmc_calibrate(void)
+@@ -451,27 +450,12 @@ static void applesmc_calibrate(void)
rest_x = -rest_x;
}
@@ -109,7 +109,7 @@
if (applesmc_read_motion_sensor(SENSOR_X, &x))
goto out;
-@@ -621,13 +605,11 @@ static void applesmc_idev_poll(unsigned long unused)
+@@ -479,13 +463,11 @@ static void applesmc_idev_poll(unsigned long unused)
goto out;
x = -x;
@@ -126,7 +126,7 @@
mutex_unlock(&applesmc_lock);
}
-@@ -959,8 +941,7 @@ static ssize_t applesmc_key_at_index_read_show(struct
device *dev,
+@@ -817,8 +799,7 @@ static ssize_t applesmc_key_at_index_read_show(struct
device *dev,
if (!ret) {
return info[0];
@@ -136,7 +136,7 @@
return ret;
}
}
-@@ -1359,6 +1340,7 @@ static int applesmc_dmi_match(struct dmi_system_id *id)
+@@ -1089,6 +1070,7 @@ static int applesmc_dmi_match(struct dmi_system_id *id)
/* Create accelerometer ressources */
static int applesmc_create_accelerometer(void)
{
@@ -144,7 +144,7 @@
int ret;
ret = sysfs_create_group(&pdev->dev.kobj,
-@@ -1366,40 +1348,37 @@ static int applesmc_create_accelerometer(void)
+@@ -1096,40 +1078,37 @@ static int applesmc_create_accelerometer(void)
if (ret)
goto out;
@@ -199,7 +199,7 @@
out_sysfs:
sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
-@@ -1412,8 +1391,8 @@ out:
+@@ -1142,8 +1121,8 @@ out:
/* Release all ressources used by the accelerometer */
static void applesmc_release_accelerometer(void)
{
@@ -210,7 +210,7 @@
sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
}
-@@ -1450,8 +1429,6 @@ static int __init applesmc_init(void)
+@@ -1180,8 +1159,6 @@ static int __init applesmc_init(void)
int count;
int i;
Modified: trunk/kernel/mactel-patches-2.6.22/applesmc_int.patch
===================================================================
--- trunk/kernel/mactel-patches-2.6.22/applesmc_int.patch 2007-06-24
09:03:48 UTC (rev 132)
+++ trunk/kernel/mactel-patches-2.6.22/applesmc_int.patch 2007-06-27
13:14:46 UTC (rev 133)
@@ -5,11 +5,11 @@
---
- drivers/hwmon/applesmc.c | 316 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 293 insertions(+), 23 deletions(-)
+ drivers/hwmon/applesmc.c | 321 +++++++++++++++++++++++++++++++++++++++++++---
+ 1 files changed, 298 insertions(+), 23 deletions(-)
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index fd1281f..e523851 100644
+index 232cbad..933a72d 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -39,14 +39,20 @@
@@ -41,12 +41,12 @@
+
#define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */
#define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */
- #define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
+ #define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
@@ -68,6 +76,19 @@
#define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
#define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-+/*
++/*
+ * Interrupt controls.
+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than
the
@@ -62,18 +62,18 @@
#define FANS_COUNT "FNum" /* r-o ui8 */
#define FANS_MANUAL "FS! " /* r-w ui16 */
#define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -348,12 +369,79 @@ static int applesmc_read_motion_sensor(int index, s16*
value)
+@@ -351,12 +372,83 @@ static int applesmc_read_motion_sensor(int index, s16*
value)
}
/*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes
in
++ * applesmc_init_check_key_value - checks if a given key contains the bytes in
+ * buffer, if not, writes these bytes.
+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
+ * waited more than INIT_TIMEOUT_MSECS in total.
+ * Returns zero on success or a negative error on failure. Callers must
+ * hold applesmc_lock.
+ */
-+static int applesmc_init_check_key_value(const char* key, u8* buffer, u8 len)
++static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
+{
+ int total, ret, i, compare;
+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
@@ -86,7 +86,8 @@
+ }
+
+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ if (!(ret = applesmc_read_key(key, rdbuffer, len))) {
++ ret = applesmc_read_key(key, rdbuffer, len);
++ if (!ret) {
+ compare = 1;
+ for (i = 0; i < len; i++) {
+ if (rdbuffer[i] != buffer[i]) {
@@ -97,7 +98,7 @@
+
+ if (compare) {
+ return 0;
-+ }
++ }
+ }
+ ret = applesmc_write_key(key, buffer, len);
+ msleep(INIT_WAIT_MSECS);
@@ -115,17 +116,20 @@
+
+ switch (int_type) {
+ case 0x60:
-+ printk("applesmc: received a free fall interrupt\n");
++ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
+ break;
+ case 0x6f:
-+ printk("applesmc: received a high acceleration interrupt\n");
++ printk(KERN_INFO
++ "applesmc: received a high acceleration interrupt\n");
+ break;
+ case 0x80:
-+ printk("applesmc: received a shock interrupt\n");
++ printk(KERN_INFO "applesmc: received a shock interrupt\n");
+ break;
+ default:
-+ printk("applesmc: received an unknown interrupt %x\n",
int_type);
-+ }
++ printk(KERN_INFO
++ "applesmc: received an unknown interrupt %x\n",
++ int_type);
++ }
+
+ return IRQ_HANDLED;
+}
@@ -143,7 +147,7 @@
u8 buffer[2];
if (!applesmc_accelerometer)
-@@ -361,32 +449,79 @@ static int applesmc_device_init(void)
+@@ -364,32 +456,79 @@ static int applesmc_device_init(void)
mutex_lock(&applesmc_lock);
@@ -172,7 +176,7 @@
- buffer[1] = 0x00;
- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
+ msleep(INIT_WAIT_MSECS);
+
+ if (!ret1)
+ break;
@@ -193,9 +197,10 @@
+ if (ret1 || ret2) {
+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
+ "interrupt interval, might not receive "
-+ "some interrupts.");
-+ }
-+
++ "some interrupts.");
+ }
+
+- printk(KERN_WARNING "applesmc: failed to init the device\n");
+ buffer[0] = 0x00;
+ buffer[1] = 0x60;
+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM, buffer, 2);
@@ -207,14 +212,14 @@
+ if (ret1 || ret2) {
+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
++ "might not receive some interrupts.");
+ }
+
+ /* Mysterious key. */
+ buffer[0] = 0x01;
+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
++ msleep(INIT_WAIT_MSECS);
+
+ if (!ret1)
+ break;
@@ -229,9 +234,8 @@
+ printk(KERN_WARNING "applesmc: failed to init "
+ "the accelerometer\n");
+ goto out;
- }
-
-- printk(KERN_WARNING "applesmc: failed to init the device\n");
++ }
++
+ ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler, IRQF_DISABLED,
+ "applesmc_irq_handler", NULL);
+
@@ -245,7 +249,7 @@
out:
mutex_unlock(&applesmc_lock);
-@@ -431,9 +566,16 @@ static int applesmc_resume(struct platform_device *dev)
+@@ -434,9 +573,16 @@ static int applesmc_resume(struct platform_device *dev)
return applesmc_device_init();
}
@@ -262,7 +266,7 @@
.driver = {
.name = "applesmc",
.owner = THIS_MODULE,
-@@ -913,6 +1055,122 @@ static ssize_t applesmc_key_at_index_store(struct
device *dev,
+@@ -898,6 +1044,123 @@ static ssize_t applesmc_key_at_index_store(struct
device *dev,
return count;
}
@@ -272,12 +276,12 @@
+ int ret;
+ unsigned int value = 0;
+ u8 buffer[2];
-+ char* key;
++ char *key;
+ int length;
+ struct sensor_device_attribute_2 *sensor_attr =
+ to_sensor_dev_attr_2(attr);
+
-+ switch(sensor_attr->index) {
++ switch (sensor_attr->index) {
+ case 0:
+ key = MOTION_LOW_NORM_INTERVAL;
+ length = 1;
@@ -295,7 +299,8 @@
+ length = 2;
+ break;
+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
++ printk(KERN_ERR
++ "Invalid index for applesmc_accelerometer_show");
+ return -EINVAL;
+ }
+
@@ -325,12 +330,12 @@
+ int ret;
+ u32 value;
+ u8 buffer[2];
-+ char* key;
++ char *key;
+ int length;
+ struct sensor_device_attribute_2 *sensor_attr =
+ to_sensor_dev_attr_2(attr);
+
-+ switch(sensor_attr->index) {
++ switch (sensor_attr->index) {
+ case 0:
+ key = MOTION_LOW_NORM_INTERVAL;
+ length = 1;
@@ -385,7 +390,7 @@
static struct led_classdev applesmc_backlight = {
.name = "smc:kbd_backlight",
.default_trigger = "nand-disk",
-@@ -924,10 +1182,22 @@ static DEVICE_ATTR(name, 0444, applesmc_name_show,
NULL);
+@@ -909,10 +1172,22 @@ static DEVICE_ATTR(name, 0444, applesmc_name_show,
NULL);
static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL);
static DEVICE_ATTR(calibrate, 0644,
applesmc_calibrate_show, applesmc_calibrate_store);
Modified: trunk/kernel/mactel-patches-2.6.22/series
===================================================================
--- trunk/kernel/mactel-patches-2.6.22/series 2007-06-24 09:03:48 UTC (rev
132)
+++ trunk/kernel/mactel-patches-2.6.22/series 2007-06-27 13:14:46 UTC (rev
133)
@@ -1,9 +1,10 @@
-# This series applies on GIT commit 75154f402ef18e459ff97ddece25656b6c2b329c
+# This series applies on GIT commit 48d8d7ee5dd17c64833e0343ab4ae8ef01cc2648
+applesmc-use-input-polldev.patch
+applesmc-add-macbook-temperature-keys.patch
sigmatel_audio2.patch
sigmatel_audio3.patch
applesmc_int.patch
appletouch.patch
appleir.patch
-applesmc-use-input-polldev.patch
appletouch-shut-up-when-it-has-nothing-to-say.patch
appletouch-fix-run-amok-problem.patch
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mactel-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mactel-linux-devel