Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Murata ZPA2326 pressure and temperature sensor IIO driver
0004  *
0005  * Copyright (c) 2016 Parrot S.A.
0006  *
0007  * Author: Gregor Boirie <gregor.boirie@parrot.com>
0008  */
0009 
0010 #ifndef _ZPA2326_H
0011 #define _ZPA2326_H
0012 
0013 /* Register map. */
0014 #define ZPA2326_REF_P_XL_REG              (0x8)
0015 #define ZPA2326_REF_P_L_REG               (0x9)
0016 #define ZPA2326_REF_P_H_REG               (0xa)
0017 #define ZPA2326_DEVICE_ID_REG             (0xf)
0018 #define ZPA2326_DEVICE_ID                 (0xb9)
0019 #define ZPA2326_RES_CONF_REG              (0x10)
0020 #define ZPA2326_CTRL_REG0_REG             (0x20)
0021 #define ZPA2326_CTRL_REG0_ONE_SHOT        BIT(0)
0022 #define ZPA2326_CTRL_REG0_ENABLE          BIT(1)
0023 #define ZPA2326_CTRL_REG1_REG             (0x21)
0024 #define ZPA2326_CTRL_REG1_MASK_DATA_READY BIT(2)
0025 #define ZPA2326_CTRL_REG2_REG             (0x22)
0026 #define ZPA2326_CTRL_REG2_SWRESET         BIT(2)
0027 #define ZPA2326_CTRL_REG3_REG             (0x23)
0028 #define ZPA2326_CTRL_REG3_ODR_SHIFT       (4)
0029 #define ZPA2326_CTRL_REG3_ENABLE_MEAS     BIT(7)
0030 #define ZPA2326_INT_SOURCE_REG            (0x24)
0031 #define ZPA2326_INT_SOURCE_DATA_READY     BIT(2)
0032 #define ZPA2326_THS_P_LOW_REG             (0x25)
0033 #define ZPA2326_THS_P_HIGH_REG            (0x26)
0034 #define ZPA2326_STATUS_REG                (0x27)
0035 #define ZPA2326_STATUS_P_DA               BIT(1)
0036 #define ZPA2326_STATUS_FIFO_E             BIT(2)
0037 #define ZPA2326_STATUS_P_OR               BIT(5)
0038 #define ZPA2326_PRESS_OUT_XL_REG          (0x28)
0039 #define ZPA2326_PRESS_OUT_L_REG           (0x29)
0040 #define ZPA2326_PRESS_OUT_H_REG           (0x2a)
0041 #define ZPA2326_TEMP_OUT_L_REG            (0x2b)
0042 #define ZPA2326_TEMP_OUT_H_REG            (0x2c)
0043 
0044 struct device;
0045 struct regmap;
0046 
0047 bool zpa2326_isreg_writeable(struct device *dev, unsigned int reg);
0048 bool zpa2326_isreg_readable(struct device *dev, unsigned int reg);
0049 bool zpa2326_isreg_precious(struct device *dev, unsigned int reg);
0050 
0051 /**
0052  * zpa2326_probe() - Instantiate and register core ZPA2326 IIO device
0053  * @parent: Hardware sampling device the created IIO device will be a child of.
0054  * @name:   Arbitrary name to identify the device.
0055  * @irq:    Interrupt line, negative if none.
0056  * @hwid:   Expected device hardware id.
0057  * @regmap: Registers map used to abstract underlying bus accesses.
0058  *
0059  * Return: Zero when successful, a negative error code otherwise.
0060  */
0061 int zpa2326_probe(struct device        *parent,
0062           const char           *name,
0063           int                   irq,
0064           unsigned int          hwid,
0065           struct regmap        *regmap);
0066 
0067 /**
0068  * zpa2326_remove() - Unregister and destroy core ZPA2326 IIO device.
0069  * @parent: Hardware sampling device the IIO device to remove is a child of.
0070  */
0071 void zpa2326_remove(const struct device *parent);
0072 
0073 #ifdef CONFIG_PM
0074 #include <linux/pm.h>
0075 extern const struct dev_pm_ops zpa2326_pm_ops;
0076 #define ZPA2326_PM_OPS (&zpa2326_pm_ops)
0077 #else
0078 #define ZPA2326_PM_OPS (NULL)
0079 #endif
0080 
0081 #endif