Commit b7a8399e authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 30c867ee b4b0b4a9
...@@ -197,6 +197,17 @@ config HP_ACCEL ...@@ -197,6 +197,17 @@ config HP_ACCEL
To compile this driver as a module, choose M here: the module will To compile this driver as a module, choose M here: the module will
be called hp_accel. be called hp_accel.
config HP_WIRELESS
tristate "HP WIRELESS"
depends on ACPI
depends on INPUT
help
This driver provides supports for new HP wireless button for Windows 8.
On such systems the driver should load automatically (via ACPI alias).
To compile this driver as a module, choose M here: the module will
be called hp-wireless.
config HP_WMI config HP_WMI
tristate "HP WMI extras" tristate "HP WMI extras"
depends on ACPI_WMI depends on ACPI_WMI
...@@ -808,4 +819,12 @@ config PVPANIC ...@@ -808,4 +819,12 @@ config PVPANIC
a paravirtualized device provided by QEMU; it lets a virtual machine a paravirtualized device provided by QEMU; it lets a virtual machine
(guest) communicate panic events to the host. (guest) communicate panic events to the host.
config INTEL_BAYTRAIL_MBI
tristate
depends on PCI
---help---
Needed on Baytrail platforms for access to the IOSF Sideband Mailbox
Interface. This is a requirement for systems that need to configure
the PUNIT for power management features such as RAPL.
endif # X86_PLATFORM_DEVICES endif # X86_PLATFORM_DEVICES
...@@ -16,6 +16,7 @@ obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o ...@@ -16,6 +16,7 @@ obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o
obj-$(CONFIG_ACER_WMI) += acer-wmi.o obj-$(CONFIG_ACER_WMI) += acer-wmi.o
obj-$(CONFIG_ACERHDF) += acerhdf.o obj-$(CONFIG_ACERHDF) += acerhdf.o
obj-$(CONFIG_HP_ACCEL) += hp_accel.o obj-$(CONFIG_HP_ACCEL) += hp_accel.o
obj-$(CONFIG_HP_WIRELESS) += hp-wireless.o
obj-$(CONFIG_HP_WMI) += hp-wmi.o obj-$(CONFIG_HP_WMI) += hp-wmi.o
obj-$(CONFIG_AMILO_RFKILL) += amilo-rfkill.o obj-$(CONFIG_AMILO_RFKILL) += amilo-rfkill.o
obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o
...@@ -54,3 +55,4 @@ obj-$(CONFIG_INTEL_RST) += intel-rst.o ...@@ -54,3 +55,4 @@ obj-$(CONFIG_INTEL_RST) += intel-rst.o
obj-$(CONFIG_INTEL_SMARTCONNECT) += intel-smartconnect.o obj-$(CONFIG_INTEL_SMARTCONNECT) += intel-smartconnect.o
obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_PVPANIC) += pvpanic.o
obj-$(CONFIG_INTEL_BAYTRAIL_MBI) += intel_baytrail.o
...@@ -183,7 +183,6 @@ struct asus_wmi { ...@@ -183,7 +183,6 @@ struct asus_wmi {
struct input_dev *inputdev; struct input_dev *inputdev;
struct backlight_device *backlight_device; struct backlight_device *backlight_device;
struct device *hwmon_device;
struct platform_device *platform_device; struct platform_device *platform_device;
struct led_classdev wlan_led; struct led_classdev wlan_led;
...@@ -1072,20 +1071,12 @@ static ssize_t asus_hwmon_temp1(struct device *dev, ...@@ -1072,20 +1071,12 @@ static ssize_t asus_hwmon_temp1(struct device *dev,
return sprintf(buf, "%d\n", value); return sprintf(buf, "%d\n", value);
} }
static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO, asus_hwmon_pwm1, NULL, 0); static DEVICE_ATTR(pwm1, S_IRUGO, asus_hwmon_pwm1, NULL);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL, 0); static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL);
static ssize_t
show_name(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "asus\n");
}
static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
static struct attribute *hwmon_attributes[] = { static struct attribute *hwmon_attributes[] = {
&sensor_dev_attr_pwm1.dev_attr.attr, &dev_attr_pwm1.attr,
&sensor_dev_attr_temp1_input.dev_attr.attr, &dev_attr_temp1_input.attr,
&sensor_dev_attr_name.dev_attr.attr,
NULL NULL
}; };
...@@ -1099,9 +1090,9 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, ...@@ -1099,9 +1090,9 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
int dev_id = -1; int dev_id = -1;
u32 value = ASUS_WMI_UNSUPPORTED_METHOD; u32 value = ASUS_WMI_UNSUPPORTED_METHOD;
if (attr == &sensor_dev_attr_pwm1.dev_attr.attr) if (attr == &dev_attr_pwm1.attr)
dev_id = ASUS_WMI_DEVID_FAN_CTRL; dev_id = ASUS_WMI_DEVID_FAN_CTRL;
else if (attr == &sensor_dev_attr_temp1_input.dev_attr.attr) else if (attr == &dev_attr_temp1_input.attr)
dev_id = ASUS_WMI_DEVID_THERMAL_CTRL; dev_id = ASUS_WMI_DEVID_THERMAL_CTRL;
if (dev_id != -1) { if (dev_id != -1) {
...@@ -1136,35 +1127,20 @@ static struct attribute_group hwmon_attribute_group = { ...@@ -1136,35 +1127,20 @@ static struct attribute_group hwmon_attribute_group = {
.is_visible = asus_hwmon_sysfs_is_visible, .is_visible = asus_hwmon_sysfs_is_visible,
.attrs = hwmon_attributes .attrs = hwmon_attributes
}; };
__ATTRIBUTE_GROUPS(hwmon_attribute);
static void asus_wmi_hwmon_exit(struct asus_wmi *asus)
{
struct device *hwmon;
hwmon = asus->hwmon_device;
if (!hwmon)
return;
sysfs_remove_group(&hwmon->kobj, &hwmon_attribute_group);
hwmon_device_unregister(hwmon);
asus->hwmon_device = NULL;
}
static int asus_wmi_hwmon_init(struct asus_wmi *asus) static int asus_wmi_hwmon_init(struct asus_wmi *asus)
{ {
struct device *hwmon; struct device *hwmon;
int result;
hwmon = hwmon_device_register(&asus->platform_device->dev); hwmon = hwmon_device_register_with_groups(&asus->platform_device->dev,
"asus", asus,
hwmon_attribute_groups);
if (IS_ERR(hwmon)) { if (IS_ERR(hwmon)) {
pr_err("Could not register asus hwmon device\n"); pr_err("Could not register asus hwmon device\n");
return PTR_ERR(hwmon); return PTR_ERR(hwmon);
} }
dev_set_drvdata(hwmon, asus); return 0;
asus->hwmon_device = hwmon;
result = sysfs_create_group(&hwmon->kobj, &hwmon_attribute_group);
if (result)
asus_wmi_hwmon_exit(asus);
return result;
} }
/* /*
...@@ -1835,7 +1811,6 @@ static int asus_wmi_add(struct platform_device *pdev) ...@@ -1835,7 +1811,6 @@ static int asus_wmi_add(struct platform_device *pdev)
fail_rfkill: fail_rfkill:
asus_wmi_led_exit(asus); asus_wmi_led_exit(asus);
fail_leds: fail_leds:
asus_wmi_hwmon_exit(asus);
fail_hwmon: fail_hwmon:
asus_wmi_input_exit(asus); asus_wmi_input_exit(asus);
fail_input: fail_input:
...@@ -1853,7 +1828,6 @@ static int asus_wmi_remove(struct platform_device *device) ...@@ -1853,7 +1828,6 @@ static int asus_wmi_remove(struct platform_device *device)
wmi_remove_notify_handler(asus->driver->event_guid); wmi_remove_notify_handler(asus->driver->event_guid);
asus_wmi_backlight_exit(asus); asus_wmi_backlight_exit(asus);
asus_wmi_input_exit(asus); asus_wmi_input_exit(asus);
asus_wmi_hwmon_exit(asus);
asus_wmi_led_exit(asus); asus_wmi_led_exit(asus);
asus_wmi_rfkill_exit(asus); asus_wmi_rfkill_exit(asus);
asus_wmi_debugfs_exit(asus); asus_wmi_debugfs_exit(asus);
......
...@@ -173,8 +173,7 @@ ...@@ -173,8 +173,7 @@
/* ======= */ /* ======= */
struct compal_data{ struct compal_data{
/* Fan control */ /* Fan control */
struct device *hwmon_dev; int pwm_enable; /* 0:full on, 1:set by pwm1, 2:control by motherboard */
int pwm_enable; /* 0:full on, 1:set by pwm1, 2:control by moterboard */
unsigned char curr_pwm; unsigned char curr_pwm;
/* Power supply */ /* Power supply */
...@@ -402,15 +401,6 @@ SIMPLE_MASKED_STORE_SHOW(wake_up_wlan, WAKE_UP_ADDR, WAKE_UP_WLAN) ...@@ -402,15 +401,6 @@ SIMPLE_MASKED_STORE_SHOW(wake_up_wlan, WAKE_UP_ADDR, WAKE_UP_WLAN)
SIMPLE_MASKED_STORE_SHOW(wake_up_key, WAKE_UP_ADDR, WAKE_UP_KEY) SIMPLE_MASKED_STORE_SHOW(wake_up_key, WAKE_UP_ADDR, WAKE_UP_KEY)
SIMPLE_MASKED_STORE_SHOW(wake_up_mouse, WAKE_UP_ADDR, WAKE_UP_MOUSE) SIMPLE_MASKED_STORE_SHOW(wake_up_mouse, WAKE_UP_ADDR, WAKE_UP_MOUSE)
/* General hwmon interface */
static ssize_t hwmon_name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", DRIVER_NAME);
}
/* Fan control interface */ /* Fan control interface */
static ssize_t pwm_enable_show(struct device *dev, static ssize_t pwm_enable_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
...@@ -665,55 +655,55 @@ static DEVICE_ATTR(wake_up_key, ...@@ -665,55 +655,55 @@ static DEVICE_ATTR(wake_up_key,
static DEVICE_ATTR(wake_up_mouse, static DEVICE_ATTR(wake_up_mouse,
0644, wake_up_mouse_show, wake_up_mouse_store); 0644, wake_up_mouse_show, wake_up_mouse_store);
static SENSOR_DEVICE_ATTR(name, S_IRUGO, hwmon_name_show, NULL, 1); static DEVICE_ATTR(fan1_input, S_IRUGO, fan_show, NULL);
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, fan_show, NULL, 1); static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu, NULL);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu, NULL, 1); static DEVICE_ATTR(temp2_input, S_IRUGO, temp_cpu_local, NULL);
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, temp_cpu_local, NULL, 1); static DEVICE_ATTR(temp3_input, S_IRUGO, temp_cpu_DTS, NULL);
static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, temp_cpu_DTS, NULL, 1); static DEVICE_ATTR(temp4_input, S_IRUGO, temp_northbridge, NULL);
static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, temp_northbridge, NULL, 1); static DEVICE_ATTR(temp5_input, S_IRUGO, temp_vga, NULL);
static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, temp_vga, NULL, 1); static DEVICE_ATTR(temp6_input, S_IRUGO, temp_SKIN, NULL);
static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, temp_SKIN, NULL, 1); static DEVICE_ATTR(temp1_label, S_IRUGO, label_cpu, NULL);
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, label_cpu, NULL, 1); static DEVICE_ATTR(temp2_label, S_IRUGO, label_cpu_local, NULL);
static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, label_cpu_local, NULL, 1); static DEVICE_ATTR(temp3_label, S_IRUGO, label_cpu_DTS, NULL);
static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, label_cpu_DTS, NULL, 1); static DEVICE_ATTR(temp4_label, S_IRUGO, label_northbridge, NULL);
static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, label_northbridge, NULL, 1); static DEVICE_ATTR(temp5_label, S_IRUGO, label_vga, NULL);
static SENSOR_DEVICE_ATTR(temp5_label, S_IRUGO, label_vga, NULL, 1); static DEVICE_ATTR(temp6_label, S_IRUGO, label_SKIN, NULL);
static SENSOR_DEVICE_ATTR(temp6_label, S_IRUGO, label_SKIN, NULL, 1); static DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, pwm_show, pwm_store);
static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, pwm_show, pwm_store, 1); static DEVICE_ATTR(pwm1_enable,
static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, pwm_enable_show, pwm_enable_store);
S_IRUGO | S_IWUSR, pwm_enable_show, pwm_enable_store, 0);
static struct attribute *compal_platform_attrs[] = {
static struct attribute *compal_attributes[] = {
&dev_attr_wake_up_pme.attr, &dev_attr_wake_up_pme.attr,
&dev_attr_wake_up_modem.attr, &dev_attr_wake_up_modem.attr,
&dev_attr_wake_up_lan.attr, &dev_attr_wake_up_lan.attr,
&dev_attr_wake_up_wlan.attr, &dev_attr_wake_up_wlan.attr,
&dev_attr_wake_up_key.attr, &dev_attr_wake_up_key.attr,
&dev_attr_wake_up_mouse.attr, &dev_attr_wake_up_mouse.attr,
/* Maybe put the sensor-stuff in a separate hwmon-driver? That way,
* the hwmon sysfs won't be cluttered with the above files. */
&sensor_dev_attr_name.dev_attr.attr,
&sensor_dev_attr_pwm1_enable.dev_attr.attr,
&sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_fan1_input.dev_attr.attr,
&sensor_dev_attr_temp1_input.dev_attr.attr,
&sensor_dev_attr_temp2_input.dev_attr.attr,
&sensor_dev_attr_temp3_input.dev_attr.attr,
&sensor_dev_attr_temp4_input.dev_attr.attr,
&sensor_dev_attr_temp5_input.dev_attr.attr,
&sensor_dev_attr_temp6_input.dev_attr.attr,
&sensor_dev_attr_temp1_label.dev_attr.attr,
&sensor_dev_attr_temp2_label.dev_attr.attr,
&sensor_dev_attr_temp3_label.dev_attr.attr,
&sensor_dev_attr_temp4_label.dev_attr.attr,
&sensor_dev_attr_temp5_label.dev_attr.attr,
&sensor_dev_attr_temp6_label.dev_attr.attr,
NULL NULL
}; };
static struct attribute_group compal_platform_attr_group = {
.attrs = compal_platform_attrs
};
static struct attribute_group compal_attribute_group = { static struct attribute *compal_hwmon_attrs[] = {
.attrs = compal_attributes &dev_attr_pwm1_enable.attr,
&dev_attr_pwm1.attr,
&dev_attr_fan1_input.attr,
&dev_attr_temp1_input.attr,
&dev_attr_temp2_input.attr,
&dev_attr_temp3_input.attr,
&dev_attr_temp4_input.attr,
&dev_attr_temp5_input.attr,
&dev_attr_temp6_input.attr,
&dev_attr_temp1_label.attr,
&dev_attr_temp2_label.attr,
&dev_attr_temp3_label.attr,
&dev_attr_temp4_label.attr,
&dev_attr_temp5_label.attr,
&dev_attr_temp6_label.attr,
NULL
}; };
ATTRIBUTE_GROUPS(compal_hwmon);
static int compal_probe(struct platform_device *); static int compal_probe(struct platform_device *);
static int compal_remove(struct platform_device *); static int compal_remove(struct platform_device *);
...@@ -1021,30 +1011,28 @@ static int compal_probe(struct platform_device *pdev) ...@@ -1021,30 +1011,28 @@ static int compal_probe(struct platform_device *pdev)
{ {
int err; int err;
struct compal_data *data; struct compal_data *data;
struct device *hwmon_dev;
if (!extra_features) if (!extra_features)
return 0; return 0;
/* Fan control */ /* Fan control */
data = kzalloc(sizeof(struct compal_data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
initialize_fan_control_data(data); initialize_fan_control_data(data);
err = sysfs_create_group(&pdev->dev.kobj, &compal_attribute_group); err = sysfs_create_group(&pdev->dev.kobj, &compal_platform_attr_group);
if (err) { if (err)
kfree(data);
return err; return err;
}
data->hwmon_dev = hwmon_device_register(&pdev->dev); hwmon_dev = hwmon_device_register_with_groups(&pdev->dev,
if (IS_ERR(data->hwmon_dev)) { DRIVER_NAME, data,
err = PTR_ERR(data->hwmon_dev); compal_hwmon_groups);
sysfs_remove_group(&pdev->dev.kobj, if (IS_ERR(hwmon_dev)) {
&compal_attribute_group); err = PTR_ERR(hwmon_dev);
kfree(data); goto remove;
return err;
} }
/* Power supply */ /* Power supply */
...@@ -1054,6 +1042,10 @@ static int compal_probe(struct platform_device *pdev) ...@@ -1054,6 +1042,10 @@ static int compal_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
return 0; return 0;
remove:
sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
return err;
} }
static void __exit compal_cleanup(void) static void __exit compal_cleanup(void)
...@@ -1080,12 +1072,9 @@ static int compal_remove(struct platform_device *pdev) ...@@ -1080,12 +1072,9 @@ static int compal_remove(struct platform_device *pdev)
pwm_disable_control(); pwm_disable_control();
data = platform_get_drvdata(pdev); data = platform_get_drvdata(pdev);
hwmon_device_unregister(data->hwmon_dev);
power_supply_unregister(&data->psy); power_supply_unregister(&data->psy);
kfree(data); sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
sysfs_remove_group(&pdev->dev.kobj, &compal_attribute_group);
return 0; return 0;
} }
......
...@@ -559,19 +559,45 @@ static void dell_update_rfkill(struct work_struct *ignored) ...@@ -559,19 +559,45 @@ static void dell_update_rfkill(struct work_struct *ignored)
} }
static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill);
static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
struct serio *port)
{
static bool extended;
if (str & 0x20)
return false;
if (unlikely(data == 0xe0)) {
extended = true;
return false;
} else if (unlikely(extended)) {
switch (data) {
case 0x8:
schedule_delayed_work(&dell_rfkill_work,
round_jiffies_relative(HZ / 4));
break;
}
extended = false;
}
return false;
}
static int __init dell_setup_rfkill(void) static int __init dell_setup_rfkill(void)
{ {
int status; int status, ret, whitelisted;
int ret;
const char *product; const char *product;
/* /*
* rfkill causes trouble on various non Latitudes, according to Dell * rfkill support causes trouble on various models, mostly Inspirons.
* actually testing the rfkill functionality is only done on Latitudes. * So we whitelist certain series, and don't support rfkill on others.
*/ */
whitelisted = 0;
product = dmi_get_system_info(DMI_PRODUCT_NAME); product = dmi_get_system_info(DMI_PRODUCT_NAME);
if (!force_rfkill && (!product || strncmp(product, "Latitude", 8))) if (product && (strncmp(product, "Latitude", 8) == 0 ||
strncmp(product, "Precision", 9) == 0))
whitelisted = 1;
if (!force_rfkill && !whitelisted)
return 0; return 0;
get_buffer(); get_buffer();
...@@ -633,7 +659,16 @@ static int __init dell_setup_rfkill(void) ...@@ -633,7 +659,16 @@ static int __init dell_setup_rfkill(void)
goto err_wwan; goto err_wwan;
} }
ret = i8042_install_filter(dell_laptop_i8042_filter);
if (ret) {
pr_warn("Unable to install key filter\n");
goto err_filter;
}
return 0; return 0;
err_filter:
if (wwan_rfkill)
rfkill_unregister(wwan_rfkill);
err_wwan: err_wwan:
rfkill_destroy(wwan_rfkill); rfkill_destroy(wwan_rfkill);
if (bluetooth_rfkill) if (bluetooth_rfkill)
...@@ -684,7 +719,7 @@ static int dell_send_intensity(struct backlight_device *bd) ...@@ -684,7 +719,7 @@ static int dell_send_intensity(struct backlight_device *bd)
out: out:
release_buffer(); release_buffer();
return 0; return ret;
} }
static int dell_get_intensity(struct backlight_device *bd) static int dell_get_intensity(struct backlight_device *bd)
...@@ -755,30 +790,6 @@ static void touchpad_led_exit(void) ...@@ -755,30 +790,6 @@ static void touchpad_led_exit(void)
led_classdev_unregister(&touchpad_led); led_classdev_unregister(&touchpad_led);
} }
static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
struct serio *port)
{
static bool extended;
if (str & 0x20)
return false;
if (unlikely(data == 0xe0)) {
extended = true;
return false;
} else if (unlikely(extended)) {
switch (data) {
case 0x8:
schedule_delayed_work(&dell_rfkill_work,
round_jiffies_relative(HZ / 4));
break;
}
extended = false;
}
return false;
}
static int __init dell_init(void) static int __init dell_init(void)
{ {
int max_intensity = 0; int max_intensity = 0;
...@@ -828,12 +839,6 @@ static int __init dell_init(void) ...@@ -828,12 +839,6 @@ static int __init dell_init(void)
goto fail_rfkill; goto fail_rfkill;
} }
ret = i8042_install_filter(dell_laptop_i8042_filter);
if (ret) {
pr_warn("Unable to install key filter\n");
goto fail_filter;
}
if (quirks && quirks->touchpad_led) if (quirks && quirks->touchpad_led)
touchpad_led_init(&platform_device->dev); touchpad_led_init(&platform_device->dev);
...@@ -885,7 +890,6 @@ static int __init dell_init(void) ...@@ -885,7 +890,6 @@ static int __init dell_init(void)
fail_backlight: fail_backlight:
i8042_remove_filter(dell_laptop_i8042_filter); i8042_remove_filter(dell_laptop_i8042_filter);
cancel_delayed_work_sync(&dell_rfkill_work); cancel_delayed_work_sync(&dell_rfkill_work);
fail_filter:
dell_cleanup_rfkill(); dell_cleanup_rfkill();
fail_rfkill: fail_rfkill:
free_page((unsigned long)bufferpage); free_page((unsigned long)bufferpage);
......
...@@ -165,7 +165,6 @@ struct eeepc_laptop { ...@@ -165,7 +165,6 @@ struct eeepc_laptop {
struct platform_device *platform_device; struct platform_device *platform_device;
struct acpi_device *device; /* the device we are in */ struct acpi_device *device; /* the device we are in */
struct device *hwmon_device;
struct backlight_device *backlight_device; struct backlight_device *backlight_device;
struct input_dev *inputdev; struct input_dev *inputdev;
...@@ -1068,7 +1067,7 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf) ...@@ -1068,7 +1067,7 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf)
{ \ { \
return store_sys_hwmon(_get, buf, count); \ return store_sys_hwmon(_get, buf, count); \
} \ } \
static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0); static DEVICE_ATTR(_name, _mode, show_##_name, store_##_name);
EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL);
EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR,
...@@ -1076,55 +1075,26 @@ EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, ...@@ -1076,55 +1075,26 @@ EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR,
EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
eeepc_get_fan_ctrl, eeepc_set_fan_ctrl); eeepc_get_fan_ctrl, eeepc_set_fan_ctrl);
static ssize_t static struct attribute *hwmon_attrs[] = {
show_name(struct device *dev, struct device_attribute *attr, char *buf) &dev_attr_pwm1.attr,
{ &dev_attr_fan1_input.attr,
return sprintf(buf, "eeepc\n"); &dev_attr_pwm1_enable.attr,
}
static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
static struct attribute *hwmon_attributes[] = {
&sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_fan1_input.dev_attr.attr,
&sensor_dev_attr_pwm1_enable.dev_attr.attr,
&sensor_dev_attr_name.dev_attr.attr,
NULL NULL
}; };
ATTRIBUTE_GROUPS(hwmon);
static struct attribute_group hwmon_attribute_group = {
.attrs = hwmon_attributes
};
static void eeepc_hwmon_exit(struct eeepc_laptop *eeepc)
{
struct device *hwmon;
hwmon = eeepc->hwmon_device;
if (!hwmon)
return;
sysfs_remove_group(&hwmon->kobj,
&hwmon_attribute_group);
hwmon_device_unregister(hwmon);
eeepc->hwmon_device = NULL;
}
static int eeepc_hwmon_init(struct eeepc_laptop *eeepc) static int eeepc_hwmon_init(struct eeepc_laptop *eeepc)
{ {
struct device *dev = &eeepc->platform_device->dev;
struct device *hwmon; struct device *hwmon;
int result;
hwmon = hwmon_device_register(&eeepc->platform_device->dev); hwmon = devm_hwmon_device_register_with_groups(dev, "eeepc", NULL,
hwmon_groups);
if (IS_ERR(hwmon)) { if (IS_ERR(hwmon)) {
pr_err("Could not register eeepc hwmon device\n"); pr_err("Could not register eeepc hwmon device\n");
eeepc->hwmon_device = NULL;
return PTR_ERR(hwmon); return PTR_ERR(hwmon);
} }
eeepc->hwmon_device = hwmon; return 0;
result = sysfs_create_group(&hwmon->kobj,
&hwmon_attribute_group);
if (result)
eeepc_hwmon_exit(eeepc);
return result;
} }
/* /*
...@@ -1480,7 +1450,6 @@ static int eeepc_acpi_add(struct acpi_device *device) ...@@ -1480,7 +1450,6 @@ static int eeepc_acpi_add(struct acpi_device *device)
fail_rfkill: fail_rfkill:
eeepc_led_exit(eeepc); eeepc_led_exit(eeepc);
fail_led: fail_led:
eeepc_hwmon_exit(eeepc);
fail_hwmon: fail_hwmon:
eeepc_input_exit(eeepc); eeepc_input_exit(eeepc);
fail_input: fail_input:
...@@ -1500,7 +1469,6 @@ static int eeepc_acpi_remove(struct acpi_device *device) ...@@ -1500,7 +1469,6 @@ static int eeepc_acpi_remove(struct acpi_device *device)
eeepc_backlight_exit(eeepc); eeepc_backlight_exit(eeepc);
eeepc_rfkill_exit(eeepc); eeepc_rfkill_exit(eeepc);
eeepc_input_exit(eeepc); eeepc_input_exit(eeepc);
eeepc_hwmon_exit(eeepc);
eeepc_led_exit(eeepc); eeepc_led_exit(eeepc);
eeepc_platform_exit(eeepc); eeepc_platform_exit(eeepc);
......
...@@ -633,7 +633,6 @@ static struct dmi_system_id fujitsu_dmi_table[] = { ...@@ -633,7 +633,6 @@ static struct dmi_system_id fujitsu_dmi_table[] = {
static int acpi_fujitsu_add(struct acpi_device *device) static int acpi_fujitsu_add(struct acpi_device *device)
{ {
int result = 0;
int state = 0; int state = 0;
struct input_dev *input; struct input_dev *input;
int error; int error;
...@@ -669,8 +668,8 @@ static int acpi_fujitsu_add(struct acpi_device *device) ...@@ -669,8 +668,8 @@ static int acpi_fujitsu_add(struct acpi_device *device)
if (error) if (error)
goto err_free_input_dev; goto err_free_input_dev;
result = acpi_bus_update_power(fujitsu->acpi_handle, &state); error = acpi_bus_update_power(fujitsu->acpi_handle, &state);
if (result) { if (error) {
pr_err("Error reading power state\n"); pr_err("Error reading power state\n");
goto err_unregister_input_dev; goto err_unregister_input_dev;
} }
...@@ -700,7 +699,7 @@ static int acpi_fujitsu_add(struct acpi_device *device) ...@@ -700,7 +699,7 @@ static int acpi_fujitsu_add(struct acpi_device *device)
fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS; fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS;
get_lcd_level(); get_lcd_level();
return result; return 0;
err_unregister_input_dev: err_unregister_input_dev:
input_unregister_device(input); input_unregister_device(input);
...@@ -708,7 +707,7 @@ static int acpi_fujitsu_add(struct acpi_device *device) ...@@ -708,7 +707,7 @@ static int acpi_fujitsu_add(struct acpi_device *device)
err_free_input_dev: err_free_input_dev:
input_free_device(input); input_free_device(input);
err_stop: err_stop:
return result; return error;
} }
static int acpi_fujitsu_remove(struct acpi_device *device) static int acpi_fujitsu_remove(struct acpi_device *device)
...@@ -831,8 +830,8 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) ...@@ -831,8 +830,8 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
if (error) if (error)
goto err_free_input_dev; goto err_free_input_dev;
result = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state); error = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state);
if (result) { if (error) {
pr_err("Error reading power state\n"); pr_err("Error reading power state\n");
goto err_unregister_input_dev; goto err_unregister_input_dev;
} }
...@@ -907,7 +906,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) ...@@ -907,7 +906,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
err_free_fifo: err_free_fifo:
kfifo_free(&fujitsu_hotkey->fifo); kfifo_free(&fujitsu_hotkey->fifo);
err_stop: err_stop:
return result; return error;
} }
static int acpi_fujitsu_hotkey_remove(struct acpi_device *device) static int acpi_fujitsu_hotkey_remove(struct acpi_device *device)
......
/*
* hp-wireless button for Windows 8
*
* Copyright (C) 2014 Alex Hung <alex.hung@canonical.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/acpi.h>
#include <acpi/acpi_bus.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Alex Hung");
MODULE_ALIAS("acpi*:HPQ6001:*");
static struct input_dev *hpwl_input_dev;
static const struct acpi_device_id hpwl_ids[] = {
{"HPQ6001", 0},
{"", 0},
};
static int hp_wireless_input_setup(void)
{
int err;
hpwl_input_dev = input_allocate_device();
if (!hpwl_input_dev)
return -ENOMEM;
hpwl_input_dev->name = "HP Wireless hotkeys";
hpwl_input_dev->phys = "hpq6001/input0";
hpwl_input_dev->id.bustype = BUS_HOST;
hpwl_input_dev->evbit[0] = BIT(EV_KEY);
set_bit(KEY_RFKILL, hpwl_input_dev->keybit);
err = input_register_device(hpwl_input_dev);
if (err)
goto err_free_dev;
return 0;
err_free_dev:
input_free_device(hpwl_input_dev);
return err;
}
static void hp_wireless_input_destroy(void)
{
input_unregister_device(hpwl_input_dev);
}
static void hpwl_notify(struct acpi_device *acpi_dev, u32 event)
{
if (event != 0x80) {
pr_info("Received unknown event (0x%x)\n", event);
return;
}
input_report_key(hpwl_input_dev, KEY_RFKILL, 1);
input_sync(hpwl_input_dev);
input_report_key(hpwl_input_dev, KEY_RFKILL, 0);
input_sync(hpwl_input_dev);
}
static int hpwl_add(struct acpi_device *device)
{
int err;
err = hp_wireless_input_setup();
return err;
}
static int hpwl_remove(struct acpi_device *device)
{
hp_wireless_input_destroy();
return 0;
}
static struct acpi_driver hpwl_driver = {
.name = "hp-wireless",
.owner = THIS_MODULE,
.ids = hpwl_ids,
.ops = {
.add = hpwl_add,
.remove = hpwl_remove,
.notify = hpwl_notify,
},
};
static int __init hpwl_init(void)
{
int err;
pr_info("Initializing HPQ6001 module\n");
err = acpi_bus_register_driver(&hpwl_driver);
if (err) {
pr_err("Unable to register HP wireless control driver.\n");
goto error_acpi_register;
}
return 0;
error_acpi_register:
return err;
}
static void __exit hpwl_exit(void)
{
pr_info("Exiting HPQ6001 module\n");
acpi_bus_unregister_driver(&hpwl_driver);
}
module_init(hpwl_init);
module_exit(hpwl_exit);
...@@ -77,6 +77,7 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev, ...@@ -77,6 +77,7 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev,
static struct acpi_device_id lis3lv02d_device_ids[] = { static struct acpi_device_id lis3lv02d_device_ids[] = {
{"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */
{"HPQ6000", 0}, /* HP Mobile Data Protection System PNP */ {"HPQ6000", 0}, /* HP Mobile Data Protection System PNP */
{"HPQ6007", 0}, /* HP Mobile Data Protection System PNP */
{"", 0}, {"", 0},
}; };
MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids); MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids);
...@@ -88,7 +89,7 @@ MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids); ...@@ -88,7 +89,7 @@ MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids);
* *
* Returns 0 on success. * Returns 0 on success.
*/ */
int lis3lv02d_acpi_init(struct lis3lv02d *lis3) static int lis3lv02d_acpi_init(struct lis3lv02d *lis3)
{ {
struct acpi_device *dev = lis3->bus_priv; struct acpi_device *dev = lis3->bus_priv;
if (acpi_evaluate_object(dev->handle, METHOD_NAME__INI, if (acpi_evaluate_object(dev->handle, METHOD_NAME__INI,
...@@ -106,7 +107,7 @@ int lis3lv02d_acpi_init(struct lis3lv02d *lis3) ...@@ -106,7 +107,7 @@ int lis3lv02d_acpi_init(struct lis3lv02d *lis3)
* *
* Returns 0 on success. * Returns 0 on success.
*/ */
int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret) static int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret)
{ {
struct acpi_device *dev = lis3->bus_priv; struct acpi_device *dev = lis3->bus_priv;
union acpi_object arg0 = { ACPI_TYPE_INTEGER }; union acpi_object arg0 = { ACPI_TYPE_INTEGER };
...@@ -129,7 +130,7 @@ int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret) ...@@ -129,7 +130,7 @@ int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret)
* *
* Returns 0 on success. * Returns 0 on success.
*/ */
int lis3lv02d_acpi_write(struct lis3lv02d *lis3, int reg, u8 val) static int lis3lv02d_acpi_write(struct lis3lv02d *lis3, int reg, u8 val)
{ {
struct acpi_device *dev = lis3->bus_priv; struct acpi_device *dev = lis3->bus_priv;
unsigned long long ret; /* Not used when writting */ unsigned long long ret; /* Not used when writting */
......
/*
* Baytrail IOSF-SB MailBox Interface Driver
* Copyright (c) 2013, Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*
* The IOSF-SB is a fabric bus available on Atom based SOC's that uses a
* mailbox interface (MBI) to communicate with mutiple devices. This
* driver implements BayTrail-specific access to this interface.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/pci.h>
#include "intel_baytrail.h"
static DEFINE_SPINLOCK(iosf_mbi_lock);
static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset)
{
return (op << 24) | (port << 16) | (offset << 8) | BT_MBI_ENABLE;
}
static struct pci_dev *mbi_pdev; /* one mbi device */
/* Hold lock before calling */
static int iosf_mbi_pci_read_mdr(u32 mcrx, u32 mcr, u32 *mdr)
{
int result;
if (!mbi_pdev)
return -ENODEV;
if (mcrx) {
result = pci_write_config_dword(mbi_pdev,
BT_MBI_MCRX_OFFSET, mcrx);
if (result < 0)
goto iosf_mbi_read_err;
}
result = pci_write_config_dword(mbi_pdev,
BT_MBI_MCR_OFFSET, mcr);
if (result < 0)
goto iosf_mbi_read_err;
result = pci_read_config_dword(mbi_pdev,
BT_MBI_MDR_OFFSET, mdr);
if (result < 0)
goto iosf_mbi_read_err;
return 0;
iosf_mbi_read_err:
dev_err(&mbi_pdev->dev, "error: PCI config operation returned %d\n",
result);
return result;
}
/* Hold lock before calling */
static int iosf_mbi_pci_write_mdr(u32 mcrx, u32 mcr, u32 mdr)
{
int result;
if (!mbi_pdev)
return -ENODEV;
result = pci_write_config_dword(mbi_pdev,
BT_MBI_MDR_OFFSET, mdr);
if (result < 0)
goto iosf_mbi_write_err;
if (mcrx) {
result = pci_write_config_dword(mbi_pdev,
BT_MBI_MCRX_OFFSET, mcrx);
if (result < 0)
goto iosf_mbi_write_err;
}
result = pci_write_config_dword(mbi_pdev,
BT_MBI_MCR_OFFSET, mcr);
if (result < 0)
goto iosf_mbi_write_err;
return 0;
iosf_mbi_write_err:
dev_err(&mbi_pdev->dev, "error: PCI config operation returned %d\n",
result);
return result;
}
int bt_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr)
{
u32 mcr, mcrx;
unsigned long flags;
int ret;
/*Access to the GFX unit is handled by GPU code */
BUG_ON(port == BT_MBI_UNIT_GFX);
mcr = iosf_mbi_form_mcr(opcode, port, offset & BT_MBI_MASK_LO);
mcrx = offset & BT_MBI_MASK_HI;
spin_lock_irqsave(&iosf_mbi_lock, flags);
ret = iosf_mbi_pci_read_mdr(mcrx, mcr, mdr);
spin_unlock_irqrestore(&iosf_mbi_lock, flags);
return ret;
}
EXPORT_SYMBOL(bt_mbi_read);
int bt_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr)
{
u32 mcr, mcrx;
unsigned long flags;
int ret;
/*Access to the GFX unit is handled by GPU code */
BUG_ON(port == BT_MBI_UNIT_GFX);
mcr = iosf_mbi_form_mcr(opcode, port, offset & BT_MBI_MASK_LO);
mcrx = offset & BT_MBI_MASK_HI;
spin_lock_irqsave(&iosf_mbi_lock, flags);
ret = iosf_mbi_pci_write_mdr(mcrx, mcr, mdr);
spin_unlock_irqrestore(&iosf_mbi_lock, flags);
return ret;
}
EXPORT_SYMBOL(bt_mbi_write);
int bt_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)
{
u32 mcr, mcrx;
u32 value;
unsigned long flags;
int ret;
/*Access to the GFX unit is handled by GPU code */
BUG_ON(port == BT_MBI_UNIT_GFX);
mcr = iosf_mbi_form_mcr(opcode, port, offset & BT_MBI_MASK_LO);
mcrx = offset & BT_MBI_MASK_HI;
spin_lock_irqsave(&iosf_mbi_lock, flags);
/* Read current mdr value */
ret = iosf_mbi_pci_read_mdr(mcrx, mcr & BT_MBI_RD_MASK, &value);
if (ret < 0) {
spin_unlock_irqrestore(&iosf_mbi_lock, flags);
return ret;
}
/* Apply mask */
value &= ~mask;
mdr &= mask;
value |= mdr;
/* Write back */
ret = iosf_mbi_pci_write_mdr(mcrx, mcr | BT_MBI_WR_MASK, value);
spin_unlock_irqrestore(&iosf_mbi_lock, flags);
return ret;
}
EXPORT_SYMBOL(bt_mbi_modify);
static int iosf_mbi_probe(struct pci_dev *pdev,
const struct pci_device_id *unused)
{
int ret;
ret = pci_enable_device(pdev);
if (ret < 0) {
dev_err(&pdev->dev, "error: could not enable device\n");
return ret;
}
mbi_pdev = pci_dev_get(pdev);
return 0;
}
static DEFINE_PCI_DEVICE_TABLE(iosf_mbi_pci_ids) = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0F00) },
{ 0, },
};
MODULE_DEVICE_TABLE(pci, iosf_mbi_pci_ids);
static struct pci_driver iosf_mbi_pci_driver = {
.name = "iosf_mbi_pci",
.probe = iosf_mbi_probe,
.id_table = iosf_mbi_pci_ids,
};
static int __init bt_mbi_init(void)
{
return pci_register_driver(&iosf_mbi_pci_driver);
}
static void __exit bt_mbi_exit(void)
{
pci_unregister_driver(&iosf_mbi_pci_driver);
if (mbi_pdev) {
pci_dev_put(mbi_pdev);
mbi_pdev = NULL;
}
}
module_init(bt_mbi_init);
module_exit(bt_mbi_exit);
MODULE_AUTHOR("David E. Box <david.e.box@linux.intel.com>");
MODULE_DESCRIPTION("BayTrail Mailbox Interface accessor");
MODULE_LICENSE("GPL v2");
/*
* intel_baytrail.h: MailBox access support for Intel BayTrail platforms
*/
#ifndef INTEL_BAYTRAIL_MBI_SYMS_H
#define INTEL_BAYTRAIL_MBI_SYMS_H
#define BT_MBI_MCR_OFFSET 0xD0
#define BT_MBI_MDR_OFFSET 0xD4
#define BT_MBI_MCRX_OFFSET 0xD8
#define BT_MBI_RD_MASK 0xFEFFFFFF
#define BT_MBI_WR_MASK 0X01000000
#define BT_MBI_MASK_HI 0xFFFFFF00
#define BT_MBI_MASK_LO 0x000000FF
#define BT_MBI_ENABLE 0xF0
/* BT-SB unit access methods */
#define BT_MBI_UNIT_AUNIT 0x00
#define BT_MBI_UNIT_SMC 0x01
#define BT_MBI_UNIT_CPU 0x02
#define BT_MBI_UNIT_BUNIT 0x03
#define BT_MBI_UNIT_PMC 0x04
#define BT_MBI_UNIT_GFX 0x06
#define BT_MBI_UNIT_SMI 0x0C
#define BT_MBI_UNIT_USB 0x43
#define BT_MBI_UNIT_SATA 0xA3
#define BT_MBI_UNIT_PCIE 0xA6
/* Read/write opcodes */
#define BT_MBI_AUNIT_READ 0x10
#define BT_MBI_AUNIT_WRITE 0x11
#define BT_MBI_SMC_READ 0x10
#define BT_MBI_SMC_WRITE 0x11
#define BT_MBI_CPU_READ 0x10
#define BT_MBI_CPU_WRITE 0x11
#define BT_MBI_BUNIT_READ 0x10
#define BT_MBI_BUNIT_WRITE 0x11
#define BT_MBI_PMC_READ 0x06
#define BT_MBI_PMC_WRITE 0x07
#define BT_MBI_GFX_READ 0x00
#define BT_MBI_GFX_WRITE 0x01
#define BT_MBI_SMIO_READ 0x06
#define BT_MBI_SMIO_WRITE 0x07
#define BT_MBI_USB_READ 0x06
#define BT_MBI_USB_WRITE 0x07
#define BT_MBI_SATA_READ 0x00
#define BT_MBI_SATA_WRITE 0x01
#define BT_MBI_PCIE_READ 0x00
#define BT_MBI_PCIE_WRITE 0x01
/**
* bt_mbi_read() - MailBox Interface read command
* @port: port indicating subunit being accessed
* @opcode: port specific read or write opcode
* @offset: register address offset
* @mdr: register data to be read
*
* Locking is handled by spinlock - cannot sleep.
* Return: Nonzero on error
*/
int bt_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr);
/**
* bt_mbi_write() - MailBox unmasked write command
* @port: port indicating subunit being accessed
* @opcode: port specific read or write opcode
* @offset: register address offset
* @mdr: register data to be written
*
* Locking is handled by spinlock - cannot sleep.
* Return: Nonzero on error
*/
int bt_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr);
/**
* bt_mbi_modify() - MailBox masked write command
* @port: port indicating subunit being accessed
* @opcode: port specific read or write opcode
* @offset: register address offset
* @mdr: register data being modified
* @mask: mask indicating bits in mdr to be modified
*
* Locking is handled by spinlock - cannot sleep.
* Return: Nonzero on error
*/
int bt_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
#endif /* INTEL_BAYTRAIL_MBI_SYMS_H */
...@@ -62,12 +62,10 @@ ...@@ -62,12 +62,10 @@
#define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */ #define IPC_RWBUF_SIZE 20 /* IPC Read buffer Size */
#define IPC_IOC 0x100 /* IPC command register IOC bit */ #define IPC_IOC 0x100 /* IPC command register IOC bit */
enum { #define PCI_DEVICE_ID_LINCROFT 0x082a
SCU_IPC_LINCROFT, #define PCI_DEVICE_ID_PENWELL 0x080e
SCU_IPC_PENWELL, #define PCI_DEVICE_ID_CLOVERVIEW 0x08ea
SCU_IPC_CLOVERVIEW, #define PCI_DEVICE_ID_TANGIER 0x11a0
SCU_IPC_TANGIER,
};
/* intel scu ipc driver data*/ /* intel scu ipc driver data*/
struct intel_scu_ipc_pdata_t { struct intel_scu_ipc_pdata_t {
...@@ -78,35 +76,29 @@ struct intel_scu_ipc_pdata_t { ...@@ -78,35 +76,29 @@ struct intel_scu_ipc_pdata_t {
u8 irq_mode; u8 irq_mode;
}; };
static struct intel_scu_ipc_pdata_t intel_scu_ipc_pdata[] = { static struct intel_scu_ipc_pdata_t intel_scu_ipc_lincroft_pdata = {
[SCU_IPC_LINCROFT] = {
.ipc_base = 0xff11c000, .ipc_base = 0xff11c000,
.i2c_base = 0xff12b000, .i2c_base = 0xff12b000,
.ipc_len = 0x100, .ipc_len = 0x100,
.i2c_len = 0x10, .i2c_len = 0x10,
.irq_mode = 0, .irq_mode = 0,
}, };
[SCU_IPC_PENWELL] = {
.ipc_base = 0xff11c000, /* Penwell and Cloverview */
.i2c_base = 0xff12b000, static struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = {
.ipc_len = 0x100,
.i2c_len = 0x10,
.irq_mode = 1,
},
[SCU_IPC_CLOVERVIEW] = {
.ipc_base = 0xff11c000, .ipc_base = 0xff11c000,
.i2c_base = 0xff12b000, .i2c_base = 0xff12b000,
.ipc_len = 0x100, .ipc_len = 0x100,
.i2c_len = 0x10, .i2c_len = 0x10,
.irq_mode = 1, .irq_mode = 1,
}, };
[SCU_IPC_TANGIER] = {
static struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = {
.ipc_base = 0xff009000, .ipc_base = 0xff009000,
.i2c_base = 0xff00d000, .i2c_base = 0xff00d000,
.ipc_len = 0x100, .ipc_len = 0x100,
.i2c_len = 0x10, .i2c_len = 0x10,
.irq_mode = 0, .irq_mode = 0,
},
}; };
static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id); static 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,15 +575,14 @@ static irqreturn_t ioc(int irq, void *dev_id)
*/ */
static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id) static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
{ {
int err, pid; int err;
struct intel_scu_ipc_pdata_t *pdata; struct intel_scu_ipc_pdata_t *pdata;
resource_size_t pci_resource; resource_size_t pci_resource;
if (ipcdev.pdev) /* We support only one SCU */ if (ipcdev.pdev) /* We support only one SCU */
return -EBUSY; return -EBUSY;
pid = id->driver_data; pdata = (struct intel_scu_ipc_pdata_t *)id->driver_data;
pdata = &intel_scu_ipc_pdata[pid];
ipcdev.pdev = pci_dev_get(dev); ipcdev.pdev = pci_dev_get(dev);
ipcdev.irq_mode = pdata->irq_mode; ipcdev.irq_mode = pdata->irq_mode;
...@@ -650,11 +641,21 @@ static void ipc_remove(struct pci_dev *pdev) ...@@ -650,11 +641,21 @@ static void ipc_remove(struct pci_dev *pdev)
} }
static DEFINE_PCI_DEVICE_TABLE(pci_ids) = { static DEFINE_PCI_DEVICE_TABLE(pci_ids) = {
{PCI_VDEVICE(INTEL, 0x082a), SCU_IPC_LINCROFT}, {
{PCI_VDEVICE(INTEL, 0x080e), SCU_IPC_PENWELL}, PCI_VDEVICE(INTEL, PCI_DEVICE_ID_LINCROFT),
{PCI_VDEVICE(INTEL, 0x08ea), SCU_IPC_CLOVERVIEW}, (kernel_ulong_t)&intel_scu_ipc_lincroft_pdata,
{PCI_VDEVICE(INTEL, 0x11a0), SCU_IPC_TANGIER}, }, {
{ 0,} PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL),
(kernel_ulong_t)&intel_scu_ipc_penwell_pdata,
}, {
PCI_VDEVICE(INTEL, PCI_DEVICE_ID_CLOVERVIEW),
(kernel_ulong_t)&intel_scu_ipc_penwell_pdata,
}, {
PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER),
(kernel_ulong_t)&intel_scu_ipc_tangier_pdata,
}, {
0,
}
}; };
MODULE_DEVICE_TABLE(pci, pci_ids); MODULE_DEVICE_TABLE(pci, pci_ids);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mxm-wmi.h>
#include <linux/acpi.h> #include <linux/acpi.h>
MODULE_AUTHOR("Dave Airlie"); MODULE_AUTHOR("Dave Airlie");
......
...@@ -789,7 +789,7 @@ static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value, ...@@ -789,7 +789,7 @@ static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
void *buffer, size_t buflen) void *buffer, size_t buflen)
{ {
int ret = 0; int ret = 0;
size_t len = len; size_t len;
union acpi_object *object = __call_snc_method(handle, name, value); union acpi_object *object = __call_snc_method(handle, name, value);
if (!object) if (!object)
......
...@@ -149,6 +149,7 @@ static const struct acpi_device_id toshiba_device_ids[] = { ...@@ -149,6 +149,7 @@ static const struct acpi_device_id toshiba_device_ids[] = {
MODULE_DEVICE_TABLE(acpi, toshiba_device_ids); MODULE_DEVICE_TABLE(acpi, toshiba_device_ids);
static const struct key_entry toshiba_acpi_keymap[] = { static const struct key_entry toshiba_acpi_keymap[] = {
{ KE_KEY, 0x9e, { KEY_RFKILL } },
{ KE_KEY, 0x101, { KEY_MUTE } }, { KE_KEY, 0x101, { KEY_MUTE } },
{ KE_KEY, 0x102, { KEY_ZOOMOUT } }, { KE_KEY, 0x102, { KEY_ZOOMOUT } },
{ KE_KEY, 0x103, { KEY_ZOOMIN } }, { KE_KEY, 0x103, { KEY_ZOOMIN } },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment