summaryrefslogtreecommitdiff
path: root/drivers/iio/pressure/st_pressure_core.c
diff options
context:
space:
mode:
authorDenis Ciocca <denis.ciocca@st.com>2019-07-19 01:53:47 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-07-28 00:52:05 +0300
commit539b25fa700acf8985ea1a273fcccef5e52d52e4 (patch)
tree8c4044e63d6c399347a1e0b8a4bc2f249ee37838 /drivers/iio/pressure/st_pressure_core.c
parentaa4e75c85076c056d944b92ed94b76277430d263 (diff)
downloadlinux-539b25fa700acf8985ea1a273fcccef5e52d52e4.tar.xz
iio:pressure: introduce st_press_get_settings() function
The function is introduced to retrieve press device settings. It will be used by probe in order to configure regmap. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/pressure/st_pressure_core.c')
-rw-r--r--drivers/iio/pressure/st_pressure_core.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index b960e76f7dfd..35d80ff27464 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -664,6 +664,24 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
#define ST_PRESS_TRIGGER_OPS NULL
#endif
+/*
+ * st_press_get_settings() - get sensor settings from device name
+ * @name: device name buffer reference.
+ *
+ * Return: valid reference on success, NULL otherwise.
+ */
+const struct st_sensor_settings *st_press_get_settings(const char *name)
+{
+ int index = st_sensors_get_settings_index(name,
+ st_press_sensors_settings,
+ ARRAY_SIZE(st_press_sensors_settings));
+ if (index < 0)
+ return NULL;
+
+ return &st_press_sensors_settings[index];
+}
+EXPORT_SYMBOL(st_press_get_settings);
+
int st_press_common_probe(struct iio_dev *indio_dev)
{
struct st_sensor_data *press_data = iio_priv(indio_dev);