platform-drivers-x86 for 3.18-3

Remove hp_accel events from keyboard bus stream.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJUZYFKAAoJEKbMaAwKp364rjAH/jFoEj0sJa1nMRS4OsIwOuf+
 zbh5wv9rLIsGI4lrvI35bUY+RXAudf5Ih4n0n6XwXvE8GfMjDCbKelRDdbBBhOcL
 knIcypuWKwrcl5mIp71ro8twm+dkFO7i6euts4S44wyBc5f43eYJfKdQ/BFsr5l+
 1187LU1TjZN+60no/bKoaoE1xHwd7dyqFmMSJJT9CBroa8pTRoyunlh6bxq9Couf
 CMaM79lsIDO6Jy+hFbos1HPCC4Cd7tHsQnHZqSPNCb49uQmz394pZhkIjV2T8nYa
 sdCUNtzOG/eRmVlUvZoV0TcvwEEtZMdYfq8erPa/cHbZxE61ln5WwEU7q2goOXk=
 =bk2k
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v3.18-3' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86

Pull x86 platform drivers fixlets from Darren Hart:
 "Just two patches to remove hp_accel events from the keyboard bus
  stream via an i8042 filter"

* tag 'platform-drivers-x86-v3.18-3' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86:
  platform: hp_accel: Add SERIO_I8042 as a dependency since it now includes i8042.h/serio.h
  platform: hp_accel: add a i8042 filter to remove HPQ6000 data from kb bus stream
This commit is contained in:
Linus Torvalds 2014-11-14 14:20:46 -08:00
commit 5ae93760cb
2 changed files with 45 additions and 0 deletions

View File

@ -202,6 +202,7 @@ config TC1100_WMI
config HP_ACCEL
tristate "HP laptop accelerometer"
depends on INPUT && ACPI
depends on SERIO_I8042
select SENSORS_LIS3LV02D
select NEW_LEDS
select LEDS_CLASS

View File

@ -37,6 +37,8 @@
#include <linux/leds.h>
#include <linux/atomic.h>
#include <linux/acpi.h>
#include <linux/i8042.h>
#include <linux/serio.h>
#include "../../misc/lis3lv02d/lis3lv02d.h"
#define DRIVER_NAME "hp_accel"
@ -73,6 +75,13 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev,
/* HP-specific accelerometer driver ------------------------------------ */
/* e0 25, e0 26, e0 27, e0 28 are scan codes that the accelerometer with acpi id
* HPQ6000 sends through the keyboard bus */
#define ACCEL_1 0x25
#define ACCEL_2 0x26
#define ACCEL_3 0x27
#define ACCEL_4 0x28
/* For automatic insertion of the module */
static const struct acpi_device_id lis3lv02d_device_ids[] = {
{"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */
@ -294,6 +303,35 @@ static void lis3lv02d_enum_resources(struct acpi_device *device)
printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n");
}
static bool hp_accel_i8042_filter(unsigned char data, unsigned char str,
struct serio *port)
{
static bool extended;
if (str & I8042_STR_AUXDATA)
return false;
if (data == 0xe0) {
extended = true;
return true;
} else if (unlikely(extended)) {
extended = false;
switch (data) {
case ACCEL_1:
case ACCEL_2:
case ACCEL_3:
case ACCEL_4:
return true;
default:
serio_interrupt(port, 0xe0, 0);
return false;
}
}
return false;
}
static int lis3lv02d_add(struct acpi_device *device)
{
int ret;
@ -326,6 +364,11 @@ static int lis3lv02d_add(struct acpi_device *device)
if (ret)
return ret;
/* filter to remove HPQ6000 accelerometer data
* from keyboard bus stream */
if (strstr(dev_name(&device->dev), "HPQ6000"))
i8042_install_filter(hp_accel_i8042_filter);
INIT_WORK(&hpled_led.work, delayed_set_status_worker);
ret = led_classdev_register(NULL, &hpled_led.led_classdev);
if (ret) {
@ -343,6 +386,7 @@ static int lis3lv02d_remove(struct acpi_device *device)
if (!device)
return -EINVAL;
i8042_remove_filter(hp_accel_i8042_filter);
lis3lv02d_joystick_disable(&lis3_dev);
lis3lv02d_poweroff(&lis3_dev);