summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Gardner <je_fro@gentoo.org>2010-09-10 01:30:12 +0000
committerJeffrey Gardner <je_fro@gentoo.org>2010-09-10 01:30:12 +0000
commit1cb2c3e9ad0779c2a8fab4a9655f75f616198402 (patch)
treed7836e952b6bc7c774309bf2d32fcc6d4d004c96 /sys-kernel/mactel-linux-sources
parentfix in my overlay for bug #316287 (diff)
downloadje_fro-1cb2c3e9ad0779c2a8fab4a9655f75f616198402.tar.gz
je_fro-1cb2c3e9ad0779c2a8fab4a9655f75f616198402.tar.bz2
je_fro-1cb2c3e9ad0779c2a8fab4a9655f75f616198402.zip
Cleanup, mactel-sources are no longer needed.
svn path=/; revision=299
Diffstat (limited to 'sys-kernel/mactel-linux-sources')
-rw-r--r--sys-kernel/mactel-linux-sources/ChangeLog8
-rw-r--r--sys-kernel/mactel-linux-sources/Manifest105
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc-macbook2.patch76
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc-retry-when-accessing-keys.patch115
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc_int.patch415
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/appletouch.patch23
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/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-r145/sigmatel_audio_fix_macbook_v2.patch30
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-case-led.patch142
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-macbook2.patch76
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-retry-when-accessing-keys.patch115
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc_int.patch414
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch-add-macbook3-trackpad.patch50
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch-new.patch364
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch.patch23
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/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-r149/sigmatel_audio_fix_macbook_v2.patch30
-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.patch115
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc_int.patch414
-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.patch23
-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/2.6.24-mactel-patches-r153/applesmc-int-protect.patch304
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-macbook2.patch77
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-retry-when-accessing-keys.patch116
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc_int.patch415
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/appletouch-new.patch377
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/appletouch.patch24
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect-fix-2.6.24-crash.patch49
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect-update.patch37
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect.patch826
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/export-lookup_dev.patch24
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/hid-add-new-apple-keyboard.patch182
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch29
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/sigmatel_audio_fix_macbook_v2.patch31
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-int-protect.patch304
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-macbook2.patch77
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-remove-debugging-messages.patch92
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-retry-when-accessing-keys.patch116
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc_int.patch424
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/appletouch-new.patch377
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/appletouch.patch24
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect-fix-2.6.24-crash.patch49
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect-update.patch37
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect.patch826
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/export-lookup_dev.patch24
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/hid-add-new-apple-keyboard.patch182
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch29
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/sigmatel_audio_fix_macbook_v2.patch31
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-int-protect.patch304
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-remove-debugging-messages.patch92
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-retry-when-accessing-keys.patch116
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc_int.patch424
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/appletouch-new.patch358
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/appletouch.patch24
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-2.6.25.patch945
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-fix-2.6.24-crash.patch51
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-update.patch37
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/export-lookup_dev.patch24
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch29
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/sigmatel_audio_fix_macbook_v2.patch31
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-accel-create-check.patch79
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-int-protect.patch304
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-macbook-air.patch45
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-macbook-v3.patch50
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-remove-debugging-messages.patch92
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-retry-when-accessing-keys.patch116
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc_int.patch424
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/appletouch-new.patch358
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/appletouch.patch24
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/disk-protect-2.6.26.patch954
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/disk-protect-update.patch37
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/export-lookup_dev.patch24
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/fix_fn_key_on_macbookpro_4_1_and_mb_air.patch41
-rw-r--r--sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/sigmatel_audio_fix_when_module_parameter_is_set.patch112
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r1.ebuild40
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r2.ebuild40
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r3.ebuild41
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r4.ebuild45
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r5.ebuild45
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.25-r1.ebuild43
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.25-r4.ebuild43
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.26.ebuild46
-rw-r--r--sys-kernel/mactel-linux-sources/metadata.xml13
89 files changed, 0 insertions, 13970 deletions
diff --git a/sys-kernel/mactel-linux-sources/ChangeLog b/sys-kernel/mactel-linux-sources/ChangeLog
deleted file mode 100644
index 0153158..0000000
--- a/sys-kernel/mactel-linux-sources/ChangeLog
+++ /dev/null
@@ -1,8 +0,0 @@
-# ChangeLog for sys-kernel/mactel-linux-sources
-# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: $
-
- 12 Jun 2008; Jeff Gardner <je_fro@gentoo.org> +metadata.xml,
- +mactel-linux-sources-2.6.25-r4.ebuild:
- Add ChangeLog and rely on gentoo-sources-2.6.25-r4
-
diff --git a/sys-kernel/mactel-linux-sources/Manifest b/sys-kernel/mactel-linux-sources/Manifest
deleted file mode 100644
index aec6a9e..0000000
--- a/sys-kernel/mactel-linux-sources/Manifest
+++ /dev/null
@@ -1,105 +0,0 @@
-AUX 2.6.24-mactel-patches-r145/applesmc-macbook2.patch 3087 RMD160 cc8004b2cded1ab1e799f80892e9c0ead247f1ac SHA1 9ebdbe5427a962fc8fd1293f2ec5c6b0bf9472c2 SHA256 7e77a025094f33329d72b3173a59d7b45046e6e244b8f7fa86ac397fa6455eff
-AUX 2.6.24-mactel-patches-r145/applesmc-retry-when-accessing-keys.patch 3004 RMD160 424e9ddee6928a97eea55dbbbc8dec0ab5538b9b SHA1 262db3755ab837468aea2f7c89c755c5e597ac09 SHA256 82bf776bb5029f5a9a292c5a42109fa22f3ce5540122af5faad4ad273592c3c9
-AUX 2.6.24-mactel-patches-r145/applesmc_int.patch 11196 RMD160 732ddf93bdbb07e23607d0247b21276e45d7d6dd SHA1 89ac3dd9dfc2a62d28a01aab6d5b6281e91ea94a SHA256 7a000e30e7323654a13e3880cfab258578c2af2cc890f09d14e41ade440d16f7
-AUX 2.6.24-mactel-patches-r145/appletouch.patch 653 RMD160 7af72520cfc712a37ad3a44e2d7ffa66284cdd77 SHA1 0a2ae7c4d9057322be7bfe269c1724bbdcb1c6e6 SHA256 4ed7833238e497050fc175e2f41777e983a58ba61b6ed6034df307065e57cf8e
-AUX 2.6.24-mactel-patches-r145/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 819 RMD160 8bec3f90f028e060695aebf0f8bae63778cd013c SHA1 19142c8fd86614727b95a0374539315995768e25 SHA256 94e7415487d455cbd1d0f6a3d5a393b4d008ac6dedf1a335a2aa40b70d6767f2
-AUX 2.6.24-mactel-patches-r145/sigmatel_audio_fix_macbook_v2.patch 855 RMD160 f9a8a9c67f2a69e9e6cd5012c4a58e493d05930b SHA1 677656bd94f432aa92ad77b13c8fe32fd738a71b SHA256 4ad9524f09b2d3ffc2d3643be844a25e5ad11e7e7b4638e98340d10d27c5a722
-AUX 2.6.24-mactel-patches-r149/applesmc-case-led.patch 4329 RMD160 c983bf2caa205dc6cbebef97a29bcb83199fbd0b SHA1 001c03b338ca7a447fd05a4a610601d0d6698712 SHA256 3fe745f196839162578becd9a8fb6aaf9e6836244fb2cd5e0e9d798c46d852c2
-AUX 2.6.24-mactel-patches-r149/applesmc-macbook2.patch 3087 RMD160 cc8004b2cded1ab1e799f80892e9c0ead247f1ac SHA1 9ebdbe5427a962fc8fd1293f2ec5c6b0bf9472c2 SHA256 7e77a025094f33329d72b3173a59d7b45046e6e244b8f7fa86ac397fa6455eff
-AUX 2.6.24-mactel-patches-r149/applesmc-retry-when-accessing-keys.patch 3004 RMD160 424e9ddee6928a97eea55dbbbc8dec0ab5538b9b SHA1 262db3755ab837468aea2f7c89c755c5e597ac09 SHA256 82bf776bb5029f5a9a292c5a42109fa22f3ce5540122af5faad4ad273592c3c9
-AUX 2.6.24-mactel-patches-r149/applesmc_int.patch 11194 RMD160 6ee955475ad799c56db220b92b6d2b938fb18899 SHA1 3842ffa4320f3c2dac0c070a6782a68b7583461d SHA256 90c77b42bd95cbf521a6d8e551baa8cc031da63354ad9eb6e57b6d68c924cf70
-AUX 2.6.24-mactel-patches-r149/appletouch-add-macbook3-trackpad.patch 1553 RMD160 73c1d944cb9dbc2cfb36034927082dd18dc34fe7 SHA1 64a40fbd2fbbe64aca25354e5430d7323bcad3d0 SHA256 5d8df65b0b452592aacd5d28baa3197ced474cfd699a5e140277c4f2527fc2da
-AUX 2.6.24-mactel-patches-r149/appletouch-new.patch 11503 RMD160 c557fa453270bc7e871377a829dc8c5923d8cf67 SHA1 67b00340cf92ef4c000a6309250a5bda7393c74b SHA256 ac341736a16ac91ce596860e0c3c278a70a68b087c09b786a8bc6dc22de33e50
-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 2.6.24-mactel-patches-r153/applesmc-int-protect.patch 8678 RMD160 434a853f53e97959dd6e97d4814b2e491cb2c999 SHA1 f7da3957a247b5bc6a4deac7b02d9780ac59fa85 SHA256 5f7900f749670874802662c4bfb4e5991e5b25588f50cfa39fa2123bf2ea03ea
-AUX 2.6.24-mactel-patches-r153/applesmc-macbook2.patch 3088 RMD160 447b80e268c997780a2b48d518e5a5c1956fb119 SHA1 df37a98f40ab1d118274e2f240b1878d8af25d0c SHA256 84a025192e47dcfbfcc39a4b638434df8e034057bded9eb31a9be3cf81c93374
-AUX 2.6.24-mactel-patches-r153/applesmc-retry-when-accessing-keys.patch 3005 RMD160 7edff70b59f6bb1e27e9594d5ac3789207a2d203 SHA1 103d650a667b86b454ecbfd8ffacaf3894f21236 SHA256 5d6395ceba951ebd6d75e7d5f97f1dae8a4971dd2d4a3abae59f96a53c663c44
-AUX 2.6.24-mactel-patches-r153/applesmc_int.patch 11195 RMD160 72dfd4248cdaa4babac0bdd236f920a4b9462f4e SHA1 831db7f1a4e4438fc4e13d356e138c321de218bd SHA256 e1432c2ac7c35790f2560e482ec1ecfdaff637fff078137d4bf8ef4ddd82cb10
-AUX 2.6.24-mactel-patches-r153/appletouch-new.patch 11927 RMD160 ada04ab11c9602b8d9e5e9f8a0fce5769200dde6 SHA1 6582d125c5edce8b32db396ddd28884d434279ff SHA256 585dc12ec28f3b4dfa377deccae1ac8b8d5a37190dd6cfdfdc0d302215bde8a6
-AUX 2.6.24-mactel-patches-r153/appletouch.patch 654 RMD160 71fe6e4b886063601fa71dde4401d0003c17b5ba SHA1 fd599a2b5ff9dea91ff4b8eff956bebededf9abd SHA256 5143872df96fa8e79a0602af15ef9bc9cd880bd88e39c1d3a0bbc4659516d4c8
-AUX 2.6.24-mactel-patches-r153/disk-protect-fix-2.6.24-crash.patch 1690 RMD160 cfc272937096214b6a90b90a8fec45946d727f6b SHA1 a53e30d013e910e4089cb62eb0a8eb5075bde2bd SHA256 21f319713860d982dea4ee8293be72354605c91cd112fd40b0370ffe1a89b641
-AUX 2.6.24-mactel-patches-r153/disk-protect-update.patch 1130 RMD160 ea48d721ef45a80a8a341a0e62e47483e19f8441 SHA1 4428a17a9ed5ff3c09b48e563ee8e6dd9d64f614 SHA256 02b91671fc86186b7547a0468b3dbd4804959d076807140c271433b96a11aa6a
-AUX 2.6.24-mactel-patches-r153/disk-protect.patch 24637 RMD160 7e43c5ca0ed7a01c01a397faa54174e5bf4cf8e7 SHA1 150dfe2897262da5404d122be858b1281a1d54c0 SHA256 ad5f2d8f3c0acbffaaf2fadbe26ec2fa0bb5ca6c8c90eeb97d0c9576368e0078
-AUX 2.6.24-mactel-patches-r153/export-lookup_dev.patch 423 RMD160 b0362beae6dfac8be4d37ec34337c0fa48ae1be9 SHA1 4a521886503f2675dcf7ec3cee9469fa86311781 SHA256 bd5015342217a7df1596b0be8c122c64bc52b09e0921afada64e3ba176e8b2b9
-AUX 2.6.24-mactel-patches-r153/hid-add-new-apple-keyboard.patch 8440 RMD160 78b893ab1e6d7d8a2b217c01a0f2b15a9fd6863f SHA1 e662407bb1a610d93569fd82a4a8e8c9c61d07dd SHA256 9691663c497723c200543ea2869f180f0b77997e2374aa7ddfa78990eb68910c
-AUX 2.6.24-mactel-patches-r153/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 820 RMD160 94de76a57d94cfedf6261cc849e9316c100d3f0f SHA1 250486062646728b0d8fb4aad4cfa7bcd861238a SHA256 af3f2cc085444027d712ed1a1e078608f8141f4253292d0043e5b992d11396c6
-AUX 2.6.24-mactel-patches-r153/sigmatel_audio_fix_macbook_v2.patch 856 RMD160 8d343c8b0f4eec70a449e2bda987edeb9fafbd6f SHA1 eda6c5f026936addff8ad090df24d2c5658ca5fe SHA256 9bd96288b95d94111b19c1d055d98088d414bbfed5d38c2bbf82a1563ec1fb5a
-AUX 2.6.24-mactel-patches-r155/applesmc-int-protect.patch 8678 RMD160 560e38277bfb9f917744771406f6eaed4dbad6ed SHA1 d13f3d2b4c6ae5e835305ef16f19b387ab3297c7 SHA256 a760fe387d8af9bc07262905c6562a933d9da4cce6b64207d270f83b2dd5b74d
-AUX 2.6.24-mactel-patches-r155/applesmc-macbook2.patch 3088 RMD160 447b80e268c997780a2b48d518e5a5c1956fb119 SHA1 df37a98f40ab1d118274e2f240b1878d8af25d0c SHA256 84a025192e47dcfbfcc39a4b638434df8e034057bded9eb31a9be3cf81c93374
-AUX 2.6.24-mactel-patches-r155/applesmc-remove-debugging-messages.patch 2347 RMD160 359b19b4b6b0af6d628f8aefbba91c3c3fc85a74 SHA1 0d6f56fa6fe0f8286aa7e2e3aee65dc7d440d17b SHA256 cad9a2861e1108fa3826f3a5877a31ebe25bfbf0bd7504afbbc57653e0d28778
-AUX 2.6.24-mactel-patches-r155/applesmc-retry-when-accessing-keys.patch 3005 RMD160 7edff70b59f6bb1e27e9594d5ac3789207a2d203 SHA1 103d650a667b86b454ecbfd8ffacaf3894f21236 SHA256 5d6395ceba951ebd6d75e7d5f97f1dae8a4971dd2d4a3abae59f96a53c663c44
-AUX 2.6.24-mactel-patches-r155/applesmc_int.patch 11496 RMD160 20b19d6d5f5cd93f0138e5dc40192c6e1e2dd971 SHA1 f0c0484f7d85a18bd9c3d8fae611aafe2f0b7909 SHA256 fc601217e23a267cf4f08815a53b1bda803a82b87576260cc0ef1885ba2a9b00
-AUX 2.6.24-mactel-patches-r155/appletouch-new.patch 11927 RMD160 ada04ab11c9602b8d9e5e9f8a0fce5769200dde6 SHA1 6582d125c5edce8b32db396ddd28884d434279ff SHA256 585dc12ec28f3b4dfa377deccae1ac8b8d5a37190dd6cfdfdc0d302215bde8a6
-AUX 2.6.24-mactel-patches-r155/appletouch.patch 654 RMD160 71fe6e4b886063601fa71dde4401d0003c17b5ba SHA1 fd599a2b5ff9dea91ff4b8eff956bebededf9abd SHA256 5143872df96fa8e79a0602af15ef9bc9cd880bd88e39c1d3a0bbc4659516d4c8
-AUX 2.6.24-mactel-patches-r155/disk-protect-fix-2.6.24-crash.patch 1690 RMD160 cfc272937096214b6a90b90a8fec45946d727f6b SHA1 a53e30d013e910e4089cb62eb0a8eb5075bde2bd SHA256 21f319713860d982dea4ee8293be72354605c91cd112fd40b0370ffe1a89b641
-AUX 2.6.24-mactel-patches-r155/disk-protect-update.patch 1130 RMD160 ea48d721ef45a80a8a341a0e62e47483e19f8441 SHA1 4428a17a9ed5ff3c09b48e563ee8e6dd9d64f614 SHA256 02b91671fc86186b7547a0468b3dbd4804959d076807140c271433b96a11aa6a
-AUX 2.6.24-mactel-patches-r155/disk-protect.patch 24637 RMD160 7e43c5ca0ed7a01c01a397faa54174e5bf4cf8e7 SHA1 150dfe2897262da5404d122be858b1281a1d54c0 SHA256 ad5f2d8f3c0acbffaaf2fadbe26ec2fa0bb5ca6c8c90eeb97d0c9576368e0078
-AUX 2.6.24-mactel-patches-r155/export-lookup_dev.patch 423 RMD160 b0362beae6dfac8be4d37ec34337c0fa48ae1be9 SHA1 4a521886503f2675dcf7ec3cee9469fa86311781 SHA256 bd5015342217a7df1596b0be8c122c64bc52b09e0921afada64e3ba176e8b2b9
-AUX 2.6.24-mactel-patches-r155/hid-add-new-apple-keyboard.patch 8440 RMD160 78b893ab1e6d7d8a2b217c01a0f2b15a9fd6863f SHA1 e662407bb1a610d93569fd82a4a8e8c9c61d07dd SHA256 9691663c497723c200543ea2869f180f0b77997e2374aa7ddfa78990eb68910c
-AUX 2.6.24-mactel-patches-r155/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 820 RMD160 94de76a57d94cfedf6261cc849e9316c100d3f0f SHA1 250486062646728b0d8fb4aad4cfa7bcd861238a SHA256 af3f2cc085444027d712ed1a1e078608f8141f4253292d0043e5b992d11396c6
-AUX 2.6.24-mactel-patches-r155/sigmatel_audio_fix_macbook_v2.patch 856 RMD160 8d343c8b0f4eec70a449e2bda987edeb9fafbd6f SHA1 eda6c5f026936addff8ad090df24d2c5658ca5fe SHA256 9bd96288b95d94111b19c1d055d98088d414bbfed5d38c2bbf82a1563ec1fb5a
-AUX 2.6.25-mactel-patches-r156/applesmc-int-protect.patch 8725 RMD160 64452091e476274fc07b1a7f6419f445700c18c4 SHA1 d849891cbbb86fd1e73381ddfb29051078748fac SHA256 40f6f44bdd442255416fcc18d68c9154a450de98d90ed576dc38ceae4a3987ed
-AUX 2.6.25-mactel-patches-r156/applesmc-remove-debugging-messages.patch 2394 RMD160 83dafc15f0e7e2ec9eb6b845365850c2f1904a19 SHA1 295915802eb5cfb9cd61a0197c2b5795d4b11b23 SHA256 71ecec051bb1c2c4306a18933d908492e87566423caaf51650ca64b9f6c4e933
-AUX 2.6.25-mactel-patches-r156/applesmc-retry-when-accessing-keys.patch 3052 RMD160 7e802797f9a682d94ffa2821d4242f8c2bc2631b SHA1 8e767f9d011c093be63b711843a6a1d665b67178 SHA256 4a329888b12698da1b79f32c5a698c912f13b545f83a2317b2cec5b632f54d59
-AUX 2.6.25-mactel-patches-r156/applesmc_int.patch 11544 RMD160 4665d16e0484b803cf1b455f659fa5f581256b78 SHA1 860caf108156fae8e0709970ff99c8ed87299a5d SHA256 b578653b27c9bf2b3fb058d4c3c1bf4cb500ed8da4a2d5924bdea4802e524156
-AUX 2.6.25-mactel-patches-r156/appletouch-new.patch 11413 RMD160 f1602a2d65bfd84bb2d0f06ca15461018e2bf4e3 SHA1 9d5f55c6b2630b5773c6cfdac5e1dfcb43bf76f8 SHA256 c57d7ce7aedbfdae0e0a95a99888d6552af4791cdd1e4d713a51aecfa84f03ea
-AUX 2.6.25-mactel-patches-r156/appletouch.patch 701 RMD160 aa3f9b858789a4a51a397d007f0fb214596a88ef SHA1 37acdd23207751cbff45c5c7c52c1770d30d7b8f SHA256 a5f8cf3600c19b861310e1aab8d3091484ebbfb56cc0d7490d72ff9f59238406
-AUX 2.6.25-mactel-patches-r156/disk-protect-2.6.25.patch 29511 RMD160 09e4de47d04ac63decf0578099d166c2571caab4 SHA1 724e21d331a7d36b729ad18343d9e91ee8ee2fea SHA256 6419089878e076f66da0e3f15f93cbdb0dc60fb7067d6bff89b1c2ba24cf96fa
-AUX 2.6.25-mactel-patches-r156/disk-protect-fix-2.6.24-crash.patch 1737 RMD160 b1538a04bf61d56395e6a198f1211dc3312a6ae9 SHA1 6572e9e2581d8f86b60048885e36ff1e0fb5d544 SHA256 20249f39b7a424bdd2e8ee27ce81169d6a6450b37312b3d30baf9c81bca865a3
-AUX 2.6.25-mactel-patches-r156/disk-protect-update.patch 1160 RMD160 4dba960e59df3d7289fbde1a662b6ac1f1284d89 SHA1 20b6f7cfde6156a61c7af2d720c199308f32f3fe SHA256 7966482cc14a971a5ddd6fae875038a5d998fb204a7c97938b43a037ef88ad16
-AUX 2.6.25-mactel-patches-r156/export-lookup_dev.patch 470 RMD160 529cb69bf3062696a77d75266e521245964e0492 SHA1 e72702cff98103de967d004259434624a48dbe98 SHA256 6c3a35534924555f03e32ec128dd1e607feadee9793ccf339b209ce5f0a24e8a
-AUX 2.6.25-mactel-patches-r156/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 867 RMD160 36ed0064b3c4e779ea30776d2234dbc725a179f9 SHA1 92762b6363ad2ccfd8310d1caa9aa520930d3109 SHA256 139a1d90f755932011b17cad3e9cfa52844000c78b26c0c43141d554bc4107c6
-AUX 2.6.25-mactel-patches-r156/sigmatel_audio_fix_macbook_v2.patch 905 RMD160 010b6cb83ec0812a08d80857054e69a7e47ab3e5 SHA1 287d2c9522f29a4f6acca38ba4ab0703a0fceb19 SHA256 06731e6d9958aac6f76c5aebbd6d8c1c7a2073f0b645291f4382f31ef1e0d1ee
-AUX 2.6.26-mactel-patches-r159/applesmc-accel-create-check.patch 2142 RMD160 3e2fa6ed631525cbd9a89912c64aa3d4ece8902e SHA1 5e8b57473cb0e8649250e26439e83355f7e22f74 SHA256 603b7156fd698b5d2085fce450dc08d2f1ae6de8c3329562e30e774c8d94286d
-AUX 2.6.26-mactel-patches-r159/applesmc-int-protect.patch 8718 RMD160 a6b62fe421d7c2c9665118dad1b6bfcd04206bbc SHA1 eb0f64fd01f6cd66738a8d2e0d6b89c14d49a61b SHA256 aab01ca260399ff6c1d7da74219e9ea0a3bc84cdfe43fb0cad83c7706c2f2ee9
-AUX 2.6.26-mactel-patches-r159/applesmc-macbook-air.patch 1745 RMD160 94b982bb52556cc61c1145214afca9a1434ac627 SHA1 efaa5ff970479bec04ee60df9e5d4adbeaf87c55 SHA256 06cfc2d2e28d09ff11dbd9cc378d818fbee0dd1077138b3273f62e9940fdd179
-AUX 2.6.26-mactel-patches-r159/applesmc-macbook-v3.patch 1949 RMD160 d1056dd967bfd100be88be4e94fe9f405d944e63 SHA1 7f20242fe0f8535c1630cc34f281f0b6e0c2e64c SHA256 43957048a64b6a8190049f02c0dc9b7400291fb244d0e3cb0cc8e792536b5ba3
-AUX 2.6.26-mactel-patches-r159/applesmc-remove-debugging-messages.patch 2394 RMD160 456e712d1e6a53cbf6cfcaa0aa2a98a714ef0e73 SHA1 66b6b41a3566eae2521c0df1ce917f7f856755e8 SHA256 cc1a10a41d318b3ff19c0e4ba6593224c6803d736dbbddb2d80f360beacc158d
-AUX 2.6.26-mactel-patches-r159/applesmc-retry-when-accessing-keys.patch 3052 RMD160 340a9b0ce8d347e1019359ce47027feb4f7f55df SHA1 cafa5810b2b72021ce4aaf84571dff0e73eb71fc SHA256 be61ad68167bf55750ec5ee2352a7c96aec8b4597e889a80e85b9f2cb42599f0
-AUX 2.6.26-mactel-patches-r159/applesmc_int.patch 11544 RMD160 29b4749f0fdfef0454236764d0deedb17423a5cd SHA1 ae35d6bee83ac0a2aeda8efc1c3fb25cce6c1512 SHA256 23cc6feaf8354b41d5061cb006fc2b9113d089bddeb622da9b7d69a80072b9eb
-AUX 2.6.26-mactel-patches-r159/appletouch-new.patch 11413 RMD160 89e0c5b4718d94d1d5628191cdb5cd18a2f96cd2 SHA1 88d5cf95b52a1b6f39b075d3e876acdf6d061f7c SHA256 a42dbc57c49cf08dc5ea802f4f633afeb89751a0a5c0b238e5bfa4b37d629980
-AUX 2.6.26-mactel-patches-r159/appletouch.patch 701 RMD160 497b302ccdd809350d142c9d0737fb84bcae9b92 SHA1 33d1000c679a0697f3d8d45df93fceb1d6cc897a SHA256 c56331466771ad753fdf61b217f3c5a20de2ed03cb50db41ae96f68bd5b942a4
-AUX 2.6.26-mactel-patches-r159/disk-protect-2.6.26.patch 29910 RMD160 842e7b36678bdc3049f8b3986c2f94585febacd1 SHA1 4b9162a4f085c38d6f027a7bf07ce6a55003d5f0 SHA256 635f54b5b67919ec51a2f2170b23646e9d945b175389fb3b346da9a6176310a6
-AUX 2.6.26-mactel-patches-r159/disk-protect-update.patch 1059 RMD160 c0bf467aafd5c082ec83a780ba6b92163224e262 SHA1 feb907832c7a04e9dd74dd3fd09ba754501d9390 SHA256 c310fb43279440324ccf1c8495a919fcac45f74fb2a1270fbc494dca87d3e7ee
-AUX 2.6.26-mactel-patches-r159/export-lookup_dev.patch 470 RMD160 1670716329207295a6f4a6b8683ccb750aee616a SHA1 20402292514eda6bb9a1eb0761703678a3faa2ec SHA256 cbd6f6e64ef9b6776893c4faa4c2393311daf9df767ba98be12454589762e960
-AUX 2.6.26-mactel-patches-r159/fix_fn_key_on_macbookpro_4_1_and_mb_air.patch 2600 RMD160 2f758ed6aa5c15712f69f67e9966ca6b060f5234 SHA1 6e34d4331f6f76fe80da696b7f2fa172fc0fa760 SHA256 a82b0d1e5ed14ab3ab9e06571c1a591dfb0b88094baf6096affa6b0bcd550ef8
-AUX 2.6.26-mactel-patches-r159/sigmatel_audio_fix_when_module_parameter_is_set.patch 4623 RMD160 9eda81663a5d7b47e358736161a300a9278e9f11 SHA1 851881b7bb68cb6051a5cb0c243c581fa02d68a9 SHA256 98ae51a62aec4c30590618f8223c421acff8e5cd1144217eb71c8d504461bb0d
-DIST genpatches-2.6.24-2.base.tar.bz2 22171 RMD160 59509ac6af64a2ef1d0be8c9409f3144c75e93d8 SHA1 84e6c497508b663ae5f32f352c1299a1bf09691a SHA256 1c002fd593f623516c93e2bae65f77eaa84e8e410f9def268c9c091b09c29e3f
-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 genpatches-2.6.24-6.base.tar.bz2 70308 RMD160 5d849f178c1227a28d97b0a77020f104d27207e1 SHA1 d06c9f02193323af7f09a75328c23e40f70c0639 SHA256 6dbb8b7a8c43c7c500c628d4ac3e052bf8b3db8b3764067eea21651aac63e579
-DIST genpatches-2.6.24-6.extras.tar.bz2 50248 RMD160 8d95c79873dcaffdd01278ef2101eb72da5459f8 SHA1 b88da6f302390d6b26670d92065b9a80f108bf17 SHA256 080962ededdc2b9b69a7269f0920c102e10d1869c2ff204e3444ceb1ce416126
-DIST genpatches-2.6.25-2.base.tar.bz2 2154 RMD160 e4311661139fd0c1512c00093a5e8e3a847506ef SHA1 2864c0709872c77cd6d9cf484b0917c0762c26ee SHA256 884419b97ca49fcbf5ac010162ec9c2aa430f539655be7a77c4aa05a7a0b8685
-DIST genpatches-2.6.25-2.extras.tar.bz2 41955 RMD160 95a9230a5592dec44391d1860204a175d2779f58 SHA1 a487626a53262225b543c82ebc1e6a8b3010f52e SHA256 79b5fcf6d936888309f55d4715bcaecea139393ea79984649c33130833d80ddf
-DIST genpatches-2.6.25-5.base.tar.bz2 43426 RMD160 f5350e3a3113fe3400ec7fc35541513b70681fea SHA1 06c2a7c9224507e89736f918bc9ca8caf6b36194 SHA256 9633e3480434abe8426465213b8af88cee3f2af015c12ebb7a0fdbe01ed45c1d
-DIST genpatches-2.6.25-5.extras.tar.bz2 41717 RMD160 bc2f220a944f701d944061f11d633f2301139ccc SHA1 79d093c93ff1c76e98bff174d5b3c603cd1f0d7e SHA256 0cc8eaab5e746a7b514ee6c86e6ae986618ae4929c0a0c4a8e6098c9d3a43eae
-DIST genpatches-2.6.26-1.base.tar.bz2 2747 RMD160 0bba41529ab51e9bf72bcca24fc5bdddfa8316be SHA1 36cb7c6300ed93d8db6e110ab5d823449c44cf0e SHA256 43fc0f34912623fc9102dabe627228cd993533d6a78162ee9817c0d994cfbf77
-DIST genpatches-2.6.26-1.extras.tar.bz2 41329 RMD160 247f08545525ebc0764d96be31f73cb3bc5366aa SHA1 4e46d6fc86530a535e2869dc255851a49fdb35e0 SHA256 4997e9dc128498286d10d54088f45be0ebdd98ec667723604d8760745b766716
-DIST linux-2.6.24.tar.bz2 46737783 RMD160 0e5194c69c3d82c41ece689c4f84e638f8776d34 SHA1 351aebc784a5395fe4c92d1e514a89680482f7e2 SHA256 413c64fbbcf81244cb5571be4963644a1e81166a2b0f008a016528363b65c5d3
-DIST linux-2.6.25.tar.bz2 48601689 RMD160 cf3ed52f888fe9df7a93abe4fdc2f598e1ba0ce4 SHA1 aa6187a1c212dd2d8bd906b023fcefdcf711f35e SHA256 108b2a3f2b05c0e57d1d0977619525e46f8d4b425aef4b38b47dcf94292f2dd2
-DIST linux-2.6.26.tar.bz2 49441874 RMD160 57c37e81afa48e7c05e1a933d390a12ac2921255 SHA1 3f44384bf84f27add3b6c43ec68f974d7f7e9c67 SHA256 666488e2511393fdb901eaf1e67275bcc38ab37c930e8a9adb290a95c1721a2a
-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-r4.ebuild 1347 RMD160 089274c3635fb12e86479a8cec253a64d47dc0a4 SHA1 b1c1db8e05c9d0a591b54b8a191178bd200fc324 SHA256 3c9fa5098addc57c818c761fe3e5f879750c5a896b7620dbccd6ee50f1a69ea4
-EBUILD mactel-linux-sources-2.6.24-r5.ebuild 1401 RMD160 e661f5bfe3cb0f90bdb606fa828516031eaa2ade SHA1 609ecc0d5121f8cba2cb67a812564d76320b638f SHA256 ef0de6f7260fab64869877ce6db6ab83965ec37f9e45b5e23af7a55fc8496837
-EBUILD mactel-linux-sources-2.6.25-r1.ebuild 1323 RMD160 836f21ac787e5373a00e627152a96896509de84c SHA1 f44f40a0f593c52f0b4880736a8c48411ee6a863 SHA256 cd9505684c2ad47fb9fc4aab87e513ae4ebdccaf51bea71bc66bf0b696d3a82e
-EBUILD mactel-linux-sources-2.6.25-r4.ebuild 1323 RMD160 6bd1ba678257659354eacd0c339a8d1348ade80b SHA1 8aa54e0148e96fb95cccfe8b6d9df0c6669455ad SHA256 229fb2f69ef09ce0953b11bc0bc745013fd2deb29a636de38610012e4fb98a76
-EBUILD mactel-linux-sources-2.6.26.ebuild 1436 RMD160 e324fbb115a5b81c18cff8c572483aa2629bd3a2 SHA1 fd1ccd8d9e26196705ed7d1e3eceafd2beba5997 SHA256 40f03960babe00a92714837ca0eebef8196fe80ef90ee89bba3273408fb58c22
-MISC ChangeLog 291 RMD160 176d00efe9082a238c1f12985dfa00db7b40edd5 SHA1 cdcadf524047cd48bfaae847d5a458f5ddcbaac4 SHA256 8dc690fd83321645435c5fe2c8a4fe248629e266e6299fa675b1271cceecd1bf
-MISC metadata.xml 337 RMD160 7746bfc80e970f2a875778a1e9e50726767e43c5 SHA1 434b7cbdb29a63ccb7c93abd037c87bbd5173e52 SHA256 ef98ba1112b876c5895acb6315b169c184237f7718a86886c644be41fabca709
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc-macbook2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc-macbook2.patch
deleted file mode 100644
index ec3128a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc-macbook2.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-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/2.6.24-mactel-patches-r145/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc-retry-when-accessing-keys.patch
deleted file mode 100644
index a12be92..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc-retry-when-accessing-keys.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-Retry up to 200 ms when reading or writing keys.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 69 +++++++++++++++++++++++++++++++---------------
- 1 files changed, 47 insertions(+), 22 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index c0dd9b1..3b09cdb 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -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 */
-
-+#define ACCESS_TIMEOUT_MSECS 500 /* wait up to 500ms when accessing a key */
-+#define ACCESS_WAIT_MSECS 5 /* ... in 5ms increments */
-+
- #define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-@@ -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.
-+ * Tries up to ACCESS_WAIT_MSECS to read the value.
- * Returns zero on success or a negative error on failure. Callers must
- * hold applesmc_lock.
- */
- static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- {
-- int i;
-+ int i, total, ret;
-
- if (len > APPLESMC_MAX_DATA_LENGTH) {
- printk(KERN_ERR "applesmc_read_key: cannot read more than "
-@@ -199,33 +203,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- return -EINVAL;
- }
-
-- outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-- if (__wait_status(0x0c))
-- return -EIO;
-+ for (total = ACCESS_TIMEOUT_MSECS; total > 0;
-+ total -= ACCESS_WAIT_MSECS) {
-+ ret = 0;
-+ outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-+ if (__wait_status(0x0c)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-
-- for (i = 0; i < 4; i++) {
-- outb(key[i], APPLESMC_DATA_PORT);
-- if (__wait_status(0x04))
-- return -EIO;
-- }
-- if (debug)
-- printk(KERN_DEBUG "<%s", key);
-+ for (i = 0; i < 4; i++) {
-+ outb(key[i], APPLESMC_DATA_PORT);
-+ if (__wait_status(0x04)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ }
-+ if (debug)
-+ printk(KERN_DEBUG "<%s", key);
-
-- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-- printk(KERN_DEBUG ">%x", len);
-+ outb(len, APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG ">%x", len);
-
-- for (i = 0; i < len; i++) {
-- if (__wait_status(0x05))
-- return -EIO;
-- buffer[i] = inb(APPLESMC_DATA_PORT);
-+ for (i = 0; i < len; i++) {
-+ if (__wait_status(0x05)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ buffer[i] = inb(APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG "<%x", buffer[i]);
-+ }
- if (debug)
-- printk(KERN_DEBUG "<%x", buffer[i]);
-+ printk(KERN_DEBUG "\n");
-+
-+ break;
-+
-+wait_fail:
-+ msleep(ACCESS_WAIT_MSECS);
-+ continue;
- }
-- if (debug)
-- printk(KERN_DEBUG "\n");
-
-- return 0;
-+ if (total != ACCESS_TIMEOUT_MSECS) {
-+ printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-+ ACCESS_TIMEOUT_MSECS-total);
-+ }
-+
-+ return ret;
- }
-
- /*
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc_int.patch
deleted file mode 100644
index 5a10e44..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/applesmc_int.patch
+++ /dev/null
@@ -1,415 +0,0 @@
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 321 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 298 insertions(+), 23 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 3b09cdb..ff3e79d 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -39,14 +39,20 @@
- #include <linux/leds.h>
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
-+#include <linux/interrupt.h>
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
- /* command/status port used by Apple SMC */
- #define APPLESMC_CMD_PORT 0x304
-+/* status port used by Apple SMC to get which interrupt type just happened */
-+#define APPLESMC_INT_PORT 0x31f
-
- #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */
-
-+/* Defined in ACPI DSDT table, should we read it from there? */
-+#define APPLESMC_IRQ 6
-+
- #define APPLESMC_MAX_DATA_LENGTH 32
-
- #define APPLESMC_STATUS_MASK 0x0f
-@@ -57,6 +63,8 @@
-
- #define KEY_COUNT_KEY "#KEY" /* r-o ui32 */
-
-+#define INTERRUPT_OK_KEY "NTOK" /* w-o ui8 */
-+
- #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) */
-@@ -68,6 +76,19 @@
- #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-
-+/*
-+ * Interrupt controls.
-+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
-+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than the
-+ * value of MOLD (or MOHD), SMC will trigger an interrupt.
-+ */
-+#define MOTION_LOW_NORM "MOLT" /* r/w sp78 (2 bytes) */
-+#define MOTION_HIGH_NORM "MOHT" /* r/w sp78 (2 bytes) */
-+#define MOTION_LOW_NORM_INTERVAL "MOLD" /* r/w ui8 */
-+#define MOTION_HIGH_NORM_INTERVAL "MOHD" /* r/w ui8 */
-+
-+#define MSDW_KEY "MSDW" /* r/w flag (1 byte) */
-+
- #define FANS_COUNT "FNum" /* r-o ui8 */
- #define FANS_MANUAL "FS! " /* r-w ui16 */
- #define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -385,12 +406,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * buffer, if not, writes these bytes.
-+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
-+ * waited more than INIT_TIMEOUT_MSECS in total.
-+ * Returns zero on success or a negative error on failure. Callers must
-+ * hold applesmc_lock.
-+ */
-+static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
-+{
-+ int total, ret, i, compare;
-+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
-+
-+ if (len > APPLESMC_MAX_DATA_LENGTH) {
-+ printk(KERN_ERR "applesmc_init_check_key_value: cannot "
-+ "read/write more than %d bytes",
-+ APPLESMC_MAX_DATA_LENGTH);
-+ return -EINVAL;
-+ }
-+
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret = applesmc_read_key(key, rdbuffer, len);
-+ if (!ret) {
-+ compare = 1;
-+ for (i = 0; i < len; i++) {
-+ if (rdbuffer[i] != buffer[i]) {
-+ compare = 0;
-+ break;
-+ }
-+ }
-+
-+ if (compare) {
-+ return 0;
-+ }
-+ }
-+ ret = applesmc_write_key(key, buffer, len);
-+ msleep(INIT_WAIT_MSECS);
-+ }
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return -EIO;
-+}
-+
-+irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
-+{
-+ u8 int_type = inb(APPLESMC_INT_PORT);
-+
-+ switch (int_type) {
-+ case 0x60:
-+ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
-+ break;
-+ case 0x6f:
-+ printk(KERN_INFO
-+ "applesmc: received a high acceleration interrupt\n");
-+ break;
-+ case 0x80:
-+ printk(KERN_INFO "applesmc: received a shock interrupt\n");
-+ break;
-+ default:
-+ printk(KERN_INFO
-+ "applesmc: received an unknown interrupt %x\n",
-+ int_type);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
- */
- static int applesmc_device_init(void)
- {
-- int total, ret = -ENXIO;
-+ int total;
-+ int ret = -ENXIO;
-+ int ret1, ret2;
- u8 buffer[2];
-
- if (!applesmc_accelerometer)
-@@ -398,32 +490,79 @@ static int applesmc_device_init(void)
-
- mutex_lock(&applesmc_lock);
-
-+ /* Accept interrupts */
-+ buffer[0] = 0x01;
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug)
-- printk(KERN_DEBUG "applesmc try %d\n", total);
-- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
-- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
-- if (total == INIT_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "applesmc: device has"
-- " already been initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- } else {
-- printk(KERN_DEBUG "applesmc: device"
-- " successfully initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- }
-- ret = 0;
-- goto out;
-- }
-- buffer[0] = 0xe0;
-- buffer[1] = 0x00;
-- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
-+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set NTOK key, "
-+ "will not receive interrupts.\n");
-+
-+ /* Setup interrupt controls. */
-+ buffer[0] = 20; /* 20 msecs */
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ buffer[0] = 20; /* 20 msecs */
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ if (ret1 || ret2) {
-+ 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);
-+
-+ buffer[0] = 0x01;
-+ buffer[1] = 0xc0;
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM, buffer, 2);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
-+ }
-+
-+ /* Mysterious key. */
-+ buffer[0] = 0x01;
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set MSDW key\n");
-+
-+ /* Initialize the device. */
-+ buffer[0] = 0xe0;
-+ buffer[1] = 0xf8;
-+ if (applesmc_init_check_key_value(MOTION_SENSOR_KEY, buffer, 2)) {
-+ printk(KERN_WARNING "applesmc: failed to init "
-+ "the accelerometer\n");
-+ goto out;
-+ }
-+
-+ ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler, IRQF_DISABLED,
-+ "applesmc_irq_handler", NULL);
-+
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-+ }
-+
-+ printk(KERN_DEBUG "applesmc: accelerometer "
-+ "successfully initialized.\n");
-+ ret = 0;
-
- out:
- mutex_unlock(&applesmc_lock);
-@@ -468,9 +607,16 @@ static int applesmc_resume(struct platform_device *dev)
- return applesmc_device_init();
- }
-
-+static int applesmc_remove(struct platform_device *dev)
-+{
-+ free_irq(APPLESMC_IRQ, NULL);
-+ return 0;
-+}
-+
- static struct platform_driver applesmc_driver = {
- .probe = applesmc_probe,
- .resume = applesmc_resume,
-+ .remove = applesmc_remove,
- .driver = {
- .name = "applesmc",
- .owner = THIS_MODULE,
-@@ -932,6 +1078,123 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
- return count;
- }
-
-+static ssize_t applesmc_accelerometer_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ int ret;
-+ unsigned int value = 0;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk(KERN_ERR
-+ "Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_read_key(key, buffer, length);
-+ if (length == 2)
-+ value = ((unsigned int)buffer[0] << 8) | buffer[1];
-+ else if (length == 1)
-+ value = buffer[0];
-+ else {
-+ printk("Invalid length for applesmc_param_show");
-+ ret = -EINVAL;
-+ }
-+
-+ mutex_unlock(&applesmc_lock);
-+ if (ret)
-+ return ret;
-+ else
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", value);
-+}
-+
-+static ssize_t applesmc_accelerometer_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *sysfsbuf, size_t count)
-+{
-+ int ret;
-+ u32 value;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ value = simple_strtoul(sysfsbuf, NULL, 10);
-+
-+ if (length == 2) {
-+ if (value > 0xffff)
-+ return -EINVAL;
-+
-+ buffer[0] = (value >> 8) & 0xff;
-+ buffer[1] = value & 0xff;
-+ } else if (length == 1) {
-+ if (value > 0xff)
-+ return -EINVAL;
-+
-+ buffer[0] = value & 0xff;
-+ } else {
-+ printk("Invalid length for applesmc_param_store");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_write_key(key, buffer, length);
-+
-+ mutex_unlock(&applesmc_lock);
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return count;
-+}
-+
- static struct led_classdev applesmc_backlight = {
- .name = "smc:kbd_backlight",
- .default_trigger = "nand-disk",
-@@ -943,10 +1206,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);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 1);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 2);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 3);
-
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+ &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger_interval.dev_attr.attr,
- NULL
- };
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/appletouch.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/appletouch.patch
deleted file mode 100644
index d09b12a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/appletouch.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Appletouch driver ATP_THRESHOLD fix.
-
-From: Ortwin Glück <odi@odi.ch>
-
-
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-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);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 5
-+#define ATP_THRESHOLD 3
-
- /* 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-r145/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
deleted file mode 100644
index f7b4cb9..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-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-r145/sigmatel_audio_fix_macbook_v2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/sigmatel_audio_fix_macbook_v2.patch
deleted file mode 100644
index a559167..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r145/sigmatel_audio_fix_macbook_v2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-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/2.6.24-mactel-patches-r149/applesmc-case-led.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-case-led.patch
deleted file mode 100644
index 860f9d4..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-case-led.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-[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-r149/applesmc-macbook2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-macbook2.patch
deleted file mode 100644
index ec3128a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-macbook2.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-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/2.6.24-mactel-patches-r149/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-retry-when-accessing-keys.patch
deleted file mode 100644
index a12be92..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc-retry-when-accessing-keys.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-Retry up to 200 ms when reading or writing keys.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 69 +++++++++++++++++++++++++++++++---------------
- 1 files changed, 47 insertions(+), 22 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index c0dd9b1..3b09cdb 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -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 */
-
-+#define ACCESS_TIMEOUT_MSECS 500 /* wait up to 500ms when accessing a key */
-+#define ACCESS_WAIT_MSECS 5 /* ... in 5ms increments */
-+
- #define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-@@ -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.
-+ * Tries up to ACCESS_WAIT_MSECS to read the value.
- * Returns zero on success or a negative error on failure. Callers must
- * hold applesmc_lock.
- */
- static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- {
-- int i;
-+ int i, total, ret;
-
- if (len > APPLESMC_MAX_DATA_LENGTH) {
- printk(KERN_ERR "applesmc_read_key: cannot read more than "
-@@ -199,33 +203,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- return -EINVAL;
- }
-
-- outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-- if (__wait_status(0x0c))
-- return -EIO;
-+ for (total = ACCESS_TIMEOUT_MSECS; total > 0;
-+ total -= ACCESS_WAIT_MSECS) {
-+ ret = 0;
-+ outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-+ if (__wait_status(0x0c)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-
-- for (i = 0; i < 4; i++) {
-- outb(key[i], APPLESMC_DATA_PORT);
-- if (__wait_status(0x04))
-- return -EIO;
-- }
-- if (debug)
-- printk(KERN_DEBUG "<%s", key);
-+ for (i = 0; i < 4; i++) {
-+ outb(key[i], APPLESMC_DATA_PORT);
-+ if (__wait_status(0x04)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ }
-+ if (debug)
-+ printk(KERN_DEBUG "<%s", key);
-
-- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-- printk(KERN_DEBUG ">%x", len);
-+ outb(len, APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG ">%x", len);
-
-- for (i = 0; i < len; i++) {
-- if (__wait_status(0x05))
-- return -EIO;
-- buffer[i] = inb(APPLESMC_DATA_PORT);
-+ for (i = 0; i < len; i++) {
-+ if (__wait_status(0x05)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ buffer[i] = inb(APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG "<%x", buffer[i]);
-+ }
- if (debug)
-- printk(KERN_DEBUG "<%x", buffer[i]);
-+ printk(KERN_DEBUG "\n");
-+
-+ break;
-+
-+wait_fail:
-+ msleep(ACCESS_WAIT_MSECS);
-+ continue;
- }
-- if (debug)
-- printk(KERN_DEBUG "\n");
-
-- return 0;
-+ if (total != ACCESS_TIMEOUT_MSECS) {
-+ printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-+ ACCESS_TIMEOUT_MSECS-total);
-+ }
-+
-+ return ret;
- }
-
- /*
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc_int.patch
deleted file mode 100644
index d69f9df..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/applesmc_int.patch
+++ /dev/null
@@ -1,414 +0,0 @@
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- 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 3b09cdb..8f75b57 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -39,14 +39,20 @@
- #include <linux/leds.h>
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
-+#include <linux/interrupt.h>
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
- /* command/status port used by Apple SMC */
- #define APPLESMC_CMD_PORT 0x304
-+/* status port used by Apple SMC to get which interrupt type just happened */
-+#define APPLESMC_INT_PORT 0x31f
-
- #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */
-
-+/* Defined in ACPI DSDT table, should we read it from there? */
-+#define APPLESMC_IRQ 6
-+
- #define APPLESMC_MAX_DATA_LENGTH 32
-
- #define APPLESMC_STATUS_MASK 0x0f
-@@ -57,6 +63,8 @@
-
- #define KEY_COUNT_KEY "#KEY" /* r-o ui32 */
-
-+#define INTERRUPT_OK_KEY "NTOK" /* w-o ui8 */
-+
- #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) */
-@@ -68,6 +76,19 @@
- #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-
-+/*
-+ * Interrupt controls.
-+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
-+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than the
-+ * value of MOLD (or MOHD), SMC will trigger an interrupt.
-+ */
-+#define MOTION_LOW_NORM "MOLT" /* r/w sp78 (2 bytes) */
-+#define MOTION_HIGH_NORM "MOHT" /* r/w sp78 (2 bytes) */
-+#define MOTION_LOW_NORM_INTERVAL "MOLD" /* r/w ui8 */
-+#define MOTION_HIGH_NORM_INTERVAL "MOHD" /* r/w ui8 */
-+
-+#define MSDW_KEY "MSDW" /* r/w flag (1 byte) */
-+
- #define FANS_COUNT "FNum" /* r-o ui8 */
- #define FANS_MANUAL "FS! " /* r-w ui16 */
- #define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -385,12 +406,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * buffer, if not, writes these bytes.
-+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
-+ * waited more than INIT_TIMEOUT_MSECS in total.
-+ * Returns zero on success or a negative error on failure. Callers must
-+ * hold applesmc_lock.
-+ */
-+static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
-+{
-+ int total, ret, i, compare;
-+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
-+
-+ if (len > APPLESMC_MAX_DATA_LENGTH) {
-+ printk(KERN_ERR "applesmc_init_check_key_value: cannot "
-+ "read/write more than %d bytes",
-+ APPLESMC_MAX_DATA_LENGTH);
-+ return -EINVAL;
-+ }
-+
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret = applesmc_read_key(key, rdbuffer, len);
-+ if (!ret) {
-+ compare = 1;
-+ for (i = 0; i < len; i++) {
-+ if (rdbuffer[i] != buffer[i]) {
-+ compare = 0;
-+ break;
-+ }
-+ }
-+
-+ if (compare) {
-+ return 0;
-+ }
-+ }
-+ ret = applesmc_write_key(key, buffer, len);
-+ msleep(INIT_WAIT_MSECS);
-+ }
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return -EIO;
-+}
-+
-+irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
-+{
-+ u8 int_type = inb(APPLESMC_INT_PORT);
-+
-+ switch (int_type) {
-+ case 0x60:
-+ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
-+ break;
-+ case 0x6f:
-+ printk(KERN_INFO
-+ "applesmc: received a high acceleration interrupt\n");
-+ break;
-+ case 0x80:
-+ printk(KERN_INFO "applesmc: received a shock interrupt\n");
-+ break;
-+ default:
-+ printk(KERN_INFO
-+ "applesmc: received an unknown interrupt %x\n",
-+ int_type);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
- */
- static int applesmc_device_init(void)
- {
-- int total, ret = -ENXIO;
-+ int total;
-+ int ret = -ENXIO;
-+ int ret1, ret2;
- u8 buffer[2];
-
- if (!applesmc_accelerometer)
-@@ -398,32 +490,79 @@ static int applesmc_device_init(void)
-
- mutex_lock(&applesmc_lock);
-
-+ /* Accept interrupts */
-+ buffer[0] = 0x01;
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug)
-- printk(KERN_DEBUG "applesmc try %d\n", total);
-- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
-- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
-- if (total == INIT_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "applesmc: device has"
-- " already been initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- } else {
-- printk(KERN_DEBUG "applesmc: device"
-- " successfully initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- }
-- ret = 0;
-- goto out;
-- }
-- buffer[0] = 0xe0;
-- buffer[1] = 0x00;
-- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
-+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set NTOK key, "
-+ "will not receive interrupts.\n");
-+
-+ /* Setup interrupt controls. */
-+ buffer[0] = 20; /* 20 msecs */
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ buffer[0] = 20; /* 20 msecs */
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "interrupt interval, might not receive "
-+ "some interrupts.");
-+ }
-+
-+ buffer[0] = 0x00;
-+ buffer[1] = 0x60;
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM, buffer, 2);
-+
-+ buffer[0] = 0x01;
-+ buffer[1] = 0xc0;
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM, buffer, 2);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
-+ }
-+
-+ /* Mysterious key. */
-+ buffer[0] = 0x01;
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set MSDW key\n");
-+
-+ /* Initialize the device. */
-+ buffer[0] = 0xe0;
-+ buffer[1] = 0xf8;
-+ if (applesmc_init_check_key_value(MOTION_SENSOR_KEY, buffer, 2)) {
-+ 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);
-+
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-+ }
-+
-+ printk(KERN_DEBUG "applesmc: accelerometer "
-+ "successfully initialized.\n");
-+ ret = 0;
-
- out:
- mutex_unlock(&applesmc_lock);
-@@ -468,9 +607,16 @@ static int applesmc_resume(struct platform_device *dev)
- return applesmc_device_init();
- }
-
-+static int applesmc_remove(struct platform_device *dev)
-+{
-+ free_irq(APPLESMC_IRQ, NULL);
-+ return 0;
-+}
-+
- static struct platform_driver applesmc_driver = {
- .probe = applesmc_probe,
- .resume = applesmc_resume,
-+ .remove = applesmc_remove,
- .driver = {
- .name = "applesmc",
- .owner = THIS_MODULE,
-@@ -932,6 +1078,122 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
- return count;
- }
-
-+static ssize_t applesmc_accelerometer_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ int ret;
-+ unsigned int value = 0;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk(KERN_ERR
-+ "Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_read_key(key, buffer, length);
-+ if (length == 2)
-+ value = ((unsigned int)buffer[0] << 8) | buffer[1];
-+ else if (length == 1)
-+ value = buffer[0];
-+ else {
-+ printk("Invalid length for applesmc_param_show");
-+ ret = -EINVAL;
-+ }
-+
-+ mutex_unlock(&applesmc_lock);
-+ if (ret)
-+ return ret;
-+ else
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", value);
-+}
-+
-+static ssize_t applesmc_accelerometer_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *sysfsbuf, size_t count)
-+{
-+ int ret;
-+ u32 value;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ value = simple_strtoul(sysfsbuf, NULL, 10);
-+
-+ if (length == 2) {
-+ if (value > 0xffff)
-+ return -EINVAL;
-+
-+ buffer[0] = (value >> 8) & 0xff;
-+ buffer[1] = value & 0xff;
-+ } else if (length == 1) {
-+ if (value > 0xff)
-+ return -EINVAL;
-+
-+ buffer[0] = value & 0xff;
-+ } else {
-+ printk("Invalid length for applesmc_param_store");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_write_key(key, buffer, length);
-+
-+ mutex_unlock(&applesmc_lock);
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return count;
-+}
- static struct led_classdev applesmc_backlight = {
- .name = "smc:kbd_backlight",
- .default_trigger = "nand-disk",
-@@ -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);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 1);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 2);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 3);
-
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+ &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger_interval.dev_attr.attr,
- NULL
- };
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch-add-macbook3-trackpad.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch-add-macbook3-trackpad.patch
deleted file mode 100644
index feef8da..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch-add-macbook3-trackpad.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-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-r149/appletouch-new.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch-new.patch
deleted file mode 100644
index 4ca9035..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch-new.patch
+++ /dev/null
@@ -1,364 +0,0 @@
-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/2.6.24-mactel-patches-r149/appletouch.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch.patch
deleted file mode 100644
index d09b12a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/appletouch.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Appletouch driver ATP_THRESHOLD fix.
-
-From: Ortwin Glück <odi@odi.ch>
-
-
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-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);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 5
-+#define ATP_THRESHOLD 3
-
- /* 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-r149/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
deleted file mode 100644
index f7b4cb9..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-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-r149/sigmatel_audio_fix_macbook_v2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/sigmatel_audio_fix_macbook_v2.patch
deleted file mode 100644
index a559167..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r149/sigmatel_audio_fix_macbook_v2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-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/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
deleted file mode 100644
index 860f9d4..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-case-led.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-[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
deleted file mode 100644
index ec3128a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-macbook2.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-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/2.6.24-mactel-patches-r151/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
deleted file mode 100644
index a12be92..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc-retry-when-accessing-keys.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-Retry up to 200 ms when reading or writing keys.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 69 +++++++++++++++++++++++++++++++---------------
- 1 files changed, 47 insertions(+), 22 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index c0dd9b1..3b09cdb 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -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 */
-
-+#define ACCESS_TIMEOUT_MSECS 500 /* wait up to 500ms when accessing a key */
-+#define ACCESS_WAIT_MSECS 5 /* ... in 5ms increments */
-+
- #define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-@@ -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.
-+ * Tries up to ACCESS_WAIT_MSECS to read the value.
- * Returns zero on success or a negative error on failure. Callers must
- * hold applesmc_lock.
- */
- static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- {
-- int i;
-+ int i, total, ret;
-
- if (len > APPLESMC_MAX_DATA_LENGTH) {
- printk(KERN_ERR "applesmc_read_key: cannot read more than "
-@@ -199,33 +203,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- return -EINVAL;
- }
-
-- outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-- if (__wait_status(0x0c))
-- return -EIO;
-+ for (total = ACCESS_TIMEOUT_MSECS; total > 0;
-+ total -= ACCESS_WAIT_MSECS) {
-+ ret = 0;
-+ outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-+ if (__wait_status(0x0c)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-
-- for (i = 0; i < 4; i++) {
-- outb(key[i], APPLESMC_DATA_PORT);
-- if (__wait_status(0x04))
-- return -EIO;
-- }
-- if (debug)
-- printk(KERN_DEBUG "<%s", key);
-+ for (i = 0; i < 4; i++) {
-+ outb(key[i], APPLESMC_DATA_PORT);
-+ if (__wait_status(0x04)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ }
-+ if (debug)
-+ printk(KERN_DEBUG "<%s", key);
-
-- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-- printk(KERN_DEBUG ">%x", len);
-+ outb(len, APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG ">%x", len);
-
-- for (i = 0; i < len; i++) {
-- if (__wait_status(0x05))
-- return -EIO;
-- buffer[i] = inb(APPLESMC_DATA_PORT);
-+ for (i = 0; i < len; i++) {
-+ if (__wait_status(0x05)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ buffer[i] = inb(APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG "<%x", buffer[i]);
-+ }
- if (debug)
-- printk(KERN_DEBUG "<%x", buffer[i]);
-+ printk(KERN_DEBUG "\n");
-+
-+ break;
-+
-+wait_fail:
-+ msleep(ACCESS_WAIT_MSECS);
-+ continue;
- }
-- if (debug)
-- printk(KERN_DEBUG "\n");
-
-- return 0;
-+ if (total != ACCESS_TIMEOUT_MSECS) {
-+ printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-+ ACCESS_TIMEOUT_MSECS-total);
-+ }
-+
-+ return ret;
- }
-
- /*
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc_int.patch
deleted file mode 100644
index d69f9df..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/applesmc_int.patch
+++ /dev/null
@@ -1,414 +0,0 @@
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- 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 3b09cdb..8f75b57 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -39,14 +39,20 @@
- #include <linux/leds.h>
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
-+#include <linux/interrupt.h>
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
- /* command/status port used by Apple SMC */
- #define APPLESMC_CMD_PORT 0x304
-+/* status port used by Apple SMC to get which interrupt type just happened */
-+#define APPLESMC_INT_PORT 0x31f
-
- #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */
-
-+/* Defined in ACPI DSDT table, should we read it from there? */
-+#define APPLESMC_IRQ 6
-+
- #define APPLESMC_MAX_DATA_LENGTH 32
-
- #define APPLESMC_STATUS_MASK 0x0f
-@@ -57,6 +63,8 @@
-
- #define KEY_COUNT_KEY "#KEY" /* r-o ui32 */
-
-+#define INTERRUPT_OK_KEY "NTOK" /* w-o ui8 */
-+
- #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) */
-@@ -68,6 +76,19 @@
- #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-
-+/*
-+ * Interrupt controls.
-+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
-+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than the
-+ * value of MOLD (or MOHD), SMC will trigger an interrupt.
-+ */
-+#define MOTION_LOW_NORM "MOLT" /* r/w sp78 (2 bytes) */
-+#define MOTION_HIGH_NORM "MOHT" /* r/w sp78 (2 bytes) */
-+#define MOTION_LOW_NORM_INTERVAL "MOLD" /* r/w ui8 */
-+#define MOTION_HIGH_NORM_INTERVAL "MOHD" /* r/w ui8 */
-+
-+#define MSDW_KEY "MSDW" /* r/w flag (1 byte) */
-+
- #define FANS_COUNT "FNum" /* r-o ui8 */
- #define FANS_MANUAL "FS! " /* r-w ui16 */
- #define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -385,12 +406,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * buffer, if not, writes these bytes.
-+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
-+ * waited more than INIT_TIMEOUT_MSECS in total.
-+ * Returns zero on success or a negative error on failure. Callers must
-+ * hold applesmc_lock.
-+ */
-+static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
-+{
-+ int total, ret, i, compare;
-+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
-+
-+ if (len > APPLESMC_MAX_DATA_LENGTH) {
-+ printk(KERN_ERR "applesmc_init_check_key_value: cannot "
-+ "read/write more than %d bytes",
-+ APPLESMC_MAX_DATA_LENGTH);
-+ return -EINVAL;
-+ }
-+
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret = applesmc_read_key(key, rdbuffer, len);
-+ if (!ret) {
-+ compare = 1;
-+ for (i = 0; i < len; i++) {
-+ if (rdbuffer[i] != buffer[i]) {
-+ compare = 0;
-+ break;
-+ }
-+ }
-+
-+ if (compare) {
-+ return 0;
-+ }
-+ }
-+ ret = applesmc_write_key(key, buffer, len);
-+ msleep(INIT_WAIT_MSECS);
-+ }
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return -EIO;
-+}
-+
-+irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
-+{
-+ u8 int_type = inb(APPLESMC_INT_PORT);
-+
-+ switch (int_type) {
-+ case 0x60:
-+ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
-+ break;
-+ case 0x6f:
-+ printk(KERN_INFO
-+ "applesmc: received a high acceleration interrupt\n");
-+ break;
-+ case 0x80:
-+ printk(KERN_INFO "applesmc: received a shock interrupt\n");
-+ break;
-+ default:
-+ printk(KERN_INFO
-+ "applesmc: received an unknown interrupt %x\n",
-+ int_type);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
- */
- static int applesmc_device_init(void)
- {
-- int total, ret = -ENXIO;
-+ int total;
-+ int ret = -ENXIO;
-+ int ret1, ret2;
- u8 buffer[2];
-
- if (!applesmc_accelerometer)
-@@ -398,32 +490,79 @@ static int applesmc_device_init(void)
-
- mutex_lock(&applesmc_lock);
-
-+ /* Accept interrupts */
-+ buffer[0] = 0x01;
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug)
-- printk(KERN_DEBUG "applesmc try %d\n", total);
-- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
-- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
-- if (total == INIT_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "applesmc: device has"
-- " already been initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- } else {
-- printk(KERN_DEBUG "applesmc: device"
-- " successfully initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- }
-- ret = 0;
-- goto out;
-- }
-- buffer[0] = 0xe0;
-- buffer[1] = 0x00;
-- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
-+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set NTOK key, "
-+ "will not receive interrupts.\n");
-+
-+ /* Setup interrupt controls. */
-+ buffer[0] = 20; /* 20 msecs */
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ buffer[0] = 20; /* 20 msecs */
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "interrupt interval, might not receive "
-+ "some interrupts.");
-+ }
-+
-+ buffer[0] = 0x00;
-+ buffer[1] = 0x60;
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM, buffer, 2);
-+
-+ buffer[0] = 0x01;
-+ buffer[1] = 0xc0;
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM, buffer, 2);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
-+ }
-+
-+ /* Mysterious key. */
-+ buffer[0] = 0x01;
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set MSDW key\n");
-+
-+ /* Initialize the device. */
-+ buffer[0] = 0xe0;
-+ buffer[1] = 0xf8;
-+ if (applesmc_init_check_key_value(MOTION_SENSOR_KEY, buffer, 2)) {
-+ 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);
-+
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-+ }
-+
-+ printk(KERN_DEBUG "applesmc: accelerometer "
-+ "successfully initialized.\n");
-+ ret = 0;
-
- out:
- mutex_unlock(&applesmc_lock);
-@@ -468,9 +607,16 @@ static int applesmc_resume(struct platform_device *dev)
- return applesmc_device_init();
- }
-
-+static int applesmc_remove(struct platform_device *dev)
-+{
-+ free_irq(APPLESMC_IRQ, NULL);
-+ return 0;
-+}
-+
- static struct platform_driver applesmc_driver = {
- .probe = applesmc_probe,
- .resume = applesmc_resume,
-+ .remove = applesmc_remove,
- .driver = {
- .name = "applesmc",
- .owner = THIS_MODULE,
-@@ -932,6 +1078,122 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
- return count;
- }
-
-+static ssize_t applesmc_accelerometer_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ int ret;
-+ unsigned int value = 0;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk(KERN_ERR
-+ "Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_read_key(key, buffer, length);
-+ if (length == 2)
-+ value = ((unsigned int)buffer[0] << 8) | buffer[1];
-+ else if (length == 1)
-+ value = buffer[0];
-+ else {
-+ printk("Invalid length for applesmc_param_show");
-+ ret = -EINVAL;
-+ }
-+
-+ mutex_unlock(&applesmc_lock);
-+ if (ret)
-+ return ret;
-+ else
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", value);
-+}
-+
-+static ssize_t applesmc_accelerometer_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *sysfsbuf, size_t count)
-+{
-+ int ret;
-+ u32 value;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ value = simple_strtoul(sysfsbuf, NULL, 10);
-+
-+ if (length == 2) {
-+ if (value > 0xffff)
-+ return -EINVAL;
-+
-+ buffer[0] = (value >> 8) & 0xff;
-+ buffer[1] = value & 0xff;
-+ } else if (length == 1) {
-+ if (value > 0xff)
-+ return -EINVAL;
-+
-+ buffer[0] = value & 0xff;
-+ } else {
-+ printk("Invalid length for applesmc_param_store");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_write_key(key, buffer, length);
-+
-+ mutex_unlock(&applesmc_lock);
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return count;
-+}
- static struct led_classdev applesmc_backlight = {
- .name = "smc:kbd_backlight",
- .default_trigger = "nand-disk",
-@@ -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);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 1);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 2);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 3);
-
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+ &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger_interval.dev_attr.attr,
- NULL
- };
-
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
deleted file mode 100644
index feef8da..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-add-macbook3-trackpad.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-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
deleted file mode 100644
index 4ca9035..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch-new.patch
+++ /dev/null
@@ -1,364 +0,0 @@
-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/2.6.24-mactel-patches-r151/appletouch.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch.patch
deleted file mode 100644
index d09b12a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/appletouch.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Appletouch driver ATP_THRESHOLD fix.
-
-From: Ortwin Glück <odi@odi.ch>
-
-
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-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);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 5
-+#define ATP_THRESHOLD 3
-
- /* 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
deleted file mode 100644
index 4b085df..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/hid-add-new-apple-keyboard.patch
+++ /dev/null
@@ -1,152 +0,0 @@
-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
deleted file mode 100644
index f7b4cb9..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-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
deleted file mode 100644
index a559167..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r151/sigmatel_audio_fix_macbook_v2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-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/2.6.24-mactel-patches-r153/applesmc-int-protect.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-int-protect.patch
deleted file mode 100644
index 41ac501..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-int-protect.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-AppleSMC: use interrupts to protect a block device.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/Kconfig | 7 ++
- drivers/hwmon/Makefile | 4 +
- drivers/hwmon/applesmc.c | 155 +++++++++++++++++++++++++++++++++++++++++++---
- 3 files changed, 156 insertions(+), 10 deletions(-)
-
-
-diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
-index a0445be..1e857c0 100644
---- a/drivers/hwmon/Kconfig
-+++ b/drivers/hwmon/Kconfig
-@@ -754,6 +754,13 @@ config SENSORS_APPLESMC
- Say Y here if you have an applicable laptop and want to experience
- the awesome power of applesmc.
-
-+config SENSORS_APPLESMC_PROTECT
-+ bool "Apple SMC - Protect block devices on shock/free fall"
-+ depends on SENSORS_APPLESMC
-+ default n
-+ help
-+ Fill in......
-+
- config HWMON_DEBUG_CHIP
- bool "Hardware Monitoring Chip debugging messages"
- default n
-diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
-index 55595f6..4225f3d 100644
---- a/drivers/hwmon/Makefile
-+++ b/drivers/hwmon/Makefile
-@@ -73,3 +73,7 @@ ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
- EXTRA_CFLAGS += -DDEBUG
- endif
-
-+ifeq ($(CONFIG_SENSORS_APPLESMC_PROTECT),y)
-+EXTRA_CFLAGS += -DAPPLESMC_PROTECT
-+endif
-+
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 8f75b57..4186974 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -40,6 +40,12 @@
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
- #include <linux/interrupt.h>
-+#ifdef APPLESMC_PROTECT
-+#include <linux/fs.h>
-+#include <linux/blkdev.h>
-+#include <linux/namei.h>
-+#include <linux/mount.h>
-+#endif
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
-@@ -170,6 +176,11 @@ static unsigned int applesmc_light;
- /* Indicates which temperature sensors set to use. */
- static unsigned int applesmc_temperature_set;
-
-+#ifdef APPLESMC_PROTECT
-+/* Device to protect in case of shock or free fall. */
-+struct block_device *bdev_protect;
-+#endif
-+
- static DEFINE_MUTEX(applesmc_lock);
-
- /*
-@@ -450,6 +461,35 @@ static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
- return -EIO;
- }
-
-+#ifdef APPLESMC_PROTECT
-+static void protect_callback(struct work_struct *ignored) {
-+ char b[BDEVNAME_SIZE];
-+ /* This code comes from queue_protect_store (block/ll_rw_blk.c) */
-+ if (bdev_protect && bdev_protect->bd_disk &&
-+ bdev_protect->bd_disk->queue &&
-+ bdev_protect->bd_disk->queue->issue_protect_fn) {
-+ struct request_queue *q = bdev_protect->bd_disk->queue;
-+
-+ printk(KERN_INFO "applesmc: protecting the device (%s)\n",
-+ bdevname(bdev_protect, b));
-+
-+ /* Park and freeze */
-+ if (!blk_queue_stopped(q))
-+ q->issue_protect_fn(q);
-+
-+ /* freeze for 2 seconds (we will receive interrupt often
-+ * enough to reenable this if needed) */
-+ spin_lock_irq(q->queue_lock);
-+ blk_freeze_queue(q, 2);
-+ spin_unlock_irq(q->queue_lock);
-+
-+ printk(KERN_INFO "applesmc: device protected\n");
-+ }
-+}
-+
-+static DECLARE_WORK(protect_work, protect_callback);
-+#endif
-+
- irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
- {
- u8 int_type = inb(APPLESMC_INT_PORT);
-@@ -471,14 +511,24 @@ irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
- int_type);
- }
-
-+#ifdef APPLESMC_PROTECT
-+ if (bdev_protect && bdev_protect->bd_disk &&
-+ bdev_protect->bd_disk->queue &&
-+ bdev_protect->bd_disk->queue->issue_protect_fn) {
-+ schedule_work(&protect_work);
-+ }
-+#endif
-+
- return IRQ_HANDLED;
- }
-
- /*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
-+ * - resume is true if we are waking up from a resume, so we don't need
-+ * to setup interrupt handling again, and probe for a device to protect.
- */
--static int applesmc_device_init(void)
-+static int applesmc_device_init(int resume)
- {
- int total;
- int ret = -ENXIO;
-@@ -553,17 +603,21 @@ static int applesmc_device_init(void)
- goto out;
- }
-
-- ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler, IRQF_DISABLED,
-- "applesmc_irq_handler", NULL);
-+ if (!resume) {
-+ ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler,
-+ IRQF_DISABLED, "applesmc_irq_handler",
-+ NULL);
-
-- if (ret1) {
-- printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-- }
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup "
-+ "irq handler\n");
-+ }
-
-- printk(KERN_DEBUG "applesmc: accelerometer "
-+ printk(KERN_DEBUG "applesmc: accelerometer "
- "successfully initialized.\n");
-- ret = 0;
-+ }
-
-+ ret = 0;
- out:
- mutex_unlock(&applesmc_lock);
- return ret;
-@@ -594,7 +648,7 @@ static int applesmc_probe(struct platform_device *dev)
- {
- int ret;
-
-- ret = applesmc_device_init();
-+ ret = applesmc_device_init(0);
- if (ret)
- return ret;
-
-@@ -604,7 +658,7 @@ static int applesmc_probe(struct platform_device *dev)
-
- static int applesmc_resume(struct platform_device *dev)
- {
-- return applesmc_device_init();
-+ return applesmc_device_init(1);
- }
-
- static int applesmc_remove(struct platform_device *dev)
-@@ -901,6 +955,46 @@ static ssize_t applesmc_calibrate_store(struct device *dev,
- return count;
- }
-
-+#ifdef APPLESMC_PROTECT
-+static ssize_t applesmc_protect_device_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ char b[BDEVNAME_SIZE];
-+
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", bdevname(bdev_protect, b));
-+}
-+
-+static ssize_t applesmc_protect_device_store(struct device *dev,
-+ struct device_attribute *attr, const char *sysfsbuf, size_t count)
-+{
-+ char b[BDEVNAME_SIZE];
-+ struct block_device *bdev;
-+
-+ if (bdev_protect)
-+ bdput(bdev_protect);
-+
-+ bdev = lookup_bdev(sysfsbuf);
-+
-+ if (IS_ERR(bdev)) {
-+ bdev_protect = NULL;
-+ return -EIO; /* Could be more precise? */
-+ }
-+
-+ if (bdev->bd_disk && bdev->bd_disk->queue
-+ && bdev->bd_disk->queue->issue_protect_fn) {
-+ bdev_protect = bdev;
-+ printk(KERN_INFO "applesmc: accelerometer will now "
-+ "protect %s.\n", bdevname(bdev, b));
-+ return count;
-+ }
-+ else {
-+ bdput(bdev);
-+ bdev_protect = NULL;
-+ return -EIO; /* Could be more precise? */
-+ }
-+}
-+#endif
-+
- /* Store the next backlight value to be written by the work */
- static unsigned int backlight_value;
-
-@@ -1205,6 +1299,10 @@ 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);
-+#ifdef APPLESMC_PROTECT
-+static DEVICE_ATTR(protect_device, 0644,
-+ applesmc_protect_device_show, applesmc_protect_device_store);
-+#endif
- static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
- applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
- static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-@@ -1217,6 +1315,9 @@ static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+#ifdef APPLESMC_PROTECT
-+ &dev_attr_protect_device.attr,
-+#endif
- &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
- &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
- &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-@@ -1457,6 +1558,10 @@ static int applesmc_create_accelerometer(void)
- {
- struct input_dev *idev;
- int ret;
-+#ifdef APPLESMC_PROTECT
-+ char b[BDEVNAME_SIZE];
-+ int major, minor;
-+#endif
-
- ret = sysfs_create_group(&pdev->dev.kobj,
- &accelerometer_attributes_group);
-@@ -1490,6 +1595,30 @@ static int applesmc_create_accelerometer(void)
- if (ret)
- goto out_idev;
-
-+#ifdef APPLESMC_PROTECT
-+ /* Try to find a suitable block device to protect */
-+ bdev_protect = NULL;
-+ major = SCSI_DISK0_MAJOR;
-+
-+ /* Iterate over a maximum of 16 SCSI devices to find one that
-+ * can be protected.
-+ * Note: other devices could also be protected. */
-+ for (minor = 0; minor < 256; minor += 16) {
-+ dev_t dev = MKDEV(major, minor);
-+ struct block_device *bdev = bdget(dev);
-+ if (bdev->bd_disk && bdev->bd_disk->queue
-+ && bdev->bd_disk->queue->issue_protect_fn) {
-+ bdev_protect = bdev;
-+ printk(KERN_INFO "applesmc: accelerometer "
-+ "will protect %s (%d:%d).\n",
-+ bdevname(bdev, b),
-+ major, minor);
-+ break;
-+ }
-+ bdput(bdev);
-+ }
-+#endif
-+
- return 0;
-
- out_idev:
-@@ -1509,6 +1638,12 @@ static void applesmc_release_accelerometer(void)
- input_unregister_polled_device(applesmc_idev);
- input_free_polled_device(applesmc_idev);
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
-+#ifdef APPLESMC_PROTECT
-+ if (bdev_protect) {
-+ bdput(bdev_protect);
-+ bdev_protect = NULL;
-+ }
-+#endif
- }
-
- static __initdata struct dmi_match_data applesmc_dmi_data[] = {
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-macbook2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-macbook2.patch
deleted file mode 100644
index 0733cbe..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-macbook2.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-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/2.6.24-mactel-patches-r153/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-retry-when-accessing-keys.patch
deleted file mode 100644
index a5ee733..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc-retry-when-accessing-keys.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-Retry up to 200 ms when reading or writing keys.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 69 +++++++++++++++++++++++++++++++---------------
- 1 files changed, 47 insertions(+), 22 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index c0dd9b1..3b09cdb 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -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 */
-
-+#define ACCESS_TIMEOUT_MSECS 500 /* wait up to 500ms when accessing a key */
-+#define ACCESS_WAIT_MSECS 5 /* ... in 5ms increments */
-+
- #define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-@@ -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.
-+ * Tries up to ACCESS_WAIT_MSECS to read the value.
- * Returns zero on success or a negative error on failure. Callers must
- * hold applesmc_lock.
- */
- static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- {
-- int i;
-+ int i, total, ret;
-
- if (len > APPLESMC_MAX_DATA_LENGTH) {
- printk(KERN_ERR "applesmc_read_key: cannot read more than "
-@@ -199,33 +203,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- return -EINVAL;
- }
-
-- outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-- if (__wait_status(0x0c))
-- return -EIO;
-+ for (total = ACCESS_TIMEOUT_MSECS; total > 0;
-+ total -= ACCESS_WAIT_MSECS) {
-+ ret = 0;
-+ outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-+ if (__wait_status(0x0c)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-
-- for (i = 0; i < 4; i++) {
-- outb(key[i], APPLESMC_DATA_PORT);
-- if (__wait_status(0x04))
-- return -EIO;
-- }
-- if (debug)
-- printk(KERN_DEBUG "<%s", key);
-+ for (i = 0; i < 4; i++) {
-+ outb(key[i], APPLESMC_DATA_PORT);
-+ if (__wait_status(0x04)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ }
-+ if (debug)
-+ printk(KERN_DEBUG "<%s", key);
-
-- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-- printk(KERN_DEBUG ">%x", len);
-+ outb(len, APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG ">%x", len);
-
-- for (i = 0; i < len; i++) {
-- if (__wait_status(0x05))
-- return -EIO;
-- buffer[i] = inb(APPLESMC_DATA_PORT);
-+ for (i = 0; i < len; i++) {
-+ if (__wait_status(0x05)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ buffer[i] = inb(APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG "<%x", buffer[i]);
-+ }
- if (debug)
-- printk(KERN_DEBUG "<%x", buffer[i]);
-+ printk(KERN_DEBUG "\n");
-+
-+ break;
-+
-+wait_fail:
-+ msleep(ACCESS_WAIT_MSECS);
-+ continue;
- }
-- if (debug)
-- printk(KERN_DEBUG "\n");
-
-- return 0;
-+ if (total != ACCESS_TIMEOUT_MSECS) {
-+ printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-+ ACCESS_TIMEOUT_MSECS-total);
-+ }
-+
-+ return ret;
- }
-
- /*
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc_int.patch
deleted file mode 100644
index 87122db..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/applesmc_int.patch
+++ /dev/null
@@ -1,415 +0,0 @@
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- 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 3b09cdb..8f75b57 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -39,14 +39,20 @@
- #include <linux/leds.h>
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
-+#include <linux/interrupt.h>
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
- /* command/status port used by Apple SMC */
- #define APPLESMC_CMD_PORT 0x304
-+/* status port used by Apple SMC to get which interrupt type just happened */
-+#define APPLESMC_INT_PORT 0x31f
-
- #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */
-
-+/* Defined in ACPI DSDT table, should we read it from there? */
-+#define APPLESMC_IRQ 6
-+
- #define APPLESMC_MAX_DATA_LENGTH 32
-
- #define APPLESMC_STATUS_MASK 0x0f
-@@ -57,6 +63,8 @@
-
- #define KEY_COUNT_KEY "#KEY" /* r-o ui32 */
-
-+#define INTERRUPT_OK_KEY "NTOK" /* w-o ui8 */
-+
- #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) */
-@@ -68,6 +76,19 @@
- #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-
-+/*
-+ * Interrupt controls.
-+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
-+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than the
-+ * value of MOLD (or MOHD), SMC will trigger an interrupt.
-+ */
-+#define MOTION_LOW_NORM "MOLT" /* r/w sp78 (2 bytes) */
-+#define MOTION_HIGH_NORM "MOHT" /* r/w sp78 (2 bytes) */
-+#define MOTION_LOW_NORM_INTERVAL "MOLD" /* r/w ui8 */
-+#define MOTION_HIGH_NORM_INTERVAL "MOHD" /* r/w ui8 */
-+
-+#define MSDW_KEY "MSDW" /* r/w flag (1 byte) */
-+
- #define FANS_COUNT "FNum" /* r-o ui8 */
- #define FANS_MANUAL "FS! " /* r-w ui16 */
- #define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -385,12 +406,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * buffer, if not, writes these bytes.
-+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
-+ * waited more than INIT_TIMEOUT_MSECS in total.
-+ * Returns zero on success or a negative error on failure. Callers must
-+ * hold applesmc_lock.
-+ */
-+static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
-+{
-+ int total, ret, i, compare;
-+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
-+
-+ if (len > APPLESMC_MAX_DATA_LENGTH) {
-+ printk(KERN_ERR "applesmc_init_check_key_value: cannot "
-+ "read/write more than %d bytes",
-+ APPLESMC_MAX_DATA_LENGTH);
-+ return -EINVAL;
-+ }
-+
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret = applesmc_read_key(key, rdbuffer, len);
-+ if (!ret) {
-+ compare = 1;
-+ for (i = 0; i < len; i++) {
-+ if (rdbuffer[i] != buffer[i]) {
-+ compare = 0;
-+ break;
-+ }
-+ }
-+
-+ if (compare) {
-+ return 0;
-+ }
-+ }
-+ ret = applesmc_write_key(key, buffer, len);
-+ msleep(INIT_WAIT_MSECS);
-+ }
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return -EIO;
-+}
-+
-+irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
-+{
-+ u8 int_type = inb(APPLESMC_INT_PORT);
-+
-+ switch (int_type) {
-+ case 0x60:
-+ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
-+ break;
-+ case 0x6f:
-+ printk(KERN_INFO
-+ "applesmc: received a high acceleration interrupt\n");
-+ break;
-+ case 0x80:
-+ printk(KERN_INFO "applesmc: received a shock interrupt\n");
-+ break;
-+ default:
-+ printk(KERN_INFO
-+ "applesmc: received an unknown interrupt %x\n",
-+ int_type);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
- */
- static int applesmc_device_init(void)
- {
-- int total, ret = -ENXIO;
-+ int total;
-+ int ret = -ENXIO;
-+ int ret1, ret2;
- u8 buffer[2];
-
- if (!applesmc_accelerometer)
-@@ -398,32 +490,79 @@ static int applesmc_device_init(void)
-
- mutex_lock(&applesmc_lock);
-
-+ /* Accept interrupts */
-+ buffer[0] = 0x01;
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug)
-- printk(KERN_DEBUG "applesmc try %d\n", total);
-- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
-- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
-- if (total == INIT_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "applesmc: device has"
-- " already been initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- } else {
-- printk(KERN_DEBUG "applesmc: device"
-- " successfully initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- }
-- ret = 0;
-- goto out;
-- }
-- buffer[0] = 0xe0;
-- buffer[1] = 0x00;
-- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
-+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set NTOK key, "
-+ "will not receive interrupts.\n");
-+
-+ /* Setup interrupt controls. */
-+ buffer[0] = 20; /* 20 msecs */
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ buffer[0] = 20; /* 20 msecs */
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "interrupt interval, might not receive "
-+ "some interrupts.");
-+ }
-+
-+ buffer[0] = 0x00;
-+ buffer[1] = 0x60;
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM, buffer, 2);
-+
-+ buffer[0] = 0x01;
-+ buffer[1] = 0xc0;
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM, buffer, 2);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
-+ }
-+
-+ /* Mysterious key. */
-+ buffer[0] = 0x01;
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set MSDW key\n");
-+
-+ /* Initialize the device. */
-+ buffer[0] = 0xe0;
-+ buffer[1] = 0xf8;
-+ if (applesmc_init_check_key_value(MOTION_SENSOR_KEY, buffer, 2)) {
-+ 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);
-+
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-+ }
-+
-+ printk(KERN_DEBUG "applesmc: accelerometer "
-+ "successfully initialized.\n");
-+ ret = 0;
-
- out:
- mutex_unlock(&applesmc_lock);
-@@ -468,9 +607,16 @@ static int applesmc_resume(struct platform_device *dev)
- return applesmc_device_init();
- }
-
-+static int applesmc_remove(struct platform_device *dev)
-+{
-+ free_irq(APPLESMC_IRQ, NULL);
-+ return 0;
-+}
-+
- static struct platform_driver applesmc_driver = {
- .probe = applesmc_probe,
- .resume = applesmc_resume,
-+ .remove = applesmc_remove,
- .driver = {
- .name = "applesmc",
- .owner = THIS_MODULE,
-@@ -932,6 +1078,122 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
- return count;
- }
-
-+static ssize_t applesmc_accelerometer_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ int ret;
-+ unsigned int value = 0;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk(KERN_ERR
-+ "Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_read_key(key, buffer, length);
-+ if (length == 2)
-+ value = ((unsigned int)buffer[0] << 8) | buffer[1];
-+ else if (length == 1)
-+ value = buffer[0];
-+ else {
-+ printk("Invalid length for applesmc_param_show");
-+ ret = -EINVAL;
-+ }
-+
-+ mutex_unlock(&applesmc_lock);
-+ if (ret)
-+ return ret;
-+ else
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", value);
-+}
-+
-+static ssize_t applesmc_accelerometer_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *sysfsbuf, size_t count)
-+{
-+ int ret;
-+ u32 value;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ value = simple_strtoul(sysfsbuf, NULL, 10);
-+
-+ if (length == 2) {
-+ if (value > 0xffff)
-+ return -EINVAL;
-+
-+ buffer[0] = (value >> 8) & 0xff;
-+ buffer[1] = value & 0xff;
-+ } else if (length == 1) {
-+ if (value > 0xff)
-+ return -EINVAL;
-+
-+ buffer[0] = value & 0xff;
-+ } else {
-+ printk("Invalid length for applesmc_param_store");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_write_key(key, buffer, length);
-+
-+ mutex_unlock(&applesmc_lock);
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return count;
-+}
- static struct led_classdev applesmc_backlight = {
- .name = "smc:kbd_backlight",
- .default_trigger = "nand-disk",
-@@ -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);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 1);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 2);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 3);
-
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+ &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger_interval.dev_attr.attr,
- NULL
- };
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/appletouch-new.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/appletouch-new.patch
deleted file mode 100644
index f995c7a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/appletouch-new.patch
+++ /dev/null
@@ -1,377 +0,0 @@
-
-
-From: Sven Anders <anders@anduras.de>
-
-
----
-
- drivers/input/mouse/appletouch.c | 165 +++++++++++++++++++++++++++++---------
- 1 files changed, 125 insertions(+), 40 deletions(-)
-
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index b4423a4..b42c1ed 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 0x022B
-
- #define ATP_DEVICE(prod) \
- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
-@@ -73,15 +81,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) },
-@@ -93,6 +103,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 */
- { }
- };
-@@ -136,12 +151,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 ? */
-@@ -156,8 +180,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) \
-@@ -174,8 +198,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");
-
- /*
-@@ -185,7 +213,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");
-
-@@ -203,12 +231,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);
-
-@@ -217,7 +245,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);
- }
-
- /*
-@@ -229,7 +260,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,
-@@ -237,6 +268,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;
-@@ -252,6 +290,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;
-@@ -269,8 +314,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);
-@@ -385,7 +429,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));
-
- /*
-@@ -442,13 +486,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 */
-@@ -474,26 +525,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;
-@@ -538,16 +610,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:
-@@ -615,7 +699,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;
-@@ -658,7 +742,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
- */
-@@ -701,6 +785,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/2.6.24-mactel-patches-r153/appletouch.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/appletouch.patch
deleted file mode 100644
index 036655a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/appletouch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Appletouch driver ATP_THRESHOLD fix.
-
-From: Ortwin Glück <odi@odi.ch>
-
-
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index b42c1ed..805cc5e 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -142,7 +142,7 @@ MODULE_DEVICE_TABLE (usb, atp_table);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 5
-+#define ATP_THRESHOLD 3
-
- /* 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-r153/disk-protect-fix-2.6.24-crash.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect-fix-2.6.24-crash.patch
deleted file mode 100644
index 0c6c494..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect-fix-2.6.24-crash.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-Elias Oltmanns linux-thinkpad@linux-thinkpad.org
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Wed, 13 Feb 2008 12:39:17 +0100
-
-Anyway, there is a temporary solution to this problem. If you apply the
-little patch attached to this email, the usual disk-protect patch will
-work on 2.6.24. This change is supposed to fix a generic problem in
-libata and may eventually be merged upstream, but Tejun Heo (libata
-developer) said that some testing was required first.
-
-This change is absolutely safe for everyone using a non-NCQ capable
-system. In particular, ata_piix doesn't support NCQ. If you are using
-ahci and /sys/class/scsi_disk/.../device/queue_depth reports a value
-greater than 1, i.e. NCQ is enabled, then the patch shouldn't cause any
-harm either but it may or may not affect I/O performance.
-
-Enjoy,
-
-Elias
----
-
- drivers/ata/libata-scsi.c | 4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-
-diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
-index 6b02998..82ec82a 100644
---- a/drivers/ata/libata-scsi.c
-+++ b/drivers/ata/libata-scsi.c
-@@ -823,7 +823,7 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev)
- * prevent SCSI midlayer from automatically deferring
- * requests.
- */
-- sdev->max_device_blocked = 1;
-+ sdev->max_device_blocked = 2;
- }
-
- static void ata_scsi_dev_config(struct scsi_device *sdev,
-@@ -3156,7 +3156,7 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
- * Set host_blocked to 1 to prevent SCSI midlayer from
- * automatically deferring requests.
- */
-- shost->max_host_blocked = 1;
-+ shost->max_host_blocked = 2;
-
- rc = scsi_add_host(ap->scsi_host, ap->host->dev);
- if (rc)
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect-update.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect-update.patch
deleted file mode 100644
index af6afd4..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect-update.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Disk protect patch update.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- block/ll_rw_blk.c | 1 +
- include/linux/blkdev.h | 2 ++
- 2 files changed, 3 insertions(+), 0 deletions(-)
-
-
-diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
-index 31f0c22..9d7864a 100644
---- a/block/ll_rw_blk.c
-+++ b/block/ll_rw_blk.c
-@@ -4308,6 +4308,7 @@ static ssize_t queue_protect_show(struct request_queue *q, char *page)
- spin_unlock_irq(q->queue_lock);
- return queue_var_show(seconds, (page));
- }
-+EXPORT_SYMBOL(blk_freeze_queue);
-
- /*
- * When writing the 'protect' attribute, input is the number of seconds
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index e10f40b..3e53289 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -114,6 +114,8 @@ struct io_context *get_io_context(gfp_t gfp_flags, int node);
- void copy_io_context(struct io_context **pdst, struct io_context **psrc);
- void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
-
-+void blk_freeze_queue(struct request_queue *q, int seconds);
-+
- struct request;
- typedef void (rq_end_io_fn)(struct request *, int);
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect.patch
deleted file mode 100644
index c7c9ae7..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/disk-protect.patch
+++ /dev/null
@@ -1,826 +0,0 @@
-From: Elias Oltmanns <eo@...>
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Subject: disk-protect patch for kernel 2.6.24-rc3
-Newsgroups: gmane.linux.drivers.hdaps.devel
-Date: 2007-11-18 16:19:24 GMT (16 weeks, 20 hours and 52 minutes ago)
-
-For those who can't wait. Mind you, it's compile tested only. But then
-you all know about rc versions and the usual disclaimers with regard to
-your precious data.
----
-
- block/ll_rw_blk.c | 236 ++++++++++++++++++++++++++++++++++++++++++++-
- drivers/ata/libata-scsi.c | 36 +++++++
- drivers/ide/ide-disk.c | 142 +++++++++++++++++++++++++++
- drivers/ide/ide-io.c | 14 +++
- drivers/scsi/scsi_lib.c | 169 ++++++++++++++++++++++++++++++++
- include/linux/ata.h | 12 ++
- include/linux/blkdev.h | 14 +++
- include/linux/ide.h | 1
- 8 files changed, 621 insertions(+), 3 deletions(-)
-
-
-diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
-index 8b91994..31f0c22 100644
---- a/block/ll_rw_blk.c
-+++ b/block/ll_rw_blk.c
-@@ -39,6 +39,10 @@
-
- static void blk_unplug_work(struct work_struct *work);
- static void blk_unplug_timeout(unsigned long data);
-+static void blk_unfreeze_work(struct work_struct *work);
-+static void blk_unfreeze_timeout(unsigned long data);
-+static int blk_protect_register(struct request_queue *q);
-+static void blk_protect_unregister(struct request_queue *q);
- static void drive_stat_acct(struct request *rq, int new_io);
- static void init_request_from_bio(struct request *req, struct bio *bio);
- static int __make_request(struct request_queue *q, struct bio *bio);
-@@ -231,6 +235,16 @@ void blk_queue_make_request(struct request_queue * q, make_request_fn * mfn)
- q->unplug_timer.function = blk_unplug_timeout;
- q->unplug_timer.data = (unsigned long)q;
-
-+ q->max_unfreeze = 30;
-+
-+ INIT_WORK(&q->unfreeze_work, blk_unfreeze_work);
-+
-+ q->unfreeze_timer.function = blk_unfreeze_timeout;
-+ q->unfreeze_timer.data = (unsigned long)q;
-+
-+ /* Set protect_method to auto detection initially */
-+ q->protect_method = 2;
-+
- /*
- * by default assume old behaviour and bounce for any highmem page
- */
-@@ -263,6 +277,18 @@ static void rq_init(struct request_queue *q, struct request *rq)
- rq->next_rq = NULL;
- }
-
-+void blk_queue_issue_protect_fn(struct request_queue *q, issue_protect_fn *ipf)
-+{
-+ q->issue_protect_fn = ipf;
-+}
-+EXPORT_SYMBOL(blk_queue_issue_protect_fn);
-+
-+void blk_queue_issue_unprotect_fn(struct request_queue *q, issue_unprotect_fn *iuf)
-+{
-+ q->issue_unprotect_fn = iuf;
-+}
-+EXPORT_SYMBOL(blk_queue_issue_unprotect_fn);
-+
- /**
- * blk_queue_ordered - does this queue support ordered writes
- * @q: the request queue
-@@ -1861,6 +1887,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
- }
-
- init_timer(&q->unplug_timer);
-+ init_timer(&q->unfreeze_timer);
-
- kobject_set_name(&q->kobj, "%s", "queue");
- q->kobj.ktype = &queue_ktype;
-@@ -4191,13 +4218,21 @@ int blk_register_queue(struct gendisk *disk)
- kobject_uevent(&q->kobj, KOBJ_ADD);
-
- ret = elv_register_queue(q);
-+ if (ret)
-+ goto err;
-+
-+ ret = blk_protect_register(q);
- if (ret) {
-- kobject_uevent(&q->kobj, KOBJ_REMOVE);
-- kobject_del(&q->kobj);
-- return ret;
-+ elv_unregister_queue(q);
-+ goto err;
- }
-
- return 0;
-+
-+err:
-+ kobject_uevent(&q->kobj, KOBJ_REMOVE);
-+ kobject_del(&q->kobj);
-+ return ret;
- }
-
- void blk_unregister_queue(struct gendisk *disk)
-@@ -4205,6 +4240,7 @@ void blk_unregister_queue(struct gendisk *disk)
- struct request_queue *q = disk->queue;
-
- if (q && q->request_fn) {
-+ blk_protect_unregister(q);
- elv_unregister_queue(q);
-
- kobject_uevent(&q->kobj, KOBJ_REMOVE);
-@@ -4212,3 +4248,197 @@ void blk_unregister_queue(struct gendisk *disk)
- kobject_put(&disk->kobj);
- }
- }
-+
-+/*
-+ * Issue lower level unprotect function if no timers are pending.
-+ */
-+static void blk_unfreeze_work(struct work_struct *work)
-+{
-+ struct request_queue *q = container_of(work, struct request_queue, unfreeze_work);
-+ int pending;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ pending = timer_pending(&q->unfreeze_timer);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ if (!pending)
-+ q->issue_unprotect_fn(q);
-+}
-+
-+/*
-+ * Called when the queue freeze timeout expires...
-+ */
-+static void blk_unfreeze_timeout(unsigned long data)
-+{
-+ struct request_queue *q = (struct request_queue *) data;
-+
-+ kblockd_schedule_work(&q->unfreeze_work);
-+}
-+
-+/*
-+ * The lower level driver parks and freezes the queue, and this block layer
-+ * function sets up the freeze timeout timer on return. If the queue is
-+ * already frozen then this is called to extend the timer...
-+ */
-+void blk_freeze_queue(struct request_queue *q, int seconds)
-+{
-+ /* Don't accept arbitrarily long freezes */
-+ if (seconds >= q->max_unfreeze)
-+ seconds = q->max_unfreeze;
-+ /* set/reset the timer */
-+ mod_timer(&q->unfreeze_timer, msecs_to_jiffies(seconds*1000) + jiffies);
-+}
-+
-+/*
-+ * When reading the 'protect' attribute, we return seconds remaining
-+ * before unfreeze timeout expires
-+ */
-+static ssize_t queue_protect_show(struct request_queue *q, char *page)
-+{
-+ unsigned int seconds = 0;
-+
-+ spin_lock_irq(q->queue_lock);
-+ if (blk_queue_stopped(q) && timer_pending(&q->unfreeze_timer))
-+ /*
-+ * Adding 1 in order to guarantee nonzero value until timer
-+ * has actually expired.
-+ */
-+ seconds = jiffies_to_msecs(q->unfreeze_timer.expires
-+ - jiffies) / 1000 + 1;
-+ spin_unlock_irq(q->queue_lock);
-+ return queue_var_show(seconds, (page));
-+}
-+
-+/*
-+ * When writing the 'protect' attribute, input is the number of seconds
-+ * to freeze the queue for. We call a lower level helper function to
-+ * park the heads and freeze/block the queue, then we make a block layer
-+ * call to setup the thaw timeout. If input is 0, then we thaw the queue.
-+ */
-+static ssize_t queue_protect_store(struct request_queue *q,
-+ const char *page, size_t count)
-+{
-+ unsigned long freeze = 0;
-+
-+ queue_var_store(&freeze, page, count);
-+
-+ if (freeze>0) {
-+ /* Park and freeze */
-+ if (!blk_queue_stopped(q))
-+ q->issue_protect_fn(q);
-+ /* set / reset the thaw timer */
-+ spin_lock_irq(q->queue_lock);
-+ blk_freeze_queue(q, freeze);
-+ spin_unlock_irq(q->queue_lock);
-+ } else {
-+ spin_lock_irq(q->queue_lock);
-+ freeze = del_timer(&q->unfreeze_timer);
-+ spin_unlock_irq(q->queue_lock);
-+ if (freeze)
-+ q->issue_unprotect_fn(q);
-+ }
-+
-+ return count;
-+}
-+
-+static ssize_t
-+queue_str_show(char *page, char *str, int status)
-+{
-+ ssize_t len;
-+
-+ if (status & 1)
-+ len = sprintf(page, "[%s]", str);
-+ else
-+ len = sprintf(page, "%s", str);
-+ if (status & 2)
-+ len += sprintf(page+len, "\n");
-+ else
-+ len += sprintf(page+len, " ");
-+ return len;
-+}
-+
-+/*
-+ * Returns current protect_method.
-+ */
-+static ssize_t queue_protect_method_show(struct request_queue *q, char *page)
-+{
-+ int len = 0;
-+ int unload = q->protect_method;
-+
-+ len += queue_str_show(page+len, "auto", (unload & 2) >> 1);
-+ len += queue_str_show(page+len, "unload", unload & 1);
-+ len += queue_str_show(page+len, "standby", !unload ? 3 : 2);
-+ return len;
-+}
-+
-+/*
-+ * Stores the device protect method.
-+ */
-+static ssize_t queue_protect_method_store(struct request_queue *q,
-+ const char *page, size_t count)
-+{
-+ spin_lock_irq(q->queue_lock);
-+ if (!strcmp(page, "auto") || !strcmp(page, "auto\n"))
-+ q->protect_method = 2;
-+ else if (!strcmp(page, "unload") || !strcmp(page, "unload\n"))
-+ q->protect_method = 1;
-+ else if (!strcmp(page, "standby") || !strcmp(page, "standby\n"))
-+ q->protect_method = 0;
-+ else {
-+ spin_unlock_irq(q->queue_lock);
-+ return -EINVAL;
-+ }
-+ spin_unlock_irq(q->queue_lock);
-+ return count;
-+}
-+
-+static struct queue_sysfs_entry queue_protect_entry = {
-+ .attr = { .name = "protect", .mode = S_IRUGO | S_IWUSR },
-+ .show = queue_protect_show,
-+ .store = queue_protect_store,
-+};
-+static struct queue_sysfs_entry queue_protect_method_entry = {
-+ .attr = { .name = "protect_method", .mode = S_IRUGO | S_IWUSR },
-+ .show = queue_protect_method_show,
-+ .store = queue_protect_method_store,
-+};
-+
-+static int blk_protect_register(struct request_queue *q)
-+{
-+ int error = 0;
-+
-+ /* check that the lower level driver has a protect handler */
-+ if (!q->issue_protect_fn)
-+ return 0;
-+
-+ /* create the attributes */
-+ error = sysfs_create_file(&q->kobj, &queue_protect_entry.attr);
-+ if (error) {
-+ printk(KERN_ERR
-+ "blk_protect_register(): failed to create protect queue attribute!\n");
-+ return error;
-+ }
-+
-+ error = sysfs_create_file(&q->kobj, &queue_protect_method_entry.attr);
-+ if (error) {
-+ sysfs_remove_file(&q->kobj, &queue_protect_entry.attr);
-+ printk(KERN_ERR
-+ "blk_protect_register(): failed to create protect_method attribute!\n");
-+ return error;
-+ }
-+ kobject_get(&q->kobj);
-+
-+ return 0;
-+}
-+
-+static void blk_protect_unregister(struct request_queue *q)
-+{
-+ /* check that the lower level driver has a protect handler */
-+ if (!q->issue_protect_fn)
-+ return;
-+
-+ /* remove the attributes */
-+ sysfs_remove_file(&q->kobj, &queue_protect_method_entry.attr);
-+ sysfs_remove_file(&q->kobj, &queue_protect_entry.attr);
-+ kobject_put(&q->kobj);
-+}
-diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
-index 14daf48..6b02998 100644
---- a/drivers/ata/libata-scsi.c
-+++ b/drivers/ata/libata-scsi.c
-@@ -856,6 +856,38 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
- }
- }
-
-+extern int scsi_protect_queue(struct request_queue *q, int unload);
-+extern int scsi_unprotect_queue(struct request_queue *q);
-+
-+static int ata_scsi_issue_protect_fn(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+ struct ata_port *ap = ata_shost_to_port(sdev->host);
-+ struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
-+ int unload = q->protect_method;
-+ unsigned long flags;
-+
-+ if (!dev) {
-+ printk(KERN_DEBUG "ata_scsi_issue_protect_fn(): Couldn't find ATA device to be parked.\n");
-+ return -ENXIO;
-+ }
-+
-+ if (unload == 2) {
-+ unload = ata_id_has_unload(dev->id) ? 1 : 0;
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ q->protect_method = unload;
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ }
-+
-+ /* call scsi_protect_queue, requesting either unload or standby */
-+ return scsi_protect_queue(q, unload);
-+}
-+
-+static int ata_scsi_issue_unprotect_fn(struct request_queue *q)
-+{
-+ return scsi_unprotect_queue(q);
-+}
-+
- /**
- * ata_scsi_slave_config - Set SCSI device attributes
- * @sdev: SCSI device to examine
-@@ -877,6 +909,10 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
-
- if (dev)
- ata_scsi_dev_config(sdev, dev);
-+ blk_queue_issue_protect_fn(sdev->request_queue,
-+ ata_scsi_issue_protect_fn);
-+ blk_queue_issue_unprotect_fn(sdev->request_queue,
-+ ata_scsi_issue_unprotect_fn);
-
- return 0; /* scsi layer doesn't check return value, sigh */
- }
-diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
-index b178190..1ef536f 100644
---- a/drivers/ide/ide-disk.c
-+++ b/drivers/ide/ide-disk.c
-@@ -675,6 +675,145 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
- }
-
- /*
-+ * todo:
-+ * - we freeze the queue regardless of success and rely on the
-+ * ide_protect_queue function to thaw immediately if the command
-+ * failed (to be consistent with the libata handler)... should
-+ * we also inspect here?
-+ */
-+void ide_end_protect_rq(struct request *rq, int error)
-+{
-+ struct completion *waiting = rq->end_io_data;
-+
-+ rq->end_io_data = NULL;
-+ /* spin lock already accquired */
-+ if (!blk_queue_stopped(rq->q))
-+ blk_stop_queue(rq->q);
-+
-+ complete(waiting);
-+}
-+
-+int ide_unprotect_queue(struct request_queue *q)
-+{
-+ struct request rq;
-+ unsigned long flags;
-+ int pending = 0, rc = 0;
-+ ide_drive_t *drive = q->queuedata;
-+ u8 args[7], *argbuf = args;
-+
-+ if (!blk_queue_stopped(q))
-+ return -EIO;
-+
-+ /* Are there any pending jobs on the queue? */
-+ pending = ((q->rq.count[READ] > 0) || (q->rq.count[WRITE] > 0)) ? 1 : 0;
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ blk_start_queue(q);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+
-+ /* The unload feature of the IDLE_IMMEDIATE command
-+ temporarily disables HD power management from spinning down
-+ the disk. Any other command will reenable HD pm, so, if
-+ there are no pending jobs on the queue, another
-+ CHECK_POWER_MODE1 command without the unload feature should do
-+ just fine. */
-+ if (!pending) {
-+ printk(KERN_DEBUG "ide_unprotect_queue(): No pending I/O, re-enabling power management..\n");
-+ memset(args, 0, sizeof(args));
-+ argbuf[0] = 0xe5; /* CHECK_POWER_MODE1 */
-+ ide_init_drive_cmd(&rq);
-+ rq.cmd_type = REQ_TYPE_ATA_TASK;
-+ rq.buffer = argbuf;
-+ rc = ide_do_drive_cmd(drive, &rq, ide_head_wait);
-+ }
-+
-+ return rc;
-+}
-+
-+int ide_protect_queue(struct request_queue *q, int unload)
-+{
-+ ide_drive_t *drive = q->queuedata;
-+ struct request rq;
-+ u8 args[7], *argbuf = args;
-+ int ret = 0;
-+ DECLARE_COMPLETION(wait);
-+
-+ memset(&rq, 0, sizeof(rq));
-+ memset(args, 0, sizeof(args));
-+
-+ if (blk_queue_stopped(q))
-+ return -EIO;
-+
-+ if (unload) {
-+ argbuf[0] = 0xe1;
-+ argbuf[1] = 0x44;
-+ argbuf[3] = 0x4c;
-+ argbuf[4] = 0x4e;
-+ argbuf[5] = 0x55;
-+ } else
-+ argbuf[0] = 0xe0;
-+
-+ /* Issue the park command & freeze */
-+ ide_init_drive_cmd(&rq);
-+
-+ rq.cmd_type = REQ_TYPE_ATA_TASK;
-+ rq.buffer = argbuf;
-+ rq.end_io_data = &wait;
-+ rq.end_io = ide_end_protect_rq;
-+
-+ ret = ide_do_drive_cmd(drive, &rq, ide_next);
-+ wait_for_completion(&wait);
-+
-+ if (ret)
-+ {
-+ printk(KERN_DEBUG "ide_protect_queue(): Warning: head NOT parked!..\n");
-+ ide_unprotect_queue(q);
-+ return ret;
-+ }
-+
-+ if (unload) {
-+ if (args[3] == 0xc4)
-+ printk(KERN_DEBUG "ide_protect_queue(): head parked..\n");
-+ else {
-+ /* error parking the head */
-+ printk(KERN_DEBUG "ide_protect_queue(): head NOT parked!..\n");
-+ ret = -EIO;
-+ ide_unprotect_queue(q);
-+ }
-+ } else
-+ printk(KERN_DEBUG "ide_protect_queue(): head park not requested, used standby!..\n");
-+
-+ return ret;
-+}
-+
-+int idedisk_issue_protect_fn(struct request_queue *q)
-+{
-+ ide_drive_t *drive = q->queuedata;
-+ int unload = q->protect_method;
-+ unsigned long flags;
-+
-+ /*
-+ * Check capability of the device -
-+ * - if "idle immediate with unload" is supported we use that, else
-+ * we use "standby immediate" and live with spinning down the drive..
-+ * (Word 84, bit 13 of IDENTIFY DEVICE data)
-+ */
-+ if (unload == 2) {
-+ unload = drive->id->cfsse & (1 << 13) ? 1 : 0;
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ q->protect_method = unload;
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ }
-+
-+ return ide_protect_queue(q, unload);
-+}
-+
-+int idedisk_issue_unprotect_fn(struct request_queue *q)
-+{
-+ return ide_unprotect_queue(q);
-+}
-+
-+/*
- * This is tightly woven into the driver->do_special can not touch.
- * DON'T do it again until a total personality rewrite is committed.
- */
-@@ -943,6 +1082,9 @@ static void idedisk_setup (ide_drive_t *drive)
- drive->wcache = 1;
-
- write_cache(drive, 1);
-+
-+ blk_queue_issue_protect_fn(drive->queue, idedisk_issue_protect_fn);
-+ blk_queue_issue_unprotect_fn(drive->queue, idedisk_issue_unprotect_fn);
- }
-
- static void ide_cacheflush_p(ide_drive_t *drive)
-diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
-index bef781f..873764e 100644
---- a/drivers/ide/ide-io.c
-+++ b/drivers/ide/ide-io.c
-@@ -1271,6 +1271,17 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
- }
-
- /*
-+ * Don't accept a request when the queue is stopped (unless we
-+ * are resuming from suspend). Prevents existing queue entries
-+ * being processed after queue is stopped by the hard disk
-+ * protection mechanism...
-+ */
-+ if (test_bit(QUEUE_FLAG_STOPPED, &drive->queue->queue_flags) && !blk_pm_resume_request(rq)) {
-+ hwgroup->busy = 0;
-+ break;
-+ }
-+
-+ /*
- * Sanity: don't accept a request that isn't a PM request
- * if we are currently power managed. This is very important as
- * blk_stop_queue() doesn't prevent the elv_next_request()
-@@ -1768,6 +1779,9 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
- where = ELEVATOR_INSERT_FRONT;
- rq->cmd_flags |= REQ_PREEMPT;
- }
-+ if (action == ide_next)
-+ where = ELEVATOR_INSERT_FRONT;
-+
- __elv_add_request(drive->queue, rq, where, 0);
- ide_do_request(hwgroup, IDE_NO_IRQ);
- spin_unlock_irqrestore(&ide_lock, flags);
-diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
-index a9ac5b1..58049e7 100644
---- a/drivers/scsi/scsi_lib.c
-+++ b/drivers/scsi/scsi_lib.c
-@@ -2268,7 +2268,13 @@ EXPORT_SYMBOL_GPL(sdev_evt_send_simple);
- int
- scsi_device_quiesce(struct scsi_device *sdev)
- {
-+ int i;
- int err = scsi_device_set_state(sdev, SDEV_QUIESCE);
-+ for (i = 0; err && (sdev->sdev_state == SDEV_BLOCK) && (i < 100);
-+ i++) {
-+ msleep_interruptible(200);
-+ err = scsi_device_set_state(sdev, SDEV_QUIESCE);
-+ }
- if (err)
- return err;
-
-@@ -2518,3 +2524,166 @@ void scsi_kunmap_atomic_sg(void *virt)
- kunmap_atomic(virt, KM_BIO_SRC_IRQ);
- }
- EXPORT_SYMBOL(scsi_kunmap_atomic_sg);
-+
-+/*
-+ * Structure required for synchronous io completion after queue freezing
-+ */
-+struct scsi_protect_io_context_sync {
-+ struct scsi_device *sdev;
-+ int result;
-+ char *sense;
-+ struct completion *waiting;
-+};
-+
-+/*
-+ * scsi_protect_wait_done()
-+ * Command completion handler for scsi_protect_queue().
-+ *
-+ * Unable to call scsi_internal_device_block() as
-+ * scsi_end_request() already has the spinlock. So,
-+ * we put the necessary functionality inline.
-+ *
-+ * todo:
-+ * - we block the queue regardless of success and rely on the
-+ * scsi_protect_queue function to unblock if the command
-+ * failed... should we also inspect here?
-+ */
-+static void scsi_protect_wait_done(void *data, char *sense, int result, int resid)
-+{
-+ struct scsi_protect_io_context_sync *siocs = data;
-+ struct completion *waiting = siocs->waiting;
-+ struct request_queue *q = siocs->sdev->request_queue;
-+
-+ siocs->waiting = NULL;
-+ siocs->result = result;
-+ memcpy(siocs->sense, sense, SCSI_SENSE_BUFFERSIZE);
-+
-+ if (!scsi_device_set_state(siocs->sdev, SDEV_BLOCK))
-+ blk_stop_queue(q);
-+
-+ complete(waiting);
-+}
-+
-+/*
-+ * scsi_unprotect_queue()
-+ * - release the queue that was previously blocked
-+ */
-+int scsi_unprotect_queue(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+ int rc = 0, pending = 0;
-+ u8 scsi_cmd[MAX_COMMAND_SIZE];
-+ struct scsi_sense_hdr sshdr;
-+
-+ if (sdev->sdev_state != SDEV_BLOCK)
-+ return -ENXIO;
-+
-+ /* Are there any pending jobs on the queue? */
-+ pending = ((q->rq.count[READ] > 0) || (q->rq.count[WRITE] > 0)) ? 1 : 0;
-+
-+ rc = scsi_internal_device_unblock(sdev);
-+ if (rc)
-+ return rc;
-+
-+ if (!pending) {
-+ printk(KERN_DEBUG "scsi_unprotect_queue(): No pending I/O, re-enabling power management..\n");
-+
-+ memset(scsi_cmd, 0, sizeof(scsi_cmd));
-+ scsi_cmd[0] = ATA_16;
-+ scsi_cmd[1] = (3 << 1); /* Non-data */
-+ /* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
-+ scsi_cmd[14] = 0xe5; /* CHECK_POWER_MODE1 */
-+
-+ /* Good values for timeout and retries? Values below
-+ from scsi_ioctl_send_command() for default case... */
-+ if (scsi_execute_req(sdev, scsi_cmd, DMA_NONE, NULL, 0, &sshdr,
-+ (10*HZ), 5))
-+ rc = -EIO;
-+ }
-+ return rc;
-+}
-+EXPORT_SYMBOL_GPL(scsi_unprotect_queue);
-+
-+/*
-+ * scsi_protect_queue()
-+ * - build and issue the park/standby command..
-+ * - queue is blocked during command completion handler
-+ */
-+int scsi_protect_queue(struct request_queue *q, int unload)
-+{
-+ struct scsi_protect_io_context_sync siocs;
-+ struct scsi_device *sdev = q->queuedata;
-+ int rc = 0;
-+ u8 args[7];
-+ u8 scsi_cmd[MAX_COMMAND_SIZE];
-+ unsigned char sense[SCSI_SENSE_BUFFERSIZE];
-+ unsigned char *desc;
-+ DECLARE_COMPLETION_ONSTACK(wait);
-+
-+ if (sdev->sdev_state != SDEV_RUNNING)
-+ return -ENXIO;
-+
-+ memset(args, 0, sizeof(args));
-+ memset(sense, 0, sizeof(sense));
-+
-+ if (unload) {
-+ args[0] = 0xe1;
-+ args[1] = 0x44;
-+ args[3] = 0x4c;
-+ args[4] = 0x4e;
-+ args[5] = 0x55;
-+ } else
-+ args[0] = 0xe0;
-+
-+ memset(scsi_cmd, 0, sizeof(scsi_cmd));
-+ scsi_cmd[0] = ATA_16;
-+ scsi_cmd[1] = (3 << 1); /* Non-data */
-+ scsi_cmd[2] = 0x20; /* no off.line, or data xfer, request cc */
-+ scsi_cmd[4] = args[1];
-+ scsi_cmd[6] = args[2];
-+ scsi_cmd[8] = args[3];
-+ scsi_cmd[10] = args[4];
-+ scsi_cmd[12] = args[5];
-+ scsi_cmd[14] = args[0];
-+ siocs.sdev = sdev;
-+ siocs.sense = sense;
-+ siocs.waiting = &wait;
-+
-+ scsi_execute_async(sdev, scsi_cmd, COMMAND_SIZE(scsi_cmd[0]),
-+ DMA_NONE, NULL, 0, 0, (10*HZ), 5,
-+ &siocs, &scsi_protect_wait_done, GFP_NOWAIT);
-+ wait_for_completion(&wait);
-+
-+ if (siocs.result != ((DRIVER_SENSE << 24) + SAM_STAT_CHECK_CONDITION)) {
-+ printk(KERN_DEBUG "scsi_protect_queue(): head NOT parked!..\n");
-+ scsi_unprotect_queue(q); /* just in case we still managed to block */
-+ rc = -EIO;
-+ goto out;
-+ }
-+
-+ desc = sense + 8;
-+
-+ /* Retrieve data from check condition */
-+ args[1] = desc[3];
-+ args[2] = desc[5];
-+ args[3] = desc[7];
-+ args[4] = desc[9];
-+ args[5] = desc[11];
-+ args[0] = desc[13];
-+
-+ if (unload) {
-+ if (args[3] == 0xc4)
-+ printk(KERN_DEBUG "scsi_protect_queue(): head parked..\n");
-+ else {
-+ /* error parking the head */
-+ printk(KERN_DEBUG "scsi_protect_queue(): head NOT parked!..\n");
-+ rc = -EIO;
-+ scsi_unprotect_queue(q);
-+ }
-+ } else
-+ printk(KERN_DEBUG "scsi_protect_queue(): head park not requested, used standby!..\n");
-+
-+out:
-+ return rc;
-+}
-+EXPORT_SYMBOL_GPL(scsi_protect_queue);
-diff --git a/include/linux/ata.h b/include/linux/ata.h
-index e672e80..aa16cbb 100644
---- a/include/linux/ata.h
-+++ b/include/linux/ata.h
-@@ -395,6 +395,18 @@ struct ata_taskfile {
-
- #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
-
-+static inline int ata_id_has_unload(const u16 *id)
-+{
-+ /* ATA-7 specifies two places to indicate unload feature support.
-+ * Since I don't really understand the difference, I'll just check
-+ * both and only return zero if none of them indicates otherwise. */
-+ if ((id[84] & 0xC000) == 0x4000 && id[84] & (1 << 13))
-+ return id[84] & (1 << 13);
-+ if ((id[87] & 0xC000) == 0x4000)
-+ return id[87] & (1 << 13);
-+ return 0;
-+}
-+
- static inline bool ata_id_has_hipm(const u16 *id)
- {
- u16 val = id[76];
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index d18ee67..e10f40b 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -332,6 +332,8 @@ struct bio_vec;
- typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *);
- typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
- typedef void (softirq_done_fn)(struct request *);
-+typedef int (issue_protect_fn) (struct request_queue *);
-+typedef int (issue_unprotect_fn) (struct request_queue *);
-
- enum blk_queue_state {
- Queue_down,
-@@ -368,6 +370,8 @@ struct request_queue
- merge_bvec_fn *merge_bvec_fn;
- prepare_flush_fn *prepare_flush_fn;
- softirq_done_fn *softirq_done_fn;
-+ issue_protect_fn *issue_protect_fn;
-+ issue_unprotect_fn *issue_unprotect_fn;
-
- /*
- * Dispatch queue sorting
-@@ -383,6 +387,14 @@ struct request_queue
- unsigned long unplug_delay; /* After this many jiffies */
- struct work_struct unplug_work;
-
-+ /*
-+ * Auto-unfreeze state
-+ */
-+ struct timer_list unfreeze_timer;
-+ int max_unfreeze; /* At most this many seconds */
-+ struct work_struct unfreeze_work;
-+ int protect_method;
-+
- struct backing_dev_info backing_dev_info;
-
- /*
-@@ -773,6 +785,8 @@ extern int blk_do_ordered(struct request_queue *, struct request **);
- extern unsigned blk_ordered_cur_seq(struct request_queue *);
- extern unsigned blk_ordered_req_seq(struct request *);
- extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int);
-+extern void blk_queue_issue_protect_fn(struct request_queue *, issue_protect_fn *);
-+extern void blk_queue_issue_unprotect_fn(struct request_queue *, issue_unprotect_fn *);
-
- extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
- extern void blk_dump_rq_flags(struct request *, char *);
-diff --git a/include/linux/ide.h b/include/linux/ide.h
-index 9a6a41e..a8f12f5 100644
---- a/include/linux/ide.h
-+++ b/include/linux/ide.h
-@@ -1045,6 +1045,7 @@ extern void ide_init_drive_cmd (struct request *rq);
- */
- typedef enum {
- ide_wait, /* insert rq at end of list, and wait for it */
-+ ide_next, /* insert rq immediately after current request */
- ide_preempt, /* insert rq in front of current request */
- ide_head_wait, /* insert rq in front of current request and wait for it */
- ide_end /* insert rq at end of list, but don't wait for it */
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/export-lookup_dev.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/export-lookup_dev.patch
deleted file mode 100644
index 38e671a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/export-lookup_dev.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Export lookup_dev.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- fs/block_dev.c | 2 ++
- 1 files changed, 2 insertions(+), 0 deletions(-)
-
-
-diff --git a/fs/block_dev.c b/fs/block_dev.c
-index 993f78c..3df9250 100644
---- a/fs/block_dev.c
-+++ b/fs/block_dev.c
-@@ -1417,6 +1417,8 @@ fail:
- goto out;
- }
-
-+EXPORT_SYMBOL(lookup_bdev);
-+
- /**
- * open_bdev_excl - open a block device by name and set it up for use
- *
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/hid-add-new-apple-keyboard.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/hid-add-new-apple-keyboard.patch
deleted file mode 100644
index e2fbf92..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/hid-add-new-apple-keyboard.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hid/hid-input.c | 48 +++++++++++++++++++++++++++++++++---
- drivers/hid/usbhid/hid-quirks.c | 52 +++++++++++++++++++++++++++++++++++++++
- include/linux/hid.h | 1 +
- 3 files changed, 97 insertions(+), 4 deletions(-)
-
-
-diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
-index 0b27da7..a39de6c 100644
---- a/drivers/hid/hid-input.c
-+++ b/drivers/hid/hid-input.c
-@@ -119,6 +119,30 @@ static struct hidinput_key_translation powerbook_fn_keys[] = {
- { }
- };
-
-+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 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
-
- 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 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
- }
- }
-
-- 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 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
- }
- }
-
-+ 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 @@ static void hidinput_pb_setup(struct input_dev *input)
- 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 --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
-index a255285..8d21c83 100644
---- a/drivers/hid/usbhid/hid-quirks.c
-+++ b/drivers/hid/usbhid/hid-quirks.c
-@@ -59,6 +59,32 @@
- #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
-+
-+/* Apple WellSpring keyboard + trackpad */
-+#define USB_PRODUCT_ID_WELLSPRING_ANSI 0x0223
-+#define USB_PRODUCT_ID_WELLSPRING_ISO 0x0224
-+#define USB_PRODUCT_ID_WELLSPRING_JIS 0x0225
-+
-+/* Apple WellSpring II keyboard + trackpad */
-+#define USB_PRODUCT_ID_WELLSPRING2_ANSI 0x0230
-+#define USB_PRODUCT_ID_WELLSPRING2_ISO 0x0231
-+#define USB_PRODUCT_ID_WELLSPRING2_JIS 0x0232
-+
-+/* 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 +577,32 @@ static const struct hid_blacklist {
- { 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},
-+
-+ /* 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},
-+
-+ /* Apple WellSpring keyboard + trackpad */
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+
-+ /* Apple WellSpring II keyboard + trackpad */
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_JIS, HID_QUIRK_POWERBOOK_HAS_FN | 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 --git a/include/linux/hid.h b/include/linux/hid.h
-index 6e35b92..04b26b5 100644
---- a/include/linux/hid.h
-+++ b/include/linux/hid.h
-@@ -281,6 +281,7 @@ struct hid_item {
- #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-r153/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
deleted file mode 100644
index 235146d..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-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-r153/sigmatel_audio_fix_macbook_v2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/sigmatel_audio_fix_macbook_v2.patch
deleted file mode 100644
index e35465b..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r153/sigmatel_audio_fix_macbook_v2.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-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/2.6.24-mactel-patches-r155/applesmc-int-protect.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-int-protect.patch
deleted file mode 100644
index a3a4104..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-int-protect.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-AppleSMC: use interrupts to protect a block device.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/Kconfig | 7 ++
- drivers/hwmon/Makefile | 4 +
- drivers/hwmon/applesmc.c | 155 +++++++++++++++++++++++++++++++++++++++++++---
- 3 files changed, 156 insertions(+), 10 deletions(-)
-
-
-diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
-index a0445be..1e857c0 100644
---- a/drivers/hwmon/Kconfig
-+++ b/drivers/hwmon/Kconfig
-@@ -754,6 +754,13 @@ config SENSORS_APPLESMC
- Say Y here if you have an applicable laptop and want to experience
- the awesome power of applesmc.
-
-+config SENSORS_APPLESMC_PROTECT
-+ bool "Apple SMC - Protect block devices on shock/free fall"
-+ depends on SENSORS_APPLESMC
-+ default n
-+ help
-+ Fill in......
-+
- config HWMON_DEBUG_CHIP
- bool "Hardware Monitoring Chip debugging messages"
- default n
-diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
-index 55595f6..4225f3d 100644
---- a/drivers/hwmon/Makefile
-+++ b/drivers/hwmon/Makefile
-@@ -73,3 +73,7 @@ ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
- EXTRA_CFLAGS += -DDEBUG
- endif
-
-+ifeq ($(CONFIG_SENSORS_APPLESMC_PROTECT),y)
-+EXTRA_CFLAGS += -DAPPLESMC_PROTECT
-+endif
-+
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 9ed7c84..62c8bd1 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -40,6 +40,12 @@
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
- #include <linux/interrupt.h>
-+#ifdef APPLESMC_PROTECT
-+#include <linux/fs.h>
-+#include <linux/blkdev.h>
-+#include <linux/namei.h>
-+#include <linux/mount.h>
-+#endif
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
-@@ -171,6 +177,11 @@ static unsigned int applesmc_light;
- /* Indicates which temperature sensors set to use. */
- static unsigned int applesmc_temperature_set;
-
-+#ifdef APPLESMC_PROTECT
-+/* Device to protect in case of shock or free fall. */
-+struct block_device *bdev_protect;
-+#endif
-+
- static DEFINE_MUTEX(applesmc_lock);
-
- /*
-@@ -446,6 +457,35 @@ static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
- return -EIO;
- }
-
-+#ifdef APPLESMC_PROTECT
-+static void protect_callback(struct work_struct *ignored) {
-+ char b[BDEVNAME_SIZE];
-+ /* This code comes from queue_protect_store (block/ll_rw_blk.c) */
-+ if (bdev_protect && bdev_protect->bd_disk &&
-+ bdev_protect->bd_disk->queue &&
-+ bdev_protect->bd_disk->queue->issue_protect_fn) {
-+ struct request_queue *q = bdev_protect->bd_disk->queue;
-+
-+ printk(KERN_INFO "applesmc: protecting the device (%s)\n",
-+ bdevname(bdev_protect, b));
-+
-+ /* Park and freeze */
-+ if (!blk_queue_stopped(q))
-+ q->issue_protect_fn(q);
-+
-+ /* freeze for 2 seconds (we will receive interrupt often
-+ * enough to reenable this if needed) */
-+ spin_lock_irq(q->queue_lock);
-+ blk_freeze_queue(q, 2);
-+ spin_unlock_irq(q->queue_lock);
-+
-+ printk(KERN_INFO "applesmc: device protected\n");
-+ }
-+}
-+
-+static DECLARE_WORK(protect_work, protect_callback);
-+#endif
-+
- irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
- {
- u8 int_type = inb(APPLESMC_INT_PORT);
-@@ -467,14 +507,24 @@ irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
- int_type);
- }
-
-+#ifdef APPLESMC_PROTECT
-+ if (bdev_protect && bdev_protect->bd_disk &&
-+ bdev_protect->bd_disk->queue &&
-+ bdev_protect->bd_disk->queue->issue_protect_fn) {
-+ schedule_work(&protect_work);
-+ }
-+#endif
-+
- return IRQ_HANDLED;
- }
-
- /*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
-+ * - resume is true if we are waking up from a resume, so we don't need
-+ * to setup interrupt handling again, and probe for a device to protect.
- */
--static int applesmc_device_init(void)
-+static int applesmc_device_init(int resume)
- {
- int total;
- int ret = -ENXIO;
-@@ -549,17 +599,21 @@ static int applesmc_device_init(void)
- goto out;
- }
-
-- ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler, IRQF_DISABLED,
-- "applesmc_irq_handler", NULL);
-+ if (!resume) {
-+ ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler,
-+ IRQF_DISABLED, "applesmc_irq_handler",
-+ NULL);
-
-- if (ret1) {
-- printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-- }
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup "
-+ "irq handler\n");
-+ }
-
-- printk(KERN_DEBUG "applesmc: accelerometer "
-+ printk(KERN_DEBUG "applesmc: accelerometer "
- "successfully initialized.\n");
-- ret = 0;
-+ }
-
-+ ret = 0;
- out:
- mutex_unlock(&applesmc_lock);
- return ret;
-@@ -590,7 +644,7 @@ static int applesmc_probe(struct platform_device *dev)
- {
- int ret;
-
-- ret = applesmc_device_init();
-+ ret = applesmc_device_init(0);
- if (ret)
- return ret;
-
-@@ -600,7 +654,7 @@ static int applesmc_probe(struct platform_device *dev)
-
- static int applesmc_resume(struct platform_device *dev)
- {
-- return applesmc_device_init();
-+ return applesmc_device_init(1);
- }
-
- static int applesmc_remove(struct platform_device *dev)
-@@ -897,6 +951,46 @@ static ssize_t applesmc_calibrate_store(struct device *dev,
- return count;
- }
-
-+#ifdef APPLESMC_PROTECT
-+static ssize_t applesmc_protect_device_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ char b[BDEVNAME_SIZE];
-+
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", bdevname(bdev_protect, b));
-+}
-+
-+static ssize_t applesmc_protect_device_store(struct device *dev,
-+ struct device_attribute *attr, const char *sysfsbuf, size_t count)
-+{
-+ char b[BDEVNAME_SIZE];
-+ struct block_device *bdev;
-+
-+ if (bdev_protect)
-+ bdput(bdev_protect);
-+
-+ bdev = lookup_bdev(sysfsbuf);
-+
-+ if (IS_ERR(bdev)) {
-+ bdev_protect = NULL;
-+ return -EIO; /* Could be more precise? */
-+ }
-+
-+ if (bdev->bd_disk && bdev->bd_disk->queue
-+ && bdev->bd_disk->queue->issue_protect_fn) {
-+ bdev_protect = bdev;
-+ printk(KERN_INFO "applesmc: accelerometer will now "
-+ "protect %s.\n", bdevname(bdev, b));
-+ return count;
-+ }
-+ else {
-+ bdput(bdev);
-+ bdev_protect = NULL;
-+ return -EIO; /* Could be more precise? */
-+ }
-+}
-+#endif
-+
- /* Store the next backlight value to be written by the work */
- static unsigned int backlight_value;
-
-@@ -1201,6 +1295,10 @@ 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);
-+#ifdef APPLESMC_PROTECT
-+static DEVICE_ATTR(protect_device, 0644,
-+ applesmc_protect_device_show, applesmc_protect_device_store);
-+#endif
- static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
- applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
- static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-@@ -1213,6 +1311,9 @@ static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+#ifdef APPLESMC_PROTECT
-+ &dev_attr_protect_device.attr,
-+#endif
- &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
- &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
- &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-@@ -1453,6 +1554,10 @@ static int applesmc_create_accelerometer(void)
- {
- struct input_dev *idev;
- int ret;
-+#ifdef APPLESMC_PROTECT
-+ char b[BDEVNAME_SIZE];
-+ int major, minor;
-+#endif
-
- ret = sysfs_create_group(&pdev->dev.kobj,
- &accelerometer_attributes_group);
-@@ -1486,6 +1591,30 @@ static int applesmc_create_accelerometer(void)
- if (ret)
- goto out_idev;
-
-+#ifdef APPLESMC_PROTECT
-+ /* Try to find a suitable block device to protect */
-+ bdev_protect = NULL;
-+ major = SCSI_DISK0_MAJOR;
-+
-+ /* Iterate over a maximum of 16 SCSI devices to find one that
-+ * can be protected.
-+ * Note: other devices could also be protected. */
-+ for (minor = 0; minor < 256; minor += 16) {
-+ dev_t dev = MKDEV(major, minor);
-+ struct block_device *bdev = bdget(dev);
-+ if (bdev->bd_disk && bdev->bd_disk->queue
-+ && bdev->bd_disk->queue->issue_protect_fn) {
-+ bdev_protect = bdev;
-+ printk(KERN_INFO "applesmc: accelerometer "
-+ "will protect %s (%d:%d).\n",
-+ bdevname(bdev, b),
-+ major, minor);
-+ break;
-+ }
-+ bdput(bdev);
-+ }
-+#endif
-+
- return 0;
-
- out_idev:
-@@ -1505,6 +1634,12 @@ static void applesmc_release_accelerometer(void)
- input_unregister_polled_device(applesmc_idev);
- input_free_polled_device(applesmc_idev);
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
-+#ifdef APPLESMC_PROTECT
-+ if (bdev_protect) {
-+ bdput(bdev_protect);
-+ bdev_protect = NULL;
-+ }
-+#endif
- }
-
- static __initdata struct dmi_match_data applesmc_dmi_data[] = {
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-macbook2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-macbook2.patch
deleted file mode 100644
index 0733cbe..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-macbook2.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-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/2.6.24-mactel-patches-r155/applesmc-remove-debugging-messages.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-remove-debugging-messages.patch
deleted file mode 100644
index 8b6f6c4..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-remove-debugging-messages.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-Remove debugging messages.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 24 ++++++++++--------------
- 1 files changed, 10 insertions(+), 14 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 3b09cdb..25204b4 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -133,7 +133,8 @@ struct dmi_match_data {
- int temperature_set;
- };
-
--static const int debug;
-+static int debug = 0;
-+module_param(debug, int, S_IRUGO|S_IWUSR);
- static struct platform_device *pdev;
- static s16 rest_x;
- static s16 rest_y;
-@@ -172,7 +173,7 @@ static int __wait_status(u8 val)
-
- for (i = 0; i < 200; i++) {
- if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == val) {
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG
- "Waited %d us for status %x\n",
- i*10, val);
-@@ -181,7 +182,8 @@ static int __wait_status(u8 val)
- udelay(10);
- }
-
-- printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
-+ if (debug >= 1)
-+ printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
- val, inb(APPLESMC_CMD_PORT));
-
- return -EIO;
-@@ -219,11 +221,11 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- goto wait_fail;
- }
- }
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "<%s", key);
-
- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG ">%x", len);
-
- for (i = 0; i < len; i++) {
-@@ -232,22 +234,16 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- goto wait_fail;
- }
- buffer[i] = inb(APPLESMC_DATA_PORT);
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "<%x", buffer[i]);
- }
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "\n");
-
- break;
-
- wait_fail:
- msleep(ACCESS_WAIT_MSECS);
-- continue;
-- }
--
-- if (total != ACCESS_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-- ACCESS_TIMEOUT_MSECS-total);
- }
-
- return ret;
-@@ -399,7 +395,7 @@ static int applesmc_device_init(void)
- mutex_lock(&applesmc_lock);
-
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "applesmc try %d\n", total);
- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-retry-when-accessing-keys.patch
deleted file mode 100644
index a5ee733..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc-retry-when-accessing-keys.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-Retry up to 200 ms when reading or writing keys.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 69 +++++++++++++++++++++++++++++++---------------
- 1 files changed, 47 insertions(+), 22 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index c0dd9b1..3b09cdb 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -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 */
-
-+#define ACCESS_TIMEOUT_MSECS 500 /* wait up to 500ms when accessing a key */
-+#define ACCESS_WAIT_MSECS 5 /* ... in 5ms increments */
-+
- #define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-@@ -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.
-+ * Tries up to ACCESS_WAIT_MSECS to read the value.
- * Returns zero on success or a negative error on failure. Callers must
- * hold applesmc_lock.
- */
- static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- {
-- int i;
-+ int i, total, ret;
-
- if (len > APPLESMC_MAX_DATA_LENGTH) {
- printk(KERN_ERR "applesmc_read_key: cannot read more than "
-@@ -199,33 +203,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- return -EINVAL;
- }
-
-- outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-- if (__wait_status(0x0c))
-- return -EIO;
-+ for (total = ACCESS_TIMEOUT_MSECS; total > 0;
-+ total -= ACCESS_WAIT_MSECS) {
-+ ret = 0;
-+ outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-+ if (__wait_status(0x0c)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-
-- for (i = 0; i < 4; i++) {
-- outb(key[i], APPLESMC_DATA_PORT);
-- if (__wait_status(0x04))
-- return -EIO;
-- }
-- if (debug)
-- printk(KERN_DEBUG "<%s", key);
-+ for (i = 0; i < 4; i++) {
-+ outb(key[i], APPLESMC_DATA_PORT);
-+ if (__wait_status(0x04)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ }
-+ if (debug)
-+ printk(KERN_DEBUG "<%s", key);
-
-- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-- printk(KERN_DEBUG ">%x", len);
-+ outb(len, APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG ">%x", len);
-
-- for (i = 0; i < len; i++) {
-- if (__wait_status(0x05))
-- return -EIO;
-- buffer[i] = inb(APPLESMC_DATA_PORT);
-+ for (i = 0; i < len; i++) {
-+ if (__wait_status(0x05)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ buffer[i] = inb(APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG "<%x", buffer[i]);
-+ }
- if (debug)
-- printk(KERN_DEBUG "<%x", buffer[i]);
-+ printk(KERN_DEBUG "\n");
-+
-+ break;
-+
-+wait_fail:
-+ msleep(ACCESS_WAIT_MSECS);
-+ continue;
- }
-- if (debug)
-- printk(KERN_DEBUG "\n");
-
-- return 0;
-+ if (total != ACCESS_TIMEOUT_MSECS) {
-+ printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-+ ACCESS_TIMEOUT_MSECS-total);
-+ }
-+
-+ return ret;
- }
-
- /*
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc_int.patch
deleted file mode 100644
index 2f2d3dc..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/applesmc_int.patch
+++ /dev/null
@@ -1,424 +0,0 @@
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 322 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 298 insertions(+), 24 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 25204b4..9ed7c84 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -39,14 +39,20 @@
- #include <linux/leds.h>
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
-+#include <linux/interrupt.h>
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
- /* command/status port used by Apple SMC */
- #define APPLESMC_CMD_PORT 0x304
-+/* status port used by Apple SMC to get which interrupt type just happened */
-+#define APPLESMC_INT_PORT 0x31f
-
- #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */
-
-+/* Defined in ACPI DSDT table, should we read it from there? */
-+#define APPLESMC_IRQ 6
-+
- #define APPLESMC_MAX_DATA_LENGTH 32
-
- #define APPLESMC_STATUS_MASK 0x0f
-@@ -57,6 +63,8 @@
-
- #define KEY_COUNT_KEY "#KEY" /* r-o ui32 */
-
-+#define INTERRUPT_OK_KEY "NTOK" /* w-o ui8 */
-+
- #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) */
-@@ -68,6 +76,19 @@
- #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-
-+/*
-+ * Interrupt controls.
-+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
-+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than the
-+ * value of MOLD (or MOHD), SMC will trigger an interrupt.
-+ */
-+#define MOTION_LOW_NORM "MOLT" /* r/w sp78 (2 bytes) */
-+#define MOTION_HIGH_NORM "MOHT" /* r/w sp78 (2 bytes) */
-+#define MOTION_LOW_NORM_INTERVAL "MOLD" /* r/w ui8 */
-+#define MOTION_HIGH_NORM_INTERVAL "MOHD" /* r/w ui8 */
-+
-+#define MSDW_KEY "MSDW" /* r/w flag (1 byte) */
-+
- #define FANS_COUNT "FNum" /* r-o ui8 */
- #define FANS_MANUAL "FS! " /* r-w ui16 */
- #define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -381,12 +402,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * buffer, if not, writes these bytes.
-+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
-+ * waited more than INIT_TIMEOUT_MSECS in total.
-+ * Returns zero on success or a negative error on failure. Callers must
-+ * hold applesmc_lock.
-+ */
-+static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
-+{
-+ int total, ret, i, compare;
-+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
-+
-+ if (len > APPLESMC_MAX_DATA_LENGTH) {
-+ printk(KERN_ERR "applesmc_init_check_key_value: cannot "
-+ "read/write more than %d bytes",
-+ APPLESMC_MAX_DATA_LENGTH);
-+ return -EINVAL;
-+ }
-+
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret = applesmc_read_key(key, rdbuffer, len);
-+ if (!ret) {
-+ compare = 1;
-+ for (i = 0; i < len; i++) {
-+ if (rdbuffer[i] != buffer[i]) {
-+ compare = 0;
-+ break;
-+ }
-+ }
-+
-+ if (compare) {
-+ return 0;
-+ }
-+ }
-+ ret = applesmc_write_key(key, buffer, len);
-+ msleep(INIT_WAIT_MSECS);
-+ }
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return -EIO;
-+}
-+
-+irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
-+{
-+ u8 int_type = inb(APPLESMC_INT_PORT);
-+
-+ switch (int_type) {
-+ case 0x60:
-+ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
-+ break;
-+ case 0x6f:
-+ printk(KERN_INFO
-+ "applesmc: received a high acceleration interrupt\n");
-+ break;
-+ case 0x80:
-+ printk(KERN_INFO "applesmc: received a shock interrupt\n");
-+ break;
-+ default:
-+ printk(KERN_INFO
-+ "applesmc: received an unknown interrupt %x\n",
-+ int_type);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
- */
- static int applesmc_device_init(void)
- {
-- int total, ret = -ENXIO;
-+ int total;
-+ int ret = -ENXIO;
-+ int ret1, ret2;
- u8 buffer[2];
-
- if (!applesmc_accelerometer)
-@@ -394,32 +486,79 @@ static int applesmc_device_init(void)
-
- mutex_lock(&applesmc_lock);
-
-+ /* Accept interrupts */
-+ buffer[0] = 0x01;
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug >= 9)
-- printk(KERN_DEBUG "applesmc try %d\n", total);
-- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
-- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
-- if (total == INIT_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "applesmc: device has"
-- " already been initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- } else {
-- printk(KERN_DEBUG "applesmc: device"
-- " successfully initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- }
-- ret = 0;
-- goto out;
-- }
-- buffer[0] = 0xe0;
-- buffer[1] = 0x00;
-- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
-+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set NTOK key, "
-+ "will not receive interrupts.\n");
-+
-+ /* Setup interrupt controls. */
-+ buffer[0] = 20; /* 20 msecs */
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ buffer[0] = 20; /* 20 msecs */
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "interrupt interval, might not receive "
-+ "some interrupts.");
-+ }
-+
-+ buffer[0] = 0x00;
-+ buffer[1] = 0x60;
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM, buffer, 2);
-+
-+ buffer[0] = 0x01;
-+ buffer[1] = 0xc0;
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM, buffer, 2);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
-+ }
-+
-+ /* Mysterious key. */
-+ buffer[0] = 0x01;
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set MSDW key\n");
-+
-+ /* Initialize the device. */
-+ buffer[0] = 0xe0;
-+ buffer[1] = 0xf8;
-+ if (applesmc_init_check_key_value(MOTION_SENSOR_KEY, buffer, 2)) {
-+ 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);
-+
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-+ }
-+
-+ printk(KERN_DEBUG "applesmc: accelerometer "
-+ "successfully initialized.\n");
-+ ret = 0;
-
- out:
- mutex_unlock(&applesmc_lock);
-@@ -464,9 +603,16 @@ static int applesmc_resume(struct platform_device *dev)
- return applesmc_device_init();
- }
-
-+static int applesmc_remove(struct platform_device *dev)
-+{
-+ free_irq(APPLESMC_IRQ, NULL);
-+ return 0;
-+}
-+
- static struct platform_driver applesmc_driver = {
- .probe = applesmc_probe,
- .resume = applesmc_resume,
-+ .remove = applesmc_remove,
- .driver = {
- .name = "applesmc",
- .owner = THIS_MODULE,
-@@ -774,7 +920,7 @@ static void applesmc_brightness_set(struct led_classdev *led_cdev,
- backlight_value = value;
- ret = queue_work(applesmc_led_wq, &backlight_work);
-
-- if (debug && (!ret))
-+ if ((debug >= 9) && (!ret))
- printk(KERN_DEBUG "applesmc: work was already on the queue.\n");
- }
-
-@@ -928,6 +1074,122 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
- return count;
- }
-
-+static ssize_t applesmc_accelerometer_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ int ret;
-+ unsigned int value = 0;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk(KERN_ERR
-+ "Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_read_key(key, buffer, length);
-+ if (length == 2)
-+ value = ((unsigned int)buffer[0] << 8) | buffer[1];
-+ else if (length == 1)
-+ value = buffer[0];
-+ else {
-+ printk("Invalid length for applesmc_param_show");
-+ ret = -EINVAL;
-+ }
-+
-+ mutex_unlock(&applesmc_lock);
-+ if (ret)
-+ return ret;
-+ else
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", value);
-+}
-+
-+static ssize_t applesmc_accelerometer_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *sysfsbuf, size_t count)
-+{
-+ int ret;
-+ u32 value;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ value = simple_strtoul(sysfsbuf, NULL, 10);
-+
-+ if (length == 2) {
-+ if (value > 0xffff)
-+ return -EINVAL;
-+
-+ buffer[0] = (value >> 8) & 0xff;
-+ buffer[1] = value & 0xff;
-+ } else if (length == 1) {
-+ if (value > 0xff)
-+ return -EINVAL;
-+
-+ buffer[0] = value & 0xff;
-+ } else {
-+ printk("Invalid length for applesmc_param_store");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_write_key(key, buffer, length);
-+
-+ mutex_unlock(&applesmc_lock);
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return count;
-+}
- static struct led_classdev applesmc_backlight = {
- .name = "smc:kbd_backlight",
- .default_trigger = "nand-disk",
-@@ -939,10 +1201,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);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 1);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 2);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 3);
-
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+ &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger_interval.dev_attr.attr,
- NULL
- };
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/appletouch-new.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/appletouch-new.patch
deleted file mode 100644
index f995c7a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/appletouch-new.patch
+++ /dev/null
@@ -1,377 +0,0 @@
-
-
-From: Sven Anders <anders@anduras.de>
-
-
----
-
- drivers/input/mouse/appletouch.c | 165 +++++++++++++++++++++++++++++---------
- 1 files changed, 125 insertions(+), 40 deletions(-)
-
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index b4423a4..b42c1ed 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 0x022B
-
- #define ATP_DEVICE(prod) \
- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
-@@ -73,15 +81,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) },
-@@ -93,6 +103,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 */
- { }
- };
-@@ -136,12 +151,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 ? */
-@@ -156,8 +180,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) \
-@@ -174,8 +198,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");
-
- /*
-@@ -185,7 +213,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");
-
-@@ -203,12 +231,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);
-
-@@ -217,7 +245,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);
- }
-
- /*
-@@ -229,7 +260,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,
-@@ -237,6 +268,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;
-@@ -252,6 +290,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;
-@@ -269,8 +314,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);
-@@ -385,7 +429,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));
-
- /*
-@@ -442,13 +486,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 */
-@@ -474,26 +525,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;
-@@ -538,16 +610,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:
-@@ -615,7 +699,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;
-@@ -658,7 +742,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
- */
-@@ -701,6 +785,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/2.6.24-mactel-patches-r155/appletouch.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/appletouch.patch
deleted file mode 100644
index 036655a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/appletouch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Appletouch driver ATP_THRESHOLD fix.
-
-From: Ortwin Glück <odi@odi.ch>
-
-
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index b42c1ed..805cc5e 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -142,7 +142,7 @@ MODULE_DEVICE_TABLE (usb, atp_table);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 5
-+#define ATP_THRESHOLD 3
-
- /* 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-r155/disk-protect-fix-2.6.24-crash.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect-fix-2.6.24-crash.patch
deleted file mode 100644
index 0c6c494..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect-fix-2.6.24-crash.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-Elias Oltmanns linux-thinkpad@linux-thinkpad.org
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Wed, 13 Feb 2008 12:39:17 +0100
-
-Anyway, there is a temporary solution to this problem. If you apply the
-little patch attached to this email, the usual disk-protect patch will
-work on 2.6.24. This change is supposed to fix a generic problem in
-libata and may eventually be merged upstream, but Tejun Heo (libata
-developer) said that some testing was required first.
-
-This change is absolutely safe for everyone using a non-NCQ capable
-system. In particular, ata_piix doesn't support NCQ. If you are using
-ahci and /sys/class/scsi_disk/.../device/queue_depth reports a value
-greater than 1, i.e. NCQ is enabled, then the patch shouldn't cause any
-harm either but it may or may not affect I/O performance.
-
-Enjoy,
-
-Elias
----
-
- drivers/ata/libata-scsi.c | 4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-
-diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
-index 6b02998..82ec82a 100644
---- a/drivers/ata/libata-scsi.c
-+++ b/drivers/ata/libata-scsi.c
-@@ -823,7 +823,7 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev)
- * prevent SCSI midlayer from automatically deferring
- * requests.
- */
-- sdev->max_device_blocked = 1;
-+ sdev->max_device_blocked = 2;
- }
-
- static void ata_scsi_dev_config(struct scsi_device *sdev,
-@@ -3156,7 +3156,7 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
- * Set host_blocked to 1 to prevent SCSI midlayer from
- * automatically deferring requests.
- */
-- shost->max_host_blocked = 1;
-+ shost->max_host_blocked = 2;
-
- rc = scsi_add_host(ap->scsi_host, ap->host->dev);
- if (rc)
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect-update.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect-update.patch
deleted file mode 100644
index af6afd4..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect-update.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Disk protect patch update.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- block/ll_rw_blk.c | 1 +
- include/linux/blkdev.h | 2 ++
- 2 files changed, 3 insertions(+), 0 deletions(-)
-
-
-diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
-index 31f0c22..9d7864a 100644
---- a/block/ll_rw_blk.c
-+++ b/block/ll_rw_blk.c
-@@ -4308,6 +4308,7 @@ static ssize_t queue_protect_show(struct request_queue *q, char *page)
- spin_unlock_irq(q->queue_lock);
- return queue_var_show(seconds, (page));
- }
-+EXPORT_SYMBOL(blk_freeze_queue);
-
- /*
- * When writing the 'protect' attribute, input is the number of seconds
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index e10f40b..3e53289 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -114,6 +114,8 @@ struct io_context *get_io_context(gfp_t gfp_flags, int node);
- void copy_io_context(struct io_context **pdst, struct io_context **psrc);
- void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
-
-+void blk_freeze_queue(struct request_queue *q, int seconds);
-+
- struct request;
- typedef void (rq_end_io_fn)(struct request *, int);
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect.patch
deleted file mode 100644
index c7c9ae7..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/disk-protect.patch
+++ /dev/null
@@ -1,826 +0,0 @@
-From: Elias Oltmanns <eo@...>
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Subject: disk-protect patch for kernel 2.6.24-rc3
-Newsgroups: gmane.linux.drivers.hdaps.devel
-Date: 2007-11-18 16:19:24 GMT (16 weeks, 20 hours and 52 minutes ago)
-
-For those who can't wait. Mind you, it's compile tested only. But then
-you all know about rc versions and the usual disclaimers with regard to
-your precious data.
----
-
- block/ll_rw_blk.c | 236 ++++++++++++++++++++++++++++++++++++++++++++-
- drivers/ata/libata-scsi.c | 36 +++++++
- drivers/ide/ide-disk.c | 142 +++++++++++++++++++++++++++
- drivers/ide/ide-io.c | 14 +++
- drivers/scsi/scsi_lib.c | 169 ++++++++++++++++++++++++++++++++
- include/linux/ata.h | 12 ++
- include/linux/blkdev.h | 14 +++
- include/linux/ide.h | 1
- 8 files changed, 621 insertions(+), 3 deletions(-)
-
-
-diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
-index 8b91994..31f0c22 100644
---- a/block/ll_rw_blk.c
-+++ b/block/ll_rw_blk.c
-@@ -39,6 +39,10 @@
-
- static void blk_unplug_work(struct work_struct *work);
- static void blk_unplug_timeout(unsigned long data);
-+static void blk_unfreeze_work(struct work_struct *work);
-+static void blk_unfreeze_timeout(unsigned long data);
-+static int blk_protect_register(struct request_queue *q);
-+static void blk_protect_unregister(struct request_queue *q);
- static void drive_stat_acct(struct request *rq, int new_io);
- static void init_request_from_bio(struct request *req, struct bio *bio);
- static int __make_request(struct request_queue *q, struct bio *bio);
-@@ -231,6 +235,16 @@ void blk_queue_make_request(struct request_queue * q, make_request_fn * mfn)
- q->unplug_timer.function = blk_unplug_timeout;
- q->unplug_timer.data = (unsigned long)q;
-
-+ q->max_unfreeze = 30;
-+
-+ INIT_WORK(&q->unfreeze_work, blk_unfreeze_work);
-+
-+ q->unfreeze_timer.function = blk_unfreeze_timeout;
-+ q->unfreeze_timer.data = (unsigned long)q;
-+
-+ /* Set protect_method to auto detection initially */
-+ q->protect_method = 2;
-+
- /*
- * by default assume old behaviour and bounce for any highmem page
- */
-@@ -263,6 +277,18 @@ static void rq_init(struct request_queue *q, struct request *rq)
- rq->next_rq = NULL;
- }
-
-+void blk_queue_issue_protect_fn(struct request_queue *q, issue_protect_fn *ipf)
-+{
-+ q->issue_protect_fn = ipf;
-+}
-+EXPORT_SYMBOL(blk_queue_issue_protect_fn);
-+
-+void blk_queue_issue_unprotect_fn(struct request_queue *q, issue_unprotect_fn *iuf)
-+{
-+ q->issue_unprotect_fn = iuf;
-+}
-+EXPORT_SYMBOL(blk_queue_issue_unprotect_fn);
-+
- /**
- * blk_queue_ordered - does this queue support ordered writes
- * @q: the request queue
-@@ -1861,6 +1887,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
- }
-
- init_timer(&q->unplug_timer);
-+ init_timer(&q->unfreeze_timer);
-
- kobject_set_name(&q->kobj, "%s", "queue");
- q->kobj.ktype = &queue_ktype;
-@@ -4191,13 +4218,21 @@ int blk_register_queue(struct gendisk *disk)
- kobject_uevent(&q->kobj, KOBJ_ADD);
-
- ret = elv_register_queue(q);
-+ if (ret)
-+ goto err;
-+
-+ ret = blk_protect_register(q);
- if (ret) {
-- kobject_uevent(&q->kobj, KOBJ_REMOVE);
-- kobject_del(&q->kobj);
-- return ret;
-+ elv_unregister_queue(q);
-+ goto err;
- }
-
- return 0;
-+
-+err:
-+ kobject_uevent(&q->kobj, KOBJ_REMOVE);
-+ kobject_del(&q->kobj);
-+ return ret;
- }
-
- void blk_unregister_queue(struct gendisk *disk)
-@@ -4205,6 +4240,7 @@ void blk_unregister_queue(struct gendisk *disk)
- struct request_queue *q = disk->queue;
-
- if (q && q->request_fn) {
-+ blk_protect_unregister(q);
- elv_unregister_queue(q);
-
- kobject_uevent(&q->kobj, KOBJ_REMOVE);
-@@ -4212,3 +4248,197 @@ void blk_unregister_queue(struct gendisk *disk)
- kobject_put(&disk->kobj);
- }
- }
-+
-+/*
-+ * Issue lower level unprotect function if no timers are pending.
-+ */
-+static void blk_unfreeze_work(struct work_struct *work)
-+{
-+ struct request_queue *q = container_of(work, struct request_queue, unfreeze_work);
-+ int pending;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ pending = timer_pending(&q->unfreeze_timer);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ if (!pending)
-+ q->issue_unprotect_fn(q);
-+}
-+
-+/*
-+ * Called when the queue freeze timeout expires...
-+ */
-+static void blk_unfreeze_timeout(unsigned long data)
-+{
-+ struct request_queue *q = (struct request_queue *) data;
-+
-+ kblockd_schedule_work(&q->unfreeze_work);
-+}
-+
-+/*
-+ * The lower level driver parks and freezes the queue, and this block layer
-+ * function sets up the freeze timeout timer on return. If the queue is
-+ * already frozen then this is called to extend the timer...
-+ */
-+void blk_freeze_queue(struct request_queue *q, int seconds)
-+{
-+ /* Don't accept arbitrarily long freezes */
-+ if (seconds >= q->max_unfreeze)
-+ seconds = q->max_unfreeze;
-+ /* set/reset the timer */
-+ mod_timer(&q->unfreeze_timer, msecs_to_jiffies(seconds*1000) + jiffies);
-+}
-+
-+/*
-+ * When reading the 'protect' attribute, we return seconds remaining
-+ * before unfreeze timeout expires
-+ */
-+static ssize_t queue_protect_show(struct request_queue *q, char *page)
-+{
-+ unsigned int seconds = 0;
-+
-+ spin_lock_irq(q->queue_lock);
-+ if (blk_queue_stopped(q) && timer_pending(&q->unfreeze_timer))
-+ /*
-+ * Adding 1 in order to guarantee nonzero value until timer
-+ * has actually expired.
-+ */
-+ seconds = jiffies_to_msecs(q->unfreeze_timer.expires
-+ - jiffies) / 1000 + 1;
-+ spin_unlock_irq(q->queue_lock);
-+ return queue_var_show(seconds, (page));
-+}
-+
-+/*
-+ * When writing the 'protect' attribute, input is the number of seconds
-+ * to freeze the queue for. We call a lower level helper function to
-+ * park the heads and freeze/block the queue, then we make a block layer
-+ * call to setup the thaw timeout. If input is 0, then we thaw the queue.
-+ */
-+static ssize_t queue_protect_store(struct request_queue *q,
-+ const char *page, size_t count)
-+{
-+ unsigned long freeze = 0;
-+
-+ queue_var_store(&freeze, page, count);
-+
-+ if (freeze>0) {
-+ /* Park and freeze */
-+ if (!blk_queue_stopped(q))
-+ q->issue_protect_fn(q);
-+ /* set / reset the thaw timer */
-+ spin_lock_irq(q->queue_lock);
-+ blk_freeze_queue(q, freeze);
-+ spin_unlock_irq(q->queue_lock);
-+ } else {
-+ spin_lock_irq(q->queue_lock);
-+ freeze = del_timer(&q->unfreeze_timer);
-+ spin_unlock_irq(q->queue_lock);
-+ if (freeze)
-+ q->issue_unprotect_fn(q);
-+ }
-+
-+ return count;
-+}
-+
-+static ssize_t
-+queue_str_show(char *page, char *str, int status)
-+{
-+ ssize_t len;
-+
-+ if (status & 1)
-+ len = sprintf(page, "[%s]", str);
-+ else
-+ len = sprintf(page, "%s", str);
-+ if (status & 2)
-+ len += sprintf(page+len, "\n");
-+ else
-+ len += sprintf(page+len, " ");
-+ return len;
-+}
-+
-+/*
-+ * Returns current protect_method.
-+ */
-+static ssize_t queue_protect_method_show(struct request_queue *q, char *page)
-+{
-+ int len = 0;
-+ int unload = q->protect_method;
-+
-+ len += queue_str_show(page+len, "auto", (unload & 2) >> 1);
-+ len += queue_str_show(page+len, "unload", unload & 1);
-+ len += queue_str_show(page+len, "standby", !unload ? 3 : 2);
-+ return len;
-+}
-+
-+/*
-+ * Stores the device protect method.
-+ */
-+static ssize_t queue_protect_method_store(struct request_queue *q,
-+ const char *page, size_t count)
-+{
-+ spin_lock_irq(q->queue_lock);
-+ if (!strcmp(page, "auto") || !strcmp(page, "auto\n"))
-+ q->protect_method = 2;
-+ else if (!strcmp(page, "unload") || !strcmp(page, "unload\n"))
-+ q->protect_method = 1;
-+ else if (!strcmp(page, "standby") || !strcmp(page, "standby\n"))
-+ q->protect_method = 0;
-+ else {
-+ spin_unlock_irq(q->queue_lock);
-+ return -EINVAL;
-+ }
-+ spin_unlock_irq(q->queue_lock);
-+ return count;
-+}
-+
-+static struct queue_sysfs_entry queue_protect_entry = {
-+ .attr = { .name = "protect", .mode = S_IRUGO | S_IWUSR },
-+ .show = queue_protect_show,
-+ .store = queue_protect_store,
-+};
-+static struct queue_sysfs_entry queue_protect_method_entry = {
-+ .attr = { .name = "protect_method", .mode = S_IRUGO | S_IWUSR },
-+ .show = queue_protect_method_show,
-+ .store = queue_protect_method_store,
-+};
-+
-+static int blk_protect_register(struct request_queue *q)
-+{
-+ int error = 0;
-+
-+ /* check that the lower level driver has a protect handler */
-+ if (!q->issue_protect_fn)
-+ return 0;
-+
-+ /* create the attributes */
-+ error = sysfs_create_file(&q->kobj, &queue_protect_entry.attr);
-+ if (error) {
-+ printk(KERN_ERR
-+ "blk_protect_register(): failed to create protect queue attribute!\n");
-+ return error;
-+ }
-+
-+ error = sysfs_create_file(&q->kobj, &queue_protect_method_entry.attr);
-+ if (error) {
-+ sysfs_remove_file(&q->kobj, &queue_protect_entry.attr);
-+ printk(KERN_ERR
-+ "blk_protect_register(): failed to create protect_method attribute!\n");
-+ return error;
-+ }
-+ kobject_get(&q->kobj);
-+
-+ return 0;
-+}
-+
-+static void blk_protect_unregister(struct request_queue *q)
-+{
-+ /* check that the lower level driver has a protect handler */
-+ if (!q->issue_protect_fn)
-+ return;
-+
-+ /* remove the attributes */
-+ sysfs_remove_file(&q->kobj, &queue_protect_method_entry.attr);
-+ sysfs_remove_file(&q->kobj, &queue_protect_entry.attr);
-+ kobject_put(&q->kobj);
-+}
-diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
-index 14daf48..6b02998 100644
---- a/drivers/ata/libata-scsi.c
-+++ b/drivers/ata/libata-scsi.c
-@@ -856,6 +856,38 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
- }
- }
-
-+extern int scsi_protect_queue(struct request_queue *q, int unload);
-+extern int scsi_unprotect_queue(struct request_queue *q);
-+
-+static int ata_scsi_issue_protect_fn(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+ struct ata_port *ap = ata_shost_to_port(sdev->host);
-+ struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
-+ int unload = q->protect_method;
-+ unsigned long flags;
-+
-+ if (!dev) {
-+ printk(KERN_DEBUG "ata_scsi_issue_protect_fn(): Couldn't find ATA device to be parked.\n");
-+ return -ENXIO;
-+ }
-+
-+ if (unload == 2) {
-+ unload = ata_id_has_unload(dev->id) ? 1 : 0;
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ q->protect_method = unload;
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ }
-+
-+ /* call scsi_protect_queue, requesting either unload or standby */
-+ return scsi_protect_queue(q, unload);
-+}
-+
-+static int ata_scsi_issue_unprotect_fn(struct request_queue *q)
-+{
-+ return scsi_unprotect_queue(q);
-+}
-+
- /**
- * ata_scsi_slave_config - Set SCSI device attributes
- * @sdev: SCSI device to examine
-@@ -877,6 +909,10 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
-
- if (dev)
- ata_scsi_dev_config(sdev, dev);
-+ blk_queue_issue_protect_fn(sdev->request_queue,
-+ ata_scsi_issue_protect_fn);
-+ blk_queue_issue_unprotect_fn(sdev->request_queue,
-+ ata_scsi_issue_unprotect_fn);
-
- return 0; /* scsi layer doesn't check return value, sigh */
- }
-diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
-index b178190..1ef536f 100644
---- a/drivers/ide/ide-disk.c
-+++ b/drivers/ide/ide-disk.c
-@@ -675,6 +675,145 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
- }
-
- /*
-+ * todo:
-+ * - we freeze the queue regardless of success and rely on the
-+ * ide_protect_queue function to thaw immediately if the command
-+ * failed (to be consistent with the libata handler)... should
-+ * we also inspect here?
-+ */
-+void ide_end_protect_rq(struct request *rq, int error)
-+{
-+ struct completion *waiting = rq->end_io_data;
-+
-+ rq->end_io_data = NULL;
-+ /* spin lock already accquired */
-+ if (!blk_queue_stopped(rq->q))
-+ blk_stop_queue(rq->q);
-+
-+ complete(waiting);
-+}
-+
-+int ide_unprotect_queue(struct request_queue *q)
-+{
-+ struct request rq;
-+ unsigned long flags;
-+ int pending = 0, rc = 0;
-+ ide_drive_t *drive = q->queuedata;
-+ u8 args[7], *argbuf = args;
-+
-+ if (!blk_queue_stopped(q))
-+ return -EIO;
-+
-+ /* Are there any pending jobs on the queue? */
-+ pending = ((q->rq.count[READ] > 0) || (q->rq.count[WRITE] > 0)) ? 1 : 0;
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ blk_start_queue(q);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+
-+ /* The unload feature of the IDLE_IMMEDIATE command
-+ temporarily disables HD power management from spinning down
-+ the disk. Any other command will reenable HD pm, so, if
-+ there are no pending jobs on the queue, another
-+ CHECK_POWER_MODE1 command without the unload feature should do
-+ just fine. */
-+ if (!pending) {
-+ printk(KERN_DEBUG "ide_unprotect_queue(): No pending I/O, re-enabling power management..\n");
-+ memset(args, 0, sizeof(args));
-+ argbuf[0] = 0xe5; /* CHECK_POWER_MODE1 */
-+ ide_init_drive_cmd(&rq);
-+ rq.cmd_type = REQ_TYPE_ATA_TASK;
-+ rq.buffer = argbuf;
-+ rc = ide_do_drive_cmd(drive, &rq, ide_head_wait);
-+ }
-+
-+ return rc;
-+}
-+
-+int ide_protect_queue(struct request_queue *q, int unload)
-+{
-+ ide_drive_t *drive = q->queuedata;
-+ struct request rq;
-+ u8 args[7], *argbuf = args;
-+ int ret = 0;
-+ DECLARE_COMPLETION(wait);
-+
-+ memset(&rq, 0, sizeof(rq));
-+ memset(args, 0, sizeof(args));
-+
-+ if (blk_queue_stopped(q))
-+ return -EIO;
-+
-+ if (unload) {
-+ argbuf[0] = 0xe1;
-+ argbuf[1] = 0x44;
-+ argbuf[3] = 0x4c;
-+ argbuf[4] = 0x4e;
-+ argbuf[5] = 0x55;
-+ } else
-+ argbuf[0] = 0xe0;
-+
-+ /* Issue the park command & freeze */
-+ ide_init_drive_cmd(&rq);
-+
-+ rq.cmd_type = REQ_TYPE_ATA_TASK;
-+ rq.buffer = argbuf;
-+ rq.end_io_data = &wait;
-+ rq.end_io = ide_end_protect_rq;
-+
-+ ret = ide_do_drive_cmd(drive, &rq, ide_next);
-+ wait_for_completion(&wait);
-+
-+ if (ret)
-+ {
-+ printk(KERN_DEBUG "ide_protect_queue(): Warning: head NOT parked!..\n");
-+ ide_unprotect_queue(q);
-+ return ret;
-+ }
-+
-+ if (unload) {
-+ if (args[3] == 0xc4)
-+ printk(KERN_DEBUG "ide_protect_queue(): head parked..\n");
-+ else {
-+ /* error parking the head */
-+ printk(KERN_DEBUG "ide_protect_queue(): head NOT parked!..\n");
-+ ret = -EIO;
-+ ide_unprotect_queue(q);
-+ }
-+ } else
-+ printk(KERN_DEBUG "ide_protect_queue(): head park not requested, used standby!..\n");
-+
-+ return ret;
-+}
-+
-+int idedisk_issue_protect_fn(struct request_queue *q)
-+{
-+ ide_drive_t *drive = q->queuedata;
-+ int unload = q->protect_method;
-+ unsigned long flags;
-+
-+ /*
-+ * Check capability of the device -
-+ * - if "idle immediate with unload" is supported we use that, else
-+ * we use "standby immediate" and live with spinning down the drive..
-+ * (Word 84, bit 13 of IDENTIFY DEVICE data)
-+ */
-+ if (unload == 2) {
-+ unload = drive->id->cfsse & (1 << 13) ? 1 : 0;
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ q->protect_method = unload;
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ }
-+
-+ return ide_protect_queue(q, unload);
-+}
-+
-+int idedisk_issue_unprotect_fn(struct request_queue *q)
-+{
-+ return ide_unprotect_queue(q);
-+}
-+
-+/*
- * This is tightly woven into the driver->do_special can not touch.
- * DON'T do it again until a total personality rewrite is committed.
- */
-@@ -943,6 +1082,9 @@ static void idedisk_setup (ide_drive_t *drive)
- drive->wcache = 1;
-
- write_cache(drive, 1);
-+
-+ blk_queue_issue_protect_fn(drive->queue, idedisk_issue_protect_fn);
-+ blk_queue_issue_unprotect_fn(drive->queue, idedisk_issue_unprotect_fn);
- }
-
- static void ide_cacheflush_p(ide_drive_t *drive)
-diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
-index bef781f..873764e 100644
---- a/drivers/ide/ide-io.c
-+++ b/drivers/ide/ide-io.c
-@@ -1271,6 +1271,17 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
- }
-
- /*
-+ * Don't accept a request when the queue is stopped (unless we
-+ * are resuming from suspend). Prevents existing queue entries
-+ * being processed after queue is stopped by the hard disk
-+ * protection mechanism...
-+ */
-+ if (test_bit(QUEUE_FLAG_STOPPED, &drive->queue->queue_flags) && !blk_pm_resume_request(rq)) {
-+ hwgroup->busy = 0;
-+ break;
-+ }
-+
-+ /*
- * Sanity: don't accept a request that isn't a PM request
- * if we are currently power managed. This is very important as
- * blk_stop_queue() doesn't prevent the elv_next_request()
-@@ -1768,6 +1779,9 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
- where = ELEVATOR_INSERT_FRONT;
- rq->cmd_flags |= REQ_PREEMPT;
- }
-+ if (action == ide_next)
-+ where = ELEVATOR_INSERT_FRONT;
-+
- __elv_add_request(drive->queue, rq, where, 0);
- ide_do_request(hwgroup, IDE_NO_IRQ);
- spin_unlock_irqrestore(&ide_lock, flags);
-diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
-index a9ac5b1..58049e7 100644
---- a/drivers/scsi/scsi_lib.c
-+++ b/drivers/scsi/scsi_lib.c
-@@ -2268,7 +2268,13 @@ EXPORT_SYMBOL_GPL(sdev_evt_send_simple);
- int
- scsi_device_quiesce(struct scsi_device *sdev)
- {
-+ int i;
- int err = scsi_device_set_state(sdev, SDEV_QUIESCE);
-+ for (i = 0; err && (sdev->sdev_state == SDEV_BLOCK) && (i < 100);
-+ i++) {
-+ msleep_interruptible(200);
-+ err = scsi_device_set_state(sdev, SDEV_QUIESCE);
-+ }
- if (err)
- return err;
-
-@@ -2518,3 +2524,166 @@ void scsi_kunmap_atomic_sg(void *virt)
- kunmap_atomic(virt, KM_BIO_SRC_IRQ);
- }
- EXPORT_SYMBOL(scsi_kunmap_atomic_sg);
-+
-+/*
-+ * Structure required for synchronous io completion after queue freezing
-+ */
-+struct scsi_protect_io_context_sync {
-+ struct scsi_device *sdev;
-+ int result;
-+ char *sense;
-+ struct completion *waiting;
-+};
-+
-+/*
-+ * scsi_protect_wait_done()
-+ * Command completion handler for scsi_protect_queue().
-+ *
-+ * Unable to call scsi_internal_device_block() as
-+ * scsi_end_request() already has the spinlock. So,
-+ * we put the necessary functionality inline.
-+ *
-+ * todo:
-+ * - we block the queue regardless of success and rely on the
-+ * scsi_protect_queue function to unblock if the command
-+ * failed... should we also inspect here?
-+ */
-+static void scsi_protect_wait_done(void *data, char *sense, int result, int resid)
-+{
-+ struct scsi_protect_io_context_sync *siocs = data;
-+ struct completion *waiting = siocs->waiting;
-+ struct request_queue *q = siocs->sdev->request_queue;
-+
-+ siocs->waiting = NULL;
-+ siocs->result = result;
-+ memcpy(siocs->sense, sense, SCSI_SENSE_BUFFERSIZE);
-+
-+ if (!scsi_device_set_state(siocs->sdev, SDEV_BLOCK))
-+ blk_stop_queue(q);
-+
-+ complete(waiting);
-+}
-+
-+/*
-+ * scsi_unprotect_queue()
-+ * - release the queue that was previously blocked
-+ */
-+int scsi_unprotect_queue(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+ int rc = 0, pending = 0;
-+ u8 scsi_cmd[MAX_COMMAND_SIZE];
-+ struct scsi_sense_hdr sshdr;
-+
-+ if (sdev->sdev_state != SDEV_BLOCK)
-+ return -ENXIO;
-+
-+ /* Are there any pending jobs on the queue? */
-+ pending = ((q->rq.count[READ] > 0) || (q->rq.count[WRITE] > 0)) ? 1 : 0;
-+
-+ rc = scsi_internal_device_unblock(sdev);
-+ if (rc)
-+ return rc;
-+
-+ if (!pending) {
-+ printk(KERN_DEBUG "scsi_unprotect_queue(): No pending I/O, re-enabling power management..\n");
-+
-+ memset(scsi_cmd, 0, sizeof(scsi_cmd));
-+ scsi_cmd[0] = ATA_16;
-+ scsi_cmd[1] = (3 << 1); /* Non-data */
-+ /* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
-+ scsi_cmd[14] = 0xe5; /* CHECK_POWER_MODE1 */
-+
-+ /* Good values for timeout and retries? Values below
-+ from scsi_ioctl_send_command() for default case... */
-+ if (scsi_execute_req(sdev, scsi_cmd, DMA_NONE, NULL, 0, &sshdr,
-+ (10*HZ), 5))
-+ rc = -EIO;
-+ }
-+ return rc;
-+}
-+EXPORT_SYMBOL_GPL(scsi_unprotect_queue);
-+
-+/*
-+ * scsi_protect_queue()
-+ * - build and issue the park/standby command..
-+ * - queue is blocked during command completion handler
-+ */
-+int scsi_protect_queue(struct request_queue *q, int unload)
-+{
-+ struct scsi_protect_io_context_sync siocs;
-+ struct scsi_device *sdev = q->queuedata;
-+ int rc = 0;
-+ u8 args[7];
-+ u8 scsi_cmd[MAX_COMMAND_SIZE];
-+ unsigned char sense[SCSI_SENSE_BUFFERSIZE];
-+ unsigned char *desc;
-+ DECLARE_COMPLETION_ONSTACK(wait);
-+
-+ if (sdev->sdev_state != SDEV_RUNNING)
-+ return -ENXIO;
-+
-+ memset(args, 0, sizeof(args));
-+ memset(sense, 0, sizeof(sense));
-+
-+ if (unload) {
-+ args[0] = 0xe1;
-+ args[1] = 0x44;
-+ args[3] = 0x4c;
-+ args[4] = 0x4e;
-+ args[5] = 0x55;
-+ } else
-+ args[0] = 0xe0;
-+
-+ memset(scsi_cmd, 0, sizeof(scsi_cmd));
-+ scsi_cmd[0] = ATA_16;
-+ scsi_cmd[1] = (3 << 1); /* Non-data */
-+ scsi_cmd[2] = 0x20; /* no off.line, or data xfer, request cc */
-+ scsi_cmd[4] = args[1];
-+ scsi_cmd[6] = args[2];
-+ scsi_cmd[8] = args[3];
-+ scsi_cmd[10] = args[4];
-+ scsi_cmd[12] = args[5];
-+ scsi_cmd[14] = args[0];
-+ siocs.sdev = sdev;
-+ siocs.sense = sense;
-+ siocs.waiting = &wait;
-+
-+ scsi_execute_async(sdev, scsi_cmd, COMMAND_SIZE(scsi_cmd[0]),
-+ DMA_NONE, NULL, 0, 0, (10*HZ), 5,
-+ &siocs, &scsi_protect_wait_done, GFP_NOWAIT);
-+ wait_for_completion(&wait);
-+
-+ if (siocs.result != ((DRIVER_SENSE << 24) + SAM_STAT_CHECK_CONDITION)) {
-+ printk(KERN_DEBUG "scsi_protect_queue(): head NOT parked!..\n");
-+ scsi_unprotect_queue(q); /* just in case we still managed to block */
-+ rc = -EIO;
-+ goto out;
-+ }
-+
-+ desc = sense + 8;
-+
-+ /* Retrieve data from check condition */
-+ args[1] = desc[3];
-+ args[2] = desc[5];
-+ args[3] = desc[7];
-+ args[4] = desc[9];
-+ args[5] = desc[11];
-+ args[0] = desc[13];
-+
-+ if (unload) {
-+ if (args[3] == 0xc4)
-+ printk(KERN_DEBUG "scsi_protect_queue(): head parked..\n");
-+ else {
-+ /* error parking the head */
-+ printk(KERN_DEBUG "scsi_protect_queue(): head NOT parked!..\n");
-+ rc = -EIO;
-+ scsi_unprotect_queue(q);
-+ }
-+ } else
-+ printk(KERN_DEBUG "scsi_protect_queue(): head park not requested, used standby!..\n");
-+
-+out:
-+ return rc;
-+}
-+EXPORT_SYMBOL_GPL(scsi_protect_queue);
-diff --git a/include/linux/ata.h b/include/linux/ata.h
-index e672e80..aa16cbb 100644
---- a/include/linux/ata.h
-+++ b/include/linux/ata.h
-@@ -395,6 +395,18 @@ struct ata_taskfile {
-
- #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
-
-+static inline int ata_id_has_unload(const u16 *id)
-+{
-+ /* ATA-7 specifies two places to indicate unload feature support.
-+ * Since I don't really understand the difference, I'll just check
-+ * both and only return zero if none of them indicates otherwise. */
-+ if ((id[84] & 0xC000) == 0x4000 && id[84] & (1 << 13))
-+ return id[84] & (1 << 13);
-+ if ((id[87] & 0xC000) == 0x4000)
-+ return id[87] & (1 << 13);
-+ return 0;
-+}
-+
- static inline bool ata_id_has_hipm(const u16 *id)
- {
- u16 val = id[76];
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index d18ee67..e10f40b 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -332,6 +332,8 @@ struct bio_vec;
- typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *);
- typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
- typedef void (softirq_done_fn)(struct request *);
-+typedef int (issue_protect_fn) (struct request_queue *);
-+typedef int (issue_unprotect_fn) (struct request_queue *);
-
- enum blk_queue_state {
- Queue_down,
-@@ -368,6 +370,8 @@ struct request_queue
- merge_bvec_fn *merge_bvec_fn;
- prepare_flush_fn *prepare_flush_fn;
- softirq_done_fn *softirq_done_fn;
-+ issue_protect_fn *issue_protect_fn;
-+ issue_unprotect_fn *issue_unprotect_fn;
-
- /*
- * Dispatch queue sorting
-@@ -383,6 +387,14 @@ struct request_queue
- unsigned long unplug_delay; /* After this many jiffies */
- struct work_struct unplug_work;
-
-+ /*
-+ * Auto-unfreeze state
-+ */
-+ struct timer_list unfreeze_timer;
-+ int max_unfreeze; /* At most this many seconds */
-+ struct work_struct unfreeze_work;
-+ int protect_method;
-+
- struct backing_dev_info backing_dev_info;
-
- /*
-@@ -773,6 +785,8 @@ extern int blk_do_ordered(struct request_queue *, struct request **);
- extern unsigned blk_ordered_cur_seq(struct request_queue *);
- extern unsigned blk_ordered_req_seq(struct request *);
- extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int);
-+extern void blk_queue_issue_protect_fn(struct request_queue *, issue_protect_fn *);
-+extern void blk_queue_issue_unprotect_fn(struct request_queue *, issue_unprotect_fn *);
-
- extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
- extern void blk_dump_rq_flags(struct request *, char *);
-diff --git a/include/linux/ide.h b/include/linux/ide.h
-index 9a6a41e..a8f12f5 100644
---- a/include/linux/ide.h
-+++ b/include/linux/ide.h
-@@ -1045,6 +1045,7 @@ extern void ide_init_drive_cmd (struct request *rq);
- */
- typedef enum {
- ide_wait, /* insert rq at end of list, and wait for it */
-+ ide_next, /* insert rq immediately after current request */
- ide_preempt, /* insert rq in front of current request */
- ide_head_wait, /* insert rq in front of current request and wait for it */
- ide_end /* insert rq at end of list, but don't wait for it */
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/export-lookup_dev.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/export-lookup_dev.patch
deleted file mode 100644
index 38e671a..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/export-lookup_dev.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Export lookup_dev.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- fs/block_dev.c | 2 ++
- 1 files changed, 2 insertions(+), 0 deletions(-)
-
-
-diff --git a/fs/block_dev.c b/fs/block_dev.c
-index 993f78c..3df9250 100644
---- a/fs/block_dev.c
-+++ b/fs/block_dev.c
-@@ -1417,6 +1417,8 @@ fail:
- goto out;
- }
-
-+EXPORT_SYMBOL(lookup_bdev);
-+
- /**
- * open_bdev_excl - open a block device by name and set it up for use
- *
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/hid-add-new-apple-keyboard.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/hid-add-new-apple-keyboard.patch
deleted file mode 100644
index e2fbf92..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/hid-add-new-apple-keyboard.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hid/hid-input.c | 48 +++++++++++++++++++++++++++++++++---
- drivers/hid/usbhid/hid-quirks.c | 52 +++++++++++++++++++++++++++++++++++++++
- include/linux/hid.h | 1 +
- 3 files changed, 97 insertions(+), 4 deletions(-)
-
-
-diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
-index 0b27da7..a39de6c 100644
---- a/drivers/hid/hid-input.c
-+++ b/drivers/hid/hid-input.c
-@@ -119,6 +119,30 @@ static struct hidinput_key_translation powerbook_fn_keys[] = {
- { }
- };
-
-+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 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
-
- 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 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
- }
- }
-
-- 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 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
- }
- }
-
-+ 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 @@ static void hidinput_pb_setup(struct input_dev *input)
- 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 --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
-index a255285..8d21c83 100644
---- a/drivers/hid/usbhid/hid-quirks.c
-+++ b/drivers/hid/usbhid/hid-quirks.c
-@@ -59,6 +59,32 @@
- #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
-+
-+/* Apple WellSpring keyboard + trackpad */
-+#define USB_PRODUCT_ID_WELLSPRING_ANSI 0x0223
-+#define USB_PRODUCT_ID_WELLSPRING_ISO 0x0224
-+#define USB_PRODUCT_ID_WELLSPRING_JIS 0x0225
-+
-+/* Apple WellSpring II keyboard + trackpad */
-+#define USB_PRODUCT_ID_WELLSPRING2_ANSI 0x0230
-+#define USB_PRODUCT_ID_WELLSPRING2_ISO 0x0231
-+#define USB_PRODUCT_ID_WELLSPRING2_JIS 0x0232
-+
-+/* 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 +577,32 @@ static const struct hid_blacklist {
- { 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},
-+
-+ /* 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},
-+
-+ /* Apple WellSpring keyboard + trackpad */
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+
-+ /* Apple WellSpring II keyboard + trackpad */
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_JIS, HID_QUIRK_POWERBOOK_HAS_FN | 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 --git a/include/linux/hid.h b/include/linux/hid.h
-index 6e35b92..04b26b5 100644
---- a/include/linux/hid.h
-+++ b/include/linux/hid.h
-@@ -281,6 +281,7 @@ struct hid_item {
- #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-r155/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
deleted file mode 100644
index 235146d..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-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-r155/sigmatel_audio_fix_macbook_v2.patch b/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/sigmatel_audio_fix_macbook_v2.patch
deleted file mode 100644
index e35465b..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.24-mactel-patches-r155/sigmatel_audio_fix_macbook_v2.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-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/2.6.25-mactel-patches-r156/applesmc-int-protect.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-int-protect.patch
deleted file mode 100644
index 038583e..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-int-protect.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-commit b69b46ff2a770621c85516dbe626a0c45b459983
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-AppleSMC: use interrupts to protect a block device.
----
-
- drivers/hwmon/Kconfig | 7 ++
- drivers/hwmon/Makefile | 4 +
- drivers/hwmon/applesmc.c | 155 +++++++++++++++++++++++++++++++++++++++++++---
- 3 files changed, 156 insertions(+), 10 deletions(-)
-
-
-diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
-index 4dc76bc..f066348 100644
---- a/drivers/hwmon/Kconfig
-+++ b/drivers/hwmon/Kconfig
-@@ -785,6 +785,13 @@ config SENSORS_APPLESMC
- Say Y here if you have an applicable laptop and want to experience
- the awesome power of applesmc.
-
-+config SENSORS_APPLESMC_PROTECT
-+ bool "Apple SMC - Protect block devices on shock/free fall"
-+ depends on SENSORS_APPLESMC
-+ default n
-+ help
-+ Fill in......
-+
- config HWMON_DEBUG_CHIP
- bool "Hardware Monitoring Chip debugging messages"
- default n
-diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
-index 3bdb05a..d535e14 100644
---- a/drivers/hwmon/Makefile
-+++ b/drivers/hwmon/Makefile
-@@ -76,3 +76,7 @@ ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
- EXTRA_CFLAGS += -DDEBUG
- endif
-
-+ifeq ($(CONFIG_SENSORS_APPLESMC_PROTECT),y)
-+EXTRA_CFLAGS += -DAPPLESMC_PROTECT
-+endif
-+
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 4980338..4c8ea4c 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -40,6 +40,12 @@
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
- #include <linux/interrupt.h>
-+#ifdef APPLESMC_PROTECT
-+#include <linux/fs.h>
-+#include <linux/blkdev.h>
-+#include <linux/namei.h>
-+#include <linux/mount.h>
-+#endif
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
-@@ -171,6 +177,11 @@ static unsigned int applesmc_light;
- /* Indicates which temperature sensors set to use. */
- static unsigned int applesmc_temperature_set;
-
-+#ifdef APPLESMC_PROTECT
-+/* Device to protect in case of shock or free fall. */
-+struct block_device *bdev_protect;
-+#endif
-+
- static DEFINE_MUTEX(applesmc_lock);
-
- /*
-@@ -446,6 +457,35 @@ static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
- return -EIO;
- }
-
-+#ifdef APPLESMC_PROTECT
-+static void protect_callback(struct work_struct *ignored) {
-+ char b[BDEVNAME_SIZE];
-+ /* This code comes from queue_protect_store (block/ll_rw_blk.c) */
-+ if (bdev_protect && bdev_protect->bd_disk &&
-+ bdev_protect->bd_disk->queue &&
-+ bdev_protect->bd_disk->queue->issue_protect_fn) {
-+ struct request_queue *q = bdev_protect->bd_disk->queue;
-+
-+ printk(KERN_INFO "applesmc: protecting the device (%s)\n",
-+ bdevname(bdev_protect, b));
-+
-+ /* Park and freeze */
-+ if (!blk_queue_stopped(q))
-+ q->issue_protect_fn(q);
-+
-+ /* freeze for 2 seconds (we will receive interrupt often
-+ * enough to reenable this if needed) */
-+ spin_lock_irq(q->queue_lock);
-+ blk_freeze_queue(q, 2);
-+ spin_unlock_irq(q->queue_lock);
-+
-+ printk(KERN_INFO "applesmc: device protected\n");
-+ }
-+}
-+
-+static DECLARE_WORK(protect_work, protect_callback);
-+#endif
-+
- irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
- {
- u8 int_type = inb(APPLESMC_INT_PORT);
-@@ -467,14 +507,24 @@ irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
- int_type);
- }
-
-+#ifdef APPLESMC_PROTECT
-+ if (bdev_protect && bdev_protect->bd_disk &&
-+ bdev_protect->bd_disk->queue &&
-+ bdev_protect->bd_disk->queue->issue_protect_fn) {
-+ schedule_work(&protect_work);
-+ }
-+#endif
-+
- return IRQ_HANDLED;
- }
-
- /*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
-+ * - resume is true if we are waking up from a resume, so we don't need
-+ * to setup interrupt handling again, and probe for a device to protect.
- */
--static int applesmc_device_init(void)
-+static int applesmc_device_init(int resume)
- {
- int total;
- int ret = -ENXIO;
-@@ -549,17 +599,21 @@ static int applesmc_device_init(void)
- goto out;
- }
-
-- ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler, IRQF_DISABLED,
-- "applesmc_irq_handler", NULL);
-+ if (!resume) {
-+ ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler,
-+ IRQF_DISABLED, "applesmc_irq_handler",
-+ NULL);
-
-- if (ret1) {
-- printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-- }
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup "
-+ "irq handler\n");
-+ }
-
-- printk(KERN_DEBUG "applesmc: accelerometer "
-+ printk(KERN_DEBUG "applesmc: accelerometer "
- "successfully initialized.\n");
-- ret = 0;
-+ }
-
-+ ret = 0;
- out:
- mutex_unlock(&applesmc_lock);
- return ret;
-@@ -590,7 +644,7 @@ static int applesmc_probe(struct platform_device *dev)
- {
- int ret;
-
-- ret = applesmc_device_init();
-+ ret = applesmc_device_init(0);
- if (ret)
- return ret;
-
-@@ -600,7 +654,7 @@ static int applesmc_probe(struct platform_device *dev)
-
- static int applesmc_resume(struct platform_device *dev)
- {
-- return applesmc_device_init();
-+ return applesmc_device_init(1);
- }
-
- static int applesmc_remove(struct platform_device *dev)
-@@ -897,6 +951,46 @@ static ssize_t applesmc_calibrate_store(struct device *dev,
- return count;
- }
-
-+#ifdef APPLESMC_PROTECT
-+static ssize_t applesmc_protect_device_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ char b[BDEVNAME_SIZE];
-+
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", bdevname(bdev_protect, b));
-+}
-+
-+static ssize_t applesmc_protect_device_store(struct device *dev,
-+ struct device_attribute *attr, const char *sysfsbuf, size_t count)
-+{
-+ char b[BDEVNAME_SIZE];
-+ struct block_device *bdev;
-+
-+ if (bdev_protect)
-+ bdput(bdev_protect);
-+
-+ bdev = lookup_bdev(sysfsbuf);
-+
-+ if (IS_ERR(bdev)) {
-+ bdev_protect = NULL;
-+ return -EIO; /* Could be more precise? */
-+ }
-+
-+ if (bdev->bd_disk && bdev->bd_disk->queue
-+ && bdev->bd_disk->queue->issue_protect_fn) {
-+ bdev_protect = bdev;
-+ printk(KERN_INFO "applesmc: accelerometer will now "
-+ "protect %s.\n", bdevname(bdev, b));
-+ return count;
-+ }
-+ else {
-+ bdput(bdev);
-+ bdev_protect = NULL;
-+ return -EIO; /* Could be more precise? */
-+ }
-+}
-+#endif
-+
- /* Store the next backlight value to be written by the work */
- static unsigned int backlight_value;
-
-@@ -1201,6 +1295,10 @@ 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);
-+#ifdef APPLESMC_PROTECT
-+static DEVICE_ATTR(protect_device, 0644,
-+ applesmc_protect_device_show, applesmc_protect_device_store);
-+#endif
- static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
- applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
- static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-@@ -1213,6 +1311,9 @@ static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+#ifdef APPLESMC_PROTECT
-+ &dev_attr_protect_device.attr,
-+#endif
- &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
- &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
- &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-@@ -1453,6 +1554,10 @@ static int applesmc_create_accelerometer(void)
- {
- struct input_dev *idev;
- int ret;
-+#ifdef APPLESMC_PROTECT
-+ char b[BDEVNAME_SIZE];
-+ int major, minor;
-+#endif
-
- ret = sysfs_create_group(&pdev->dev.kobj,
- &accelerometer_attributes_group);
-@@ -1486,6 +1591,30 @@ static int applesmc_create_accelerometer(void)
- if (ret)
- goto out_idev;
-
-+#ifdef APPLESMC_PROTECT
-+ /* Try to find a suitable block device to protect */
-+ bdev_protect = NULL;
-+ major = SCSI_DISK0_MAJOR;
-+
-+ /* Iterate over a maximum of 16 SCSI devices to find one that
-+ * can be protected.
-+ * Note: other devices could also be protected. */
-+ for (minor = 0; minor < 256; minor += 16) {
-+ dev_t dev = MKDEV(major, minor);
-+ struct block_device *bdev = bdget(dev);
-+ if (bdev->bd_disk && bdev->bd_disk->queue
-+ && bdev->bd_disk->queue->issue_protect_fn) {
-+ bdev_protect = bdev;
-+ printk(KERN_INFO "applesmc: accelerometer "
-+ "will protect %s (%d:%d).\n",
-+ bdevname(bdev, b),
-+ major, minor);
-+ break;
-+ }
-+ bdput(bdev);
-+ }
-+#endif
-+
- return 0;
-
- out_idev:
-@@ -1505,6 +1634,12 @@ static void applesmc_release_accelerometer(void)
- input_unregister_polled_device(applesmc_idev);
- input_free_polled_device(applesmc_idev);
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
-+#ifdef APPLESMC_PROTECT
-+ if (bdev_protect) {
-+ bdput(bdev_protect);
-+ bdev_protect = NULL;
-+ }
-+#endif
- }
-
- static __initdata struct dmi_match_data applesmc_dmi_data[] = {
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-remove-debugging-messages.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-remove-debugging-messages.patch
deleted file mode 100644
index a499386..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-remove-debugging-messages.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-commit d6a5b9228b0d64168f88bb8d906a2040daca74f5
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Remove debugging messages.
----
-
- drivers/hwmon/applesmc.c | 24 ++++++++++--------------
- 1 files changed, 10 insertions(+), 14 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 489432f..1dcebb1 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -133,7 +133,8 @@ struct dmi_match_data {
- int temperature_set;
- };
-
--static const int debug;
-+static int debug = 0;
-+module_param(debug, int, S_IRUGO|S_IWUSR);
- static struct platform_device *pdev;
- static s16 rest_x;
- static s16 rest_y;
-@@ -172,7 +173,7 @@ static int __wait_status(u8 val)
-
- for (i = 0; i < 200; i++) {
- if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == val) {
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG
- "Waited %d us for status %x\n",
- i*10, val);
-@@ -181,7 +182,8 @@ static int __wait_status(u8 val)
- udelay(10);
- }
-
-- printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
-+ if (debug >= 1)
-+ printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
- val, inb(APPLESMC_CMD_PORT));
-
- return -EIO;
-@@ -219,11 +221,11 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- goto wait_fail;
- }
- }
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "<%s", key);
-
- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG ">%x", len);
-
- for (i = 0; i < len; i++) {
-@@ -232,22 +234,16 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- goto wait_fail;
- }
- buffer[i] = inb(APPLESMC_DATA_PORT);
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "<%x", buffer[i]);
- }
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "\n");
-
- break;
-
- wait_fail:
- msleep(ACCESS_WAIT_MSECS);
-- continue;
-- }
--
-- if (total != ACCESS_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-- ACCESS_TIMEOUT_MSECS-total);
- }
-
- return ret;
-@@ -399,7 +395,7 @@ static int applesmc_device_init(void)
- mutex_lock(&applesmc_lock);
-
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "applesmc try %d\n", total);
- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-retry-when-accessing-keys.patch
deleted file mode 100644
index 9eb7d25..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc-retry-when-accessing-keys.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-commit f9b12606e452b43114836f7a75e6ed41738d78dc
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Retry up to 200 ms when reading or writing keys.
----
-
- drivers/hwmon/applesmc.c | 69 +++++++++++++++++++++++++++++++---------------
- 1 files changed, 47 insertions(+), 22 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index aacc0c4..489432f 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -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 */
-
-+#define ACCESS_TIMEOUT_MSECS 500 /* wait up to 500ms when accessing a key */
-+#define ACCESS_WAIT_MSECS 5 /* ... in 5ms increments */
-+
- #define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-@@ -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.
-+ * Tries up to ACCESS_WAIT_MSECS to read the value.
- * Returns zero on success or a negative error on failure. Callers must
- * hold applesmc_lock.
- */
- static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- {
-- int i;
-+ int i, total, ret;
-
- if (len > APPLESMC_MAX_DATA_LENGTH) {
- printk(KERN_ERR "applesmc_read_key: cannot read more than "
-@@ -199,33 +203,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- return -EINVAL;
- }
-
-- outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-- if (__wait_status(0x0c))
-- return -EIO;
-+ for (total = ACCESS_TIMEOUT_MSECS; total > 0;
-+ total -= ACCESS_WAIT_MSECS) {
-+ ret = 0;
-+ outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-+ if (__wait_status(0x0c)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-
-- for (i = 0; i < 4; i++) {
-- outb(key[i], APPLESMC_DATA_PORT);
-- if (__wait_status(0x04))
-- return -EIO;
-- }
-- if (debug)
-- printk(KERN_DEBUG "<%s", key);
-+ for (i = 0; i < 4; i++) {
-+ outb(key[i], APPLESMC_DATA_PORT);
-+ if (__wait_status(0x04)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ }
-+ if (debug)
-+ printk(KERN_DEBUG "<%s", key);
-
-- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-- printk(KERN_DEBUG ">%x", len);
-+ outb(len, APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG ">%x", len);
-
-- for (i = 0; i < len; i++) {
-- if (__wait_status(0x05))
-- return -EIO;
-- buffer[i] = inb(APPLESMC_DATA_PORT);
-+ for (i = 0; i < len; i++) {
-+ if (__wait_status(0x05)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ buffer[i] = inb(APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG "<%x", buffer[i]);
-+ }
- if (debug)
-- printk(KERN_DEBUG "<%x", buffer[i]);
-+ printk(KERN_DEBUG "\n");
-+
-+ break;
-+
-+wait_fail:
-+ msleep(ACCESS_WAIT_MSECS);
-+ continue;
- }
-- if (debug)
-- printk(KERN_DEBUG "\n");
-
-- return 0;
-+ if (total != ACCESS_TIMEOUT_MSECS) {
-+ printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-+ ACCESS_TIMEOUT_MSECS-total);
-+ }
-+
-+ return ret;
- }
-
- /*
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc_int.patch
deleted file mode 100644
index 32ef2d6..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/applesmc_int.patch
+++ /dev/null
@@ -1,424 +0,0 @@
-commit 04ae6b26f11c2ad146c2f2229a3d2500b11becb7
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
----
-
- drivers/hwmon/applesmc.c | 322 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 298 insertions(+), 24 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 1dcebb1..4980338 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -39,14 +39,20 @@
- #include <linux/leds.h>
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
-+#include <linux/interrupt.h>
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
- /* command/status port used by Apple SMC */
- #define APPLESMC_CMD_PORT 0x304
-+/* status port used by Apple SMC to get which interrupt type just happened */
-+#define APPLESMC_INT_PORT 0x31f
-
- #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */
-
-+/* Defined in ACPI DSDT table, should we read it from there? */
-+#define APPLESMC_IRQ 6
-+
- #define APPLESMC_MAX_DATA_LENGTH 32
-
- #define APPLESMC_STATUS_MASK 0x0f
-@@ -57,6 +63,8 @@
-
- #define KEY_COUNT_KEY "#KEY" /* r-o ui32 */
-
-+#define INTERRUPT_OK_KEY "NTOK" /* w-o ui8 */
-+
- #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) */
-@@ -68,6 +76,19 @@
- #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-
-+/*
-+ * Interrupt controls.
-+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
-+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than the
-+ * value of MOLD (or MOHD), SMC will trigger an interrupt.
-+ */
-+#define MOTION_LOW_NORM "MOLT" /* r/w sp78 (2 bytes) */
-+#define MOTION_HIGH_NORM "MOHT" /* r/w sp78 (2 bytes) */
-+#define MOTION_LOW_NORM_INTERVAL "MOLD" /* r/w ui8 */
-+#define MOTION_HIGH_NORM_INTERVAL "MOHD" /* r/w ui8 */
-+
-+#define MSDW_KEY "MSDW" /* r/w flag (1 byte) */
-+
- #define FANS_COUNT "FNum" /* r-o ui8 */
- #define FANS_MANUAL "FS! " /* r-w ui16 */
- #define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -381,12 +402,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * buffer, if not, writes these bytes.
-+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
-+ * waited more than INIT_TIMEOUT_MSECS in total.
-+ * Returns zero on success or a negative error on failure. Callers must
-+ * hold applesmc_lock.
-+ */
-+static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
-+{
-+ int total, ret, i, compare;
-+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
-+
-+ if (len > APPLESMC_MAX_DATA_LENGTH) {
-+ printk(KERN_ERR "applesmc_init_check_key_value: cannot "
-+ "read/write more than %d bytes",
-+ APPLESMC_MAX_DATA_LENGTH);
-+ return -EINVAL;
-+ }
-+
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret = applesmc_read_key(key, rdbuffer, len);
-+ if (!ret) {
-+ compare = 1;
-+ for (i = 0; i < len; i++) {
-+ if (rdbuffer[i] != buffer[i]) {
-+ compare = 0;
-+ break;
-+ }
-+ }
-+
-+ if (compare) {
-+ return 0;
-+ }
-+ }
-+ ret = applesmc_write_key(key, buffer, len);
-+ msleep(INIT_WAIT_MSECS);
-+ }
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return -EIO;
-+}
-+
-+irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
-+{
-+ u8 int_type = inb(APPLESMC_INT_PORT);
-+
-+ switch (int_type) {
-+ case 0x60:
-+ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
-+ break;
-+ case 0x6f:
-+ printk(KERN_INFO
-+ "applesmc: received a high acceleration interrupt\n");
-+ break;
-+ case 0x80:
-+ printk(KERN_INFO "applesmc: received a shock interrupt\n");
-+ break;
-+ default:
-+ printk(KERN_INFO
-+ "applesmc: received an unknown interrupt %x\n",
-+ int_type);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
- */
- static int applesmc_device_init(void)
- {
-- int total, ret = -ENXIO;
-+ int total;
-+ int ret = -ENXIO;
-+ int ret1, ret2;
- u8 buffer[2];
-
- if (!applesmc_accelerometer)
-@@ -394,32 +486,79 @@ static int applesmc_device_init(void)
-
- mutex_lock(&applesmc_lock);
-
-+ /* Accept interrupts */
-+ buffer[0] = 0x01;
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug >= 9)
-- printk(KERN_DEBUG "applesmc try %d\n", total);
-- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
-- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
-- if (total == INIT_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "applesmc: device has"
-- " already been initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- } else {
-- printk(KERN_DEBUG "applesmc: device"
-- " successfully initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- }
-- ret = 0;
-- goto out;
-- }
-- buffer[0] = 0xe0;
-- buffer[1] = 0x00;
-- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
-+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set NTOK key, "
-+ "will not receive interrupts.\n");
-+
-+ /* Setup interrupt controls. */
-+ buffer[0] = 20; /* 20 msecs */
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ buffer[0] = 20; /* 20 msecs */
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "interrupt interval, might not receive "
-+ "some interrupts.");
-+ }
-+
-+ buffer[0] = 0x00;
-+ buffer[1] = 0x60;
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM, buffer, 2);
-+
-+ buffer[0] = 0x01;
-+ buffer[1] = 0xc0;
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM, buffer, 2);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
-+ }
-+
-+ /* Mysterious key. */
-+ buffer[0] = 0x01;
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set MSDW key\n");
-+
-+ /* Initialize the device. */
-+ buffer[0] = 0xe0;
-+ buffer[1] = 0xf8;
-+ if (applesmc_init_check_key_value(MOTION_SENSOR_KEY, buffer, 2)) {
-+ 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);
-+
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-+ }
-+
-+ printk(KERN_DEBUG "applesmc: accelerometer "
-+ "successfully initialized.\n");
-+ ret = 0;
-
- out:
- mutex_unlock(&applesmc_lock);
-@@ -464,9 +603,16 @@ static int applesmc_resume(struct platform_device *dev)
- return applesmc_device_init();
- }
-
-+static int applesmc_remove(struct platform_device *dev)
-+{
-+ free_irq(APPLESMC_IRQ, NULL);
-+ return 0;
-+}
-+
- static struct platform_driver applesmc_driver = {
- .probe = applesmc_probe,
- .resume = applesmc_resume,
-+ .remove = applesmc_remove,
- .driver = {
- .name = "applesmc",
- .owner = THIS_MODULE,
-@@ -774,7 +920,7 @@ static void applesmc_brightness_set(struct led_classdev *led_cdev,
- backlight_value = value;
- ret = queue_work(applesmc_led_wq, &backlight_work);
-
-- if (debug && (!ret))
-+ if ((debug >= 9) && (!ret))
- printk(KERN_DEBUG "applesmc: work was already on the queue.\n");
- }
-
-@@ -928,6 +1074,122 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
- return count;
- }
-
-+static ssize_t applesmc_accelerometer_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ int ret;
-+ unsigned int value = 0;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk(KERN_ERR
-+ "Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_read_key(key, buffer, length);
-+ if (length == 2)
-+ value = ((unsigned int)buffer[0] << 8) | buffer[1];
-+ else if (length == 1)
-+ value = buffer[0];
-+ else {
-+ printk("Invalid length for applesmc_param_show");
-+ ret = -EINVAL;
-+ }
-+
-+ mutex_unlock(&applesmc_lock);
-+ if (ret)
-+ return ret;
-+ else
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", value);
-+}
-+
-+static ssize_t applesmc_accelerometer_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *sysfsbuf, size_t count)
-+{
-+ int ret;
-+ u32 value;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ value = simple_strtoul(sysfsbuf, NULL, 10);
-+
-+ if (length == 2) {
-+ if (value > 0xffff)
-+ return -EINVAL;
-+
-+ buffer[0] = (value >> 8) & 0xff;
-+ buffer[1] = value & 0xff;
-+ } else if (length == 1) {
-+ if (value > 0xff)
-+ return -EINVAL;
-+
-+ buffer[0] = value & 0xff;
-+ } else {
-+ printk("Invalid length for applesmc_param_store");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_write_key(key, buffer, length);
-+
-+ mutex_unlock(&applesmc_lock);
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return count;
-+}
- static struct led_classdev applesmc_backlight = {
- .name = "smc::kbd_backlight",
- .default_trigger = "nand-disk",
-@@ -939,10 +1201,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);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 1);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 2);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 3);
-
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+ &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger_interval.dev_attr.attr,
- NULL
- };
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/appletouch-new.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/appletouch-new.patch
deleted file mode 100644
index cd9f6a2..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/appletouch-new.patch
+++ /dev/null
@@ -1,358 +0,0 @@
-commit 60ef60451a5cd0ed62770ce2d1965a7cc48b7a89
-
-From: Sven Anders <anders@anduras.de>
-
-
----
-
- drivers/input/mouse/appletouch.c | 152 ++++++++++++++++++++++++++++----------
- 1 files changed, 113 insertions(+), 39 deletions(-)
-
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index 8dd3942..b42c1ed 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,10 +61,11 @@
- * 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 0x022B
-@@ -77,15 +81,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) },
-@@ -97,6 +103,7 @@ 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) },
-@@ -144,12 +151,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 ? */
-@@ -164,8 +180,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) \
-@@ -182,8 +198,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");
-
- /*
-@@ -193,7 +213,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");
-
-@@ -211,12 +231,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);
-
-@@ -240,7 +260,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,
-@@ -248,6 +268,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;
-@@ -263,6 +290,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;
-@@ -280,8 +314,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);
-@@ -396,7 +429,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));
-
- /*
-@@ -453,13 +486,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 */
-@@ -485,26 +525,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;
-@@ -549,16 +610,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:
-@@ -626,7 +699,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;
-@@ -669,7 +742,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
- */
-@@ -712,6 +785,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/2.6.25-mactel-patches-r156/appletouch.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/appletouch.patch
deleted file mode 100644
index f4d9ad7..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/appletouch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-commit 19637bc6b985ac81c61e217f61dd49d1302ac81f
-
-From: Ortwin Glück <odi@odi.ch>
-
-Appletouch driver ATP_THRESHOLD fix.
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index b42c1ed..805cc5e 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -142,7 +142,7 @@ MODULE_DEVICE_TABLE (usb, atp_table);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 5
-+#define ATP_THRESHOLD 3
-
- /* Geyser initialization constants */
- #define ATP_GEYSER_MODE_READ_REQUEST_ID 1
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-2.6.25.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-2.6.25.patch
deleted file mode 100644
index be58bde..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-2.6.25.patch
+++ /dev/null
@@ -1,945 +0,0 @@
-commit beb2164499afdd131e94469e6f8803cc43aec345
-
-From: Elias Oltmanns <eo@>
-
-http://article.gmane.org/gmane.linux.drivers.hdaps.devel/1245
-
- Here is the updated patch. Unfortunately, I still experience the same
- hangs on 2.6.25-rc9 as I do on 2.6.24.x, so I still have to apply the
- patch [1] I posted as a work around at the time.
-
- Have fun,
-
- Elias
-
- [1] http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/2008-February/042226.html
----
-
- Documentation/block/disk-protection.txt | 79 ++++++++++++++
- block/blk-core.c | 41 +++++++
- block/blk-settings.c | 22 ++++
- block/blk-sysfs.c | 168 ++++++++++++++++++++++++++++++
- block/blk.h | 3 +
- drivers/ata/libata-scsi.c | 36 +++++++
- drivers/ide/ide-disk.c | 145 ++++++++++++++++++++++++++
- drivers/ide/ide-io.c | 14 +++
- drivers/scsi/scsi_lib.c | 171 +++++++++++++++++++++++++++++++
- include/linux/ata.h | 12 ++
- include/linux/blkdev.h | 14 +++
- include/linux/ide.h | 1
- 12 files changed, 703 insertions(+), 3 deletions(-)
- create mode 100644 Documentation/block/disk-protection.txt
-
-
-diff --git a/Documentation/block/disk-protection.txt b/Documentation/block/disk-protection.txt
-new file mode 100644
-index 0000000..3fc4c16
---- /dev/null
-+++ b/Documentation/block/disk-protection.txt
-@@ -0,0 +1,79 @@
-+Hard disk protection
-+====================
-+
-+
-+Intro
-+-----
-+ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with UNLOAD FEATURE.
-+Issuing this command should cause the drive to switch to idle mode and
-+unload disk heads. This feature is being used in modern laptops in
-+conjunction with accelerometers and appropriate software to implement
-+a shock protection facility. The idea is to stop all I/O operations on
-+the internal hard drive and park its heads on the ramp when critical
-+situations are anticipated. The desire to have such a feature
-+available on GNU/Linux systems has been the original motivation to
-+implement a generic disk parking interface in the Linux kernel.
-+
-+
-+The interface
-+-------------
-+The interface works as follows: Writing an integer value to
-+/sys/block/*/queue/protect will park the respective drive and freeze
-+the block layer queue for the specified number of seconds. When the
-+timeout expires and no further disk park request has been issued in
-+the meantime, the queue is unfrozen and accumulated I/O operations are
-+performed.
-+
-+IMPORTANT NOTE:
-+Not all ATA drives implement IDLE IMMEDIATE with UNLOAD FEATURE and
-+quite a few of those that do so, don't report this capability as
-+described in the specs. When a disk park has been requested through
-+sysfs as described above, the kernel will try to determine if the
-+drive supports the UNLOAD FEATURE by default. The kernel will only
-+rely on the IDLE IMMEDIATE with UNLOAD FEATURE command if it is
-+convinced that this command is actually supported by the disk drive;
-+otherwise, it will fall back to STANDBY IMMEDIATE. Resuming from the
-+latter will take much longer and it is generally more likely to have a
-+negative impact on the drive's lifetime due to the inclease of spin
-+down and up cycles. If you want to use this interface in a shock
-+protection framework and you know that your drive does indeed support
-+the IDLE IMMEDIATE with UNLOAD FEATURE command despite not saying so,
-+you can force the kernel to issue that command by doing the following
-+on the command line:
-+# echo -n unload > /sys/block/sda/queue/protect_method
-+(replace sda by the drive identifier as appropriate).
-+
-+/sys/block/*/queue/protect_method accepts auto, unload and standby
-+respectively. Reading from protect_method shows the available options
-+surrounding the active one with brackets. When auto is active, this
-+will change to whatever the kernel sees fit after the next disk park
-+command has been issued.
-+
-+
-+References
-+----------
-+
-+There are several laptops from different brands featuring shock
-+protection capabilities. As manufacturers have refused to support open
-+source development of the required software components so far, Linux
-+support for shock protection varies considerably between different
-+hardware implementations. Ideally, this section should contain a list
-+of poiters at different projects aiming at an implementation of shock
-+protection on different systeems. Unfortunately, I only know of a
-+single project which, although still considered experimental, is fit
-+for use. Please feel free to add projects that have been the victims
-+of my ignorance.
-+
-+- http://www.thinkwiki.org/wiki/HDAPS
-+ See this page for information about Linux support of the hard disk
-+ active protection syystem as implemented in IBM/Lenovo Thinkpads.
-+
-+
-+CREDITS
-+-------
-+
-+The patch to implement the interface described in this file has
-+originally been published by Jon Escombe <lists@...>.
-+
-+
-+05 Dec 2006, Elias Oltmanns <eo@...>
-diff --git a/block/blk-core.c b/block/blk-core.c
-index 2a438a9..5affbf3 100644
---- a/block/blk-core.c
-+++ b/block/blk-core.c
-@@ -320,6 +320,46 @@ void blk_unplug(struct request_queue *q)
- }
- EXPORT_SYMBOL(blk_unplug);
-
-+/*
-+ * Issue lower level unprotect function if no timers are pending.
-+ */
-+void blk_unfreeze_work(struct work_struct *work)
-+{
-+ struct request_queue *q = container_of(work, struct request_queue, unfreeze_work);
-+ int pending;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ pending = timer_pending(&q->unfreeze_timer);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ if (!pending)
-+ q->issue_unprotect_fn(q);
-+}
-+
-+/*
-+ * Called when the queue freeze timeout expires...
-+ */
-+void blk_unfreeze_timeout(unsigned long data)
-+{
-+ struct request_queue *q = (struct request_queue *) data;
-+
-+ kblockd_schedule_work(&q->unfreeze_work);
-+}
-+
-+/*
-+ * The lower level driver parks and freezes the queue, and this block layer
-+ * function sets up the freeze timeout timer on return. If the queue is
-+ * already frozen then this is called to extend the timer...
-+ */
-+void blk_freeze_queue(struct request_queue *q, int seconds)
-+{
-+ /* Don't accept arbitrarily long freezes */
-+ if (seconds >= q->max_unfreeze)
-+ seconds = q->max_unfreeze;
-+ /* set/reset the timer */
-+ mod_timer(&q->unfreeze_timer, msecs_to_jiffies(seconds*1000) + jiffies);
-+}
-+
- /**
- * blk_start_queue - restart a previously stopped queue
- * @q: The &struct request_queue in question
-@@ -482,6 +522,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
- }
-
- init_timer(&q->unplug_timer);
-+ init_timer(&q->unfreeze_timer);
-
- kobject_init(&q->kobj, &blk_queue_ktype);
-
-diff --git a/block/blk-settings.c b/block/blk-settings.c
-index 5713f7e..b4dfa5d 100644
---- a/block/blk-settings.c
-+++ b/block/blk-settings.c
-@@ -112,6 +112,16 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
- q->unplug_timer.function = blk_unplug_timeout;
- q->unplug_timer.data = (unsigned long)q;
-
-+ q->max_unfreeze = 30;
-+
-+ INIT_WORK(&q->unfreeze_work, blk_unfreeze_work);
-+
-+ q->unfreeze_timer.function = blk_unfreeze_timeout;
-+ q->unfreeze_timer.data = (unsigned long)q;
-+
-+ /* Set protect_method to auto detection initially */
-+ q->protect_method = 2;
-+
- /*
- * by default assume old behaviour and bounce for any highmem page
- */
-@@ -119,6 +129,18 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
- }
- EXPORT_SYMBOL(blk_queue_make_request);
-
-+void blk_queue_issue_protect_fn(struct request_queue *q, issue_protect_fn *ipf)
-+{
-+ q->issue_protect_fn = ipf;
-+}
-+EXPORT_SYMBOL(blk_queue_issue_protect_fn);
-+
-+void blk_queue_issue_unprotect_fn(struct request_queue *q, issue_unprotect_fn *iuf)
-+{
-+ q->issue_unprotect_fn = iuf;
-+}
-+EXPORT_SYMBOL(blk_queue_issue_unprotect_fn);
-+
- /**
- * blk_queue_bounce_limit - set bounce buffer limit for queue
- * @q: the request queue for the device
-diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
-index 54d0db1..d901003 100644
---- a/block/blk-sysfs.c
-+++ b/block/blk-sysfs.c
-@@ -270,6 +270,160 @@ struct kobj_type blk_queue_ktype = {
- .release = blk_release_queue,
- };
-
-+/*
-+ * When reading the 'protect' attribute, we return seconds remaining
-+ * before unfreeze timeout expires
-+ */
-+static ssize_t queue_protect_show(struct request_queue *q, char *page)
-+{
-+ unsigned int seconds = 0;
-+
-+ spin_lock_irq(q->queue_lock);
-+ if (blk_queue_stopped(q) && timer_pending(&q->unfreeze_timer))
-+ /*
-+ * Adding 1 in order to guarantee nonzero value until timer
-+ * has actually expired.
-+ */
-+ seconds = jiffies_to_msecs(q->unfreeze_timer.expires
-+ - jiffies) / 1000 + 1;
-+ spin_unlock_irq(q->queue_lock);
-+ return queue_var_show(seconds, (page));
-+}
-+
-+/*
-+ * When writing the 'protect' attribute, input is the number of seconds
-+ * to freeze the queue for. We call a lower level helper function to
-+ * park the heads and freeze/block the queue, then we make a block layer
-+ * call to setup the thaw timeout. If input is 0, then we thaw the queue.
-+ */
-+static ssize_t queue_protect_store(struct request_queue *q,
-+ const char *page, size_t count)
-+{
-+ unsigned long freeze = 0;
-+
-+ queue_var_store(&freeze, page, count);
-+
-+ if (freeze>0) {
-+ /* Park and freeze */
-+ if (!blk_queue_stopped(q))
-+ q->issue_protect_fn(q);
-+ /* set / reset the thaw timer */
-+ spin_lock_irq(q->queue_lock);
-+ blk_freeze_queue(q, freeze);
-+ spin_unlock_irq(q->queue_lock);
-+ } else {
-+ spin_lock_irq(q->queue_lock);
-+ freeze = del_timer(&q->unfreeze_timer);
-+ spin_unlock_irq(q->queue_lock);
-+ if (freeze)
-+ q->issue_unprotect_fn(q);
-+ }
-+
-+ return count;
-+}
-+
-+static ssize_t
-+queue_str_show(char *page, char *str, int status)
-+{
-+ ssize_t len;
-+
-+ if (status & 1)
-+ len = sprintf(page, "[%s]", str);
-+ else
-+ len = sprintf(page, "%s", str);
-+ if (status & 2)
-+ len += sprintf(page+len, "\n");
-+ else
-+ len += sprintf(page+len, " ");
-+ return len;
-+}
-+
-+/*
-+ * Returns current protect_method.
-+ */
-+static ssize_t queue_protect_method_show(struct request_queue *q, char *page)
-+{
-+ int len = 0;
-+ int unload = q->protect_method;
-+
-+ len += queue_str_show(page+len, "auto", (unload & 2) >> 1);
-+ len += queue_str_show(page+len, "unload", unload & 1);
-+ len += queue_str_show(page+len, "standby", !unload ? 3 : 2);
-+ return len;
-+}
-+
-+/*
-+ * Stores the device protect method.
-+ */
-+static ssize_t queue_protect_method_store(struct request_queue *q,
-+ const char *page, size_t count)
-+{
-+ spin_lock_irq(q->queue_lock);
-+ if (!strcmp(page, "auto") || !strcmp(page, "auto\n"))
-+ q->protect_method = 2;
-+ else if (!strcmp(page, "unload") || !strcmp(page, "unload\n"))
-+ q->protect_method = 1;
-+ else if (!strcmp(page, "standby") || !strcmp(page, "standby\n"))
-+ q->protect_method = 0;
-+ else {
-+ spin_unlock_irq(q->queue_lock);
-+ return -EINVAL;
-+ }
-+ spin_unlock_irq(q->queue_lock);
-+ return count;
-+}
-+
-+static struct queue_sysfs_entry queue_protect_entry = {
-+ .attr = { .name = "protect", .mode = S_IRUGO | S_IWUSR },
-+ .show = queue_protect_show,
-+ .store = queue_protect_store,
-+};
-+static struct queue_sysfs_entry queue_protect_method_entry = {
-+ .attr = { .name = "protect_method", .mode = S_IRUGO | S_IWUSR },
-+ .show = queue_protect_method_show,
-+ .store = queue_protect_method_store,
-+};
-+
-+static int blk_protect_register(struct request_queue *q)
-+{
-+ int error = 0;
-+
-+ /* check that the lower level driver has a protect handler */
-+ if (!q->issue_protect_fn)
-+ return 0;
-+
-+ /* create the attributes */
-+ error = sysfs_create_file(&q->kobj, &queue_protect_entry.attr);
-+ if (error) {
-+ printk(KERN_ERR
-+ "blk_protect_register(): failed to create protect queue attribute!\n");
-+ return error;
-+ }
-+
-+ error = sysfs_create_file(&q->kobj, &queue_protect_method_entry.attr);
-+ if (error) {
-+ sysfs_remove_file(&q->kobj, &queue_protect_entry.attr);
-+ printk(KERN_ERR
-+ "blk_protect_register(): failed to create protect_method attribute!\n");
-+ return error;
-+ }
-+ kobject_get(&q->kobj);
-+
-+ return 0;
-+}
-+
-+static void blk_protect_unregister(struct request_queue *q)
-+{
-+ /* check that the lower level driver has a protect handler */
-+ if (!q->issue_protect_fn)
-+ return;
-+
-+ /* remove the attributes */
-+ sysfs_remove_file(&q->kobj, &queue_protect_method_entry.attr);
-+ sysfs_remove_file(&q->kobj, &queue_protect_entry.attr);
-+ kobject_put(&q->kobj);
-+}
-+
- int blk_register_queue(struct gendisk *disk)
- {
- int ret;
-@@ -287,13 +441,20 @@ int blk_register_queue(struct gendisk *disk)
- kobject_uevent(&q->kobj, KOBJ_ADD);
-
- ret = elv_register_queue(q);
-+ if (ret)
-+ goto err;
-+ ret = blk_protect_register(q);
- if (ret) {
-- kobject_uevent(&q->kobj, KOBJ_REMOVE);
-- kobject_del(&q->kobj);
-- return ret;
-+ elv_unregister_queue(q);
-+ goto err;
- }
-
- return 0;
-+
-+err:
-+ kobject_uevent(&q->kobj, KOBJ_REMOVE);
-+ kobject_del(&q->kobj);
-+ return ret;
- }
-
- void blk_unregister_queue(struct gendisk *disk)
-@@ -301,6 +462,7 @@ void blk_unregister_queue(struct gendisk *disk)
- struct request_queue *q = disk->queue;
-
- if (q && q->request_fn) {
-+ blk_protect_unregister(q);
- elv_unregister_queue(q);
-
- kobject_uevent(&q->kobj, KOBJ_REMOVE);
-diff --git a/block/blk.h b/block/blk.h
-index ec9120f..98d0f87 100644
---- a/block/blk.h
-+++ b/block/blk.h
-@@ -18,6 +18,9 @@ void __blk_queue_free_tags(struct request_queue *q);
-
- void blk_unplug_work(struct work_struct *work);
- void blk_unplug_timeout(unsigned long data);
-+void blk_unfreeze_work(struct work_struct *work);
-+void blk_unfreeze_timeout(unsigned long data);
-+void blk_freeze_queue(struct request_queue *q, int seconds);
-
- struct io_context *current_io_context(gfp_t gfp_flags, int node);
-
-diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
-index 1579539..54c1ad2 100644
---- a/drivers/ata/libata-scsi.c
-+++ b/drivers/ata/libata-scsi.c
-@@ -905,6 +905,38 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
- return 0;
- }
-
-+extern int scsi_protect_queue(struct request_queue *q, int unload);
-+extern int scsi_unprotect_queue(struct request_queue *q);
-+
-+static int ata_scsi_issue_protect_fn(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+ struct ata_port *ap = ata_shost_to_port(sdev->host);
-+ struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
-+ int unload = q->protect_method;
-+ unsigned long flags;
-+
-+ if (!dev) {
-+ printk(KERN_DEBUG "ata_scsi_issue_protect_fn(): Couldn't find ATA device to be parked.\n");
-+ return -ENXIO;
-+ }
-+
-+ if (unload == 2) {
-+ unload = ata_id_has_unload(dev->id) ? 1 : 0;
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ q->protect_method = unload;
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ }
-+
-+ /* call scsi_protect_queue, requesting either unload or standby */
-+ return scsi_protect_queue(q, unload);
-+}
-+
-+static int ata_scsi_issue_unprotect_fn(struct request_queue *q)
-+{
-+ return scsi_unprotect_queue(q);
-+}
-+
- /**
- * ata_scsi_slave_config - Set SCSI device attributes
- * @sdev: SCSI device to examine
-@@ -927,6 +959,10 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
-
- if (dev)
- rc = ata_scsi_dev_config(sdev, dev);
-+ blk_queue_issue_protect_fn(sdev->request_queue,
-+ ata_scsi_issue_protect_fn);
-+ blk_queue_issue_unprotect_fn(sdev->request_queue,
-+ ata_scsi_issue_unprotect_fn);
-
- return rc;
- }
-diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
-index 39501d1..feab06f 100644
---- a/drivers/ide/ide-disk.c
-+++ b/drivers/ide/ide-disk.c
-@@ -612,6 +612,148 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
- }
-
- /*
-+ * todo:
-+ * - we freeze the queue regardless of success and rely on the
-+ * ide_protect_queue function to thaw immediately if the command
-+ * failed (to be consistent with the libata handler)... should
-+ * we also inspect here?
-+ */
-+void ide_end_protect_rq(struct request *rq, int error)
-+{
-+ struct completion *waiting = rq->end_io_data;
-+
-+ rq->end_io_data = NULL;
-+ /* spin lock already accquired */
-+ if (!blk_queue_stopped(rq->q))
-+ blk_stop_queue(rq->q);
-+
-+ complete(waiting);
-+}
-+
-+int ide_unprotect_queue(struct request_queue *q)
-+{
-+ struct request rq;
-+ unsigned long flags;
-+ int pending, rc = 0;
-+ ide_drive_t *drive = q->queuedata;
-+ ide_task_t task;
-+
-+ if (!blk_queue_stopped(q))
-+ return -EIO;
-+
-+ /* Are there any pending jobs on the queue? */
-+ pending = ((q->rq.count[READ] > 0) || (q->rq.count[WRITE] > 0)) ? 1 : 0;
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ blk_start_queue(q);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+
-+ /* The unload feature of the IDLE_IMMEDIATE command
-+ temporarily disables HD power management from spinning down
-+ the disk. Any other command will reenable HD pm, so, if
-+ there are no pending jobs on the queue, another
-+ CHECK_POWER_MODE1 command without the unload feature should do
-+ just fine. */
-+ if (!pending) {
-+ printk(KERN_DEBUG "ide_unprotect_queue(): No pending I/O, re-enabling power management..\n");
-+ memset(&task, 0, sizeof(task));
-+ task.tf.command = WIN_CHECKPOWERMODE1; /* CHECK_POWER_MODE1 */
-+ task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
-+ task.data_phase = TASKFILE_NO_DATA;
-+ ide_init_drive_cmd(&rq);
-+ rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
-+ rq.special = &task;
-+ rc = ide_do_drive_cmd(drive, &rq, ide_head_wait);
-+ }
-+
-+ return rc;
-+}
-+
-+int ide_protect_queue(struct request_queue *q, int unload)
-+{
-+ ide_drive_t *drive = q->queuedata;
-+ struct request rq;
-+ ide_task_t task;
-+ int ret = 0;
-+ DECLARE_COMPLETION(wait);
-+
-+ memset(&rq, 0, sizeof(rq));
-+ memset(&task, 0, sizeof(task));
-+
-+ if (blk_queue_stopped(q))
-+ return -EIO;
-+
-+ task.data_phase = TASKFILE_NO_DATA;
-+ task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
-+ if (unload) {
-+ task.tf.command = 0xe1;
-+ task.tf.feature = 0x44;
-+ task.tf.lbal = 0x4c;
-+ task.tf.lbam = 0x4e;
-+ task.tf.lbah = 0x55;
-+ } else
-+ task.tf.command = 0xe0;
-+
-+ /* Issue the park command & freeze */
-+ ide_init_drive_cmd(&rq);
-+
-+ rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
-+ rq.special = &task;
-+ rq.end_io_data = &wait;
-+ rq.end_io = ide_end_protect_rq;
-+
-+ ret = ide_do_drive_cmd(drive, &rq, ide_next);
-+ wait_for_completion(&wait);
-+
-+ if (ret) {
-+ printk(KERN_DEBUG "ide_protect_queue(): Warning: head NOT parked!..\n");
-+ ide_unprotect_queue(q);
-+ return ret;
-+ }
-+
-+ if (unload) {
-+ if (task.tf.lbal == 0xc4)
-+ printk(KERN_DEBUG "ide_protect_queue(): head parked..\n");
-+ else {
-+ /* error parking the head */
-+ printk(KERN_DEBUG "ide_protect_queue(): head NOT parked!..\n");
-+ ret = -EIO;
-+ ide_unprotect_queue(q);
-+ }
-+ } else
-+ printk(KERN_DEBUG "ide_protect_queue(): head park not requested, used standby!..\n");
-+
-+ return ret;
-+}
-+
-+int idedisk_issue_protect_fn(struct request_queue *q)
-+{
-+ ide_drive_t *drive = q->queuedata;
-+ int unload = q->protect_method;
-+ unsigned long flags;
-+
-+ /*
-+ * Check capability of the device -
-+ * - if "idle immediate with unload" is supported we use that, else
-+ * we use "standby immediate" and live with spinning down the drive..
-+ * (Word 84, bit 13 of IDENTIFY DEVICE data)
-+ */
-+ if (unload == 2) {
-+ unload = drive->id->cfsse & (1 << 13) ? 1 : 0;
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ q->protect_method = unload;
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ }
-+
-+ return ide_protect_queue(q, unload);
-+}
-+
-+int idedisk_issue_unprotect_fn(struct request_queue *q)
-+{
-+ return ide_unprotect_queue(q);
-+}
-+
-+/*
- * This is tightly woven into the driver->do_special can not touch.
- * DON'T do it again until a total personality rewrite is committed.
- */
-@@ -877,6 +1019,9 @@ static void idedisk_setup (ide_drive_t *drive)
- drive->wcache = 1;
-
- write_cache(drive, 1);
-+
-+ blk_queue_issue_protect_fn(drive->queue, idedisk_issue_protect_fn);
-+ blk_queue_issue_unprotect_fn(drive->queue, idedisk_issue_unprotect_fn);
- }
-
- static void ide_cacheflush_p(ide_drive_t *drive)
-diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
-index 7153796..81444fe 100644
---- a/drivers/ide/ide-io.c
-+++ b/drivers/ide/ide-io.c
-@@ -1158,6 +1158,17 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
- }
-
- /*
-+ * Don't accept a request when the queue is stopped (unless we
-+ * are resuming from suspend). Prevents existing queue entries
-+ * being processed after queue is stopped by the hard disk
-+ * protection mechanism...
-+ */
-+ if (test_bit(QUEUE_FLAG_STOPPED, &drive->queue->queue_flags) && !blk_pm_resume_request(rq)) {
-+ hwgroup->busy = 0;
-+ break;
-+ }
-+
-+ /*
- * Sanity: don't accept a request that isn't a PM request
- * if we are currently power managed. This is very important as
- * blk_stop_queue() doesn't prevent the elv_next_request()
-@@ -1651,6 +1662,9 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
- where = ELEVATOR_INSERT_FRONT;
- rq->cmd_flags |= REQ_PREEMPT;
- }
-+ if (action == ide_next)
-+ where = ELEVATOR_INSERT_FRONT;
-+
- __elv_add_request(drive->queue, rq, where, 0);
- ide_do_request(hwgroup, IDE_NO_IRQ);
- spin_unlock_irqrestore(&ide_lock, flags);
-diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
-index f40898d..02238d6 100644
---- a/drivers/scsi/scsi_lib.c
-+++ b/drivers/scsi/scsi_lib.c
-@@ -2248,7 +2248,13 @@ EXPORT_SYMBOL_GPL(sdev_evt_send_simple);
- int
- scsi_device_quiesce(struct scsi_device *sdev)
- {
-+ int i;
- int err = scsi_device_set_state(sdev, SDEV_QUIESCE);
-+ for (i = 0; err && (sdev->sdev_state == SDEV_BLOCK) && (i < 100);
-+ i++) {
-+ msleep_interruptible(200);
-+ err = scsi_device_set_state(sdev, SDEV_QUIESCE);
-+ }
- if (err)
- return err;
-
-@@ -2496,3 +2502,168 @@ void scsi_kunmap_atomic_sg(void *virt)
- kunmap_atomic(virt, KM_BIO_SRC_IRQ);
- }
- EXPORT_SYMBOL(scsi_kunmap_atomic_sg);
-+
-+/*
-+ * Structure required for synchronous io completion after queue freezing
-+ */
-+struct scsi_protect_io_context_sync {
-+ struct scsi_device *sdev;
-+ int result;
-+ char *sense;
-+ struct completion *waiting;
-+};
-+
-+/*
-+ * scsi_protect_wait_done()
-+ * Command completion handler for scsi_protect_queue().
-+ *
-+ * Unable to call scsi_internal_device_block() as
-+ * scsi_end_request() already has the spinlock. So,
-+ * we put the necessary functionality inline.
-+ *
-+ * todo:
-+ * - we block the queue regardless of success and rely on the
-+ * scsi_protect_queue function to unblock if the command
-+ * failed... should we also inspect here?
-+ */
-+static void scsi_protect_wait_done(void *data, char *sense, int result, int resid)
-+{
-+ struct scsi_protect_io_context_sync *siocs = data;
-+ struct completion *waiting = siocs->waiting;
-+ struct request_queue *q = siocs->sdev->request_queue;
-+
-+ siocs->waiting = NULL;
-+ siocs->result = result;
-+ memcpy(siocs->sense, sense, SCSI_SENSE_BUFFERSIZE);
-+
-+ if (!scsi_device_set_state(siocs->sdev, SDEV_BLOCK))
-+ blk_stop_queue(q);
-+
-+ complete(waiting);
-+}
-+
-+/*
-+ * scsi_unprotect_queue()
-+ * - release the queue that was previously blocked
-+ */
-+int scsi_unprotect_queue(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+ int rc = 0, pending = 0;
-+ u8 scsi_cmd[MAX_COMMAND_SIZE];
-+ struct scsi_sense_hdr sshdr;
-+
-+ if (sdev->sdev_state != SDEV_BLOCK)
-+ return -ENXIO;
-+
-+ /* Are there any pending jobs on the queue? */
-+ pending = ((q->rq.count[READ] > 0) || (q->rq.count[WRITE] > 0)) ? 1 : 0;
-+
-+ rc = scsi_internal_device_unblock(sdev);
-+ if (rc)
-+ return rc;
-+
-+ if (!pending) {
-+ printk(KERN_DEBUG "scsi_unprotect_queue(): No pending I/O, re-enabling power management..\n");
-+
-+ memset(scsi_cmd, 0, sizeof(scsi_cmd));
-+ scsi_cmd[0] = ATA_16;
-+ scsi_cmd[1] = (3 << 1); /* Non-data */
-+ /* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
-+ scsi_cmd[14] = 0xe5; /* CHECK_POWER_MODE1 */
-+
-+ /* Good values for timeout and retries? Values below
-+ from scsi_ioctl_send_command() for default case... */
-+ if (scsi_execute_req(sdev, scsi_cmd, DMA_NONE, NULL, 0, &sshdr,
-+ (10*HZ), 5))
-+ rc = -EIO;
-+ }
-+ return rc;
-+}
-+EXPORT_SYMBOL_GPL(scsi_unprotect_queue);
-+
-+/*
-+ * scsi_protect_queue()
-+ * - build and issue the park/standby command..
-+ * - queue is blocked during command completion handler
-+ */
-+int scsi_protect_queue(struct request_queue *q, int unload)
-+{
-+ struct scsi_protect_io_context_sync siocs;
-+ struct scsi_device *sdev = q->queuedata;
-+ int rc = 0;
-+ u8 args[7];
-+ u8 scsi_cmd[MAX_COMMAND_SIZE];
-+ unsigned char sense[SCSI_SENSE_BUFFERSIZE];
-+ unsigned char *desc;
-+ DECLARE_COMPLETION_ONSTACK(wait);
-+
-+ if (sdev->sdev_state != SDEV_RUNNING)
-+ return -ENXIO;
-+
-+ memset(args, 0, sizeof(args));
-+ memset(sense, 0, sizeof(sense));
-+
-+ if (unload) {
-+ args[0] = 0xe1;
-+ args[1] = 0x44;
-+ args[3] = 0x4c;
-+ args[4] = 0x4e;
-+ args[5] = 0x55;
-+ } else
-+ args[0] = 0xe0;
-+
-+ memset(scsi_cmd, 0, sizeof(scsi_cmd));
-+ scsi_cmd[0] = ATA_16;
-+ scsi_cmd[1] = (3 << 1); /* Non-data */
-+ scsi_cmd[2] = 0x20; /* no off.line, or data xfer, request cc */
-+ scsi_cmd[4] = args[1];
-+ scsi_cmd[6] = args[2];
-+ scsi_cmd[8] = args[3];
-+ scsi_cmd[10] = args[4];
-+ scsi_cmd[12] = args[5];
-+ scsi_cmd[14] = args[0];
-+ siocs.sdev = sdev;
-+ siocs.sense = sense;
-+ siocs.waiting = &wait;
-+
-+ rc = scsi_execute_async(sdev, scsi_cmd, COMMAND_SIZE(scsi_cmd[0]),
-+ DMA_NONE, NULL, 0, 0, (10*HZ), 5,
-+ &siocs, &scsi_protect_wait_done, GFP_NOWAIT);
-+ if (rc)
-+ goto out;
-+ wait_for_completion(&wait);
-+
-+ if (siocs.result != ((DRIVER_SENSE << 24) + SAM_STAT_CHECK_CONDITION)) {
-+ printk(KERN_DEBUG "scsi_protect_queue(): head NOT parked!..\n");
-+ scsi_unprotect_queue(q); /* just in case we still managed to block */
-+ rc = -EIO;
-+ goto out;
-+ }
-+
-+ desc = sense + 8;
-+
-+ /* Retrieve data from check condition */
-+ args[1] = desc[3];
-+ args[2] = desc[5];
-+ args[3] = desc[7];
-+ args[4] = desc[9];
-+ args[5] = desc[11];
-+ args[0] = desc[13];
-+
-+ if (unload) {
-+ if (args[3] == 0xc4)
-+ printk(KERN_DEBUG "scsi_protect_queue(): head parked..\n");
-+ else {
-+ /* error parking the head */
-+ printk(KERN_DEBUG "scsi_protect_queue(): head NOT parked!..\n");
-+ rc = -EIO;
-+ scsi_unprotect_queue(q);
-+ }
-+ } else
-+ printk(KERN_DEBUG "scsi_protect_queue(): head park not requested, used standby!..\n");
-+
-+out:
-+ return rc;
-+}
-+EXPORT_SYMBOL_GPL(scsi_protect_queue);
-diff --git a/include/linux/ata.h b/include/linux/ata.h
-index 1c622e2..199a4e3 100644
---- a/include/linux/ata.h
-+++ b/include/linux/ata.h
-@@ -459,6 +459,18 @@ static inline int ata_is_data(u8 prot)
-
- #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
-
-+static inline int ata_id_has_unload(const u16 *id)
-+{
-+ /* ATA-7 specifies two places to indicate unload feature support.
-+ * Since I don't really understand the difference, I'll just check
-+ * both and only return zero if none of them indicates otherwise. */
-+ if ((id[84] & 0xC000) == 0x4000 && id[84] & (1 << 13))
-+ return id[84] & (1 << 13);
-+ if ((id[87] & 0xC000) == 0x4000)
-+ return id[87] & (1 << 13);
-+ return 0;
-+}
-+
- static inline bool ata_id_has_hipm(const u16 *id)
- {
- u16 val = id[76];
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index 6f79d40..1173d21 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -260,6 +260,8 @@ typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_ve
- typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
- typedef void (softirq_done_fn)(struct request *);
- typedef int (dma_drain_needed_fn)(struct request *);
-+typedef int (issue_protect_fn) (struct request_queue *);
-+typedef int (issue_unprotect_fn) (struct request_queue *);
-
- enum blk_queue_state {
- Queue_down,
-@@ -297,6 +299,8 @@ struct request_queue
- prepare_flush_fn *prepare_flush_fn;
- softirq_done_fn *softirq_done_fn;
- dma_drain_needed_fn *dma_drain_needed;
-+ issue_protect_fn *issue_protect_fn;
-+ issue_unprotect_fn *issue_unprotect_fn;
-
- /*
- * Dispatch queue sorting
-@@ -312,6 +316,14 @@ struct request_queue
- unsigned long unplug_delay; /* After this many jiffies */
- struct work_struct unplug_work;
-
-+ /*
-+ * Auto-unfreeze state
-+ */
-+ struct timer_list unfreeze_timer;
-+ int max_unfreeze; /* At most this many seconds */
-+ struct work_struct unfreeze_work;
-+ int protect_method;
-+
- struct backing_dev_info backing_dev_info;
-
- /*
-@@ -718,6 +730,8 @@ extern int blk_do_ordered(struct request_queue *, struct request **);
- extern unsigned blk_ordered_cur_seq(struct request_queue *);
- extern unsigned blk_ordered_req_seq(struct request *);
- extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int);
-+extern void blk_queue_issue_protect_fn(struct request_queue *, issue_protect_fn *);
-+extern void blk_queue_issue_unprotect_fn(struct request_queue *, issue_unprotect_fn *);
-
- extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
- extern void blk_dump_rq_flags(struct request *, char *);
-diff --git a/include/linux/ide.h b/include/linux/ide.h
-index bc26b2f..1eab8fe 100644
---- a/include/linux/ide.h
-+++ b/include/linux/ide.h
-@@ -837,6 +837,7 @@ extern void ide_init_drive_cmd (struct request *rq);
- */
- typedef enum {
- ide_wait, /* insert rq at end of list, and wait for it */
-+ ide_next, /* insert rq immediately after current request */
- ide_preempt, /* insert rq in front of current request */
- ide_head_wait, /* insert rq in front of current request and wait for it */
- ide_end /* insert rq at end of list, but don't wait for it */
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-fix-2.6.24-crash.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-fix-2.6.24-crash.patch
deleted file mode 100644
index f86fde6..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-fix-2.6.24-crash.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-commit 0fc6ef445d2eb106a6bd4b4b52938dbfc159c0a8
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Elias Oltmanns linux-thinkpad@linux-thinkpad.org
-
- Wed, 13 Feb 2008 12:39:17 +0100
-
- Anyway, there is a temporary solution to this problem. If you apply the
- little patch attached to this email, the usual disk-protect patch will
- work on 2.6.24. This change is supposed to fix a generic problem in
- libata and may eventually be merged upstream, but Tejun Heo (libata
- developer) said that some testing was required first.
-
- This change is absolutely safe for everyone using a non-NCQ capable
- system. In particular, ata_piix doesn't support NCQ. If you are using
- ahci and /sys/class/scsi_disk/.../device/queue_depth reports a value
- greater than 1, i.e. NCQ is enabled, then the patch shouldn't cause any
- harm either but it may or may not affect I/O performance.
-
- Enjoy,
-
- Elias
----
-
- drivers/ata/libata-scsi.c | 4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-
-diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
-index 54c1ad2..1d28f68 100644
---- a/drivers/ata/libata-scsi.c
-+++ b/drivers/ata/libata-scsi.c
-@@ -831,7 +831,7 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev)
- * prevent SCSI midlayer from automatically deferring
- * requests.
- */
-- sdev->max_device_blocked = 1;
-+ sdev->max_device_blocked = 2;
- }
-
- /**
-@@ -3242,7 +3242,7 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
- * Set host_blocked to 1 to prevent SCSI midlayer from
- * automatically deferring requests.
- */
-- shost->max_host_blocked = 1;
-+ shost->max_host_blocked = 2;
-
- rc = scsi_add_host(ap->scsi_host, ap->host->dev);
- if (rc)
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-update.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-update.patch
deleted file mode 100644
index 756fe0f..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/disk-protect-update.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-commit c78bcf2753db4c3398cdbf9262e62d7ce6fdc8f3
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Disk protect patch update.
----
-
- block/blk-core.c | 1 +
- include/linux/blkdev.h | 2 ++
- 2 files changed, 3 insertions(+), 0 deletions(-)
-
-
-diff --git a/block/blk-core.c b/block/blk-core.c
-index 5affbf3..5ae5391 100644
---- a/block/blk-core.c
-+++ b/block/blk-core.c
-@@ -359,6 +359,7 @@ void blk_freeze_queue(struct request_queue *q, int seconds)
- /* set/reset the timer */
- mod_timer(&q->unfreeze_timer, msecs_to_jiffies(seconds*1000) + jiffies);
- }
-+EXPORT_SYMBOL(blk_freeze_queue);
-
- /**
- * blk_start_queue - restart a previously stopped queue
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index 1173d21..a0a8b59 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -40,6 +40,8 @@ struct io_context *get_io_context(gfp_t gfp_flags, int node);
- struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
- void copy_io_context(struct io_context **pdst, struct io_context **psrc);
-
-+void blk_freeze_queue(struct request_queue *q, int seconds);
-+
- struct request;
- typedef void (rq_end_io_fn)(struct request *, int);
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/export-lookup_dev.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/export-lookup_dev.patch
deleted file mode 100644
index 6ff51d6..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/export-lookup_dev.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-commit 6dd60da5e6f7db05c9494d5ca023ca07505c2499
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Export lookup_dev.
----
-
- fs/block_dev.c | 2 ++
- 1 files changed, 2 insertions(+), 0 deletions(-)
-
-
-diff --git a/fs/block_dev.c b/fs/block_dev.c
-index 7d822fa..c5d045c 100644
---- a/fs/block_dev.c
-+++ b/fs/block_dev.c
-@@ -1221,6 +1221,8 @@ fail:
- goto out;
- }
-
-+EXPORT_SYMBOL(lookup_bdev);
-+
- /**
- * open_bdev_excl - open a block device by name and set it up for use
- *
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
deleted file mode 100644
index 52bade9..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-commit 14f62bdeedfffcab97b5d3bf6467c3c96a08b0db
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Display Macbook Pro 1st gen controls when the subsystem id is wrong (0x100).
----
-
- 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 caf48ed..e6584a8 100644
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -3475,10 +3475,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.25-mactel-patches-r156/sigmatel_audio_fix_macbook_v2.patch b/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/sigmatel_audio_fix_macbook_v2.patch
deleted file mode 100644
index 79fdf83..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.25-mactel-patches-r156/sigmatel_audio_fix_macbook_v2.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-commit 59f8ddaffe1dd016fc8156e21d20d9e1d50a5a02
-
-From: Marek Sterzik <marek@milimetr.org>
-
-Fixes audio on Macbook v2.
----
-
- 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 e6584a8..dfb0181 100644
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -91,6 +91,7 @@ enum {
- /* for backward compatibility */
- STAC_MACMINI,
- STAC_MACBOOK,
-+ STAC_MACBOOK_V2,
- STAC_MACBOOK_PRO_V1,
- STAC_MACBOOK_PRO_V2,
- STAC_IMAC_INTEL,
-@@ -1372,6 +1373,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/2.6.26-mactel-patches-r159/applesmc-accel-create-check.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-accel-create-check.patch
deleted file mode 100644
index 7185e50..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-accel-create-check.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-applesmc: Do not create accelerometer input device if it cannot be calibrated.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-It should fix kernel bug #10998.
-
-Needs testing.
----
-
- drivers/hwmon/applesmc.c | 30 +++++++++++++++++++++++-------
- 1 files changed, 23 insertions(+), 7 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index aacc0c4..f3aa9e0 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -456,11 +456,20 @@ static struct platform_driver applesmc_driver = {
- * applesmc_calibrate - Set our "resting" values. Callers must
- * hold applesmc_lock.
- */
--static void applesmc_calibrate(void)
-+static int applesmc_calibrate(void)
- {
-- applesmc_read_motion_sensor(SENSOR_X, &rest_x);
-- applesmc_read_motion_sensor(SENSOR_Y, &rest_y);
-+ int ret;
-+
-+ ret = applesmc_read_motion_sensor(SENSOR_X, &rest_x);
-+ if (ret)
-+ return ret;
-+
-+ ret = applesmc_read_motion_sensor(SENSOR_Y, &rest_y);
-+ if (ret)
-+ return ret;
-+
- rest_x = -rest_x;
-+ return 0;
- }
-
- static void applesmc_idev_poll(struct input_polled_dev *dev)
-@@ -1159,6 +1168,13 @@ static int applesmc_create_accelerometer(void)
- struct input_dev *idev;
- int ret;
-
-+ /* initial calibrate for the input device */
-+ ret = applesmc_calibrate();
-+ if (ret) {
-+ printk(KERN_ERR "applesmc: Cannot calibrate the accelerometer.\n");
-+ return ret;
-+ }
-+
- ret = sysfs_create_group(&pdev->dev.kobj,
- &accelerometer_attributes_group);
- if (ret)
-@@ -1173,9 +1189,6 @@ static int applesmc_create_accelerometer(void)
- applesmc_idev->poll = applesmc_idev_poll;
- applesmc_idev->poll_interval = APPLESMC_POLL_INTERVAL;
-
-- /* initial calibrate for the input device */
-- applesmc_calibrate();
--
- /* initialize the input device */
- idev = applesmc_idev->input;
- idev->name = "applesmc";
-@@ -1344,9 +1357,12 @@ static int __init applesmc_init(void)
- }
-
- if (applesmc_accelerometer) {
-+ /* Try to initialize the accelerometer, not being able to do so
-+ * is not a fatal error. */
-+
- ret = applesmc_create_accelerometer();
- if (ret)
-- goto out_temperature;
-+ applesmc_accelerometer = 0;
- }
-
- if (applesmc_light) {
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-int-protect.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-int-protect.patch
deleted file mode 100644
index dcfa895..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-int-protect.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-commit b69b46ff2a770621c85516dbe626a0c45b459983
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-AppleSMC: use interrupts to protect a block device.
----
-
- drivers/hwmon/Kconfig | 7 ++
- drivers/hwmon/Makefile | 4 +
- drivers/hwmon/applesmc.c | 155 +++++++++++++++++++++++++++++++++++++++++++---
- 3 files changed, 156 insertions(+), 10 deletions(-)
-
-
-diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
-index 00ff533..23424e3 100644
---- a/drivers/hwmon/Kconfig
-+++ b/drivers/hwmon/Kconfig
-@@ -799,6 +799,13 @@ config SENSORS_APPLESMC
- Say Y here if you have an applicable laptop and want to experience
- the awesome power of applesmc.
-
-+config SENSORS_APPLESMC_PROTECT
-+ bool "Apple SMC - Protect block devices on shock/free fall"
-+ depends on SENSORS_APPLESMC
-+ default n
-+ help
-+ Fill in......
-+
- config HWMON_DEBUG_CHIP
- bool "Hardware Monitoring Chip debugging messages"
- default n
-diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
-index d098677..cb60249 100644
---- a/drivers/hwmon/Makefile
-+++ b/drivers/hwmon/Makefile
-@@ -77,3 +77,7 @@ ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
- EXTRA_CFLAGS += -DDEBUG
- endif
-
-+ifeq ($(CONFIG_SENSORS_APPLESMC_PROTECT),y)
-+EXTRA_CFLAGS += -DAPPLESMC_PROTECT
-+endif
-+
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 0c66728..7754464 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -40,6 +40,12 @@
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
- #include <linux/interrupt.h>
-+#ifdef APPLESMC_PROTECT
-+#include <linux/fs.h>
-+#include <linux/blkdev.h>
-+#include <linux/namei.h>
-+#include <linux/mount.h>
-+#endif
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
-@@ -176,6 +182,11 @@ static unsigned int applesmc_light;
- /* Indicates which temperature sensors set to use. */
- static unsigned int applesmc_temperature_set;
-
-+#ifdef APPLESMC_PROTECT
-+/* Device to protect in case of shock or free fall. */
-+struct block_device *bdev_protect;
-+#endif
-+
- static DEFINE_MUTEX(applesmc_lock);
-
- /*
-@@ -451,6 +462,35 @@ static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
- return -EIO;
- }
-
-+#ifdef APPLESMC_PROTECT
-+static void protect_callback(struct work_struct *ignored) {
-+ char b[BDEVNAME_SIZE];
-+ /* This code comes from queue_protect_store (block/ll_rw_blk.c) */
-+ if (bdev_protect && bdev_protect->bd_disk &&
-+ bdev_protect->bd_disk->queue &&
-+ bdev_protect->bd_disk->queue->issue_protect_fn) {
-+ struct request_queue *q = bdev_protect->bd_disk->queue;
-+
-+ printk(KERN_INFO "applesmc: protecting the device (%s)\n",
-+ bdevname(bdev_protect, b));
-+
-+ /* Park and freeze */
-+ if (!blk_queue_stopped(q))
-+ q->issue_protect_fn(q);
-+
-+ /* freeze for 2 seconds (we will receive interrupt often
-+ * enough to reenable this if needed) */
-+ spin_lock_irq(q->queue_lock);
-+ blk_freeze_queue(q, 2);
-+ spin_unlock_irq(q->queue_lock);
-+
-+ printk(KERN_INFO "applesmc: device protected\n");
-+ }
-+}
-+
-+static DECLARE_WORK(protect_work, protect_callback);
-+#endif
-+
- irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
- {
- u8 int_type = inb(APPLESMC_INT_PORT);
-@@ -472,14 +512,24 @@ irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
- int_type);
- }
-
-+#ifdef APPLESMC_PROTECT
-+ if (bdev_protect && bdev_protect->bd_disk &&
-+ bdev_protect->bd_disk->queue &&
-+ bdev_protect->bd_disk->queue->issue_protect_fn) {
-+ schedule_work(&protect_work);
-+ }
-+#endif
-+
- return IRQ_HANDLED;
- }
-
- /*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
-+ * - resume is true if we are waking up from a resume, so we don't need
-+ * to setup interrupt handling again, and probe for a device to protect.
- */
--static int applesmc_device_init(void)
-+static int applesmc_device_init(int resume)
- {
- int total;
- int ret = -ENXIO;
-@@ -554,17 +604,21 @@ static int applesmc_device_init(void)
- goto out;
- }
-
-- ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler, IRQF_DISABLED,
-- "applesmc_irq_handler", NULL);
-+ if (!resume) {
-+ ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler,
-+ IRQF_DISABLED, "applesmc_irq_handler",
-+ NULL);
-
-- if (ret1) {
-- printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-- }
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup "
-+ "irq handler\n");
-+ }
-
-- printk(KERN_DEBUG "applesmc: accelerometer "
-+ printk(KERN_DEBUG "applesmc: accelerometer "
- "successfully initialized.\n");
-- ret = 0;
-+ }
-
-+ ret = 0;
- out:
- mutex_unlock(&applesmc_lock);
- return ret;
-@@ -595,7 +649,7 @@ static int applesmc_probe(struct platform_device *dev)
- {
- int ret;
-
-- ret = applesmc_device_init();
-+ ret = applesmc_device_init(0);
- if (ret)
- return ret;
-
-@@ -605,7 +659,7 @@ static int applesmc_probe(struct platform_device *dev)
-
- static int applesmc_resume(struct platform_device *dev)
- {
-- return applesmc_device_init();
-+ return applesmc_device_init(1);
- }
-
- static int applesmc_remove(struct platform_device *dev)
-@@ -911,6 +965,46 @@ static ssize_t applesmc_calibrate_store(struct device *dev,
- return count;
- }
-
-+#ifdef APPLESMC_PROTECT
-+static ssize_t applesmc_protect_device_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ char b[BDEVNAME_SIZE];
-+
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%s\n", bdevname(bdev_protect, b));
-+}
-+
-+static ssize_t applesmc_protect_device_store(struct device *dev,
-+ struct device_attribute *attr, const char *sysfsbuf, size_t count)
-+{
-+ char b[BDEVNAME_SIZE];
-+ struct block_device *bdev;
-+
-+ if (bdev_protect)
-+ bdput(bdev_protect);
-+
-+ bdev = lookup_bdev(sysfsbuf);
-+
-+ if (IS_ERR(bdev)) {
-+ bdev_protect = NULL;
-+ return -EIO; /* Could be more precise? */
-+ }
-+
-+ if (bdev->bd_disk && bdev->bd_disk->queue
-+ && bdev->bd_disk->queue->issue_protect_fn) {
-+ bdev_protect = bdev;
-+ printk(KERN_INFO "applesmc: accelerometer will now "
-+ "protect %s.\n", bdevname(bdev, b));
-+ return count;
-+ }
-+ else {
-+ bdput(bdev);
-+ bdev_protect = NULL;
-+ return -EIO; /* Could be more precise? */
-+ }
-+}
-+#endif
-+
- /* Store the next backlight value to be written by the work */
- static unsigned int backlight_value;
-
-@@ -1215,6 +1309,10 @@ 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);
-+#ifdef APPLESMC_PROTECT
-+static DEVICE_ATTR(protect_device, 0644,
-+ applesmc_protect_device_show, applesmc_protect_device_store);
-+#endif
- static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
- applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
- static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-@@ -1227,6 +1325,9 @@ static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+#ifdef APPLESMC_PROTECT
-+ &dev_attr_protect_device.attr,
-+#endif
- &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
- &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
- &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-@@ -1467,6 +1568,10 @@ static int applesmc_create_accelerometer(void)
- {
- struct input_dev *idev;
- int ret;
-+#ifdef APPLESMC_PROTECT
-+ char b[BDEVNAME_SIZE];
-+ int major, minor;
-+#endif
-
- /* initial calibrate for the input device */
- ret = applesmc_calibrate();
-@@ -1504,6 +1609,30 @@ static int applesmc_create_accelerometer(void)
- if (ret)
- goto out_idev;
-
-+#ifdef APPLESMC_PROTECT
-+ /* Try to find a suitable block device to protect */
-+ bdev_protect = NULL;
-+ major = SCSI_DISK0_MAJOR;
-+
-+ /* Iterate over a maximum of 16 SCSI devices to find one that
-+ * can be protected.
-+ * Note: other devices could also be protected. */
-+ for (minor = 0; minor < 256; minor += 16) {
-+ dev_t dev = MKDEV(major, minor);
-+ struct block_device *bdev = bdget(dev);
-+ if (bdev->bd_disk && bdev->bd_disk->queue
-+ && bdev->bd_disk->queue->issue_protect_fn) {
-+ bdev_protect = bdev;
-+ printk(KERN_INFO "applesmc: accelerometer "
-+ "will protect %s (%d:%d).\n",
-+ bdevname(bdev, b),
-+ major, minor);
-+ break;
-+ }
-+ bdput(bdev);
-+ }
-+#endif
-+
- return 0;
-
- out_idev:
-@@ -1523,6 +1652,12 @@ static void applesmc_release_accelerometer(void)
- input_unregister_polled_device(applesmc_idev);
- input_free_polled_device(applesmc_idev);
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
-+#ifdef APPLESMC_PROTECT
-+ if (bdev_protect) {
-+ bdput(bdev_protect);
-+ bdev_protect = NULL;
-+ }
-+#endif
- }
-
- static __initdata struct dmi_match_data applesmc_dmi_data[] = {
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-macbook-air.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-macbook-air.patch
deleted file mode 100644
index 8bb3897..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-macbook-air.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Add support for Apple Macbook Air.
-
-From: Henrik Rydberg <rydberg@euromail.se>
-
-This support is quite minimal at the moment, waiting for the author to see if we can add more devices.
-Can we add accelerometer support or not?
----
-
- drivers/hwmon/applesmc.c | 8 ++++++++
- 1 files changed, 8 insertions(+), 0 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index c6a1f49..939e5ea 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -101,6 +101,8 @@ static const char* temperature_sensors_sets[][36] = {
- /* Set 5: Macbook3 set */
- { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TTF0", "TW0P", "Th0H",
- "Th0S", "Th1H", NULL },
-+/* Set 6: Macbook Air */
-+ { "TB0T", NULL },
- };
-
- /* List of keys used to read/write fan speeds */
-@@ -1241,6 +1243,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
- { .accelerometer = 0, .light = 0, .temperature_set = 4 },
- /* MacBook3: accelerometer and temperature set 5 */
- { .accelerometer = 1, .light = 0, .temperature_set = 5 },
-+/* MacBook Air: accelerometer, backlight and temperature set 6 */
-+ { .accelerometer = 1, .light = 1, .temperature_set = 6 },
- };
-
- /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
-@@ -1258,6 +1262,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook3") },
- (void*)&applesmc_dmi_data[5]},
-+ { applesmc_dmi_match, "Apple MacBook Air", {
-+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
-+ DMI_MATCH(DMI_PRODUCT_NAME,"MacBookAir") },
-+ (void*)&applesmc_dmi_data[6]},
- { applesmc_dmi_match, "Apple MacBook", {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-macbook-v3.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-macbook-v3.patch
deleted file mode 100644
index 87d5ded..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-macbook-v3.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-Add support for Macbook v3.
-
-From: guilherme m. schroeder <guilherme.m.schroeder@gmail.com>
-
-Needs testing from author.
----
-
- drivers/hwmon/applesmc.c | 11 ++++++++++-
- 1 files changed, 10 insertions(+), 1 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index f3aa9e0..c6a1f49 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -98,6 +98,9 @@ static const char* temperature_sensors_sets[][36] = {
- "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S",
- "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P",
- "TM9S", "TN0H", "TS0C", NULL },
-+/* Set 5: Macbook3 set */
-+ { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TTF0", "TW0P", "Th0H",
-+ "Th0S", "Th1H", NULL },
- };
-
- /* List of keys used to read/write fan speeds */
-@@ -1236,6 +1239,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
- { .accelerometer = 0, .light = 0, .temperature_set = 3 },
- /* MacPro: temperature set 4 */
- { .accelerometer = 0, .light = 0, .temperature_set = 4 },
-+/* MacBook3: accelerometer and temperature set 5 */
-+ { .accelerometer = 1, .light = 0, .temperature_set = 5 },
- };
-
- /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
-@@ -1245,10 +1250,14 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
- DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") },
- (void*)&applesmc_dmi_data[0]},
-- { applesmc_dmi_match, "Apple MacBook", {
-+ { applesmc_dmi_match, "Apple MacBook (v2)", {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") },
- (void*)&applesmc_dmi_data[1]},
-+ { applesmc_dmi_match, "Apple MacBook (v3)", {
-+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
-+ DMI_MATCH(DMI_PRODUCT_NAME,"MacBook3") },
-+ (void*)&applesmc_dmi_data[5]},
- { applesmc_dmi_match, "Apple MacBook", {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-remove-debugging-messages.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-remove-debugging-messages.patch
deleted file mode 100644
index 7cbdef6..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-remove-debugging-messages.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-commit d6a5b9228b0d64168f88bb8d906a2040daca74f5
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Remove debugging messages.
----
-
- drivers/hwmon/applesmc.c | 24 ++++++++++--------------
- 1 files changed, 10 insertions(+), 14 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 3c8b112..fa40ab9 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -138,7 +138,8 @@ struct dmi_match_data {
- int temperature_set;
- };
-
--static const int debug;
-+static int debug = 0;
-+module_param(debug, int, S_IRUGO|S_IWUSR);
- static struct platform_device *pdev;
- static s16 rest_x;
- static s16 rest_y;
-@@ -177,7 +178,7 @@ static int __wait_status(u8 val)
-
- for (i = 0; i < 200; i++) {
- if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == val) {
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG
- "Waited %d us for status %x\n",
- i*10, val);
-@@ -186,7 +187,8 @@ static int __wait_status(u8 val)
- udelay(10);
- }
-
-- printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
-+ if (debug >= 1)
-+ printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
- val, inb(APPLESMC_CMD_PORT));
-
- return -EIO;
-@@ -224,11 +226,11 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- goto wait_fail;
- }
- }
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "<%s", key);
-
- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG ">%x", len);
-
- for (i = 0; i < len; i++) {
-@@ -237,22 +239,16 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- goto wait_fail;
- }
- buffer[i] = inb(APPLESMC_DATA_PORT);
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "<%x", buffer[i]);
- }
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "\n");
-
- break;
-
- wait_fail:
- msleep(ACCESS_WAIT_MSECS);
-- continue;
-- }
--
-- if (total != ACCESS_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-- ACCESS_TIMEOUT_MSECS-total);
- }
-
- return ret;
-@@ -404,7 +400,7 @@ static int applesmc_device_init(void)
- mutex_lock(&applesmc_lock);
-
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug)
-+ if (debug >= 9)
- printk(KERN_DEBUG "applesmc try %d\n", total);
- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-retry-when-accessing-keys.patch
deleted file mode 100644
index d9447e6..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc-retry-when-accessing-keys.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-commit f9b12606e452b43114836f7a75e6ed41738d78dc
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Retry up to 200 ms when reading or writing keys.
----
-
- drivers/hwmon/applesmc.c | 69 +++++++++++++++++++++++++++++++---------------
- 1 files changed, 47 insertions(+), 22 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 939e5ea..3c8b112 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -117,6 +117,9 @@ static const char* fan_speed_keys[] = {
- #define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */
- #define INIT_WAIT_MSECS 50 /* ... in 50ms increments */
-
-+#define ACCESS_TIMEOUT_MSECS 500 /* wait up to 500ms when accessing a key */
-+#define ACCESS_WAIT_MSECS 5 /* ... in 5ms increments */
-+
- #define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-@@ -191,12 +194,13 @@ static int __wait_status(u8 val)
-
- /*
- * applesmc_read_key - reads len bytes from a given key, and put them in buffer.
-+ * Tries up to ACCESS_WAIT_MSECS to read the value.
- * Returns zero on success or a negative error on failure. Callers must
- * hold applesmc_lock.
- */
- static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- {
-- int i;
-+ int i, total, ret;
-
- if (len > APPLESMC_MAX_DATA_LENGTH) {
- printk(KERN_ERR "applesmc_read_key: cannot read more than "
-@@ -204,33 +208,54 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
- return -EINVAL;
- }
-
-- outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-- if (__wait_status(0x0c))
-- return -EIO;
-+ for (total = ACCESS_TIMEOUT_MSECS; total > 0;
-+ total -= ACCESS_WAIT_MSECS) {
-+ ret = 0;
-+ outb(APPLESMC_READ_CMD, APPLESMC_CMD_PORT);
-+ if (__wait_status(0x0c)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-
-- for (i = 0; i < 4; i++) {
-- outb(key[i], APPLESMC_DATA_PORT);
-- if (__wait_status(0x04))
-- return -EIO;
-- }
-- if (debug)
-- printk(KERN_DEBUG "<%s", key);
-+ for (i = 0; i < 4; i++) {
-+ outb(key[i], APPLESMC_DATA_PORT);
-+ if (__wait_status(0x04)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ }
-+ if (debug)
-+ printk(KERN_DEBUG "<%s", key);
-
-- outb(len, APPLESMC_DATA_PORT);
-- if (debug)
-- printk(KERN_DEBUG ">%x", len);
-+ outb(len, APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG ">%x", len);
-
-- for (i = 0; i < len; i++) {
-- if (__wait_status(0x05))
-- return -EIO;
-- buffer[i] = inb(APPLESMC_DATA_PORT);
-+ for (i = 0; i < len; i++) {
-+ if (__wait_status(0x05)) {
-+ ret = -EIO;
-+ goto wait_fail;
-+ }
-+ buffer[i] = inb(APPLESMC_DATA_PORT);
-+ if (debug)
-+ printk(KERN_DEBUG "<%x", buffer[i]);
-+ }
- if (debug)
-- printk(KERN_DEBUG "<%x", buffer[i]);
-+ printk(KERN_DEBUG "\n");
-+
-+ break;
-+
-+wait_fail:
-+ msleep(ACCESS_WAIT_MSECS);
-+ continue;
- }
-- if (debug)
-- printk(KERN_DEBUG "\n");
-
-- return 0;
-+ if (total != ACCESS_TIMEOUT_MSECS) {
-+ printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-+ ACCESS_TIMEOUT_MSECS-total);
-+ }
-+
-+ return ret;
- }
-
- /*
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc_int.patch
deleted file mode 100644
index 17e3880..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/applesmc_int.patch
+++ /dev/null
@@ -1,424 +0,0 @@
-commit 04ae6b26f11c2ad146c2f2229a3d2500b11becb7
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
----
-
- drivers/hwmon/applesmc.c | 322 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 298 insertions(+), 24 deletions(-)
-
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index fa40ab9..0c66728 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -39,14 +39,20 @@
- #include <linux/leds.h>
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
-+#include <linux/interrupt.h>
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
- /* command/status port used by Apple SMC */
- #define APPLESMC_CMD_PORT 0x304
-+/* status port used by Apple SMC to get which interrupt type just happened */
-+#define APPLESMC_INT_PORT 0x31f
-
- #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */
-
-+/* Defined in ACPI DSDT table, should we read it from there? */
-+#define APPLESMC_IRQ 6
-+
- #define APPLESMC_MAX_DATA_LENGTH 32
-
- #define APPLESMC_STATUS_MASK 0x0f
-@@ -57,6 +63,8 @@
-
- #define KEY_COUNT_KEY "#KEY" /* r-o ui32 */
-
-+#define INTERRUPT_OK_KEY "NTOK" /* w-o ui8 */
-+
- #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) */
-@@ -68,6 +76,19 @@
- #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-
-+/*
-+ * Interrupt controls.
-+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
-+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than the
-+ * value of MOLD (or MOHD), SMC will trigger an interrupt.
-+ */
-+#define MOTION_LOW_NORM "MOLT" /* r/w sp78 (2 bytes) */
-+#define MOTION_HIGH_NORM "MOHT" /* r/w sp78 (2 bytes) */
-+#define MOTION_LOW_NORM_INTERVAL "MOLD" /* r/w ui8 */
-+#define MOTION_HIGH_NORM_INTERVAL "MOHD" /* r/w ui8 */
-+
-+#define MSDW_KEY "MSDW" /* r/w flag (1 byte) */
-+
- #define FANS_COUNT "FNum" /* r-o ui8 */
- #define FANS_MANUAL "FS! " /* r-w ui16 */
- #define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -386,12 +407,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * buffer, if not, writes these bytes.
-+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
-+ * waited more than INIT_TIMEOUT_MSECS in total.
-+ * Returns zero on success or a negative error on failure. Callers must
-+ * hold applesmc_lock.
-+ */
-+static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
-+{
-+ int total, ret, i, compare;
-+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
-+
-+ if (len > APPLESMC_MAX_DATA_LENGTH) {
-+ printk(KERN_ERR "applesmc_init_check_key_value: cannot "
-+ "read/write more than %d bytes",
-+ APPLESMC_MAX_DATA_LENGTH);
-+ return -EINVAL;
-+ }
-+
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret = applesmc_read_key(key, rdbuffer, len);
-+ if (!ret) {
-+ compare = 1;
-+ for (i = 0; i < len; i++) {
-+ if (rdbuffer[i] != buffer[i]) {
-+ compare = 0;
-+ break;
-+ }
-+ }
-+
-+ if (compare) {
-+ return 0;
-+ }
-+ }
-+ ret = applesmc_write_key(key, buffer, len);
-+ msleep(INIT_WAIT_MSECS);
-+ }
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return -EIO;
-+}
-+
-+irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
-+{
-+ u8 int_type = inb(APPLESMC_INT_PORT);
-+
-+ switch (int_type) {
-+ case 0x60:
-+ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
-+ break;
-+ case 0x6f:
-+ printk(KERN_INFO
-+ "applesmc: received a high acceleration interrupt\n");
-+ break;
-+ case 0x80:
-+ printk(KERN_INFO "applesmc: received a shock interrupt\n");
-+ break;
-+ default:
-+ printk(KERN_INFO
-+ "applesmc: received an unknown interrupt %x\n",
-+ int_type);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
- */
- static int applesmc_device_init(void)
- {
-- int total, ret = -ENXIO;
-+ int total;
-+ int ret = -ENXIO;
-+ int ret1, ret2;
- u8 buffer[2];
-
- if (!applesmc_accelerometer)
-@@ -399,32 +491,79 @@ static int applesmc_device_init(void)
-
- mutex_lock(&applesmc_lock);
-
-+ /* Accept interrupts */
-+ buffer[0] = 0x01;
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug >= 9)
-- printk(KERN_DEBUG "applesmc try %d\n", total);
-- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
-- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
-- if (total == INIT_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "applesmc: device has"
-- " already been initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- } else {
-- printk(KERN_DEBUG "applesmc: device"
-- " successfully initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- }
-- ret = 0;
-- goto out;
-- }
-- buffer[0] = 0xe0;
-- buffer[1] = 0x00;
-- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
-+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set NTOK key, "
-+ "will not receive interrupts.\n");
-+
-+ /* Setup interrupt controls. */
-+ buffer[0] = 20; /* 20 msecs */
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ buffer[0] = 20; /* 20 msecs */
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "interrupt interval, might not receive "
-+ "some interrupts.");
-+ }
-+
-+ buffer[0] = 0x00;
-+ buffer[1] = 0x60;
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM, buffer, 2);
-+
-+ buffer[0] = 0x01;
-+ buffer[1] = 0xc0;
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM, buffer, 2);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
-+ }
-+
-+ /* Mysterious key. */
-+ buffer[0] = 0x01;
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set MSDW key\n");
-+
-+ /* Initialize the device. */
-+ buffer[0] = 0xe0;
-+ buffer[1] = 0xf8;
-+ if (applesmc_init_check_key_value(MOTION_SENSOR_KEY, buffer, 2)) {
-+ 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);
-+
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-+ }
-+
-+ printk(KERN_DEBUG "applesmc: accelerometer "
-+ "successfully initialized.\n");
-+ ret = 0;
-
- out:
- mutex_unlock(&applesmc_lock);
-@@ -469,9 +608,16 @@ static int applesmc_resume(struct platform_device *dev)
- return applesmc_device_init();
- }
-
-+static int applesmc_remove(struct platform_device *dev)
-+{
-+ free_irq(APPLESMC_IRQ, NULL);
-+ return 0;
-+}
-+
- static struct platform_driver applesmc_driver = {
- .probe = applesmc_probe,
- .resume = applesmc_resume,
-+ .remove = applesmc_remove,
- .driver = {
- .name = "applesmc",
- .owner = THIS_MODULE,
-@@ -788,7 +934,7 @@ static void applesmc_brightness_set(struct led_classdev *led_cdev,
- backlight_value = value;
- ret = queue_work(applesmc_led_wq, &backlight_work);
-
-- if (debug && (!ret))
-+ if ((debug >= 9) && (!ret))
- printk(KERN_DEBUG "applesmc: work was already on the queue.\n");
- }
-
-@@ -942,6 +1088,122 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
- return count;
- }
-
-+static ssize_t applesmc_accelerometer_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ int ret;
-+ unsigned int value = 0;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk(KERN_ERR
-+ "Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_read_key(key, buffer, length);
-+ if (length == 2)
-+ value = ((unsigned int)buffer[0] << 8) | buffer[1];
-+ else if (length == 1)
-+ value = buffer[0];
-+ else {
-+ printk("Invalid length for applesmc_param_show");
-+ ret = -EINVAL;
-+ }
-+
-+ mutex_unlock(&applesmc_lock);
-+ if (ret)
-+ return ret;
-+ else
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", value);
-+}
-+
-+static ssize_t applesmc_accelerometer_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *sysfsbuf, size_t count)
-+{
-+ int ret;
-+ u32 value;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ value = simple_strtoul(sysfsbuf, NULL, 10);
-+
-+ if (length == 2) {
-+ if (value > 0xffff)
-+ return -EINVAL;
-+
-+ buffer[0] = (value >> 8) & 0xff;
-+ buffer[1] = value & 0xff;
-+ } else if (length == 1) {
-+ if (value > 0xff)
-+ return -EINVAL;
-+
-+ buffer[0] = value & 0xff;
-+ } else {
-+ printk("Invalid length for applesmc_param_store");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_write_key(key, buffer, length);
-+
-+ mutex_unlock(&applesmc_lock);
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return count;
-+}
- static struct led_classdev applesmc_backlight = {
- .name = "smc::kbd_backlight",
- .default_trigger = "nand-disk",
-@@ -953,10 +1215,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);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 1);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 2);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 3);
-
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+ &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger_interval.dev_attr.attr,
- NULL
- };
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/appletouch-new.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/appletouch-new.patch
deleted file mode 100644
index 3f01c9f..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/appletouch-new.patch
+++ /dev/null
@@ -1,358 +0,0 @@
-commit 60ef60451a5cd0ed62770ce2d1965a7cc48b7a89
-
-From: Sven Anders <anders@anduras.de>
-
-
----
-
- drivers/input/mouse/appletouch.c | 152 ++++++++++++++++++++++++++++----------
- 1 files changed, 113 insertions(+), 39 deletions(-)
-
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index ce6fdec..88177d4 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,10 +61,11 @@
- * 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 0x022B
-@@ -77,15 +81,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) },
-@@ -97,6 +103,7 @@ 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) },
-@@ -144,12 +151,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 ? */
-@@ -164,8 +180,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) \
-@@ -182,8 +198,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");
-
- /*
-@@ -193,7 +213,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");
-
-@@ -211,12 +231,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);
-
-@@ -240,7 +260,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,
-@@ -248,6 +268,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;
-@@ -263,6 +290,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;
-@@ -280,8 +314,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);
-@@ -396,7 +429,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));
-
- /*
-@@ -453,13 +486,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 */
-@@ -485,26 +525,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;
-@@ -549,16 +610,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:
-@@ -641,7 +714,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;
-@@ -680,7 +753,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
- */
-@@ -723,6 +796,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/2.6.26-mactel-patches-r159/appletouch.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/appletouch.patch
deleted file mode 100644
index 2f731f3..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/appletouch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-commit 19637bc6b985ac81c61e217f61dd49d1302ac81f
-
-From: Ortwin Glück <odi@odi.ch>
-
-Appletouch driver ATP_THRESHOLD fix.
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index 88177d4..a674984 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -142,7 +142,7 @@ MODULE_DEVICE_TABLE (usb, atp_table);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 5
-+#define ATP_THRESHOLD 3
-
- /* Geyser initialization constants */
- #define ATP_GEYSER_MODE_READ_REQUEST_ID 1
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/disk-protect-2.6.26.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/disk-protect-2.6.26.patch
deleted file mode 100644
index 3a30ed4..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/disk-protect-2.6.26.patch
+++ /dev/null
@@ -1,954 +0,0 @@
---------
-
-From: Elias Oltmanns <eo@...>
-
-Documentation/block/disk-protection.txt | 79 ++++++++++++++
- block/blk-core.c | 41 +++++++
- block/blk-settings.c | 22 ++++
- block/blk-sysfs.c | 173 ++++++++++++++++++++++++++++++-
- block/blk.h | 3 +
- drivers/ata/libata-scsi.c | 35 ++++++
- drivers/ide/ide-disk.c | 145 ++++++++++++++++++++++++++
- drivers/ide/ide-io.c | 14 ++
- drivers/scsi/scsi_lib.c | 174 +++++++++++++++++++++++++++++++
- include/linux/ata.h | 12 ++
- include/linux/blkdev.h | 14 ++
- include/linux/ide.h | 1
- 12 files changed, 706 insertions(+), 7 deletions(-)
- create mode 100644 Documentation/block/disk-protection.txt
----
-
- Documentation/block/disk-protection.txt | 79 ++++++++++++++
- block/blk-core.c | 41 +++++++
- block/blk-settings.c | 22 ++++
- block/blk-sysfs.c | 173 ++++++++++++++++++++++++++++++-
- block/blk.h | 3 +
- drivers/ata/libata-scsi.c | 35 ++++++
- drivers/ide/ide-disk.c | 145 ++++++++++++++++++++++++++
- drivers/ide/ide-io.c | 14 ++
- drivers/scsi/scsi_lib.c | 174 +++++++++++++++++++++++++++++++
- include/linux/ata.h | 12 ++
- include/linux/blkdev.h | 14 ++
- include/linux/ide.h | 1
- 12 files changed, 706 insertions(+), 7 deletions(-)
- create mode 100644 Documentation/block/disk-protection.txt
-
-
-diff --git a/Documentation/block/disk-protection.txt b/Documentation/block/disk-protection.txt
-new file mode 100644
-index 0000000..3fc4c16
---- /dev/null
-+++ b/Documentation/block/disk-protection.txt
-@@ -0,0 +1,79 @@
-+Hard disk protection
-+====================
-+
-+
-+Intro
-+-----
-+ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with UNLOAD FEATURE.
-+Issuing this command should cause the drive to switch to idle mode and
-+unload disk heads. This feature is being used in modern laptops in
-+conjunction with accelerometers and appropriate software to implement
-+a shock protection facility. The idea is to stop all I/O operations on
-+the internal hard drive and park its heads on the ramp when critical
-+situations are anticipated. The desire to have such a feature
-+available on GNU/Linux systems has been the original motivation to
-+implement a generic disk parking interface in the Linux kernel.
-+
-+
-+The interface
-+-------------
-+The interface works as follows: Writing an integer value to
-+/sys/block/*/queue/protect will park the respective drive and freeze
-+the block layer queue for the specified number of seconds. When the
-+timeout expires and no further disk park request has been issued in
-+the meantime, the queue is unfrozen and accumulated I/O operations are
-+performed.
-+
-+IMPORTANT NOTE:
-+Not all ATA drives implement IDLE IMMEDIATE with UNLOAD FEATURE and
-+quite a few of those that do so, don't report this capability as
-+described in the specs. When a disk park has been requested through
-+sysfs as described above, the kernel will try to determine if the
-+drive supports the UNLOAD FEATURE by default. The kernel will only
-+rely on the IDLE IMMEDIATE with UNLOAD FEATURE command if it is
-+convinced that this command is actually supported by the disk drive;
-+otherwise, it will fall back to STANDBY IMMEDIATE. Resuming from the
-+latter will take much longer and it is generally more likely to have a
-+negative impact on the drive's lifetime due to the inclease of spin
-+down and up cycles. If you want to use this interface in a shock
-+protection framework and you know that your drive does indeed support
-+the IDLE IMMEDIATE with UNLOAD FEATURE command despite not saying so,
-+you can force the kernel to issue that command by doing the following
-+on the command line:
-+# echo -n unload > /sys/block/sda/queue/protect_method
-+(replace sda by the drive identifier as appropriate).
-+
-+/sys/block/*/queue/protect_method accepts auto, unload and standby
-+respectively. Reading from protect_method shows the available options
-+surrounding the active one with brackets. When auto is active, this
-+will change to whatever the kernel sees fit after the next disk park
-+command has been issued.
-+
-+
-+References
-+----------
-+
-+There are several laptops from different brands featuring shock
-+protection capabilities. As manufacturers have refused to support open
-+source development of the required software components so far, Linux
-+support for shock protection varies considerably between different
-+hardware implementations. Ideally, this section should contain a list
-+of poiters at different projects aiming at an implementation of shock
-+protection on different systeems. Unfortunately, I only know of a
-+single project which, although still considered experimental, is fit
-+for use. Please feel free to add projects that have been the victims
-+of my ignorance.
-+
-+- http://www.thinkwiki.org/wiki/HDAPS
-+ See this page for information about Linux support of the hard disk
-+ active protection syystem as implemented in IBM/Lenovo Thinkpads.
-+
-+
-+CREDITS
-+-------
-+
-+The patch to implement the interface described in this file has
-+originally been published by Jon Escombe <lists@...>.
-+
-+
-+05 Dec 2006, Elias Oltmanns <eo@...>
-diff --git a/block/blk-core.c b/block/blk-core.c
-index 6f4878e..fd1f6bf 100644
---- a/block/blk-core.c
-+++ b/block/blk-core.c
-@@ -305,6 +305,46 @@ void blk_unplug(struct request_queue *q)
- }
- EXPORT_SYMBOL(blk_unplug);
-
-+/*
-+ * Issue lower level unprotect function if no timers are pending.
-+ */
-+void blk_unfreeze_work(struct work_struct *work)
-+{
-+ struct request_queue *q = container_of(work, struct request_queue, unfreeze_work);
-+ int pending;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ pending = timer_pending(&q->unfreeze_timer);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ if (!pending)
-+ q->issue_unprotect_fn(q);
-+}
-+
-+/*
-+ * Called when the queue freeze timeout expires...
-+ */
-+void blk_unfreeze_timeout(unsigned long data)
-+{
-+ struct request_queue *q = (struct request_queue *) data;
-+
-+ kblockd_schedule_work(&q->unfreeze_work);
-+}
-+
-+/*
-+ * The lower level driver parks and freezes the queue, and this block layer
-+ * function sets up the freeze timeout timer on return. If the queue is
-+ * already frozen then this is called to extend the timer...
-+ */
-+void blk_freeze_queue(struct request_queue *q, int seconds)
-+{
-+ /* Don't accept arbitrarily long freezes */
-+ if (seconds >= q->max_unfreeze)
-+ seconds = q->max_unfreeze;
-+ /* set/reset the timer */
-+ mod_timer(&q->unfreeze_timer, msecs_to_jiffies(seconds*1000) + jiffies);
-+}
-+
- /**
- * blk_start_queue - restart a previously stopped queue
- * @q: The &struct request_queue in question
-@@ -479,6 +519,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
- }
-
- init_timer(&q->unplug_timer);
-+ init_timer(&q->unfreeze_timer);
-
- kobject_init(&q->kobj, &blk_queue_ktype);
-
-diff --git a/block/blk-settings.c b/block/blk-settings.c
-index 8dd8641..2da72f3 100644
---- a/block/blk-settings.c
-+++ b/block/blk-settings.c
-@@ -111,6 +111,16 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
- q->unplug_timer.function = blk_unplug_timeout;
- q->unplug_timer.data = (unsigned long)q;
-
-+ q->max_unfreeze = 30;
-+
-+ INIT_WORK(&q->unfreeze_work, blk_unfreeze_work);
-+
-+ q->unfreeze_timer.function = blk_unfreeze_timeout;
-+ q->unfreeze_timer.data = (unsigned long)q;
-+
-+ /* Set protect_method to auto detection initially */
-+ q->protect_method = 2;
-+
- /*
- * by default assume old behaviour and bounce for any highmem page
- */
-@@ -118,6 +128,18 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
- }
- EXPORT_SYMBOL(blk_queue_make_request);
-
-+void blk_queue_issue_protect_fn(struct request_queue *q, issue_protect_fn *ipf)
-+{
-+ q->issue_protect_fn = ipf;
-+}
-+EXPORT_SYMBOL(blk_queue_issue_protect_fn);
-+
-+void blk_queue_issue_unprotect_fn(struct request_queue *q, issue_unprotect_fn *iuf)
-+{
-+ q->issue_unprotect_fn = iuf;
-+}
-+EXPORT_SYMBOL(blk_queue_issue_unprotect_fn);
-+
- /**
- * blk_queue_bounce_limit - set bounce buffer limit for queue
- * @q: the request queue for the device
-diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
-index 304ec73..2fdca01 100644
---- a/block/blk-sysfs.c
-+++ b/block/blk-sysfs.c
-@@ -298,6 +298,160 @@ struct kobj_type blk_queue_ktype = {
- .release = blk_release_queue,
- };
-
-+/*
-+ * When reading the 'protect' attribute, we return seconds remaining
-+ * before unfreeze timeout expires
-+ */
-+static ssize_t queue_protect_show(struct request_queue *q, char *page)
-+{
-+ unsigned int seconds = 0;
-+
-+ spin_lock_irq(q->queue_lock);
-+ if (blk_queue_stopped(q) && timer_pending(&q->unfreeze_timer))
-+ /*
-+ * Adding 1 in order to guarantee nonzero value until timer
-+ * has actually expired.
-+ */
-+ seconds = jiffies_to_msecs(q->unfreeze_timer.expires
-+ - jiffies) / 1000 + 1;
-+ spin_unlock_irq(q->queue_lock);
-+ return queue_var_show(seconds, (page));
-+}
-+
-+/*
-+ * When writing the 'protect' attribute, input is the number of seconds
-+ * to freeze the queue for. We call a lower level helper function to
-+ * park the heads and freeze/block the queue, then we make a block layer
-+ * call to setup the thaw timeout. If input is 0, then we thaw the queue.
-+ */
-+static ssize_t queue_protect_store(struct request_queue *q,
-+ const char *page, size_t count)
-+{
-+ unsigned long freeze = 0;
-+
-+ queue_var_store(&freeze, page, count);
-+
-+ if (freeze>0) {
-+ /* Park and freeze */
-+ if (!blk_queue_stopped(q))
-+ q->issue_protect_fn(q);
-+ /* set / reset the thaw timer */
-+ spin_lock_irq(q->queue_lock);
-+ blk_freeze_queue(q, freeze);
-+ spin_unlock_irq(q->queue_lock);
-+ } else {
-+ spin_lock_irq(q->queue_lock);
-+ freeze = del_timer(&q->unfreeze_timer);
-+ spin_unlock_irq(q->queue_lock);
-+ if (freeze)
-+ q->issue_unprotect_fn(q);
-+ }
-+
-+ return count;
-+}
-+
-+static ssize_t
-+queue_str_show(char *page, char *str, int status)
-+{
-+ ssize_t len;
-+
-+ if (status & 1)
-+ len = sprintf(page, "[%s]", str);
-+ else
-+ len = sprintf(page, "%s", str);
-+ if (status & 2)
-+ len += sprintf(page+len, "\n");
-+ else
-+ len += sprintf(page+len, " ");
-+ return len;
-+}
-+
-+/*
-+ * Returns current protect_method.
-+ */
-+static ssize_t queue_protect_method_show(struct request_queue *q, char *page)
-+{
-+ int len = 0;
-+ int unload = q->protect_method;
-+
-+ len += queue_str_show(page+len, "auto", (unload & 2) >> 1);
-+ len += queue_str_show(page+len, "unload", unload & 1);
-+ len += queue_str_show(page+len, "standby", !unload ? 3 : 2);
-+ return len;
-+}
-+
-+/*
-+ * Stores the device protect method.
-+ */
-+static ssize_t queue_protect_method_store(struct request_queue *q,
-+ const char *page, size_t count)
-+{
-+ spin_lock_irq(q->queue_lock);
-+ if (!strcmp(page, "auto") || !strcmp(page, "auto\n"))
-+ q->protect_method = 2;
-+ else if (!strcmp(page, "unload") || !strcmp(page, "unload\n"))
-+ q->protect_method = 1;
-+ else if (!strcmp(page, "standby") || !strcmp(page, "standby\n"))
-+ q->protect_method = 0;
-+ else {
-+ spin_unlock_irq(q->queue_lock);
-+ return -EINVAL;
-+ }
-+ spin_unlock_irq(q->queue_lock);
-+ return count;
-+}
-+
-+static struct queue_sysfs_entry queue_protect_entry = {
-+ .attr = { .name = "protect", .mode = S_IRUGO | S_IWUSR },
-+ .show = queue_protect_show,
-+ .store = queue_protect_store,
-+};
-+static struct queue_sysfs_entry queue_protect_method_entry = {
-+ .attr = { .name = "protect_method", .mode = S_IRUGO | S_IWUSR },
-+ .show = queue_protect_method_show,
-+ .store = queue_protect_method_store,
-+};
-+
-+static int blk_protect_register(struct request_queue *q)
-+{
-+ int error = 0;
-+
-+ /* check that the lower level driver has a protect handler */
-+ if (!q->issue_protect_fn)
-+ return 0;
-+
-+ /* create the attributes */
-+ error = sysfs_create_file(&q->kobj, &queue_protect_entry.attr);
-+ if (error) {
-+ printk(KERN_ERR
-+ "blk_protect_register(): failed to create protect queue attribute!\n");
-+ return error;
-+ }
-+
-+ error = sysfs_create_file(&q->kobj, &queue_protect_method_entry.attr);
-+ if (error) {
-+ sysfs_remove_file(&q->kobj, &queue_protect_entry.attr);
-+ printk(KERN_ERR
-+ "blk_protect_register(): failed to create protect_method attribute!\n");
-+ return error;
-+ }
-+ kobject_get(&q->kobj);
-+
-+ return 0;
-+}
-+
-+static void blk_protect_unregister(struct request_queue *q)
-+{
-+ /* check that the lower level driver has a protect handler */
-+ if (!q->issue_protect_fn)
-+ return;
-+
-+ /* remove the attributes */
-+ sysfs_remove_file(&q->kobj, &queue_protect_method_entry.attr);
-+ sysfs_remove_file(&q->kobj, &queue_protect_entry.attr);
-+ kobject_put(&q->kobj);
-+}
-+
- int blk_register_queue(struct gendisk *disk)
- {
- int ret;
-@@ -318,23 +472,28 @@ int blk_register_queue(struct gendisk *disk)
- kobject_uevent(&q->kobj, KOBJ_ADD);
-
- ret = elv_register_queue(q);
-+ if (ret)
-+ goto err;
-+ ret = blk_protect_register(q);
- if (ret) {
-- kobject_uevent(&q->kobj, KOBJ_REMOVE);
-- kobject_del(&q->kobj);
-- return ret;
-+ elv_unregister_queue(q);
-+ goto err;
- }
-
- return 0;
-+
-+err:
-+ kobject_uevent(&q->kobj, KOBJ_REMOVE);
-+ kobject_del(&q->kobj);
-+ return ret;
- }
-
- void blk_unregister_queue(struct gendisk *disk)
- {
- struct request_queue *q = disk->queue;
-
-- if (WARN_ON(!q))
-- return;
--
-- if (q->request_fn) {
-+ if (q && q->request_fn) {
-+ blk_protect_unregister(q);
- elv_unregister_queue(q);
-
- kobject_uevent(&q->kobj, KOBJ_REMOVE);
-diff --git a/block/blk.h b/block/blk.h
-index 59776ab..5c89160 100644
---- a/block/blk.h
-+++ b/block/blk.h
-@@ -17,6 +17,9 @@ void __blk_queue_free_tags(struct request_queue *q);
-
- void blk_unplug_work(struct work_struct *work);
- void blk_unplug_timeout(unsigned long data);
-+void blk_unfreeze_work(struct work_struct *work);
-+void blk_unfreeze_timeout(unsigned long data);
-+void blk_freeze_queue(struct request_queue *q, int seconds);
-
- struct io_context *current_io_context(gfp_t gfp_flags, int node);
-
-diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
-index 57a4364..8f9f118 100644
---- a/drivers/ata/libata-scsi.c
-+++ b/drivers/ata/libata-scsi.c
-@@ -917,6 +917,37 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
- return 0;
- }
-
-+extern int scsi_protect_queue(struct request_queue *q, int unload);
-+extern int scsi_unprotect_queue(struct request_queue *q);
-+
-+static int ata_scsi_issue_protect_fn(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+ struct ata_port *ap = ata_shost_to_port(sdev->host);
-+ struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
-+ int unload = q->protect_method;
-+
-+ if (!dev) {
-+ printk(KERN_DEBUG "ata_scsi_issue_protect_fn(): Couldn't find ATA device to be parked.\n");
-+ return -ENXIO;
-+ }
-+
-+ if (unload == 2) {
-+ unload = ata_id_has_unload(dev->id) ? 1 : 0;
-+ q->protect_method = unload;
-+ }
-+
-+ /* call scsi_protect_queue, requesting either unload or standby */
-+ return scsi_protect_queue(q, unload);
-+}
-+
-+static int ata_scsi_issue_unprotect_fn(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+
-+ return scsi_unprotect_queue(q);
-+}
-+
- /**
- * ata_scsi_slave_config - Set SCSI device attributes
- * @sdev: SCSI device to examine
-@@ -939,6 +970,10 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
-
- if (dev)
- rc = ata_scsi_dev_config(sdev, dev);
-+ blk_queue_issue_protect_fn(sdev->request_queue,
-+ ata_scsi_issue_protect_fn);
-+ blk_queue_issue_unprotect_fn(sdev->request_queue,
-+ ata_scsi_issue_unprotect_fn);
-
- return rc;
- }
-diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
-index 8e08d08..5721f43 100644
---- a/drivers/ide/ide-disk.c
-+++ b/drivers/ide/ide-disk.c
-@@ -612,6 +612,148 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
- }
-
- /*
-+ * todo:
-+ * - we freeze the queue regardless of success and rely on the
-+ * ide_protect_queue function to thaw immediately if the command
-+ * failed (to be consistent with the libata handler)... should
-+ * we also inspect here?
-+ */
-+void ide_end_protect_rq(struct request *rq, int error)
-+{
-+ struct completion *waiting = rq->end_io_data;
-+
-+ rq->end_io_data = NULL;
-+ /* spin lock already accquired */
-+ if (!blk_queue_stopped(rq->q))
-+ blk_stop_queue(rq->q);
-+
-+ complete(waiting);
-+}
-+
-+int ide_unprotect_queue(struct request_queue *q)
-+{
-+ struct request rq;
-+ unsigned long flags;
-+ int pending, rc = 0;
-+ ide_drive_t *drive = q->queuedata;
-+ ide_task_t task;
-+
-+ if (!blk_queue_stopped(q))
-+ return -EIO;
-+
-+ /* Are there any pending jobs on the queue? */
-+ pending = ((q->rq.count[READ] > 0) || (q->rq.count[WRITE] > 0)) ? 1 : 0;
-+
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ blk_start_queue(q);
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+
-+ /* The unload feature of the IDLE_IMMEDIATE command
-+ temporarily disables HD power management from spinning down
-+ the disk. Any other command will reenable HD pm, so, if
-+ there are no pending jobs on the queue, another
-+ CHECK_POWER_MODE1 command without the unload feature should do
-+ just fine. */
-+ if (!pending) {
-+ printk(KERN_DEBUG "ide_unprotect_queue(): No pending I/O, re-enabling power management..\n");
-+ memset(&task, 0, sizeof(task));
-+ task.tf.command = WIN_CHECKPOWERMODE1; /* CHECK_POWER_MODE1 */
-+ task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
-+ task.data_phase = TASKFILE_NO_DATA;
-+ ide_init_drive_cmd(&rq);
-+ rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
-+ rq.special = &task;
-+ rc = ide_do_drive_cmd(drive, &rq, ide_head_wait);
-+ }
-+
-+ return rc;
-+}
-+
-+int ide_protect_queue(struct request_queue *q, int unload)
-+{
-+ ide_drive_t *drive = q->queuedata;
-+ struct request rq;
-+ ide_task_t task;
-+ int ret = 0;
-+ DECLARE_COMPLETION(wait);
-+
-+ memset(&rq, 0, sizeof(rq));
-+ memset(&task, 0, sizeof(task));
-+
-+ if (blk_queue_stopped(q))
-+ return -EIO;
-+
-+ task.data_phase = TASKFILE_NO_DATA;
-+ task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
-+ if (unload) {
-+ task.tf.command = 0xe1;
-+ task.tf.feature = 0x44;
-+ task.tf.lbal = 0x4c;
-+ task.tf.lbam = 0x4e;
-+ task.tf.lbah = 0x55;
-+ } else
-+ task.tf.command = 0xe0;
-+
-+ /* Issue the park command & freeze */
-+ ide_init_drive_cmd(&rq);
-+
-+ rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
-+ rq.special = &task;
-+ rq.end_io_data = &wait;
-+ rq.end_io = ide_end_protect_rq;
-+
-+ ret = ide_do_drive_cmd(drive, &rq, ide_next);
-+ wait_for_completion(&wait);
-+
-+ if (ret) {
-+ printk(KERN_DEBUG "ide_protect_queue(): Warning: head NOT parked!..\n");
-+ ide_unprotect_queue(q);
-+ return ret;
-+ }
-+
-+ if (unload) {
-+ if (task.tf.lbal == 0xc4)
-+ printk(KERN_DEBUG "ide_protect_queue(): head parked..\n");
-+ else {
-+ /* error parking the head */
-+ printk(KERN_DEBUG "ide_protect_queue(): head NOT parked!..\n");
-+ ret = -EIO;
-+ ide_unprotect_queue(q);
-+ }
-+ } else
-+ printk(KERN_DEBUG "ide_protect_queue(): head park not requested, used standby!..\n");
-+
-+ return ret;
-+}
-+
-+int idedisk_issue_protect_fn(struct request_queue *q)
-+{
-+ ide_drive_t *drive = q->queuedata;
-+ int unload = q->protect_method;
-+ unsigned long flags;
-+
-+ /*
-+ * Check capability of the device -
-+ * - if "idle immediate with unload" is supported we use that, else
-+ * we use "standby immediate" and live with spinning down the drive..
-+ * (Word 84, bit 13 of IDENTIFY DEVICE data)
-+ */
-+ if (unload == 2) {
-+ unload = drive->id->cfsse & (1 << 13) ? 1 : 0;
-+ spin_lock_irqsave(q->queue_lock, flags);
-+ q->protect_method = unload;
-+ spin_unlock_irqrestore(q->queue_lock, flags);
-+ }
-+
-+ return ide_protect_queue(q, unload);
-+}
-+
-+int idedisk_issue_unprotect_fn(struct request_queue *q)
-+{
-+ return ide_unprotect_queue(q);
-+}
-+
-+/*
- * This is tightly woven into the driver->do_special can not touch.
- * DON'T do it again until a total personality rewrite is committed.
- */
-@@ -891,6 +1033,9 @@ static void idedisk_setup(ide_drive_t *drive)
- drive->wcache = 1;
-
- write_cache(drive, 1);
-+
-+ blk_queue_issue_protect_fn(drive->queue, idedisk_issue_protect_fn);
-+ blk_queue_issue_unprotect_fn(drive->queue, idedisk_issue_unprotect_fn);
- }
-
- static void ide_cacheflush_p(ide_drive_t *drive)
-diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
-index 6965253..b40a681 100644
---- a/drivers/ide/ide-io.c
-+++ b/drivers/ide/ide-io.c
-@@ -1115,6 +1115,17 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
- }
-
- /*
-+ * Don't accept a request when the queue is stopped (unless we
-+ * are resuming from suspend). Prevents existing queue entries
-+ * being processed after queue is stopped by the hard disk
-+ * protection mechanism...
-+ */
-+ if (test_bit(QUEUE_FLAG_STOPPED, &drive->queue->queue_flags) && !blk_pm_resume_request(rq)) {
-+ hwgroup->busy = 0;
-+ break;
-+ }
-+
-+ /*
- * Sanity: don't accept a request that isn't a PM request
- * if we are currently power managed. This is very important as
- * blk_stop_queue() doesn't prevent the elv_next_request()
-@@ -1607,6 +1618,9 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
- where = ELEVATOR_INSERT_FRONT;
- rq->cmd_flags |= REQ_PREEMPT;
- }
-+ if (action == ide_next)
-+ where = ELEVATOR_INSERT_FRONT;
-+
- __elv_add_request(drive->queue, rq, where, 0);
- ide_do_request(hwgroup, IDE_NO_IRQ);
- spin_unlock_irqrestore(&ide_lock, flags);
-diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
-index cbf55d5..8b260f5 100644
---- a/drivers/scsi/scsi_lib.c
-+++ b/drivers/scsi/scsi_lib.c
-@@ -2261,7 +2261,13 @@ EXPORT_SYMBOL_GPL(sdev_evt_send_simple);
- int
- scsi_device_quiesce(struct scsi_device *sdev)
- {
-+ int i;
- int err = scsi_device_set_state(sdev, SDEV_QUIESCE);
-+ for (i = 0; err && (sdev->sdev_state == SDEV_BLOCK) && (i < 100);
-+ i++) {
-+ msleep_interruptible(200);
-+ err = scsi_device_set_state(sdev, SDEV_QUIESCE);
-+ }
- if (err)
- return err;
-
-@@ -2509,3 +2515,171 @@ void scsi_kunmap_atomic_sg(void *virt)
- kunmap_atomic(virt, KM_BIO_SRC_IRQ);
- }
- EXPORT_SYMBOL(scsi_kunmap_atomic_sg);
-+
-+/*
-+ * Structure required for synchronous io completion after queue freezing
-+ */
-+struct scsi_protect_io_context_sync {
-+ struct scsi_device *sdev;
-+ int result;
-+ char *sense;
-+ struct completion *waiting;
-+};
-+
-+/*
-+ * scsi_protect_wait_done()
-+ * Command completion handler for scsi_protect_queue().
-+ *
-+ * Unable to call scsi_internal_device_block() as
-+ * scsi_end_request() already has the spinlock. So,
-+ * we put the necessary functionality inline.
-+ *
-+ * todo:
-+ * - we block the queue regardless of success and rely on the
-+ * scsi_protect_queue function to unblock if the command
-+ * failed... should we also inspect here?
-+ */
-+static void scsi_protect_wait_done(void *data, char *sense, int result, int resid)
-+{
-+ struct scsi_protect_io_context_sync *siocs = data;
-+ struct completion *waiting = siocs->waiting;
-+ struct request_queue *q = siocs->sdev->request_queue;
-+
-+ siocs->waiting = NULL;
-+ siocs->result = result;
-+ memcpy(siocs->sense, sense, SCSI_SENSE_BUFFERSIZE);
-+
-+ if (!scsi_device_set_state(siocs->sdev, SDEV_BLOCK)) {
-+ siocs->sdev->max_device_blocked = 2;
-+ blk_stop_queue(q);
-+ }
-+
-+ complete(waiting);
-+}
-+
-+/*
-+ * scsi_unprotect_queue()
-+ * - release the queue that was previously blocked
-+ */
-+int scsi_unprotect_queue(struct request_queue *q)
-+{
-+ struct scsi_device *sdev = q->queuedata;
-+ int rc = 0, pending = 0;
-+ u8 scsi_cmd[MAX_COMMAND_SIZE];
-+ struct scsi_sense_hdr sshdr;
-+
-+ if (sdev->sdev_state != SDEV_BLOCK)
-+ return -ENXIO;
-+
-+ /* Are there any pending jobs on the queue? */
-+ pending = ((q->rq.count[READ] > 0) || (q->rq.count[WRITE] > 0)) ? 1 : 0;
-+
-+ rc = scsi_internal_device_unblock(sdev);
-+ if (rc)
-+ return rc;
-+ sdev->max_device_blocked = 1;
-+
-+ if (!pending) {
-+ printk(KERN_DEBUG "scsi_unprotect_queue(): No pending I/O, re-enabling power management..\n");
-+
-+ memset(scsi_cmd, 0, sizeof(scsi_cmd));
-+ scsi_cmd[0] = ATA_16;
-+ scsi_cmd[1] = (3 << 1); /* Non-data */
-+ /* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */
-+ scsi_cmd[14] = 0xe5; /* CHECK_POWER_MODE1 */
-+
-+ /* Good values for timeout and retries? Values below
-+ from scsi_ioctl_send_command() for default case... */
-+ if (scsi_execute_req(sdev, scsi_cmd, DMA_NONE, NULL, 0, &sshdr,
-+ (10*HZ), 5))
-+ rc = -EIO;
-+ }
-+ return rc;
-+}
-+EXPORT_SYMBOL_GPL(scsi_unprotect_queue);
-+
-+/*
-+ * scsi_protect_queue()
-+ * - build and issue the park/standby command..
-+ * - queue is blocked during command completion handler
-+ */
-+int scsi_protect_queue(struct request_queue *q, int unload)
-+{
-+ struct scsi_protect_io_context_sync siocs;
-+ struct scsi_device *sdev = q->queuedata;
-+ int rc = 0;
-+ u8 args[7];
-+ u8 scsi_cmd[MAX_COMMAND_SIZE];
-+ unsigned char sense[SCSI_SENSE_BUFFERSIZE];
-+ unsigned char *desc;
-+ DECLARE_COMPLETION_ONSTACK(wait);
-+
-+ if (sdev->sdev_state != SDEV_RUNNING)
-+ return -ENXIO;
-+
-+ memset(args, 0, sizeof(args));
-+ memset(sense, 0, sizeof(sense));
-+
-+ if (unload) {
-+ args[0] = 0xe1;
-+ args[1] = 0x44;
-+ args[3] = 0x4c;
-+ args[4] = 0x4e;
-+ args[5] = 0x55;
-+ } else
-+ args[0] = 0xe0;
-+
-+ memset(scsi_cmd, 0, sizeof(scsi_cmd));
-+ scsi_cmd[0] = ATA_16;
-+ scsi_cmd[1] = (3 << 1); /* Non-data */
-+ scsi_cmd[2] = 0x20; /* no off.line, or data xfer, request cc */
-+ scsi_cmd[4] = args[1];
-+ scsi_cmd[6] = args[2];
-+ scsi_cmd[8] = args[3];
-+ scsi_cmd[10] = args[4];
-+ scsi_cmd[12] = args[5];
-+ scsi_cmd[14] = args[0];
-+ siocs.sdev = sdev;
-+ siocs.sense = sense;
-+ siocs.waiting = &wait;
-+
-+ rc = scsi_execute_async(sdev, scsi_cmd, COMMAND_SIZE(scsi_cmd[0]),
-+ DMA_NONE, NULL, 0, 0, (10*HZ), 5,
-+ &siocs, &scsi_protect_wait_done, GFP_NOWAIT);
-+ if (rc)
-+ goto out;
-+ wait_for_completion(&wait);
-+
-+ if (siocs.result != ((DRIVER_SENSE << 24) + SAM_STAT_CHECK_CONDITION)) {
-+ printk(KERN_DEBUG "scsi_protect_queue(): head NOT parked!..\n");
-+ scsi_unprotect_queue(q); /* just in case we still managed to block */
-+ rc = -EIO;
-+ goto out;
-+ }
-+
-+ desc = sense + 8;
-+
-+ /* Retrieve data from check condition */
-+ args[1] = desc[3];
-+ args[2] = desc[5];
-+ args[3] = desc[7];
-+ args[4] = desc[9];
-+ args[5] = desc[11];
-+ args[0] = desc[13];
-+
-+ if (unload) {
-+ if (args[3] == 0xc4)
-+ printk(KERN_DEBUG "scsi_protect_queue(): head parked..\n");
-+ else {
-+ /* error parking the head */
-+ printk(KERN_DEBUG "scsi_protect_queue(): head NOT parked!..\n");
-+ rc = -EIO;
-+ scsi_unprotect_queue(q);
-+ }
-+ } else
-+ printk(KERN_DEBUG "scsi_protect_queue(): head park not requested, used standby!..\n");
-+
-+out:
-+ return rc;
-+}
-+EXPORT_SYMBOL_GPL(scsi_protect_queue);
-diff --git a/include/linux/ata.h b/include/linux/ata.h
-index 1c622e2..199a4e3 100644
---- a/include/linux/ata.h
-+++ b/include/linux/ata.h
-@@ -459,6 +459,18 @@ static inline int ata_is_data(u8 prot)
-
- #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
-
-+static inline int ata_id_has_unload(const u16 *id)
-+{
-+ /* ATA-7 specifies two places to indicate unload feature support.
-+ * Since I don't really understand the difference, I'll just check
-+ * both and only return zero if none of them indicates otherwise. */
-+ if ((id[84] & 0xC000) == 0x4000 && id[84] & (1 << 13))
-+ return id[84] & (1 << 13);
-+ if ((id[87] & 0xC000) == 0x4000)
-+ return id[87] & (1 << 13);
-+ return 0;
-+}
-+
- static inline bool ata_id_has_hipm(const u16 *id)
- {
- u16 val = id[76];
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index f166d29..1f6f298 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -265,6 +265,8 @@ typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_ve
- typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
- typedef void (softirq_done_fn)(struct request *);
- typedef int (dma_drain_needed_fn)(struct request *);
-+typedef int (issue_protect_fn) (struct request_queue *);
-+typedef int (issue_unprotect_fn) (struct request_queue *);
-
- enum blk_queue_state {
- Queue_down,
-@@ -302,6 +304,8 @@ struct request_queue
- prepare_flush_fn *prepare_flush_fn;
- softirq_done_fn *softirq_done_fn;
- dma_drain_needed_fn *dma_drain_needed;
-+ issue_protect_fn *issue_protect_fn;
-+ issue_unprotect_fn *issue_unprotect_fn;
-
- /*
- * Dispatch queue sorting
-@@ -317,6 +321,14 @@ struct request_queue
- unsigned long unplug_delay; /* After this many jiffies */
- struct work_struct unplug_work;
-
-+ /*
-+ * Auto-unfreeze state
-+ */
-+ struct timer_list unfreeze_timer;
-+ int max_unfreeze; /* At most this many seconds */
-+ struct work_struct unfreeze_work;
-+ int protect_method;
-+
- struct backing_dev_info backing_dev_info;
-
- /*
-@@ -766,6 +778,8 @@ extern int blk_do_ordered(struct request_queue *, struct request **);
- extern unsigned blk_ordered_cur_seq(struct request_queue *);
- extern unsigned blk_ordered_req_seq(struct request *);
- extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int);
-+extern void blk_queue_issue_protect_fn(struct request_queue *, issue_protect_fn *);
-+extern void blk_queue_issue_unprotect_fn(struct request_queue *, issue_unprotect_fn *);
-
- extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
- extern void blk_dump_rq_flags(struct request *, char *);
-diff --git a/include/linux/ide.h b/include/linux/ide.h
-index eddb6da..428746d 100644
---- a/include/linux/ide.h
-+++ b/include/linux/ide.h
-@@ -864,6 +864,7 @@ extern void ide_init_drive_cmd (struct request *rq);
- */
- typedef enum {
- ide_wait, /* insert rq at end of list, and wait for it */
-+ ide_next, /* insert rq immediately after current request */
- ide_preempt, /* insert rq in front of current request */
- ide_head_wait, /* insert rq in front of current request and wait for it */
- ide_end /* insert rq at end of list, but don't wait for it */
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/disk-protect-update.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/disk-protect-update.patch
deleted file mode 100644
index b1531f5..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/disk-protect-update.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-commit c78bcf2753db4c3398cdbf9262e62d7ce6fdc8f3
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Disk protect patch update.
----
-
- block/blk-core.c | 1 +
- include/linux/blkdev.h | 2 ++
- 2 files changed, 3 insertions(+), 0 deletions(-)
-
-
-diff --git a/block/blk-core.c b/block/blk-core.c
-index 1905aab..6f4878e 100644
---- a/block/blk-core.c
-+++ b/block/blk-core.c
-@@ -420,6 +420,7 @@ void blk_put_queue(struct request_queue *q)
- {
- kobject_put(&q->kobj);
- }
-+EXPORT_SYMBOL(blk_freeze_queue);
-
- void blk_cleanup_queue(struct request_queue *q)
- {
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index d2a1b71..f166d29 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -40,6 +40,8 @@ struct io_context *get_io_context(gfp_t gfp_flags, int node);
- struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
- void copy_io_context(struct io_context **pdst, struct io_context **psrc);
-
-+void blk_freeze_queue(struct request_queue *q, int seconds);
-+
- struct request;
- typedef void (rq_end_io_fn)(struct request *, int);
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/export-lookup_dev.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/export-lookup_dev.patch
deleted file mode 100644
index 94833be..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/export-lookup_dev.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-commit 6dd60da5e6f7db05c9494d5ca023ca07505c2499
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Export lookup_dev.
----
-
- fs/block_dev.c | 2 ++
- 1 files changed, 2 insertions(+), 0 deletions(-)
-
-
-diff --git a/fs/block_dev.c b/fs/block_dev.c
-index 10d8a0a..d491734 100644
---- a/fs/block_dev.c
-+++ b/fs/block_dev.c
-@@ -1235,6 +1235,8 @@ fail:
- goto out;
- }
-
-+EXPORT_SYMBOL(lookup_bdev);
-+
- /**
- * open_bdev_excl - open a block device by name and set it up for use
- *
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/fix_fn_key_on_macbookpro_4_1_and_mb_air.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/fix_fn_key_on_macbookpro_4_1_and_mb_air.patch
deleted file mode 100644
index 8f03a16..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/fix_fn_key_on_macbookpro_4_1_and_mb_air.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-Fix fn key on MacBook Pro 4.1 and MacBook Air.
-
-From: Unknown <????>
-
-
----
-
- drivers/hid/usbhid/hid-quirks.c | 12 ++++++++++++
- 1 files changed, 12 insertions(+), 0 deletions(-)
-
-
-diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
-index 1df832a..9d6cddb 100644
---- a/drivers/hid/usbhid/hid-quirks.c
-+++ b/drivers/hid/usbhid/hid-quirks.c
-@@ -75,6 +75,12 @@
- #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
- #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
- #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e
-+#define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223
-+#define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224
-+#define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225
-+#define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230
-+#define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231
-+#define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232
- #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
-@@ -642,6 +648,12 @@ static const struct hid_blacklist {
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS,HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-
diff --git a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/sigmatel_audio_fix_when_module_parameter_is_set.patch b/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/sigmatel_audio_fix_when_module_parameter_is_set.patch
deleted file mode 100644
index 0171393..0000000
--- a/sys-kernel/mactel-linux-sources/files/2.6.26-mactel-patches-r159/sigmatel_audio_fix_when_module_parameter_is_set.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-Allow to force model to intel-mac-v3 in snd_hda_intel (sigmatel).
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Currently, even if you pass model=intel-mac-v3 as a module parameter to
-snd_hda_intel, the function patch_stac922x (patch_sigmatel.c) will still
-try to auto-detect the model type. This is a problem on my MacBook Pro 1st
-generation, which needs intel-mac-v3, but sometimes incorrectly reports
-0x00000100 as subsystem id, which causes the switch in patch_stac922x to
-select intel-mac-v4.
-
-To fix this, I added a new model called intel-mac-auto, so in case no
-module parameter is passed, and an Intel Mac board is detected, the
-model will be automatically detected, while no detection will be done
-if the model is forced to intel-mac-v3.
-
-This problem has been around for quite a while, and I used to fix it
-by moving the case statement for 0x00000100 in patch_stac922x so that
-intel-mac-v3 is chosen.
-
-Another way to fix the problem would be to check if a module parameter
-was set directly in patch_stac922x, using something like this:
-if (spec->board_config == STAC_INTEL_MAC_V3 &&
- !codec->bus->modelname) {
-
-But I think it is less elegant (if you prefer that way, I can prepare a
-patch too).
-
-This applies against 2.6.26, and should apply without any problem on the
-latest git.
-
-Signed-off-by: Nicolas Boichat <nicolas@boichat.ch>
----
-
- Documentation/sound/alsa/ALSA-Configuration.txt | 1 +
- sound/pci/hda/patch_sigmatel.c | 14 +++++++++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-
-diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
-index 0bbee38..705ca75 100644
---- a/Documentation/sound/alsa/ALSA-Configuration.txt
-+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
-@@ -1017,6 +1017,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
- intel-mac-v3 Intel Mac Type 3
- intel-mac-v4 Intel Mac Type 4
- intel-mac-v5 Intel Mac Type 5
-+ intel-mac-auto Intel Mac (detect type according to subsystem id)
- macmini Intel Mac Mini (equivalent with type 3)
- macbook Intel Mac Book (eq. type 5)
- macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3)
-diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
-index a4f44a0..8f71b48 100644
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -94,6 +94,9 @@ enum {
- STAC_INTEL_MAC_V3,
- STAC_INTEL_MAC_V4,
- STAC_INTEL_MAC_V5,
-+ STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
-+ * is given, one of the above models will be
-+ * chosen according to the subsystem id. */
- /* for backward compatibility */
- STAC_MACMINI,
- STAC_MACBOOK,
-@@ -1473,6 +1476,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
- [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,
-+ [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
- /* for backward compatibility */
- [STAC_MACMINI] = intel_mac_v3_pin_configs,
- [STAC_MACBOOK] = intel_mac_v5_pin_configs,
-@@ -1495,6 +1499,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = {
- [STAC_INTEL_MAC_V3] = "intel-mac-v3",
- [STAC_INTEL_MAC_V4] = "intel-mac-v4",
- [STAC_INTEL_MAC_V5] = "intel-mac-v5",
-+ [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
- /* for backward compatibility */
- [STAC_MACMINI] = "macmini",
- [STAC_MACBOOK] = "macbook",
-@@ -1566,9 +1571,9 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = {
- SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
- "Intel D945P", STAC_D945GTP5),
- /* other systems */
-- /* Apple Mac Mini (early 2006) */
-+ /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
- SND_PCI_QUIRK(0x8384, 0x7680,
-- "Mac Mini", STAC_INTEL_MAC_V3),
-+ "Mac", STAC_INTEL_MAC_AUTO),
- /* Dell systems */
- SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
- "unknown Dell", STAC_922X_DELL_D81),
-@@ -3709,7 +3714,7 @@ static int patch_stac922x(struct hda_codec *codec)
- spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
- stac922x_models,
- stac922x_cfg_tbl);
-- if (spec->board_config == STAC_INTEL_MAC_V3) {
-+ if (spec->board_config == STAC_INTEL_MAC_AUTO) {
- spec->gpio_mask = spec->gpio_dir = 0x03;
- spec->gpio_data = 0x03;
- /* Intel Macs have all same PCI SSID, so we need to check
-@@ -3741,6 +3746,9 @@ static int patch_stac922x(struct hda_codec *codec)
- case 0x106b2200:
- spec->board_config = STAC_INTEL_MAC_V5;
- break;
-+ default:
-+ spec->board_config = STAC_INTEL_MAC_V3;
-+ break;
- }
- }
-
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r1.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r1.ebuild
deleted file mode 100644
index a29a084..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r1.ebuild
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="2"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r149/"
-
-UNIPATCH_LIST="${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/appletouch-add-macbook3-trackpad.patch \
-${PATCHDIR}/applesmc-macbook2.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.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"
-
-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"
-}
-
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r2.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r2.ebuild
deleted file mode 100644
index 34381e6..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r2.ebuild
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="3"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r149/"
-
-UNIPATCH_LIST="${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/appletouch-add-macbook3-trackpad.patch \
-${PATCHDIR}/applesmc-macbook2.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.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"
-
-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"
-}
-
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r3.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r3.ebuild
deleted file mode 100644
index eebd448..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r3.ebuild
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="4"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r151/"
-
-UNIPATCH_LIST="${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/appletouch-add-macbook3-trackpad.patch \
-${PATCHDIR}/applesmc-macbook2.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.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"
-}
-
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r4.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r4.ebuild
deleted file mode 100644
index 872945a..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r4.ebuild
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="4"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r153/"
-
-UNIPATCH_LIST="${PATCHDIR}/appletouch-new.patch \
-${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/applesmc-macbook2.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.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}/disk-protect.patch \
-${PATCHDIR}/disk-protect-fix-2.6.24-crash.patch \
-${PATCHDIR}/disk-protect-update.patch \
-${PATCHDIR}/export-lookup_dev.patch \
-${PATCHDIR}/applesmc-int-protect.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"
-}
-
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r5.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r5.ebuild
deleted file mode 100644
index b2d2237..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.24-r5.ebuild
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="6"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r155/"
-
-UNIPATCH_LIST="${PATCHDIR}/appletouch-new.patch \
-${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/applesmc-macbook2.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.patch \
-${PATCHDIR}/applesmc-remove-debugging-messages.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}/disk-protect.patch \
-${PATCHDIR}/disk-protect-fix-2.6.24-crash.patch \
-${PATCHDIR}/disk-protect-update.patch \
-${PATCHDIR}/export-lookup_dev.patch \
-${PATCHDIR}/applesmc-int-protect.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"
-}
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.25-r1.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.25-r1.ebuild
deleted file mode 100644
index 3851984..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.25-r1.ebuild
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="2"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r156/"
-
-UNIPATCH_LIST="${PATCHDIR}/appletouch-new.patch \
-${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.patch \
-${PATCHDIR}/applesmc-remove-debugging-messages.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}/disk-protect-2.6.25.patch \
-${PATCHDIR}/disk-protect-fix-2.6.24-crash.patch \
-${PATCHDIR}/disk-protect-update.patch \
-${PATCHDIR}/export-lookup_dev.patch \
-${PATCHDIR}/applesmc-int-protect.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"
-}
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.25-r4.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.25-r4.ebuild
deleted file mode 100644
index c3e0aad..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.25-r4.ebuild
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="5"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r156/"
-
-UNIPATCH_LIST="${PATCHDIR}/appletouch-new.patch \
-${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.patch \
-${PATCHDIR}/applesmc-remove-debugging-messages.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}/disk-protect-2.6.25.patch \
-${PATCHDIR}/disk-protect-fix-2.6.24-crash.patch \
-${PATCHDIR}/disk-protect-update.patch \
-${PATCHDIR}/export-lookup_dev.patch \
-${PATCHDIR}/applesmc-int-protect.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"
-}
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.26.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.26.ebuild
deleted file mode 100644
index e1b1d05..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.26.ebuild
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="1"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/${PV}-mactel-patches-r159"
-
-UNIPATCH_LIST="${PATCHDIR}/applesmc-accel-create-check.patch \
-${PATCHDIR}/applesmc-macbook-v3.patch \
-${PATCHDIR}/applesmc-macbook-air.patch \
-${PATCHDIR}/appletouch-new.patch \
-${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/fix_fn_key_on_macbookpro_4_1_and_mb_air.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.patch \
-${PATCHDIR}/applesmc-remove-debugging-messages.patch \
-${PATCHDIR}/applesmc_int.patch \
-${PATCHDIR}/sigmatel_audio_fix_when_module_parameter_is_set.patch \
-${PATCHDIR}/disk-protect-update.patch \
-${PATCHDIR}/disk-protect-2.6.26.patch \
-${PATCHDIR}/disk-protect-update.patch \
-${PATCHDIR}/export-lookup_dev.patch \
-${PATCHDIR}/applesmc-int-protect.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"
-}
diff --git a/sys-kernel/mactel-linux-sources/metadata.xml b/sys-kernel/mactel-linux-sources/metadata.xml
deleted file mode 100644
index 2312e82..0000000
--- a/sys-kernel/mactel-linux-sources/metadata.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
-<pkgmetadata>
-<herd></herd>
-<maintainer>
-<email>je_fro@gentoo.org</email>
-<name>Jeff Gardner</name>
-</maintainer>
-<longdescription lang="en">
-gentoo-sources kernel with mactel patches applied
-</longdescription>
-</pkgmetadata>
-