summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Gardner <je_fro@gentoo.org>2008-02-27 17:50:51 +0000
committerJeffrey Gardner <je_fro@gentoo.org>2008-02-27 17:50:51 +0000
commita2a1d916124ce3dfc59e3047707fef73a3d5f499 (patch)
treec6e3afc5a91d5184e2d4f021b230412028181cff
parentlatest svn (diff)
downloadje_fro-a2a1d916124ce3dfc59e3047707fef73a3d5f499.tar.gz
je_fro-a2a1d916124ce3dfc59e3047707fef73a3d5f499.tar.bz2
je_fro-a2a1d916124ce3dfc59e3047707fef73a3d5f499.zip
latest svn and light cleanup
svn path=/; revision=185
-rw-r--r--sys-kernel/mactel-linux-sources/Manifest13
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-case-led.patch142
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-macbook2.patch76
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-retry-when-accessing-keys.patch (renamed from sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-retry-when-accessing-keys.patch)8
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc_int.patch (renamed from sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc_int.patch)31
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-add-macbook3-trackpad.patch50
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-new.patch364
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch.patch (renamed from sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch.patch)6
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/hid-add-new-apple-keyboard.patch152
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch28
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_fix_macbook_v2.patch30
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appleir-undo-hid-blacklist.patch30
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-add-macbook-temperature-keys.patch46
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-for-mac-pro-2-x-quad-core.patch202
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-use-input-polldev.patch221
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch-shut-up-when-it-has-nothing-to-say.patch202
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch_new.patch378
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r141/sigmatel-backport-2.6.23.patch341
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r3.ebuild (renamed from sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r3.ebuild)29
19 files changed, 895 insertions, 1454 deletions
diff --git a/sys-kernel/mactel-linux-sources/Manifest b/sys-kernel/mactel-linux-sources/Manifest
index b8a8c13..1673204 100644
--- a/sys-kernel/mactel-linux-sources/Manifest
+++ b/sys-kernel/mactel-linux-sources/Manifest
@@ -21,6 +21,16 @@ AUX 2.6.24-mactel-patches-r149/appletouch-new.patch 11503 RMD160 c557fa453270bc7
AUX 2.6.24-mactel-patches-r149/appletouch.patch 653 RMD160 7af72520cfc712a37ad3a44e2d7ffa66284cdd77 SHA1 0a2ae7c4d9057322be7bfe269c1724bbdcb1c6e6 SHA256 4ed7833238e497050fc175e2f41777e983a58ba61b6ed6034df307065e57cf8e
AUX 2.6.24-mactel-patches-r149/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 819 RMD160 8bec3f90f028e060695aebf0f8bae63778cd013c SHA1 19142c8fd86614727b95a0374539315995768e25 SHA256 94e7415487d455cbd1d0f6a3d5a393b4d008ac6dedf1a335a2aa40b70d6767f2
AUX 2.6.24-mactel-patches-r149/sigmatel_audio_fix_macbook_v2.patch 855 RMD160 f9a8a9c67f2a69e9e6cd5012c4a58e493d05930b SHA1 677656bd94f432aa92ad77b13c8fe32fd738a71b SHA256 4ad9524f09b2d3ffc2d3643be844a25e5ad11e7e7b4638e98340d10d27c5a722
+AUX 2.6.24-mactel-patches-r151/applesmc-case-led.patch 4329 RMD160 c983bf2caa205dc6cbebef97a29bcb83199fbd0b SHA1 001c03b338ca7a447fd05a4a610601d0d6698712 SHA256 3fe745f196839162578becd9a8fb6aaf9e6836244fb2cd5e0e9d798c46d852c2
+AUX 2.6.24-mactel-patches-r151/applesmc-macbook2.patch 3087 RMD160 cc8004b2cded1ab1e799f80892e9c0ead247f1ac SHA1 9ebdbe5427a962fc8fd1293f2ec5c6b0bf9472c2 SHA256 7e77a025094f33329d72b3173a59d7b45046e6e244b8f7fa86ac397fa6455eff
+AUX 2.6.24-mactel-patches-r151/applesmc-retry-when-accessing-keys.patch 3004 RMD160 424e9ddee6928a97eea55dbbbc8dec0ab5538b9b SHA1 262db3755ab837468aea2f7c89c755c5e597ac09 SHA256 82bf776bb5029f5a9a292c5a42109fa22f3ce5540122af5faad4ad273592c3c9
+AUX 2.6.24-mactel-patches-r151/applesmc_int.patch 11194 RMD160 6ee955475ad799c56db220b92b6d2b938fb18899 SHA1 3842ffa4320f3c2dac0c070a6782a68b7583461d SHA256 90c77b42bd95cbf521a6d8e551baa8cc031da63354ad9eb6e57b6d68c924cf70
+AUX 2.6.24-mactel-patches-r151/appletouch-add-macbook3-trackpad.patch 1553 RMD160 73c1d944cb9dbc2cfb36034927082dd18dc34fe7 SHA1 64a40fbd2fbbe64aca25354e5430d7323bcad3d0 SHA256 5d8df65b0b452592aacd5d28baa3197ced474cfd699a5e140277c4f2527fc2da
+AUX 2.6.24-mactel-patches-r151/appletouch-new.patch 11503 RMD160 c557fa453270bc7e871377a829dc8c5923d8cf67 SHA1 67b00340cf92ef4c000a6309250a5bda7393c74b SHA256 ac341736a16ac91ce596860e0c3c278a70a68b087c09b786a8bc6dc22de33e50
+AUX 2.6.24-mactel-patches-r151/appletouch.patch 653 RMD160 7af72520cfc712a37ad3a44e2d7ffa66284cdd77 SHA1 0a2ae7c4d9057322be7bfe269c1724bbdcb1c6e6 SHA256 4ed7833238e497050fc175e2f41777e983a58ba61b6ed6034df307065e57cf8e
+AUX 2.6.24-mactel-patches-r151/hid-add-new-apple-keyboard.patch 7103 RMD160 8bdb5b56f18d76dc6b4e88f66a4a0879f17b239e SHA1 b316416b5f218a058468de523716ba11316fa342 SHA256 6d6bc7bb44d08ee10ed7c386b67601a30ef292daa7343ea966eab998b88150d7
+AUX 2.6.24-mactel-patches-r151/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 819 RMD160 8bec3f90f028e060695aebf0f8bae63778cd013c SHA1 19142c8fd86614727b95a0374539315995768e25 SHA256 94e7415487d455cbd1d0f6a3d5a393b4d008ac6dedf1a335a2aa40b70d6767f2
+AUX 2.6.24-mactel-patches-r151/sigmatel_audio_fix_macbook_v2.patch 855 RMD160 f9a8a9c67f2a69e9e6cd5012c4a58e493d05930b SHA1 677656bd94f432aa92ad77b13c8fe32fd738a71b SHA256 4ad9524f09b2d3ffc2d3643be844a25e5ad11e7e7b4638e98340d10d27c5a722
AUX mactel-patches-r141/appleir-undo-hid-blacklist.patch 1243 RMD160 9cab09367c6aa4d4d77a4c7c3a04879e6ae6d24c SHA1 781ebfa912ab0cade15a2db978ec4bc0824e7211 SHA256 cbb945e2691f71f58baff171156778b99d59e31b89c10c604a2adf67cd29fa7e
AUX mactel-patches-r141/applesmc-add-macbook-temperature-keys.patch 1608 RMD160 55c9ee3672d26328eae98013d4bd1170d7980ada SHA1 9b545fe0aec185d4d074935b2e7bff68211892ba SHA256 8598fe0a787d14c48da1fa364bbfe4e38a21d1ef05d504adfb2c347e5a4faf37
AUX mactel-patches-r141/applesmc-for-mac-pro-2-x-quad-core.patch 7939 RMD160 f6974a36923a13d82565c7828e74656bf422df88 SHA1 146adfb5bab85466fefaff3f1066f52c74b0ddeb SHA256 5af5d1a007507126745cd29bbb2972e64232d83b7fb32e69f2fd0d147806f346
@@ -65,6 +75,8 @@ DIST genpatches-2.6.24-2.base.tar.bz2 22171 RMD160 59509ac6af64a2ef1d0be8c9409f3
DIST genpatches-2.6.24-2.extras.tar.bz2 43587 RMD160 a41366bb7372c168d4ede2de420256e25560122c SHA1 3a048660019206344a065beaa8dbaadbfa0a7f3b SHA256 8cee70233f609bd01c1645e9cb90c4637ee6f989b4583d652ea2df57a8894296
DIST genpatches-2.6.24-3.base.tar.bz2 22714 RMD160 826ab844e3f4d96f94e09d8763a0131d01bdce94 SHA1 1c50a62af1265684b8039d936a4fb044b3eb72b8 SHA256 51e9a3b0ca3f7434b9b0e91072509e7f697998efbfc869b6528daa7811bc2bb3
DIST genpatches-2.6.24-3.extras.tar.bz2 43587 RMD160 a41366bb7372c168d4ede2de420256e25560122c SHA1 3a048660019206344a065beaa8dbaadbfa0a7f3b SHA256 8cee70233f609bd01c1645e9cb90c4637ee6f989b4583d652ea2df57a8894296
+DIST genpatches-2.6.24-4.base.tar.bz2 39369 RMD160 c6c0bd063edbd4a2d1606cc53580530e6b0e01c4 SHA1 b6e0d72b5d452648ca3f33a529e4b6a063b10ed7 SHA256 bae9b6d932d18089283ca5ec4a8999b888dbf8d5ae3f5be8302c823f14b6f082
+DIST genpatches-2.6.24-4.extras.tar.bz2 43587 RMD160 a41366bb7372c168d4ede2de420256e25560122c SHA1 3a048660019206344a065beaa8dbaadbfa0a7f3b SHA256 8cee70233f609bd01c1645e9cb90c4637ee6f989b4583d652ea2df57a8894296
DIST linux-2.6.22.tar.bz2 45119878 RMD160 c4b2ca5ee8e71c0f8f1c95f3c9c5f261f2785912 SHA1 39401f195a618f397312d6d84ff9aebe28d99381 SHA256 73c10604c53f1a6ee65ef805293d23903696f8cef864f42d7de9506f0d2ba4c7
DIST linux-2.6.23.tar.bz2 45488158 RMD160 755690e80751d5de86d260fe05c6eeadde116c4e SHA1 3a186adf13e44415796ab6381aa8979b16a5d5ca SHA256 d4e67c0935ffb2a4158234bff92cc791b83177866009fc9b2214104e0038dbdb
DIST linux-2.6.24.tar.bz2 46737783 RMD160 0e5194c69c3d82c41ece689c4f84e638f8776d34 SHA1 351aebc784a5395fe4c92d1e514a89680482f7e2 SHA256 413c64fbbcf81244cb5571be4963644a1e81166a2b0f008a016528363b65c5d3
@@ -73,4 +85,5 @@ EBUILD mactel-linux-sources-2.6.23-r4.ebuild 1399 RMD160 8e498711091da40a9043349
EBUILD mactel-linux-sources-2.6.23.ebuild 1156 RMD160 4c3b8420602b14a72171871be7c020fc63c05035 SHA1 64eb69b750c1835baa6cb0c6739404e694458cae SHA256 67940fc4f01bde5f9de48f9fc40c24294115684e5f0b9ac8b8d40892e11e2119
EBUILD mactel-linux-sources-2.6.24-r1.ebuild 1151 RMD160 6ef9ab524a56008e0536378cfa3e112fc835dc45 SHA1 c18c164d49f76106c15110b44d83ab4311cc45c7 SHA256 b7520cdb8c33451468f85fbe8d7af1cdf47ca10a815e740cd53bedbc9f1a9b17
EBUILD mactel-linux-sources-2.6.24-r2.ebuild 1151 RMD160 3062875a537f2bc7b2f70eabbc3b92fdf18c1efe SHA1 8402bc13eecff1b22d86204971e5fae1fc5161aa SHA256 f8a459ee7d302c6ab1dff77ad2f632cbec43655ed02854548f55cef3fbfa5293
+EBUILD mactel-linux-sources-2.6.24-r3.ebuild 1196 RMD160 f5e02f5dc00c27d1af90a7fda0c259f5f79b6b3a SHA1 0b90bd716953e5fad55ac6ea05265a9db162191c SHA256 62933738e49924e7b33d0af3bcec6d43671bb82df2d9bf745f7014bad832a82f
EBUILD mactel-linux-sources-2.6.24.ebuild 1154 RMD160 ec564451d8faa0e069d228235b06a7715e40102b SHA1 691dc3f2e57b35f93e8b2bb3cfb7e73471355679 SHA256 8e018f64052e469682fc4a03d0465a79fc218ca4263231560f5a4f950777d0d7
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-case-led.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-case-led.patch
new file mode 100644
index 0000000..860f9d4
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-case-led.patch
@@ -0,0 +1,142 @@
+[PATCH] applesmc case led and SCSI LED activity trigger
+
+From: René Rebe <rene@exactcode.de>
+
+
+---
+
+ drivers/hwmon/applesmc.c | 70 ++++++++++++++++++++++++++++++++++++++++------
+ 1 files changed, 61 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
+index 86c66c3..377c96d 100644
+--- a/drivers/hwmon/applesmc.c
++++ b/drivers/hwmon/applesmc.c
+@@ -63,6 +63,8 @@
+
+ #define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
+
++#define LED_KEY "LSLF" /* r-w ui16 */
++
+ #define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */
+ #define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */
+ #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
+@@ -151,7 +153,7 @@ static DEFINE_MUTEX(applesmc_lock);
+ */
+ static unsigned int key_at_index;
+
+-static struct workqueue_struct *applesmc_led_wq;
++static struct workqueue_struct *applesmc_led_wq, *applesmc_backlight_wq;
+
+ /*
+ * __wait_status - Wait up to 2ms for the status port to get a certain value
+@@ -742,13 +744,40 @@ static void applesmc_backlight_set(struct work_struct *work)
+ }
+ static DECLARE_WORK(backlight_work, &applesmc_backlight_set);
+
+-static void applesmc_brightness_set(struct led_classdev *led_cdev,
+- enum led_brightness value)
++static void applesmc_backlight_brightness_set(struct led_classdev *led_cdev,
++ enum led_brightness value)
+ {
+ int ret;
+
+ backlight_value = value;
+- ret = queue_work(applesmc_led_wq, &backlight_work);
++ ret = queue_work(applesmc_backlight_wq, &backlight_work);
++
++ if (debug && (!ret))
++ printk(KERN_DEBUG "applesmc: work was already on the queue.\n");
++}
++
++/* Store the next LED value to be written by the work */
++static unsigned int led_value;
++
++static void applesmc_led_set(struct work_struct *work)
++{
++ u8 buffer[2];
++
++ mutex_lock(&applesmc_lock);
++ buffer[0] = led_value;
++ buffer[1] = 0x00;
++ applesmc_write_key(LED_KEY, buffer, 2);
++ mutex_unlock(&applesmc_lock);
++}
++static DECLARE_WORK(led_work, &applesmc_led_set);
++
++static void applesmc_led_brightness_set(struct led_classdev *led_cdev,
++ enum led_brightness value)
++{
++ int ret;
++
++ led_value = value;
++ ret = queue_work(applesmc_led_wq, &led_work);
+
+ if (debug && (!ret))
+ printk(KERN_DEBUG "applesmc: work was already on the queue.\n");
+@@ -904,10 +933,16 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
+ return count;
+ }
+
++static struct led_classdev applesmc_led = {
++ .name = "smc:case-led",
++ .default_trigger = "ide-disk",
++ .brightness_set = applesmc_led_brightness_set,
++};
++
+ static struct led_classdev applesmc_backlight = {
+ .name = "smc:kbd_backlight",
+ .default_trigger = "nand-disk",
+- .brightness_set = applesmc_brightness_set,
++ .brightness_set = applesmc_backlight_brightness_set,
+ };
+
+ static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL);
+@@ -1340,15 +1375,28 @@ static int __init applesmc_init(void)
+ goto out_temperature;
+ }
+
++ /* Create the workqueue */
++ applesmc_led_wq = create_singlethread_workqueue("applesmc-led");
++ if (!applesmc_led_wq) {
++ ret = -ENOMEM;
++ goto out_accelerometer;
++ }
++
++ /* register as a led device */
++ ret = led_classdev_register(&pdev->dev, &applesmc_led);
++ if (ret < 0)
++ goto out_led_wq;
++
++
+ if (applesmc_light) {
+ /* Add light sensor file */
+ ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_light.attr);
+ if (ret)
+- goto out_accelerometer;
++ goto out_led_ledclass;
+
+ /* Create the workqueue */
+- applesmc_led_wq = create_singlethread_workqueue("applesmc-led");
+- if (!applesmc_led_wq) {
++ applesmc_backlight_wq = create_singlethread_workqueue("applesmc-backlight");
++ if (!applesmc_backlight_wq) {
+ ret = -ENOMEM;
+ goto out_light_sysfs;
+ }
+@@ -1374,10 +1422,14 @@ out_light_ledclass:
+ led_classdev_unregister(&applesmc_backlight);
+ out_light_wq:
+ if (applesmc_light)
+- destroy_workqueue(applesmc_led_wq);
++ destroy_workqueue(applesmc_backlight_wq);
+ out_light_sysfs:
+ if (applesmc_light)
+ sysfs_remove_file(&pdev->dev.kobj, &dev_attr_light.attr);
++out_led_ledclass:
++ led_classdev_unregister(&applesmc_led);
++out_led_wq:
++ destroy_workqueue(applesmc_led_wq);
+ out_accelerometer:
+ if (applesmc_accelerometer)
+ applesmc_release_accelerometer();
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-macbook2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-macbook2.patch
new file mode 100644
index 0000000..ec3128a
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-macbook2.patch
@@ -0,0 +1,76 @@
+Add sensors set for MacBook2, from register dump on a mid-2007 MacBook2.
+
+From: Riki Oktarianto <rkoktarianto@gmail.com>
+
+
+---
+
+ drivers/hwmon/applesmc.c | 29 +++++++++++++++++++----------
+ 1 files changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
+index 86c66c3..c0dd9b1 100644
+--- a/drivers/hwmon/applesmc.c
++++ b/drivers/hwmon/applesmc.c
+@@ -84,12 +84,15 @@ static const char* temperature_sensors_sets[][36] = {
+ /* Set 0: Macbook Pro */
+ { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
+ "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
+-/* Set 1: Macbook set */
++/* Set 1: Macbook2 set */
++ { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "TTF0", "Th0H",
++ "Th0S", "Th1H", NULL },
++/* Set 2: Macbook set */
+ { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
+ "Th1H", "Ts0P", NULL },
+-/* Set 2: Macmini set */
++/* Set 3: Macmini set */
+ { "TC0D", "TC0P", NULL },
+-/* Set 3: Mac Pro (2 x Quad-Core) */
++/* Set 4: Mac Pro (2 x Quad-Core) */
+ { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P",
+ "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P",
+ "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S",
+@@ -1212,12 +1215,14 @@ 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 1 */
++/* MacBook2: accelerometer and temperature set 1 */
+ { .accelerometer = 1, .light = 0, .temperature_set = 1 },
+-/* MacMini: temperature set 2 */
+- { .accelerometer = 0, .light = 0, .temperature_set = 2 },
+-/* MacPro: temperature set 3 */
++/* MacBook: accelerometer and temperature set 2 */
++ { .accelerometer = 1, .light = 0, .temperature_set = 2 },
++/* MacMini: temperature set 3 */
+ { .accelerometer = 0, .light = 0, .temperature_set = 3 },
++/* MacPro: temperature set 4 */
++ { .accelerometer = 0, .light = 0, .temperature_set = 4 },
+ };
+
+ /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
+@@ -1229,16 +1234,20 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
+ (void*)&applesmc_dmi_data[0]},
+ { applesmc_dmi_match, "Apple MacBook", {
+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
+- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
++ DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") },
+ (void*)&applesmc_dmi_data[1]},
++ { applesmc_dmi_match, "Apple MacBook", {
++ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
++ DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
++ (void*)&applesmc_dmi_data[2]},
+ { applesmc_dmi_match, "Apple Macmini", {
+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
+ DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") },
+- (void*)&applesmc_dmi_data[2]},
++ (void*)&applesmc_dmi_data[3]},
+ { applesmc_dmi_match, "Apple MacPro2", {
+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
+ DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
+- (void*)&applesmc_dmi_data[3]},
++ (void*)&applesmc_dmi_data[4]},
+ { .ident = NULL }
+ };
+
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-retry-when-accessing-keys.patch
index 735ee79..a12be92 100644
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-retry-when-accessing-keys.patch
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-retry-when-accessing-keys.patch
@@ -9,10 +9,10 @@ From: Nicolas Boichat <nicolas@boichat.ch>
1 files changed, 47 insertions(+), 22 deletions(-)
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 56e4a59..99e64ee 100644
+index c0dd9b1..3b09cdb 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
-@@ -130,6 +130,9 @@ static const char* fan_speed_keys[] = {
+@@ -112,6 +112,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 */
@@ -22,7 +22,7 @@ index 56e4a59..99e64ee 100644
#define APPLESMC_POLL_INTERVAL 50 /* msecs */
#define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
#define APPLESMC_INPUT_FLAT 4
-@@ -204,12 +207,13 @@ static int __wait_status(u8 val)
+@@ -186,12 +189,13 @@ static int __wait_status(u8 val)
/*
* applesmc_read_key - reads len bytes from a given key, and put them in buffer.
@@ -37,7 +37,7 @@ index 56e4a59..99e64ee 100644
if (len > APPLESMC_MAX_DATA_LENGTH) {
printk(KERN_ERR "applesmc_read_key: cannot read more than "
-@@ -217,33 +221,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
+@@ -199,33 +203,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
return -EINVAL;
}
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc_int.patch
index 37b9948..d69f9df 100644
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc_int.patch
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc_int.patch
@@ -5,11 +5,11 @@ From: Nicolas Boichat <nicolas@boichat.ch>
---
- drivers/hwmon/applesmc.c | 321 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 298 insertions(+), 23 deletions(-)
+ drivers/hwmon/applesmc.c | 320 +++++++++++++++++++++++++++++++++++++++++++---
+ 1 files changed, 297 insertions(+), 23 deletions(-)
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 4b90444..56e4a59 100644
+index 3b09cdb..8f75b57 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -39,14 +39,20 @@
@@ -62,7 +62,7 @@ index 4b90444..56e4a59 100644
#define FANS_COUNT "FNum" /* r-o ui8 */
#define FANS_MANUAL "FS! " /* r-w ui16 */
#define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -357,12 +378,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
+@@ -385,12 +406,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
}
/*
@@ -147,7 +147,7 @@ index 4b90444..56e4a59 100644
u8 buffer[2];
if (!applesmc_accelerometer)
-@@ -370,32 +462,79 @@ static int applesmc_device_init(void)
+@@ -398,32 +490,79 @@ static int applesmc_device_init(void)
mutex_lock(&applesmc_lock);
@@ -176,7 +176,7 @@ index 4b90444..56e4a59 100644
- 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;
@@ -198,9 +198,8 @@ index 4b90444..56e4a59 100644
+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
+ "interrupt interval, might not receive "
+ "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);
@@ -219,7 +218,7 @@ index 4b90444..56e4a59 100644
+ 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;
@@ -234,8 +233,9 @@ index 4b90444..56e4a59 100644
+ 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);
+
@@ -249,7 +249,7 @@ index 4b90444..56e4a59 100644
out:
mutex_unlock(&applesmc_lock);
-@@ -440,9 +579,16 @@ static int applesmc_resume(struct platform_device *dev)
+@@ -468,9 +607,16 @@ static int applesmc_resume(struct platform_device *dev)
return applesmc_device_init();
}
@@ -266,7 +266,7 @@ index 4b90444..56e4a59 100644
.driver = {
.name = "applesmc",
.owner = THIS_MODULE,
-@@ -904,6 +1050,123 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
+@@ -932,6 +1078,122 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
return count;
}
@@ -386,11 +386,10 @@ index 4b90444..56e4a59 100644
+ else
+ return count;
+}
-+
static struct led_classdev applesmc_backlight = {
.name = "smc:kbd_backlight",
.default_trigger = "nand-disk",
-@@ -915,10 +1178,22 @@ static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL);
+@@ -943,10 +1205,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);
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-add-macbook3-trackpad.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-add-macbook3-trackpad.patch
new file mode 100644
index 0000000..feef8da
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-add-macbook3-trackpad.patch
@@ -0,0 +1,50 @@
+Added IDs for macbook3,1 trackpad
+
+From: Chris Irwin <chris@chrisirwin.ca>
+
+
+---
+
+ drivers/input/mouse/appletouch.c | 15 ++++++++++++++-
+ 1 files changed, 14 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
+index 17381a9..dcd9a0d 100644
+--- a/drivers/input/mouse/appletouch.c
++++ b/drivers/input/mouse/appletouch.c
+@@ -62,6 +62,11 @@
+ #define GEYSER4_ISO_PRODUCT_ID 0x021B
+ #define GEYSER4_JIS_PRODUCT_ID 0x021C
+
++/* Macbook3,1 devices */
++#define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229
++#define GEYSER4_HF_ISO_PRODUCT_ID 0x022A
++#define GEYSER4_HF_JIS_PRODUCT_ID 0x021B
++
+ #define ATP_DEVICE(prod) \
+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
+ USB_DEVICE_ID_MATCH_INT_CLASS | \
+@@ -93,6 +98,11 @@ static struct usb_device_id atp_table [] = {
+ { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) },
+ { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) },
+
++ /* Core2 Duo MacBook3,1 */
++ { ATP_DEVICE(GEYSER4_HF_ANSI_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) },
++
+ /* Terminating entry */
+ { }
+ };
+@@ -217,7 +227,10 @@ static inline int atp_is_geyser_3(struct atp *dev)
+ (productId == GEYSER3_JIS_PRODUCT_ID) ||
+ (productId == GEYSER4_ANSI_PRODUCT_ID) ||
+ (productId == GEYSER4_ISO_PRODUCT_ID) ||
+- (productId == GEYSER4_JIS_PRODUCT_ID);
++ (productId == GEYSER4_JIS_PRODUCT_ID) ||
++ (productId == GEYSER4_HF_ANSI_PRODUCT_ID) ||
++ (productId == GEYSER4_HF_ISO_PRODUCT_ID) ||
++ (productId == GEYSER4_HF_JIS_PRODUCT_ID);
+ }
+
+ /*
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-new.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-new.patch
new file mode 100644
index 0000000..4ca9035
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-new.patch
@@ -0,0 +1,364 @@
+New appletouch driver.
+
+From: Sven Anders <anders@anduras.de>
+
+
+---
+
+ drivers/input/mouse/appletouch.c | 160 +++++++++++++++++++++++++++++---------
+ 1 files changed, 121 insertions(+), 39 deletions(-)
+
+diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
+index dcd9a0d..5a3459c 100644
+--- a/drivers/input/mouse/appletouch.c
++++ b/drivers/input/mouse/appletouch.c
+@@ -8,6 +8,7 @@
+ * Copyright (C) 2005 Peter Osterlund (petero2@telia.com)
+ * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch)
+ * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch)
++ * Copyright (C) 2007-2008 Sven Anders (anders@anduras.de)
+ *
+ * Thanks to Alex Harper <basilisk@foobox.net> for his inputs.
+ *
+@@ -38,16 +39,18 @@
+ #define APPLE_VENDOR_ID 0x05AC
+
+ /* These names come from Info.plist in AppleUSBTrackpad.kext */
++
++/* PowerBooks Feb 2005 / iBooks */
+ #define FOUNTAIN_ANSI_PRODUCT_ID 0x020E
+ #define FOUNTAIN_ISO_PRODUCT_ID 0x020F
+-
+ #define FOUNTAIN_TP_ONLY_PRODUCT_ID 0x030A
+
+ #define GEYSER1_TP_ONLY_PRODUCT_ID 0x030B
+
+-#define GEYSER_ANSI_PRODUCT_ID 0x0214
+-#define GEYSER_ISO_PRODUCT_ID 0x0215
+-#define GEYSER_JIS_PRODUCT_ID 0x0216
++/* PowerBooks Oct 2005 */
++#define GEYSER2_ANSI_PRODUCT_ID 0x0214
++#define GEYSER2_ISO_PRODUCT_ID 0x0215
++#define GEYSER2_JIS_PRODUCT_ID 0x0216
+
+ /* MacBook devices */
+ #define GEYSER3_ANSI_PRODUCT_ID 0x0217
+@@ -58,9 +61,14 @@
+ * Geyser IV: same as Geyser III according to Info.plist in AppleUSBTrackpad.kext
+ * -> same IOClass (AppleUSBGrIIITrackpad), same acceleration tables
+ */
+-#define GEYSER4_ANSI_PRODUCT_ID 0x021A
+-#define GEYSER4_ISO_PRODUCT_ID 0x021B
+-#define GEYSER4_JIS_PRODUCT_ID 0x021C
++#define GEYSER4_ANSI_PRODUCT_ID 0x021A
++#define GEYSER4_ISO_PRODUCT_ID 0x021B
++#define GEYSER4_JIS_PRODUCT_ID 0x021C
++
++/* Macbook3,1 devices */
++#define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229
++#define GEYSER4_HF_ISO_PRODUCT_ID 0x022A
++#define GEYSER4_HF_JIS_PRODUCT_ID 0x021B
+
+ /* Macbook3,1 devices */
+ #define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229
+@@ -78,15 +86,17 @@
+
+ /* table of devices that work with this driver */
+ static struct usb_device_id atp_table [] = {
++
++ /* PowerBooks Feb 2005, iBooks G4 */
+ { ATP_DEVICE(FOUNTAIN_ANSI_PRODUCT_ID) },
+ { ATP_DEVICE(FOUNTAIN_ISO_PRODUCT_ID) },
+ { ATP_DEVICE(FOUNTAIN_TP_ONLY_PRODUCT_ID) },
+ { ATP_DEVICE(GEYSER1_TP_ONLY_PRODUCT_ID) },
+
+ /* PowerBooks Oct 2005 */
+- { ATP_DEVICE(GEYSER_ANSI_PRODUCT_ID) },
+- { ATP_DEVICE(GEYSER_ISO_PRODUCT_ID) },
+- { ATP_DEVICE(GEYSER_JIS_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER2_ANSI_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER2_ISO_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER2_JIS_PRODUCT_ID) },
+
+ /* Core Duo MacBook & MacBook Pro */
+ { ATP_DEVICE(GEYSER3_ANSI_PRODUCT_ID) },
+@@ -103,6 +113,11 @@ static struct usb_device_id atp_table [] = {
+ { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) },
+ { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) },
+
++ /* Core2 Duo MacBook3,1 */
++ { ATP_DEVICE(GEYSER4_HF_ANSI_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) },
++
+ /* Terminating entry */
+ { }
+ };
+@@ -146,12 +161,21 @@ MODULE_DEVICE_TABLE (usb, atp_table);
+ #define ATP_GEYSER_MODE_REQUEST_INDEX 0
+ #define ATP_GEYSER_MODE_VENDOR_VALUE 0x04
+
++/*
++ * Meaning of the status bits (only Geyser 3/4?)
++ */
++#define ATP_STATUS_BIT_BUTTON 0x01 /* The button was pressed */
++#define ATP_STATUS_BIT_UNKNOWN1 0x02 /* Unknown or unused */
++#define ATP_STATUS_BIT_BASE_UPDATE 0x04 /* Update of the base values (untouched pad) */
++#define ATP_STATUS_BIT_UNKNOWN2 0x08 /* Unknown or unused */
++#define ATP_STATUS_BIT_FROM_RESET 0x10 /* Reset previously performed */
++
+ /* Structure to hold all of our device specific stuff */
+ struct atp {
+ char phys[64];
+ struct usb_device * udev; /* usb device */
+ struct urb * urb; /* usb request block */
+- signed char * data; /* transferred data */
++ u8 * data; /* transferred data */
+ struct input_dev * input; /* input dev */
+ unsigned char open; /* non-zero if opened */
+ unsigned char valid; /* are the sensors valid ? */
+@@ -166,8 +190,8 @@ struct atp {
+ /* accumulated sensors */
+ int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
+ int datalen; /* size of an USB urb transfer */
+- int idlecount; /* number of empty packets */
+- struct work_struct work;
++ int idle_counter; /* number of empty packets */
++ struct work_struct work; /* kernel workqueue entry (for re-init) */
+ };
+
+ #define dbg_dump(msg, tab) \
+@@ -184,8 +208,12 @@ struct atp {
+ if (debug) printk(KERN_DEBUG format, ##a); \
+ } while (0)
+
+-MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann");
+-MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver");
++MODULE_AUTHOR("Johannes Berg");
++MODULE_AUTHOR("Stelian Pop");
++MODULE_AUTHOR("Frank Arnold");
++MODULE_AUTHOR("Michael Hanselmann");
++MODULE_AUTHOR("Sven Anders");
++MODULE_DESCRIPTION("Apple PowerBook and MacBook USB touchpad driver");
+ MODULE_LICENSE("GPL");
+
+ /*
+@@ -195,7 +223,7 @@ static int threshold = ATP_THRESHOLD;
+ module_param(threshold, int, 0644);
+ MODULE_PARM_DESC(threshold, "Discards any change in data from a sensor (trackpad has hundreds of these sensors) less than this value");
+
+-static int debug = 1;
++static int debug;
+ module_param(debug, int, 0644);
+ MODULE_PARM_DESC(debug, "Activate debugging output");
+
+@@ -213,12 +241,12 @@ static inline int atp_is_geyser_2(struct atp *dev)
+ {
+ u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
+
+- return (productId == GEYSER_ANSI_PRODUCT_ID) ||
+- (productId == GEYSER_ISO_PRODUCT_ID) ||
+- (productId == GEYSER_JIS_PRODUCT_ID);
++ return (productId == GEYSER2_ANSI_PRODUCT_ID) ||
++ (productId == GEYSER2_ISO_PRODUCT_ID) ||
++ (productId == GEYSER2_JIS_PRODUCT_ID);
+ }
+
+-static inline int atp_is_geyser_3(struct atp *dev)
++static inline int atp_is_geyser_3_4(struct atp *dev)
+ {
+ u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
+
+@@ -242,7 +270,7 @@ static int atp_geyser_init(struct usb_device *udev)
+ {
+ char data[8];
+ int size;
+-
++
+ size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
+ ATP_GEYSER_MODE_READ_REQUEST_ID,
+ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+@@ -250,6 +278,13 @@ static int atp_geyser_init(struct usb_device *udev)
+ ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
+
+ if (size != 8) {
++ if (debug)
++ {
++ int i;
++ printk("appletouch atp_geyser_init READ error\n");
++ for (i=0; i<8; i++)
++ printk("appletouch[%d]: %d\n", i, (int) data[i]);
++ }
+ err("Could not do mode read request from device"
+ " (Geyser Raw mode)");
+ return -EIO;
+@@ -265,6 +300,13 @@ static int atp_geyser_init(struct usb_device *udev)
+ ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
+
+ if (size != 8) {
++ if (debug)
++ {
++ int i;
++ printk("appletouch atp_geyser_init WRITE error\n");
++ for (i=0; i<8; i++)
++ printk("appletouch[%d]: %d\n", i, (int) data[i]);
++ }
+ err("Could not do mode write request to device"
+ " (Geyser Raw mode)");
+ return -EIO;
+@@ -282,8 +324,7 @@ static void atp_reinit(struct work_struct *work)
+ struct usb_device *udev = dev->udev;
+ int retval;
+
+- dev->idlecount = 0;
+-
++ dprintk("appletouch: putting appletouch to sleep (reinit)\n");
+ atp_geyser_init(udev);
+
+ retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
+@@ -398,7 +439,7 @@ static void atp_complete(struct urb* urb)
+ }
+
+ /* reorder the sensors values */
+- if (atp_is_geyser_3(dev)) {
++ if (atp_is_geyser_3_4(dev)) {
+ memset(dev->xy_cur, 0, sizeof(dev->xy_cur));
+
+ /*
+@@ -455,13 +496,20 @@ static void atp_complete(struct urb* urb)
+ dbg_dump("sample", dev->xy_cur);
+
+ if (!dev->valid) {
+- /* first sample */
++ /* first sample after init or resume */
+ dev->valid = 1;
+ dev->x_old = dev->y_old = -1;
+ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
++ dev->idle_counter = 0;
++
++ /* store first sample on older Geyser */
++ if ((dev->data[dev->datalen-1] & ATP_STATUS_BIT_BASE_UPDATE) ||
++ !atp_is_geyser_3_4(dev))
++ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
++
+
+ if (dev->size_detect_done ||
+- atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */
++ atp_is_geyser_3_4(dev)) /* No 17" Macbooks (yet) */
+ goto exit;
+
+ /* 17" Powerbooks have extra X sensors */
+@@ -487,26 +535,47 @@ static void atp_complete(struct urb* urb)
+ goto exit;
+ }
+
++ /* Just update the base values (i.e. touchpad in untouched state) */
++ if (dev->data[dev->datalen-1] & ATP_STATUS_BIT_BASE_UPDATE)
++ {
++ if (debug > 0) printk("appletouch: updated base values\n");
++
++ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
++ goto exit;
++ }
++
+ for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) {
+- /* accumulate the change */
+- signed char change = dev->xy_old[i] - dev->xy_cur[i];
+- dev->xy_acc[i] -= change;
++ /* calculate the change */
++ dev->xy_acc[i] = dev->xy_cur[i] - dev->xy_old[i];
++
++ /* this is a round-robin value, so couple with that */
++ if (dev->xy_acc[i] > 127)
++ dev->xy_acc[i] -= 256;
++
++ if (dev->xy_acc[i] < -127)
++ dev->xy_acc[i] += 256;
++
++ /* Needed for the older Geyser */
++ if (!atp_is_geyser_3_4(dev))
++ {
++ /* store new 'untouched' value, if any new */
++ if (dev->xy_acc[i] < -1)
++ dev->xy_old[i] = dev->xy_cur[i];
++ }
+
+ /* prevent down drifting */
+ if (dev->xy_acc[i] < 0)
+ dev->xy_acc[i] = 0;
+ }
+
+- memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
+-
+ dbg_dump("accumulator", dev->xy_acc);
+
+ x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS,
+ ATP_XFACT, &x_z, &x_f);
+ y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS,
+ ATP_YFACT, &y_z, &y_f);
+- key = dev->data[dev->datalen - 1] & 1;
+-
++ key = dev->data[dev->datalen - 1] & ATP_STATUS_BIT_BUTTON;
++
+ if (x && y) {
+ if (dev->x_old != -1) {
+ x = (dev->x_old * 3 + x) >> 2;
+@@ -551,16 +620,28 @@ static void atp_complete(struct urb* urb)
+ * work on Fountain touchpads.
+ */
+ if (!atp_is_fountain(dev)) {
++
++ /* Button must not be pressed when entering suspend,
++ otherwise we will never release the button. */
+ if (!x && !y && !key) {
+- dev->idlecount++;
+- if (dev->idlecount == 10) {
+- dev->valid = 0;
++
++ /* Idle counter */
++ dev->idle_counter++;
++
++ /* Wait for 10 more packages before suspending */
++ if (dev->idle_counter > 10) {
++
++ /* Reset counter */
++ dev->idle_counter = 0;
++
++ /* Prepare for device reset */
+ schedule_work(&dev->work);
++
+ /* Don't resubmit urb here, wait for reinit */
+ return;
+ }
+ } else
+- dev->idlecount = 0;
++ dev->idle_counter = 0;
+ }
+
+ exit:
+@@ -628,7 +709,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
+ dev->udev = udev;
+ dev->input = input_dev;
+ dev->overflowwarn = 0;
+- if (atp_is_geyser_3(dev))
++ if (atp_is_geyser_3_4(dev))
+ dev->datalen = 64;
+ else if (atp_is_geyser_2(dev))
+ dev->datalen = 64;
+@@ -671,7 +752,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
+
+ set_bit(EV_ABS, input_dev->evbit);
+
+- if (atp_is_geyser_3(dev)) {
++ if (atp_is_geyser_3_4(dev)) {
+ /*
+ * MacBook have 20 X sensors, 10 Y sensors
+ */
+@@ -714,6 +795,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
+ /* save our data pointer in this interface device */
+ usb_set_intfdata(iface, dev);
+
++ /* initialize kernel work queue for re-init out of interrupt context */
+ INIT_WORK(&dev->work, atp_reinit);
+
+ return 0;
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch.patch
index 194f980..d09b12a 100644
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch.patch
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch.patch
@@ -9,7 +9,7 @@ From: Ortwin Glück <odi@odi.ch>
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index e321526..c26af96 100644
+index b4423a4..17381a9 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -127,7 +127,7 @@ MODULE_DEVICE_TABLE (usb, atp_table);
@@ -19,5 +19,5 @@ index e321526..c26af96 100644
-#define ATP_THRESHOLD 5
+#define ATP_THRESHOLD 3
- /* MacBook Pro (Geyser 3 & 4) initialization constants */
- #define ATP_GEYSER3_MODE_READ_REQUEST_ID 1
+ /* Geyser initialization constants */
+ #define ATP_GEYSER_MODE_READ_REQUEST_ID 1
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/hid-add-new-apple-keyboard.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/hid-add-new-apple-keyboard.patch
new file mode 100644
index 0000000..4b085df
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/hid-add-new-apple-keyboard.patch
@@ -0,0 +1,152 @@
+diff -uNr linux-source-2.6.24/drivers/hid/hid-input.c linux-source-2.6.24-macbookair/drivers/hid/hid-input.c
+--- linux-source-2.6.24/drivers/hid/hid-input.c 2008-01-24 23:58:37.000000000 +0100
++++ linux-source-2.6.24-macbookair/drivers/hid/hid-input.c 2008-02-22 07:46:21.000000000 +0100
+@@ -119,6 +119,30 @@
+ { }
+ };
+
++static struct hidinput_key_translation apple_keyboard_fn_keys[] = {
++ { KEY_BACKSPACE, KEY_DELETE },
++ { KEY_F1, KEY_BRIGHTNESSDOWN, POWERBOOK_FLAG_FKEY },
++ { KEY_F2, KEY_BRIGHTNESSUP, POWERBOOK_FLAG_FKEY },
++ { KEY_F3, KEY_CYCLEWINDOWS, POWERBOOK_FLAG_FKEY },
++ { KEY_F4, KEY_CONFIG, POWERBOOK_FLAG_FKEY },
++ { KEY_F7, KEY_PREVIOUSSONG, POWERBOOK_FLAG_FKEY },
++ { KEY_F8, KEY_PLAYPAUSE, POWERBOOK_FLAG_FKEY },
++ { KEY_F9, KEY_NEXTSONG, POWERBOOK_FLAG_FKEY },
++ { KEY_F10, KEY_MUTE, POWERBOOK_FLAG_FKEY },
++ { KEY_F11, KEY_VOLUMEDOWN, POWERBOOK_FLAG_FKEY },
++ { KEY_F12, KEY_VOLUMEUP, POWERBOOK_FLAG_FKEY },
++ { KEY_UP, KEY_PAGEUP },
++ { KEY_DOWN, KEY_PAGEDOWN },
++ { KEY_LEFT, KEY_HOME },
++ { KEY_RIGHT, KEY_END },
++ { }
++};
++
++static struct hidinput_key_translation apple_keyboard[] = {
++ { KEY_VOLUMEUP, KEY_EJECTCD },
++ { }
++};
++
+ static struct hidinput_key_translation powerbook_numlock_keys[] = {
+ { KEY_J, KEY_KP1 },
+ { KEY_K, KEY_KP2 },
+@@ -176,8 +200,10 @@
+
+ if (hid_pb_fnmode) {
+ int do_translate;
+-
+- trans = find_translation(powerbook_fn_keys, usage->code);
++ if (hid->quirks & HID_QUIRK_APPLE_KEYBOARD)
++ trans = find_translation(apple_keyboard_fn_keys, usage->code);
++ else
++ trans = find_translation(powerbook_fn_keys, usage->code);
+ if (trans) {
+ if (test_bit(usage->code, hid->pb_pressed_fn))
+ do_translate = 1;
+@@ -200,8 +226,8 @@
+ }
+ }
+
+- if (test_bit(usage->code, hid->pb_pressed_numlock) ||
+- test_bit(LED_NUML, input->led)) {
++ if (!(hid->quirks & HID_QUIRK_APPLE_KEYBOARD) && (test_bit(usage->code, hid->pb_pressed_numlock) ||
++ test_bit(LED_NUML, input->led))) {
+ trans = find_translation(powerbook_numlock_keys, usage->code);
+
+ if (trans) {
+@@ -217,6 +243,14 @@
+ }
+ }
+
++ if (hid->quirks & HID_QUIRK_APPLE_KEYBOARD) {
++ trans = find_translation(apple_keyboard, usage->code);
++ if (trans) {
++ input_event(input, usage->type, trans->to, value);
++ return 1;
++ }
++ }
++
+ if (hid->quirks & HID_QUIRK_POWERBOOK_ISO_KEYBOARD) {
+ trans = find_translation(powerbook_iso_keyboard, usage->code);
+ if (trans) {
+@@ -241,6 +275,12 @@
+ for (trans = powerbook_numlock_keys; trans->from; trans++)
+ set_bit(trans->to, input->keybit);
+
++ for (trans = apple_keyboard_fn_keys; trans->from; trans++)
++ set_bit(trans->to, input->keybit);
++
++ for (trans = apple_keyboard; trans->from; trans++)
++ set_bit(trans->to, input->keybit);
++
+ for (trans = powerbook_iso_keyboard; trans->from; trans++)
+ set_bit(trans->to, input->keybit);
+
+diff -uNr linux-source-2.6.24/drivers/hid/usbhid/hid-quirks.c linux-source-2.6.24-macbookair/drivers/hid/usbhid/hid-quirks.c
+--- linux-source-2.6.24/drivers/hid/usbhid/hid-quirks.c 2008-01-24 23:58:37.000000000 +0100
++++ linux-source-2.6.24-macbookair/drivers/hid/usbhid/hid-quirks.c 2008-02-22 10:23:07.000000000 +0100
+@@ -59,6 +59,25 @@
+ #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a
+ #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b
+ #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
++
++/* Apple 2007 Wired keyboards */
++#define USB_DEVICE_ID_APPLE_KEYBOARD_ANSI 0x0220
++#define USB_DEVICE_ID_APPLE_KEYBOARD_ISO 0x0221
++#define USB_DEVICE_ID_APPLE_KEYBOARD_JIS 0x0222
++
++/* macbook3,1 keyboards */
++#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229
++#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a
++#define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b
++
++/* macbookair1,1 keyboards */
++#define USB_DEVICE_ID_APPLE_GEYSER5_HF_ANSI 0x0224
++
++/* Apple 2007 Wireless keyboards */
++#define USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_ANSI 0x022c
++#define USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_ISO 0x022d
++#define USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_JIS 0x022e
++
+ #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
+ #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
+ #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
+@@ -551,6 +570,25 @@
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
++
++ /* Apple 2007 Wired keyboards */
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_KEYBOARD_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_KEYBOARD_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_KEYBOARD_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
++
++ /* macbook3,1 keyboards */
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
++
++ /* macbookair1,1 keyboards */
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER5_HF_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
++
++ /* Apple 2007 Wireless keyboards */
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
++ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
++
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+
+diff -uNr linux-source-2.6.24/include/linux/hid.h linux-source-2.6.24-macbookair/include/linux/hid.h
+--- linux-source-2.6.24/include/linux/hid.h 2008-01-24 23:58:37.000000000 +0100
++++ linux-source-2.6.24-macbookair/include/linux/hid.h 2008-02-22 07:46:21.000000000 +0100
+@@ -281,6 +281,7 @@
+ #define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
+ #define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
+ #define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
++#define HID_QUIRK_APPLE_KEYBOARD 0x02000000
+
+ /*
+ * Separate quirks for runtime report descriptor fixup
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
new file mode 100644
index 0000000..f7b4cb9
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
@@ -0,0 +1,28 @@
+Display Macbook Pro 1st gen controls when the subsystem id is wrong (0x100).
+
+From: Nicolas Boichat <nicolas@boichat.ch>
+
+
+---
+
+ sound/pci/hda/patch_sigmatel.c | 4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
+index 0401223..c0e626b 100644
+--- a/sound/pci/hda/patch_sigmatel.c
++++ b/sound/pci/hda/patch_sigmatel.c
+@@ -2587,10 +2587,12 @@ static int patch_stac922x(struct hda_codec *codec)
+ case 0x106b1700:
+ case 0x106b0200:
+ case 0x106b1e00:
++ case 0x100: /* Invalid subsystem ID, happens randomly on
++ * MacBook Pro 1st generation
++ */
+ spec->board_config = STAC_INTEL_MAC_V3;
+ break;
+ case 0x106b1a00:
+- case 0x00000100:
+ spec->board_config = STAC_INTEL_MAC_V4;
+ break;
+ case 0x106b0a00:
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_fix_macbook_v2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_fix_macbook_v2.patch
new file mode 100644
index 0000000..a559167
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_fix_macbook_v2.patch
@@ -0,0 +1,30 @@
+Fixes audio on Macbook v2.
+
+From: Marek Sterzik <marek@milimetr.org>
+
+
+---
+
+ sound/pci/hda/patch_sigmatel.c | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
+index c0e626b..e7995f6 100644
+--- a/sound/pci/hda/patch_sigmatel.c
++++ b/sound/pci/hda/patch_sigmatel.c
+@@ -81,6 +81,7 @@ enum {
+ /* for backward compatibility */
+ STAC_MACMINI,
+ STAC_MACBOOK,
++ STAC_MACBOOK_V2,
+ STAC_MACBOOK_PRO_V1,
+ STAC_MACBOOK_PRO_V2,
+ STAC_IMAC_INTEL,
+@@ -905,6 +906,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = {
+ /* for backward compatibility */
+ [STAC_MACMINI] = "macmini",
+ [STAC_MACBOOK] = "macbook",
++ [STAC_MACBOOK_V2] = "macbook-v2",
+ [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
+ [STAC_MACBOOK_PRO_V2] = "macbook-pro",
+ [STAC_IMAC_INTEL] = "imac-intel",
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appleir-undo-hid-blacklist.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appleir-undo-hid-blacklist.patch
deleted file mode 100644
index 6d4e94d..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appleir-undo-hid-blacklist.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Undo USB HID blacklisting of Apple IR, as it is support by lirc now.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hid/usbhid/hid-quirks.c | 2 --
- 1 files changed, 0 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
-index f6c4145..3e64d56 100644
---- a/drivers/hid/usbhid/hid-quirks.c
-+++ b/drivers/hid/usbhid/hid-quirks.c
-@@ -61,7 +61,6 @@
- #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
- #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
- #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
--#define USB_DEVICE_ID_APPLE_IR 0x8240
-
- #define USB_VENDOR_ID_ATEN 0x0557
- #define USB_DEVICE_ID_ATEN_UC100KM 0x2004
-@@ -300,7 +299,6 @@ static const struct hid_blacklist {
- { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE },
-- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE },
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-add-macbook-temperature-keys.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-add-macbook-temperature-keys.patch
deleted file mode 100644
index 6f7caf4..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-add-macbook-temperature-keys.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-Fix AppleSMC registers on non-pro Macbooks.
-
-From: Martin Szulecki <mactel@sukimashita.com>
-
-
----
-
- 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..cea8d78 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".
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-for-mac-pro-2-x-quad-core.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-for-mac-pro-2-x-quad-core.patch
deleted file mode 100644
index 18ad843..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-for-mac-pro-2-x-quad-core.patch
+++ /dev/null
@@ -1,202 +0,0 @@
-At least the 2x Quad-Core Apple Mac Pro appears to have some over-heat
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-protection which suddenly powers off the whole box under load. This adds
-support for the fans and temerature sensors in the Mac Pro - later some
-"windwarm" a-like code should probably monitor the values. For now
-manually tweaking the fans prevents the sudden shutdown for me.
-
-cd /sys/devices/platform/applesmc.768
-for x in fan{1,2,3,4}; do
- echo 1 > ${x}_manual
- echo 1285 > ${x}_output
-done
-
-Two sensors are 0, while four are 129 °C, those might be removed again,
-later.
-
-Signed-off-by: René Rebe <rene@exactcode.de
-Cc: Mark M. Hoffman <mhoffman@lightlink.com>
-Cc: Nicolas Boichat <nicolas@boichat.ch>
-Cc: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- drivers/hwmon/applesmc.c | 107 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 101 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index cea8d78..4b90444 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -80,7 +80,7 @@
- /*
- * Temperature sensors keys (sp78 - 2 bytes).
- */
--static const char* temperature_sensors_sets[][13] = {
-+static const char* temperature_sensors_sets[][36] = {
- /* Set 0: Macbook Pro */
- { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
- "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
-@@ -88,7 +88,13 @@ static const char* temperature_sensors_sets[][13] = {
- { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
- "Th1H", "Ts0P", NULL },
- /* Set 2: Macmini set */
-- { "TC0D", "TC0P", NULL }
-+ { "TC0D", "TC0P", NULL },
-+/* Set 3: Mac Pro (2 x Quad-Core) */
-+ { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P",
-+ "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P",
-+ "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S",
-+ "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P",
-+ "TM9S", "TN0H", "TS0C", NULL },
- };
-
- /* List of keys used to read/write fan speeds */
-@@ -990,14 +996,18 @@ static struct attribute *fan##offset##_attributes[] = { \
-
- /*
- * Create the needed functions for each fan using the macro defined above
-- * (2 fans are supported)
-+ * (4 fans are supported)
- */
- sysfs_fan_speeds_offset(1);
- sysfs_fan_speeds_offset(2);
-+sysfs_fan_speeds_offset(3);
-+sysfs_fan_speeds_offset(4);
-
- static const struct attribute_group fan_attribute_groups[] = {
- { .attrs = fan1_attributes },
-- { .attrs = fan2_attributes }
-+ { .attrs = fan2_attributes },
-+ { .attrs = fan3_attributes },
-+ { .attrs = fan4_attributes }
- };
-
- /*
-@@ -1027,6 +1037,52 @@ static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO,
- applesmc_show_temperature, NULL, 10);
- static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO,
- applesmc_show_temperature, NULL, 11);
-+static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 12);
-+static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 13);
-+static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 14);
-+static SENSOR_DEVICE_ATTR(temp16_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 15);
-+static SENSOR_DEVICE_ATTR(temp17_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 16);
-+static SENSOR_DEVICE_ATTR(temp18_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 17);
-+static SENSOR_DEVICE_ATTR(temp19_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 18);
-+static SENSOR_DEVICE_ATTR(temp20_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 19);
-+static SENSOR_DEVICE_ATTR(temp21_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 20);
-+static SENSOR_DEVICE_ATTR(temp22_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 21);
-+static SENSOR_DEVICE_ATTR(temp23_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 22);
-+static SENSOR_DEVICE_ATTR(temp24_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 23);
-+static SENSOR_DEVICE_ATTR(temp25_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 24);
-+static SENSOR_DEVICE_ATTR(temp26_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 25);
-+static SENSOR_DEVICE_ATTR(temp27_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 26);
-+static SENSOR_DEVICE_ATTR(temp28_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 27);
-+static SENSOR_DEVICE_ATTR(temp29_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 28);
-+static SENSOR_DEVICE_ATTR(temp30_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 29);
-+static SENSOR_DEVICE_ATTR(temp31_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 30);
-+static SENSOR_DEVICE_ATTR(temp32_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 31);
-+static SENSOR_DEVICE_ATTR(temp33_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 32);
-+static SENSOR_DEVICE_ATTR(temp34_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 33);
-+static SENSOR_DEVICE_ATTR(temp35_input, S_IRUGO,
-+ applesmc_show_temperature, NULL, 34);
-
- static struct attribute *temperature_attributes[] = {
- &sensor_dev_attr_temp1_input.dev_attr.attr,
-@@ -1041,6 +1097,29 @@ static struct attribute *temperature_attributes[] = {
- &sensor_dev_attr_temp10_input.dev_attr.attr,
- &sensor_dev_attr_temp11_input.dev_attr.attr,
- &sensor_dev_attr_temp12_input.dev_attr.attr,
-+ &sensor_dev_attr_temp13_input.dev_attr.attr,
-+ &sensor_dev_attr_temp14_input.dev_attr.attr,
-+ &sensor_dev_attr_temp15_input.dev_attr.attr,
-+ &sensor_dev_attr_temp16_input.dev_attr.attr,
-+ &sensor_dev_attr_temp17_input.dev_attr.attr,
-+ &sensor_dev_attr_temp18_input.dev_attr.attr,
-+ &sensor_dev_attr_temp19_input.dev_attr.attr,
-+ &sensor_dev_attr_temp20_input.dev_attr.attr,
-+ &sensor_dev_attr_temp21_input.dev_attr.attr,
-+ &sensor_dev_attr_temp22_input.dev_attr.attr,
-+ &sensor_dev_attr_temp23_input.dev_attr.attr,
-+ &sensor_dev_attr_temp24_input.dev_attr.attr,
-+ &sensor_dev_attr_temp25_input.dev_attr.attr,
-+ &sensor_dev_attr_temp26_input.dev_attr.attr,
-+ &sensor_dev_attr_temp27_input.dev_attr.attr,
-+ &sensor_dev_attr_temp28_input.dev_attr.attr,
-+ &sensor_dev_attr_temp29_input.dev_attr.attr,
-+ &sensor_dev_attr_temp30_input.dev_attr.attr,
-+ &sensor_dev_attr_temp31_input.dev_attr.attr,
-+ &sensor_dev_attr_temp32_input.dev_attr.attr,
-+ &sensor_dev_attr_temp33_input.dev_attr.attr,
-+ &sensor_dev_attr_temp34_input.dev_attr.attr,
-+ &sensor_dev_attr_temp35_input.dev_attr.attr,
- NULL
- };
-
-@@ -1137,6 +1216,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
- { .accelerometer = 1, .light = 0, .temperature_set = 1 },
- /* MacMini: temperature set 2 */
- { .accelerometer = 0, .light = 0, .temperature_set = 2 },
-+/* MacPro: temperature set 3 */
-+ { .accelerometer = 0, .light = 0, .temperature_set = 3 },
- };
-
- /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
-@@ -1154,6 +1235,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
- DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") },
- (void*)&applesmc_dmi_data[2]},
-+ { applesmc_dmi_match, "Apple MacPro2", {
-+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
-+ DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
-+ (void*)&applesmc_dmi_data[3]},
- { .ident = NULL }
- };
-
-@@ -1204,9 +1289,19 @@ static int __init applesmc_init(void)
-
- switch (count) {
- default:
-- printk(KERN_WARNING "applesmc: More than 2 fans found,"
-- " but at most 2 fans are supported"
-+ printk(KERN_WARNING "applesmc: More than 4 fans found,"
-+ " but at most 4 fans are supported"
- " by the driver.\n");
-+ case 4:
-+ ret = sysfs_create_group(&pdev->dev.kobj,
-+ &fan_attribute_groups[3]);
-+ if (ret)
-+ goto out_key_enumeration;
-+ case 3:
-+ ret = sysfs_create_group(&pdev->dev.kobj,
-+ &fan_attribute_groups[2]);
-+ if (ret)
-+ goto out_key_enumeration;
- case 2:
- ret = sysfs_create_group(&pdev->dev.kobj,
- &fan_attribute_groups[1]);
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-use-input-polldev.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-use-input-polldev.patch
deleted file mode 100644
index a01777c..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/applesmc-use-input-polldev.patch
+++ /dev/null
@@ -1,221 +0,0 @@
-HWMON: applesmc - convert to use input-polldev.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Switch to using input-polldev skeleton instead of implementing
-polling loop by itself. This also fixes problem with trylock
-on a mutex in atomic context.
-
-Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
----
-
- drivers/hwmon/Kconfig | 1 +
- drivers/hwmon/applesmc.c | 83 +++++++++++++++++-----------------------------
- 2 files changed, 31 insertions(+), 53 deletions(-)
-
-diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
-index 13eea47..f0ab2ac 100644
---- a/drivers/hwmon/Kconfig
-+++ b/drivers/hwmon/Kconfig
-@@ -623,6 +623,7 @@ config SENSORS_APPLESMC
- depends on INPUT && X86
- select NEW_LEDS
- select LEDS_CLASS
-+ select INPUT_POLLDEV
- default n
- help
- This driver provides support for the Apple System Management
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index fd1281f..eb81a64 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -28,7 +28,7 @@
-
- #include <linux/delay.h>
- #include <linux/platform_device.h>
--#include <linux/input.h>
-+#include <linux/input-polldev.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/timer.h>
-@@ -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) */
--#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
-+#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
-
--#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
-+#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
-
- #define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */
-@@ -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 */
-
--#define APPLESMC_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */
-+#define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-
-@@ -121,8 +121,7 @@ static const int debug;
- static struct platform_device *pdev;
- static s16 rest_x;
- static s16 rest_y;
--static struct timer_list applesmc_timer;
--static struct input_dev *applesmc_idev;
-+static struct input_polled_dev *applesmc_idev;
- static struct class_device *hwmon_class_dev;
-
- /* Indicates whether this computer has an accelerometer. */
-@@ -134,7 +133,7 @@ static unsigned int applesmc_light;
- /* Indicates which temperature sensors set to use. */
- static unsigned int applesmc_temperature_set;
-
--static struct mutex applesmc_lock;
-+static DEFINE_MUTEX(applesmc_lock);
-
- /*
- * Last index written to key_at_index sysfs file, and value to use for all other
-@@ -451,27 +450,12 @@ static void applesmc_calibrate(void)
- rest_x = -rest_x;
- }
-
--static int applesmc_idev_open(struct input_dev *dev)
--{
-- add_timer(&applesmc_timer);
--
-- return 0;
--}
--
--static void applesmc_idev_close(struct input_dev *dev)
--{
-- del_timer_sync(&applesmc_timer);
--}
--
--static void applesmc_idev_poll(unsigned long unused)
-+static void applesmc_idev_poll(struct input_polled_dev *dev)
- {
-+ struct input_dev *idev = dev->input;
- s16 x, y;
-
-- /* Cannot sleep. Try nonblockingly. If we fail, try again later. */
-- if (!mutex_trylock(&applesmc_lock)) {
-- mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
-- return;
-- }
-+ mutex_lock(&applesmc_lock);
-
- if (applesmc_read_motion_sensor(SENSOR_X, &x))
- goto out;
-@@ -479,13 +463,11 @@ static void applesmc_idev_poll(unsigned long unused)
- goto out;
-
- x = -x;
-- input_report_abs(applesmc_idev, ABS_X, x - rest_x);
-- input_report_abs(applesmc_idev, ABS_Y, y - rest_y);
-- input_sync(applesmc_idev);
-+ input_report_abs(idev, ABS_X, x - rest_x);
-+ input_report_abs(idev, ABS_Y, y - rest_y);
-+ input_sync(idev);
-
- out:
-- mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
--
- mutex_unlock(&applesmc_lock);
- }
-
-@@ -817,8 +799,7 @@ static ssize_t applesmc_key_at_index_read_show(struct device *dev,
-
- if (!ret) {
- return info[0];
-- }
-- else {
-+ } else {
- return ret;
- }
- }
-@@ -1089,6 +1070,7 @@ static int applesmc_dmi_match(struct dmi_system_id *id)
- /* Create accelerometer ressources */
- static int applesmc_create_accelerometer(void)
- {
-+ struct input_dev *idev;
- int ret;
-
- ret = sysfs_create_group(&pdev->dev.kobj,
-@@ -1096,40 +1078,37 @@ static int applesmc_create_accelerometer(void)
- if (ret)
- goto out;
-
-- applesmc_idev = input_allocate_device();
-+ applesmc_idev = input_allocate_polled_device();
- if (!applesmc_idev) {
- ret = -ENOMEM;
- goto out_sysfs;
- }
-
-+ applesmc_idev->poll = applesmc_idev_poll;
-+ applesmc_idev->poll_interval = APPLESMC_POLL_INTERVAL;
-+
- /* initial calibrate for the input device */
- applesmc_calibrate();
-
-- /* initialize the input class */
-- applesmc_idev->name = "applesmc";
-- applesmc_idev->id.bustype = BUS_HOST;
-- applesmc_idev->dev.parent = &pdev->dev;
-- applesmc_idev->evbit[0] = BIT(EV_ABS);
-- applesmc_idev->open = applesmc_idev_open;
-- applesmc_idev->close = applesmc_idev_close;
-- input_set_abs_params(applesmc_idev, ABS_X,
-+ /* initialize the input device */
-+ idev = applesmc_idev->input;
-+ idev->name = "applesmc";
-+ idev->id.bustype = BUS_HOST;
-+ idev->dev.parent = &pdev->dev;
-+ idev->evbit[0] = BIT(EV_ABS);
-+ input_set_abs_params(idev, ABS_X,
- -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
-- input_set_abs_params(applesmc_idev, ABS_Y,
-+ input_set_abs_params(idev, ABS_Y,
- -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
-
-- ret = input_register_device(applesmc_idev);
-+ ret = input_register_polled_device(applesmc_idev);
- if (ret)
- goto out_idev;
-
-- /* start up our timer for the input device */
-- init_timer(&applesmc_timer);
-- applesmc_timer.function = applesmc_idev_poll;
-- applesmc_timer.expires = jiffies + APPLESMC_POLL_PERIOD;
--
- return 0;
-
- out_idev:
-- input_free_device(applesmc_idev);
-+ input_free_polled_device(applesmc_idev);
-
- out_sysfs:
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
-@@ -1142,8 +1121,8 @@ out:
- /* Release all ressources used by the accelerometer */
- static void applesmc_release_accelerometer(void)
- {
-- del_timer_sync(&applesmc_timer);
-- input_unregister_device(applesmc_idev);
-+ input_unregister_polled_device(applesmc_idev);
-+ input_free_polled_device(applesmc_idev);
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
- }
-
-@@ -1180,8 +1159,6 @@ static int __init applesmc_init(void)
- int count;
- int i;
-
-- mutex_init(&applesmc_lock);
--
- if (!dmi_check_system(applesmc_whitelist)) {
- printk(KERN_WARNING "applesmc: supported laptop not found!\n");
- ret = -ENODEV;
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch-shut-up-when-it-has-nothing-to-say.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch-shut-up-when-it-has-nothing-to-say.patch
deleted file mode 100644
index 7faa546..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch-shut-up-when-it-has-nothing-to-say.patch
+++ /dev/null
@@ -1,202 +0,0 @@
-The attached minimally intrusive patch is based on Matthew Garret's
-
-From: Soeren Sonnenburg <kernel@nn7.de>
-
-patch 'Make appletouch shut up when it has nothing to say' patches (e.g.
-http://lkml.org/lkml/2007/5/13/117): Matthews description follows /
-second paragraph lists my additional changes.
-
-The appletouch geyser3 devices found in the Intel Macs (and possibly some later
-PPC ones?) send a constant stream of packets after the first touch. This
-results in the kernel waking up around once every couple of milliseconds
-to process them, making it almost impossible to spend any significant
-period of time in C3 state on a dynamic HZ kernel. Sending the mode
-initialization code makes the device shut up until it's touched again.
-This patch does so after receiving 10 packets with no interesting
-content.
-
-In addition it now empties the work queue via cancel_work_sync on module
-exit, keeps all error checking and only reports BTN_LEFT presses if bit
-1 in the status byte (last byte in packet) is set. This fixes the random
-left clicks issue. Furthermore it invalidates touchpad data before the
-mode switch, which fixes the touchpad runs amok issue.
-
-Credits:
-Sven Anders found out that one should only check for bit 1 for BTN_LEFT.
-Matthew Garrett did the initial 'Make appletouch shut up when it has
-nothing to say' so I am adding him to the signed-off lines (hope that is
-the correct way).
-
-Patch follows inline and attached.
-
-Soeren.
-
-Signed-off-by: Soeren Sonnenburg <kernel@nn7.de>
-Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
----
-
- drivers/input/mouse/appletouch.c | 112 ++++++++++++++++++++++++++------------
- 1 files changed, 77 insertions(+), 35 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index c26af96..22182a7 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -155,6 +155,8 @@ struct atp {
- int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
- int overflowwarn; /* overflow warning printed? */
- int datalen; /* size of an USB urb transfer */
-+ int idlecount; /* number of empty packets */
-+ struct work_struct work;
- };
-
- #define dbg_dump(msg, tab) \
-@@ -208,6 +210,63 @@ static inline int atp_is_geyser_3(struct atp *dev)
- (productId == GEYSER4_JIS_PRODUCT_ID);
- }
-
-+/*
-+ * By default Geyser 3 device sends standard USB HID mouse
-+ * packets (Report ID 2). This code changes device mode, so it
-+ * sends raw sensor reports (Report ID 5).
-+ */
-+static int atp_geyser3_init(struct usb_device *udev)
-+{
-+ char data[8];
-+ int size;
-+ int i;
-+
-+ size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
-+ ATP_GEYSER3_MODE_READ_REQUEST_ID,
-+ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-+ ATP_GEYSER3_MODE_REQUEST_VALUE,
-+ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-+
-+ if (size != 8) {
-+ printk("appletouch atp_geyser3_init READ error\n");
-+ for (i=0; i<8; i++)
-+ printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+
-+ err("Could not do mode read request from device"
-+ " (Geyser 3 mode)");
-+ return -EIO;
-+ }
-+
-+ /* Apply the mode switch */
-+ data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
-+
-+ size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-+ ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
-+ USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-+ ATP_GEYSER3_MODE_REQUEST_VALUE,
-+ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-+
-+ if (size != 8) {
-+ printk("appletouch atp_geyser3_init WRITE error\n");
-+ for (i=0; i<8; i++)
-+ printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+ err("Could not do mode write request to device"
-+ " (Geyser 3 mode)");
-+ return -EIO;
-+ }
-+ return 0;
-+}
-+
-+/* Reinitialise the device if it's a geyser 3 */
-+static void atp_reinit(struct work_struct *work)
-+{
-+ struct atp *dev = container_of(work, struct atp, work);
-+ struct usb_device *udev = dev->udev;
-+
-+ dev->idlecount = 0;
-+ atp_geyser3_init(udev);
-+}
-+
- static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
- int *z, int *fingers)
- {
-@@ -449,11 +508,21 @@ static void atp_complete(struct urb* urb)
-
- /* reset the accumulator on release */
- memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
-- }
-
-- input_report_key(dev->input, BTN_LEFT,
-- !!dev->data[dev->datalen - 1]);
-+ /* Geyser 3 will continue to send packets continually after
-+ the first touch unless reinitialised. Do so if it's been
-+ idle for a while in order to avoid waking the kernel up
-+ several hundred times a second */
-+ if (atp_is_geyser_3(dev)) {
-+ dev->idlecount++;
-+ if (dev->idlecount == 10) {
-+ dev->valid=0;
-+ schedule_work (&dev->work);
-+ }
-+ }
-+ }
-
-+ input_report_key(dev->input, BTN_LEFT, dev->data[dev->datalen-1] & 1);
- input_sync(dev->input);
-
- exit:
-@@ -480,6 +549,7 @@ static void atp_close(struct input_dev *input)
- struct atp *dev = input_get_drvdata(input);
-
- usb_kill_urb(dev->urb);
-+ cancel_work_sync(&dev->work);
- dev->open = 0;
- }
-
-@@ -528,40 +598,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- dev->datalen = 81;
-
- if (atp_is_geyser_3(dev)) {
-- /*
-- * By default Geyser 3 device sends standard USB HID mouse
-- * packets (Report ID 2). This code changes device mode, so it
-- * sends raw sensor reports (Report ID 5).
-- */
-- char data[8];
-- int size;
--
-- size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
-- ATP_GEYSER3_MODE_READ_REQUEST_ID,
-- USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-- ATP_GEYSER3_MODE_REQUEST_VALUE,
-- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
--
-- if (size != 8) {
-- err("Could not do mode read request from device"
-- " (Geyser 3 mode)");
-+ /* switch to raw sensor mode */
-+ if (atp_geyser3_init(udev))
- goto err_free_devs;
-- }
--
-- /* Apply the mode switch */
-- data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
--
-- size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-- ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
-- USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-- ATP_GEYSER3_MODE_REQUEST_VALUE,
-- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-
-- if (size != 8) {
-- err("Could not do mode write request to device"
-- " (Geyser 3 mode)");
-- goto err_free_devs;
-- }
- printk("appletouch Geyser 3 inited.\n");
- }
-
-@@ -636,6 +676,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- /* save our data pointer in this interface device */
- usb_set_intfdata(iface, dev);
-
-+ INIT_WORK(&dev->work, atp_reinit);
-+
- return 0;
-
- err_free_buffer:
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch_new.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch_new.patch
deleted file mode 100644
index 47ccc2f..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/appletouch_new.patch
+++ /dev/null
@@ -1,378 +0,0 @@
-A few month ago I implemented palm-detection to the appletouch driver and
-
-From: Sven Anders <anders@anduras.de>
-
-released a development version. Currently I'm trying to reimplement these
-in a clean way and I'm planning to release it in parts, so I would be accepted
-by the kernel developers.
-
-Late in the develoment progress I found out, that the new Geyser 3/4 touchpad
-have special status flags. This patch implements the usage of them and corrects
-the calculation of the pressure (for later usage by the palm detection).
-
-It was tested by some debian people (Johannes Berg, Michel Dänzer, Gaudenz
-Steinlin) on the PowerBook and works there too.
----
-
- drivers/input/mouse/appletouch.c | 171 +++++++++++++++++++++++++-------------
- 1 files changed, 114 insertions(+), 57 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index 22182a7..7d83d86 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -8,8 +8,12 @@
- * Copyright (C) 2005 Peter Osterlund (petero2@telia.com)
- * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch)
- * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch)
-+ * Copyright (C) 2007 Sven Anders (anders@anduras.de)
- *
- * Thanks to Alex Harper <basilisk@foobox.net> for his inputs.
-+ * Jason Parekh <jasonparekh@gmail.com> for better finger detection.
-+ * Matthew Garrett <mjg59@srcf.ucam.org> for power saving additions.
-+ * Soeren Sonnenburg <mactel-ml@nn7.de> for corrections and ideas.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -38,16 +42,17 @@
- #define APPLE_VENDOR_ID 0x05AC
-
- /* These names come from Info.plist in AppleUSBTrackpad.kext */
-+
-+/* PowerBooks Feb 2005 / iBooks */
- #define FOUNTAIN_ANSI_PRODUCT_ID 0x020E
- #define FOUNTAIN_ISO_PRODUCT_ID 0x020F
--
- #define FOUNTAIN_TP_ONLY_PRODUCT_ID 0x030A
--
- #define GEYSER1_TP_ONLY_PRODUCT_ID 0x030B
-
--#define GEYSER_ANSI_PRODUCT_ID 0x0214
--#define GEYSER_ISO_PRODUCT_ID 0x0215
--#define GEYSER_JIS_PRODUCT_ID 0x0216
-+/* PowerBooks Oct 2005 */
-+#define GEYSER2_ANSI_PRODUCT_ID 0x0214
-+#define GEYSER2_ISO_PRODUCT_ID 0x0215
-+#define GEYSER2_JIS_PRODUCT_ID 0x0216
-
- /* MacBook devices */
- #define GEYSER3_ANSI_PRODUCT_ID 0x0217
-@@ -58,9 +63,9 @@
- * Geyser IV: same as Geyser III according to Info.plist in AppleUSBTrackpad.kext
- * -> same IOClass (AppleUSBGrIIITrackpad), same acceleration tables
- */
--#define GEYSER4_ANSI_PRODUCT_ID 0x021A
--#define GEYSER4_ISO_PRODUCT_ID 0x021B
--#define GEYSER4_JIS_PRODUCT_ID 0x021C
-+#define GEYSER4_ANSI_PRODUCT_ID 0x021A
-+#define GEYSER4_ISO_PRODUCT_ID 0x021B
-+#define GEYSER4_JIS_PRODUCT_ID 0x021C
-
- #define ATP_DEVICE(prod) \
- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
-@@ -73,15 +78,17 @@
-
- /* table of devices that work with this driver */
- static struct usb_device_id atp_table [] = {
-+
-+ /* PowerBooks Feb 2005, iBooks G4 */
- { ATP_DEVICE(FOUNTAIN_ANSI_PRODUCT_ID) },
- { ATP_DEVICE(FOUNTAIN_ISO_PRODUCT_ID) },
- { ATP_DEVICE(FOUNTAIN_TP_ONLY_PRODUCT_ID) },
- { ATP_DEVICE(GEYSER1_TP_ONLY_PRODUCT_ID) },
-
- /* PowerBooks Oct 2005 */
-- { ATP_DEVICE(GEYSER_ANSI_PRODUCT_ID) },
-- { ATP_DEVICE(GEYSER_ISO_PRODUCT_ID) },
-- { ATP_DEVICE(GEYSER_JIS_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER2_ANSI_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER2_ISO_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER2_JIS_PRODUCT_ID) },
-
- /* Core Duo MacBook & MacBook Pro */
- { ATP_DEVICE(GEYSER3_ANSI_PRODUCT_ID) },
-@@ -127,7 +134,7 @@ MODULE_DEVICE_TABLE (usb, atp_table);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 3
-+#define ATP_THRESHOLD 5
-
- /* MacBook Pro (Geyser 3 & 4) initialization constants */
- #define ATP_GEYSER3_MODE_READ_REQUEST_ID 1
-@@ -136,27 +143,36 @@ MODULE_DEVICE_TABLE (usb, atp_table);
- #define ATP_GEYSER3_MODE_REQUEST_INDEX 0
- #define ATP_GEYSER3_MODE_VENDOR_VALUE 0x04
-
-+/*
-+ * Meaning of the status bits (only Geyser 3/4?)
-+ */
-+#define ATP_STATUS_BIT_BUTTON 0x01 /* The button was pressed */
-+#define ATP_STATUS_BIT_UNKNOWN1 0x02 /* Unknown or unused */
-+#define ATP_STATUS_BIT_BASE_UPDATE 0x04 /* Update of the base values (untouched pad) */
-+#define ATP_STATUS_BIT_UNKNOWN2 0x08 /* Unknown or unused */
-+#define ATP_STATUS_BIT_FROM_RESET 0x10 /* Reset previously performed */
-+
- /* Structure to hold all of our device specific stuff */
- struct atp {
- char phys[64];
- struct usb_device * udev; /* usb device */
- struct urb * urb; /* usb request block */
-- signed char * data; /* transferred data */
-+ u8 * data; /* transferred data */
- int open; /* non-zero if opened */
- struct input_dev *input; /* input dev */
- int valid; /* are the sensors valid ? */
- int x_old; /* last reported x/y, */
- int y_old; /* used for smoothing */
- /* current value of the sensors */
-- signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS];
-+ u16 xy_cur[ATP_XSENSORS + ATP_YSENSORS];
- /* last value of the sensors */
-- signed char xy_old[ATP_XSENSORS + ATP_YSENSORS];
-+ u16 xy_old[ATP_XSENSORS + ATP_YSENSORS];
- /* accumulated sensors */
- int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
- int overflowwarn; /* overflow warning printed? */
- int datalen; /* size of an USB urb transfer */
-- int idlecount; /* number of empty packets */
-- struct work_struct work;
-+ int idle_counter; /* idle counter */
-+ struct work_struct work; /* kernel workqueue entry (for re-init) */
- };
-
- #define dbg_dump(msg, tab) \
-@@ -173,8 +189,12 @@ struct atp {
- if (debug) printk(format, ##a); \
- } while (0)
-
--MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann");
--MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver");
-+MODULE_AUTHOR("Johannes Berg");
-+MODULE_AUTHOR("Stelian Pop");
-+MODULE_AUTHOR("Frank Arnold");
-+MODULE_AUTHOR("Michael Hanselmann");
-+MODULE_AUTHOR("Sven Anders");
-+MODULE_DESCRIPTION("Apple PowerBook and MacBook USB touchpad driver");
- MODULE_LICENSE("GPL");
-
- /*
-@@ -184,7 +204,7 @@ static int threshold = ATP_THRESHOLD;
- module_param(threshold, int, 0644);
- MODULE_PARM_DESC(threshold, "Discards any change in data from a sensor (trackpad has hundreds of these sensors) less than this value");
-
--static int debug = 1;
-+static int debug;
- module_param(debug, int, 0644);
- MODULE_PARM_DESC(debug, "Activate debugging output");
-
-@@ -193,9 +213,9 @@ static inline int atp_is_geyser_2(struct atp *dev)
- {
- u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
-
-- return (productId == GEYSER_ANSI_PRODUCT_ID) ||
-- (productId == GEYSER_ISO_PRODUCT_ID) ||
-- (productId == GEYSER_JIS_PRODUCT_ID);
-+ return (productId == GEYSER2_ANSI_PRODUCT_ID) ||
-+ (productId == GEYSER2_ISO_PRODUCT_ID) ||
-+ (productId == GEYSER2_JIS_PRODUCT_ID);
- }
-
- static inline int atp_is_geyser_3(struct atp *dev)
-@@ -211,11 +231,11 @@ static inline int atp_is_geyser_3(struct atp *dev)
- }
-
- /*
-- * By default Geyser 3 device sends standard USB HID mouse
-- * packets (Report ID 2). This code changes device mode, so it
-- * sends raw sensor reports (Report ID 5).
-+ * By default Geyser 3 and Geyser 4 devices sends standard
-+ * USB HID mouse packets (Report ID 2). This code changes device
-+ * mode, so it sends raw sensor reports (Report ID 5).
- */
--static int atp_geyser3_init(struct usb_device *udev)
-+static int atp_geyser3_4_init(struct usb_device *udev)
- {
- char data[8];
- int size;
-@@ -228,12 +248,12 @@ static int atp_geyser3_init(struct usb_device *udev)
- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-
- if (size != 8) {
-- printk("appletouch atp_geyser3_init READ error\n");
-+ printk("appletouch atp_geyser3_4_init READ error\n");
- for (i=0; i<8; i++)
- printk("appletouch[%d]: %d\n", i, (int) data[i]);
-
- err("Could not do mode read request from device"
-- " (Geyser 3 mode)");
-+ " (Geyser 3/4 mode)");
- return -EIO;
- }
-
-@@ -247,24 +267,25 @@ static int atp_geyser3_init(struct usb_device *udev)
- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-
- if (size != 8) {
-- printk("appletouch atp_geyser3_init WRITE error\n");
-+ printk("appletouch atp_geyser3_4_init WRITE error\n");
- for (i=0; i<8; i++)
- printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+
- err("Could not do mode write request to device"
-- " (Geyser 3 mode)");
-+ " (Geyser 3/4 mode)");
- return -EIO;
- }
- return 0;
- }
-
--/* Reinitialise the device if it's a geyser 3 */
-+/* Reinitialise the device if it's a geyser 3/4 */
- static void atp_reinit(struct work_struct *work)
- {
- struct atp *dev = container_of(work, struct atp, work);
- struct usb_device *udev = dev->udev;
-
-- dev->idlecount = 0;
-- atp_geyser3_init(udev);
-+ dprintk("appletouch: putting appletouch to sleep (reinit)\n");
-+ atp_geyser3_4_init(udev);
- }
-
- static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
-@@ -428,10 +449,15 @@ static void atp_complete(struct urb* urb)
- dbg_dump("sample", dev->xy_cur);
-
- if (!dev->valid) {
-- /* first sample */
-+ /* first sample after init or resume */
- dev->valid = 1;
- dev->x_old = dev->y_old = -1;
-- memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
-+ dev->idle_counter = 0;
-+
-+ /* store first sample on older Geyser */
-+ if ((dev->data[dev->datalen-1] & ATP_STATUS_BIT_BASE_UPDATE) ||
-+ !atp_is_geyser_3(dev))
-+ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
-
- if (atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */
- goto exit;
-@@ -458,18 +484,39 @@ static void atp_complete(struct urb* urb)
- goto exit;
- }
-
-+ /* Just update the base values (i.e. touchpad in untouched state) */
-+ if (dev->data[dev->datalen-1] & ATP_STATUS_BIT_BASE_UPDATE)
-+ {
-+ if (debug > 0) printk("appletouch: updated base values\n");
-+
-+ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
-+ goto exit;
-+ }
-+
- for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) {
-- /* accumulate the change */
-- signed char change = dev->xy_old[i] - dev->xy_cur[i];
-- dev->xy_acc[i] -= change;
-+ /* calculate the change */
-+ dev->xy_acc[i] = dev->xy_cur[i] - dev->xy_old[i];
-+
-+ /* this is a round-robin value, so couple with that */
-+ if (dev->xy_acc[i] > 127)
-+ dev->xy_acc[i] -= 256;
-+
-+ if (dev->xy_acc[i] < -127)
-+ dev->xy_acc[i] += 256;
-+
-+ /* Needed for the older Geyser */
-+ if (!atp_is_geyser_3(dev))
-+ {
-+ /* store new 'untouched' value, if any new */
-+ if (dev->xy_acc[i] < -1)
-+ dev->xy_old[i] = dev->xy_cur[i];
-+ }
-
-- /* prevent down drifting */
-- if (dev->xy_acc[i] < 0)
-+ /* prevent down-drifting */
-+ if (dev->xy_acc[i] < 0)
- dev->xy_acc[i] = 0;
- }
-
-- memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
--
- dbg_dump("accumulator", dev->xy_acc);
-
- x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS,
-@@ -484,7 +531,7 @@ static void atp_complete(struct urb* urb)
- dev->x_old = x;
- dev->y_old = y;
-
-- if (debug > 1)
-+ if (debug > 0)
- printk("appletouch: X: %3d Y: %3d "
- "Xz: %3d Yz: %3d\n",
- x, y, x_z, y_z);
-@@ -509,20 +556,30 @@ static void atp_complete(struct urb* urb)
- /* reset the accumulator on release */
- memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
-
-- /* Geyser 3 will continue to send packets continually after
-- the first touch unless reinitialised. Do so if it's been
-- idle for a while in order to avoid waking the kernel up
-- several hundred times a second */
-- if (atp_is_geyser_3(dev)) {
-- dev->idlecount++;
-- if (dev->idlecount == 10) {
-- dev->valid=0;
-- schedule_work (&dev->work);
-- }
-+ /* Idle counter */
-+ dev->idle_counter++;
-+
-+ /* Wait for 10 more packages before suspending */
-+ if (dev->idle_counter > 10) {
-+
-+ /* Get every 10th sample, reset counter */
-+ dev->idle_counter = 0;
-+
-+ /* Geyser 3/4 will continue to send packets continually
-+ after the first touch. The function is called every
-+ 8 milliseconds from interrups context, unless
-+ reinitialised. Do so if it's been idle for a while
-+ in order to avoid waking the kernel up several
-+ hundred times a second */
-+
-+ if (atp_is_geyser_3(dev))
-+ schedule_work(&dev->work);
- }
- }
-
-- input_report_key(dev->input, BTN_LEFT, dev->data[dev->datalen-1] & 1);
-+ input_report_key(dev->input, BTN_LEFT,
-+ dev->data[dev->datalen - 1] & ATP_STATUS_BIT_BUTTON);
-+
- input_sync(dev->input);
-
- exit:
-@@ -599,9 +656,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
-
- if (atp_is_geyser_3(dev)) {
- /* switch to raw sensor mode */
-- if (atp_geyser3_init(udev))
-+ if (atp_geyser3_4_init(udev))
- goto err_free_devs;
--
- printk("appletouch Geyser 3 inited.\n");
- }
-
-@@ -676,6 +732,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- /* save our data pointer in this interface device */
- usb_set_intfdata(iface, dev);
-
-+ /* initialize kernel work queue for re-init out of interrupt context */
- INIT_WORK(&dev->work, atp_reinit);
-
- return 0;
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/sigmatel-backport-2.6.23.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/sigmatel-backport-2.6.23.patch
deleted file mode 100644
index 0685db1..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r141/sigmatel-backport-2.6.23.patch
+++ /dev/null
@@ -1,341 +0,0 @@
-Backport ALSA sigmatel pins from 2.6.23 for testing.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- sound/pci/hda/patch_sigmatel.c | 203 ++++++++++++++++++++++++++++++----------
- 1 files changed, 152 insertions(+), 51 deletions(-)
-
-diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
-index e3964fc..329f4c0 100644
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -44,7 +44,7 @@ enum {
-
- enum {
- STAC_9205_REF,
-- STAC_9205_MODELS
-+ STAC_9205_MODELS
- };
-
- enum {
-@@ -59,11 +59,20 @@ enum {
- STAC_D945_REF,
- STAC_D945GTP3,
- STAC_D945GTP5,
-+ STAC_922X_DELL,
-+ STAC_INTEL_MAC_V1,
-+ STAC_INTEL_MAC_V2,
-+ STAC_INTEL_MAC_V3,
-+ STAC_INTEL_MAC_V4,
-+ STAC_INTEL_MAC_V5,
-+ /* for backward compitability */
- STAC_MACMINI,
- STAC_MACBOOK,
-+ STAC_MACBOOK_V2,
- STAC_MACBOOK_PRO_V1,
- STAC_MACBOOK_PRO_V2,
- STAC_IMAC_INTEL,
-+ STAC_IMAC_INTEL_20,
- STAC_922X_MODELS
- };
-
-@@ -549,44 +558,79 @@ static unsigned int d945gtp5_pin_configs[10] = {
- 0x02a19320, 0x40000100,
- };
-
--static unsigned int macbook_pro_v1_pin_configs[10] = {
-- 0x0321e230, 0x03a1e020, 0x9017e110, 0x01014010,
-- 0x01a19021, 0x0381e021, 0x1345e240, 0x13c5e22e,
-- 0x02a19320, 0x400000fb
-+static unsigned int intel_mac_v1_pin_configs[10] = {
-+ 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
-+ 0x400000fc, 0x400000fb,
-+};
-+
-+static unsigned int intel_mac_v2_pin_configs[10] = {
-+ 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
-+ 0x400000fc, 0x400000fb,
- };
-
--static unsigned int macbook_pro_v2_pin_configs[10] = {
-- 0x0221401f, 0x90a70120, 0x01813024, 0x01014010,
-- 0x400000fd, 0x01016011, 0x1345e240, 0x13c5e22e,
-+static unsigned int intel_mac_v3_pin_configs[10] = {
-+ 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
- 0x400000fc, 0x400000fb,
- };
-
--static unsigned int imac_intel_pin_configs[10] = {
-- 0x0121e230, 0x90a70120, 0x9017e110, 0x400000fe,
-- 0x400000fd, 0x0181e021, 0x1145e040, 0x400000fa,
-+static unsigned int intel_mac_v4_pin_configs[10] = {
-+ 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
-+ 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
- 0x400000fc, 0x400000fb,
- };
-
-+static unsigned int intel_mac_v5_pin_configs[10] = {
-+ 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
-+ 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
-+ 0x400000fc, 0x400000fb,
-+};
-+
-+static unsigned int stac922x_dell_pin_configs[10] = {
-+ 0x0221121e, 0x408103ff, 0x02a1123e, 0x90100310,
-+ 0x408003f1, 0x0221122f, 0x03451340, 0x40c003f2,
-+ 0x50a003f3, 0x405003f4
-+};
-+
- static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
- [STAC_D945_REF] = ref922x_pin_configs,
- [STAC_D945GTP3] = d945gtp3_pin_configs,
- [STAC_D945GTP5] = d945gtp5_pin_configs,
-- [STAC_MACMINI] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK_PRO_V1] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK_PRO_V2] = macbook_pro_v2_pin_configs,
-- [STAC_IMAC_INTEL] = imac_intel_pin_configs,
-+ [STAC_922X_DELL] = stac922x_dell_pin_configs,
-+ [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
-+ [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
-+ [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
-+ [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
-+ [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
-+ /* for backward compitability */
-+ [STAC_MACMINI] = intel_mac_v3_pin_configs,
-+ [STAC_MACBOOK] = intel_mac_v5_pin_configs,
-+ [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
-+ [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
-+ [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
-+ [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
- };
-
- static const char *stac922x_models[STAC_922X_MODELS] = {
- [STAC_D945_REF] = "ref",
- [STAC_D945GTP5] = "5stack",
- [STAC_D945GTP3] = "3stack",
-+ [STAC_922X_DELL] = "dell",
-+ [STAC_INTEL_MAC_V1] = "intel-mac-v1",
-+ [STAC_INTEL_MAC_V2] = "intel-mac-v2",
-+ [STAC_INTEL_MAC_V3] = "intel-mac-v3",
-+ [STAC_INTEL_MAC_V4] = "intel-mac-v4",
-+ [STAC_INTEL_MAC_V5] = "intel-mac-v5",
-+ /* for backward compitability */
- [STAC_MACMINI] = "macmini",
- [STAC_MACBOOK] = "macbook",
-+ [STAC_MACBOOK_V2] = "macbook-v2",
- [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
- [STAC_MACBOOK_PRO_V2] = "macbook-pro",
- [STAC_IMAC_INTEL] = "imac-intel",
-+ [STAC_IMAC_INTEL_20] = "imac-intel-20",
- };
-
- static struct snd_pci_quirk stac922x_cfg_tbl[] = {
-@@ -649,7 +693,7 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = {
- /* other systems */
- /* Apple Mac Mini (early 2006) */
- SND_PCI_QUIRK(0x8384, 0x7680,
-- "Mac Mini", STAC_MACMINI),
-+ "Mac Mini", STAC_INTEL_MAC_V3),
- {} /* terminator */
- };
-
-@@ -770,33 +814,56 @@ static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
- return 0;
- }
-
-+static void stac92xx_set_config_reg(struct hda_codec *codec,
-+ hda_nid_t pin_nid, unsigned int pin_config)
-+{
-+ int i;
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
-+ pin_config & 0x000000ff);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
-+ (pin_config & 0x0000ff00) >> 8);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
-+ (pin_config & 0x00ff0000) >> 16);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
-+ pin_config >> 24);
-+ i = snd_hda_codec_read(codec, pin_nid, 0,
-+ AC_VERB_GET_CONFIG_DEFAULT,
-+ 0x00);
-+ snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
-+ pin_nid, i);
-+}
-+
- static void stac92xx_set_config_regs(struct hda_codec *codec)
- {
- int i;
- struct sigmatel_spec *spec = codec->spec;
-- unsigned int pin_cfg;
-
-- if (! spec->pin_nids || ! spec->pin_configs)
-- return;
-+ if (!spec->pin_configs)
-+ return;
-
-- for (i = 0; i < spec->num_pins; i++) {
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
-- spec->pin_configs[i] & 0x000000ff);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
-- (spec->pin_configs[i] & 0x0000ff00) >> 8);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
-- (spec->pin_configs[i] & 0x00ff0000) >> 16);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
-- spec->pin_configs[i] >> 24);
-- pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0,
-- AC_VERB_GET_CONFIG_DEFAULT,
-- 0x00);
-- snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", spec->pin_nids[i], pin_cfg);
-- }
-+ for (i = 0; i < spec->num_pins; i++)
-+ stac92xx_set_config_reg(codec, spec->pin_nids[i],
-+ spec->pin_configs[i]);
-+}
-+
-+static void stac92xx_enable_gpio_mask(struct hda_codec *codec,
-+ int gpio_mask, int gpio_data)
-+{
-+ /* Configure GPIOx as output */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_DIRECTION, gpio_mask);
-+ /* Configure GPIOx as CMOS */
-+ snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0x00000000);
-+ /* Assert GPIOx */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_DATA, gpio_data);
-+ /* Enable GPIOx */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_MASK, gpio_mask);
- }
-
- /*
-@@ -1168,7 +1235,7 @@ static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
- * and 9202/925x. For those, dac_nids[] must be hard-coded.
- */
- static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
-- const struct auto_pin_cfg *cfg)
-+ struct auto_pin_cfg *cfg)
- {
- struct sigmatel_spec *spec = codec->spec;
- int i, j, conn_len = 0;
-@@ -1193,6 +1260,13 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
- }
-
- if (j == conn_len) {
-+ if (spec->multiout.num_dacs > 0) {
-+ /* we have already working output pins,
-+ * so let's drop the broken ones again
-+ */
-+ cfg->line_outs = spec->multiout.num_dacs;
-+ break;
-+ }
- /* error out, no available DAC found */
- snd_printk(KERN_ERR
- "%s: No available DAC for pin 0x%x\n",
-@@ -1334,7 +1408,15 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
- continue;
- add_spec_dacs(spec, nid);
- }
--
-+ for (i = 0; i < cfg->line_outs; i++) {
-+ nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
-+ AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
-+ if (check_in_dac_nids(spec, nid))
-+ nid = 0;
-+ if (! nid)
-+ continue;
-+ add_spec_dacs(spec, nid);
-+ }
- for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
- static const char *pfxs[] = {
- "Speaker", "External Speaker", "Speaker2",
-@@ -1891,7 +1973,7 @@ static int patch_stac9200(struct hda_codec *codec)
- return -ENOMEM;
-
- codec->spec = spec;
-- spec->num_pins = 8;
-+ spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
- spec->pin_nids = stac9200_pin_nids;
- spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
- stac9200_models,
-@@ -2013,29 +2095,41 @@ static int patch_stac922x(struct hda_codec *codec)
- return -ENOMEM;
-
- codec->spec = spec;
-- spec->num_pins = 10;
-+ spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
- spec->pin_nids = stac922x_pin_nids;
- spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
- stac922x_models,
- stac922x_cfg_tbl);
-- if (spec->board_config == STAC_MACMINI) {
-+ if (spec->board_config == STAC_INTEL_MAC_V3) {
- spec->gpio_mute = 1;
- /* Intel Macs have all same PCI SSID, so we need to check
- * codec SSID to distinguish the exact models
- */
- printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
- switch (codec->subsystem_id) {
-- case 0x106b0a00: /* MacBook First generatoin */
-- spec->board_config = STAC_MACBOOK;
-+
-+ case 0x106b0800:
-+ spec->board_config = STAC_INTEL_MAC_V1;
-+ break;
-+ case 0x106b0600:
-+ case 0x106b0700:
-+ spec->board_config = STAC_INTEL_MAC_V2;
- break;
-- case 0x106b0200: /* MacBook Pro first generation */
-- spec->board_config = STAC_MACBOOK_PRO_V1;
-+ case 0x106b0e00:
-+ case 0x106b0f00:
-+ case 0x106b1600:
-+ case 0x106b1700:
-+ case 0x106b0200:
-+ case 0x106b1e00:
-+ spec->board_config = STAC_INTEL_MAC_V3;
- break;
-- case 0x106b1e00: /* MacBook Pro second generation */
-- spec->board_config = STAC_MACBOOK_PRO_V2;
-+ case 0x106b1a00:
-+ case 0x00000100:
-+ spec->board_config = STAC_INTEL_MAC_V4;
- break;
-- case 0x106b0700: /* Intel-based iMac */
-- spec->board_config = STAC_IMAC_INTEL;
-+ case 0x106b0a00:
-+ case 0x106b2200:
-+ spec->board_config = STAC_INTEL_MAC_V5;
- break;
- }
- }
-@@ -2082,6 +2176,13 @@ static int patch_stac922x(struct hda_codec *codec)
-
- codec->patch_ops = stac92xx_patch_ops;
-
-+ /* Fix Mux capture level; max to 2 */
-+ snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
-+ (0 << AC_AMPCAP_OFFSET_SHIFT) |
-+ (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
-+ (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
-+ (0 << AC_AMPCAP_MUTE_SHIFT));
-+
- return 0;
- }
-
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r3.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r3.ebuild
index 0434590..eebd448 100644
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r3.ebuild
+++ b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r3.ebuild
@@ -4,7 +4,7 @@
ETYPE="sources"
K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="6"
+K_GENPATCHES_VER="4"
K_SECURITY_UNSUPPORTED="1"
inherit kernel-2
detect_version
@@ -18,17 +18,24 @@ HOMEPAGE="http://www.kernel.org
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
KEYWORDS="~amd64 ~x86"
-PATCHDIR="${FILESDIR}/mactel-patches-r141/"
+PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r151/"
-UNIPATCH_LIST="${PATCHDIR}/applesmc-use-input-polldev.patch \
-${PATCHDIR}/applesmc-add-macbook-temperature-keys.patch \
-${PATCHDIR}/applesmc-for-mac-pro-2-x-quad-core.patch \
-${PATCHDIR}/applesmc_int.patch \
+UNIPATCH_LIST="${PATCHDIR}/appletouch.patch \
+${PATCHDIR}/appletouch-add-macbook3-trackpad.patch \
+${PATCHDIR}/applesmc-macbook2.patch \
${PATCHDIR}/applesmc-retry-when-accessing-keys.patch \
-${PATCHDIR}/sigmatel-backport-2.6.23.patch \
-${PATCHDIR}/appleir-undo-hid-blacklist.patch \
-${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/appletouch-shut-up-when-it-has-nothing-to-say.patch \
-${PATCHDIR}/appletouch_new.patch"
+${PATCHDIR}/applesmc_int.patch \
+${PATCHDIR}/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch \
+${PATCHDIR}/sigmatel_audio_fix_macbook_v2.patch \
+${PATCHDIR}/appletouch-new.patch
+${PATCHDIR}/hid-add-new-apple-keyboard.patch"
UNIPATCH_STRICTORDER="1"
+
+pkg_postinst() {
+ kernel-2_pkg_postinst
+ einfo "For more info on this patchset, see:"
+ einfo "${HOMEPAGE}"
+ einfo "Report any problems to je_fro@gentoo.org"
+}
+