diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/iio/light/cm3391.c | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/drivers/iio/light/cm3391.c b/drivers/iio/light/cm3391.c index 8049446d98a..b6461852a57 100644 --- a/drivers/iio/light/cm3391.c +++ b/drivers/iio/light/cm3391.c @@ -828,6 +828,28 @@ static int cm3391_remove(struct i2c_client *client)  	return 0;  } +static int old_config = CM3391_CMD_DEFAULT; + +static int cm3391_suspend(struct i2c_client *client, pm_message_t mesg) +{ +	old_config = i2c_smbus_read_word_data(client,  +					      CM3391_REG_ADDR_CMD); +	/* Disable device */ +	i2c_smbus_write_word_data(client, CM3391_REG_ADDR_CMD, +				  CM3391_CMD_CS_DISABLE); +	 +	return 0; +} + +static int cm3391_resume(struct i2c_client *client) +{ +	/* enable device */ +	i2c_smbus_write_word_data(client, CM3391_REG_ADDR_CMD, +				  old_config); +	 +	return 0; +} +  static const struct i2c_device_id cm3391_id[] = {  	{ "cm3391", 0},  	{ } @@ -861,6 +883,8 @@ static struct i2c_driver cm3391_driver = {  	.id_table	= cm3391_id,  	.probe		= cm3391_probe,  	.remove		= cm3391_remove, +	.suspend        = cm3391_suspend, +	.resume         = cm3391_resume,  };  module_i2c_driver(cm3391_driver); |