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