Commit 539b25fa authored by Denis Ciocca's avatar Denis Ciocca Committed by Jonathan Cameron
Browse files

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: default avatarDenis Ciocca <denis.ciocca@st.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent aa4e75c8
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,7 @@ static const struct st_sensors_platform_data default_press_pdata = {
	.drdy_int_pin = 1,
	.drdy_int_pin = 1,
};
};


const struct st_sensor_settings *st_press_get_settings(const char *name);
int st_press_common_probe(struct iio_dev *indio_dev);
int st_press_common_probe(struct iio_dev *indio_dev);
void st_press_common_remove(struct iio_dev *indio_dev);
void st_press_common_remove(struct iio_dev *indio_dev);


+18 −0
Original line number Original line Diff line number Diff line
@@ -664,6 +664,24 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
#define ST_PRESS_TRIGGER_OPS NULL
#define ST_PRESS_TRIGGER_OPS NULL
#endif
#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)
int st_press_common_probe(struct iio_dev *indio_dev)
{
{
	struct st_sensor_data *press_data = iio_priv(indio_dev);
	struct st_sensor_data *press_data = iio_priv(indio_dev);