zpa2326.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Murata ZPA2326 pressure and temperature sensor IIO driver
  4. *
  5. * Copyright (c) 2016 Parrot S.A.
  6. *
  7. * Author: Gregor Boirie <[email protected]>
  8. */
  9. #ifndef _ZPA2326_H
  10. #define _ZPA2326_H
  11. /* Register map. */
  12. #define ZPA2326_REF_P_XL_REG (0x8)
  13. #define ZPA2326_REF_P_L_REG (0x9)
  14. #define ZPA2326_REF_P_H_REG (0xa)
  15. #define ZPA2326_DEVICE_ID_REG (0xf)
  16. #define ZPA2326_DEVICE_ID (0xb9)
  17. #define ZPA2326_RES_CONF_REG (0x10)
  18. #define ZPA2326_CTRL_REG0_REG (0x20)
  19. #define ZPA2326_CTRL_REG0_ONE_SHOT BIT(0)
  20. #define ZPA2326_CTRL_REG0_ENABLE BIT(1)
  21. #define ZPA2326_CTRL_REG1_REG (0x21)
  22. #define ZPA2326_CTRL_REG1_MASK_DATA_READY BIT(2)
  23. #define ZPA2326_CTRL_REG2_REG (0x22)
  24. #define ZPA2326_CTRL_REG2_SWRESET BIT(2)
  25. #define ZPA2326_CTRL_REG3_REG (0x23)
  26. #define ZPA2326_CTRL_REG3_ODR_SHIFT (4)
  27. #define ZPA2326_CTRL_REG3_ENABLE_MEAS BIT(7)
  28. #define ZPA2326_INT_SOURCE_REG (0x24)
  29. #define ZPA2326_INT_SOURCE_DATA_READY BIT(2)
  30. #define ZPA2326_THS_P_LOW_REG (0x25)
  31. #define ZPA2326_THS_P_HIGH_REG (0x26)
  32. #define ZPA2326_STATUS_REG (0x27)
  33. #define ZPA2326_STATUS_P_DA BIT(1)
  34. #define ZPA2326_STATUS_FIFO_E BIT(2)
  35. #define ZPA2326_STATUS_P_OR BIT(5)
  36. #define ZPA2326_PRESS_OUT_XL_REG (0x28)
  37. #define ZPA2326_PRESS_OUT_L_REG (0x29)
  38. #define ZPA2326_PRESS_OUT_H_REG (0x2a)
  39. #define ZPA2326_TEMP_OUT_L_REG (0x2b)
  40. #define ZPA2326_TEMP_OUT_H_REG (0x2c)
  41. struct device;
  42. struct regmap;
  43. bool zpa2326_isreg_writeable(struct device *dev, unsigned int reg);
  44. bool zpa2326_isreg_readable(struct device *dev, unsigned int reg);
  45. bool zpa2326_isreg_precious(struct device *dev, unsigned int reg);
  46. /**
  47. * zpa2326_probe() - Instantiate and register core ZPA2326 IIO device
  48. * @parent: Hardware sampling device the created IIO device will be a child of.
  49. * @name: Arbitrary name to identify the device.
  50. * @irq: Interrupt line, negative if none.
  51. * @hwid: Expected device hardware id.
  52. * @regmap: Registers map used to abstract underlying bus accesses.
  53. *
  54. * Return: Zero when successful, a negative error code otherwise.
  55. */
  56. int zpa2326_probe(struct device *parent,
  57. const char *name,
  58. int irq,
  59. unsigned int hwid,
  60. struct regmap *regmap);
  61. /**
  62. * zpa2326_remove() - Unregister and destroy core ZPA2326 IIO device.
  63. * @parent: Hardware sampling device the IIO device to remove is a child of.
  64. */
  65. void zpa2326_remove(const struct device *parent);
  66. #ifdef CONFIG_PM
  67. #include <linux/pm.h>
  68. extern const struct dev_pm_ops zpa2326_pm_ops;
  69. #define ZPA2326_PM_OPS (&zpa2326_pm_ops)
  70. #else
  71. #define ZPA2326_PM_OPS (NULL)
  72. #endif
  73. #endif