From: Jonathan Cameron <jic23@kernel.org>
To: Mircea Caprioru <mircea.caprioru@analog.com>
Cc: <Michael.Hennerich@analog.com>, <stefan.popa@analog.com>,
<lars@metafoo.de>, <gregkh@linuxfoundation.org>,
<linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 2/2] staging: iio: adc: ad7192: Convert platform data to DT properties
Date: Sat, 16 Mar 2019 16:56:58 +0000 [thread overview]
Message-ID: <20190316165658.0cdc2f49@archlinux> (raw)
In-Reply-To: <20190315112903.15855-2-mircea.caprioru@analog.com>
On Fri, 15 Mar 2019 13:29:03 +0200
Mircea Caprioru <mircea.caprioru@analog.com> wrote:
> This patch will remove platform data members and replace them with device
> tree properties. These properties will be subject to further modifications
> and probably replaced with other functionalities at some point in time.
From the description I was initially thinking this would be a crazy
temporary binding but as they all seem to be reasonably sensible
(even if we haven't formally reviewed the binding yet so they may change)
I'm happy to take this as a step in the right direction.
>
> Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/staging/iio/adc/ad7192.c | 33 ++++++++++++++++++++------------
> drivers/staging/iio/adc/ad7192.h | 7 -------
> 2 files changed, 21 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> index 5c54ce380fa5..c56eaefbbe41 100644
> --- a/drivers/staging/iio/adc/ad7192.c
> +++ b/drivers/staging/iio/adc/ad7192.c
> @@ -250,10 +250,11 @@ static int ad7192_of_clock_select(struct ad7192_state *st)
> return clock_sel;
> }
>
> -static int ad7192_setup(struct ad7192_state *st,
> - const struct ad7192_platform_data *pdata)
> +static int ad7192_setup(struct ad7192_state *st, struct device_node *np)
> {
> struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
> + bool rej60_en, sinc3_en, refin2_en, chop_en;
> + bool buf_en, bipolar, burnout_curr_en;
> unsigned long long scale_uv;
> int i, ret, id;
>
> @@ -280,18 +281,22 @@ static int ad7192_setup(struct ad7192_state *st,
>
> st->conf = AD7192_CONF_GAIN(0);
>
> - if (pdata->rej60_en)
> + rej60_en = of_property_read_bool(np, "adi,rejection-60-Hz-enable");
> + if (rej60_en)
> st->mode |= AD7192_MODE_REJ60;
>
> - if (pdata->sinc3_en)
> + sinc3_en = of_property_read_bool(np, "adi,sinc3-filter-enable");
> + if (sinc3_en)
> st->mode |= AD7192_MODE_SINC3;
>
> - if (pdata->refin2_en && st->devid != ID_AD7195)
> + refin2_en = of_property_read_bool(np, "adi,refin2-pins-enable");
> + if (refin2_en && st->devid != ID_AD7195)
> st->conf |= AD7192_CONF_REFSEL;
>
> - if (pdata->chop_en) {
> + chop_en = of_property_read_bool(np, "adi,chop-enable");
> + if (chop_en) {
> st->conf |= AD7192_CONF_CHOP;
> - if (pdata->sinc3_en)
> + if (sinc3_en)
> st->f_order = 3; /* SINC 3rd order */
> else
> st->f_order = 4; /* SINC 4th order */
> @@ -299,15 +304,19 @@ static int ad7192_setup(struct ad7192_state *st,
> st->f_order = 1;
> }
>
> - if (pdata->buf_en)
> + buf_en = of_property_read_bool(np, "adi,buffer-enable");
> + if (buf_en)
> st->conf |= AD7192_CONF_BUF;
>
> - if (pdata->unipolar_en)
> + bipolar = of_property_read_bool(np, "bipolar");
> + if (!bipolar)
> st->conf |= AD7192_CONF_UNIPOLAR;
>
> - if (pdata->burnout_curr_en && pdata->buf_en && !pdata->chop_en) {
> + burnout_curr_en = of_property_read_bool(np,
> + "adi,burnout-currents-enable");
> + if (burnout_curr_en && buf_en && !chop_en) {
> st->conf |= AD7192_CONF_BURN;
> - } else if (pdata->burnout_curr_en) {
> + } else if (burnout_curr_en) {
> dev_warn(&st->sd.spi->dev,
> "Can't enable burnout currents: see CHOP or buffer\n");
> }
> @@ -735,7 +744,7 @@ static int ad7192_probe(struct spi_device *spi)
> }
> }
>
> - ret = ad7192_setup(st, pdata);
> + ret = ad7192_setup(st, spi->dev.of_node);
> if (ret)
> goto error_disable_clk;
>
> diff --git a/drivers/staging/iio/adc/ad7192.h b/drivers/staging/iio/adc/ad7192.h
> index 3be3ee269ed5..aa3322c14e38 100644
> --- a/drivers/staging/iio/adc/ad7192.h
> +++ b/drivers/staging/iio/adc/ad7192.h
> @@ -33,13 +33,6 @@
>
> struct ad7192_platform_data {
> u16 vref_mv;
> - bool refin2_en;
> - bool rej60_en;
> - bool sinc3_en;
> - bool chop_en;
> - bool buf_en;
> - bool unipolar_en;
> - bool burnout_curr_en;
> };
>
> #endif /* IIO_ADC_AD7192_H_ */
next prev parent reply other threads:[~2019-03-16 16:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 11:29 [PATCH 1/2] staging: iio: adc: ad7192: Use DT clock binding Mircea Caprioru
2019-03-15 11:29 ` [PATCH 2/2] staging: iio: adc: ad7192: Convert platform data to DT properties Mircea Caprioru
2019-03-16 16:56 ` Jonathan Cameron [this message]
2019-03-16 16:51 ` [PATCH 1/2] staging: iio: adc: ad7192: Use DT clock binding Jonathan Cameron
2019-03-16 16:52 ` Jonathan Cameron
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=20190316165658.0cdc2f49@archlinux \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=gregkh@linuxfoundation.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mircea.caprioru@analog.com \
--cc=stefan.popa@analog.com \
/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