From: Jonathan Cameron <jic23@kernel.org>
To: Denis Ciocca <denis.ciocca@st.com>
Cc: <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v2 08/11] iio:magn: device settings are set immediately during probe
Date: Sun, 21 Jul 2019 18:56:11 +0100 [thread overview]
Message-ID: <20190721185611.1abe36fb@archlinux> (raw)
In-Reply-To: <20190718225353.2078-9-denis.ciocca@st.com>
On Thu, 18 Jul 2019 15:53:50 -0700
Denis Ciocca <denis.ciocca@st.com> wrote:
> This patch set magn settings right after probe start. This is
> done in preparation of regmap that needs different configuration
> based on multiread bit value.
>
> Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Applied,
Thanks,
> ---
> Changes in v2:
> not there in v1.
>
> drivers/iio/magnetometer/st_magn_i2c.c | 18 ++++++++++++++----
> drivers/iio/magnetometer/st_magn_spi.c | 16 +++++++++++++---
> 2 files changed, 27 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c
> index 4d014fd1aeb0..d5d565639bed 100644
> --- a/drivers/iio/magnetometer/st_magn_i2c.c
> +++ b/drivers/iio/magnetometer/st_magn_i2c.c
> @@ -55,19 +55,29 @@ MODULE_DEVICE_TABLE(of, st_magn_of_match);
> #endif
>
> static int st_magn_i2c_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> + const struct i2c_device_id *id)
> {
> - struct iio_dev *indio_dev;
> + const struct st_sensor_settings *settings;
> struct st_sensor_data *mdata;
> + struct iio_dev *indio_dev;
> int err;
>
> + st_sensors_of_name_probe(&client->dev, st_magn_of_match,
> + client->name, sizeof(client->name));
> +
> + settings = st_magn_get_settings(client->name);
> + if (!settings) {
> + dev_err(&client->dev, "device name %s not recognized.\n",
> + client->name);
> + return -ENODEV;
> + }
> +
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*mdata));
> if (!indio_dev)
> return -ENOMEM;
>
> mdata = iio_priv(indio_dev);
> - st_sensors_of_name_probe(&client->dev, st_magn_of_match,
> - client->name, sizeof(client->name));
> + mdata->sensor_settings = (struct st_sensor_settings *)settings;
>
> st_sensors_i2c_configure(indio_dev, client, mdata);
>
> diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
> index 0d47070611b1..a3045afc6b53 100644
> --- a/drivers/iio/magnetometer/st_magn_spi.c
> +++ b/drivers/iio/magnetometer/st_magn_spi.c
> @@ -51,18 +51,28 @@ MODULE_DEVICE_TABLE(of, st_magn_of_match);
>
> static int st_magn_spi_probe(struct spi_device *spi)
> {
> - struct iio_dev *indio_dev;
> + const struct st_sensor_settings *settings;
> struct st_sensor_data *mdata;
> + struct iio_dev *indio_dev;
> int err;
>
> + st_sensors_of_name_probe(&spi->dev, st_magn_of_match,
> + spi->modalias, sizeof(spi->modalias));
> +
> + settings = st_magn_get_settings(spi->modalias);
> + if (!settings) {
> + dev_err(&spi->dev, "device name %s not recognized.\n",
> + spi->modalias);
> + return -ENODEV;
> + }
> +
> indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*mdata));
> if (!indio_dev)
> return -ENOMEM;
>
> mdata = iio_priv(indio_dev);
> + mdata->sensor_settings = (struct st_sensor_settings *)settings;
>
> - st_sensors_of_name_probe(&spi->dev, st_magn_of_match,
> - spi->modalias, sizeof(spi->modalias));
> st_sensors_spi_configure(indio_dev, spi, mdata);
>
> err = st_magn_common_probe(indio_dev);
next prev parent reply other threads:[~2019-07-21 18:01 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 ` [PATCH v2 03/11] iio:gyro: introduce st_gyro_get_settings() function Denis Ciocca
2019-07-21 17:50 ` 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 [this message]
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=20190721185611.1abe36fb@archlinux \
--to=jic23@kernel.org \
--cc=denis.ciocca@st.com \
--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).