summaryrefslogtreecommitdiffstats
path: root/drivers/iio/magnetometer/hmc5843.h
diff options
context:
space:
mode:
authorCristina Moraru2016-02-14 23:37:39 +0100
committerJonathan Cameron2016-02-24 21:40:39 +0100
commit7247645f686584552ec0f8ade7267bf7a4907624 (patch)
treeea9105eab9e0c8562637656dabcd03e8fa26bb38 /drivers/iio/magnetometer/hmc5843.h
parentiio: hmc5843: Add ABI documentation file for hmc5843 (diff)
downloadkernel-qcow2-linux-7247645f686584552ec0f8ade7267bf7a4907624.tar.gz
kernel-qcow2-linux-7247645f686584552ec0f8ade7267bf7a4907624.tar.xz
kernel-qcow2-linux-7247645f686584552ec0f8ade7267bf7a4907624.zip
iio: hmc5843: Move hmc5843 out of staging
This patch moves hmc5843 driver from staging/iio/magnetometer to iio/magnetometer, updates the corresponding Makefiles and moves the hmc5843* entries to the 'Industrial I/O support -> Magnetometer sensors' menu. Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com> Cc: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/magnetometer/hmc5843.h')
-rw-r--r--drivers/iio/magnetometer/hmc5843.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/iio/magnetometer/hmc5843.h b/drivers/iio/magnetometer/hmc5843.h
new file mode 100644
index 000000000000..76a5d7484d8d
--- /dev/null
+++ b/drivers/iio/magnetometer/hmc5843.h
@@ -0,0 +1,65 @@
+/*
+ * Header file for hmc5843 driver
+ *
+ * Split from hmc5843.c
+ * Copyright (C) Josef Gajdusek <atx@atx.name>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef HMC5843_CORE_H
+#define HMC5843_CORE_H
+
+#include <linux/regmap.h>
+#include <linux/iio/iio.h>
+
+#define HMC5843_CONFIG_REG_A 0x00
+#define HMC5843_CONFIG_REG_B 0x01
+#define HMC5843_MODE_REG 0x02
+#define HMC5843_DATA_OUT_MSB_REGS 0x03
+#define HMC5843_STATUS_REG 0x09
+#define HMC5843_ID_REG 0x0a
+#define HMC5843_ID_END 0x0c
+
+enum hmc5843_ids {
+ HMC5843_ID,
+ HMC5883_ID,
+ HMC5883L_ID,
+ HMC5983_ID,
+};
+
+/**
+ * struct hcm5843_data - device specific data
+ * @dev: actual device
+ * @lock: update and read regmap data
+ * @regmap: hardware access register maps
+ * @variant: describe chip variants
+ * @buffer: 3x 16-bit channels + padding + 64-bit timestamp
+ */
+struct hmc5843_data {
+ struct device *dev;
+ struct mutex lock;
+ struct regmap *regmap;
+ const struct hmc5843_chip_info *variant;
+ __be16 buffer[8];
+};
+
+int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
+ enum hmc5843_ids id, const char *name);
+int hmc5843_common_remove(struct device *dev);
+
+int hmc5843_common_suspend(struct device *dev);
+int hmc5843_common_resume(struct device *dev);
+
+#ifdef CONFIG_PM_SLEEP
+static SIMPLE_DEV_PM_OPS(hmc5843_pm_ops,
+ hmc5843_common_suspend,
+ hmc5843_common_resume);
+#define HMC5843_PM_OPS (&hmc5843_pm_ops)
+#else
+#define HMC5843_PM_OPS NULL
+#endif
+
+#endif /* HMC5843_CORE_H */