Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * MS5611 pressure and temperature sensor driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (c) Tomasz Duszynski <tduszyns@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #ifndef _MS5611_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _MS5611_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/iio/iio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct regulator;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define MS5611_RESET			0x1e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define MS5611_READ_ADC			0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define MS5611_READ_PROM_WORD		0xA0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define MS5611_PROM_WORDS_NB		8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	MS5611,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	MS5607,
^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) struct ms5611_chip_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	u16 prom[MS5611_PROM_WORDS_NB];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	int (*temp_and_pressure_compensate)(struct ms5611_chip_info *chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 					    s32 *temp, s32 *pressure);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)  * OverSampling Rate descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)  * Warning: cmd MUST be kept aligned on a word boundary (see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)  * m5611_spi_read_adc_temp_and_pressure in ms5611_spi.c).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct ms5611_osr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	unsigned long conv_usec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	u8 cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	unsigned short rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct ms5611_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	void *client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	const struct ms5611_osr *pressure_osr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	const struct ms5611_osr *temp_osr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	int (*reset)(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	int (*read_prom_word)(struct device *dev, int index, u16 *word);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	int (*read_adc_temp_and_pressure)(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 					  s32 *temp, s32 *pressure);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	struct ms5611_chip_info *chip_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	struct regulator *vdd;
^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) int ms5611_probe(struct iio_dev *indio_dev, struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 		 const char *name, int type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) int ms5611_remove(struct iio_dev *indio_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #endif /* _MS5611_H */