2019-06-04 16:11:33 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2014-07-22 23:01:00 +08:00
|
|
|
/*
|
|
|
|
* Header file for hmc5843 driver
|
|
|
|
*
|
|
|
|
* Split from hmc5843.c
|
|
|
|
* Copyright (C) Josef Gajdusek <atx@atx.name>
|
2016-02-08 06:21:50 +08:00
|
|
|
*/
|
2014-07-22 23:01:00 +08:00
|
|
|
|
|
|
|
#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,
|
2014-07-22 23:02:00 +08:00
|
|
|
HMC5983_ID,
|
2014-07-22 23:01:00 +08:00
|
|
|
};
|
|
|
|
|
2015-03-21 00:09:43 +08:00
|
|
|
/**
|
2018-09-20 21:49:46 +08:00
|
|
|
* struct hmc5843_data - device specific data
|
2015-03-21 00:09:43 +08:00
|
|
|
* @dev: actual device
|
|
|
|
* @lock: update and read regmap data
|
|
|
|
* @regmap: hardware access register maps
|
|
|
|
* @variant: describe chip variants
|
2021-05-02 01:01:17 +08:00
|
|
|
* @scan: buffer to pack data for passing to
|
|
|
|
* iio_push_to_buffers_with_timestamp()
|
2016-02-08 06:21:50 +08:00
|
|
|
*/
|
2014-07-22 23:01:00 +08:00
|
|
|
struct hmc5843_data {
|
|
|
|
struct device *dev;
|
|
|
|
struct mutex lock;
|
|
|
|
struct regmap *regmap;
|
|
|
|
const struct hmc5843_chip_info *variant;
|
2019-02-22 01:02:53 +08:00
|
|
|
struct iio_mount_matrix orientation;
|
2021-05-02 01:01:17 +08:00
|
|
|
struct {
|
|
|
|
__be16 chans[3];
|
|
|
|
s64 timestamp __aligned(8);
|
|
|
|
} scan;
|
2014-07-22 23:01:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
|
2015-08-12 21:25:46 +08:00
|
|
|
enum hmc5843_ids id, const char *name);
|
2021-10-14 04:32:21 +08:00
|
|
|
void hmc5843_common_remove(struct device *dev);
|
2014-07-22 23:01:00 +08:00
|
|
|
|
2022-08-08 02:45:34 +08:00
|
|
|
extern const struct dev_pm_ops hmc5843_pm_ops;
|
2014-07-22 23:01:00 +08:00
|
|
|
#endif /* HMC5843_CORE_H */
|