diff options
author | Samu Onkalo <samu.p.onkalo@nokia.com> | 2010-10-22 07:57:24 -0400 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2010-10-25 17:11:38 -0400 |
commit | f9deb41f91c41d9d91a24c84a555ec7fe82620da (patch) | |
tree | c301a8324c3bbc779b752cdf47236575a87a26d2 /drivers/hwmon/lis3lv02d.h | |
parent | 2a346996626ecbb4269c239e9ff7372a182907e9 (diff) |
hwmon: lis3: regulator control
Based on pm_runtime control, turn lis3 regulators on and off.
Perform context save and restore on transitions.
Feature is optional and must be enabled in platform data.
Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/lis3lv02d.h')
-rw-r--r-- | drivers/hwmon/lis3lv02d.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h index 633cf1debc52..c5c063de2f48 100644 --- a/drivers/hwmon/lis3lv02d.h +++ b/drivers/hwmon/lis3lv02d.h | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/input-polldev.h> | 22 | #include <linux/input-polldev.h> |
23 | #include <linux/regulator/consumer.h> | ||
23 | 24 | ||
24 | /* | 25 | /* |
25 | * This driver tries to support the "digital" accelerometer chips from | 26 | * This driver tries to support the "digital" accelerometer chips from |
@@ -223,11 +224,17 @@ enum lis3lv02d_click_src_8b { | |||
223 | CLICK_IA = 0x40, | 224 | CLICK_IA = 0x40, |
224 | }; | 225 | }; |
225 | 226 | ||
227 | enum lis3lv02d_reg_state { | ||
228 | LIS3_REG_OFF = 0x00, | ||
229 | LIS3_REG_ON = 0x01, | ||
230 | }; | ||
231 | |||
226 | union axis_conversion { | 232 | union axis_conversion { |
227 | struct { | 233 | struct { |
228 | int x, y, z; | 234 | int x, y, z; |
229 | }; | 235 | }; |
230 | int as_array[3]; | 236 | int as_array[3]; |
237 | |||
231 | }; | 238 | }; |
232 | 239 | ||
233 | struct lis3lv02d { | 240 | struct lis3lv02d { |
@@ -236,8 +243,13 @@ struct lis3lv02d { | |||
236 | int (*init) (struct lis3lv02d *lis3); | 243 | int (*init) (struct lis3lv02d *lis3); |
237 | int (*write) (struct lis3lv02d *lis3, int reg, u8 val); | 244 | int (*write) (struct lis3lv02d *lis3, int reg, u8 val); |
238 | int (*read) (struct lis3lv02d *lis3, int reg, u8 *ret); | 245 | int (*read) (struct lis3lv02d *lis3, int reg, u8 *ret); |
246 | int (*reg_ctrl) (struct lis3lv02d *lis3, bool state); | ||
239 | 247 | ||
240 | int *odrs; /* Supported output data rates */ | 248 | int *odrs; /* Supported output data rates */ |
249 | u8 *regs; /* Regs to store / restore */ | ||
250 | int regs_size; | ||
251 | u8 *reg_cache; | ||
252 | bool regs_stored; | ||
241 | u8 odr_mask; /* ODR bit mask */ | 253 | u8 odr_mask; /* ODR bit mask */ |
242 | u8 whoami; /* indicates measurement precision */ | 254 | u8 whoami; /* indicates measurement precision */ |
243 | s16 (*read_data) (struct lis3lv02d *lis3, int reg); | 255 | s16 (*read_data) (struct lis3lv02d *lis3, int reg); |
@@ -250,6 +262,7 @@ struct lis3lv02d { | |||
250 | 262 | ||
251 | struct input_polled_dev *idev; /* input device */ | 263 | struct input_polled_dev *idev; /* input device */ |
252 | struct platform_device *pdev; /* platform device */ | 264 | struct platform_device *pdev; /* platform device */ |
265 | struct regulator_bulk_data regulators[2]; | ||
253 | atomic_t count; /* interrupt count after last read */ | 266 | atomic_t count; /* interrupt count after last read */ |
254 | union axis_conversion ac; /* hw -> logical axis */ | 267 | union axis_conversion ac; /* hw -> logical axis */ |
255 | int mapped_btns[3]; | 268 | int mapped_btns[3]; |