57 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Header file for hmc5843 driver4 *5 * Split from hmc5843.c6 * Copyright (C) Josef Gajdusek <atx@atx.name>7 */8 9#ifndef HMC5843_CORE_H10#define HMC5843_CORE_H11 12#include <linux/regmap.h>13#include <linux/iio/iio.h>14 15#define HMC5843_CONFIG_REG_A 0x0016#define HMC5843_CONFIG_REG_B 0x0117#define HMC5843_MODE_REG 0x0218#define HMC5843_DATA_OUT_MSB_REGS 0x0319#define HMC5843_STATUS_REG 0x0920#define HMC5843_ID_REG 0x0a21#define HMC5843_ID_END 0x0c22 23enum hmc5843_ids {24 HMC5843_ID,25 HMC5883_ID,26 HMC5883L_ID,27 HMC5983_ID,28};29 30/**31 * struct hmc5843_data - device specific data32 * @dev: actual device33 * @lock: update and read regmap data34 * @regmap: hardware access register maps35 * @variant: describe chip variants36 * @scan: buffer to pack data for passing to37 * iio_push_to_buffers_with_timestamp()38 */39struct hmc5843_data {40 struct device *dev;41 struct mutex lock;42 struct regmap *regmap;43 const struct hmc5843_chip_info *variant;44 struct iio_mount_matrix orientation;45 struct {46 __be16 chans[3];47 s64 timestamp __aligned(8);48 } scan;49};50 51int hmc5843_common_probe(struct device *dev, struct regmap *regmap,52 enum hmc5843_ids id, const char *name);53void hmc5843_common_remove(struct device *dev);54 55extern const struct dev_pm_ops hmc5843_pm_ops;56#endif /* HMC5843_CORE_H */57