summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Gardner <je_fro@gentoo.org>2007-12-16 03:37:27 +0000
committerJeffrey Gardner <je_fro@gentoo.org>2007-12-16 03:37:27 +0000
commite72fc4590c3ae267cd3655b8cef75cb9bc59659e (patch)
tree74f5533beb46374ddebf86861deeac9cad1e232b
parentIt appears all the newer pommed's are broken for me. (diff)
downloadje_fro-e72fc4590c3ae267cd3655b8cef75cb9bc59659e.tar.gz
je_fro-e72fc4590c3ae267cd3655b8cef75cb9bc59659e.tar.bz2
je_fro-e72fc4590c3ae267cd3655b8cef75cb9bc59659e.zip
Latest mactel-linux patches.
svn path=/; revision=147
-rw-r--r--sys-kernel/mactel-linux-sources/Manifest65
-rw-r--r--sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.23-r49
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-for-mac-pro-2-x-quad-core.patch202
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-int-protect.patch303
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-macbook2.patch76
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-retry-when-accessing-keys.patch115
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-use-input-polldev.patch221
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc_int.patch415
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch-add-macbook3-trackpad.patch50
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch-new.patch385
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch.patch23
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/disk-protect-update.patch36
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/disk-protect.patch882
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/export-lookup_dev.patch23
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch28
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r147/sigmatel_audio_fix_macbook_v2.patch30
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.23-r4.ebuild46
17 files changed, 2909 insertions, 0 deletions
diff --git a/sys-kernel/mactel-linux-sources/Manifest b/sys-kernel/mactel-linux-sources/Manifest
index f279d13..96bb48a 100644
--- a/sys-kernel/mactel-linux-sources/Manifest
+++ b/sys-kernel/mactel-linux-sources/Manifest
@@ -130,12 +130,70 @@ AUX mactel-patches-r142/sigmatel_audio_fix_macbook_v2.patch 855 RMD160 8c4db3512
MD5 1e52257c9a8be5d01e10e95c3bea1d43 files/mactel-patches-r142/sigmatel_audio_fix_macbook_v2.patch 855
RMD160 8c4db3512daad3393851c7da2b1375873a7a4bd5 files/mactel-patches-r142/sigmatel_audio_fix_macbook_v2.patch 855
SHA256 be4d3d0d91125eaf975a3c585c6c5abd72b7d2601c4d9e31799a87c809d16886 files/mactel-patches-r142/sigmatel_audio_fix_macbook_v2.patch 855
+AUX mactel-patches-r147/applesmc-for-mac-pro-2-x-quad-core.patch 7939 RMD160 f6974a36923a13d82565c7828e74656bf422df88 SHA1 146adfb5bab85466fefaff3f1066f52c74b0ddeb SHA256 5af5d1a007507126745cd29bbb2972e64232d83b7fb32e69f2fd0d147806f346
+MD5 41edc31e14cb01aa7c8b296770658f93 files/mactel-patches-r147/applesmc-for-mac-pro-2-x-quad-core.patch 7939
+RMD160 f6974a36923a13d82565c7828e74656bf422df88 files/mactel-patches-r147/applesmc-for-mac-pro-2-x-quad-core.patch 7939
+SHA256 5af5d1a007507126745cd29bbb2972e64232d83b7fb32e69f2fd0d147806f346 files/mactel-patches-r147/applesmc-for-mac-pro-2-x-quad-core.patch 7939
+AUX mactel-patches-r147/applesmc-int-protect.patch 8677 RMD160 43683284d005614ecea1098c99b884561536b7c9 SHA1 b52899fd258ffed5dde19c5d8f9958a46a35accd SHA256 7d4079e50cfc9f26ca68ce08cb7f4dbe1ae02ce06762be90a8678ae0290a2c75
+MD5 9640d3b2abbb8de5006d66915de7e0b9 files/mactel-patches-r147/applesmc-int-protect.patch 8677
+RMD160 43683284d005614ecea1098c99b884561536b7c9 files/mactel-patches-r147/applesmc-int-protect.patch 8677
+SHA256 7d4079e50cfc9f26ca68ce08cb7f4dbe1ae02ce06762be90a8678ae0290a2c75 files/mactel-patches-r147/applesmc-int-protect.patch 8677
+AUX mactel-patches-r147/applesmc-macbook2.patch 3087 RMD160 a9f6f3932c83306cc3f6e86793204d460893d750 SHA1 381bd9d153fca5b51820152855bdd346f7bb94f1 SHA256 513eba6bc15f9d37d537657450227e23d7aaddf25e99b1a1f2d7fceaac9f99f7
+MD5 6969bbb69073a3bf9b8711e9e807ff2b files/mactel-patches-r147/applesmc-macbook2.patch 3087
+RMD160 a9f6f3932c83306cc3f6e86793204d460893d750 files/mactel-patches-r147/applesmc-macbook2.patch 3087
+SHA256 513eba6bc15f9d37d537657450227e23d7aaddf25e99b1a1f2d7fceaac9f99f7 files/mactel-patches-r147/applesmc-macbook2.patch 3087
+AUX mactel-patches-r147/applesmc-retry-when-accessing-keys.patch 3004 RMD160 7f55880731a37baf2fe874355e2e84be72511771 SHA1 1064351c86d9ddbd5b0b5cf2c0368af738346154 SHA256 314a38433682b169a3169b63313e8bc49fe835ea9b29afde4b62948f9463f6d4
+MD5 c19c177290d8859cbe34eea8618c888f files/mactel-patches-r147/applesmc-retry-when-accessing-keys.patch 3004
+RMD160 7f55880731a37baf2fe874355e2e84be72511771 files/mactel-patches-r147/applesmc-retry-when-accessing-keys.patch 3004
+SHA256 314a38433682b169a3169b63313e8bc49fe835ea9b29afde4b62948f9463f6d4 files/mactel-patches-r147/applesmc-retry-when-accessing-keys.patch 3004
+AUX mactel-patches-r147/applesmc-use-input-polldev.patch 6732 RMD160 6a66f9b2d40000882a21ede343c786d3a4fa1f2b SHA1 e62f0f32af450f8e22208c85de6b20e1535de73a SHA256 8e9ef49709a76169ed92c97862662f6d477cbf2732d34e08207b05b41ae28171
+MD5 307acd20d11b64dc732f244e8620bed8 files/mactel-patches-r147/applesmc-use-input-polldev.patch 6732
+RMD160 6a66f9b2d40000882a21ede343c786d3a4fa1f2b files/mactel-patches-r147/applesmc-use-input-polldev.patch 6732
+SHA256 8e9ef49709a76169ed92c97862662f6d477cbf2732d34e08207b05b41ae28171 files/mactel-patches-r147/applesmc-use-input-polldev.patch 6732
+AUX mactel-patches-r147/applesmc_int.patch 11196 RMD160 e55d2b818a9254c674586d20f809aa5f1f2e5e1c SHA1 eeab4a2960a4ca8c95409eb715612390e15ff64d SHA256 575f443c9cb9ed813932e1e2957b489fc5622bc5a279e18ad3ef2fca14b5960c
+MD5 a42d512b04bd261baf5b08c4afd653db files/mactel-patches-r147/applesmc_int.patch 11196
+RMD160 e55d2b818a9254c674586d20f809aa5f1f2e5e1c files/mactel-patches-r147/applesmc_int.patch 11196
+SHA256 575f443c9cb9ed813932e1e2957b489fc5622bc5a279e18ad3ef2fca14b5960c files/mactel-patches-r147/applesmc_int.patch 11196
+AUX mactel-patches-r147/appletouch-add-macbook3-trackpad.patch 1557 RMD160 ea7d021a3624ae4a341bf548920a10ad8178a65b SHA1 73119d3474ba024def6c4da57661111a1950a8b5 SHA256 4b7507a4d92119cba61684d2bb444d672f7f937d42c0058939472be58ec04326
+MD5 fa3057c540a4d18ef0f5b93c76a596b3 files/mactel-patches-r147/appletouch-add-macbook3-trackpad.patch 1557
+RMD160 ea7d021a3624ae4a341bf548920a10ad8178a65b files/mactel-patches-r147/appletouch-add-macbook3-trackpad.patch 1557
+SHA256 4b7507a4d92119cba61684d2bb444d672f7f937d42c0058939472be58ec04326 files/mactel-patches-r147/appletouch-add-macbook3-trackpad.patch 1557
+AUX mactel-patches-r147/appletouch-new.patch 13336 RMD160 7b5d6d63bf327d78d9aa3abaa1aea75b736c389e SHA1 253212ff2213c62a2cd3124f2e96139eed9f80a9 SHA256 f49b9247e8d81bd57d9b0a656b9dbb33143c0811310c9ed58f464425de1ab0b9
+MD5 df226eb394fa704d6ee700b201d7aac2 files/mactel-patches-r147/appletouch-new.patch 13336
+RMD160 7b5d6d63bf327d78d9aa3abaa1aea75b736c389e files/mactel-patches-r147/appletouch-new.patch 13336
+SHA256 f49b9247e8d81bd57d9b0a656b9dbb33143c0811310c9ed58f464425de1ab0b9 files/mactel-patches-r147/appletouch-new.patch 13336
+AUX mactel-patches-r147/appletouch.patch 673 RMD160 50ef1f3d00d621391d0414acbd814f1b89303854 SHA1 7d1ecad4d8c0801ab6949e6431eeb20dc6d57211 SHA256 c3a9011238a1ea7c416e0488fdc2578c2a34617c2147d67bb0b06f5bc11371a3
+MD5 8391f011e12b6595b032859daf831c32 files/mactel-patches-r147/appletouch.patch 673
+RMD160 50ef1f3d00d621391d0414acbd814f1b89303854 files/mactel-patches-r147/appletouch.patch 673
+SHA256 c3a9011238a1ea7c416e0488fdc2578c2a34617c2147d67bb0b06f5bc11371a3 files/mactel-patches-r147/appletouch.patch 673
+AUX mactel-patches-r147/disk-protect-update.patch 1129 RMD160 a1a321e8c166eb5ce34c76b2ff7682764f294646 SHA1 7a6b533b08a63fae689a78e4bf506800e30c28ab SHA256 8fce32db2e0545abd3cdf930774626b7067b82dd4a0967e03e9b46361446e9cf
+MD5 b8639cf0a84b602bc658c6579a85ee32 files/mactel-patches-r147/disk-protect-update.patch 1129
+RMD160 a1a321e8c166eb5ce34c76b2ff7682764f294646 files/mactel-patches-r147/disk-protect-update.patch 1129
+SHA256 8fce32db2e0545abd3cdf930774626b7067b82dd4a0967e03e9b46361446e9cf files/mactel-patches-r147/disk-protect-update.patch 1129
+AUX mactel-patches-r147/disk-protect.patch 27830 RMD160 d02d18affff697131e0c8ae80b4db8686532b12a SHA1 d196877b0f0b16507d2a6b3259b752e1e0b9530a SHA256 ff82391eaae9a3fd033b5a681f51a26707ea752c51cbf6cc6bc8aa7bc0dd510c
+MD5 fc4d0937a1395643ab927d86744284dc files/mactel-patches-r147/disk-protect.patch 27830
+RMD160 d02d18affff697131e0c8ae80b4db8686532b12a files/mactel-patches-r147/disk-protect.patch 27830
+SHA256 ff82391eaae9a3fd033b5a681f51a26707ea752c51cbf6cc6bc8aa7bc0dd510c files/mactel-patches-r147/disk-protect.patch 27830
+AUX mactel-patches-r147/export-lookup_dev.patch 422 RMD160 752272834b67c6c5ef9beac68bd4b013910d8ad9 SHA1 c1734b06377c6efbabc618ea64ecb27b5e012240 SHA256 fc2497fd867be26ba91248377d114a744f528f7025d5c0974f7898b458f2b900
+MD5 6ecbf8c655ab3bdef6750fdfc99c7e97 files/mactel-patches-r147/export-lookup_dev.patch 422
+RMD160 752272834b67c6c5ef9beac68bd4b013910d8ad9 files/mactel-patches-r147/export-lookup_dev.patch 422
+SHA256 fc2497fd867be26ba91248377d114a744f528f7025d5c0974f7898b458f2b900 files/mactel-patches-r147/export-lookup_dev.patch 422
+AUX mactel-patches-r147/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 819 RMD160 50a2062ffb6c9e22c699ce6703d61bdafdbb568b SHA1 69006e0d2dfbe60de246f7827293e8bf2c992c5a SHA256 4c1ca6bbec2960f405d922ec5e585bd814c19877e36f2b926762f2b0c59cbfdc
+MD5 b584e6f62bce3fd2dfb9af50a937894b files/mactel-patches-r147/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 819
+RMD160 50a2062ffb6c9e22c699ce6703d61bdafdbb568b files/mactel-patches-r147/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 819
+SHA256 4c1ca6bbec2960f405d922ec5e585bd814c19877e36f2b926762f2b0c59cbfdc files/mactel-patches-r147/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch 819
+AUX mactel-patches-r147/sigmatel_audio_fix_macbook_v2.patch 855 RMD160 8135541c8f9c988d78f4892c81b503d703a26b97 SHA1 1b39cf5e36063cb9043ccae8e01709366fb25102 SHA256 08362cac191683e4d615e5f1220c976cf62bc2cf0d2850ee23c5c14d75638ac6
+MD5 eaefd430cae30ad5307ea58ba9f2be57 files/mactel-patches-r147/sigmatel_audio_fix_macbook_v2.patch 855
+RMD160 8135541c8f9c988d78f4892c81b503d703a26b97 files/mactel-patches-r147/sigmatel_audio_fix_macbook_v2.patch 855
+SHA256 08362cac191683e4d615e5f1220c976cf62bc2cf0d2850ee23c5c14d75638ac6 files/mactel-patches-r147/sigmatel_audio_fix_macbook_v2.patch 855
DIST genpatches-2.6.22-2.base.tar.bz2 2742 RMD160 2bfb0c05acd2eb01f785d58d9785fc2f9a14d606 SHA1 78883f122d349940fc012d472eea64fec8cf179b SHA256 056838c82c8b6ef028afbe2b654882f375dedfe85eb8fec28b3919dd52048b6e
DIST genpatches-2.6.22-2.extras.tar.bz2 63706 RMD160 42f3ec0477edb3751068f6fc815aab3f0065d619 SHA1 4715440b92f04466e2fc6f2d5d451b9eb084d62d SHA256 2c1bd61ab9c1c52748f1d70a967efc75d88d41c8f8864a0864754632b32538a8
DIST genpatches-2.6.22-6.base.tar.bz2 37424 RMD160 ad09510b3330014fd0ee945dfe5c5665b7571e4e SHA1 3cf8563ad950bddc7cef4cb569f429104efa8319 SHA256 7dad76e531041f4254a38c8ffbc94300cdabcf92dbc6b8c3d5f48e5f42b408fb
DIST genpatches-2.6.22-6.extras.tar.bz2 63748 RMD160 8e3f1503ab8ecb036b50bd9b5ce4d919f8841bf0 SHA1 05cb23861a665ba577f91d93f41e04054cb10826 SHA256 7dc5a4390c9f073261a7019023cdef0c2a583441d1e0ec512f54662246c83d3f
DIST genpatches-2.6.23-1.base.tar.bz2 3147 RMD160 555ed180e4e700f3ce913fe460f05eb8f71dfe46 SHA1 3d68154d4d956460aa66b6c6d30e857696d8c2f2 SHA256 773cbe243642b1c10a49cab1175fa1c54c0ca67d6471257ce66417a754d87578
DIST genpatches-2.6.23-1.extras.tar.bz2 57252 RMD160 201fdd76ba5024f662da2c2d20e03093bcecc6d5 SHA1 196238c658d68d9046b70c98d1340a1305a102df SHA256 50bf8799ea7816d72b0db7c0fa4b886379b7b49f366fd647130318ad5de314b6
+DIST genpatches-2.6.23-5.base.tar.bz2 82324 RMD160 b49a59910d95bd12f077a5de51961cbb5799895e SHA1 edff5b23fb3c9949a76f5c58d95c1542f72d757b SHA256 d778784f81b1bfd342e0b94cbe2fc5324c102024c025e3152cf06c1e86787041
+DIST genpatches-2.6.23-5.extras.tar.bz2 147992 RMD160 bb9cfc7687944b677799b2386bc4b36d95676cea SHA1 fc7f24df398033cdf8e0ff444020c58407aa9925 SHA256 9d272384be06e00ecfdfa1795262a0859e86acd09aa95c531ff311e210d87db6
DIST linux-2.6.22.tar.bz2 45119878 RMD160 c4b2ca5ee8e71c0f8f1c95f3c9c5f261f2785912 SHA1 39401f195a618f397312d6d84ff9aebe28d99381 SHA256 73c10604c53f1a6ee65ef805293d23903696f8cef864f42d7de9506f0d2ba4c7
DIST linux-2.6.23.tar.bz2 45488158 RMD160 755690e80751d5de86d260fe05c6eeadde116c4e SHA1 3a186adf13e44415796ab6381aa8979b16a5d5ca SHA256 d4e67c0935ffb2a4158234bff92cc791b83177866009fc9b2214104e0038dbdb
EBUILD mactel-linux-sources-2.6.22-r1.ebuild 1015 RMD160 22bd8b202d28859ff8edb96af0b93b0c558265b0 SHA1 cb307f63b24e02185fdd25128edca03fc0abb1bb SHA256 0e8be879af694f1e2f6d48e43559396fbb68f1c687ee3f12c8ea3806e504a4cf
@@ -150,6 +208,10 @@ EBUILD mactel-linux-sources-2.6.22-r3.ebuild 1078 RMD160 4cd254b19d7d44da181dfd4
MD5 e7c7735f09675aa9608a8b0f586e74e3 mactel-linux-sources-2.6.22-r3.ebuild 1078
RMD160 4cd254b19d7d44da181dfd4b55937de6b4e89874 mactel-linux-sources-2.6.22-r3.ebuild 1078
SHA256 83c556df36a29032649bf8cb577f846319c5c402acbc1a8c9356854173008c38 mactel-linux-sources-2.6.22-r3.ebuild 1078
+EBUILD mactel-linux-sources-2.6.23-r4.ebuild 1399 RMD160 8e498711091da40a9043349ffa712b1c734b734e SHA1 ddf8a256f24cdd963997c3e4bb5dff11725adda1 SHA256 9e2b46d64079a4089174972077c2780c4655e150d473d571b5e8c4d405ea8542
+MD5 8256e5295d80ae200b4b1f51a2b71184 mactel-linux-sources-2.6.23-r4.ebuild 1399
+RMD160 8e498711091da40a9043349ffa712b1c734b734e mactel-linux-sources-2.6.23-r4.ebuild 1399
+SHA256 9e2b46d64079a4089174972077c2780c4655e150d473d571b5e8c4d405ea8542 mactel-linux-sources-2.6.23-r4.ebuild 1399
EBUILD mactel-linux-sources-2.6.23.ebuild 1156 RMD160 4c3b8420602b14a72171871be7c020fc63c05035 SHA1 64eb69b750c1835baa6cb0c6739404e694458cae SHA256 67940fc4f01bde5f9de48f9fc40c24294115684e5f0b9ac8b8d40892e11e2119
MD5 ec2ef327082d9e951adedb0459d18f5a mactel-linux-sources-2.6.23.ebuild 1156
RMD160 4c3b8420602b14a72171871be7c020fc63c05035 mactel-linux-sources-2.6.23.ebuild 1156
@@ -166,3 +228,6 @@ SHA256 84793279800820a1c88618a2289f390a53f8c588a50b410d3db0628dada5152f files/di
MD5 a7ba4e2a2e7a567fe407d52487601a88 files/digest-mactel-linux-sources-2.6.23 798
RMD160 727017fda5a3d16387937ecdcb2522210125263b files/digest-mactel-linux-sources-2.6.23 798
SHA256 91c37606d2f9fabebecbd311a1ecd0a89b6058c624b90fed135be807d116feba files/digest-mactel-linux-sources-2.6.23 798
+MD5 3560859548cebc2c6daf3fd183837141 files/digest-mactel-linux-sources-2.6.23-r4 804
+RMD160 906ae21265c8886a7d629d56524e3bb6a7f7294e files/digest-mactel-linux-sources-2.6.23-r4 804
+SHA256 6be75c66c3e929c8f25d6c83e4c50e8ad09776b92730848ae87362dff6d350cf files/digest-mactel-linux-sources-2.6.23-r4 804
diff --git a/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.23-r4 b/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.23-r4
new file mode 100644
index 0000000..ec91f85
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.23-r4
@@ -0,0 +1,9 @@
+MD5 7d5635db5777ea121e8d79ea8191ceb1 genpatches-2.6.23-5.base.tar.bz2 82324
+RMD160 b49a59910d95bd12f077a5de51961cbb5799895e genpatches-2.6.23-5.base.tar.bz2 82324
+SHA256 d778784f81b1bfd342e0b94cbe2fc5324c102024c025e3152cf06c1e86787041 genpatches-2.6.23-5.base.tar.bz2 82324
+MD5 df2ea06b7452990fd75f3b4f55c2feaf genpatches-2.6.23-5.extras.tar.bz2 147992
+RMD160 bb9cfc7687944b677799b2386bc4b36d95676cea genpatches-2.6.23-5.extras.tar.bz2 147992
+SHA256 9d272384be06e00ecfdfa1795262a0859e86acd09aa95c531ff311e210d87db6 genpatches-2.6.23-5.extras.tar.bz2 147992
+MD5 2cc2fd4d521dc5d7cfce0d8a9d1b3472 linux-2.6.23.tar.bz2 45488158
+RMD160 755690e80751d5de86d260fe05c6eeadde116c4e linux-2.6.23.tar.bz2 45488158
+SHA256 d4e67c0935ffb2a4158234bff92cc791b83177866009fc9b2214104e0038dbdb linux-2.6.23.tar.bz2 45488158
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-for-mac-pro-2-x-quad-core.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-for-mac-pro-2-x-quad-core.patch
new file mode 100644
index 0000000..18ad843
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-for-mac-pro-2-x-quad-core.patch
@@ -0,0 +1,202 @@
+At least the 2x Quad-Core Apple Mac Pro appears to have some over-heat
+
+From: Nicolas Boichat <nicolas@boichat.ch>
+
+protection which suddenly powers off the whole box under load. This adds
+support for the fans and temerature sensors in the Mac Pro - later some
+"windwarm" a-like code should probably monitor the values. For now
+manually tweaking the fans prevents the sudden shutdown for me.
+
+cd /sys/devices/platform/applesmc.768
+for x in fan{1,2,3,4}; do
+ echo 1 > ${x}_manual
+ echo 1285 > ${x}_output
+done
+
+Two sensors are 0, while four are 129 °C, those might be removed again,
+later.
+
+Signed-off-by: René Rebe <rene@exactcode.de
+Cc: Mark M. Hoffman <mhoffman@lightlink.com>
+Cc: Nicolas Boichat <nicolas@boichat.ch>
+Cc: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+---
+
+ drivers/hwmon/applesmc.c | 107 +++++++++++++++++++++++++++++++++++++++++++---
+ 1 files changed, 101 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
+index cea8d78..4b90444 100644
+--- a/drivers/hwmon/applesmc.c
++++ b/drivers/hwmon/applesmc.c
+@@ -80,7 +80,7 @@
+ /*
+ * Temperature sensors keys (sp78 - 2 bytes).
+ */
+-static const char* temperature_sensors_sets[][13] = {
++static const char* temperature_sensors_sets[][36] = {
+ /* Set 0: Macbook Pro */
+ { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
+ "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
+@@ -88,7 +88,13 @@ static const char* temperature_sensors_sets[][13] = {
+ { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
+ "Th1H", "Ts0P", NULL },
+ /* Set 2: Macmini set */
+- { "TC0D", "TC0P", NULL }
++ { "TC0D", "TC0P", NULL },
++/* Set 3: Mac Pro (2 x Quad-Core) */
++ { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P",
++ "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P",
++ "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S",
++ "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P",
++ "TM9S", "TN0H", "TS0C", NULL },
+ };
+
+ /* List of keys used to read/write fan speeds */
+@@ -990,14 +996,18 @@ static struct attribute *fan##offset##_attributes[] = { \
+
+ /*
+ * Create the needed functions for each fan using the macro defined above
+- * (2 fans are supported)
++ * (4 fans are supported)
+ */
+ sysfs_fan_speeds_offset(1);
+ sysfs_fan_speeds_offset(2);
++sysfs_fan_speeds_offset(3);
++sysfs_fan_speeds_offset(4);
+
+ static const struct attribute_group fan_attribute_groups[] = {
+ { .attrs = fan1_attributes },
+- { .attrs = fan2_attributes }
++ { .attrs = fan2_attributes },
++ { .attrs = fan3_attributes },
++ { .attrs = fan4_attributes }
+ };
+
+ /*
+@@ -1027,6 +1037,52 @@ static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO,
+ applesmc_show_temperature, NULL, 10);
+ static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO,
+ applesmc_show_temperature, NULL, 11);
++static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 12);
++static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 13);
++static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 14);
++static SENSOR_DEVICE_ATTR(temp16_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 15);
++static SENSOR_DEVICE_ATTR(temp17_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 16);
++static SENSOR_DEVICE_ATTR(temp18_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 17);
++static SENSOR_DEVICE_ATTR(temp19_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 18);
++static SENSOR_DEVICE_ATTR(temp20_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 19);
++static SENSOR_DEVICE_ATTR(temp21_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 20);
++static SENSOR_DEVICE_ATTR(temp22_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 21);
++static SENSOR_DEVICE_ATTR(temp23_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 22);
++static SENSOR_DEVICE_ATTR(temp24_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 23);
++static SENSOR_DEVICE_ATTR(temp25_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 24);
++static SENSOR_DEVICE_ATTR(temp26_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 25);
++static SENSOR_DEVICE_ATTR(temp27_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 26);
++static SENSOR_DEVICE_ATTR(temp28_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 27);
++static SENSOR_DEVICE_ATTR(temp29_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 28);
++static SENSOR_DEVICE_ATTR(temp30_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 29);
++static SENSOR_DEVICE_ATTR(temp31_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 30);
++static SENSOR_DEVICE_ATTR(temp32_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 31);
++static SENSOR_DEVICE_ATTR(temp33_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 32);
++static SENSOR_DEVICE_ATTR(temp34_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 33);
++static SENSOR_DEVICE_ATTR(temp35_input, S_IRUGO,
++ applesmc_show_temperature, NULL, 34);
+
+ static struct attribute *temperature_attributes[] = {
+ &sensor_dev_attr_temp1_input.dev_attr.attr,
+@@ -1041,6 +1097,29 @@ static struct attribute *temperature_attributes[] = {
+ &sensor_dev_attr_temp10_input.dev_attr.attr,
+ &sensor_dev_attr_temp11_input.dev_attr.attr,
+ &sensor_dev_attr_temp12_input.dev_attr.attr,
++ &sensor_dev_attr_temp13_input.dev_attr.attr,
++ &sensor_dev_attr_temp14_input.dev_attr.attr,
++ &sensor_dev_attr_temp15_input.dev_attr.attr,
++ &sensor_dev_attr_temp16_input.dev_attr.attr,
++ &sensor_dev_attr_temp17_input.dev_attr.attr,
++ &sensor_dev_attr_temp18_input.dev_attr.attr,
++ &sensor_dev_attr_temp19_input.dev_attr.attr,
++ &sensor_dev_attr_temp20_input.dev_attr.attr,
++ &sensor_dev_attr_temp21_input.dev_attr.attr,
++ &sensor_dev_attr_temp22_input.dev_attr.attr,
++ &sensor_dev_attr_temp23_input.dev_attr.attr,
++ &sensor_dev_attr_temp24_input.dev_attr.attr,
++ &sensor_dev_attr_temp25_input.dev_attr.attr,
++ &sensor_dev_attr_temp26_input.dev_attr.attr,
++ &sensor_dev_attr_temp27_input.dev_attr.attr,
++ &sensor_dev_attr_temp28_input.dev_attr.attr,
++ &sensor_dev_attr_temp29_input.dev_attr.attr,
++ &sensor_dev_attr_temp30_input.dev_attr.attr,
++ &sensor_dev_attr_temp31_input.dev_attr.attr,
++ &sensor_dev_attr_temp32_input.dev_attr.attr,
++ &sensor_dev_attr_temp33_input.dev_attr.attr,
++ &sensor_dev_attr_temp34_input.dev_attr.attr,
++ &sensor_dev_attr_temp35_input.dev_attr.attr,
+ NULL
+ };
+
+@@ -1137,6 +1216,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
+ { .accelerometer = 1, .light = 0, .temperature_set = 1 },
+ /* MacMini: temperature set 2 */
+ { .accelerometer = 0, .light = 0, .temperature_set = 2 },
++/* MacPro: temperature set 3 */
++ { .accelerometer = 0, .light = 0, .temperature_set = 3 },
+ };
+
+ /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
+@@ -1154,6 +1235,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
+ DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") },
+ (void*)&applesmc_dmi_data[2]},
++ { applesmc_dmi_match, "Apple MacPro2", {
++ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
++ DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
++ (void*)&applesmc_dmi_data[3]},
+ { .ident = NULL }
+ };
+
+@@ -1204,9 +1289,19 @@ static int __init applesmc_init(void)
+
+ switch (count) {
+ default:
+- printk(KERN_WARNING "applesmc: More than 2 fans found,"
+- " but at most 2 fans are supported"
++ printk(KERN_WARNING "applesmc: More than 4 fans found,"
++ " but at most 4 fans are supported"
+ " by the driver.\n");
++ case 4:
++ ret = sysfs_create_group(&pdev->dev.kobj,
++ &fan_attribute_groups[3]);
++ if (ret)
++ goto out_key_enumeration;
++ case 3:
++ ret = sysfs_create_group(&pdev->dev.kobj,
++ &fan_attribute_groups[2]);
++ if (ret)
++ goto out_key_enumeration;
+ case 2:
+ ret = sysfs_create_group(&pdev->dev.kobj,
+ &fan_attribute_groups[1]);
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-int-protect.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-int-protect.patch
new file mode 100644
index 0000000..29c7f61
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-int-protect.patch
@@ -0,0 +1,303 @@
+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 e74a89d..690135c 100644
+--- a/drivers/hwmon/Kconfig
++++ b/drivers/hwmon/Kconfig
+@@ -685,6 +685,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 d04f900..5fc1231 100644
+--- a/drivers/hwmon/Makefile
++++ b/drivers/hwmon/Makefile
+@@ -67,3 +67,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 00ce2d1..e195af0 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;
+
+@@ -1206,6 +1300,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,
+@@ -1218,6 +1316,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,
+@@ -1458,6 +1559,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);
+@@ -1491,6 +1596,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:
+@@ -1510,6 +1639,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/mactel-patches-r147/applesmc-macbook2.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-macbook2.patch
new file mode 100644
index 0000000..860b246
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-macbook2.patch
@@ -0,0 +1,76 @@
+Add sensors set for MacBook2, from register dump on a mid-2007 MacBook2.
+
+From: Riki Oktarianto <rkoktarianto@gmail.com>
+
+
+---
+
+ drivers/hwmon/applesmc.c | 29 +++++++++++++++++++----------
+ 1 files changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
+index 3c9ba72..ce0fe69 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",
+@@ -1237,12 +1240,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".
+@@ -1254,16 +1259,20 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
+ (void*)&applesmc_dmi_data[0]},
+ { applesmc_dmi_match, "Apple MacBook", {
+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
+- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
++ DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") },
+ (void*)&applesmc_dmi_data[1]},
++ { applesmc_dmi_match, "Apple MacBook", {
++ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
++ DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
++ (void*)&applesmc_dmi_data[2]},
+ { applesmc_dmi_match, "Apple Macmini", {
+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
+ DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") },
+- (void*)&applesmc_dmi_data[2]},
++ (void*)&applesmc_dmi_data[3]},
+ { applesmc_dmi_match, "Apple MacPro2", {
+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
+ DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
+- (void*)&applesmc_dmi_data[3]},
++ (void*)&applesmc_dmi_data[4]},
+ { .ident = NULL }
+ };
+
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-retry-when-accessing-keys.patch
new file mode 100644
index 0000000..f6b145b
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-retry-when-accessing-keys.patch
@@ -0,0 +1,115 @@
+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 4b90444..3c9ba72 100644
+--- a/drivers/hwmon/applesmc.c
++++ b/drivers/hwmon/applesmc.c
+@@ -109,6 +109,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
+@@ -183,12 +186,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 "
+@@ -196,33 +200,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/mactel-patches-r147/applesmc-use-input-polldev.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-use-input-polldev.patch
new file mode 100644
index 0000000..06a9998
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc-use-input-polldev.patch
@@ -0,0 +1,221 @@
+HWMON: applesmc - convert to use input-polldev.
+
+From: Nicolas Boichat <nicolas@boichat.ch>
+
+Switch to using input-polldev skeleton instead of implementing
+polling loop by itself. This also fixes problem with trylock
+on a mutex in atomic context.
+
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+---
+
+ drivers/hwmon/Kconfig | 1 +
+ drivers/hwmon/applesmc.c | 83 +++++++++++++++++-----------------------------
+ 2 files changed, 31 insertions(+), 53 deletions(-)
+
+diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
+index 192953b..e74a89d 100644
+--- a/drivers/hwmon/Kconfig
++++ b/drivers/hwmon/Kconfig
+@@ -665,6 +665,7 @@ config SENSORS_APPLESMC
+ depends on INPUT && X86
+ select NEW_LEDS
+ select LEDS_CLASS
++ select INPUT_POLLDEV
+ default n
+ help
+ This driver provides support for the Apple System Management
+diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
+index 941729a..cea8d78 100644
+--- a/drivers/hwmon/applesmc.c
++++ b/drivers/hwmon/applesmc.c
+@@ -28,7 +28,7 @@
+
+ #include <linux/delay.h>
+ #include <linux/platform_device.h>
+-#include <linux/input.h>
++#include <linux/input-polldev.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/timer.h>
+@@ -59,9 +59,9 @@
+
+ #define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */
+ #define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */
+-#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
++#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
+
+-#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
++#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
+
+ #define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */
+ #define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */
+@@ -103,7 +103,7 @@ static const char* fan_speed_keys[] = {
+ #define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */
+ #define INIT_WAIT_MSECS 50 /* ... in 50ms increments */
+
+-#define APPLESMC_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */
++#define APPLESMC_POLL_INTERVAL 50 /* msecs */
+ #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
+ #define APPLESMC_INPUT_FLAT 4
+
+@@ -125,8 +125,7 @@ static const int debug;
+ static struct platform_device *pdev;
+ static s16 rest_x;
+ static s16 rest_y;
+-static struct timer_list applesmc_timer;
+-static struct input_dev *applesmc_idev;
++static struct input_polled_dev *applesmc_idev;
+ static struct class_device *hwmon_class_dev;
+
+ /* Indicates whether this computer has an accelerometer. */
+@@ -138,7 +137,7 @@ static unsigned int applesmc_light;
+ /* Indicates which temperature sensors set to use. */
+ static unsigned int applesmc_temperature_set;
+
+-static struct mutex applesmc_lock;
++static DEFINE_MUTEX(applesmc_lock);
+
+ /*
+ * Last index written to key_at_index sysfs file, and value to use for all other
+@@ -455,27 +454,12 @@ static void applesmc_calibrate(void)
+ rest_x = -rest_x;
+ }
+
+-static int applesmc_idev_open(struct input_dev *dev)
+-{
+- add_timer(&applesmc_timer);
+-
+- return 0;
+-}
+-
+-static void applesmc_idev_close(struct input_dev *dev)
+-{
+- del_timer_sync(&applesmc_timer);
+-}
+-
+-static void applesmc_idev_poll(unsigned long unused)
++static void applesmc_idev_poll(struct input_polled_dev *dev)
+ {
++ struct input_dev *idev = dev->input;
+ s16 x, y;
+
+- /* Cannot sleep. Try nonblockingly. If we fail, try again later. */
+- if (!mutex_trylock(&applesmc_lock)) {
+- mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
+- return;
+- }
++ mutex_lock(&applesmc_lock);
+
+ if (applesmc_read_motion_sensor(SENSOR_X, &x))
+ goto out;
+@@ -483,13 +467,11 @@ static void applesmc_idev_poll(unsigned long unused)
+ goto out;
+
+ x = -x;
+- input_report_abs(applesmc_idev, ABS_X, x - rest_x);
+- input_report_abs(applesmc_idev, ABS_Y, y - rest_y);
+- input_sync(applesmc_idev);
++ input_report_abs(idev, ABS_X, x - rest_x);
++ input_report_abs(idev, ABS_Y, y - rest_y);
++ input_sync(idev);
+
+ out:
+- mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
+-
+ mutex_unlock(&applesmc_lock);
+ }
+
+@@ -821,8 +803,7 @@ static ssize_t applesmc_key_at_index_read_show(struct device *dev,
+
+ if (!ret) {
+ return info[0];
+- }
+- else {
++ } else {
+ return ret;
+ }
+ }
+@@ -1093,6 +1074,7 @@ static int applesmc_dmi_match(struct dmi_system_id *id)
+ /* Create accelerometer ressources */
+ static int applesmc_create_accelerometer(void)
+ {
++ struct input_dev *idev;
+ int ret;
+
+ ret = sysfs_create_group(&pdev->dev.kobj,
+@@ -1100,40 +1082,37 @@ static int applesmc_create_accelerometer(void)
+ if (ret)
+ goto out;
+
+- applesmc_idev = input_allocate_device();
++ applesmc_idev = input_allocate_polled_device();
+ if (!applesmc_idev) {
+ ret = -ENOMEM;
+ goto out_sysfs;
+ }
+
++ applesmc_idev->poll = applesmc_idev_poll;
++ applesmc_idev->poll_interval = APPLESMC_POLL_INTERVAL;
++
+ /* initial calibrate for the input device */
+ applesmc_calibrate();
+
+- /* initialize the input class */
+- applesmc_idev->name = "applesmc";
+- applesmc_idev->id.bustype = BUS_HOST;
+- applesmc_idev->dev.parent = &pdev->dev;
+- applesmc_idev->evbit[0] = BIT(EV_ABS);
+- applesmc_idev->open = applesmc_idev_open;
+- applesmc_idev->close = applesmc_idev_close;
+- input_set_abs_params(applesmc_idev, ABS_X,
++ /* initialize the input device */
++ idev = applesmc_idev->input;
++ idev->name = "applesmc";
++ idev->id.bustype = BUS_HOST;
++ idev->dev.parent = &pdev->dev;
++ idev->evbit[0] = BIT(EV_ABS);
++ input_set_abs_params(idev, ABS_X,
+ -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
+- input_set_abs_params(applesmc_idev, ABS_Y,
++ input_set_abs_params(idev, ABS_Y,
+ -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
+
+- ret = input_register_device(applesmc_idev);
++ ret = input_register_polled_device(applesmc_idev);
+ if (ret)
+ goto out_idev;
+
+- /* start up our timer for the input device */
+- init_timer(&applesmc_timer);
+- applesmc_timer.function = applesmc_idev_poll;
+- applesmc_timer.expires = jiffies + APPLESMC_POLL_PERIOD;
+-
+ return 0;
+
+ out_idev:
+- input_free_device(applesmc_idev);
++ input_free_polled_device(applesmc_idev);
+
+ out_sysfs:
+ sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
+@@ -1146,8 +1125,8 @@ out:
+ /* Release all ressources used by the accelerometer */
+ static void applesmc_release_accelerometer(void)
+ {
+- del_timer_sync(&applesmc_timer);
+- input_unregister_device(applesmc_idev);
++ input_unregister_polled_device(applesmc_idev);
++ input_free_polled_device(applesmc_idev);
+ sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
+ }
+
+@@ -1184,8 +1163,6 @@ static int __init applesmc_init(void)
+ int count;
+ int i;
+
+- mutex_init(&applesmc_lock);
+-
+ if (!dmi_check_system(applesmc_whitelist)) {
+ printk(KERN_WARNING "applesmc: supported laptop not found!\n");
+ ret = -ENODEV;
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc_int.patch
new file mode 100644
index 0000000..80aad72
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/applesmc_int.patch
@@ -0,0 +1,415 @@
+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 ce0fe69..00ce2d1 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/mactel-patches-r147/appletouch-add-macbook3-trackpad.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch-add-macbook3-trackpad.patch
new file mode 100644
index 0000000..d397802
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch-add-macbook3-trackpad.patch
@@ -0,0 +1,50 @@
+Added IDs for macbook3,1 trackpad
+
+From: Chris Irwin <chris@chrisirwin.ca>
+
+
+---
+
+ drivers/input/mouse/appletouch.c | 15 ++++++++++++++-
+ 1 files changed, 14 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
+index 4c838d1..1f5d5c2 100644
+--- a/drivers/input/mouse/appletouch.c
++++ b/drivers/input/mouse/appletouch.c
+@@ -67,6 +67,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 | \
+@@ -100,6 +105,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 */
+ { }
+ };
+@@ -227,7 +237,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/mactel-patches-r147/appletouch-new.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch-new.patch
new file mode 100644
index 0000000..a81fe75
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch-new.patch
@@ -0,0 +1,385 @@
+A few month ago I implemented palm-detection to the appletouch driver and
+
+From: Sven Anders <anders@anduras.de>
+
+released a development version. Currently I'm trying to reimplement these
+in a clean way and I'm planning to release it in parts, so I would be accepted
+by the kernel developers.
+
+Late in the develoment progress I found out, that the new Geyser 3/4 touchpad
+have special status flags. This patch implements the usage of them and corrects
+the calculation of the pressure (for later usage by the palm detection).
+
+It was tested by some debian people (Johannes Berg, Michel Dänzer, Gaudenz
+Steinlin) on the PowerBook and works there too.
+---
+
+ drivers/input/mouse/appletouch.c | 187 ++++++++++++++++++++++++++------------
+ 1 files changed, 126 insertions(+), 61 deletions(-)
+
+diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
+index 51cc7c3..4c838d1 100644
+--- a/drivers/input/mouse/appletouch.c
++++ b/drivers/input/mouse/appletouch.c
+@@ -8,8 +8,12 @@
+ * Copyright (C) 2005 Peter Osterlund (petero2@telia.com)
+ * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch)
+ * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch)
++ * Copyright (C) 2007 Sven Anders (anders@anduras.de)
+ *
+ * Thanks to Alex Harper <basilisk@foobox.net> for his inputs.
++ * Jason Parekh <jasonparekh@gmail.com> for better finger detection.
++ * Matthew Garrett <mjg59@srcf.ucam.org> for power saving additions.
++ * Soeren Sonnenburg <mactel-ml@nn7.de> for corrections and ideas.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+@@ -38,16 +42,17 @@
+ #define APPLE_VENDOR_ID 0x05AC
+
+ /* These names come from Info.plist in AppleUSBTrackpad.kext */
++
++/* PowerBooks Feb 2005 / iBooks */
+ #define FOUNTAIN_ANSI_PRODUCT_ID 0x020E
+ #define FOUNTAIN_ISO_PRODUCT_ID 0x020F
+-
+ #define FOUNTAIN_TP_ONLY_PRODUCT_ID 0x030A
+-
+ #define GEYSER1_TP_ONLY_PRODUCT_ID 0x030B
+
+-#define GEYSER_ANSI_PRODUCT_ID 0x0214
+-#define GEYSER_ISO_PRODUCT_ID 0x0215
+-#define GEYSER_JIS_PRODUCT_ID 0x0216
++/* PowerBooks Oct 2005 */
++#define GEYSER2_ANSI_PRODUCT_ID 0x0214
++#define GEYSER2_ISO_PRODUCT_ID 0x0215
++#define GEYSER2_JIS_PRODUCT_ID 0x0216
+
+ /* MacBook devices */
+ #define GEYSER3_ANSI_PRODUCT_ID 0x0217
+@@ -58,9 +63,9 @@
+ * Geyser IV: same as Geyser III according to Info.plist in AppleUSBTrackpad.kext
+ * -> same IOClass (AppleUSBGrIIITrackpad), same acceleration tables
+ */
+-#define GEYSER4_ANSI_PRODUCT_ID 0x021A
+-#define GEYSER4_ISO_PRODUCT_ID 0x021B
+-#define GEYSER4_JIS_PRODUCT_ID 0x021C
++#define GEYSER4_ANSI_PRODUCT_ID 0x021A
++#define GEYSER4_ISO_PRODUCT_ID 0x021B
++#define GEYSER4_JIS_PRODUCT_ID 0x021C
+
+ #define ATP_DEVICE(prod) \
+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
+@@ -73,15 +78,17 @@
+
+ /* table of devices that work with this driver */
+ static struct usb_device_id atp_table [] = {
++
++ /* PowerBooks Feb 2005, iBooks G4 */
+ { ATP_DEVICE(FOUNTAIN_ANSI_PRODUCT_ID) },
+ { ATP_DEVICE(FOUNTAIN_ISO_PRODUCT_ID) },
+ { ATP_DEVICE(FOUNTAIN_TP_ONLY_PRODUCT_ID) },
+ { ATP_DEVICE(GEYSER1_TP_ONLY_PRODUCT_ID) },
+
+ /* PowerBooks Oct 2005 */
+- { ATP_DEVICE(GEYSER_ANSI_PRODUCT_ID) },
+- { ATP_DEVICE(GEYSER_ISO_PRODUCT_ID) },
+- { ATP_DEVICE(GEYSER_JIS_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER2_ANSI_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER2_ISO_PRODUCT_ID) },
++ { ATP_DEVICE(GEYSER2_JIS_PRODUCT_ID) },
+
+ /* Core Duo MacBook & MacBook Pro */
+ { ATP_DEVICE(GEYSER3_ANSI_PRODUCT_ID) },
+@@ -136,27 +143,36 @@ MODULE_DEVICE_TABLE (usb, atp_table);
+ #define ATP_GEYSER3_MODE_REQUEST_INDEX 0
+ #define ATP_GEYSER3_MODE_VENDOR_VALUE 0x04
+
++/*
++ * Meaning of the status bits (only Geyser 3/4?)
++ */
++#define ATP_STATUS_BIT_BUTTON 0x01 /* The button was pressed */
++#define ATP_STATUS_BIT_UNKNOWN1 0x02 /* Unknown or unused */
++#define ATP_STATUS_BIT_BASE_UPDATE 0x04 /* Update of the base values (untouched pad) */
++#define ATP_STATUS_BIT_UNKNOWN2 0x08 /* Unknown or unused */
++#define ATP_STATUS_BIT_FROM_RESET 0x10 /* Reset previously performed */
++
+ /* Structure to hold all of our device specific stuff */
+ struct atp {
+ char phys[64];
+ struct usb_device * udev; /* usb device */
+ struct urb * urb; /* usb request block */
+- signed char * data; /* transferred data */
++ u8 * data; /* transferred data */
+ int open; /* non-zero if opened */
+ struct input_dev *input; /* input dev */
+ int valid; /* are the sensors valid ? */
+ int x_old; /* last reported x/y, */
+ int y_old; /* used for smoothing */
+ /* current value of the sensors */
+- signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS];
++ u16 xy_cur[ATP_XSENSORS + ATP_YSENSORS];
+ /* last value of the sensors */
+- signed char xy_old[ATP_XSENSORS + ATP_YSENSORS];
++ u16 xy_old[ATP_XSENSORS + ATP_YSENSORS];
+ /* accumulated sensors */
+ int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
+ int overflowwarn; /* overflow warning printed? */
+ int datalen; /* size of an USB urb transfer */
+- int idlecount; /* number of empty packets */
+- struct work_struct work;
++ int idle_counter; /* idle counter */
++ struct work_struct work; /* kernel workqueue entry (for re-init) */
+ };
+
+ #define dbg_dump(msg, tab) \
+@@ -173,8 +189,12 @@ struct atp {
+ if (debug) printk(format, ##a); \
+ } while (0)
+
+-MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann");
+-MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver");
++MODULE_AUTHOR("Johannes Berg");
++MODULE_AUTHOR("Stelian Pop");
++MODULE_AUTHOR("Frank Arnold");
++MODULE_AUTHOR("Michael Hanselmann");
++MODULE_AUTHOR("Sven Anders");
++MODULE_DESCRIPTION("Apple PowerBook and MacBook USB touchpad driver");
+ MODULE_LICENSE("GPL");
+
+ /*
+@@ -184,7 +204,7 @@ static int threshold = ATP_THRESHOLD;
+ module_param(threshold, int, 0644);
+ MODULE_PARM_DESC(threshold, "Discards any change in data from a sensor (trackpad has hundreds of these sensors) less than this value");
+
+-static int debug = 1;
++static int debug;
+ module_param(debug, int, 0644);
+ MODULE_PARM_DESC(debug, "Activate debugging output");
+
+@@ -193,9 +213,9 @@ static inline int atp_is_geyser_2(struct atp *dev)
+ {
+ u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
+
+- return (productId == GEYSER_ANSI_PRODUCT_ID) ||
+- (productId == GEYSER_ISO_PRODUCT_ID) ||
+- (productId == GEYSER_JIS_PRODUCT_ID);
++ return (productId == GEYSER2_ANSI_PRODUCT_ID) ||
++ (productId == GEYSER2_ISO_PRODUCT_ID) ||
++ (productId == GEYSER2_JIS_PRODUCT_ID);
+ }
+
+ static inline int atp_is_geyser_3(struct atp *dev)
+@@ -211,24 +231,29 @@ static inline int atp_is_geyser_3(struct atp *dev)
+ }
+
+ /*
+- * By default Geyser 3 device sends standard USB HID mouse
+- * packets (Report ID 2). This code changes device mode, so it
+- * sends raw sensor reports (Report ID 5).
++ * By default Geyser 3 and Geyser 4 devices sends standard
++ * USB HID mouse packets (Report ID 2). This code changes device
++ * mode, so it sends raw sensor reports (Report ID 5).
+ */
+-static int atp_geyser3_init(struct usb_device *udev)
++static int atp_geyser3_4_init(struct usb_device *udev)
+ {
+ char data[8];
+ int size;
++ int i;
+
+ size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
+- ATP_GEYSER3_MODE_READ_REQUEST_ID,
+- USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+- ATP_GEYSER3_MODE_REQUEST_VALUE,
+- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
++ ATP_GEYSER3_MODE_READ_REQUEST_ID,
++ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
++ ATP_GEYSER3_MODE_REQUEST_VALUE,
++ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
+
+ if (size != 8) {
++ printk("appletouch atp_geyser3_4_init READ error\n");
++ for (i=0; i<8; i++)
++ printk("appletouch[%d]: %d\n", i, (int) data[i]);
++
+ err("Could not do mode read request from device"
+- " (Geyser 3 mode)");
++ " (Geyser 3/4 mode)");
+ return -EIO;
+ }
+
+@@ -236,27 +261,31 @@ static int atp_geyser3_init(struct usb_device *udev)
+ data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
+
+ size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+- ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
+- USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+- ATP_GEYSER3_MODE_REQUEST_VALUE,
+- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
++ ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
++ USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
++ ATP_GEYSER3_MODE_REQUEST_VALUE,
++ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
+
+ if (size != 8) {
++ printk("appletouch atp_geyser3_4_init WRITE error\n");
++ for (i=0; i<8; i++)
++ printk("appletouch[%d]: %d\n", i, (int) data[i]);
++
+ err("Could not do mode write request to device"
+- " (Geyser 3 mode)");
++ " (Geyser 3/4 mode)");
+ return -EIO;
+ }
+ return 0;
+ }
+
+-/* Reinitialise the device if it's a geyser 3 */
++/* Reinitialise the device if it's a geyser 3/4 */
+ static void atp_reinit(struct work_struct *work)
+ {
+ struct atp *dev = container_of(work, struct atp, work);
+ struct usb_device *udev = dev->udev;
+
+- dev->idlecount = 0;
+- atp_geyser3_init(udev);
++ dprintk("appletouch: putting appletouch to sleep (reinit)\n");
++ atp_geyser3_4_init(udev);
+ }
+
+ static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
+@@ -421,10 +450,15 @@ static void atp_complete(struct urb* urb)
+ dbg_dump("sample", dev->xy_cur);
+
+ if (!dev->valid) {
+- /* first sample */
++ /* first sample after init or resume */
+ dev->valid = 1;
+ dev->x_old = dev->y_old = -1;
+- memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
++ dev->idle_counter = 0;
++
++ /* store first sample on older Geyser */
++ if ((dev->data[dev->datalen-1] & ATP_STATUS_BIT_BASE_UPDATE) ||
++ !atp_is_geyser_3(dev))
++ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
+
+ if (atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */
+ goto exit;
+@@ -451,18 +485,39 @@ static void atp_complete(struct urb* urb)
+ goto exit;
+ }
+
++ /* Just update the base values (i.e. touchpad in untouched state) */
++ if (dev->data[dev->datalen-1] & ATP_STATUS_BIT_BASE_UPDATE)
++ {
++ if (debug > 0) printk("appletouch: updated base values\n");
++
++ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
++ goto exit;
++ }
++
+ for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) {
+- /* accumulate the change */
+- signed char change = dev->xy_old[i] - dev->xy_cur[i];
+- dev->xy_acc[i] -= change;
++ /* calculate the change */
++ dev->xy_acc[i] = dev->xy_cur[i] - dev->xy_old[i];
++
++ /* this is a round-robin value, so couple with that */
++ if (dev->xy_acc[i] > 127)
++ dev->xy_acc[i] -= 256;
++
++ if (dev->xy_acc[i] < -127)
++ dev->xy_acc[i] += 256;
++
++ /* Needed for the older Geyser */
++ if (!atp_is_geyser_3(dev))
++ {
++ /* store new 'untouched' value, if any new */
++ if (dev->xy_acc[i] < -1)
++ dev->xy_old[i] = dev->xy_cur[i];
++ }
+
+- /* prevent down drifting */
+- if (dev->xy_acc[i] < 0)
++ /* prevent down-drifting */
++ if (dev->xy_acc[i] < 0)
+ dev->xy_acc[i] = 0;
+ }
+
+- memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
+-
+ dbg_dump("accumulator", dev->xy_acc);
+
+ x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS,
+@@ -478,7 +533,7 @@ static void atp_complete(struct urb* urb)
+ dev->x_old = x;
+ dev->y_old = y;
+
+- if (debug > 1)
++ if (debug > 0)
+ printk("appletouch: X: %3d Y: %3d "
+ "Xz: %3d Yz: %3d\n",
+ x, y, x_z, y_z);
+@@ -503,20 +558,30 @@ static void atp_complete(struct urb* urb)
+ /* reset the accumulator on release */
+ memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
+
+- /* Geyser 3 will continue to send packets continually after
+- the first touch unless reinitialised. Do so if it's been
+- idle for a while in order to avoid waking the kernel up
+- several hundred times a second */
+- if (!key && atp_is_geyser_3(dev)) {
+- 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) {
++
++ /* Get every 10th sample, reset counter */
++ dev->idle_counter = 0;
++
++ /* Geyser 3/4 will continue to send packets continually
++ after the first touch. The function is called every
++ 8 milliseconds from interrups context, unless
++ reinitialised. Do so if it's been idle for a while
++ in order to avoid waking the kernel up several
++ hundred times a second */
++
++ if (!key && atp_is_geyser_3(dev))
+ schedule_work(&dev->work);
+- }
+ }
+ }
+
+- input_report_key(dev->input, BTN_LEFT, key);
++ input_report_key(dev->input, BTN_LEFT,
++ dev->data[dev->datalen - 1] & ATP_STATUS_BIT_BUTTON);
++
+ input_sync(dev->input);
+
+ exit:
+@@ -593,9 +658,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
+
+ if (atp_is_geyser_3(dev)) {
+ /* switch to raw sensor mode */
+- if (atp_geyser3_init(udev))
++ if (atp_geyser3_4_init(udev))
+ goto err_free_devs;
+-
+ printk("appletouch Geyser 3 inited.\n");
+ }
+
+@@ -670,6 +734,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
+ /* save our data pointer in this interface device */
+ usb_set_intfdata(iface, dev);
+
++ /* initialize kernel work queue for re-init out of interrupt context */
+ INIT_WORK(&dev->work, atp_reinit);
+
+ return 0;
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch.patch
new file mode 100644
index 0000000..0ec50e0
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/appletouch.patch
@@ -0,0 +1,23 @@
+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 a1804bf..51cc7c3 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
+
+ /* MacBook Pro (Geyser 3 & 4) initialization constants */
+ #define ATP_GEYSER3_MODE_READ_REQUEST_ID 1
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/disk-protect-update.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/disk-protect-update.patch
new file mode 100644
index 0000000..5daf810
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/disk-protect-update.patch
@@ -0,0 +1,36 @@
+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 3a3afd8..c4c9d71 100644
+--- a/block/ll_rw_blk.c
++++ b/block/ll_rw_blk.c
+@@ -4218,6 +4218,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 2fa892d..8626bac 100644
+--- a/include/linux/blkdev.h
++++ b/include/linux/blkdev.h
+@@ -128,6 +128,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/mactel-patches-r147/disk-protect.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/disk-protect.patch
new file mode 100644
index 0000000..cb6fb25
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/disk-protect.patch
@@ -0,0 +1,882 @@
+
+
+From: Elias Oltmanns <eo@nebensachen.de>
+
+
+---
+
+ Documentation/block/disk-protection.txt | 79 +++++++++++
+ block/ll_rw_blk.c | 224 +++++++++++++++++++++++++++++++
+ 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 | 1
+ include/linux/blkdev.h | 14 ++
+ include/linux/ide.h | 1
+ 9 files changed, 680 insertions(+), 0 deletions(-)
+
+diff --git a/Documentation/block/disk-protection.txt b/Documentation/block/disk-protection.txt
+new file mode 100644
+index 0000000..508cc5b
+--- /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@dresco.co.uk>.
++
++
++05 Dec 2006, Elias Oltmanns <eo@nebensachen.de>
+diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
+index 026cf24..3a3afd8 100644
+--- a/block/ll_rw_blk.c
++++ b/block/ll_rw_blk.c
+@@ -38,10 +38,14 @@
+
+ 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 void drive_stat_acct(struct request *rq, int nr_sectors, 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);
+ static struct io_context *current_io_context(gfp_t gfp_flags, int node);
++static int blk_protect_register(struct request_queue *q);
++static void blk_protect_unregister(struct request_queue *q);
+
+ /*
+ * For the allocated request tables
+@@ -227,6 +231,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
+ */
+@@ -318,6 +332,18 @@ void blk_queue_issue_flush_fn(struct request_queue *q, issue_flush_fn *iff)
+
+ EXPORT_SYMBOL(blk_queue_issue_flush_fn);
+
++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);
++
+ /*
+ * Cache flushing for ordered writes handling
+ */
+@@ -1849,6 +1875,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
+ return NULL;
+
+ init_timer(&q->unplug_timer);
++ init_timer(&q->unfreeze_timer);
+
+ snprintf(q->kobj.name, KOBJ_NAME_LEN, "%s", "queue");
+ q->kobj.ktype = &queue_ktype;
+@@ -4114,6 +4141,7 @@ int blk_register_queue(struct gendisk *disk)
+ return ret;
+ }
+
++ blk_protect_register(q);
+ return 0;
+ }
+
+@@ -4122,6 +4150,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);
+@@ -4129,3 +4158,198 @@ 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 1;
++
++ /* 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;
++ }
++ kobject_get(&q->kobj);
++
++ error = sysfs_create_file(&q->kobj, &queue_protect_method_entry.attr);
++ if (error) {
++ 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);
++ kobject_put(&q->kobj);
++ 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 e836476..c587bf1 100644
+--- a/drivers/ata/libata-scsi.c
++++ b/drivers/ata/libata-scsi.c
+@@ -781,6 +781,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
+@@ -806,6 +838,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 4754769..938408d 100644
+--- a/drivers/ide/ide-disk.c
++++ b/drivers/ide/ide-disk.c
+@@ -743,6 +743,145 @@ static int idedisk_issue_flush(struct request_queue *q, struct gendisk *disk,
+ }
+
+ /*
++ * 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.
+ */
+@@ -1017,6 +1156,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 aa9f5f0..e664f5c 100644
+--- a/drivers/ide/ide-io.c
++++ b/drivers/ide/ide-io.c
+@@ -1276,6 +1276,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()
+@@ -1773,6 +1784,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 a417a6f..ac5cd9c 100644
+--- a/drivers/scsi/scsi_lib.c
++++ b/drivers/scsi/scsi_lib.c
+@@ -2024,7 +2024,13 @@ EXPORT_SYMBOL(scsi_device_set_state);
+ 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;
+
+@@ -2273,3 +2279,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 c043c1c..618906f 100644
+--- a/include/linux/ata.h
++++ b/include/linux/ata.h
+@@ -344,6 +344,7 @@ struct ata_taskfile {
+ #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
+ #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
+ #define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
++#define ata_id_has_unload(id) ((id)[84] & (1 << 13))
+ #define ata_id_has_fua(id) ((id)[84] & (1 << 6))
+ #define ata_id_has_flush(id) ((id)[83] & (1 << 12))
+ #define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
+diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
+index d26bbb0..2fa892d 100644
+--- a/include/linux/blkdev.h
++++ b/include/linux/blkdev.h
+@@ -347,6 +347,8 @@ typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_ve
+ typedef int (issue_flush_fn) (struct request_queue *, struct gendisk *, sector_t *);
+ 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,
+@@ -384,6 +386,8 @@ struct request_queue
+ issue_flush_fn *issue_flush_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
+@@ -399,6 +403,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;
+
+ /*
+@@ -774,6 +786,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 20528c0..ee846d5 100644
+--- a/include/linux/ide.h
++++ b/include/linux/ide.h
+@@ -1110,6 +1110,7 @@ extern u64 ide_get_error_location(ide_drive_t *, char *);
+ */
+ 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/mactel-patches-r147/export-lookup_dev.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/export-lookup_dev.patch
new file mode 100644
index 0000000..f6f2a0c
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/export-lookup_dev.patch
@@ -0,0 +1,23 @@
+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 2980eab..5a928ac 100644
+--- a/fs/block_dev.c
++++ b/fs/block_dev.c
+@@ -1405,6 +1405,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/mactel-patches-r147/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
new file mode 100644
index 0000000..d484af8
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/sigmatel_audio_display_all_controls_when_subsystem_id_is_wrong.patch
@@ -0,0 +1,28 @@
+Display Macbook Pro 1st gen controls when the subsystem id is wrong (0x100).
+
+From: Nicolas Boichat <nicolas@boichat.ch>
+
+
+---
+
+ sound/pci/hda/patch_sigmatel.c | 4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
+index d46e7e4..78c5b45 100644
+--- a/sound/pci/hda/patch_sigmatel.c
++++ b/sound/pci/hda/patch_sigmatel.c
+@@ -2132,10 +2132,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/mactel-patches-r147/sigmatel_audio_fix_macbook_v2.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/sigmatel_audio_fix_macbook_v2.patch
new file mode 100644
index 0000000..e7a7783
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/files/mactel-patches-r147/sigmatel_audio_fix_macbook_v2.patch
@@ -0,0 +1,30 @@
+Fixes audio on Macbook v2.
+
+From: Marek Sterzik <marek@milimetr.org>
+
+
+---
+
+ sound/pci/hda/patch_sigmatel.c | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
+index 78c5b45..d747b19 100644
+--- a/sound/pci/hda/patch_sigmatel.c
++++ b/sound/pci/hda/patch_sigmatel.c
+@@ -69,6 +69,7 @@ enum {
+ /* for backward compitability */
+ STAC_MACMINI,
+ STAC_MACBOOK,
++ STAC_MACBOOK_V2,
+ STAC_MACBOOK_PRO_V1,
+ STAC_MACBOOK_PRO_V2,
+ STAC_IMAC_INTEL,
+@@ -625,6 +626,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = {
+ /* for backward compitability */
+ [STAC_MACMINI] = "macmini",
+ [STAC_MACBOOK] = "macbook",
++ [STAC_MACBOOK_V2] = "macbook-v2",
+ [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
+ [STAC_MACBOOK_PRO_V2] = "macbook-pro",
+ [STAC_IMAC_INTEL] = "imac-intel",
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.23-r4.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.23-r4.ebuild
new file mode 100644
index 0000000..b755f9b
--- /dev/null
+++ b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.23-r4.ebuild
@@ -0,0 +1,46 @@
+# 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="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}/mactel-patches-r147/"
+
+UNIPATCH_LIST="${PATCHDIR}/applesmc-use-input-polldev.patch \
+${PATCHDIR}/applesmc-for-mac-pro-2-x-quad-core.patch \
+${PATCHDIR}/applesmc-retry-when-accessing-keys.patch \
+${PATCHDIR}/applesmc-macbook2.patch \
+${PATCHDIR}/applesmc_int.patch \
+${PATCHDIR}/appletouch.patch \
+${PATCHDIR}/appletouch-new.patch \
+${PATCHDIR}/appletouch-add-macbook3-trackpad.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-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"
+}
+