platform/x86: asus-laptop: switch to using polled mode of input devices
We have added polled mode to the normal input devices with the intent of retiring input_polled_dev. This converts Asus laptop driver to use the polling mode of standard input devices and removes dependency on INPUT_POLLDEV. Also removed no longed needed set_bit(EV_ABS, ...) as input_set_abs_oarams() does it for us. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
10b65e2915
commit
2011176d8a
|
@ -94,7 +94,6 @@ config ASUS_LAPTOP
|
||||||
depends on RFKILL || RFKILL = n
|
depends on RFKILL || RFKILL = n
|
||||||
depends on ACPI_VIDEO || ACPI_VIDEO = n
|
depends on ACPI_VIDEO || ACPI_VIDEO = n
|
||||||
select INPUT_SPARSEKMAP
|
select INPUT_SPARSEKMAP
|
||||||
select INPUT_POLLDEV
|
|
||||||
---help---
|
---help---
|
||||||
This is a driver for Asus laptops, Lenovo SL and the Pegatron
|
This is a driver for Asus laptops, Lenovo SL and the Pegatron
|
||||||
Lucid tablet. It may also support some MEDION, JVC or VICTOR
|
Lucid tablet. It may also support some MEDION, JVC or VICTOR
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/input/sparse-keymap.h>
|
#include <linux/input/sparse-keymap.h>
|
||||||
#include <linux/input-polldev.h>
|
|
||||||
#include <linux/rfkill.h>
|
#include <linux/rfkill.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/dmi.h>
|
#include <linux/dmi.h>
|
||||||
|
@ -244,7 +243,7 @@ struct asus_laptop {
|
||||||
|
|
||||||
struct input_dev *inputdev;
|
struct input_dev *inputdev;
|
||||||
struct key_entry *keymap;
|
struct key_entry *keymap;
|
||||||
struct input_polled_dev *pega_accel_poll;
|
struct input_dev *pega_accel_poll;
|
||||||
|
|
||||||
struct asus_led wled;
|
struct asus_led wled;
|
||||||
struct asus_led bled;
|
struct asus_led bled;
|
||||||
|
@ -446,9 +445,9 @@ static int pega_acc_axis(struct asus_laptop *asus, int curr, char *method)
|
||||||
return clamp_val((short)val, -PEGA_ACC_CLAMP, PEGA_ACC_CLAMP);
|
return clamp_val((short)val, -PEGA_ACC_CLAMP, PEGA_ACC_CLAMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pega_accel_poll(struct input_polled_dev *ipd)
|
static void pega_accel_poll(struct input_dev *input)
|
||||||
{
|
{
|
||||||
struct device *parent = ipd->input->dev.parent;
|
struct device *parent = input->dev.parent;
|
||||||
struct asus_laptop *asus = dev_get_drvdata(parent);
|
struct asus_laptop *asus = dev_get_drvdata(parent);
|
||||||
|
|
||||||
/* In some cases, the very first call to poll causes a
|
/* In some cases, the very first call to poll causes a
|
||||||
|
@ -457,10 +456,10 @@ static void pega_accel_poll(struct input_polled_dev *ipd)
|
||||||
* device, and perhaps a firmware bug. Fake the first report. */
|
* device, and perhaps a firmware bug. Fake the first report. */
|
||||||
if (!asus->pega_acc_live) {
|
if (!asus->pega_acc_live) {
|
||||||
asus->pega_acc_live = true;
|
asus->pega_acc_live = true;
|
||||||
input_report_abs(ipd->input, ABS_X, 0);
|
input_report_abs(input, ABS_X, 0);
|
||||||
input_report_abs(ipd->input, ABS_Y, 0);
|
input_report_abs(input, ABS_Y, 0);
|
||||||
input_report_abs(ipd->input, ABS_Z, 0);
|
input_report_abs(input, ABS_Z, 0);
|
||||||
input_sync(ipd->input);
|
input_sync(input);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,25 +470,24 @@ static void pega_accel_poll(struct input_polled_dev *ipd)
|
||||||
/* Note transform, convert to "right/up/out" in the native
|
/* Note transform, convert to "right/up/out" in the native
|
||||||
* landscape orientation (i.e. the vector is the direction of
|
* landscape orientation (i.e. the vector is the direction of
|
||||||
* "real up" in the device's cartiesian coordinates). */
|
* "real up" in the device's cartiesian coordinates). */
|
||||||
input_report_abs(ipd->input, ABS_X, -asus->pega_acc_x);
|
input_report_abs(input, ABS_X, -asus->pega_acc_x);
|
||||||
input_report_abs(ipd->input, ABS_Y, -asus->pega_acc_y);
|
input_report_abs(input, ABS_Y, -asus->pega_acc_y);
|
||||||
input_report_abs(ipd->input, ABS_Z, asus->pega_acc_z);
|
input_report_abs(input, ABS_Z, asus->pega_acc_z);
|
||||||
input_sync(ipd->input);
|
input_sync(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pega_accel_exit(struct asus_laptop *asus)
|
static void pega_accel_exit(struct asus_laptop *asus)
|
||||||
{
|
{
|
||||||
if (asus->pega_accel_poll) {
|
if (asus->pega_accel_poll) {
|
||||||
input_unregister_polled_device(asus->pega_accel_poll);
|
input_unregister_device(asus->pega_accel_poll);
|
||||||
input_free_polled_device(asus->pega_accel_poll);
|
asus->pega_accel_poll = NULL;
|
||||||
}
|
}
|
||||||
asus->pega_accel_poll = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pega_accel_init(struct asus_laptop *asus)
|
static int pega_accel_init(struct asus_laptop *asus)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct input_polled_dev *ipd;
|
struct input_dev *input;
|
||||||
|
|
||||||
if (!asus->is_pega_lucid)
|
if (!asus->is_pega_lucid)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -499,37 +497,39 @@ static int pega_accel_init(struct asus_laptop *asus)
|
||||||
acpi_check_handle(asus->handle, METHOD_XLRZ, NULL))
|
acpi_check_handle(asus->handle, METHOD_XLRZ, NULL))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
ipd = input_allocate_polled_device();
|
input = input_allocate_device();
|
||||||
if (!ipd)
|
if (!input)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ipd->poll = pega_accel_poll;
|
input->name = PEGA_ACCEL_DESC;
|
||||||
ipd->poll_interval = 125;
|
input->phys = PEGA_ACCEL_NAME "/input0";
|
||||||
ipd->poll_interval_min = 50;
|
input->dev.parent = &asus->platform_device->dev;
|
||||||
ipd->poll_interval_max = 2000;
|
input->id.bustype = BUS_HOST;
|
||||||
|
|
||||||
ipd->input->name = PEGA_ACCEL_DESC;
|
input_set_abs_params(input, ABS_X,
|
||||||
ipd->input->phys = PEGA_ACCEL_NAME "/input0";
|
|
||||||
ipd->input->dev.parent = &asus->platform_device->dev;
|
|
||||||
ipd->input->id.bustype = BUS_HOST;
|
|
||||||
|
|
||||||
set_bit(EV_ABS, ipd->input->evbit);
|
|
||||||
input_set_abs_params(ipd->input, ABS_X,
|
|
||||||
-PEGA_ACC_CLAMP, PEGA_ACC_CLAMP, 0, 0);
|
-PEGA_ACC_CLAMP, PEGA_ACC_CLAMP, 0, 0);
|
||||||
input_set_abs_params(ipd->input, ABS_Y,
|
input_set_abs_params(input, ABS_Y,
|
||||||
-PEGA_ACC_CLAMP, PEGA_ACC_CLAMP, 0, 0);
|
-PEGA_ACC_CLAMP, PEGA_ACC_CLAMP, 0, 0);
|
||||||
input_set_abs_params(ipd->input, ABS_Z,
|
input_set_abs_params(input, ABS_Z,
|
||||||
-PEGA_ACC_CLAMP, PEGA_ACC_CLAMP, 0, 0);
|
-PEGA_ACC_CLAMP, PEGA_ACC_CLAMP, 0, 0);
|
||||||
|
|
||||||
err = input_register_polled_device(ipd);
|
err = input_setup_polling(input, pega_accel_poll);
|
||||||
if (err)
|
if (err)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
asus->pega_accel_poll = ipd;
|
input_set_poll_interval(input, 125);
|
||||||
|
input_set_min_poll_interval(input, 50);
|
||||||
|
input_set_max_poll_interval(input, 2000);
|
||||||
|
|
||||||
|
err = input_register_device(input);
|
||||||
|
if (err)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
asus->pega_accel_poll = input;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
input_free_polled_device(ipd);
|
input_free_device(input);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,8 +1550,7 @@ static void asus_acpi_notify(struct acpi_device *device, u32 event)
|
||||||
|
|
||||||
/* Accelerometer "coarse orientation change" event */
|
/* Accelerometer "coarse orientation change" event */
|
||||||
if (asus->pega_accel_poll && event == 0xEA) {
|
if (asus->pega_accel_poll && event == 0xEA) {
|
||||||
kobject_uevent(&asus->pega_accel_poll->input->dev.kobj,
|
kobject_uevent(&asus->pega_accel_poll->dev.kobj, KOBJ_CHANGE);
|
||||||
KOBJ_CHANGE);
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue