aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-29 21:54:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-29 21:54:05 -0500
commitb7a8399edfd7ad3da36d51513ea30a4708b02b52 (patch)
tree5da5a480f020cefc4450ca679bf7d193fe82462f /drivers/platform
parent30c867eebfbd1c25310aec9f152578deaf793080 (diff)
parentb4b0b4a9e0392dbd00e5f033e1329ce61ed06fef (diff)
Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86
Pull x86 platform drivers update from Matthew Garrett: "Nothing amazingly special here. Some cleanups, a new driver to support a single button on some new HPs, a tiny amount of hardware enablement" * 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86: ipc: add intel-mid's pci id macros hp-wireless: new driver for hp wireless button for Windows 8 toshiba_acpi: Support RFKILL hotkey scancode hp_accel: Add a new PnP ID HPQ6007 for new HP laptops sony-laptop: remove unnecessary assigment of len fujitsu-laptop: fix error return code dell-laptop: Only install the i8042 filter when rfkill is active X86 platform: New BayTrail IOSF-SB MBI driver drivers: platform: Include appropriate header file in mxm-wmi.c drivers: platform: Mark functions as static in hp_accel.c dell-laptop: rkill whitelist Precision models ipc: simplify platform data approach asus-wmi: Convert to use devm_hwmon_device_register_with_groups compal-laptop: Use devm_hwmon_device_register_with_groups compal-laptop: Replace SENSOR_DEVICE_ATTR with DEVICE_ATTR eeepc-laptop: Convert to use devm_hwmon_device_register_with_groups compal-laptop: Use devm_kzalloc to allocate local data structure dell-laptop: fix to return error code in dell_send_intensity()
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/Kconfig19
-rw-r--r--drivers/platform/x86/Makefile2
-rw-r--r--drivers/platform/x86/asus-wmi.c48
-rw-r--r--drivers/platform/x86/compal-laptop.c121
-rw-r--r--drivers/platform/x86/dell-laptop.c78
-rw-r--r--drivers/platform/x86/eeepc-laptop.c52
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c15
-rw-r--r--drivers/platform/x86/hp-wireless.c132
-rw-r--r--drivers/platform/x86/hp_accel.c7
-rw-r--r--drivers/platform/x86/intel_baytrail.c224
-rw-r--r--drivers/platform/x86/intel_baytrail.h90
-rw-r--r--drivers/platform/x86/intel_scu_ipc.c87
-rw-r--r--drivers/platform/x86/mxm-wmi.c1
-rw-r--r--drivers/platform/x86/sony-laptop.c2
-rw-r--r--drivers/platform/x86/toshiba_acpi.c1
15 files changed, 642 insertions, 237 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index d9dcd37b5a52..5ae65c11d544 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -197,6 +197,17 @@ config HP_ACCEL
197 To compile this driver as a module, choose M here: the module will 197 To compile this driver as a module, choose M here: the module will
198 be called hp_accel. 198 be called hp_accel.
199 199
200config HP_WIRELESS
201 tristate "HP WIRELESS"
202 depends on ACPI
203 depends on INPUT
204 help
205 This driver provides supports for new HP wireless button for Windows 8.
206 On such systems the driver should load automatically (via ACPI alias).
207
208 To compile this driver as a module, choose M here: the module will
209 be called hp-wireless.
210
200config HP_WMI 211config HP_WMI
201 tristate "HP WMI extras" 212 tristate "HP WMI extras"
202 depends on ACPI_WMI 213 depends on ACPI_WMI
@@ -808,4 +819,12 @@ config PVPANIC
808 a paravirtualized device provided by QEMU; it lets a virtual machine 819 a paravirtualized device provided by QEMU; it lets a virtual machine
809 (guest) communicate panic events to the host. 820 (guest) communicate panic events to the host.
810 821
822config INTEL_BAYTRAIL_MBI
823 tristate
824 depends on PCI
825 ---help---
826 Needed on Baytrail platforms for access to the IOSF Sideband Mailbox
827 Interface. This is a requirement for systems that need to configure
828 the PUNIT for power management features such as RAPL.
829
811endif # X86_PLATFORM_DEVICES 830endif # X86_PLATFORM_DEVICES
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index f0e6aa407ffb..9b87cfc42b84 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o
16obj-$(CONFIG_ACER_WMI) += acer-wmi.o 16obj-$(CONFIG_ACER_WMI) += acer-wmi.o
17obj-$(CONFIG_ACERHDF) += acerhdf.o 17obj-$(CONFIG_ACERHDF) += acerhdf.o
18obj-$(CONFIG_HP_ACCEL) += hp_accel.o 18obj-$(CONFIG_HP_ACCEL) += hp_accel.o
19obj-$(CONFIG_HP_WIRELESS) += hp-wireless.o
19obj-$(CONFIG_HP_WMI) += hp-wmi.o 20obj-$(CONFIG_HP_WMI) += hp-wmi.o
20obj-$(CONFIG_AMILO_RFKILL) += amilo-rfkill.o 21obj-$(CONFIG_AMILO_RFKILL) += amilo-rfkill.o
21obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o 22obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o
@@ -54,3 +55,4 @@ obj-$(CONFIG_INTEL_RST) += intel-rst.o
54obj-$(CONFIG_INTEL_SMARTCONNECT) += intel-smartconnect.o 55obj-$(CONFIG_INTEL_SMARTCONNECT) += intel-smartconnect.o
55 56
56obj-$(CONFIG_PVPANIC) += pvpanic.o 57obj-$(CONFIG_PVPANIC) += pvpanic.o
58obj-$(CONFIG_INTEL_BAYTRAIL_MBI) += intel_baytrail.o
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 109f6383040c..c5e082fb82fa 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -183,7 +183,6 @@ struct asus_wmi {
183 183
184 struct input_dev *inputdev; 184 struct input_dev *inputdev;
185 struct backlight_device *backlight_device; 185 struct backlight_device *backlight_device;
186 struct device *hwmon_device;
187 struct platform_device *platform_device; 186 struct platform_device *platform_device;
188 187
189 struct led_classdev wlan_led; 188 struct led_classdev wlan_led;
@@ -1072,20 +1071,12 @@ static ssize_t asus_hwmon_temp1(struct device *dev,
1072 return sprintf(buf, "%d\n", value); 1071 return sprintf(buf, "%d\n", value);
1073} 1072}
1074 1073
1075static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO, asus_hwmon_pwm1, NULL, 0); 1074static DEVICE_ATTR(pwm1, S_IRUGO, asus_hwmon_pwm1, NULL);
1076static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL, 0); 1075static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL);
1077
1078static ssize_t
1079show_name(struct device *dev, struct device_attribute *attr, char *buf)
1080{
1081 return sprintf(buf, "asus\n");
1082}
1083static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
1084 1076
1085static struct attribute *hwmon_attributes[] = { 1077static struct attribute *hwmon_attributes[] = {
1086 &sensor_dev_attr_pwm1.dev_attr.attr, 1078 &dev_attr_pwm1.attr,
1087 &sensor_dev_attr_temp1_input.dev_attr.attr, 1079 &dev_attr_temp1_input.attr,
1088 &sensor_dev_attr_name.dev_attr.attr,
1089 NULL 1080 NULL
1090}; 1081};
1091 1082
@@ -1099,9 +1090,9 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
1099 int dev_id = -1; 1090 int dev_id = -1;
1100 u32 value = ASUS_WMI_UNSUPPORTED_METHOD; 1091 u32 value = ASUS_WMI_UNSUPPORTED_METHOD;
1101 1092
1102 if (attr == &sensor_dev_attr_pwm1.dev_attr.attr) 1093 if (attr == &dev_attr_pwm1.attr)
1103 dev_id = ASUS_WMI_DEVID_FAN_CTRL; 1094 dev_id = ASUS_WMI_DEVID_FAN_CTRL;
1104 else if (attr == &sensor_dev_attr_temp1_input.dev_attr.attr) 1095 else if (attr == &dev_attr_temp1_input.attr)
1105 dev_id = ASUS_WMI_DEVID_THERMAL_CTRL; 1096 dev_id = ASUS_WMI_DEVID_THERMAL_CTRL;
1106 1097
1107 if (dev_id != -1) { 1098 if (dev_id != -1) {
@@ -1136,35 +1127,20 @@ static struct attribute_group hwmon_attribute_group = {
1136 .is_visible = asus_hwmon_sysfs_is_visible, 1127 .is_visible = asus_hwmon_sysfs_is_visible,
1137 .attrs = hwmon_attributes 1128 .attrs = hwmon_attributes
1138}; 1129};
1139 1130__ATTRIBUTE_GROUPS(hwmon_attribute);
1140static void asus_wmi_hwmon_exit(struct asus_wmi *asus)
1141{
1142 struct device *hwmon;
1143
1144 hwmon = asus->hwmon_device;
1145 if (!hwmon)
1146 return;
1147 sysfs_remove_group(&hwmon->kobj, &hwmon_attribute_group);
1148 hwmon_device_unregister(hwmon);
1149 asus->hwmon_device = NULL;
1150}
1151 1131
1152static int asus_wmi_hwmon_init(struct asus_wmi *asus) 1132static int asus_wmi_hwmon_init(struct asus_wmi *asus)
1153{ 1133{
1154 struct device *hwmon; 1134 struct device *hwmon;
1155 int result;
1156 1135
1157 hwmon = hwmon_device_register(&asus->platform_device->dev); 1136 hwmon = hwmon_device_register_with_groups(&asus->platform_device->dev,
1137 "asus", asus,
1138 hwmon_attribute_groups);
1158 if (IS_ERR(hwmon)) { 1139 if (IS_ERR(hwmon)) {
1159 pr_err("Could not register asus hwmon device\n"); 1140 pr_err("Could not register asus hwmon device\n");
1160 return PTR_ERR(hwmon); 1141 return PTR_ERR(hwmon);
1161 } 1142 }
1162 dev_set_drvdata(hwmon, asus); 1143 return 0;
1163 asus->hwmon_device = hwmon;
1164 result = sysfs_create_group(&hwmon->kobj, &hwmon_attribute_group);
1165 if (result)
1166 asus_wmi_hwmon_exit(asus);
1167 return result;
1168} 1144}
1169 1145
1170/* 1146/*
@@ -1835,7 +1811,6 @@ fail_backlight:
1835fail_rfkill: 1811fail_rfkill:
1836 asus_wmi_led_exit(asus); 1812 asus_wmi_led_exit(asus);
1837fail_leds: 1813fail_leds:
1838 asus_wmi_hwmon_exit(asus);
1839fail_hwmon: 1814fail_hwmon:
1840 asus_wmi_input_exit(asus); 1815 asus_wmi_input_exit(asus);
1841fail_input: 1816fail_input:
@@ -1853,7 +1828,6 @@ static int asus_wmi_remove(struct platform_device *device)
1853 wmi_remove_notify_handler(asus->driver->event_guid); 1828 wmi_remove_notify_handler(asus->driver->event_guid);
1854 asus_wmi_backlight_exit(asus); 1829 asus_wmi_backlight_exit(asus);
1855 asus_wmi_input_exit(asus); 1830 asus_wmi_input_exit(asus);
1856 asus_wmi_hwmon_exit(asus);
1857 asus_wmi_led_exit(asus); 1831 asus_wmi_led_exit(asus);
1858 asus_wmi_rfkill_exit(asus); 1832 asus_wmi_rfkill_exit(asus);
1859 asus_wmi_debugfs_exit(asus); 1833 asus_wmi_debugfs_exit(asus);
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index eaa78edb1f4e..7297df2ebf50 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -173,8 +173,7 @@
173/* ======= */ 173/* ======= */
174struct compal_data{ 174struct compal_data{
175 /* Fan control */ 175 /* Fan control */
176 struct device *hwmon_dev; 176 int pwm_enable; /* 0:full on, 1:set by pwm1, 2:control by motherboard */
177 int pwm_enable; /* 0:full on, 1:set by pwm1, 2:control by moterboard */
178 unsigned char curr_pwm; 177 unsigned char curr_pwm;
179 178
180 /* Power supply */ 179 /* Power supply */
@@ -402,15 +401,6 @@ SIMPLE_MASKED_STORE_SHOW(wake_up_wlan, WAKE_UP_ADDR, WAKE_UP_WLAN)
402SIMPLE_MASKED_STORE_SHOW(wake_up_key, WAKE_UP_ADDR, WAKE_UP_KEY) 401SIMPLE_MASKED_STORE_SHOW(wake_up_key, WAKE_UP_ADDR, WAKE_UP_KEY)
403SIMPLE_MASKED_STORE_SHOW(wake_up_mouse, WAKE_UP_ADDR, WAKE_UP_MOUSE) 402SIMPLE_MASKED_STORE_SHOW(wake_up_mouse, WAKE_UP_ADDR, WAKE_UP_MOUSE)
404 403
405
406/* General hwmon interface */
407static ssize_t hwmon_name_show(struct device *dev,
408 struct device_attribute *attr, char *buf)
409{
410 return sprintf(buf, "%s\n", DRIVER_NAME);
411}
412
413
414/* Fan control interface */ 404/* Fan control interface */
415static ssize_t pwm_enable_show(struct device *dev, 405static ssize_t pwm_enable_show(struct device *dev,
416 struct device_attribute *attr, char *buf) 406 struct device_attribute *attr, char *buf)
@@ -665,55 +655,55 @@ static DEVICE_ATTR(wake_up_key,
665static DEVICE_ATTR(wake_up_mouse, 655static DEVICE_ATTR(wake_up_mouse,
666 0644, wake_up_mouse_show, wake_up_mouse_store); 656 0644, wake_up_mouse_show, wake_up_mouse_store);
667 657
668static SENSOR_DEVICE_ATTR(name, S_IRUGO, hwmon_name_show, NULL, 1); 658static DEVICE_ATTR(fan1_input, S_IRUGO, fan_show, NULL);
669static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, fan_show, NULL, 1); 659static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu, NULL);
670static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu, NULL, 1); 660static DEVICE_ATTR(temp2_input, S_IRUGO, temp_cpu_local, NULL);
671static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, temp_cpu_local, NULL, 1); 661static DEVICE_ATTR(temp3_input, S_IRUGO, temp_cpu_DTS, NULL);
672static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, temp_cpu_DTS, NULL, 1); 662static DEVICE_ATTR(temp4_input, S_IRUGO, temp_northbridge, NULL);
673static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, temp_northbridge, NULL, 1); 663static DEVICE_ATTR(temp5_input, S_IRUGO, temp_vga, NULL);
674static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, temp_vga, NULL, 1); 664static DEVICE_ATTR(temp6_input, S_IRUGO, temp_SKIN, NULL);
675static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, temp_SKIN, NULL, 1); 665static DEVICE_ATTR(temp1_label, S_IRUGO, label_cpu, NULL);
676static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, label_cpu, NULL, 1); 666static DEVICE_ATTR(temp2_label, S_IRUGO, label_cpu_local, NULL);
677static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, label_cpu_local, NULL, 1); 667static DEVICE_ATTR(temp3_label, S_IRUGO, label_cpu_DTS, NULL);
678static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, label_cpu_DTS, NULL, 1); 668static DEVICE_ATTR(temp4_label, S_IRUGO, label_northbridge, NULL);
679static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, label_northbridge, NULL, 1); 669static DEVICE_ATTR(temp5_label, S_IRUGO, label_vga, NULL);
680static SENSOR_DEVICE_ATTR(temp5_label, S_IRUGO, label_vga, NULL, 1); 670static DEVICE_ATTR(temp6_label, S_IRUGO, label_SKIN, NULL);
681static SENSOR_DEVICE_ATTR(temp6_label, S_IRUGO, label_SKIN, NULL, 1); 671static DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, pwm_show, pwm_store);
682static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, pwm_show, pwm_store, 1); 672static DEVICE_ATTR(pwm1_enable,
683static SENSOR_DEVICE_ATTR(pwm1_enable, 673 S_IRUGO | S_IWUSR, pwm_enable_show, pwm_enable_store);
684 S_IRUGO | S_IWUSR, pwm_enable_show, pwm_enable_store, 0); 674
685 675static struct attribute *compal_platform_attrs[] = {
686static struct attribute *compal_attributes[] = {
687 &dev_attr_wake_up_pme.attr, 676 &dev_attr_wake_up_pme.attr,
688 &dev_attr_wake_up_modem.attr, 677 &dev_attr_wake_up_modem.attr,
689 &dev_attr_wake_up_lan.attr, 678 &dev_attr_wake_up_lan.attr,
690 &dev_attr_wake_up_wlan.attr, 679 &dev_attr_wake_up_wlan.attr,
691 &dev_attr_wake_up_key.attr, 680 &dev_attr_wake_up_key.attr,
692 &dev_attr_wake_up_mouse.attr, 681 &dev_attr_wake_up_mouse.attr,
693 /* Maybe put the sensor-stuff in a separate hwmon-driver? That way,
694 * the hwmon sysfs won't be cluttered with the above files. */
695 &sensor_dev_attr_name.dev_attr.attr,
696 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
697 &sensor_dev_attr_pwm1.dev_attr.attr,
698 &sensor_dev_attr_fan1_input.dev_attr.attr,
699 &sensor_dev_attr_temp1_input.dev_attr.attr,
700 &sensor_dev_attr_temp2_input.dev_attr.attr,
701 &sensor_dev_attr_temp3_input.dev_attr.attr,
702 &sensor_dev_attr_temp4_input.dev_attr.attr,
703 &sensor_dev_attr_temp5_input.dev_attr.attr,
704 &sensor_dev_attr_temp6_input.dev_attr.attr,
705 &sensor_dev_attr_temp1_label.dev_attr.attr,
706 &sensor_dev_attr_temp2_label.dev_attr.attr,
707 &sensor_dev_attr_temp3_label.dev_attr.attr,
708 &sensor_dev_attr_temp4_label.dev_attr.attr,
709 &sensor_dev_attr_temp5_label.dev_attr.attr,
710 &sensor_dev_attr_temp6_label.dev_attr.attr,
711 NULL 682 NULL
712}; 683};
684static struct attribute_group compal_platform_attr_group = {
685 .attrs = compal_platform_attrs
686};
713 687
714static struct attribute_group compal_attribute_group = { 688static struct attribute *compal_hwmon_attrs[] = {
715 .attrs = compal_attributes 689 &dev_attr_pwm1_enable.attr,
690 &dev_attr_pwm1.attr,
691 &dev_attr_fan1_input.attr,
692 &dev_attr_temp1_input.attr,
693 &dev_attr_temp2_input.attr,
694 &dev_attr_temp3_input.attr,
695 &dev_attr_temp4_input.attr,
696 &dev_attr_temp5_input.attr,
697 &dev_attr_temp6_input.attr,
698 &dev_attr_temp1_label.attr,
699 &dev_attr_temp2_label.attr,
700 &dev_attr_temp3_label.attr,
701 &dev_attr_temp4_label.attr,
702 &dev_attr_temp5_label.attr,
703 &dev_attr_temp6_label.attr,
704 NULL
716}; 705};
706ATTRIBUTE_GROUPS(compal_hwmon);
717 707
718static int compal_probe(struct platform_device *); 708static int compal_probe(struct platform_device *);
719static int compal_remove(struct platform_device *); 709static int compal_remove(struct platform_device *);
@@ -1021,30 +1011,28 @@ static int compal_probe(struct platform_device *pdev)
1021{ 1011{
1022 int err; 1012 int err;
1023 struct compal_data *data; 1013 struct compal_data *data;
1014 struct device *hwmon_dev;
1024 1015
1025 if (!extra_features) 1016 if (!extra_features)
1026 return 0; 1017 return 0;
1027 1018
1028 /* Fan control */ 1019 /* Fan control */
1029 data = kzalloc(sizeof(struct compal_data), GFP_KERNEL); 1020 data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL);
1030 if (!data) 1021 if (!data)
1031 return -ENOMEM; 1022 return -ENOMEM;
1032 1023
1033 initialize_fan_control_data(data); 1024 initialize_fan_control_data(data);
1034 1025
1035 err = sysfs_create_group(&pdev->dev.kobj, &compal_attribute_group); 1026 err = sysfs_create_group(&pdev->dev.kobj, &compal_platform_attr_group);
1036 if (err) { 1027 if (err)
1037 kfree(data);
1038 return err; 1028 return err;
1039 }
1040 1029
1041 data->hwmon_dev = hwmon_device_register(&pdev->dev); 1030 hwmon_dev = hwmon_device_register_with_groups(&pdev->dev,
1042 if (IS_ERR(data->hwmon_dev)) { 1031 DRIVER_NAME, data,
1043 err = PTR_ERR(data->hwmon_dev); 1032 compal_hwmon_groups);
1044 sysfs_remove_group(&pdev->dev.kobj, 1033 if (IS_ERR(hwmon_dev)) {
1045 &compal_attribute_group); 1034 err = PTR_ERR(hwmon_dev);
1046 kfree(data); 1035 goto remove;
1047 return err;
1048 } 1036 }
1049 1037
1050 /* Power supply */ 1038 /* Power supply */
@@ -1054,6 +1042,10 @@ static int compal_probe(struct platform_device *pdev)
1054 platform_set_drvdata(pdev, data); 1042 platform_set_drvdata(pdev, data);
1055 1043
1056 return 0; 1044 return 0;
1045
1046remove:
1047 sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
1048 return err;
1057} 1049}
1058 1050
1059static void __exit compal_cleanup(void) 1051static void __exit compal_cleanup(void)
@@ -1080,12 +1072,9 @@ static int compal_remove(struct platform_device *pdev)
1080 pwm_disable_control(); 1072 pwm_disable_control();
1081 1073
1082 data = platform_get_drvdata(pdev); 1074 data = platform_get_drvdata(pdev);
1083 hwmon_device_unregister(data->hwmon_dev);
1084 power_supply_unregister(&data->psy); 1075 power_supply_unregister(&data->psy);
1085 1076
1086 kfree(data); 1077 sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
1087
1088 sysfs_remove_group(&pdev->dev.kobj, &compal_attribute_group);
1089 1078
1090 return 0; 1079 return 0;
1091} 1080}
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index c608b1d33f4a..fed4111ac31a 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -559,19 +559,45 @@ static void dell_update_rfkill(struct work_struct *ignored)
559} 559}
560static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); 560static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill);
561 561
562static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
563 struct serio *port)
564{
565 static bool extended;
566
567 if (str & 0x20)
568 return false;
569
570 if (unlikely(data == 0xe0)) {
571 extended = true;
572 return false;
573 } else if (unlikely(extended)) {
574 switch (data) {
575 case 0x8:
576 schedule_delayed_work(&dell_rfkill_work,
577 round_jiffies_relative(HZ / 4));
578 break;
579 }
580 extended = false;
581 }
582
583 return false;
584}
562 585
563static int __init dell_setup_rfkill(void) 586static int __init dell_setup_rfkill(void)
564{ 587{
565 int status; 588 int status, ret, whitelisted;
566 int ret;
567 const char *product; 589 const char *product;
568 590
569 /* 591 /*
570 * rfkill causes trouble on various non Latitudes, according to Dell 592 * rfkill support causes trouble on various models, mostly Inspirons.
571 * actually testing the rfkill functionality is only done on Latitudes. 593 * So we whitelist certain series, and don't support rfkill on others.
572 */ 594 */
595 whitelisted = 0;
573 product = dmi_get_system_info(DMI_PRODUCT_NAME); 596 product = dmi_get_system_info(DMI_PRODUCT_NAME);
574 if (!force_rfkill && (!product || strncmp(product, "Latitude", 8))) 597 if (product && (strncmp(product, "Latitude", 8) == 0 ||
598 strncmp(product, "Precision", 9) == 0))
599 whitelisted = 1;
600 if (!force_rfkill && !whitelisted)
575 return 0; 601 return 0;
576 602
577 get_buffer(); 603 get_buffer();
@@ -633,7 +659,16 @@ static int __init dell_setup_rfkill(void)
633 goto err_wwan; 659 goto err_wwan;
634 } 660 }
635 661
662 ret = i8042_install_filter(dell_laptop_i8042_filter);
663 if (ret) {
664 pr_warn("Unable to install key filter\n");
665 goto err_filter;
666 }
667
636 return 0; 668 return 0;
669err_filter:
670 if (wwan_rfkill)
671 rfkill_unregister(wwan_rfkill);
637err_wwan: 672err_wwan:
638 rfkill_destroy(wwan_rfkill); 673 rfkill_destroy(wwan_rfkill);
639 if (bluetooth_rfkill) 674 if (bluetooth_rfkill)
@@ -684,7 +719,7 @@ static int dell_send_intensity(struct backlight_device *bd)
684 719
685out: 720out:
686 release_buffer(); 721 release_buffer();
687 return 0; 722 return ret;
688} 723}
689 724
690static int dell_get_intensity(struct backlight_device *bd) 725static int dell_get_intensity(struct backlight_device *bd)
@@ -755,30 +790,6 @@ static void touchpad_led_exit(void)
755 led_classdev_unregister(&touchpad_led); 790 led_classdev_unregister(&touchpad_led);
756} 791}
757 792
758static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
759 struct serio *port)
760{
761 static bool extended;
762
763 if (str & 0x20)
764 return false;
765
766 if (unlikely(data == 0xe0)) {
767 extended = true;
768 return false;
769 } else if (unlikely(extended)) {
770 switch (data) {
771 case 0x8:
772 schedule_delayed_work(&dell_rfkill_work,
773 round_jiffies_relative(HZ / 4));
774 break;
775 }
776 extended = false;
777 }
778
779 return false;
780}
781
782static int __init dell_init(void) 793static int __init dell_init(void)
783{ 794{
784 int max_intensity = 0; 795 int max_intensity = 0;
@@ -828,12 +839,6 @@ static int __init dell_init(void)
828 goto fail_rfkill; 839 goto fail_rfkill;
829 } 840 }
830 841
831 ret = i8042_install_filter(dell_laptop_i8042_filter);
832 if (ret) {
833 pr_warn("Unable to install key filter\n");
834 goto fail_filter;
835 }
836
837 if (quirks && quirks->touchpad_led) 842 if (quirks && quirks->touchpad_led)
838 touchpad_led_init(&platform_device->dev); 843 touchpad_led_init(&platform_device->dev);
839 844
@@ -885,7 +890,6 @@ static int __init dell_init(void)
885fail_backlight: 890fail_backlight:
886 i8042_remove_filter(dell_laptop_i8042_filter); 891 i8042_remove_filter(dell_laptop_i8042_filter);
887 cancel_delayed_work_sync(&dell_rfkill_work); 892 cancel_delayed_work_sync(&dell_rfkill_work);
888fail_filter:
889 dell_cleanup_rfkill(); 893 dell_cleanup_rfkill();
890fail_rfkill: 894fail_rfkill:
891 free_page((unsigned long)bufferpage); 895 free_page((unsigned long)bufferpage);
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index ed69ec5f36f7..399e8c562192 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -165,7 +165,6 @@ struct eeepc_laptop {
165 165
166 struct platform_device *platform_device; 166 struct platform_device *platform_device;
167 struct acpi_device *device; /* the device we are in */ 167 struct acpi_device *device; /* the device we are in */
168 struct device *hwmon_device;
169 struct backlight_device *backlight_device; 168 struct backlight_device *backlight_device;
170 169
171 struct input_dev *inputdev; 170 struct input_dev *inputdev;
@@ -1068,7 +1067,7 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf)
1068 { \ 1067 { \
1069 return store_sys_hwmon(_get, buf, count); \ 1068 return store_sys_hwmon(_get, buf, count); \
1070 } \ 1069 } \
1071 static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0); 1070 static DEVICE_ATTR(_name, _mode, show_##_name, store_##_name);
1072 1071
1073EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); 1072EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL);
1074EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, 1073EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR,
@@ -1076,55 +1075,26 @@ EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR,
1076EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, 1075EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
1077 eeepc_get_fan_ctrl, eeepc_set_fan_ctrl); 1076 eeepc_get_fan_ctrl, eeepc_set_fan_ctrl);
1078 1077
1079static ssize_t 1078static struct attribute *hwmon_attrs[] = {
1080show_name(struct device *dev, struct device_attribute *attr, char *buf) 1079 &dev_attr_pwm1.attr,
1081{ 1080 &dev_attr_fan1_input.attr,
1082 return sprintf(buf, "eeepc\n"); 1081 &dev_attr_pwm1_enable.attr,
1083}
1084static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
1085
1086static struct attribute *hwmon_attributes[] = {
1087 &sensor_dev_attr_pwm1.dev_attr.attr,
1088 &sensor_dev_attr_fan1_input.dev_attr.attr,
1089 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
1090 &sensor_dev_attr_name.dev_attr.attr,
1091 NULL 1082 NULL
1092}; 1083};
1093 1084ATTRIBUTE_GROUPS(hwmon);
1094static struct attribute_group hwmon_attribute_group = {
1095 .attrs = hwmon_attributes
1096};
1097
1098static void eeepc_hwmon_exit(struct eeepc_laptop *eeepc)
1099{
1100 struct device *hwmon;
1101
1102 hwmon = eeepc->hwmon_device;
1103 if (!hwmon)
1104 return;
1105 sysfs_remove_group(&hwmon->kobj,
1106 &hwmon_attribute_group);
1107 hwmon_device_unregister(hwmon);
1108 eeepc->hwmon_device = NULL;
1109}
1110 1085
1111static int eeepc_hwmon_init(struct eeepc_laptop *eeepc) 1086static int eeepc_hwmon_init(struct eeepc_laptop *eeepc)
1112{ 1087{
1088 struct device *dev = &eeepc->platform_device->dev;
1113 struct device *hwmon; 1089 struct device *hwmon;
1114 int result;
1115 1090
1116 hwmon = hwmon_device_register(&eeepc->platform_device->dev); 1091 hwmon = devm_hwmon_device_register_with_groups(dev, "eeepc", NULL,
1092 hwmon_groups);
1117 if (IS_ERR(hwmon)) { 1093 if (IS_ERR(hwmon)) {
1118 pr_err("Could not register eeepc hwmon device\n"); 1094 pr_err("Could not register eeepc hwmon device\n");
1119 eeepc->hwmon_device = NULL;
1120 return PTR_ERR(hwmon); 1095 return PTR_ERR(hwmon);
1121 } 1096 }
1122 eeepc->hwmon_device = hwmon; 1097 return 0;
1123 result = sysfs_create_group(&hwmon->kobj,
1124 &hwmon_attribute_group);
1125 if (result)
1126 eeepc_hwmon_exit(eeepc);
1127 return result;
1128} 1098}
1129 1099
1130/* 1100/*
@@ -1480,7 +1450,6 @@ static int eeepc_acpi_add(struct acpi_device *device)
1480fail_rfkill: 1450fail_rfkill:
1481 eeepc_led_exit(eeepc); 1451 eeepc_led_exit(eeepc);
1482fail_led: 1452fail_led:
1483 eeepc_hwmon_exit(eeepc);
1484fail_hwmon: 1453fail_hwmon:
1485 eeepc_input_exit(eeepc); 1454 eeepc_input_exit(eeepc);
1486fail_input: 1455fail_input:
@@ -1500,7 +1469,6 @@ static int eeepc_acpi_remove(struct acpi_device *device)
1500 eeepc_backlight_exit(eeepc); 1469 eeepc_backlight_exit(eeepc);
1501 eeepc_rfkill_exit(eeepc); 1470 eeepc_rfkill_exit(eeepc);
1502 eeepc_input_exit(eeepc); 1471 eeepc_input_exit(eeepc);
1503 eeepc_hwmon_exit(eeepc);
1504 eeepc_led_exit(eeepc); 1472 eeepc_led_exit(eeepc);
1505 eeepc_platform_exit(eeepc); 1473 eeepc_platform_exit(eeepc);
1506 1474
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 9d30d69aa78f..be02bcc346d3 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -633,7 +633,6 @@ static struct dmi_system_id fujitsu_dmi_table[] = {
633 633
634static int acpi_fujitsu_add(struct acpi_device *device) 634static int acpi_fujitsu_add(struct acpi_device *device)
635{ 635{
636 int result = 0;
637 int state = 0; 636 int state = 0;
638 struct input_dev *input; 637 struct input_dev *input;
639 int error; 638 int error;
@@ -669,8 +668,8 @@ static int acpi_fujitsu_add(struct acpi_device *device)
669 if (error) 668 if (error)
670 goto err_free_input_dev; 669 goto err_free_input_dev;
671 670
672 result = acpi_bus_update_power(fujitsu->acpi_handle, &state); 671 error = acpi_bus_update_power(fujitsu->acpi_handle, &state);
673 if (result) { 672 if (error) {
674 pr_err("Error reading power state\n"); 673 pr_err("Error reading power state\n");
675 goto err_unregister_input_dev; 674 goto err_unregister_input_dev;
676 } 675 }
@@ -700,7 +699,7 @@ static int acpi_fujitsu_add(struct acpi_device *device)
700 fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS; 699 fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS;
701 get_lcd_level(); 700 get_lcd_level();
702 701
703 return result; 702 return 0;
704 703
705err_unregister_input_dev: 704err_unregister_input_dev:
706 input_unregister_device(input); 705 input_unregister_device(input);
@@ -708,7 +707,7 @@ err_unregister_input_dev:
708err_free_input_dev: 707err_free_input_dev:
709 input_free_device(input); 708 input_free_device(input);
710err_stop: 709err_stop:
711 return result; 710 return error;
712} 711}
713 712
714static int acpi_fujitsu_remove(struct acpi_device *device) 713static int acpi_fujitsu_remove(struct acpi_device *device)
@@ -831,8 +830,8 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
831 if (error) 830 if (error)
832 goto err_free_input_dev; 831 goto err_free_input_dev;
833 832
834 result = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state); 833 error = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state);
835 if (result) { 834 if (error) {
836 pr_err("Error reading power state\n"); 835 pr_err("Error reading power state\n");
837 goto err_unregister_input_dev; 836 goto err_unregister_input_dev;
838 } 837 }
@@ -907,7 +906,7 @@ err_free_input_dev:
907err_free_fifo: 906err_free_fifo:
908 kfifo_free(&fujitsu_hotkey->fifo); 907 kfifo_free(&fujitsu_hotkey->fifo);
909err_stop: 908err_stop:
910 return result; 909 return error;
911} 910}
912 911
913static int acpi_fujitsu_hotkey_remove(struct acpi_device *device) 912static int acpi_fujitsu_hotkey_remove(struct acpi_device *device)
diff --git a/drivers/platform/x86/hp-wireless.c b/drivers/platform/x86/hp-wireless.c
new file mode 100644
index 000000000000..415348fc1210
--- /dev/null
+++ b/drivers/platform/x86/hp-wireless.c
@@ -0,0 +1,132 @@
1/*
2 * hp-wireless button for Windows 8
3 *
4 * Copyright (C) 2014 Alex Hung <alex.hung@canonical.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/input.h>
25#include <linux/platform_device.h>
26#include <linux/acpi.h>
27#include <acpi/acpi_bus.h>
28
29MODULE_LICENSE("GPL");
30MODULE_AUTHOR("Alex Hung");
31MODULE_ALIAS("acpi*:HPQ6001:*");
32
33static struct input_dev *hpwl_input_dev;
34
35static const struct acpi_device_id hpwl_ids[] = {
36 {"HPQ6001", 0},
37 {"", 0},
38};
39
40static int hp_wireless_input_setup(void)
41{
42 int err;
43
44 hpwl_input_dev = input_allocate_device();
45 if (!hpwl_input_dev)
46 return -ENOMEM;
47
48 hpwl_input_dev->name = "HP Wireless hotkeys";
49 hpwl_input_dev->phys = "hpq6001/input0";
50 hpwl_input_dev->id.bustype = BUS_HOST;
51 hpwl_input_dev->evbit[0] = BIT(EV_KEY);
52 set_bit(KEY_RFKILL, hpwl_input_dev->keybit);
53
54 err = input_register_device(hpwl_input_dev);
55 if (err)
56 goto err_free_dev;
57
58 return 0;
59
60err_free_dev:
61 input_free_device(hpwl_input_dev);
62 return err;
63}
64
65static void hp_wireless_input_destroy(void)
66{
67 input_unregister_device(hpwl_input_dev);
68}
69
70static void hpwl_notify(struct acpi_device *acpi_dev, u32 event)
71{
72 if (event != 0x80) {
73 pr_info("Received unknown event (0x%x)\n", event);
74 return;
75 }
76
77 input_report_key(hpwl_input_dev, KEY_RFKILL, 1);
78 input_sync(hpwl_input_dev);
79 input_report_key(hpwl_input_dev, KEY_RFKILL, 0);
80 input_sync(hpwl_input_dev);
81}
82
83static int hpwl_add(struct acpi_device *device)
84{
85 int err;
86
87 err = hp_wireless_input_setup();
88 return err;
89}
90
91static int hpwl_remove(struct acpi_device *device)
92{
93 hp_wireless_input_destroy();
94 return 0;
95}
96
97static struct acpi_driver hpwl_driver = {
98 .name = "hp-wireless",
99 .owner = THIS_MODULE,
100 .ids = hpwl_ids,
101 .ops = {
102 .add = hpwl_add,
103 .remove = hpwl_remove,
104 .notify = hpwl_notify,
105 },
106};
107
108static int __init hpwl_init(void)
109{
110 int err;
111
112 pr_info("Initializing HPQ6001 module\n");
113 err = acpi_bus_register_driver(&hpwl_driver);
114 if (err) {
115 pr_err("Unable to register HP wireless control driver.\n");
116 goto error_acpi_register;
117 }
118
119 return 0;
120
121error_acpi_register:
122 return err;
123}
124
125static void __exit hpwl_exit(void)
126{
127 pr_info("Exiting HPQ6001 module\n");
128 acpi_bus_unregister_driver(&hpwl_driver);
129}
130
131module_init(hpwl_init);
132module_exit(hpwl_exit);
diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
index aff4d0670edf..3dc934438c28 100644
--- a/drivers/platform/x86/hp_accel.c
+++ b/drivers/platform/x86/hp_accel.c
@@ -77,6 +77,7 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev,
77static struct acpi_device_id lis3lv02d_device_ids[] = { 77static struct acpi_device_id lis3lv02d_device_ids[] = {
78 {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ 78 {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */
79 {"HPQ6000", 0}, /* HP Mobile Data Protection System PNP */ 79 {"HPQ6000", 0}, /* HP Mobile Data Protection System PNP */
80 {"HPQ6007", 0}, /* HP Mobile Data Protection System PNP */
80 {"", 0}, 81 {"", 0},
81}; 82};
82MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids); 83MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids);
@@ -88,7 +89,7 @@ MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids);
88 * 89 *
89 * Returns 0 on success. 90 * Returns 0 on success.
90 */ 91 */
91int lis3lv02d_acpi_init(struct lis3lv02d *lis3) 92static int lis3lv02d_acpi_init(struct lis3lv02d *lis3)
92{ 93{
93 struct acpi_device *dev = lis3->bus_priv; 94 struct acpi_device *dev = lis3->bus_priv;
94 if (acpi_evaluate_object(dev->handle, METHOD_NAME__INI, 95 if (acpi_evaluate_object(dev->handle, METHOD_NAME__INI,
@@ -106,7 +107,7 @@ int lis3lv02d_acpi_init(struct lis3lv02d *lis3)
106 * 107 *
107 * Returns 0 on success. 108 * Returns 0 on success.
108 */ 109 */
109int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret) 110static int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret)
110{ 111{
111 struct acpi_device *dev = lis3->bus_priv; 112 struct acpi_device *dev = lis3->bus_priv;
112 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 113 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
@@ -129,7 +130,7 @@ int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret)
129 * 130 *
130 * Returns 0 on success. 131 * Returns 0 on success.
131 */ 132 */
132int lis3lv02d_acpi_write(struct lis3lv02d *lis3, int reg, u8 val) 133static int lis3lv02d_acpi_write(struct lis3lv02d *lis3, int reg, u8 val)
133{ 134{
134 struct acpi_device *dev = lis3->bus_priv; 135 struct acpi_device *dev = lis3->bus_priv;
135 unsigned long long ret; /* Not used when writting */ 136 unsigned long long ret; /* Not used when writting */
diff --git a/drivers/platform/x86/intel_baytrail.c b/drivers/platform/x86/intel_baytrail.c
new file mode 100644
index 000000000000..f96626b17260
--- /dev/null
+++ b/drivers/platform/x86/intel_baytrail.c
@@ -0,0 +1,224 @@
1/*
2 * Baytrail IOSF-SB MailBox Interface Driver
3 * Copyright (c) 2013, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 *
15 * The IOSF-SB is a fabric bus available on Atom based SOC's that uses a
16 * mailbox interface (MBI) to communicate with mutiple devices. This
17 * driver implements BayTrail-specific access to this interface.
18 */
19
20#include <linux/module.h>
21#include <linux/init.h>
22#include <linux/spinlock.h>
23#include <linux/pci.h>
24
25#include "intel_baytrail.h"
26
27static DEFINE_SPINLOCK(iosf_mbi_lock);
28
29static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset)
30{
31 return (op << 24) | (port << 16) | (offset << 8) | BT_MBI_ENABLE;
32}
33
34static struct pci_dev *mbi_pdev; /* one mbi device */
35
36/* Hold lock before calling */
37static int iosf_mbi_pci_read_mdr(u32 mcrx, u32 mcr, u32 *mdr)
38{
39 int result;
40
41 if (!mbi_pdev)
42 return -ENODEV;
43
44 if (mcrx) {
45 result = pci_write_config_dword(mbi_pdev,
46 BT_MBI_MCRX_OFFSET, mcrx);
47 if (result < 0)
48 goto iosf_mbi_read_err;
49 }
50
51 result = pci_write_config_dword(mbi_pdev,
52 BT_MBI_MCR_OFFSET, mcr);
53 if (result < 0)
54 goto iosf_mbi_read_err;
55
56 result = pci_read_config_dword(mbi_pdev,
57 BT_MBI_MDR_OFFSET, mdr);
58 if (result < 0)
59 goto iosf_mbi_read_err;
60
61 return 0;
62
63iosf_mbi_read_err:
64 dev_err(&mbi_pdev->dev, "error: PCI config operation returned %d\n",
65 result);
66 return result;
67}
68
69/* Hold lock before calling */
70static int iosf_mbi_pci_write_mdr(u32 mcrx, u32 mcr, u32 mdr)
71{
72 int result;
73
74 if (!mbi_pdev)
75 return -ENODEV;
76
77 result = pci_write_config_dword(mbi_pdev,
78 BT_MBI_MDR_OFFSET, mdr);
79 if (result < 0)
80 goto iosf_mbi_write_err;
81
82 if (mcrx) {
83 result = pci_write_config_dword(mbi_pdev,
84 BT_MBI_MCRX_OFFSET, mcrx);
85 if (result < 0)
86 goto iosf_mbi_write_err;
87 }
88
89 result = pci_write_config_dword(mbi_pdev,
90 BT_MBI_MCR_OFFSET, mcr);
91 if (result < 0)
92 goto iosf_mbi_write_err;
93
94 return 0;
95
96iosf_mbi_write_err:
97 dev_err(&mbi_pdev->dev, "error: PCI config operation returned %d\n",
98 result);
99 return result;
100}
101
102int bt_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr)
103{
104 u32 mcr, mcrx;
105 unsigned long flags;
106 int ret;
107
108 /*Access to the GFX unit is handled by GPU code */
109 BUG_ON(port == BT_MBI_UNIT_GFX);
110
111 mcr = iosf_mbi_form_mcr(opcode, port, offset & BT_MBI_MASK_LO);
112 mcrx = offset & BT_MBI_MASK_HI;
113
114 spin_lock_irqsave(&iosf_mbi_lock, flags);
115 ret = iosf_mbi_pci_read_mdr(mcrx, mcr, mdr);
116 spin_unlock_irqrestore(&iosf_mbi_lock, flags);
117
118 return ret;
119}
120EXPORT_SYMBOL(bt_mbi_read);
121
122int bt_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr)
123{
124 u32 mcr, mcrx;
125 unsigned long flags;
126 int ret;
127
128 /*Access to the GFX unit is handled by GPU code */
129 BUG_ON(port == BT_MBI_UNIT_GFX);
130
131 mcr = iosf_mbi_form_mcr(opcode, port, offset & BT_MBI_MASK_LO);
132 mcrx = offset & BT_MBI_MASK_HI;
133
134 spin_lock_irqsave(&iosf_mbi_lock, flags);
135 ret = iosf_mbi_pci_write_mdr(mcrx, mcr, mdr);
136 spin_unlock_irqrestore(&iosf_mbi_lock, flags);
137
138 return ret;
139}
140EXPORT_SYMBOL(bt_mbi_write);
141
142int bt_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)
143{
144 u32 mcr, mcrx;
145 u32 value;
146 unsigned long flags;
147 int ret;
148
149 /*Access to the GFX unit is handled by GPU code */
150 BUG_ON(port == BT_MBI_UNIT_GFX);
151
152 mcr = iosf_mbi_form_mcr(opcode, port, offset & BT_MBI_MASK_LO);
153 mcrx = offset & BT_MBI_MASK_HI;
154
155 spin_lock_irqsave(&iosf_mbi_lock, flags);
156
157 /* Read current mdr value */
158 ret = iosf_mbi_pci_read_mdr(mcrx, mcr & BT_MBI_RD_MASK, &value);
159 if (ret < 0) {
160 spin_unlock_irqrestore(&iosf_mbi_lock, flags);
161 return ret;
162 }
163
164 /* Apply mask */
165 value &= ~mask;
166 mdr &= mask;
167 value |= mdr;
168
169 /* Write back */
170 ret = iosf_mbi_pci_write_mdr(mcrx, mcr | BT_MBI_WR_MASK, value);
171
172 spin_unlock_irqrestore(&iosf_mbi_lock, flags);
173
174 return ret;
175}
176EXPORT_SYMBOL(bt_mbi_modify);
177
178static int iosf_mbi_probe(struct pci_dev *pdev,
179 const struct pci_device_id *unused)
180{
181 int ret;
182
183 ret = pci_enable_device(pdev);
184 if (ret < 0) {
185 dev_err(&pdev->dev, "error: could not enable device\n");
186 return ret;
187 }
188
189 mbi_pdev = pci_dev_get(pdev);
190 return 0;
191}
192
193static DEFINE_PCI_DEVICE_TABLE(iosf_mbi_pci_ids) = {
194 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0F00) },
195 { 0, },
196};
197MODULE_DEVICE_TABLE(pci, iosf_mbi_pci_ids);
198
199static struct pci_driver iosf_mbi_pci_driver = {
200 .name = "iosf_mbi_pci",
201 .probe = iosf_mbi_probe,
202 .id_table = iosf_mbi_pci_ids,
203};
204
205static int __init bt_mbi_init(void)
206{
207 return pci_register_driver(&iosf_mbi_pci_driver);
208}
209
210static void __exit bt_mbi_exit(void)
211{
212 pci_unregister_driver(&iosf_mbi_pci_driver);
213 if (mbi_pdev) {
214 pci_dev_put(mbi_pdev);
215 mbi_pdev = NULL;
216 }
217}
218
219module_init(bt_mbi_init);
220module_exit(bt_mbi_exit);
221
222MODULE_AUTHOR("David E. Box <david.e.box@linux.intel.com>");
223MODULE_DESCRIPTION("BayTrail Mailbox Interface accessor");
224MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_baytrail.h b/drivers/platform/x86/intel_baytrail.h
new file mode 100644
index 000000000000..8bcc311262e9
--- /dev/null
+++ b/drivers/platform/x86/intel_baytrail.h
@@ -0,0 +1,90 @@
1/*
2 * intel_baytrail.h: MailBox access support for Intel BayTrail platforms
3 */
4
5#ifndef INTEL_BAYTRAIL_MBI_SYMS_H
6#define INTEL_BAYTRAIL_MBI_SYMS_H
7
8#define BT_MBI_MCR_OFFSET 0xD0
9#define BT_MBI_MDR_OFFSET 0xD4
10#define BT_MBI_MCRX_OFFSET 0xD8
11
12#define BT_MBI_RD_MASK 0xFEFFFFFF
13#define BT_MBI_WR_MASK 0X01000000
14
15#define BT_MBI_MASK_HI 0xFFFFFF00
16#define BT_MBI_MASK_LO 0x000000FF
17#define BT_MBI_ENABLE 0xF0
18
19/* BT-SB unit access methods */
20#define BT_MBI_UNIT_AUNIT 0x00
21#define BT_MBI_UNIT_SMC 0x01
22#define BT_MBI_UNIT_CPU 0x02
23#define BT_MBI_UNIT_BUNIT 0x03
24#define BT_MBI_UNIT_PMC 0x04
25#define BT_MBI_UNIT_GFX 0x06
26#define BT_MBI_UNIT_SMI 0x0C
27#define BT_MBI_UNIT_USB 0x43
28#define BT_MBI_UNIT_SATA 0xA3
29#define BT_MBI_UNIT_PCIE 0xA6
30
31/* Read/write opcodes */
32#define BT_MBI_AUNIT_READ 0x10
33#define BT_MBI_AUNIT_WRITE 0x11
34#define BT_MBI_SMC_READ 0x10
35#define BT_MBI_SMC_WRITE 0x11
36#define BT_MBI_CPU_READ 0x10
37#define BT_MBI_CPU_WRITE 0x11
38#define BT_MBI_BUNIT_READ 0x10
39#define BT_MBI_BUNIT_WRITE 0x11
40#define BT_MBI_PMC_READ 0x06
41#define BT_MBI_PMC_WRITE 0x07
42#define BT_MBI_GFX_READ 0x00
43#define BT_MBI_GFX_WRITE 0x01
44#define BT_MBI_SMIO_READ 0x06
45#define BT_MBI_SMIO_WRITE 0x07
46#define BT_MBI_USB_READ 0x06
47#define BT_MBI_USB_WRITE 0x07
48#define BT_MBI_SATA_READ 0x00
49#define BT_MBI_SATA_WRITE 0x01
50#define BT_MBI_PCIE_READ 0x00
51#define BT_MBI_PCIE_WRITE 0x01
52
53/**
54 * bt_mbi_read() - MailBox Interface read command
55 * @port: port indicating subunit being accessed
56 * @opcode: port specific read or write opcode
57 * @offset: register address offset
58 * @mdr: register data to be read
59 *
60 * Locking is handled by spinlock - cannot sleep.
61 * Return: Nonzero on error
62 */
63int bt_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr);
64
65/**
66 * bt_mbi_write() - MailBox unmasked write command
67 * @port: port indicating subunit being accessed
68 * @opcode: port specific read or write opcode
69 * @offset: register address offset
70 * @mdr: register data to be written
71 *
72 * Locking is handled by spinlock - cannot sleep.
73 * Return: Nonzero on error
74 */
75int bt_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);
76
77/**
78 * bt_mbi_modify() - MailBox masked write command
79 * @port: port indicating subunit being accessed
80 * @opcode: port specific read or write opcode
81 * @offset: register address offset
82 * @mdr: register data being modified
83 * @mask: mask indicating bits in mdr to be modified
84 *
85 * Locking is handled by spinlock - cannot sleep.
86 * Return: Nonzero on error
87 */
88int bt_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
89
90#endif /* INTEL_BAYTRAIL_MBI_SYMS_H */
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index 60ea476a9130..76ca094ed012 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -62,12 +62,10 @@
62#define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */ 62#define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */
63#define IPC_IOC 0x100 /* IPC command register IOC bit */ 63#define IPC_IOC 0x100 /* IPC command register IOC bit */
64 64
65enum { 65#define PCI_DEVICE_ID_LINCROFT 0x082a
66 SCU_IPC_LINCROFT, 66#define PCI_DEVICE_ID_PENWELL 0x080e
67 SCU_IPC_PENWELL, 67#define PCI_DEVICE_ID_CLOVERVIEW 0x08ea
68 SCU_IPC_CLOVERVIEW, 68#define PCI_DEVICE_ID_TANGIER 0x11a0
69 SCU_IPC_TANGIER,
70};
71 69
72/* intel scu ipc driver data*/ 70/* intel scu ipc driver data*/
73struct intel_scu_ipc_pdata_t { 71struct intel_scu_ipc_pdata_t {
@@ -78,35 +76,29 @@ struct intel_scu_ipc_pdata_t {
78 u8 irq_mode; 76 u8 irq_mode;
79}; 77};
80 78
81static struct intel_scu_ipc_pdata_t intel_scu_ipc_pdata[] = { 79static struct intel_scu_ipc_pdata_t intel_scu_ipc_lincroft_pdata = {
82 [SCU_IPC_LINCROFT] = { 80 .ipc_base = 0xff11c000,
83 .ipc_base = 0xff11c000, 81 .i2c_base = 0xff12b000,
84 .i2c_base = 0xff12b000, 82 .ipc_len = 0x100,
85 .ipc_len = 0x100, 83 .i2c_len = 0x10,
86 .i2c_len = 0x10, 84 .irq_mode = 0,
87 .irq_mode = 0, 85};
88 }, 86
89 [SCU_IPC_PENWELL] = { 87/* Penwell and Cloverview */
90 .ipc_base = 0xff11c000, 88static struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = {
91 .i2c_base = 0xff12b000, 89 .ipc_base = 0xff11c000,
92 .ipc_len = 0x100, 90 .i2c_base = 0xff12b000,
93 .i2c_len = 0x10, 91 .ipc_len = 0x100,
94 .irq_mode = 1, 92 .i2c_len = 0x10,
95 }, 93 .irq_mode = 1,
96 [SCU_IPC_CLOVERVIEW] = { 94};
97 .ipc_base = 0xff11c000, 95
98 .i2c_base = 0xff12b000, 96static struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = {
99 .ipc_len = 0x100, 97 .ipc_base = 0xff009000,
100 .i2c_len = 0x10, 98 .i2c_base = 0xff00d000,
101 .irq_mode = 1, 99 .ipc_len = 0x100,
102 }, 100 .i2c_len = 0x10,
103 [SCU_IPC_TANGIER] = { 101 .irq_mode = 0,
104 .ipc_base = 0xff009000,
105 .i2c_base = 0xff00d000,
106 .ipc_len = 0x100,
107 .i2c_len = 0x10,
108 .irq_mode = 0,
109 },
110}; 102};
111 103
112static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id); 104static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id);
@@ -583,15 +575,14 @@ static irqreturn_t ioc(int irq, void *dev_id)
583 */ 575 */
584static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id) 576static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
585{ 577{
586 int err, pid; 578 int err;
587 struct intel_scu_ipc_pdata_t *pdata; 579 struct intel_scu_ipc_pdata_t *pdata;
588 resource_size_t pci_resource; 580 resource_size_t pci_resource;
589 581
590 if (ipcdev.pdev) /* We support only one SCU */ 582 if (ipcdev.pdev) /* We support only one SCU */
591 return -EBUSY; 583 return -EBUSY;
592 584
593 pid = id->driver_data; 585 pdata = (struct intel_scu_ipc_pdata_t *)id->driver_data;
594 pdata = &intel_scu_ipc_pdata[pid];
595 586
596 ipcdev.pdev = pci_dev_get(dev); 587 ipcdev.pdev = pci_dev_get(dev);
597 ipcdev.irq_mode = pdata->irq_mode; 588 ipcdev.irq_mode = pdata->irq_mode;
@@ -650,11 +641,21 @@ static void ipc_remove(struct pci_dev *pdev)
650} 641}
651 642
652static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { 643static DEFINE_PCI_DEVICE_TABLE(pci_ids) = {
653 {PCI_VDEVICE(INTEL, 0x082a), SCU_IPC_LINCROFT}, 644 {
654 {PCI_VDEVICE(INTEL, 0x080e), SCU_IPC_PENWELL}, 645 PCI_VDEVICE(INTEL, PCI_DEVICE_ID_LINCROFT),
655 {PCI_VDEVICE(INTEL, 0x08ea), SCU_IPC_CLOVERVIEW}, 646 (kernel_ulong_t)&intel_scu_ipc_lincroft_pdata,
656 {PCI_VDEVICE(INTEL, 0x11a0), SCU_IPC_TANGIER}, 647 }, {
657 { 0,} 648 PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL),
649 (kernel_ulong_t)&intel_scu_ipc_penwell_pdata,
650 }, {
651 PCI_VDEVICE(INTEL, PCI_DEVICE_ID_CLOVERVIEW),
652 (kernel_ulong_t)&intel_scu_ipc_penwell_pdata,
653 }, {
654 PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER),
655 (kernel_ulong_t)&intel_scu_ipc_tangier_pdata,
656 }, {
657 0,
658 }
658}; 659};
659MODULE_DEVICE_TABLE(pci, pci_ids); 660MODULE_DEVICE_TABLE(pci, pci_ids);
660 661
diff --git a/drivers/platform/x86/mxm-wmi.c b/drivers/platform/x86/mxm-wmi.c
index 3c59c0a3ee0f..f4bad83053a9 100644
--- a/drivers/platform/x86/mxm-wmi.c
+++ b/drivers/platform/x86/mxm-wmi.c
@@ -20,6 +20,7 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/mxm-wmi.h>
23#include <linux/acpi.h> 24#include <linux/acpi.h>
24 25
25MODULE_AUTHOR("Dave Airlie"); 26MODULE_AUTHOR("Dave Airlie");
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 563e4f595f83..8f8551a63cc0 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -789,7 +789,7 @@ static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
789 void *buffer, size_t buflen) 789 void *buffer, size_t buflen)
790{ 790{
791 int ret = 0; 791 int ret = 0;
792 size_t len = len; 792 size_t len;
793 union acpi_object *object = __call_snc_method(handle, name, value); 793 union acpi_object *object = __call_snc_method(handle, name, value);
794 794
795 if (!object) 795 if (!object)
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 7ad1ed091f92..90dd7645a9e5 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -149,6 +149,7 @@ static const struct acpi_device_id toshiba_device_ids[] = {
149MODULE_DEVICE_TABLE(acpi, toshiba_device_ids); 149MODULE_DEVICE_TABLE(acpi, toshiba_device_ids);
150 150
151static const struct key_entry toshiba_acpi_keymap[] = { 151static const struct key_entry toshiba_acpi_keymap[] = {
152 { KE_KEY, 0x9e, { KEY_RFKILL } },
152 { KE_KEY, 0x101, { KEY_MUTE } }, 153 { KE_KEY, 0x101, { KEY_MUTE } },
153 { KE_KEY, 0x102, { KEY_ZOOMOUT } }, 154 { KE_KEY, 0x102, { KEY_ZOOMOUT } },
154 { KE_KEY, 0x103, { KEY_ZOOMIN } }, 155 { KE_KEY, 0x103, { KEY_ZOOMIN } },