iio:magn: introduce st_magn_get_settings() function
The function is introduced to retrieve magn 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>alistair/sunxi64-5.4-dsi
parent
2acca26bba
commit
aa4e75c850
|
@ -22,6 +22,7 @@
|
||||||
#define LIS2MDL_MAGN_DEV_NAME "lis2mdl"
|
#define LIS2MDL_MAGN_DEV_NAME "lis2mdl"
|
||||||
#define LSM9DS1_MAGN_DEV_NAME "lsm9ds1_magn"
|
#define LSM9DS1_MAGN_DEV_NAME "lsm9ds1_magn"
|
||||||
|
|
||||||
|
const struct st_sensor_settings *st_magn_get_settings(const char *name);
|
||||||
int st_magn_common_probe(struct iio_dev *indio_dev);
|
int st_magn_common_probe(struct iio_dev *indio_dev);
|
||||||
void st_magn_common_remove(struct iio_dev *indio_dev);
|
void st_magn_common_remove(struct iio_dev *indio_dev);
|
||||||
|
|
||||||
|
|
|
@ -470,6 +470,24 @@ static const struct iio_trigger_ops st_magn_trigger_ops = {
|
||||||
#define ST_MAGN_TRIGGER_OPS NULL
|
#define ST_MAGN_TRIGGER_OPS NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* st_magn_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_magn_get_settings(const char *name)
|
||||||
|
{
|
||||||
|
int index = st_sensors_get_settings_index(name,
|
||||||
|
st_magn_sensors_settings,
|
||||||
|
ARRAY_SIZE(st_magn_sensors_settings));
|
||||||
|
if (index < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &st_magn_sensors_settings[index];
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(st_magn_get_settings);
|
||||||
|
|
||||||
int st_magn_common_probe(struct iio_dev *indio_dev)
|
int st_magn_common_probe(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
struct st_sensor_data *mdata = iio_priv(indio_dev);
|
struct st_sensor_data *mdata = iio_priv(indio_dev);
|
||||||
|
|
Loading…
Reference in New Issue