1
2
3
4
5
6
7
8
9 #ifndef HMC5843_CORE_H
10 #define HMC5843_CORE_H
11
12 #include <linux/regmap.h>
13 #include <linux/iio/iio.h>
14
15 #define HMC5843_CONFIG_REG_A 0x00
16 #define HMC5843_CONFIG_REG_B 0x01
17 #define HMC5843_MODE_REG 0x02
18 #define HMC5843_DATA_OUT_MSB_REGS 0x03
19 #define HMC5843_STATUS_REG 0x09
20 #define HMC5843_ID_REG 0x0a
21 #define HMC5843_ID_END 0x0c
22
23 enum hmc5843_ids {
24 HMC5843_ID,
25 HMC5883_ID,
26 HMC5883L_ID,
27 HMC5983_ID,
28 };
29
30
31
32
33
34
35
36
37
38 struct hmc5843_data {
39 struct device *dev;
40 struct mutex lock;
41 struct regmap *regmap;
42 const struct hmc5843_chip_info *variant;
43 struct iio_mount_matrix orientation;
44 __be16 buffer[8];
45 };
46
47 int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
48 enum hmc5843_ids id, const char *name);
49 int hmc5843_common_remove(struct device *dev);
50
51 int hmc5843_common_suspend(struct device *dev);
52 int hmc5843_common_resume(struct device *dev);
53
54 #ifdef CONFIG_PM_SLEEP
55 static SIMPLE_DEV_PM_OPS(hmc5843_pm_ops,
56 hmc5843_common_suspend,
57 hmc5843_common_resume);
58 #define HMC5843_PM_OPS (&hmc5843_pm_ops)
59 #else
60 #define HMC5843_PM_OPS NULL
61 #endif
62
63 #endif