^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * STMicroelectronics pressures driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright 2013 STMicroelectronics Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Denis Ciocca <denis.ciocca@st.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * v. 1.0.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #ifndef ST_PRESS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define ST_PRESS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/iio/common/st_sensors.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) enum st_press_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) LPS001WP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) LPS25H,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) LPS331AP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) LPS22HB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) LPS33HW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) LPS35HW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) LPS22HH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ST_PRESS_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define LPS001WP_PRESS_DEV_NAME "lps001wp"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define LPS25H_PRESS_DEV_NAME "lps25h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define LPS331AP_PRESS_DEV_NAME "lps331ap"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define LPS22HB_PRESS_DEV_NAME "lps22hb"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define LPS33HW_PRESS_DEV_NAME "lps33hw"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define LPS35HW_PRESS_DEV_NAME "lps35hw"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define LPS22HH_PRESS_DEV_NAME "lps22hh"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * struct st_sensors_platform_data - default press platform data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * @drdy_int_pin: default press DRDY is available on INT1 pin.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static __maybe_unused const struct st_sensors_platform_data default_press_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .drdy_int_pin = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) const struct st_sensor_settings *st_press_get_settings(const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int st_press_common_probe(struct iio_dev *indio_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void st_press_common_remove(struct iio_dev *indio_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #ifdef CONFIG_IIO_BUFFER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int st_press_allocate_ring(struct iio_dev *indio_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) void st_press_deallocate_ring(struct iio_dev *indio_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int st_press_trig_set_state(struct iio_trigger *trig, bool state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define ST_PRESS_TRIGGER_SET_STATE (&st_press_trig_set_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #else /* CONFIG_IIO_BUFFER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static inline int st_press_allocate_ring(struct iio_dev *indio_dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static inline void st_press_deallocate_ring(struct iio_dev *indio_dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define ST_PRESS_TRIGGER_SET_STATE NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #endif /* CONFIG_IIO_BUFFER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #endif /* ST_PRESS_H */