Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio:gyro: introduce st_gyro_get_settings() function

The function is introduced to retrieve gyro 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>

authored by

Denis Ciocca and committed by
Jonathan Cameron
2acca26b 823a7ada

+19
+1
drivers/iio/gyro/st_gyro.h
··· 32 32 .drdy_int_pin = 2, 33 33 }; 34 34 35 + const struct st_sensor_settings *st_gyro_get_settings(const char *name); 35 36 int st_gyro_common_probe(struct iio_dev *indio_dev); 36 37 void st_gyro_common_remove(struct iio_dev *indio_dev); 37 38
+18
drivers/iio/gyro/st_gyro_core.c
··· 368 368 #define ST_GYRO_TRIGGER_OPS NULL 369 369 #endif 370 370 371 + /* 372 + * st_gyro_get_settings() - get sensor settings from device name 373 + * @name: device name buffer reference. 374 + * 375 + * Return: valid reference on success, NULL otherwise. 376 + */ 377 + const struct st_sensor_settings *st_gyro_get_settings(const char *name) 378 + { 379 + int index = st_sensors_get_settings_index(name, 380 + st_gyro_sensors_settings, 381 + ARRAY_SIZE(st_gyro_sensors_settings)); 382 + if (index < 0) 383 + return NULL; 384 + 385 + return &st_gyro_sensors_settings[index]; 386 + } 387 + EXPORT_SYMBOL(st_gyro_get_settings); 388 + 371 389 int st_gyro_common_probe(struct iio_dev *indio_dev) 372 390 { 373 391 struct st_sensor_data *gdata = iio_priv(indio_dev);