summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.22-r19
-rw-r--r--sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.22-r29
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appleir-undo-hid-blacklist.patch30
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc-add-macbook-temperature-keys.patch46
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc-use-input-polldev.patch221
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc_int.patch415
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appletouch-shut-up-when-it-has-nothing-to-say.patch202
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appletouch.patch23
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r138/sigmatel-backport-2.6.23.patch341
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appleir-undo-hid-blacklist.patch30
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-add-macbook-temperature-keys.patch46
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-retry-when-accessing-keys.patch115
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-use-input-polldev.patch221
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc_int.patch415
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appletouch-shut-up-when-it-has-nothing-to-say.patch202
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appletouch.patch23
-rw-r--r--sys-kernel/mactel-linux-sources/files/mactel-patches-r140/sigmatel-backport-2.6.23.patch341
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r1.ebuild25
-rw-r--r--sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r2.ebuild28
19 files changed, 0 insertions, 2742 deletions
diff --git a/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.22-r1 b/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.22-r1
deleted file mode 100644
index 2d7b427..0000000
--- a/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.22-r1
+++ /dev/null
@@ -1,9 +0,0 @@
-MD5 b577e0db08d8ad136fc99c454ea57663 genpatches-2.6.22-2.base.tar.bz2 2742
-RMD160 2bfb0c05acd2eb01f785d58d9785fc2f9a14d606 genpatches-2.6.22-2.base.tar.bz2 2742
-SHA256 056838c82c8b6ef028afbe2b654882f375dedfe85eb8fec28b3919dd52048b6e genpatches-2.6.22-2.base.tar.bz2 2742
-MD5 d6ed7738a73e136d3e8fd846aac91467 genpatches-2.6.22-2.extras.tar.bz2 63706
-RMD160 42f3ec0477edb3751068f6fc815aab3f0065d619 genpatches-2.6.22-2.extras.tar.bz2 63706
-SHA256 2c1bd61ab9c1c52748f1d70a967efc75d88d41c8f8864a0864754632b32538a8 genpatches-2.6.22-2.extras.tar.bz2 63706
-MD5 2e230d005c002fb3d38a3ca07c0200d0 linux-2.6.22.tar.bz2 45119878
-RMD160 c4b2ca5ee8e71c0f8f1c95f3c9c5f261f2785912 linux-2.6.22.tar.bz2 45119878
-SHA256 73c10604c53f1a6ee65ef805293d23903696f8cef864f42d7de9506f0d2ba4c7 linux-2.6.22.tar.bz2 45119878
diff --git a/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.22-r2 b/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.22-r2
deleted file mode 100644
index 5c12d74..0000000
--- a/sys-kernel/mactel-linux-sources/files/digest-mactel-linux-sources-2.6.22-r2
+++ /dev/null
@@ -1,9 +0,0 @@
-MD5 c3585620eeb733566968805b85aeb74c genpatches-2.6.22-6.base.tar.bz2 37424
-RMD160 ad09510b3330014fd0ee945dfe5c5665b7571e4e genpatches-2.6.22-6.base.tar.bz2 37424
-SHA256 7dad76e531041f4254a38c8ffbc94300cdabcf92dbc6b8c3d5f48e5f42b408fb genpatches-2.6.22-6.base.tar.bz2 37424
-MD5 20b73d08be89dfe1588e1b0f21463eb3 genpatches-2.6.22-6.extras.tar.bz2 63748
-RMD160 8e3f1503ab8ecb036b50bd9b5ce4d919f8841bf0 genpatches-2.6.22-6.extras.tar.bz2 63748
-SHA256 7dc5a4390c9f073261a7019023cdef0c2a583441d1e0ec512f54662246c83d3f genpatches-2.6.22-6.extras.tar.bz2 63748
-MD5 2e230d005c002fb3d38a3ca07c0200d0 linux-2.6.22.tar.bz2 45119878
-RMD160 c4b2ca5ee8e71c0f8f1c95f3c9c5f261f2785912 linux-2.6.22.tar.bz2 45119878
-SHA256 73c10604c53f1a6ee65ef805293d23903696f8cef864f42d7de9506f0d2ba4c7 linux-2.6.22.tar.bz2 45119878
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appleir-undo-hid-blacklist.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appleir-undo-hid-blacklist.patch
deleted file mode 100644
index 6d4e94d..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appleir-undo-hid-blacklist.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Undo USB HID blacklisting of Apple IR, as it is support by lirc now.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hid/usbhid/hid-quirks.c | 2 --
- 1 files changed, 0 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
-index f6c4145..3e64d56 100644
---- a/drivers/hid/usbhid/hid-quirks.c
-+++ b/drivers/hid/usbhid/hid-quirks.c
-@@ -61,7 +61,6 @@
- #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
- #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
- #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
--#define USB_DEVICE_ID_APPLE_IR 0x8240
-
- #define USB_VENDOR_ID_ATEN 0x0557
- #define USB_DEVICE_ID_ATEN_UC100KM 0x2004
-@@ -300,7 +299,6 @@ static const struct hid_blacklist {
- { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE },
-- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE },
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc-add-macbook-temperature-keys.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc-add-macbook-temperature-keys.patch
deleted file mode 100644
index 6f7caf4..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc-add-macbook-temperature-keys.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-Fix AppleSMC registers on non-pro Macbooks.
-
-From: Martin Szulecki <mactel@sukimashita.com>
-
-
----
-
- drivers/hwmon/applesmc.c | 14 +++++++++-----
- 1 files changed, 9 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index eb81a64..cea8d78 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -79,11 +79,15 @@
-
- /*
- * Temperature sensors keys (sp78 - 2 bytes).
-- * First set for Macbook(Pro), second for Macmini.
- */
- static const char* temperature_sensors_sets[][13] = {
-+/* Set 0: Macbook Pro */
- { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
- "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
-+/* Set 1: Macbook set */
-+ { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
-+ "Th1H", "Ts0P", NULL },
-+/* Set 2: Macmini set */
- { "TC0D", "TC0P", NULL }
- };
-
-@@ -1129,10 +1133,10 @@ static void applesmc_release_accelerometer(void)
- static __initdata struct dmi_match_data applesmc_dmi_data[] = {
- /* MacBook Pro: accelerometer, backlight and temperature set 0 */
- { .accelerometer = 1, .light = 1, .temperature_set = 0 },
--/* MacBook: accelerometer and temperature set 0 */
-- { .accelerometer = 1, .light = 0, .temperature_set = 0 },
--/* MacBook: temperature set 1 */
-- { .accelerometer = 0, .light = 0, .temperature_set = 1 }
-+/* MacBook: accelerometer and temperature set 1 */
-+ { .accelerometer = 1, .light = 0, .temperature_set = 1 },
-+/* MacMini: temperature set 2 */
-+ { .accelerometer = 0, .light = 0, .temperature_set = 2 },
- };
-
- /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc-use-input-polldev.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc-use-input-polldev.patch
deleted file mode 100644
index a01777c..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc-use-input-polldev.patch
+++ /dev/null
@@ -1,221 +0,0 @@
-HWMON: applesmc - convert to use input-polldev.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Switch to using input-polldev skeleton instead of implementing
-polling loop by itself. This also fixes problem with trylock
-on a mutex in atomic context.
-
-Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
----
-
- drivers/hwmon/Kconfig | 1 +
- drivers/hwmon/applesmc.c | 83 +++++++++++++++++-----------------------------
- 2 files changed, 31 insertions(+), 53 deletions(-)
-
-diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
-index 13eea47..f0ab2ac 100644
---- a/drivers/hwmon/Kconfig
-+++ b/drivers/hwmon/Kconfig
-@@ -623,6 +623,7 @@ config SENSORS_APPLESMC
- depends on INPUT && X86
- select NEW_LEDS
- select LEDS_CLASS
-+ select INPUT_POLLDEV
- default n
- help
- This driver provides support for the Apple System Management
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index fd1281f..eb81a64 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -28,7 +28,7 @@
-
- #include <linux/delay.h>
- #include <linux/platform_device.h>
--#include <linux/input.h>
-+#include <linux/input-polldev.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/timer.h>
-@@ -59,9 +59,9 @@
-
- #define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */
- #define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */
--#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
-+#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
-
--#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
-+#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
-
- #define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */
-@@ -99,7 +99,7 @@ static const char* fan_speed_keys[] = {
- #define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */
- #define INIT_WAIT_MSECS 50 /* ... in 50ms increments */
-
--#define APPLESMC_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */
-+#define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-
-@@ -121,8 +121,7 @@ static const int debug;
- static struct platform_device *pdev;
- static s16 rest_x;
- static s16 rest_y;
--static struct timer_list applesmc_timer;
--static struct input_dev *applesmc_idev;
-+static struct input_polled_dev *applesmc_idev;
- static struct class_device *hwmon_class_dev;
-
- /* Indicates whether this computer has an accelerometer. */
-@@ -134,7 +133,7 @@ static unsigned int applesmc_light;
- /* Indicates which temperature sensors set to use. */
- static unsigned int applesmc_temperature_set;
-
--static struct mutex applesmc_lock;
-+static DEFINE_MUTEX(applesmc_lock);
-
- /*
- * Last index written to key_at_index sysfs file, and value to use for all other
-@@ -451,27 +450,12 @@ static void applesmc_calibrate(void)
- rest_x = -rest_x;
- }
-
--static int applesmc_idev_open(struct input_dev *dev)
--{
-- add_timer(&applesmc_timer);
--
-- return 0;
--}
--
--static void applesmc_idev_close(struct input_dev *dev)
--{
-- del_timer_sync(&applesmc_timer);
--}
--
--static void applesmc_idev_poll(unsigned long unused)
-+static void applesmc_idev_poll(struct input_polled_dev *dev)
- {
-+ struct input_dev *idev = dev->input;
- s16 x, y;
-
-- /* Cannot sleep. Try nonblockingly. If we fail, try again later. */
-- if (!mutex_trylock(&applesmc_lock)) {
-- mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
-- return;
-- }
-+ mutex_lock(&applesmc_lock);
-
- if (applesmc_read_motion_sensor(SENSOR_X, &x))
- goto out;
-@@ -479,13 +463,11 @@ static void applesmc_idev_poll(unsigned long unused)
- goto out;
-
- x = -x;
-- input_report_abs(applesmc_idev, ABS_X, x - rest_x);
-- input_report_abs(applesmc_idev, ABS_Y, y - rest_y);
-- input_sync(applesmc_idev);
-+ input_report_abs(idev, ABS_X, x - rest_x);
-+ input_report_abs(idev, ABS_Y, y - rest_y);
-+ input_sync(idev);
-
- out:
-- mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
--
- mutex_unlock(&applesmc_lock);
- }
-
-@@ -817,8 +799,7 @@ static ssize_t applesmc_key_at_index_read_show(struct device *dev,
-
- if (!ret) {
- return info[0];
-- }
-- else {
-+ } else {
- return ret;
- }
- }
-@@ -1089,6 +1070,7 @@ static int applesmc_dmi_match(struct dmi_system_id *id)
- /* Create accelerometer ressources */
- static int applesmc_create_accelerometer(void)
- {
-+ struct input_dev *idev;
- int ret;
-
- ret = sysfs_create_group(&pdev->dev.kobj,
-@@ -1096,40 +1078,37 @@ static int applesmc_create_accelerometer(void)
- if (ret)
- goto out;
-
-- applesmc_idev = input_allocate_device();
-+ applesmc_idev = input_allocate_polled_device();
- if (!applesmc_idev) {
- ret = -ENOMEM;
- goto out_sysfs;
- }
-
-+ applesmc_idev->poll = applesmc_idev_poll;
-+ applesmc_idev->poll_interval = APPLESMC_POLL_INTERVAL;
-+
- /* initial calibrate for the input device */
- applesmc_calibrate();
-
-- /* initialize the input class */
-- applesmc_idev->name = "applesmc";
-- applesmc_idev->id.bustype = BUS_HOST;
-- applesmc_idev->dev.parent = &pdev->dev;
-- applesmc_idev->evbit[0] = BIT(EV_ABS);
-- applesmc_idev->open = applesmc_idev_open;
-- applesmc_idev->close = applesmc_idev_close;
-- input_set_abs_params(applesmc_idev, ABS_X,
-+ /* initialize the input device */
-+ idev = applesmc_idev->input;
-+ idev->name = "applesmc";
-+ idev->id.bustype = BUS_HOST;
-+ idev->dev.parent = &pdev->dev;
-+ idev->evbit[0] = BIT(EV_ABS);
-+ input_set_abs_params(idev, ABS_X,
- -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
-- input_set_abs_params(applesmc_idev, ABS_Y,
-+ input_set_abs_params(idev, ABS_Y,
- -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
-
-- ret = input_register_device(applesmc_idev);
-+ ret = input_register_polled_device(applesmc_idev);
- if (ret)
- goto out_idev;
-
-- /* start up our timer for the input device */
-- init_timer(&applesmc_timer);
-- applesmc_timer.function = applesmc_idev_poll;
-- applesmc_timer.expires = jiffies + APPLESMC_POLL_PERIOD;
--
- return 0;
-
- out_idev:
-- input_free_device(applesmc_idev);
-+ input_free_polled_device(applesmc_idev);
-
- out_sysfs:
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
-@@ -1142,8 +1121,8 @@ out:
- /* Release all ressources used by the accelerometer */
- static void applesmc_release_accelerometer(void)
- {
-- del_timer_sync(&applesmc_timer);
-- input_unregister_device(applesmc_idev);
-+ input_unregister_polled_device(applesmc_idev);
-+ input_free_polled_device(applesmc_idev);
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
- }
-
-@@ -1180,8 +1159,6 @@ static int __init applesmc_init(void)
- int count;
- int i;
-
-- mutex_init(&applesmc_lock);
--
- if (!dmi_check_system(applesmc_whitelist)) {
- printk(KERN_WARNING "applesmc: supported laptop not found!\n");
- ret = -ENODEV;
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc_int.patch
deleted file mode 100644
index 7cab258..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/applesmc_int.patch
+++ /dev/null
@@ -1,415 +0,0 @@
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 321 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 298 insertions(+), 23 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index cea8d78..5d184a1 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) */
-@@ -351,12 +372,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * 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)
-@@ -364,32 +456,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);
-@@ -434,9 +573,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,
-@@ -898,6 +1044,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",
-@@ -909,10 +1172,22 @@ static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL);
- static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL);
- static DEVICE_ATTR(calibrate, 0644,
- applesmc_calibrate_show, applesmc_calibrate_store);
-+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-r138/appletouch-shut-up-when-it-has-nothing-to-say.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appletouch-shut-up-when-it-has-nothing-to-say.patch
deleted file mode 100644
index 7faa546..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appletouch-shut-up-when-it-has-nothing-to-say.patch
+++ /dev/null
@@ -1,202 +0,0 @@
-The attached minimally intrusive patch is based on Matthew Garret's
-
-From: Soeren Sonnenburg <kernel@nn7.de>
-
-patch 'Make appletouch shut up when it has nothing to say' patches (e.g.
-http://lkml.org/lkml/2007/5/13/117): Matthews description follows /
-second paragraph lists my additional changes.
-
-The appletouch geyser3 devices found in the Intel Macs (and possibly some later
-PPC ones?) send a constant stream of packets after the first touch. This
-results in the kernel waking up around once every couple of milliseconds
-to process them, making it almost impossible to spend any significant
-period of time in C3 state on a dynamic HZ kernel. Sending the mode
-initialization code makes the device shut up until it's touched again.
-This patch does so after receiving 10 packets with no interesting
-content.
-
-In addition it now empties the work queue via cancel_work_sync on module
-exit, keeps all error checking and only reports BTN_LEFT presses if bit
-1 in the status byte (last byte in packet) is set. This fixes the random
-left clicks issue. Furthermore it invalidates touchpad data before the
-mode switch, which fixes the touchpad runs amok issue.
-
-Credits:
-Sven Anders found out that one should only check for bit 1 for BTN_LEFT.
-Matthew Garrett did the initial 'Make appletouch shut up when it has
-nothing to say' so I am adding him to the signed-off lines (hope that is
-the correct way).
-
-Patch follows inline and attached.
-
-Soeren.
-
-Signed-off-by: Soeren Sonnenburg <kernel@nn7.de>
-Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
----
-
- drivers/input/mouse/appletouch.c | 112 ++++++++++++++++++++++++++------------
- 1 files changed, 77 insertions(+), 35 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index c26af96..22182a7 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -155,6 +155,8 @@ struct atp {
- int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
- int overflowwarn; /* overflow warning printed? */
- int datalen; /* size of an USB urb transfer */
-+ int idlecount; /* number of empty packets */
-+ struct work_struct work;
- };
-
- #define dbg_dump(msg, tab) \
-@@ -208,6 +210,63 @@ static inline int atp_is_geyser_3(struct atp *dev)
- (productId == GEYSER4_JIS_PRODUCT_ID);
- }
-
-+/*
-+ * By default Geyser 3 device sends standard USB HID mouse
-+ * packets (Report ID 2). This code changes device mode, so it
-+ * sends raw sensor reports (Report ID 5).
-+ */
-+static int atp_geyser3_init(struct usb_device *udev)
-+{
-+ char data[8];
-+ int size;
-+ int i;
-+
-+ size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
-+ ATP_GEYSER3_MODE_READ_REQUEST_ID,
-+ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-+ ATP_GEYSER3_MODE_REQUEST_VALUE,
-+ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-+
-+ if (size != 8) {
-+ printk("appletouch atp_geyser3_init READ error\n");
-+ for (i=0; i<8; i++)
-+ printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+
-+ err("Could not do mode read request from device"
-+ " (Geyser 3 mode)");
-+ return -EIO;
-+ }
-+
-+ /* Apply the mode switch */
-+ data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
-+
-+ size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-+ ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
-+ USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-+ ATP_GEYSER3_MODE_REQUEST_VALUE,
-+ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-+
-+ if (size != 8) {
-+ printk("appletouch atp_geyser3_init WRITE error\n");
-+ for (i=0; i<8; i++)
-+ printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+ err("Could not do mode write request to device"
-+ " (Geyser 3 mode)");
-+ return -EIO;
-+ }
-+ return 0;
-+}
-+
-+/* Reinitialise the device if it's a geyser 3 */
-+static void atp_reinit(struct work_struct *work)
-+{
-+ struct atp *dev = container_of(work, struct atp, work);
-+ struct usb_device *udev = dev->udev;
-+
-+ dev->idlecount = 0;
-+ atp_geyser3_init(udev);
-+}
-+
- static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
- int *z, int *fingers)
- {
-@@ -449,11 +508,21 @@ static void atp_complete(struct urb* urb)
-
- /* reset the accumulator on release */
- memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
-- }
-
-- input_report_key(dev->input, BTN_LEFT,
-- !!dev->data[dev->datalen - 1]);
-+ /* Geyser 3 will continue to send packets continually after
-+ the first touch unless reinitialised. Do so if it's been
-+ idle for a while in order to avoid waking the kernel up
-+ several hundred times a second */
-+ if (atp_is_geyser_3(dev)) {
-+ dev->idlecount++;
-+ if (dev->idlecount == 10) {
-+ dev->valid=0;
-+ schedule_work (&dev->work);
-+ }
-+ }
-+ }
-
-+ input_report_key(dev->input, BTN_LEFT, dev->data[dev->datalen-1] & 1);
- input_sync(dev->input);
-
- exit:
-@@ -480,6 +549,7 @@ static void atp_close(struct input_dev *input)
- struct atp *dev = input_get_drvdata(input);
-
- usb_kill_urb(dev->urb);
-+ cancel_work_sync(&dev->work);
- dev->open = 0;
- }
-
-@@ -528,40 +598,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- dev->datalen = 81;
-
- if (atp_is_geyser_3(dev)) {
-- /*
-- * By default Geyser 3 device sends standard USB HID mouse
-- * packets (Report ID 2). This code changes device mode, so it
-- * sends raw sensor reports (Report ID 5).
-- */
-- char data[8];
-- int size;
--
-- size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
-- ATP_GEYSER3_MODE_READ_REQUEST_ID,
-- USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-- ATP_GEYSER3_MODE_REQUEST_VALUE,
-- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
--
-- if (size != 8) {
-- err("Could not do mode read request from device"
-- " (Geyser 3 mode)");
-+ /* switch to raw sensor mode */
-+ if (atp_geyser3_init(udev))
- goto err_free_devs;
-- }
--
-- /* Apply the mode switch */
-- data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
--
-- size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-- ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
-- USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-- ATP_GEYSER3_MODE_REQUEST_VALUE,
-- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-
-- if (size != 8) {
-- err("Could not do mode write request to device"
-- " (Geyser 3 mode)");
-- goto err_free_devs;
-- }
- printk("appletouch Geyser 3 inited.\n");
- }
-
-@@ -636,6 +676,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- /* save our data pointer in this interface device */
- usb_set_intfdata(iface, dev);
-
-+ INIT_WORK(&dev->work, atp_reinit);
-+
- return 0;
-
- err_free_buffer:
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appletouch.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appletouch.patch
deleted file mode 100644
index 194f980..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/appletouch.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Appletouch driver ATP_THRESHOLD fix.
-
-From: Ortwin Glück <odi@odi.ch>
-
-
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index e321526..c26af96 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-r138/sigmatel-backport-2.6.23.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/sigmatel-backport-2.6.23.patch
deleted file mode 100644
index 0685db1..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r138/sigmatel-backport-2.6.23.patch
+++ /dev/null
@@ -1,341 +0,0 @@
-Backport ALSA sigmatel pins from 2.6.23 for testing.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- sound/pci/hda/patch_sigmatel.c | 203 ++++++++++++++++++++++++++++++----------
- 1 files changed, 152 insertions(+), 51 deletions(-)
-
-diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
-index e3964fc..329f4c0 100644
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -44,7 +44,7 @@ enum {
-
- enum {
- STAC_9205_REF,
-- STAC_9205_MODELS
-+ STAC_9205_MODELS
- };
-
- enum {
-@@ -59,11 +59,20 @@ enum {
- STAC_D945_REF,
- STAC_D945GTP3,
- STAC_D945GTP5,
-+ STAC_922X_DELL,
-+ STAC_INTEL_MAC_V1,
-+ STAC_INTEL_MAC_V2,
-+ STAC_INTEL_MAC_V3,
-+ STAC_INTEL_MAC_V4,
-+ STAC_INTEL_MAC_V5,
-+ /* for backward compitability */
- STAC_MACMINI,
- STAC_MACBOOK,
-+ STAC_MACBOOK_V2,
- STAC_MACBOOK_PRO_V1,
- STAC_MACBOOK_PRO_V2,
- STAC_IMAC_INTEL,
-+ STAC_IMAC_INTEL_20,
- STAC_922X_MODELS
- };
-
-@@ -549,44 +558,79 @@ static unsigned int d945gtp5_pin_configs[10] = {
- 0x02a19320, 0x40000100,
- };
-
--static unsigned int macbook_pro_v1_pin_configs[10] = {
-- 0x0321e230, 0x03a1e020, 0x9017e110, 0x01014010,
-- 0x01a19021, 0x0381e021, 0x1345e240, 0x13c5e22e,
-- 0x02a19320, 0x400000fb
-+static unsigned int intel_mac_v1_pin_configs[10] = {
-+ 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
-+ 0x400000fc, 0x400000fb,
-+};
-+
-+static unsigned int intel_mac_v2_pin_configs[10] = {
-+ 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
-+ 0x400000fc, 0x400000fb,
- };
-
--static unsigned int macbook_pro_v2_pin_configs[10] = {
-- 0x0221401f, 0x90a70120, 0x01813024, 0x01014010,
-- 0x400000fd, 0x01016011, 0x1345e240, 0x13c5e22e,
-+static unsigned int intel_mac_v3_pin_configs[10] = {
-+ 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
- 0x400000fc, 0x400000fb,
- };
-
--static unsigned int imac_intel_pin_configs[10] = {
-- 0x0121e230, 0x90a70120, 0x9017e110, 0x400000fe,
-- 0x400000fd, 0x0181e021, 0x1145e040, 0x400000fa,
-+static unsigned int intel_mac_v4_pin_configs[10] = {
-+ 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
-+ 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
- 0x400000fc, 0x400000fb,
- };
-
-+static unsigned int intel_mac_v5_pin_configs[10] = {
-+ 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
-+ 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
-+ 0x400000fc, 0x400000fb,
-+};
-+
-+static unsigned int stac922x_dell_pin_configs[10] = {
-+ 0x0221121e, 0x408103ff, 0x02a1123e, 0x90100310,
-+ 0x408003f1, 0x0221122f, 0x03451340, 0x40c003f2,
-+ 0x50a003f3, 0x405003f4
-+};
-+
- static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
- [STAC_D945_REF] = ref922x_pin_configs,
- [STAC_D945GTP3] = d945gtp3_pin_configs,
- [STAC_D945GTP5] = d945gtp5_pin_configs,
-- [STAC_MACMINI] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK_PRO_V1] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK_PRO_V2] = macbook_pro_v2_pin_configs,
-- [STAC_IMAC_INTEL] = imac_intel_pin_configs,
-+ [STAC_922X_DELL] = stac922x_dell_pin_configs,
-+ [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
-+ [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
-+ [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
-+ [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
-+ [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
-+ /* for backward compitability */
-+ [STAC_MACMINI] = intel_mac_v3_pin_configs,
-+ [STAC_MACBOOK] = intel_mac_v5_pin_configs,
-+ [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
-+ [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
-+ [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
-+ [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
- };
-
- static const char *stac922x_models[STAC_922X_MODELS] = {
- [STAC_D945_REF] = "ref",
- [STAC_D945GTP5] = "5stack",
- [STAC_D945GTP3] = "3stack",
-+ [STAC_922X_DELL] = "dell",
-+ [STAC_INTEL_MAC_V1] = "intel-mac-v1",
-+ [STAC_INTEL_MAC_V2] = "intel-mac-v2",
-+ [STAC_INTEL_MAC_V3] = "intel-mac-v3",
-+ [STAC_INTEL_MAC_V4] = "intel-mac-v4",
-+ [STAC_INTEL_MAC_V5] = "intel-mac-v5",
-+ /* for backward compitability */
- [STAC_MACMINI] = "macmini",
- [STAC_MACBOOK] = "macbook",
-+ [STAC_MACBOOK_V2] = "macbook-v2",
- [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
- [STAC_MACBOOK_PRO_V2] = "macbook-pro",
- [STAC_IMAC_INTEL] = "imac-intel",
-+ [STAC_IMAC_INTEL_20] = "imac-intel-20",
- };
-
- static struct snd_pci_quirk stac922x_cfg_tbl[] = {
-@@ -649,7 +693,7 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = {
- /* other systems */
- /* Apple Mac Mini (early 2006) */
- SND_PCI_QUIRK(0x8384, 0x7680,
-- "Mac Mini", STAC_MACMINI),
-+ "Mac Mini", STAC_INTEL_MAC_V3),
- {} /* terminator */
- };
-
-@@ -770,33 +814,56 @@ static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
- return 0;
- }
-
-+static void stac92xx_set_config_reg(struct hda_codec *codec,
-+ hda_nid_t pin_nid, unsigned int pin_config)
-+{
-+ int i;
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
-+ pin_config & 0x000000ff);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
-+ (pin_config & 0x0000ff00) >> 8);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
-+ (pin_config & 0x00ff0000) >> 16);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
-+ pin_config >> 24);
-+ i = snd_hda_codec_read(codec, pin_nid, 0,
-+ AC_VERB_GET_CONFIG_DEFAULT,
-+ 0x00);
-+ snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
-+ pin_nid, i);
-+}
-+
- static void stac92xx_set_config_regs(struct hda_codec *codec)
- {
- int i;
- struct sigmatel_spec *spec = codec->spec;
-- unsigned int pin_cfg;
-
-- if (! spec->pin_nids || ! spec->pin_configs)
-- return;
-+ if (!spec->pin_configs)
-+ return;
-
-- for (i = 0; i < spec->num_pins; i++) {
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
-- spec->pin_configs[i] & 0x000000ff);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
-- (spec->pin_configs[i] & 0x0000ff00) >> 8);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
-- (spec->pin_configs[i] & 0x00ff0000) >> 16);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
-- spec->pin_configs[i] >> 24);
-- pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0,
-- AC_VERB_GET_CONFIG_DEFAULT,
-- 0x00);
-- snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", spec->pin_nids[i], pin_cfg);
-- }
-+ for (i = 0; i < spec->num_pins; i++)
-+ stac92xx_set_config_reg(codec, spec->pin_nids[i],
-+ spec->pin_configs[i]);
-+}
-+
-+static void stac92xx_enable_gpio_mask(struct hda_codec *codec,
-+ int gpio_mask, int gpio_data)
-+{
-+ /* Configure GPIOx as output */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_DIRECTION, gpio_mask);
-+ /* Configure GPIOx as CMOS */
-+ snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0x00000000);
-+ /* Assert GPIOx */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_DATA, gpio_data);
-+ /* Enable GPIOx */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_MASK, gpio_mask);
- }
-
- /*
-@@ -1168,7 +1235,7 @@ static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
- * and 9202/925x. For those, dac_nids[] must be hard-coded.
- */
- static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
-- const struct auto_pin_cfg *cfg)
-+ struct auto_pin_cfg *cfg)
- {
- struct sigmatel_spec *spec = codec->spec;
- int i, j, conn_len = 0;
-@@ -1193,6 +1260,13 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
- }
-
- if (j == conn_len) {
-+ if (spec->multiout.num_dacs > 0) {
-+ /* we have already working output pins,
-+ * so let's drop the broken ones again
-+ */
-+ cfg->line_outs = spec->multiout.num_dacs;
-+ break;
-+ }
- /* error out, no available DAC found */
- snd_printk(KERN_ERR
- "%s: No available DAC for pin 0x%x\n",
-@@ -1334,7 +1408,15 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
- continue;
- add_spec_dacs(spec, nid);
- }
--
-+ for (i = 0; i < cfg->line_outs; i++) {
-+ nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
-+ AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
-+ if (check_in_dac_nids(spec, nid))
-+ nid = 0;
-+ if (! nid)
-+ continue;
-+ add_spec_dacs(spec, nid);
-+ }
- for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
- static const char *pfxs[] = {
- "Speaker", "External Speaker", "Speaker2",
-@@ -1891,7 +1973,7 @@ static int patch_stac9200(struct hda_codec *codec)
- return -ENOMEM;
-
- codec->spec = spec;
-- spec->num_pins = 8;
-+ spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
- spec->pin_nids = stac9200_pin_nids;
- spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
- stac9200_models,
-@@ -2013,29 +2095,41 @@ static int patch_stac922x(struct hda_codec *codec)
- return -ENOMEM;
-
- codec->spec = spec;
-- spec->num_pins = 10;
-+ spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
- spec->pin_nids = stac922x_pin_nids;
- spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
- stac922x_models,
- stac922x_cfg_tbl);
-- if (spec->board_config == STAC_MACMINI) {
-+ if (spec->board_config == STAC_INTEL_MAC_V3) {
- spec->gpio_mute = 1;
- /* Intel Macs have all same PCI SSID, so we need to check
- * codec SSID to distinguish the exact models
- */
- printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
- switch (codec->subsystem_id) {
-- case 0x106b0a00: /* MacBook First generatoin */
-- spec->board_config = STAC_MACBOOK;
-+
-+ case 0x106b0800:
-+ spec->board_config = STAC_INTEL_MAC_V1;
-+ break;
-+ case 0x106b0600:
-+ case 0x106b0700:
-+ spec->board_config = STAC_INTEL_MAC_V2;
- break;
-- case 0x106b0200: /* MacBook Pro first generation */
-- spec->board_config = STAC_MACBOOK_PRO_V1;
-+ case 0x106b0e00:
-+ case 0x106b0f00:
-+ case 0x106b1600:
-+ case 0x106b1700:
-+ case 0x106b0200:
-+ case 0x106b1e00:
-+ spec->board_config = STAC_INTEL_MAC_V3;
- break;
-- case 0x106b1e00: /* MacBook Pro second generation */
-- spec->board_config = STAC_MACBOOK_PRO_V2;
-+ case 0x106b1a00:
-+ case 0x00000100:
-+ spec->board_config = STAC_INTEL_MAC_V4;
- break;
-- case 0x106b0700: /* Intel-based iMac */
-- spec->board_config = STAC_IMAC_INTEL;
-+ case 0x106b0a00:
-+ case 0x106b2200:
-+ spec->board_config = STAC_INTEL_MAC_V5;
- break;
- }
- }
-@@ -2082,6 +2176,13 @@ static int patch_stac922x(struct hda_codec *codec)
-
- codec->patch_ops = stac92xx_patch_ops;
-
-+ /* Fix Mux capture level; max to 2 */
-+ snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
-+ (0 << AC_AMPCAP_OFFSET_SHIFT) |
-+ (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
-+ (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
-+ (0 << AC_AMPCAP_MUTE_SHIFT));
-+
- return 0;
- }
-
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appleir-undo-hid-blacklist.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appleir-undo-hid-blacklist.patch
deleted file mode 100644
index 6d4e94d..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appleir-undo-hid-blacklist.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Undo USB HID blacklisting of Apple IR, as it is support by lirc now.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hid/usbhid/hid-quirks.c | 2 --
- 1 files changed, 0 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
-index f6c4145..3e64d56 100644
---- a/drivers/hid/usbhid/hid-quirks.c
-+++ b/drivers/hid/usbhid/hid-quirks.c
-@@ -61,7 +61,6 @@
- #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
- #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
- #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
--#define USB_DEVICE_ID_APPLE_IR 0x8240
-
- #define USB_VENDOR_ID_ATEN 0x0557
- #define USB_DEVICE_ID_ATEN_UC100KM 0x2004
-@@ -300,7 +299,6 @@ static const struct hid_blacklist {
- { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE },
-- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE },
- { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE },
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-add-macbook-temperature-keys.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-add-macbook-temperature-keys.patch
deleted file mode 100644
index 6f7caf4..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-add-macbook-temperature-keys.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-Fix AppleSMC registers on non-pro Macbooks.
-
-From: Martin Szulecki <mactel@sukimashita.com>
-
-
----
-
- drivers/hwmon/applesmc.c | 14 +++++++++-----
- 1 files changed, 9 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index eb81a64..cea8d78 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -79,11 +79,15 @@
-
- /*
- * Temperature sensors keys (sp78 - 2 bytes).
-- * First set for Macbook(Pro), second for Macmini.
- */
- static const char* temperature_sensors_sets[][13] = {
-+/* Set 0: Macbook Pro */
- { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
- "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
-+/* Set 1: Macbook set */
-+ { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
-+ "Th1H", "Ts0P", NULL },
-+/* Set 2: Macmini set */
- { "TC0D", "TC0P", NULL }
- };
-
-@@ -1129,10 +1133,10 @@ static void applesmc_release_accelerometer(void)
- static __initdata struct dmi_match_data applesmc_dmi_data[] = {
- /* MacBook Pro: accelerometer, backlight and temperature set 0 */
- { .accelerometer = 1, .light = 1, .temperature_set = 0 },
--/* MacBook: accelerometer and temperature set 0 */
-- { .accelerometer = 1, .light = 0, .temperature_set = 0 },
--/* MacBook: temperature set 1 */
-- { .accelerometer = 0, .light = 0, .temperature_set = 1 }
-+/* MacBook: accelerometer and temperature set 1 */
-+ { .accelerometer = 1, .light = 0, .temperature_set = 1 },
-+/* MacMini: temperature set 2 */
-+ { .accelerometer = 0, .light = 0, .temperature_set = 2 },
- };
-
- /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-retry-when-accessing-keys.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-retry-when-accessing-keys.patch
deleted file mode 100644
index b1cc7b0..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-retry-when-accessing-keys.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-Retry up to 200 ms when reading or writing keys.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 69 +++++++++++++++++++++++++++++++---------------
- 1 files changed, 47 insertions(+), 22 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 5d184a1..4451c9e 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -124,6 +124,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
-@@ -198,12 +201,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 "
-@@ -211,33 +215,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-r140/applesmc-use-input-polldev.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-use-input-polldev.patch
deleted file mode 100644
index a01777c..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc-use-input-polldev.patch
+++ /dev/null
@@ -1,221 +0,0 @@
-HWMON: applesmc - convert to use input-polldev.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-Switch to using input-polldev skeleton instead of implementing
-polling loop by itself. This also fixes problem with trylock
-on a mutex in atomic context.
-
-Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
----
-
- drivers/hwmon/Kconfig | 1 +
- drivers/hwmon/applesmc.c | 83 +++++++++++++++++-----------------------------
- 2 files changed, 31 insertions(+), 53 deletions(-)
-
-diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
-index 13eea47..f0ab2ac 100644
---- a/drivers/hwmon/Kconfig
-+++ b/drivers/hwmon/Kconfig
-@@ -623,6 +623,7 @@ config SENSORS_APPLESMC
- depends on INPUT && X86
- select NEW_LEDS
- select LEDS_CLASS
-+ select INPUT_POLLDEV
- default n
- help
- This driver provides support for the Apple System Management
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index fd1281f..eb81a64 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -28,7 +28,7 @@
-
- #include <linux/delay.h>
- #include <linux/platform_device.h>
--#include <linux/input.h>
-+#include <linux/input-polldev.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/timer.h>
-@@ -59,9 +59,9 @@
-
- #define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */
- #define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */
--#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
-+#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
-
--#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
-+#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
-
- #define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */
-@@ -99,7 +99,7 @@ static const char* fan_speed_keys[] = {
- #define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */
- #define INIT_WAIT_MSECS 50 /* ... in 50ms increments */
-
--#define APPLESMC_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */
-+#define APPLESMC_POLL_INTERVAL 50 /* msecs */
- #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
- #define APPLESMC_INPUT_FLAT 4
-
-@@ -121,8 +121,7 @@ static const int debug;
- static struct platform_device *pdev;
- static s16 rest_x;
- static s16 rest_y;
--static struct timer_list applesmc_timer;
--static struct input_dev *applesmc_idev;
-+static struct input_polled_dev *applesmc_idev;
- static struct class_device *hwmon_class_dev;
-
- /* Indicates whether this computer has an accelerometer. */
-@@ -134,7 +133,7 @@ static unsigned int applesmc_light;
- /* Indicates which temperature sensors set to use. */
- static unsigned int applesmc_temperature_set;
-
--static struct mutex applesmc_lock;
-+static DEFINE_MUTEX(applesmc_lock);
-
- /*
- * Last index written to key_at_index sysfs file, and value to use for all other
-@@ -451,27 +450,12 @@ static void applesmc_calibrate(void)
- rest_x = -rest_x;
- }
-
--static int applesmc_idev_open(struct input_dev *dev)
--{
-- add_timer(&applesmc_timer);
--
-- return 0;
--}
--
--static void applesmc_idev_close(struct input_dev *dev)
--{
-- del_timer_sync(&applesmc_timer);
--}
--
--static void applesmc_idev_poll(unsigned long unused)
-+static void applesmc_idev_poll(struct input_polled_dev *dev)
- {
-+ struct input_dev *idev = dev->input;
- s16 x, y;
-
-- /* Cannot sleep. Try nonblockingly. If we fail, try again later. */
-- if (!mutex_trylock(&applesmc_lock)) {
-- mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
-- return;
-- }
-+ mutex_lock(&applesmc_lock);
-
- if (applesmc_read_motion_sensor(SENSOR_X, &x))
- goto out;
-@@ -479,13 +463,11 @@ static void applesmc_idev_poll(unsigned long unused)
- goto out;
-
- x = -x;
-- input_report_abs(applesmc_idev, ABS_X, x - rest_x);
-- input_report_abs(applesmc_idev, ABS_Y, y - rest_y);
-- input_sync(applesmc_idev);
-+ input_report_abs(idev, ABS_X, x - rest_x);
-+ input_report_abs(idev, ABS_Y, y - rest_y);
-+ input_sync(idev);
-
- out:
-- mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
--
- mutex_unlock(&applesmc_lock);
- }
-
-@@ -817,8 +799,7 @@ static ssize_t applesmc_key_at_index_read_show(struct device *dev,
-
- if (!ret) {
- return info[0];
-- }
-- else {
-+ } else {
- return ret;
- }
- }
-@@ -1089,6 +1070,7 @@ static int applesmc_dmi_match(struct dmi_system_id *id)
- /* Create accelerometer ressources */
- static int applesmc_create_accelerometer(void)
- {
-+ struct input_dev *idev;
- int ret;
-
- ret = sysfs_create_group(&pdev->dev.kobj,
-@@ -1096,40 +1078,37 @@ static int applesmc_create_accelerometer(void)
- if (ret)
- goto out;
-
-- applesmc_idev = input_allocate_device();
-+ applesmc_idev = input_allocate_polled_device();
- if (!applesmc_idev) {
- ret = -ENOMEM;
- goto out_sysfs;
- }
-
-+ applesmc_idev->poll = applesmc_idev_poll;
-+ applesmc_idev->poll_interval = APPLESMC_POLL_INTERVAL;
-+
- /* initial calibrate for the input device */
- applesmc_calibrate();
-
-- /* initialize the input class */
-- applesmc_idev->name = "applesmc";
-- applesmc_idev->id.bustype = BUS_HOST;
-- applesmc_idev->dev.parent = &pdev->dev;
-- applesmc_idev->evbit[0] = BIT(EV_ABS);
-- applesmc_idev->open = applesmc_idev_open;
-- applesmc_idev->close = applesmc_idev_close;
-- input_set_abs_params(applesmc_idev, ABS_X,
-+ /* initialize the input device */
-+ idev = applesmc_idev->input;
-+ idev->name = "applesmc";
-+ idev->id.bustype = BUS_HOST;
-+ idev->dev.parent = &pdev->dev;
-+ idev->evbit[0] = BIT(EV_ABS);
-+ input_set_abs_params(idev, ABS_X,
- -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
-- input_set_abs_params(applesmc_idev, ABS_Y,
-+ input_set_abs_params(idev, ABS_Y,
- -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
-
-- ret = input_register_device(applesmc_idev);
-+ ret = input_register_polled_device(applesmc_idev);
- if (ret)
- goto out_idev;
-
-- /* start up our timer for the input device */
-- init_timer(&applesmc_timer);
-- applesmc_timer.function = applesmc_idev_poll;
-- applesmc_timer.expires = jiffies + APPLESMC_POLL_PERIOD;
--
- return 0;
-
- out_idev:
-- input_free_device(applesmc_idev);
-+ input_free_polled_device(applesmc_idev);
-
- out_sysfs:
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
-@@ -1142,8 +1121,8 @@ out:
- /* Release all ressources used by the accelerometer */
- static void applesmc_release_accelerometer(void)
- {
-- del_timer_sync(&applesmc_timer);
-- input_unregister_device(applesmc_idev);
-+ input_unregister_polled_device(applesmc_idev);
-+ input_free_polled_device(applesmc_idev);
- sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
- }
-
-@@ -1180,8 +1159,6 @@ static int __init applesmc_init(void)
- int count;
- int i;
-
-- mutex_init(&applesmc_lock);
--
- if (!dmi_check_system(applesmc_whitelist)) {
- printk(KERN_WARNING "applesmc: supported laptop not found!\n");
- ret = -ENODEV;
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc_int.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc_int.patch
deleted file mode 100644
index 7cab258..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/applesmc_int.patch
+++ /dev/null
@@ -1,415 +0,0 @@
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 321 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 298 insertions(+), 23 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index cea8d78..5d184a1 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) */
-@@ -351,12 +372,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * 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)
-@@ -364,32 +456,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);
-@@ -434,9 +573,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,
-@@ -898,6 +1044,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",
-@@ -909,10 +1172,22 @@ static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL);
- static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL);
- static DEVICE_ATTR(calibrate, 0644,
- applesmc_calibrate_show, applesmc_calibrate_store);
-+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-r140/appletouch-shut-up-when-it-has-nothing-to-say.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appletouch-shut-up-when-it-has-nothing-to-say.patch
deleted file mode 100644
index 7faa546..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appletouch-shut-up-when-it-has-nothing-to-say.patch
+++ /dev/null
@@ -1,202 +0,0 @@
-The attached minimally intrusive patch is based on Matthew Garret's
-
-From: Soeren Sonnenburg <kernel@nn7.de>
-
-patch 'Make appletouch shut up when it has nothing to say' patches (e.g.
-http://lkml.org/lkml/2007/5/13/117): Matthews description follows /
-second paragraph lists my additional changes.
-
-The appletouch geyser3 devices found in the Intel Macs (and possibly some later
-PPC ones?) send a constant stream of packets after the first touch. This
-results in the kernel waking up around once every couple of milliseconds
-to process them, making it almost impossible to spend any significant
-period of time in C3 state on a dynamic HZ kernel. Sending the mode
-initialization code makes the device shut up until it's touched again.
-This patch does so after receiving 10 packets with no interesting
-content.
-
-In addition it now empties the work queue via cancel_work_sync on module
-exit, keeps all error checking and only reports BTN_LEFT presses if bit
-1 in the status byte (last byte in packet) is set. This fixes the random
-left clicks issue. Furthermore it invalidates touchpad data before the
-mode switch, which fixes the touchpad runs amok issue.
-
-Credits:
-Sven Anders found out that one should only check for bit 1 for BTN_LEFT.
-Matthew Garrett did the initial 'Make appletouch shut up when it has
-nothing to say' so I am adding him to the signed-off lines (hope that is
-the correct way).
-
-Patch follows inline and attached.
-
-Soeren.
-
-Signed-off-by: Soeren Sonnenburg <kernel@nn7.de>
-Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org>
----
-
- drivers/input/mouse/appletouch.c | 112 ++++++++++++++++++++++++++------------
- 1 files changed, 77 insertions(+), 35 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index c26af96..22182a7 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -155,6 +155,8 @@ struct atp {
- int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
- int overflowwarn; /* overflow warning printed? */
- int datalen; /* size of an USB urb transfer */
-+ int idlecount; /* number of empty packets */
-+ struct work_struct work;
- };
-
- #define dbg_dump(msg, tab) \
-@@ -208,6 +210,63 @@ static inline int atp_is_geyser_3(struct atp *dev)
- (productId == GEYSER4_JIS_PRODUCT_ID);
- }
-
-+/*
-+ * By default Geyser 3 device sends standard USB HID mouse
-+ * packets (Report ID 2). This code changes device mode, so it
-+ * sends raw sensor reports (Report ID 5).
-+ */
-+static int atp_geyser3_init(struct usb_device *udev)
-+{
-+ char data[8];
-+ int size;
-+ int i;
-+
-+ size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
-+ ATP_GEYSER3_MODE_READ_REQUEST_ID,
-+ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-+ ATP_GEYSER3_MODE_REQUEST_VALUE,
-+ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-+
-+ if (size != 8) {
-+ printk("appletouch atp_geyser3_init READ error\n");
-+ for (i=0; i<8; i++)
-+ printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+
-+ err("Could not do mode read request from device"
-+ " (Geyser 3 mode)");
-+ return -EIO;
-+ }
-+
-+ /* Apply the mode switch */
-+ data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
-+
-+ size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-+ ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
-+ USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-+ ATP_GEYSER3_MODE_REQUEST_VALUE,
-+ ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-+
-+ if (size != 8) {
-+ printk("appletouch atp_geyser3_init WRITE error\n");
-+ for (i=0; i<8; i++)
-+ printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+ err("Could not do mode write request to device"
-+ " (Geyser 3 mode)");
-+ return -EIO;
-+ }
-+ return 0;
-+}
-+
-+/* Reinitialise the device if it's a geyser 3 */
-+static void atp_reinit(struct work_struct *work)
-+{
-+ struct atp *dev = container_of(work, struct atp, work);
-+ struct usb_device *udev = dev->udev;
-+
-+ dev->idlecount = 0;
-+ atp_geyser3_init(udev);
-+}
-+
- static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
- int *z, int *fingers)
- {
-@@ -449,11 +508,21 @@ static void atp_complete(struct urb* urb)
-
- /* reset the accumulator on release */
- memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
-- }
-
-- input_report_key(dev->input, BTN_LEFT,
-- !!dev->data[dev->datalen - 1]);
-+ /* Geyser 3 will continue to send packets continually after
-+ the first touch unless reinitialised. Do so if it's been
-+ idle for a while in order to avoid waking the kernel up
-+ several hundred times a second */
-+ if (atp_is_geyser_3(dev)) {
-+ dev->idlecount++;
-+ if (dev->idlecount == 10) {
-+ dev->valid=0;
-+ schedule_work (&dev->work);
-+ }
-+ }
-+ }
-
-+ input_report_key(dev->input, BTN_LEFT, dev->data[dev->datalen-1] & 1);
- input_sync(dev->input);
-
- exit:
-@@ -480,6 +549,7 @@ static void atp_close(struct input_dev *input)
- struct atp *dev = input_get_drvdata(input);
-
- usb_kill_urb(dev->urb);
-+ cancel_work_sync(&dev->work);
- dev->open = 0;
- }
-
-@@ -528,40 +598,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- dev->datalen = 81;
-
- if (atp_is_geyser_3(dev)) {
-- /*
-- * By default Geyser 3 device sends standard USB HID mouse
-- * packets (Report ID 2). This code changes device mode, so it
-- * sends raw sensor reports (Report ID 5).
-- */
-- char data[8];
-- int size;
--
-- size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
-- ATP_GEYSER3_MODE_READ_REQUEST_ID,
-- USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-- ATP_GEYSER3_MODE_REQUEST_VALUE,
-- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
--
-- if (size != 8) {
-- err("Could not do mode read request from device"
-- " (Geyser 3 mode)");
-+ /* switch to raw sensor mode */
-+ if (atp_geyser3_init(udev))
- goto err_free_devs;
-- }
--
-- /* Apply the mode switch */
-- data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
--
-- size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-- ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
-- USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-- ATP_GEYSER3_MODE_REQUEST_VALUE,
-- ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
-
-- if (size != 8) {
-- err("Could not do mode write request to device"
-- " (Geyser 3 mode)");
-- goto err_free_devs;
-- }
- printk("appletouch Geyser 3 inited.\n");
- }
-
-@@ -636,6 +676,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- /* save our data pointer in this interface device */
- usb_set_intfdata(iface, dev);
-
-+ INIT_WORK(&dev->work, atp_reinit);
-+
- return 0;
-
- err_free_buffer:
diff --git a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appletouch.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appletouch.patch
deleted file mode 100644
index 194f980..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/appletouch.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Appletouch driver ATP_THRESHOLD fix.
-
-From: Ortwin Glück <odi@odi.ch>
-
-
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index e321526..c26af96 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-r140/sigmatel-backport-2.6.23.patch b/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/sigmatel-backport-2.6.23.patch
deleted file mode 100644
index 0685db1..0000000
--- a/sys-kernel/mactel-linux-sources/files/mactel-patches-r140/sigmatel-backport-2.6.23.patch
+++ /dev/null
@@ -1,341 +0,0 @@
-Backport ALSA sigmatel pins from 2.6.23 for testing.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- sound/pci/hda/patch_sigmatel.c | 203 ++++++++++++++++++++++++++++++----------
- 1 files changed, 152 insertions(+), 51 deletions(-)
-
-diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
-index e3964fc..329f4c0 100644
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -44,7 +44,7 @@ enum {
-
- enum {
- STAC_9205_REF,
-- STAC_9205_MODELS
-+ STAC_9205_MODELS
- };
-
- enum {
-@@ -59,11 +59,20 @@ enum {
- STAC_D945_REF,
- STAC_D945GTP3,
- STAC_D945GTP5,
-+ STAC_922X_DELL,
-+ STAC_INTEL_MAC_V1,
-+ STAC_INTEL_MAC_V2,
-+ STAC_INTEL_MAC_V3,
-+ STAC_INTEL_MAC_V4,
-+ STAC_INTEL_MAC_V5,
-+ /* for backward compitability */
- STAC_MACMINI,
- STAC_MACBOOK,
-+ STAC_MACBOOK_V2,
- STAC_MACBOOK_PRO_V1,
- STAC_MACBOOK_PRO_V2,
- STAC_IMAC_INTEL,
-+ STAC_IMAC_INTEL_20,
- STAC_922X_MODELS
- };
-
-@@ -549,44 +558,79 @@ static unsigned int d945gtp5_pin_configs[10] = {
- 0x02a19320, 0x40000100,
- };
-
--static unsigned int macbook_pro_v1_pin_configs[10] = {
-- 0x0321e230, 0x03a1e020, 0x9017e110, 0x01014010,
-- 0x01a19021, 0x0381e021, 0x1345e240, 0x13c5e22e,
-- 0x02a19320, 0x400000fb
-+static unsigned int intel_mac_v1_pin_configs[10] = {
-+ 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
-+ 0x400000fc, 0x400000fb,
-+};
-+
-+static unsigned int intel_mac_v2_pin_configs[10] = {
-+ 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
-+ 0x400000fc, 0x400000fb,
- };
-
--static unsigned int macbook_pro_v2_pin_configs[10] = {
-- 0x0221401f, 0x90a70120, 0x01813024, 0x01014010,
-- 0x400000fd, 0x01016011, 0x1345e240, 0x13c5e22e,
-+static unsigned int intel_mac_v3_pin_configs[10] = {
-+ 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
-+ 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
- 0x400000fc, 0x400000fb,
- };
-
--static unsigned int imac_intel_pin_configs[10] = {
-- 0x0121e230, 0x90a70120, 0x9017e110, 0x400000fe,
-- 0x400000fd, 0x0181e021, 0x1145e040, 0x400000fa,
-+static unsigned int intel_mac_v4_pin_configs[10] = {
-+ 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
-+ 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
- 0x400000fc, 0x400000fb,
- };
-
-+static unsigned int intel_mac_v5_pin_configs[10] = {
-+ 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
-+ 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
-+ 0x400000fc, 0x400000fb,
-+};
-+
-+static unsigned int stac922x_dell_pin_configs[10] = {
-+ 0x0221121e, 0x408103ff, 0x02a1123e, 0x90100310,
-+ 0x408003f1, 0x0221122f, 0x03451340, 0x40c003f2,
-+ 0x50a003f3, 0x405003f4
-+};
-+
- static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
- [STAC_D945_REF] = ref922x_pin_configs,
- [STAC_D945GTP3] = d945gtp3_pin_configs,
- [STAC_D945GTP5] = d945gtp5_pin_configs,
-- [STAC_MACMINI] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK_PRO_V1] = macbook_pro_v1_pin_configs,
-- [STAC_MACBOOK_PRO_V2] = macbook_pro_v2_pin_configs,
-- [STAC_IMAC_INTEL] = imac_intel_pin_configs,
-+ [STAC_922X_DELL] = stac922x_dell_pin_configs,
-+ [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs,
-+ [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs,
-+ [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
-+ [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
-+ [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
-+ /* for backward compitability */
-+ [STAC_MACMINI] = intel_mac_v3_pin_configs,
-+ [STAC_MACBOOK] = intel_mac_v5_pin_configs,
-+ [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs,
-+ [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
-+ [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
-+ [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
- };
-
- static const char *stac922x_models[STAC_922X_MODELS] = {
- [STAC_D945_REF] = "ref",
- [STAC_D945GTP5] = "5stack",
- [STAC_D945GTP3] = "3stack",
-+ [STAC_922X_DELL] = "dell",
-+ [STAC_INTEL_MAC_V1] = "intel-mac-v1",
-+ [STAC_INTEL_MAC_V2] = "intel-mac-v2",
-+ [STAC_INTEL_MAC_V3] = "intel-mac-v3",
-+ [STAC_INTEL_MAC_V4] = "intel-mac-v4",
-+ [STAC_INTEL_MAC_V5] = "intel-mac-v5",
-+ /* for backward compitability */
- [STAC_MACMINI] = "macmini",
- [STAC_MACBOOK] = "macbook",
-+ [STAC_MACBOOK_V2] = "macbook-v2",
- [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
- [STAC_MACBOOK_PRO_V2] = "macbook-pro",
- [STAC_IMAC_INTEL] = "imac-intel",
-+ [STAC_IMAC_INTEL_20] = "imac-intel-20",
- };
-
- static struct snd_pci_quirk stac922x_cfg_tbl[] = {
-@@ -649,7 +693,7 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = {
- /* other systems */
- /* Apple Mac Mini (early 2006) */
- SND_PCI_QUIRK(0x8384, 0x7680,
-- "Mac Mini", STAC_MACMINI),
-+ "Mac Mini", STAC_INTEL_MAC_V3),
- {} /* terminator */
- };
-
-@@ -770,33 +814,56 @@ static int stac92xx_save_bios_config_regs(struct hda_codec *codec)
- return 0;
- }
-
-+static void stac92xx_set_config_reg(struct hda_codec *codec,
-+ hda_nid_t pin_nid, unsigned int pin_config)
-+{
-+ int i;
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
-+ pin_config & 0x000000ff);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
-+ (pin_config & 0x0000ff00) >> 8);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
-+ (pin_config & 0x00ff0000) >> 16);
-+ snd_hda_codec_write(codec, pin_nid, 0,
-+ AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
-+ pin_config >> 24);
-+ i = snd_hda_codec_read(codec, pin_nid, 0,
-+ AC_VERB_GET_CONFIG_DEFAULT,
-+ 0x00);
-+ snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
-+ pin_nid, i);
-+}
-+
- static void stac92xx_set_config_regs(struct hda_codec *codec)
- {
- int i;
- struct sigmatel_spec *spec = codec->spec;
-- unsigned int pin_cfg;
-
-- if (! spec->pin_nids || ! spec->pin_configs)
-- return;
-+ if (!spec->pin_configs)
-+ return;
-
-- for (i = 0; i < spec->num_pins; i++) {
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
-- spec->pin_configs[i] & 0x000000ff);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
-- (spec->pin_configs[i] & 0x0000ff00) >> 8);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
-- (spec->pin_configs[i] & 0x00ff0000) >> 16);
-- snd_hda_codec_write(codec, spec->pin_nids[i], 0,
-- AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
-- spec->pin_configs[i] >> 24);
-- pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0,
-- AC_VERB_GET_CONFIG_DEFAULT,
-- 0x00);
-- snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", spec->pin_nids[i], pin_cfg);
-- }
-+ for (i = 0; i < spec->num_pins; i++)
-+ stac92xx_set_config_reg(codec, spec->pin_nids[i],
-+ spec->pin_configs[i]);
-+}
-+
-+static void stac92xx_enable_gpio_mask(struct hda_codec *codec,
-+ int gpio_mask, int gpio_data)
-+{
-+ /* Configure GPIOx as output */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_DIRECTION, gpio_mask);
-+ /* Configure GPIOx as CMOS */
-+ snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0x00000000);
-+ /* Assert GPIOx */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_DATA, gpio_data);
-+ /* Enable GPIOx */
-+ snd_hda_codec_write(codec, codec->afg, 0,
-+ AC_VERB_SET_GPIO_MASK, gpio_mask);
- }
-
- /*
-@@ -1168,7 +1235,7 @@ static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
- * and 9202/925x. For those, dac_nids[] must be hard-coded.
- */
- static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
-- const struct auto_pin_cfg *cfg)
-+ struct auto_pin_cfg *cfg)
- {
- struct sigmatel_spec *spec = codec->spec;
- int i, j, conn_len = 0;
-@@ -1193,6 +1260,13 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
- }
-
- if (j == conn_len) {
-+ if (spec->multiout.num_dacs > 0) {
-+ /* we have already working output pins,
-+ * so let's drop the broken ones again
-+ */
-+ cfg->line_outs = spec->multiout.num_dacs;
-+ break;
-+ }
- /* error out, no available DAC found */
- snd_printk(KERN_ERR
- "%s: No available DAC for pin 0x%x\n",
-@@ -1334,7 +1408,15 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
- continue;
- add_spec_dacs(spec, nid);
- }
--
-+ for (i = 0; i < cfg->line_outs; i++) {
-+ nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0,
-+ AC_VERB_GET_CONNECT_LIST, 0) & 0xff;
-+ if (check_in_dac_nids(spec, nid))
-+ nid = 0;
-+ if (! nid)
-+ continue;
-+ add_spec_dacs(spec, nid);
-+ }
- for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) {
- static const char *pfxs[] = {
- "Speaker", "External Speaker", "Speaker2",
-@@ -1891,7 +1973,7 @@ static int patch_stac9200(struct hda_codec *codec)
- return -ENOMEM;
-
- codec->spec = spec;
-- spec->num_pins = 8;
-+ spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
- spec->pin_nids = stac9200_pin_nids;
- spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
- stac9200_models,
-@@ -2013,29 +2095,41 @@ static int patch_stac922x(struct hda_codec *codec)
- return -ENOMEM;
-
- codec->spec = spec;
-- spec->num_pins = 10;
-+ spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
- spec->pin_nids = stac922x_pin_nids;
- spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
- stac922x_models,
- stac922x_cfg_tbl);
-- if (spec->board_config == STAC_MACMINI) {
-+ if (spec->board_config == STAC_INTEL_MAC_V3) {
- spec->gpio_mute = 1;
- /* Intel Macs have all same PCI SSID, so we need to check
- * codec SSID to distinguish the exact models
- */
- printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
- switch (codec->subsystem_id) {
-- case 0x106b0a00: /* MacBook First generatoin */
-- spec->board_config = STAC_MACBOOK;
-+
-+ case 0x106b0800:
-+ spec->board_config = STAC_INTEL_MAC_V1;
-+ break;
-+ case 0x106b0600:
-+ case 0x106b0700:
-+ spec->board_config = STAC_INTEL_MAC_V2;
- break;
-- case 0x106b0200: /* MacBook Pro first generation */
-- spec->board_config = STAC_MACBOOK_PRO_V1;
-+ case 0x106b0e00:
-+ case 0x106b0f00:
-+ case 0x106b1600:
-+ case 0x106b1700:
-+ case 0x106b0200:
-+ case 0x106b1e00:
-+ spec->board_config = STAC_INTEL_MAC_V3;
- break;
-- case 0x106b1e00: /* MacBook Pro second generation */
-- spec->board_config = STAC_MACBOOK_PRO_V2;
-+ case 0x106b1a00:
-+ case 0x00000100:
-+ spec->board_config = STAC_INTEL_MAC_V4;
- break;
-- case 0x106b0700: /* Intel-based iMac */
-- spec->board_config = STAC_IMAC_INTEL;
-+ case 0x106b0a00:
-+ case 0x106b2200:
-+ spec->board_config = STAC_INTEL_MAC_V5;
- break;
- }
- }
-@@ -2082,6 +2176,13 @@ static int patch_stac922x(struct hda_codec *codec)
-
- codec->patch_ops = stac92xx_patch_ops;
-
-+ /* Fix Mux capture level; max to 2 */
-+ snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
-+ (0 << AC_AMPCAP_OFFSET_SHIFT) |
-+ (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
-+ (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
-+ (0 << AC_AMPCAP_MUTE_SHIFT));
-+
- return 0;
- }
-
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r1.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r1.ebuild
deleted file mode 100644
index f21c56f..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r1.ebuild
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="2"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-# UNIPATCH_LIST="${FILESDIR}/mactel-patches-${PV}.tar.bz2"
-# MACTEL_SVN="mactel-patches-r138"
-PATCHDIR="${FILESDIR}/mactel-patches-r138/"
-UNIPATCH_LIST="${PATCHDIR}/applesmc-use-input-polldev.patch ${PATCHDIR}/applesmc-add-macbook-temperature-keys.patch \
-${PATCHDIR}/sigmatel-backport-2.6.23.patch ${PATCHDIR}/applesmc_int.patch ${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/appleir-undo-hid-blacklist.patch ${PATCHDIR}/appletouch-shut-up-when-it-has-nothing-to-say.patch"
-UNIPATCH_STRICTORDER="1"
diff --git a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r2.ebuild b/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r2.ebuild
deleted file mode 100644
index 006ddcd..0000000
--- a/sys-kernel/mactel-linux-sources/mactel-linux-sources-2.6.22-r2.ebuild
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-ETYPE="sources"
-K_WANT_GENPATCHES="base extras"
-K_GENPATCHES_VER="6"
-K_SECURITY_UNSUPPORTED="1"
-inherit kernel-2
-detect_version
-detect_arch
-
-DESCRIPTION="Sources for the Linux kernel with mactel-linux and gentoo patches."
-HOMEPAGE="http://www.kernel.org
- http://dev.gentoo.org/~dsd/genpatches
- http://mactel-linux.org"
-
-SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
-KEYWORDS="~amd64 ~x86"
-
-PATCHDIR="${FILESDIR}/mactel-patches-r140/"
-
-UNIPATCH_LIST="${PATCHDIR}/applesmc-use-input-polldev.patch ${PATCHDIR}/applesmc-add-macbook-temperature-keys.patch \
-${PATCHDIR}/sigmatel-backport-2.6.23.patch ${PATCHDIR}/applesmc_int.patch ${PATCHDIR}/appletouch.patch \
-${PATCHDIR}/appleir-undo-hid-blacklist.patch ${PATCHDIR}/appletouch-shut-up-when-it-has-nothing-to-say.patch \
-${PATCHDIR}/applesmc-retry-when-accessing-keys.patch"
-
-UNIPATCH_STRICTORDER="1"