Commit 823a7ada authored by Denis Ciocca's avatar Denis Ciocca Committed by Jonathan Cameron

iio:accel: introduce st_accel_get_settings() function

The function is introduced to retrieve accel device settings. It will be
used by probe in order to configure regmap.
Signed-off-by: default avatarDenis Ciocca <denis.ciocca@st.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent a090965b
......@@ -68,6 +68,7 @@ static const struct st_sensors_platform_data default_accel_pdata = {
.drdy_int_pin = 1,
};
const struct st_sensor_settings *st_accel_get_settings(const char *name);
int st_accel_common_probe(struct iio_dev *indio_dev);
void st_accel_common_remove(struct iio_dev *indio_dev);
......
......@@ -1147,6 +1147,24 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev,
#endif
}
/*
* st_accel_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_accel_get_settings(const char *name)
{
int index = st_sensors_get_settings_index(name,
st_accel_sensors_settings,
ARRAY_SIZE(st_accel_sensors_settings));
if (index < 0)
return NULL;
return &st_accel_sensors_settings[index];
}
EXPORT_SYMBOL(st_accel_get_settings);
int st_accel_common_probe(struct iio_dev *indio_dev)
{
struct st_sensor_data *adata = iio_priv(indio_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment