Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 217494e5 authored by Denis CIOCCA's avatar Denis CIOCCA Committed by Jonathan Cameron
Browse files

iio:pressure: Add STMicroelectronics pressures driver



This patch adds a generic pressure driver for STMicroelectronics
pressure sensors, currently it supports: LPS331AP.

Signed-off-by: default avatarDenis Ciocca <denis.ciocca@st.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 607a568a
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -73,5 +73,6 @@ source "drivers/iio/magnetometer/Kconfig"
if IIO_TRIGGER
if IIO_TRIGGER
   source "drivers/iio/trigger/Kconfig"
   source "drivers/iio/trigger/Kconfig"
endif #IIO_TRIGGER
endif #IIO_TRIGGER
source "drivers/iio/pressure/Kconfig"


endif # IIO
endif # IIO
+1 −0
Original line number Original line Diff line number Diff line
@@ -22,3 +22,4 @@ obj-y += imu/
obj-y += light/
obj-y += light/
obj-y += magnetometer/
obj-y += magnetometer/
obj-y += trigger/
obj-y += trigger/
obj-y += pressure/
+35 −0
Original line number Original line Diff line number Diff line
#
# Pressure drivers
#
menu "Pressure Sensors"

config IIO_ST_PRESS
	tristate "STMicroelectronics pressures Driver"
	depends on (I2C || SPI_MASTER) && SYSFS
	select IIO_ST_SENSORS_CORE
	select IIO_ST_PRESS_I2C if (I2C)
	select IIO_ST_PRESS_SPI if (SPI_MASTER)
	select IIO_TRIGGERED_BUFFER if (IIO_BUFFER)
	help
	  Say yes here to build support for STMicroelectronics pressures:
	  LPS331AP.

	  This driver can also be built as a module. If so, will be created
	  these modules:
	  - st_pressure (core functions for the driver [it is mandatory]);
	  - st_pressure_i2c (necessary for the I2C devices [optional*]);
	  - st_pressure_spi (necessary for the SPI devices [optional*]);

	  (*) one of these is necessary to do something.

config IIO_ST_PRESS_I2C
	tristate
	depends on IIO_ST_PRESS
	depends on IIO_ST_SENSORS_I2C

config IIO_ST_PRESS_SPI
	tristate
	depends on IIO_ST_PRESS
	depends on IIO_ST_SENSORS_SPI

endmenu
+10 −0
Original line number Original line Diff line number Diff line
#
# Makefile for industrial I/O pressure drivers
#

obj-$(CONFIG_IIO_ST_PRESS) += st_pressure.o
st_pressure-y := st_pressure_core.o
st_pressure-$(CONFIG_IIO_BUFFER) += st_pressure_buffer.o

obj-$(CONFIG_IIO_ST_PRESS_I2C) += st_pressure_i2c.o
obj-$(CONFIG_IIO_ST_PRESS_SPI) += st_pressure_spi.o
+39 −0
Original line number Original line Diff line number Diff line
/*
 * STMicroelectronics pressures driver
 *
 * Copyright 2013 STMicroelectronics Inc.
 *
 * Denis Ciocca <denis.ciocca@st.com>
 * v. 1.0.0
 * Licensed under the GPL-2.
 */

#ifndef ST_PRESS_H
#define ST_PRESS_H

#include <linux/types.h>
#include <linux/iio/common/st_sensors.h>

#define LPS331AP_PRESS_DEV_NAME		"lps331ap"

int st_press_common_probe(struct iio_dev *indio_dev);
void st_press_common_remove(struct iio_dev *indio_dev);

#ifdef CONFIG_IIO_BUFFER
int st_press_allocate_ring(struct iio_dev *indio_dev);
void st_press_deallocate_ring(struct iio_dev *indio_dev);
int st_press_trig_set_state(struct iio_trigger *trig, bool state);
#define ST_PRESS_TRIGGER_SET_STATE (&st_press_trig_set_state)
#else /* CONFIG_IIO_BUFFER */
static inline int st_press_allocate_ring(struct iio_dev *indio_dev)
{
	return 0;
}

static inline void st_press_deallocate_ring(struct iio_dev *indio_dev)
{
}
#define ST_PRESS_TRIGGER_SET_STATE NULL
#endif /* CONFIG_IIO_BUFFER */

#endif /* ST_PRESS_H */
Loading