summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2008-05-12 12:16:46 +0200
committerThomas Bächler <thomas@archlinux.org>2008-05-12 12:16:46 +0200
commit32cd17590eb4884de28e692fa79571644f0e59c5 (patch)
tree1870c3586cef63a64c91580c239bbfbdd9f113e2 /patches
parent06217f8984f279c1ab3f11c43af994d7b489d1a4 (diff)
Release 2.6.25.1-1-ARCH
Diffstat (limited to 'patches')
-rw-r--r--patches/ati-catalyst-2.6.25.patch12
-rw-r--r--patches/linux-phc-0.3.0-kernel-vanilla-2.6.23rc3.patch530
-rw-r--r--patches/mactel-linux-2.6.24.patch1266
-rw-r--r--patches/toshiba-bluetooth.patch241
4 files changed, 12 insertions, 2037 deletions
diff --git a/patches/ati-catalyst-2.6.25.patch b/patches/ati-catalyst-2.6.25.patch
new file mode 100644
index 0000000..f90d8b4
--- /dev/null
+++ b/patches/ati-catalyst-2.6.25.patch
@@ -0,0 +1,12 @@
+ /*
+ * Initial thread structure.
+--- linux-2.6.25/arch/x86/kernel/smp_64.c.orig 2008-04-20 23:29:10.000000000 -0300
++++ linux-2.6.25/arch/x86/kernel/smp_64.c 2008-04-20 23:29:39.000000000 -0300
+@@ -269,6 +269,7 @@
+
+ preempt_enable();
+ }
++EXPORT_SYMBOL(flush_tlb_page);
+
+ static void do_flush_tlb_all(void* info)
+ {
diff --git a/patches/linux-phc-0.3.0-kernel-vanilla-2.6.23rc3.patch b/patches/linux-phc-0.3.0-kernel-vanilla-2.6.23rc3.patch
deleted file mode 100644
index 215cd08..0000000
--- a/patches/linux-phc-0.3.0-kernel-vanilla-2.6.23rc3.patch
+++ /dev/null
@@ -1,530 +0,0 @@
-diff --new-file -a --unified=5 --recursive linux-2.6.23-rc3/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c linux-source-2.6.23-rc3/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
---- linux-2.6.23-rc3/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c 2007-08-13 06:25:24.000000000 +0200
-+++ linux-source-2.6.23-rc3/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c 2007-08-14 15:33:30.000000000 +0200
-@@ -23,10 +23,15 @@
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-+/* This file has been patched with Linux PHC: https://www.dedigentoo.org/trac/linux-phc
-+ * Patch version: linux-phc-0.3.0-kernel-vanilla-2.6.23.patch
-+ */
-+
-+
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
- #include <linux/smp.h>
- #include <linux/sched.h>
-@@ -57,16 +62,22 @@
- };
-
- #define INTEL_MSR_RANGE (0xffff)
- #define CPUID_6_ECX_APERFMPERF_CAPABILITY (0x1)
-
-+#define INTEL_MSR_VID_MASK (0x00ff)
-+#define INTEL_MSR_FID_MASK (0xff00)
-+#define INTEL_MSR_FID_SHIFT (0x8)
-+#define PHC_VERSION_STRING "0.3.0"
-+
- struct acpi_cpufreq_data {
- struct acpi_processor_performance *acpi_data;
- struct cpufreq_frequency_table *freq_table;
- unsigned int max_freq;
- unsigned int resume;
- unsigned int cpu_feature;
-+ acpi_integer *original_controls;
- };
-
- static struct acpi_cpufreq_data *drv_data[NR_CPUS];
- /* acpi_perf_data is a pointer to percpu data. */
- static struct acpi_processor_performance *acpi_perf_data;
-@@ -101,17 +112,19 @@
- }
-
- static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
- {
- int i;
-+ u32 fid;
- struct acpi_processor_performance *perf;
-
-- msr &= INTEL_MSR_RANGE;
-+ fid = msr & INTEL_MSR_FID_MASK;
- perf = data->acpi_data;
-
- for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
-- if (msr == perf->states[data->freq_table[i].index].status)
-+ if (fid == (perf->states[data->freq_table[i].index].status &
-+ INTEL_MSR_FID_MASK))
- return data->freq_table[i].frequency;
- }
- return data->freq_table[0].frequency;
- }
-
-@@ -729,10 +742,12 @@
- if (data) {
- cpufreq_frequency_table_put_attr(policy->cpu);
- drv_data[policy->cpu] = NULL;
- acpi_processor_unregister_performance(data->acpi_data,
- policy->cpu);
-+ if (data->original_controls)
-+ kfree(data->original_controls);
- kfree(data);
- }
-
- return 0;
- }
-@@ -746,12 +761,452 @@
- data->resume = 1;
-
- return 0;
- }
-
-+
-+
-+
-+/* sysfs interface to change operating points voltages */
-+
-+static unsigned int extract_fid_from_control(unsigned int control)
-+{
-+ return ((control & INTEL_MSR_FID_MASK) >> INTEL_MSR_FID_SHIFT);
-+}
-+
-+static unsigned int extract_vid_from_control(unsigned int control)
-+{
-+ return (control & INTEL_MSR_VID_MASK);
-+}
-+
-+static ssize_t check_origial_table (struct acpi_cpufreq_data *data)
-+{
-+ struct acpi_processor_performance *acpi_data;
-+ struct cpufreq_frequency_table *freq_table;
-+ unsigned int state_index;
-+
-+ acpi_data = data->acpi_data;
-+ freq_table = data->freq_table;
-+
-+ if (data->original_controls == NULL) {
-+ // Backup original control values
-+ data->original_controls = kcalloc(acpi_data->state_count,
-+ sizeof(acpi_integer), GFP_KERNEL);
-+ if (data->original_controls == NULL) {
-+ printk("failed to allocate memory for original control values\n");
-+ return -ENOMEM;
-+ }
-+ for (state_index = 0; state_index < acpi_data->state_count; state_index++) {
-+ data->original_controls[state_index] = acpi_data->states[state_index].control;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static ssize_t show_freq_attr_vids(struct cpufreq_policy *policy, char *buf)
-+{
-+ struct acpi_cpufreq_data *data = drv_data[policy->cpu];
-+ struct acpi_processor_performance *acpi_data;
-+ struct cpufreq_frequency_table *freq_table;
-+ unsigned int i;
-+ unsigned int vid;
-+ ssize_t count = 0;
-+
-+ if (unlikely(data == NULL ||
-+ data->acpi_data == NULL ||
-+ data->freq_table == NULL ||
-+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) {
-+ return -ENODEV;
-+ }
-+
-+ acpi_data = data->acpi_data;
-+ freq_table = data->freq_table;
-+
-+ for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
-+ vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
-+ count += sprintf(&buf[count], "%u ", vid);
-+ }
-+ count += sprintf(&buf[count], "\n");
-+
-+ return count;
-+}
-+
-+static ssize_t show_freq_attr_default_vids(struct cpufreq_policy *policy, char *buf)
-+{
-+ struct acpi_cpufreq_data *data = drv_data[policy->cpu];
-+ struct cpufreq_frequency_table *freq_table;
-+ unsigned int i;
-+ unsigned int vid;
-+ ssize_t count = 0;
-+ ssize_t retval;
-+
-+ if (unlikely(data == NULL ||
-+ data->acpi_data == NULL ||
-+ data->freq_table == NULL ||
-+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) {
-+ return -ENODEV;
-+ }
-+
-+ retval = check_origial_table(data);
-+ if (0 != retval)
-+ return retval;
-+
-+ freq_table = data->freq_table;
-+
-+ for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
-+ vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
-+ count += sprintf(&buf[count], "%u ", vid);
-+ }
-+ count += sprintf(&buf[count], "\n");
-+
-+ return count;
-+}
-+
-+static ssize_t show_freq_attr_fids(struct cpufreq_policy *policy, char *buf)
-+{
-+ struct acpi_cpufreq_data *data = drv_data[policy->cpu];
-+ struct acpi_processor_performance *acpi_data;
-+ struct cpufreq_frequency_table *freq_table;
-+ unsigned int i;
-+ unsigned int fid;
-+ ssize_t count = 0;
-+
-+ if (unlikely(data == NULL ||
-+ data->acpi_data == NULL ||
-+ data->freq_table == NULL ||
-+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) {
-+ return -ENODEV;
-+ }
-+
-+ acpi_data = data->acpi_data;
-+ freq_table = data->freq_table;
-+
-+ for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
-+ fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
-+ count += sprintf(&buf[count], "%u ", fid);
-+ }
-+ count += sprintf(&buf[count], "\n");
-+
-+ return count;
-+}
-+
-+static ssize_t show_freq_attr_controls(struct cpufreq_policy *policy, char *buf)
-+{
-+ struct acpi_cpufreq_data *data = drv_data[policy->cpu];
-+ struct acpi_processor_performance *acpi_data;
-+ struct cpufreq_frequency_table *freq_table;
-+ unsigned int i;
-+ unsigned int fid;
-+ unsigned int vid;
-+ ssize_t count = 0;
-+
-+ if (unlikely(data == NULL ||
-+ data->acpi_data == NULL ||
-+ data->freq_table == NULL ||
-+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) {
-+ return -ENODEV;
-+ }
-+
-+ acpi_data = data->acpi_data;
-+ freq_table = data->freq_table;
-+
-+ for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
-+ fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
-+ vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
-+ count += sprintf(&buf[count], "%u:%u ", fid, vid);
-+ }
-+ count += sprintf(&buf[count], "\n");
-+
-+ return count;
-+}
-+
-+static ssize_t show_freq_attr_default_controls(struct cpufreq_policy *policy, char *buf)
-+{
-+ struct acpi_cpufreq_data *data = drv_data[policy->cpu];
-+ struct cpufreq_frequency_table *freq_table;
-+ unsigned int i;
-+ unsigned int fid;
-+ unsigned int vid;
-+ ssize_t count = 0;
-+ ssize_t retval;
-+
-+ if (unlikely(data == NULL ||
-+ data->acpi_data == NULL ||
-+ data->freq_table == NULL ||
-+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) {
-+ return -ENODEV;
-+ }
-+
-+ retval = check_origial_table(data);
-+ if (0 != retval)
-+ return retval;
-+
-+ freq_table = data->freq_table;
-+
-+ for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
-+ fid = extract_fid_from_control(data->original_controls[freq_table[i].index]);
-+ vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
-+ count += sprintf(&buf[count], "%u:%u ", fid, vid);
-+ }
-+ count += sprintf(&buf[count], "\n");
-+
-+ return count;
-+}
-+
-+
-+static ssize_t store_freq_attr_vids(struct cpufreq_policy *policy, const char *buf, size_t count)
-+{
-+ struct acpi_cpufreq_data *data = drv_data[policy->cpu];
-+ struct acpi_processor_performance *acpi_data;
-+ struct cpufreq_frequency_table *freq_table;
-+ unsigned int freq_index;
-+ unsigned int state_index;
-+ unsigned int new_vid;
-+ unsigned int original_vid;
-+ unsigned int new_control;
-+ unsigned int original_control;
-+ const char *curr_buf = buf;
-+ char *next_buf;
-+ ssize_t retval;
-+
-+ if (unlikely(data == NULL ||
-+ data->acpi_data == NULL ||
-+ data->freq_table == NULL ||
-+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) {
-+ return -ENODEV;
-+ }
-+
-+ retval = check_origial_table(data);
-+ if (0 != retval)
-+ return retval;
-+
-+ acpi_data = data->acpi_data;
-+ freq_table = data->freq_table;
-+
-+ for (freq_index = 0; freq_table[freq_index].frequency != CPUFREQ_TABLE_END; freq_index++) {
-+ new_vid = simple_strtoul(curr_buf, &next_buf, 10);
-+ if (next_buf == curr_buf) {
-+ if ((curr_buf - buf == count - 1) && (*curr_buf == '\n')) {
-+ curr_buf++;
-+ break;
-+ }
-+ printk("failed to parse vid value at %i (%s)\n", freq_index, curr_buf);
-+ return -EINVAL;
-+ }
-+
-+ state_index = freq_table[freq_index].index;
-+ original_control = data->original_controls[state_index];
-+ original_vid = original_control & INTEL_MSR_VID_MASK;
-+ if (new_vid <= original_vid) {
-+ new_control = (original_control & ~INTEL_MSR_VID_MASK) | new_vid;
-+ dprintk("setting control at %i to %x (default is %x)\n",
-+ freq_index, new_control, original_control);
-+ acpi_data->states[state_index].control = new_control;
-+
-+ } else {
-+ printk("skipping vid at %i, %u is greater than default %u\n",
-+ freq_index, new_vid, original_vid);
-+ }
-+
-+ curr_buf = next_buf;
-+ while ((curr_buf - buf < count) && ((*curr_buf == ' ') || (*curr_buf == ','))) {
-+ curr_buf++;
-+ }
-+ }
-+
-+ /* set new voltage at current frequency */
-+ data->resume = 1;
-+ acpi_cpufreq_target(policy, get_cur_freq_on_cpu(policy->cpu), CPUFREQ_RELATION_L);
-+
-+ return curr_buf - buf;
-+}
-+
-+static ssize_t store_freq_attr_controls(struct cpufreq_policy *policy, const char *buf, size_t count)
-+{
-+ struct acpi_cpufreq_data *data = drv_data[policy->cpu];
-+ struct acpi_processor_performance *acpi_data;
-+ struct cpufreq_frequency_table *freq_table;
-+ const char *curr_buf;
-+ unsigned int op_count;
-+ unsigned int state_index;
-+ int isok;
-+ char *next_buf;
-+ ssize_t retval;
-+ unsigned int new_vid;
-+ unsigned int original_vid;
-+ unsigned int new_fid;
-+ unsigned int old_fid;
-+ unsigned int original_control;
-+ unsigned int old_control;
-+ unsigned int new_control;
-+ int found;
-+
-+ if (unlikely(data == NULL ||
-+ data->acpi_data == NULL ||
-+ data->freq_table == NULL ||
-+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) {
-+ return -ENODEV;
-+ }
-+
-+ retval = check_origial_table(data);
-+ if (0 != retval)
-+ return retval;
-+
-+ acpi_data = data->acpi_data;
-+ freq_table = data->freq_table;
-+
-+ op_count = 0;
-+ curr_buf = buf;
-+ next_buf = NULL;
-+ isok = 1;
-+
-+ while ( (isok) && (curr_buf != NULL) )
-+ {
-+ op_count++;
-+ // Parse fid
-+ new_fid = simple_strtoul(curr_buf, &next_buf, 10);
-+ if ((next_buf != curr_buf) && (next_buf != NULL))
-+ {
-+ // Parse separator between frequency and voltage
-+ curr_buf = next_buf;
-+ next_buf = NULL;
-+ if (*curr_buf==':')
-+ {
-+ curr_buf++;
-+ // Parse vid
-+ new_vid = simple_strtoul(curr_buf, &next_buf, 10);
-+ if ((next_buf != curr_buf) && (next_buf != NULL))
-+ {
-+ found = 0;
-+ for (state_index = 0; state_index < acpi_data->state_count; state_index++) {
-+ old_control = acpi_data->states[state_index].control;
-+ old_fid = extract_fid_from_control(old_control);
-+ if (new_fid == old_fid)
-+ {
-+ found = 1;
-+ original_control = data->original_controls[state_index];
-+ original_vid = extract_vid_from_control(original_control);
-+ if (new_vid <= original_vid)
-+ {
-+ new_control = (original_control & ~INTEL_MSR_VID_MASK) | new_vid;
-+ dprintk("setting control at %i to %x (default is %x)\n",
-+ state_index, new_control, original_control);
-+ acpi_data->states[state_index].control = new_control;
-+
-+ } else {
-+ printk("skipping vid at %i, %u is greater than default %u\n",
-+ state_index, new_vid, original_vid);
-+ }
-+ }
-+ }
-+
-+ if (found == 0)
-+ {
-+ printk("operating point # %u not found (FID = %u)\n", op_count, new_fid);
-+ isok = 0;
-+ }
-+
-+ // Parse seprator before next operating point, if any
-+ curr_buf = next_buf;
-+ next_buf = NULL;
-+ if ((*curr_buf == ',') || (*curr_buf == ' '))
-+ curr_buf++;
-+ else
-+ curr_buf = NULL;
-+ }
-+ else
-+ {
-+ printk("failed to parse VID of operating point # %u (%s)\n", op_count, curr_buf);
-+ isok = 0;
-+ }
-+ }
-+ else
-+ {
-+ printk("failed to parse operating point # %u (%s)\n", op_count, curr_buf);
-+ isok = 0;
-+ }
-+ }
-+ else
-+ {
-+ printk("failed to parse FID of operating point # %u (%s)\n", op_count, curr_buf);
-+ isok = 0;
-+ }
-+ }
-+
-+ if (isok)
-+ {
-+ retval = count;
-+ /* set new voltage at current frequency */
-+ data->resume = 1;
-+ acpi_cpufreq_target(policy, get_cur_freq_on_cpu(policy->cpu), CPUFREQ_RELATION_L);
-+ }
-+ else
-+ {
-+ retval = -EINVAL;
-+ }
-+
-+ return retval;
-+}
-+
-+static ssize_t show_freq_attr_phc_version(struct cpufreq_policy *policy, char *buf)
-+{
-+ ssize_t count = 0;
-+ count += sprintf(&buf[count], "%s\n", PHC_VERSION_STRING);
-+ return count;
-+}
-+
-+static struct freq_attr cpufreq_freq_attr_phc_version =
-+{
-+ .attr = { .name = "phc_version", .mode = 0444, .owner = THIS_MODULE },
-+ .show = show_freq_attr_phc_version,
-+ .store = NULL,
-+};
-+
-+static struct freq_attr cpufreq_freq_attr_vids =
-+{
-+ .attr = { .name = "phc_vids", .mode = 0644, .owner = THIS_MODULE },
-+ .show = show_freq_attr_vids,
-+ .store = store_freq_attr_vids,
-+};
-+
-+static struct freq_attr cpufreq_freq_attr_default_vids =
-+{
-+ .attr = { .name = "phc_default_vids", .mode = 0444, .owner = THIS_MODULE },
-+ .show = show_freq_attr_default_vids,
-+ .store = NULL,
-+};
-+
-+static struct freq_attr cpufreq_freq_attr_fids =
-+{
-+ .attr = { .name = "phc_fids", .mode = 0444, .owner = THIS_MODULE },
-+ .show = show_freq_attr_fids,
-+ .store = NULL,
-+};
-+
-+static struct freq_attr cpufreq_freq_attr_controls =
-+{
-+ .attr = { .name = "phc_controls", .mode = 0644, .owner = THIS_MODULE },
-+ .show = show_freq_attr_controls,
-+ .store = store_freq_attr_controls,
-+};
-+
-+static struct freq_attr cpufreq_freq_attr_default_controls =
-+{
-+ .attr = { .name = "phc_default_controls", .mode = 0444, .owner = THIS_MODULE },
-+ .show = show_freq_attr_default_controls,
-+ .store = NULL,
-+};
-+
-+
- static struct freq_attr *acpi_cpufreq_attr[] = {
-+ &cpufreq_freq_attr_phc_version,
- &cpufreq_freq_attr_scaling_available_freqs,
-+ &cpufreq_freq_attr_vids,
-+ &cpufreq_freq_attr_default_vids,
-+ &cpufreq_freq_attr_fids,
-+ &cpufreq_freq_attr_controls,
-+ &cpufreq_freq_attr_default_controls,
- NULL,
- };
-
- static struct cpufreq_driver acpi_cpufreq_driver = {
- .verify = acpi_cpufreq_verify,
diff --git a/patches/mactel-linux-2.6.24.patch b/patches/mactel-linux-2.6.24.patch
deleted file mode 100644
index 644bd25..0000000
--- a/patches/mactel-linux-2.6.24.patch
+++ /dev/null
@@ -1,1266 +0,0 @@
-Add sensors set for MacBook2, from register dump on a mid-2007 MacBook2.
-
-From: Riki Oktarianto <rkoktarianto@gmail.com>
-
-
----
-
- drivers/hwmon/applesmc.c | 29 +++++++++++++++++++----------
- 1 files changed, 19 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 377c96d..4dca4cd 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -86,12 +86,15 @@ static const char* temperature_sensors_sets[][36] = {
- /* Set 0: Macbook Pro */
- { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
- "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
--/* Set 1: Macbook set */
-+/* Set 1: Macbook2 set */
-+ { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "TTF0", "Th0H",
-+ "Th0S", "Th1H", NULL },
-+/* Set 2: Macbook set */
- { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
- "Th1H", "Ts0P", NULL },
--/* Set 2: Macmini set */
-+/* Set 3: Macmini set */
- { "TC0D", "TC0P", NULL },
--/* Set 3: Mac Pro (2 x Quad-Core) */
-+/* Set 4: Mac Pro (2 x Quad-Core) */
- { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P",
- "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P",
- "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S",
-@@ -1247,12 +1250,14 @@ static void applesmc_release_accelerometer(void)
- static __initdata struct dmi_match_data applesmc_dmi_data[] = {
- /* MacBook Pro: accelerometer, backlight and temperature set 0 */
- { .accelerometer = 1, .light = 1, .temperature_set = 0 },
--/* MacBook: accelerometer and temperature set 1 */
-+/* MacBook2: accelerometer and temperature set 1 */
- { .accelerometer = 1, .light = 0, .temperature_set = 1 },
--/* MacMini: temperature set 2 */
-- { .accelerometer = 0, .light = 0, .temperature_set = 2 },
--/* MacPro: temperature set 3 */
-+/* MacBook: accelerometer and temperature set 2 */
-+ { .accelerometer = 1, .light = 0, .temperature_set = 2 },
-+/* MacMini: temperature set 3 */
- { .accelerometer = 0, .light = 0, .temperature_set = 3 },
-+/* MacPro: temperature set 4 */
-+ { .accelerometer = 0, .light = 0, .temperature_set = 4 },
- };
-
- /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
-@@ -1264,16 +1269,20 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
- (void*)&applesmc_dmi_data[0]},
- { applesmc_dmi_match, "Apple MacBook", {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
-- DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
-+ DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") },
- (void*)&applesmc_dmi_data[1]},
-+ { applesmc_dmi_match, "Apple MacBook", {
-+ DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
-+ DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
-+ (void*)&applesmc_dmi_data[2]},
- { applesmc_dmi_match, "Apple Macmini", {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
- DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") },
-- (void*)&applesmc_dmi_data[2]},
-+ (void*)&applesmc_dmi_data[3]},
- { applesmc_dmi_match, "Apple MacPro2", {
- DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
- DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
-- (void*)&applesmc_dmi_data[3]},
-+ (void*)&applesmc_dmi_data[4]},
- { .ident = NULL }
- };
-
-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 4dca4cd..0950839 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -114,6 +114,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
-@@ -188,12 +191,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 "
-@@ -201,33 +205,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;
- }
-
- /*
-Add interrupt support for the accelerometer. A message is printed in dmesg when an interrupt occurs, but no further handling is done.
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- drivers/hwmon/applesmc.c | 320 +++++++++++++++++++++++++++++++++++++++++++---
- 1 files changed, 297 insertions(+), 23 deletions(-)
-
-diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index 3b09cdb..8f75b57 100644
---- a/drivers/hwmon/applesmc.c
-+++ b/drivers/hwmon/applesmc.c
-@@ -39,14 +39,20 @@
- #include <linux/leds.h>
- #include <linux/hwmon.h>
- #include <linux/workqueue.h>
-+#include <linux/interrupt.h>
-
- /* data port used by Apple SMC */
- #define APPLESMC_DATA_PORT 0x300
- /* command/status port used by Apple SMC */
- #define APPLESMC_CMD_PORT 0x304
-+/* status port used by Apple SMC to get which interrupt type just happened */
-+#define APPLESMC_INT_PORT 0x31f
-
- #define APPLESMC_NR_PORTS 32 /* 0x300-0x31f */
-
-+/* Defined in ACPI DSDT table, should we read it from there? */
-+#define APPLESMC_IRQ 6
-+
- #define APPLESMC_MAX_DATA_LENGTH 32
-
- #define APPLESMC_STATUS_MASK 0x0f
-@@ -57,6 +63,8 @@
-
- #define KEY_COUNT_KEY "#KEY" /* r-o ui32 */
-
-+#define INTERRUPT_OK_KEY "NTOK" /* w-o ui8 */
-+
- #define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */
- #define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */
- #define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
-@@ -68,6 +76,19 @@
- #define MOTION_SENSOR_Z_KEY "MO_Z" /* r-o sp78 (2 bytes) */
- #define MOTION_SENSOR_KEY "MOCN" /* r/w ui16 */
-
-+/*
-+ * Interrupt controls.
-+ * If the norm of the position (sqrt(MO_X^2+MO_Y^2+MO_Z^2)) is smaller than
-+ * MOLT (free fall), or bigger than MOHT (high acceleration) for longer than the
-+ * value of MOLD (or MOHD), SMC will trigger an interrupt.
-+ */
-+#define MOTION_LOW_NORM "MOLT" /* r/w sp78 (2 bytes) */
-+#define MOTION_HIGH_NORM "MOHT" /* r/w sp78 (2 bytes) */
-+#define MOTION_LOW_NORM_INTERVAL "MOLD" /* r/w ui8 */
-+#define MOTION_HIGH_NORM_INTERVAL "MOHD" /* r/w ui8 */
-+
-+#define MSDW_KEY "MSDW" /* r/w flag (1 byte) */
-+
- #define FANS_COUNT "FNum" /* r-o ui8 */
- #define FANS_MANUAL "FS! " /* r-w ui16 */
- #define FAN_ACTUAL_SPEED "F0Ac" /* r-o fpe2 (2 bytes) */
-@@ -385,12 +406,83 @@ static int applesmc_read_motion_sensor(int index, s16* value)
- }
-
- /*
-+ * applesmc_init_check_key_value - checks if a given key contains the bytes in
-+ * buffer, if not, writes these bytes.
-+ * In case of failure retry every INIT_WAIT_MSECS msec, and timeout if it
-+ * waited more than INIT_TIMEOUT_MSECS in total.
-+ * Returns zero on success or a negative error on failure. Callers must
-+ * hold applesmc_lock.
-+ */
-+static int applesmc_init_check_key_value(const char *key, u8 *buffer, u8 len)
-+{
-+ int total, ret, i, compare;
-+ u8 rdbuffer[APPLESMC_MAX_DATA_LENGTH];
-+
-+ if (len > APPLESMC_MAX_DATA_LENGTH) {
-+ printk(KERN_ERR "applesmc_init_check_key_value: cannot "
-+ "read/write more than %d bytes",
-+ APPLESMC_MAX_DATA_LENGTH);
-+ return -EINVAL;
-+ }
-+
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret = applesmc_read_key(key, rdbuffer, len);
-+ if (!ret) {
-+ compare = 1;
-+ for (i = 0; i < len; i++) {
-+ if (rdbuffer[i] != buffer[i]) {
-+ compare = 0;
-+ break;
-+ }
-+ }
-+
-+ if (compare) {
-+ return 0;
-+ }
-+ }
-+ ret = applesmc_write_key(key, buffer, len);
-+ msleep(INIT_WAIT_MSECS);
-+ }
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return -EIO;
-+}
-+
-+irqreturn_t applesmc_irq_handler(int irq, void *dev_id)
-+{
-+ u8 int_type = inb(APPLESMC_INT_PORT);
-+
-+ switch (int_type) {
-+ case 0x60:
-+ printk(KERN_INFO "applesmc: received a free fall interrupt\n");
-+ break;
-+ case 0x6f:
-+ printk(KERN_INFO
-+ "applesmc: received a high acceleration interrupt\n");
-+ break;
-+ case 0x80:
-+ printk(KERN_INFO "applesmc: received a shock interrupt\n");
-+ break;
-+ default:
-+ printk(KERN_INFO
-+ "applesmc: received an unknown interrupt %x\n",
-+ int_type);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/*
- * applesmc_device_init - initialize the accelerometer. Returns zero on success
- * and negative error code on failure. Can sleep.
- */
- static int applesmc_device_init(void)
- {
-- int total, ret = -ENXIO;
-+ int total;
-+ int ret = -ENXIO;
-+ int ret1, ret2;
- u8 buffer[2];
-
- if (!applesmc_accelerometer)
-@@ -398,32 +490,79 @@ static int applesmc_device_init(void)
-
- mutex_lock(&applesmc_lock);
-
-+ /* Accept interrupts */
-+ buffer[0] = 0x01;
- for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-- if (debug)
-- printk(KERN_DEBUG "applesmc try %d\n", total);
-- if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
-- (buffer[0] != 0x00 || buffer[1] != 0x00)) {
-- if (total == INIT_TIMEOUT_MSECS) {
-- printk(KERN_DEBUG "applesmc: device has"
-- " already been initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- } else {
-- printk(KERN_DEBUG "applesmc: device"
-- " successfully initialized"
-- " (0x%02x, 0x%02x).\n",
-- buffer[0], buffer[1]);
-- }
-- ret = 0;
-- goto out;
-- }
-- buffer[0] = 0xe0;
-- buffer[1] = 0x00;
-- applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
-+ ret1 = applesmc_write_key(INTERRUPT_OK_KEY, buffer, 1);
-+ msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set NTOK key, "
-+ "will not receive interrupts.\n");
-+
-+ /* Setup interrupt controls. */
-+ buffer[0] = 20; /* 20 msecs */
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ buffer[0] = 20; /* 20 msecs */
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM_INTERVAL,
-+ buffer, 1);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "interrupt interval, might not receive "
-+ "some interrupts.");
-+ }
-+
-+ buffer[0] = 0x00;
-+ buffer[1] = 0x60;
-+ ret1 = applesmc_init_check_key_value(MOTION_LOW_NORM, buffer, 2);
-+
-+ buffer[0] = 0x01;
-+ buffer[1] = 0xc0;
-+ ret2 = applesmc_init_check_key_value(MOTION_HIGH_NORM, buffer, 2);
-+
-+ if (ret1 || ret2) {
-+ printk(KERN_WARNING "applesmc: Cannot set motion sensor "
-+ "min/max norm parameters, "
-+ "might not receive some interrupts.");
-+ }
-+
-+ /* Mysterious key. */
-+ buffer[0] = 0x01;
-+ for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-+ ret1 = applesmc_write_key(MSDW_KEY, buffer, 1);
- msleep(INIT_WAIT_MSECS);
-+
-+ if (!ret1)
-+ break;
-+ }
-+ if (ret1)
-+ printk(KERN_WARNING "applesmc: Cannot set MSDW key\n");
-+
-+ /* Initialize the device. */
-+ buffer[0] = 0xe0;
-+ buffer[1] = 0xf8;
-+ if (applesmc_init_check_key_value(MOTION_SENSOR_KEY, buffer, 2)) {
-+ printk(KERN_WARNING "applesmc: failed to init "
-+ "the accelerometer\n");
-+ goto out;
- }
-
-- printk(KERN_WARNING "applesmc: failed to init the device\n");
-+ ret1 = request_irq(APPLESMC_IRQ, applesmc_irq_handler, IRQF_DISABLED,
-+ "applesmc_irq_handler", NULL);
-+
-+ if (ret1) {
-+ printk(KERN_WARNING "applesmc: cannot setup irq handler\n");
-+ }
-+
-+ printk(KERN_DEBUG "applesmc: accelerometer "
-+ "successfully initialized.\n");
-+ ret = 0;
-
- out:
- mutex_unlock(&applesmc_lock);
-@@ -468,9 +607,16 @@ static int applesmc_resume(struct platform_device *dev)
- return applesmc_device_init();
- }
-
-+static int applesmc_remove(struct platform_device *dev)
-+{
-+ free_irq(APPLESMC_IRQ, NULL);
-+ return 0;
-+}
-+
- static struct platform_driver applesmc_driver = {
- .probe = applesmc_probe,
- .resume = applesmc_resume,
-+ .remove = applesmc_remove,
- .driver = {
- .name = "applesmc",
- .owner = THIS_MODULE,
-@@ -932,6 +1078,122 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
- return count;
- }
-
-+static ssize_t applesmc_accelerometer_show(struct device *dev,
-+ struct device_attribute *attr, char *sysfsbuf)
-+{
-+ int ret;
-+ unsigned int value = 0;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk(KERN_ERR
-+ "Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_read_key(key, buffer, length);
-+ if (length == 2)
-+ value = ((unsigned int)buffer[0] << 8) | buffer[1];
-+ else if (length == 1)
-+ value = buffer[0];
-+ else {
-+ printk("Invalid length for applesmc_param_show");
-+ ret = -EINVAL;
-+ }
-+
-+ mutex_unlock(&applesmc_lock);
-+ if (ret)
-+ return ret;
-+ else
-+ return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", value);
-+}
-+
-+static ssize_t applesmc_accelerometer_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *sysfsbuf, size_t count)
-+{
-+ int ret;
-+ u32 value;
-+ u8 buffer[2];
-+ char *key;
-+ int length;
-+ struct sensor_device_attribute_2 *sensor_attr =
-+ to_sensor_dev_attr_2(attr);
-+
-+ switch (sensor_attr->index) {
-+ case 0:
-+ key = MOTION_LOW_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 1:
-+ key = MOTION_HIGH_NORM_INTERVAL;
-+ length = 1;
-+ break;
-+ case 2:
-+ key = MOTION_LOW_NORM;
-+ length = 2;
-+ break;
-+ case 3:
-+ key = MOTION_HIGH_NORM;
-+ length = 2;
-+ break;
-+ default:
-+ printk("Invalid index for applesmc_accelerometer_show");
-+ return -EINVAL;
-+ }
-+
-+ value = simple_strtoul(sysfsbuf, NULL, 10);
-+
-+ if (length == 2) {
-+ if (value > 0xffff)
-+ return -EINVAL;
-+
-+ buffer[0] = (value >> 8) & 0xff;
-+ buffer[1] = value & 0xff;
-+ } else if (length == 1) {
-+ if (value > 0xff)
-+ return -EINVAL;
-+
-+ buffer[0] = value & 0xff;
-+ } else {
-+ printk("Invalid length for applesmc_param_store");
-+ return -EINVAL;
-+ }
-+
-+ mutex_lock(&applesmc_lock);
-+
-+ ret = applesmc_write_key(key, buffer, length);
-+
-+ mutex_unlock(&applesmc_lock);
-+
-+ if (ret)
-+ return ret;
-+ else
-+ return count;
-+}
- static struct led_classdev applesmc_backlight = {
- .name = "smc:kbd_backlight",
- .default_trigger = "nand-disk",
-@@ -943,10 +1205,22 @@ static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL);
- static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL);
- static DEVICE_ATTR(calibrate, 0644,
- applesmc_calibrate_show, applesmc_calibrate_store);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 0);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger_interval, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 1);
-+static SENSOR_DEVICE_ATTR(low_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 2);
-+static SENSOR_DEVICE_ATTR(high_norm_trigger, 0644,
-+ applesmc_accelerometer_show, applesmc_accelerometer_store, 3);
-
- static struct attribute *accelerometer_attributes[] = {
- &dev_attr_position.attr,
- &dev_attr_calibrate.attr,
-+ &sensor_dev_attr_low_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger.dev_attr.attr,
-+ &sensor_dev_attr_low_norm_trigger_interval.dev_attr.attr,
-+ &sensor_dev_attr_high_norm_trigger_interval.dev_attr.attr,
- NULL
- };
-
-Appletouch driver ATP_THRESHOLD fix.
-
-From: Ortwin Glück <odi@odi.ch>
-
-
----
-
- drivers/input/mouse/appletouch.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index a1804bf..51cc7c3 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -127,7 +127,7 @@ MODULE_DEVICE_TABLE (usb, atp_table);
- * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is
- * ignored.
- */
--#define ATP_THRESHOLD 5
-+#define ATP_THRESHOLD 3
-
- /* MacBook Pro (Geyser 3 & 4) initialization constants */
- #define ATP_GEYSER3_MODE_READ_REQUEST_ID 1
-Added IDs for macbook3,1 trackpad
-
-From: Chris Irwin <chris@chrisirwin.ca>
-
-
----
-
- drivers/input/mouse/appletouch.c | 15 ++++++++++++++-
- 1 files changed, 14 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index 17381a9..dcd9a0d 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -62,6 +62,11 @@
- #define GEYSER4_ISO_PRODUCT_ID 0x021B
- #define GEYSER4_JIS_PRODUCT_ID 0x021C
-
-+/* Macbook3,1 devices */
-+#define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229
-+#define GEYSER4_HF_ISO_PRODUCT_ID 0x022A
-+#define GEYSER4_HF_JIS_PRODUCT_ID 0x021B
-+
- #define ATP_DEVICE(prod) \
- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
- USB_DEVICE_ID_MATCH_INT_CLASS | \
-@@ -93,6 +98,11 @@ static struct usb_device_id atp_table [] = {
- { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) },
- { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) },
-
-+ /* Core2 Duo MacBook3,1 */
-+ { ATP_DEVICE(GEYSER4_HF_ANSI_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) },
-+
- /* Terminating entry */
- { }
- };
-@@ -217,7 +227,10 @@ static inline int atp_is_geyser_3(struct atp *dev)
- (productId == GEYSER3_JIS_PRODUCT_ID) ||
- (productId == GEYSER4_ANSI_PRODUCT_ID) ||
- (productId == GEYSER4_ISO_PRODUCT_ID) ||
-- (productId == GEYSER4_JIS_PRODUCT_ID);
-+ (productId == GEYSER4_JIS_PRODUCT_ID) ||
-+ (productId == GEYSER4_HF_ANSI_PRODUCT_ID) ||
-+ (productId == GEYSER4_HF_ISO_PRODUCT_ID) ||
-+ (productId == GEYSER4_HF_JIS_PRODUCT_ID);
- }
-
- /*
-Display Macbook Pro 1st gen controls when the subsystem id is wrong (0x100).
-
-From: Nicolas Boichat <nicolas@boichat.ch>
-
-
----
-
- sound/pci/hda/patch_sigmatel.c | 4 +++-
- 1 files changed, 3 insertions(+), 1 deletions(-)
-
-diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
-index 3f25de7..f210051 100644
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -2125,10 +2125,12 @@ static int patch_stac922x(struct hda_codec *codec)
- case 0x106b1700:
- case 0x106b0200:
- case 0x106b1e00:
-+ case 0x100: /* Invalid subsystem ID, happens randomly on
-+ * MacBook Pro 1st generation
-+ */
- spec->board_config = STAC_INTEL_MAC_V3;
- break;
- case 0x106b1a00:
-- case 0x00000100:
- spec->board_config = STAC_INTEL_MAC_V4;
- break;
- case 0x106b0a00:
-Fixes audio on Macbook v2.
-
-From: Marek Sterzik <marek@milimetr.org>
-
-
----
-
- sound/pci/hda/patch_sigmatel.c | 2 ++
- 1 files changed, 2 insertions(+), 0 deletions(-)
-
-diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
-index f210051..271cb77 100644
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -69,6 +69,7 @@ enum {
- /* for backward compitability */
- STAC_MACMINI,
- STAC_MACBOOK,
-+ STAC_MACBOOK_V2,
- STAC_MACBOOK_PRO_V1,
- STAC_MACBOOK_PRO_V2,
- STAC_IMAC_INTEL,
-@@ -623,6 +624,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = {
- /* for backward compitability */
- [STAC_MACMINI] = "macmini",
- [STAC_MACBOOK] = "macbook",
-+ [STAC_MACBOOK_V2] = "macbook-v2",
- [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1",
- [STAC_MACBOOK_PRO_V2] = "macbook-pro",
- [STAC_IMAC_INTEL] = "imac-intel",
-New appletouch driver.
-
-From: Sven Anders <anders@anduras.de>
-
-
----
-
- drivers/input/mouse/appletouch.c | 160 +++++++++++++++++++++++++++++---------
- 1 files changed, 121 insertions(+), 39 deletions(-)
-
-diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
-index dcd9a0d..5a3459c 100644
---- a/drivers/input/mouse/appletouch.c
-+++ b/drivers/input/mouse/appletouch.c
-@@ -8,6 +8,7 @@
- * Copyright (C) 2005 Peter Osterlund (petero2@telia.com)
- * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch)
- * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch)
-+ * Copyright (C) 2007-2008 Sven Anders (anders@anduras.de)
- *
- * Thanks to Alex Harper <basilisk@foobox.net> for his inputs.
- *
-@@ -38,16 +39,18 @@
- #define APPLE_VENDOR_ID 0x05AC
-
- /* These names come from Info.plist in AppleUSBTrackpad.kext */
-+
-+/* PowerBooks Feb 2005 / iBooks */
- #define FOUNTAIN_ANSI_PRODUCT_ID 0x020E
- #define FOUNTAIN_ISO_PRODUCT_ID 0x020F
--
- #define FOUNTAIN_TP_ONLY_PRODUCT_ID 0x030A
-
- #define GEYSER1_TP_ONLY_PRODUCT_ID 0x030B
-
--#define GEYSER_ANSI_PRODUCT_ID 0x0214
--#define GEYSER_ISO_PRODUCT_ID 0x0215
--#define GEYSER_JIS_PRODUCT_ID 0x0216
-+/* PowerBooks Oct 2005 */
-+#define GEYSER2_ANSI_PRODUCT_ID 0x0214
-+#define GEYSER2_ISO_PRODUCT_ID 0x0215
-+#define GEYSER2_JIS_PRODUCT_ID 0x0216
-
- /* MacBook devices */
- #define GEYSER3_ANSI_PRODUCT_ID 0x0217
-@@ -58,9 +61,14 @@
- * Geyser IV: same as Geyser III according to Info.plist in AppleUSBTrackpad.kext
- * -> same IOClass (AppleUSBGrIIITrackpad), same acceleration tables
- */
--#define GEYSER4_ANSI_PRODUCT_ID 0x021A
--#define GEYSER4_ISO_PRODUCT_ID 0x021B
--#define GEYSER4_JIS_PRODUCT_ID 0x021C
-+#define GEYSER4_ANSI_PRODUCT_ID 0x021A
-+#define GEYSER4_ISO_PRODUCT_ID 0x021B
-+#define GEYSER4_JIS_PRODUCT_ID 0x021C
-+
-+/* Macbook3,1 devices */
-+#define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229
-+#define GEYSER4_HF_ISO_PRODUCT_ID 0x022A
-+#define GEYSER4_HF_JIS_PRODUCT_ID 0x021B
-
- /* Macbook3,1 devices */
- #define GEYSER4_HF_ANSI_PRODUCT_ID 0x0229
-@@ -78,15 +86,17 @@
-
- /* table of devices that work with this driver */
- static struct usb_device_id atp_table [] = {
-+
-+ /* PowerBooks Feb 2005, iBooks G4 */
- { ATP_DEVICE(FOUNTAIN_ANSI_PRODUCT_ID) },
- { ATP_DEVICE(FOUNTAIN_ISO_PRODUCT_ID) },
- { ATP_DEVICE(FOUNTAIN_TP_ONLY_PRODUCT_ID) },
- { ATP_DEVICE(GEYSER1_TP_ONLY_PRODUCT_ID) },
-
- /* PowerBooks Oct 2005 */
-- { ATP_DEVICE(GEYSER_ANSI_PRODUCT_ID) },
-- { ATP_DEVICE(GEYSER_ISO_PRODUCT_ID) },
-- { ATP_DEVICE(GEYSER_JIS_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER2_ANSI_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER2_ISO_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER2_JIS_PRODUCT_ID) },
-
- /* Core Duo MacBook & MacBook Pro */
- { ATP_DEVICE(GEYSER3_ANSI_PRODUCT_ID) },
-@@ -103,6 +113,11 @@ static struct usb_device_id atp_table [] = {
- { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) },
- { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) },
-
-+ /* Core2 Duo MacBook3,1 */
-+ { ATP_DEVICE(GEYSER4_HF_ANSI_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER4_HF_ISO_PRODUCT_ID) },
-+ { ATP_DEVICE(GEYSER4_HF_JIS_PRODUCT_ID) },
-+
- /* Terminating entry */
- { }
- };
-@@ -146,12 +161,21 @@ MODULE_DEVICE_TABLE (usb, atp_table);
- #define ATP_GEYSER_MODE_REQUEST_INDEX 0
- #define ATP_GEYSER_MODE_VENDOR_VALUE 0x04
-
-+/*
-+ * Meaning of the status bits (only Geyser 3/4?)
-+ */
-+#define ATP_STATUS_BIT_BUTTON 0x01 /* The button was pressed */
-+#define ATP_STATUS_BIT_UNKNOWN1 0x02 /* Unknown or unused */
-+#define ATP_STATUS_BIT_BASE_UPDATE 0x04 /* Update of the base values (untouched pad) */
-+#define ATP_STATUS_BIT_UNKNOWN2 0x08 /* Unknown or unused */
-+#define ATP_STATUS_BIT_FROM_RESET 0x10 /* Reset previously performed */
-+
- /* Structure to hold all of our device specific stuff */
- struct atp {
- char phys[64];
- struct usb_device * udev; /* usb device */
- struct urb * urb; /* usb request block */
-- signed char * data; /* transferred data */
-+ u8 * data; /* transferred data */
- struct input_dev * input; /* input dev */
- unsigned char open; /* non-zero if opened */
- unsigned char valid; /* are the sensors valid ? */
-@@ -166,8 +190,8 @@ struct atp {
- /* accumulated sensors */
- int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
- int datalen; /* size of an USB urb transfer */
-- int idlecount; /* number of empty packets */
-- struct work_struct work;
-+ int idle_counter; /* number of empty packets */
-+ struct work_struct work; /* kernel workqueue entry (for re-init) */
- };
-
- #define dbg_dump(msg, tab) \
-@@ -184,8 +208,12 @@ struct atp {
- if (debug) printk(KERN_DEBUG format, ##a); \
- } while (0)
-
--MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann");
--MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver");
-+MODULE_AUTHOR("Johannes Berg");
-+MODULE_AUTHOR("Stelian Pop");
-+MODULE_AUTHOR("Frank Arnold");
-+MODULE_AUTHOR("Michael Hanselmann");
-+MODULE_AUTHOR("Sven Anders");
-+MODULE_DESCRIPTION("Apple PowerBook and MacBook USB touchpad driver");
- MODULE_LICENSE("GPL");
-
- /*
-@@ -195,7 +223,7 @@ static int threshold = ATP_THRESHOLD;
- module_param(threshold, int, 0644);
- MODULE_PARM_DESC(threshold, "Discards any change in data from a sensor (trackpad has hundreds of these sensors) less than this value");
-
--static int debug = 1;
-+static int debug;
- module_param(debug, int, 0644);
- MODULE_PARM_DESC(debug, "Activate debugging output");
-
-@@ -213,12 +241,12 @@ static inline int atp_is_geyser_2(struct atp *dev)
- {
- u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
-
-- return (productId == GEYSER_ANSI_PRODUCT_ID) ||
-- (productId == GEYSER_ISO_PRODUCT_ID) ||
-- (productId == GEYSER_JIS_PRODUCT_ID);
-+ return (productId == GEYSER2_ANSI_PRODUCT_ID) ||
-+ (productId == GEYSER2_ISO_PRODUCT_ID) ||
-+ (productId == GEYSER2_JIS_PRODUCT_ID);
- }
-
--static inline int atp_is_geyser_3(struct atp *dev)
-+static inline int atp_is_geyser_3_4(struct atp *dev)
- {
- u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
-
-@@ -242,7 +270,7 @@ static int atp_geyser_init(struct usb_device *udev)
- {
- char data[8];
- int size;
--
-+
- size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- ATP_GEYSER_MODE_READ_REQUEST_ID,
- USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-@@ -250,6 +278,13 @@ static int atp_geyser_init(struct usb_device *udev)
- ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
-
- if (size != 8) {
-+ if (debug)
-+ {
-+ int i;
-+ printk("appletouch atp_geyser_init READ error\n");
-+ for (i=0; i<8; i++)
-+ printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+ }
- err("Could not do mode read request from device"
- " (Geyser Raw mode)");
- return -EIO;
-@@ -265,6 +300,13 @@ static int atp_geyser_init(struct usb_device *udev)
- ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
-
- if (size != 8) {
-+ if (debug)
-+ {
-+ int i;
-+ printk("appletouch atp_geyser_init WRITE error\n");
-+ for (i=0; i<8; i++)
-+ printk("appletouch[%d]: %d\n", i, (int) data[i]);
-+ }
- err("Could not do mode write request to device"
- " (Geyser Raw mode)");
- return -EIO;
-@@ -282,8 +324,7 @@ static void atp_reinit(struct work_struct *work)
- struct usb_device *udev = dev->udev;
- int retval;
-
-- dev->idlecount = 0;
--
-+ dprintk("appletouch: putting appletouch to sleep (reinit)\n");
- atp_geyser_init(udev);
-
- retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
-@@ -398,7 +439,7 @@ static void atp_complete(struct urb* urb)
- }
-
- /* reorder the sensors values */
-- if (atp_is_geyser_3(dev)) {
-+ if (atp_is_geyser_3_4(dev)) {
- memset(dev->xy_cur, 0, sizeof(dev->xy_cur));
-
- /*
-@@ -455,13 +496,20 @@ static void atp_complete(struct urb* urb)
- dbg_dump("sample", dev->xy_cur);
-
- if (!dev->valid) {
-- /* first sample */
-+ /* first sample after init or resume */
- dev->valid = 1;
- dev->x_old = dev->y_old = -1;
- memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
-+ dev->idle_counter = 0;
-+
-+ /* store first sample on older Geyser */
-+ if ((dev->data[dev->datalen-1] & ATP_STATUS_BIT_BASE_UPDATE) ||
-+ !atp_is_geyser_3_4(dev))
-+ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
-+
-
- if (dev->size_detect_done ||
-- atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */
-+ atp_is_geyser_3_4(dev)) /* No 17" Macbooks (yet) */
- goto exit;
-
- /* 17" Powerbooks have extra X sensors */
-@@ -487,26 +535,47 @@ static void atp_complete(struct urb* urb)
- goto exit;
- }
-
-+ /* Just update the base values (i.e. touchpad in untouched state) */
-+ if (dev->data[dev->datalen-1] & ATP_STATUS_BIT_BASE_UPDATE)
-+ {
-+ if (debug > 0) printk("appletouch: updated base values\n");
-+
-+ memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
-+ goto exit;
-+ }
-+
- for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) {
-- /* accumulate the change */
-- signed char change = dev->xy_old[i] - dev->xy_cur[i];
-- dev->xy_acc[i] -= change;
-+ /* calculate the change */
-+ dev->xy_acc[i] = dev->xy_cur[i] - dev->xy_old[i];
-+
-+ /* this is a round-robin value, so couple with that */
-+ if (dev->xy_acc[i] > 127)
-+ dev->xy_acc[i] -= 256;
-+
-+ if (dev->xy_acc[i] < -127)
-+ dev->xy_acc[i] += 256;
-+
-+ /* Needed for the older Geyser */
-+ if (!atp_is_geyser_3_4(dev))
-+ {
-+ /* store new 'untouched' value, if any new */
-+ if (dev->xy_acc[i] < -1)
-+ dev->xy_old[i] = dev->xy_cur[i];
-+ }
-
- /* prevent down drifting */
- if (dev->xy_acc[i] < 0)
- dev->xy_acc[i] = 0;
- }
-
-- memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
--
- dbg_dump("accumulator", dev->xy_acc);
-
- x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS,
- ATP_XFACT, &x_z, &x_f);
- y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS,
- ATP_YFACT, &y_z, &y_f);
-- key = dev->data[dev->datalen - 1] & 1;
--
-+ key = dev->data[dev->datalen - 1] & ATP_STATUS_BIT_BUTTON;
-+
- if (x && y) {
- if (dev->x_old != -1) {
- x = (dev->x_old * 3 + x) >> 2;
-@@ -551,16 +620,28 @@ static void atp_complete(struct urb* urb)
- * work on Fountain touchpads.
- */
- if (!atp_is_fountain(dev)) {
-+
-+ /* Button must not be pressed when entering suspend,
-+ otherwise we will never release the button. */
- if (!x && !y && !key) {
-- dev->idlecount++;
-- if (dev->idlecount == 10) {
-- dev->valid = 0;
-+
-+ /* Idle counter */
-+ dev->idle_counter++;
-+
-+ /* Wait for 10 more packages before suspending */
-+ if (dev->idle_counter > 10) {
-+
-+ /* Reset counter */
-+ dev->idle_counter = 0;
-+
-+ /* Prepare for device reset */
- schedule_work(&dev->work);
-+
- /* Don't resubmit urb here, wait for reinit */
- return;
- }
- } else
-- dev->idlecount = 0;
-+ dev->idle_counter = 0;
- }
-
- exit:
-@@ -628,7 +709,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- dev->udev = udev;
- dev->input = input_dev;
- dev->overflowwarn = 0;
-- if (atp_is_geyser_3(dev))
-+ if (atp_is_geyser_3_4(dev))
- dev->datalen = 64;
- else if (atp_is_geyser_2(dev))
- dev->datalen = 64;
-@@ -671,7 +752,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
-
- set_bit(EV_ABS, input_dev->evbit);
-
-- if (atp_is_geyser_3(dev)) {
-+ if (atp_is_geyser_3_4(dev)) {
- /*
- * MacBook have 20 X sensors, 10 Y sensors
- */
-@@ -714,6 +795,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
- /* save our data pointer in this interface device */
- usb_set_intfdata(iface, dev);
-
-+ /* initialize kernel work queue for re-init out of interrupt context */
- INIT_WORK(&dev->work, atp_reinit);
-
- return 0;
-diff -uNr linux-2.6.24/drivers/hid/hid-input.c linux-2.6.24-macbookair/drivers/hid/hid-input.c
---- linux-2.6.24/drivers/hid/hid-input.c 2008-01-24 23:58:37.000000000 +0100
-+++ linux-2.6.24-macbookair/drivers/hid/hid-input.c 2008-03-03 09:00:02.000000000 +0100
-@@ -119,6 +119,30 @@
- { }
- };
-
-+static struct hidinput_key_translation apple_keyboard_fn_keys[] = {
-+ { KEY_BACKSPACE, KEY_DELETE },
-+ { KEY_F1, KEY_BRIGHTNESSDOWN, POWERBOOK_FLAG_FKEY },
-+ { KEY_F2, KEY_BRIGHTNESSUP, POWERBOOK_FLAG_FKEY },
-+ { KEY_F3, KEY_CYCLEWINDOWS, POWERBOOK_FLAG_FKEY },
-+ { KEY_F4, KEY_CONFIG, POWERBOOK_FLAG_FKEY },
-+ { KEY_F7, KEY_PREVIOUSSONG, POWERBOOK_FLAG_FKEY },
-+ { KEY_F8, KEY_PLAYPAUSE, POWERBOOK_FLAG_FKEY },
-+ { KEY_F9, KEY_NEXTSONG, POWERBOOK_FLAG_FKEY },
-+ { KEY_F10, KEY_MUTE, POWERBOOK_FLAG_FKEY },
-+ { KEY_F11, KEY_VOLUMEDOWN, POWERBOOK_FLAG_FKEY },
-+ { KEY_F12, KEY_VOLUMEUP, POWERBOOK_FLAG_FKEY },
-+ { KEY_UP, KEY_PAGEUP },
-+ { KEY_DOWN, KEY_PAGEDOWN },
-+ { KEY_LEFT, KEY_HOME },
-+ { KEY_RIGHT, KEY_END },
-+ { }
-+};
-+
-+static struct hidinput_key_translation apple_keyboard[] = {
-+ { KEY_VOLUMEUP, KEY_EJECTCD },
-+ { }
-+};
-+
- static struct hidinput_key_translation powerbook_numlock_keys[] = {
- { KEY_J, KEY_KP1 },
- { KEY_K, KEY_KP2 },
-@@ -176,8 +200,10 @@
-
- if (hid_pb_fnmode) {
- int do_translate;
--
-- trans = find_translation(powerbook_fn_keys, usage->code);
-+ if (hid->quirks & HID_QUIRK_APPLE_KEYBOARD)
-+ trans = find_translation(apple_keyboard_fn_keys, usage->code);
-+ else
-+ trans = find_translation(powerbook_fn_keys, usage->code);
- if (trans) {
- if (test_bit(usage->code, hid->pb_pressed_fn))
- do_translate = 1;
-@@ -200,8 +226,8 @@
- }
- }
-
-- if (test_bit(usage->code, hid->pb_pressed_numlock) ||
-- test_bit(LED_NUML, input->led)) {
-+ if (!(hid->quirks & HID_QUIRK_APPLE_KEYBOARD) && (test_bit(usage->code, hid->pb_pressed_numlock) ||
-+ test_bit(LED_NUML, input->led))) {
- trans = find_translation(powerbook_numlock_keys, usage->code);
-
- if (trans) {
-@@ -217,6 +243,14 @@
- }
- }
-
-+ if (hid->quirks & HID_QUIRK_APPLE_KEYBOARD) {
-+ trans = find_translation(apple_keyboard, usage->code);
-+ if (trans) {
-+ input_event(input, usage->type, trans->to, value);
-+ return 1;
-+ }
-+ }
-+
- if (hid->quirks & HID_QUIRK_POWERBOOK_ISO_KEYBOARD) {
- trans = find_translation(powerbook_iso_keyboard, usage->code);
- if (trans) {
-@@ -241,6 +275,12 @@
- for (trans = powerbook_numlock_keys; trans->from; trans++)
- set_bit(trans->to, input->keybit);
-
-+ for (trans = apple_keyboard_fn_keys; trans->from; trans++)
-+ set_bit(trans->to, input->keybit);
-+
-+ for (trans = apple_keyboard; trans->from; trans++)
-+ set_bit(trans->to, input->keybit);
-+
- for (trans = powerbook_iso_keyboard; trans->from; trans++)
- set_bit(trans->to, input->keybit);
-
-diff -uNr linux-2.6.24/drivers/hid/usbhid/hid-quirks.c linux-2.6.24-macbookair/drivers/hid/usbhid/hid-quirks.c
---- linux-2.6.24/drivers/hid/usbhid/hid-quirks.c 2008-01-24 23:58:37.000000000 +0100
-+++ linux-2.6.24-macbookair/drivers/hid/usbhid/hid-quirks.c 2008-03-03 09:00:35.000000000 +0100
-@@ -59,6 +59,32 @@
- #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a
- #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b
- #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
-+
-+/* Apple 2007 Wired keyboards */
-+#define USB_DEVICE_ID_APPLE_KEYBOARD_ANSI 0x0220
-+#define USB_DEVICE_ID_APPLE_KEYBOARD_ISO 0x0221
-+#define USB_DEVICE_ID_APPLE_KEYBOARD_JIS 0x0222
-+
-+/* macbook3,1 keyboards */
-+#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229
-+#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a
-+#define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b
-+
-+/* Apple WellSpring keyboard + trackpad */
-+#define USB_PRODUCT_ID_WELLSPRING_ANSI 0x0223
-+#define USB_PRODUCT_ID_WELLSPRING_ISO 0x0224
-+#define USB_PRODUCT_ID_WELLSPRING_JIS 0x0225
-+
-+/* Apple WellSpring II keyboard + trackpad */
-+#define USB_PRODUCT_ID_WELLSPRING2_ANSI 0x0230
-+#define USB_PRODUCT_ID_WELLSPRING2_ISO 0x0231
-+#define USB_PRODUCT_ID_WELLSPRING2_JIS 0x0232
-+
-+/* Apple 2007 Wireless keyboards */
-+#define USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_ANSI 0x022c
-+#define USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_ISO 0x022d
-+#define USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_JIS 0x022e
-+
- #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
- #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
- #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
-@@ -551,6 +577,32 @@
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-+
-+ /* Apple 2007 Wired keyboards */
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_KEYBOARD_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_KEYBOARD_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_KEYBOARD_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
-+
-+ /* macbook3,1 keyboards */
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
-+
-+ /* Apple 2007 Wireless keyboards */
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WIRELESS_KEYBOARD_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_KEYBOARD},
-+
-+ /* Apple WellSpring keyboard + trackpad */
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+
-+ /* Apple WellSpring II keyboard + trackpad */
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-+ { USB_VENDOR_ID_APPLE, USB_PRODUCT_ID_WELLSPRING2_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_APPLE_KEYBOARD},
-+
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
- { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-
-diff -uNr linux-2.6.24/include/linux/hid.h linux-2.6.24-macbookair/include/linux/hid.h
---- linux-2.6.24/include/linux/hid.h 2008-01-24 23:58:37.000000000 +0100
-+++ linux-2.6.24-macbookair/include/linux/hid.h 2008-03-03 09:00:02.000000000 +0100
-@@ -281,6 +281,7 @@
- #define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
- #define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
- #define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
-+#define HID_QUIRK_APPLE_KEYBOARD 0x02000000
-
- /*
- * Separate quirks for runtime report descriptor fixup
diff --git a/patches/toshiba-bluetooth.patch b/patches/toshiba-bluetooth.patch
deleted file mode 100644
index 50752d8..0000000
--- a/patches/toshiba-bluetooth.patch
+++ /dev/null
@@ -1,241 +0,0 @@
---- linux-source-2.6.14.orig/drivers/acpi/toshiba_acpi.c 2005-10-28 02:02:08.000000000 +0200
-+++ linux-source-2.6.14/drivers/acpi/toshiba_acpi.c 2005-11-12 14:14:05.000000000 +0100
-@@ -33,7 +33,7 @@
- *
- */
-
--#define TOSHIBA_ACPI_VERSION "0.18"
-+#define TOSHIBA_ACPI_VERSION "0.18-p1"
- #define PROC_INTERFACE_VERSION 1
-
- #include <linux/kernel.h>
-@@ -209,6 +209,31 @@ static acpi_status hci_read1(u32 reg, u3
- return status;
- }
-
-+static acpi_status
-+hci_write2(u32 reg, u32 in1, u32 in2, u32* result)
-+{
-+ u32 in[HCI_WORDS] = { HCI_SET, reg, in1, in2, 0, 0 };
-+ u32 out[HCI_WORDS];
-+ acpi_status status = hci_raw(in, out);
-+ *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
-+ return status;
-+}
-+
-+static acpi_status
-+hci_read2(u32 reg, u32* out1, u32* out2, u32* result)
-+{
-+ u32 in[HCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 };
-+ u32 out[HCI_WORDS];
-+ acpi_status status = hci_raw(in, out);
-+ *out1 = out[2];
-+ *out2 = out[3];
-+ *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
-+ return status;
-+}
-+
-+
-+
-+
- static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ;
- static struct backlight_device *toshiba_backlight_device;
- static int force_fan;
-@@ -214,6 +214,7 @@
- static int force_fan;
- static int last_key_event;
- static int key_event_valid;
-+static int arbitrary, arbitrary2, arbitrary1;
-
- typedef struct _ProcItem {
- const char *name;
-@@ -455,6 +481,171 @@ static unsigned long write_keys(const ch
- return count;
- }
-
-+static char*
-+read_wk(char* p)
-+{
-+ u32 hci_result;
-+ u32 value, value2;
-+ value = 0;
-+ value2 = 0x0001;
-+ hci_read2(0x0056, &value, &value2, &hci_result);
-+ if (hci_result == HCI_SUCCESS) {
-+ p += sprintf(p,"wireless key: %d\n", value );
-+ } else {
-+ p += sprintf(p, "ERROR\n");
-+ }
-+
-+ return p;
-+}
-+
-+static char*
-+read_bt(char* p)
-+{
-+ u32 hci_result;
-+ u32 value, value2;
-+ value = 0;
-+ value2 = 0;
-+ hci_read2(0x0056, &value, &value2, &hci_result);
-+ if (hci_result == HCI_SUCCESS) {
-+/* p += sprintf(p,"present: %d\n", value);*/
-+ p += sprintf(p,"present: %d\n", (value & 0x0f)?1:0);
-+ } else {
-+ p += sprintf(p, "ERROR\n");
-+ }
-+ value = 0;
-+ value2 = 0x0001;
-+ hci_read2(0x0056, &value, &value2, &hci_result);
-+ if (hci_result == HCI_SUCCESS) {
-+ p += sprintf(p,"power: %d\n", (value & 128) >> 7);
-+ p += sprintf(p,"attach: %d\n", (value & 64) >> 6);
-+ p += sprintf(p,"wireless: %d\n", (value & 512) >> 9);
-+ } else {
-+ p += sprintf(p, "ERROR\n");
-+ }
-+
-+ return p;
-+}
-+
-+static unsigned long
-+write_bt(const char* buffer, unsigned long count)
-+{
-+ int value, value2;
-+ u32 hci_result;
-+ value2 = 0x0080;
-+
-+ if (sscanf(buffer, " power : %i", &value) == 1 &&
-+ value >= 0 && value <= 1) {
-+ hci_write2(0x0056, value, value2, &hci_result);
-+ if (hci_result != HCI_SUCCESS)
-+ return -EFAULT;
-+ } else
-+ if (sscanf(buffer, " attach : %i", &value) == 1 &&
-+ value >= 0 && value <= 1) {
-+ value2 = 0x0040;
-+ hci_write2(0x0056, value, value2, &hci_result);
-+ if (hci_result != HCI_SUCCESS)
-+ return -EFAULT;
-+ } else
-+ if (sscanf(buffer, " orinoco : %i", &value) == 1 &&
-+ value >= 0 && value <= 1) {
-+ value2 = 0x0200;
-+ hci_write2(0x0056, value, value2, &hci_result);
-+ if (hci_result != HCI_SUCCESS)
-+ return -EFAULT;
-+ } else {
-+ return -EINVAL;
-+ }
-+
-+ return count;
-+}
-+
-+static char*
-+read_arb(char* p)
-+{
-+ u32 hci_result;
-+ u32 value, value2;
-+ value = 0;
-+ value2 = arbitrary2;
-+ p += sprintf(p,"arg1 : %d\n", value );
-+ p += sprintf(p,"arg2 : %d\n", value2 );
-+ hci_read2(arbitrary, &value, &value2, &hci_result);
-+ if (hci_result == HCI_SUCCESS) {
-+ p += sprintf(p,"arbitrary call: %d\n", arbitrary);
-+
-+ p += sprintf(p,"return1: %x\n", value);
-+ p += sprintf(p,"return2: %x\n",value2);
-+ } else
-+ p += sprintf(p, "ERROR\n");
-+
-+ return p;
-+}
-+
-+static unsigned long
-+write_arb(const char* buffer, unsigned long count)
-+{
-+ int value, value2, i;
-+ u32 hci_result;
-+ value2 = 0x0080;
-+
-+ sscanf(buffer, " arb : %i", &value) ;
-+ arbitrary=value;
-+ i=0;
-+ while(buffer[i]!=';')i++;
-+ if (sscanf(buffer+i+1, " arb2 : %i", &value) == 1 )
-+ arbitrary2=value;
-+ else
-+ return -EINVAL;
-+
-+ return count;
-+}
-+
-+
-+static char*
-+read_arb_c(char* p)
-+{
-+ u32 hci_result;
-+ u32 value, value2;
-+
-+ value = arbitrary1;
-+ value2 = arbitrary2;
-+ p += sprintf(p,"arg1 : %d\n", value );
-+ p += sprintf(p,"arg2 : %d\n", value2 );
-+
-+ hci_write2(arbitrary, value, value2, &hci_result);
-+ if (hci_result == HCI_SUCCESS) {
-+ p += sprintf(p,"arbitrary call: %d\n", arbitrary);
-+ p += sprintf(p,"return1: %d\n", value);
-+ p += sprintf(p,"return2: %d\n",value2);
-+ } else
-+ p += sprintf(p, "ERROR\n");
-+
-+ return p;
-+}
-+
-+static unsigned long
-+write_arb_c(const char* buffer, unsigned long count)
-+{
-+ int value, value2, i;
-+ u32 hci_result;
-+ value2 = 0x0080;
-+
-+ sscanf(buffer, " arb : %i", &value) ;
-+ arbitrary=value;
-+ i=0;
-+ while(buffer[i]!=';')i++;
-+ sscanf(buffer+i+1, " arb2 : %i", &value);
-+ arbitrary2=value;
-+ i++;
-+ while(buffer[i]!=';')i++;
-+ if (sscanf(buffer+i+1, " arb1 : %i", &value) == 1 )
-+ arbitrary1=value;
-+ else
-+ return -EINVAL;
-+
-+ return count;
-+}
-+
-+
- static char *read_version(char *p)
- {
- p += sprintf(p, "driver: %s\n", TOSHIBA_ACPI_VERSION);
-@@ -474,6 +665,8 @@ static ProcItem proc_items[] = {
- {"fan", read_fan, write_fan},
- {"keys", read_keys, write_keys},
- {"version", read_version, NULL},
-+ { "wireless_key", read_wk , 0 },
-+ { "bluetooth" , read_bt , write_bt },
- {NULL}
- };
-
-@@ -484,7 +677,7 @@ static acpi_status __init add_device(voi
-
- for (item = proc_items; item->name; ++item) {
- proc = create_proc_read_entry(item->name,
-- S_IFREG | S_IRUGO | S_IWUSR,
-+ S_IFREG | S_IRUGO | S_IWUGO,
- toshiba_proc_dir,
- (read_proc_t *) dispatch_read,
- item);