diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-13 22:35:00 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-13 22:35:00 +0300 |
commit | 72cca7baf4fba777b8ab770b902cf2e08941773f (patch) | |
tree | c5cdbcd65ac166946f54f1dd6ef3693eea29d791 /drivers/iio/humidity/hts221.h | |
parent | 5266e70335dac35c35b5ca9cea4251c1389d4a68 (diff) | |
parent | 3e0f9b2ca8e4839335e4d64ec0a75f4fd5111c4b (diff) | |
download | linux-72cca7baf4fba777b8ab770b902cf2e08941773f.tar.xz |
Merge tag 'staging-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO updates from Greg KH:
"Here's the "big" staging/iio pull request for 4.10-rc1.
Not as big as 4.9 was, but still just over a thousand changes. We
almost broke even of lines added vs. removed, as the slicoss driver
was removed (got a "clean" driver for the same hardware through the
netdev tree), and some iio drivers were also dropped, but I think we
ended up adding a few thousand lines to the source tree in the end.
Other than that it's a lot of minor fixes all over the place, nothing
major stands out at all.
All of these have been in linux-next for a while. There will be a
merge conflict with Al's vfs tree in the lustre code, but the
resolution for that should be pretty simple, that too has been in
linux-next"
* tag 'staging-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1002 commits)
staging: comedi: comedidev.h: Document usage of 'detach' handler
staging: fsl-mc: remove unnecessary info prints from bus driver
staging: fsl-mc: add sysfs ABI doc
staging/lustre/o2iblnd: Fix misspelled attemps->attempts
staging/lustre/o2iblnd: Fix misspelling intialized->intialized
staging/lustre: Convert all bare unsigned to unsigned int
staging/lustre/socklnd: Fix whitespace problem
staging/lustre/o2iblnd: Add missing space
staging/lustre/lnetselftest: Fix potential integer overflow
staging: greybus: audio_module: remove redundant OOM message
staging: dgnc: Fix lines longer than 80 characters
staging: dgnc: fix blank line after '{' warnings.
staging/android: remove Sync Framework tasks from TODO
staging/lustre/osc: Revert erroneous list_for_each_entry_safe use
staging: slicoss: remove the staging driver
staging: lustre: libcfs: remove lnet upcall code
staging: lustre: remove set but unused variables
staging: lustre: osc: set lock data for readahead lock
staging: lustre: import: don't reconnect during connect interpret
staging: lustre: clio: remove mtime check in vvp_io_fault_start()
...
Diffstat (limited to 'drivers/iio/humidity/hts221.h')
-rw-r--r-- | drivers/iio/humidity/hts221.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h new file mode 100644 index 000000000000..c7154665512e --- /dev/null +++ b/drivers/iio/humidity/hts221.h @@ -0,0 +1,73 @@ +/* + * STMicroelectronics hts221 sensor driver + * + * Copyright 2016 STMicroelectronics Inc. + * + * Lorenzo Bianconi <lorenzo.bianconi@st.com> + * + * Licensed under the GPL-2. + */ + +#ifndef HTS221_H +#define HTS221_H + +#define HTS221_DEV_NAME "hts221" + +#include <linux/iio/iio.h> + +#define HTS221_RX_MAX_LENGTH 8 +#define HTS221_TX_MAX_LENGTH 8 + +#define HTS221_DATA_SIZE 2 + +struct hts221_transfer_buffer { + u8 rx_buf[HTS221_RX_MAX_LENGTH]; + u8 tx_buf[HTS221_TX_MAX_LENGTH] ____cacheline_aligned; +}; + +struct hts221_transfer_function { + int (*read)(struct device *dev, u8 addr, int len, u8 *data); + int (*write)(struct device *dev, u8 addr, int len, u8 *data); +}; + +#define HTS221_AVG_DEPTH 8 +struct hts221_avg_avl { + u16 avg; + u8 val; +}; + +enum hts221_sensor_type { + HTS221_SENSOR_H, + HTS221_SENSOR_T, + HTS221_SENSOR_MAX, +}; + +struct hts221_sensor { + u8 cur_avg_idx; + int slope, b_gen; +}; + +struct hts221_hw { + const char *name; + struct device *dev; + + struct mutex lock; + struct iio_trigger *trig; + int irq; + + struct hts221_sensor sensors[HTS221_SENSOR_MAX]; + + u8 odr; + + const struct hts221_transfer_function *tf; + struct hts221_transfer_buffer tb; +}; + +int hts221_config_drdy(struct hts221_hw *hw, bool enable); +int hts221_probe(struct iio_dev *iio_dev); +int hts221_power_on(struct hts221_hw *hw); +int hts221_power_off(struct hts221_hw *hw); +int hts221_allocate_buffers(struct hts221_hw *hw); +int hts221_allocate_trigger(struct hts221_hw *hw); + +#endif /* HTS221_H */ |