diff options
Diffstat (limited to 'drivers/input/mouse/synaptics_i2c.c')
| -rw-r--r-- | drivers/input/mouse/synaptics_i2c.c | 54 | 
1 files changed, 20 insertions, 34 deletions
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c index 0ae62f0bcb3..ad822608f6e 100644 --- a/drivers/input/mouse/synaptics_i2c.c +++ b/drivers/input/mouse/synaptics_i2c.c @@ -18,6 +18,7 @@  #include <linux/delay.h>  #include <linux/workqueue.h>  #include <linux/slab.h> +#include <linux/pm.h>  #define DRIVER_NAME		"synaptics_i2c"  /* maximum product id is 15 characters */ @@ -184,17 +185,17 @@  #define NO_DATA_SLEEP_MSECS	(MSEC_PER_SEC / 4)  /* Control touchpad's No Deceleration option */ -static int no_decel = 1; +static bool no_decel = 1;  module_param(no_decel, bool, 0644);  MODULE_PARM_DESC(no_decel, "No Deceleration. Default = 1 (on)");  /* Control touchpad's Reduced Reporting option */ -static int reduce_report; +static bool reduce_report;  module_param(reduce_report, bool, 0644);  MODULE_PARM_DESC(reduce_report, "Reduced Reporting. Default = 0 (off)");  /* Control touchpad's No Filter option */ -static int no_filter; +static bool no_filter;  module_param(no_filter, bool, 0644);  MODULE_PARM_DESC(no_filter, "No Filter. Default = 0 (off)"); @@ -375,12 +376,7 @@ static void synaptics_i2c_reschedule_work(struct synaptics_i2c *touch,  	spin_lock_irqsave(&touch->lock, flags); -	/* -	 * If work is already scheduled then subsequent schedules will not -	 * change the scheduled time that's why we have to cancel it first. -	 */ -	__cancel_delayed_work(&touch->dwork); -	schedule_delayed_work(&touch->dwork, delay); +	mod_delayed_work(system_wq, &touch->dwork, delay);  	spin_unlock_irqrestore(&touch->lock, flags);  } @@ -461,7 +457,7 @@ static void synaptics_i2c_work_handler(struct work_struct *work)  	 * While interrupt driven, there is no real need to poll the device.  	 * But touchpads are very sensitive, so there could be errors  	 * related to physical environment and the attention line isn't -	 * neccesarily asserted. In such case we can lose the touchpad. +	 * necessarily asserted. In such case we can lose the touchpad.  	 * We poll the device once in THREAD_IRQ_SLEEP_SECS and  	 * if error is detected, we try to reset and reconfigure the touchpad.  	 */ @@ -539,7 +535,7 @@ static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *clien  	return touch;  } -static int __devinit synaptics_i2c_probe(struct i2c_client *client, +static int synaptics_i2c_probe(struct i2c_client *client,  			       const struct i2c_device_id *dev_id)  {  	int ret; @@ -569,7 +565,7 @@ static int __devinit synaptics_i2c_probe(struct i2c_client *client,  			 "Requesting IRQ: %d\n", touch->client->irq);  		ret = request_irq(touch->client->irq, synaptics_i2c_irq, -				  IRQF_DISABLED|IRQ_TYPE_EDGE_FALLING, +				  IRQ_TYPE_EDGE_FALLING,  				  DRIVER_NAME, touch);  		if (ret) {  			dev_warn(&touch->client->dev, @@ -605,7 +601,7 @@ err_mem_free:  	return ret;  } -static int __devexit synaptics_i2c_remove(struct i2c_client *client) +static int synaptics_i2c_remove(struct i2c_client *client)  {  	struct synaptics_i2c *touch = i2c_get_clientdata(client); @@ -618,9 +614,10 @@ static int __devexit synaptics_i2c_remove(struct i2c_client *client)  	return 0;  } -#ifdef CONFIG_PM -static int synaptics_i2c_suspend(struct i2c_client *client, pm_message_t mesg) +#ifdef CONFIG_PM_SLEEP +static int synaptics_i2c_suspend(struct device *dev)  { +	struct i2c_client *client = to_i2c_client(dev);  	struct synaptics_i2c *touch = i2c_get_clientdata(client);  	cancel_delayed_work_sync(&touch->dwork); @@ -631,9 +628,10 @@ static int synaptics_i2c_suspend(struct i2c_client *client, pm_message_t mesg)  	return 0;  } -static int synaptics_i2c_resume(struct i2c_client *client) +static int synaptics_i2c_resume(struct device *dev)  {  	int ret; +	struct i2c_client *client = to_i2c_client(dev);  	struct synaptics_i2c *touch = i2c_get_clientdata(client);  	ret = synaptics_i2c_reset_config(client); @@ -645,11 +643,11 @@ static int synaptics_i2c_resume(struct i2c_client *client)  	return 0;  } -#else -#define synaptics_i2c_suspend	NULL -#define synaptics_i2c_resume	NULL  #endif +static SIMPLE_DEV_PM_OPS(synaptics_i2c_pm, synaptics_i2c_suspend, +			 synaptics_i2c_resume); +  static const struct i2c_device_id synaptics_i2c_id_table[] = {  	{ "synaptics_i2c", 0 },  	{ }, @@ -660,28 +658,16 @@ static struct i2c_driver synaptics_i2c_driver = {  	.driver = {  		.name	= DRIVER_NAME,  		.owner	= THIS_MODULE, +		.pm	= &synaptics_i2c_pm,  	},  	.probe		= synaptics_i2c_probe, -	.remove		= __devexit_p(synaptics_i2c_remove), +	.remove		= synaptics_i2c_remove, -	.suspend	= synaptics_i2c_suspend, -	.resume		= synaptics_i2c_resume,  	.id_table	= synaptics_i2c_id_table,  }; -static int __init synaptics_i2c_init(void) -{ -	return i2c_add_driver(&synaptics_i2c_driver); -} - -static void __exit synaptics_i2c_exit(void) -{ -	i2c_del_driver(&synaptics_i2c_driver); -} - -module_init(synaptics_i2c_init); -module_exit(synaptics_i2c_exit); +module_i2c_driver(synaptics_i2c_driver);  MODULE_DESCRIPTION("Synaptics I2C touchpad driver");  MODULE_AUTHOR("Mike Rapoport, Igor Grinberg, Compulab");  | 
