Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / staging / iio / magnetometer / hmc5843.h
1 /*
2  * Header file for hmc5843 driver
3  *
4  * Split from hmc5843.c
5  * Copyright (C) Josef Gajdusek <atx@atx.name>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * */
12
13 #ifndef HMC5843_CORE_H
14 #define HMC5843_CORE_H
15
16 #include <linux/regmap.h>
17 #include <linux/iio/iio.h>
18
19 #define HMC5843_CONFIG_REG_A                    0x00
20 #define HMC5843_CONFIG_REG_B                    0x01
21 #define HMC5843_MODE_REG                        0x02
22 #define HMC5843_DATA_OUT_MSB_REGS               0x03
23 #define HMC5843_STATUS_REG                      0x09
24 #define HMC5843_ID_REG                          0x0a
25 #define HMC5843_ID_END                          0x0c
26
27 enum hmc5843_ids {
28         HMC5843_ID,
29         HMC5883_ID,
30         HMC5883L_ID,
31         HMC5983_ID,
32 };
33
34 /**
35  * struct hcm5843_data  - device specific data
36  * @dev:                actual device
37  * @lock:               update and read regmap data
38  * @regmap:             hardware access register maps
39  * @variant:            describe chip variants
40  * @buffer:             3x 16-bit channels + padding + 64-bit timestamp
41  **/
42 struct hmc5843_data {
43         struct device *dev;
44         struct mutex lock;
45         struct regmap *regmap;
46         const struct hmc5843_chip_info *variant;
47         __be16 buffer[8];
48 };
49
50 int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
51                          enum hmc5843_ids id);
52 int hmc5843_common_remove(struct device *dev);
53
54 int hmc5843_common_suspend(struct device *dev);
55 int hmc5843_common_resume(struct device *dev);
56
57 #ifdef CONFIG_PM_SLEEP
58 static SIMPLE_DEV_PM_OPS(hmc5843_pm_ops,
59                 hmc5843_common_suspend,
60                 hmc5843_common_resume);
61 #define HMC5843_PM_OPS (&hmc5843_pm_ops)
62 #else
63 #define HMC5843_PM_OPS NULL
64 #endif
65
66 #endif /* HMC5843_CORE_H */