linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>,
	linux-iio@vger.kernel.org, Denis CIOCCA <denis.ciocca@st.com>
Cc: Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH 3/6] iio: st_sensors: get platform data from device tree
Date: Sat, 26 Apr 2014 11:56:47 +0100	[thread overview]
Message-ID: <535B90EF.9070707@kernel.org> (raw)
In-Reply-To: <1397416143-4396-4-git-send-email-linus.walleij@linaro.org>

On 13/04/14 20:09, Linus Walleij wrote:
> Currently the STMicroelectronics sensors only support one single
> platform data item: configuration of the DRDY (data ready) pin
> for a particular design. Augment the core to prioritize and take
> this information from the device tree if the parent device has an
> assigned device node, else fall back to passed in platform data
> (usually the default data).
>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Denis CIOCCA <denis.ciocca@st.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This one adds binding elements so needs to sit for another week I think...
If you are respinning patch 5 then I'll probably wait for a repost before
taking another look at the remaining 4 patches.

Thanks,

Jonathan
> ---
>   drivers/iio/common/st_sensors/st_sensors_core.c | 35 ++++++++++++++++++++++++-
>   1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index e8b932fed70e..1cdcef94e6a2 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -14,8 +14,8 @@
>   #include <linux/delay.h>
>   #include <linux/iio/iio.h>
>   #include <linux/regulator/consumer.h>
> +#include <linux/of.h>
>   #include <asm/unaligned.h>
> -
>   #include <linux/iio/common/st_sensors.h>
>
>
> @@ -265,14 +265,47 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
>   	return 0;
>   }
>
> +#ifdef CONFIG_OF
> +static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
> +		struct st_sensors_platform_data *defdata)
> +{
> +	struct st_sensors_platform_data *pdata;
> +	struct device_node *np = dev->of_node;
> +	u32 val;
> +
> +	if (!np)
> +		return NULL;
> +
> +	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!of_property_read_u32(np, "st,drdy-int-pin", &val) && (val <= 2))
> +		pdata->drdy_int_pin = (u8) val;
> +	else
> +		pdata->drdy_int_pin = defdata ? defdata->drdy_int_pin : 1;
> +
> +	return pdata;
> +}
> +#else
> +static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
> +		struct st_sensors_platform_data *defdata)
> +{
> +	return NULL;
> +}
> +#endif
> +
>   int st_sensors_init_sensor(struct iio_dev *indio_dev,
>   					struct st_sensors_platform_data *pdata)
>   {
>   	struct st_sensor_data *sdata = iio_priv(indio_dev);
> +	struct st_sensors_platform_data *of_pdata;
>   	int err = 0;
>
>   	mutex_init(&sdata->tb.buf_lock);
>
> +	/* If OF/DT pdata exists, it will take precedence of anything else */
> +	of_pdata = st_sensors_of_probe(indio_dev->dev.parent, pdata);
> +	if (of_pdata)
> +		pdata = of_pdata;
> +
>   	if (pdata)
>   		err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
>
>


  reply	other threads:[~2014-04-26 10:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-13 19:08 [PATCH 0/6] iio: enable ST Sensors on Ux500 Linus Walleij
2014-04-13 19:08 ` [PATCH 1/6] iio: st_sensors: announce registered sensors Linus Walleij
2014-04-23 21:21   ` Jonathan Cameron
2014-04-24  8:30     ` Linus Walleij
2014-04-26 10:51       ` Jonathan Cameron
2014-04-13 19:08 ` [PATCH 2/6] iio: st_sensors: move regulator retrieveal to core Linus Walleij
2014-04-13 19:09 ` [PATCH 3/6] iio: st_sensors: get platform data from device tree Linus Walleij
2014-04-26 10:56   ` Jonathan Cameron [this message]
2014-04-13 19:09 ` [PATCH 4/6] iio: st_sensors: add device tree bindings Linus Walleij
2014-04-13 19:09 ` [PATCH 5/6] iio: st_sensors: add devicetree probing support Linus Walleij
2014-04-23 21:19   ` Jonathan Cameron
2014-04-24  8:33     ` Linus Walleij
2014-04-26 10:57       ` Jonathan Cameron
2014-06-02 12:07         ` Linus Walleij
2014-04-13 19:09 ` [PATCH 6/6] ARM: ux500: add misc sensors to the device trees Linus Walleij

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=535B90EF.9070707@kernel.org \
    --to=jic23@kernel.org \
    --cc=denis.ciocca@st.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.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).