linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Ciocca <denis.ciocca@st.com>
To: <denis.ciocca@st.com>, <jic23@kernel.org>, <linux-iio@vger.kernel.org>
Subject: [PATCH v2 03/11] iio:gyro: introduce st_gyro_get_settings() function
Date: Thu, 18 Jul 2019 15:53:45 -0700	[thread overview]
Message-ID: <20190718225353.2078-4-denis.ciocca@st.com> (raw)
In-Reply-To: <20190718225353.2078-1-denis.ciocca@st.com>

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>
---
Changes in v2:
 not there in v1. This meant to replace "iio:gyro:introduce st_gyro_multiread_bit() function"

 drivers/iio/gyro/st_gyro.h      |  1 +
 drivers/iio/gyro/st_gyro_core.c | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h
index 460d190be4a4..592f6b34e987 100644
--- a/drivers/iio/gyro/st_gyro.h
+++ b/drivers/iio/gyro/st_gyro.h
@@ -32,6 +32,7 @@ static const struct st_sensors_platform_data gyro_pdata = {
 	.drdy_int_pin = 2,
 };
 
+const struct st_sensor_settings *st_gyro_get_settings(const char *name);
 int st_gyro_common_probe(struct iio_dev *indio_dev);
 void st_gyro_common_remove(struct iio_dev *indio_dev);
 
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index e995dc77e30e..5cc63d41d855 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -368,6 +368,24 @@ static const struct iio_trigger_ops st_gyro_trigger_ops = {
 #define ST_GYRO_TRIGGER_OPS NULL
 #endif
 
+/*
+ * st_gyro_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_gyro_get_settings(const char *name)
+{
+	int index = st_sensors_get_settings_index(name,
+					st_gyro_sensors_settings,
+					ARRAY_SIZE(st_gyro_sensors_settings));
+	if (index < 0)
+		return NULL;
+
+	return &st_gyro_sensors_settings[index];
+}
+EXPORT_SYMBOL(st_gyro_get_settings);
+
 int st_gyro_common_probe(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *gdata = iio_priv(indio_dev);
-- 
2.22.0


  parent reply	other threads:[~2019-07-18 22:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 22:53 [PATCH v2 00/11] iio:st_sensors: make use of regmap API Denis Ciocca
2019-07-18 22:53 ` [PATCH v2 01/11] iio:common:st_sensors: add st_sensors_get_settings_index() helper function Denis Ciocca
2019-07-21 17:48   ` Jonathan Cameron
2019-07-18 22:53 ` [PATCH v2 02/11] iio:accel: introduce st_accel_get_settings() function Denis Ciocca
2019-07-21 17:48   ` Jonathan Cameron
2019-07-18 22:53 ` Denis Ciocca [this message]
2019-07-21 17:50   ` [PATCH v2 03/11] iio:gyro: introduce st_gyro_get_settings() function Jonathan Cameron
2019-07-18 22:53 ` [PATCH v2 04/11] iio:magn: introduce st_magn_get_settings() function Denis Ciocca
2019-07-21 17:51   ` Jonathan Cameron
2019-07-18 22:53 ` [PATCH v2 05/11] iio:pressure: introduce st_press_get_settings() function Denis Ciocca
2019-07-21 17:52   ` Jonathan Cameron
2019-07-18 22:53 ` [PATCH v2 06/11] iio:accel: device settings are set immediately during probe Denis Ciocca
2019-07-21 17:54   ` Jonathan Cameron
2019-07-18 22:53 ` [PATCH v2 07/11] iio:gyro: " Denis Ciocca
2019-07-21 17:55   ` Jonathan Cameron
2019-07-18 22:53 ` [PATCH v2 08/11] iio:magn: " Denis Ciocca
2019-07-21 17:56   ` Jonathan Cameron
2019-07-18 22:53 ` [PATCH v2 09/11] iio:pressure: " Denis Ciocca
2019-07-18 22:53 ` [PATCH v2 10/11] iio: move 3-wire spi initialization to st_sensors_spi Denis Ciocca
2019-07-21 17:58   ` Jonathan Cameron
2019-07-21 18:03     ` Jonathan Cameron
2019-07-22 19:53       ` Denis CIOCCA
2019-07-18 22:53 ` [PATCH v2 11/11] iio: make st_sensors drivers use regmap Denis Ciocca
2019-07-21 18:05   ` Jonathan Cameron
2019-07-22 19:53     ` Denis CIOCCA

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190718225353.2078-4-denis.ciocca@st.com \
    --to=denis.ciocca@st.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).