devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
To: Lukasz Czerwinski <l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: "jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org"
	<jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>,
	"denis.ciocca-qxv4g6HH51o@public.gmane.org"
	<denis.ciocca-qxv4g6HH51o@public.gmane.org>,
	"linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [RFC v2 PATCH 01/14] iio: st_common: New interrupt interface
Date: Mon, 21 Oct 2013 12:48:46 +0100	[thread overview]
Message-ID: <20131021114845.GF8144@kartoffel> (raw)
In-Reply-To: <1380299538-22047-2-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

On Fri, Sep 27, 2013 at 05:32:05PM +0100, Lukasz Czerwinski wrote:
> This patch adds two interrupts handling by the st_common library.
> Additional second interrupt is used to indetify enabled event support for
> chosen ST device. It supports board files and dt.
> 
> For dt interface multiple interrupts are passed through interrupt-names
> property.
> 
> Read drdy_int_pin value is moved to the st_sensors_parse_platform_data()
> in the st_sensors_i2c.c and st_sensors_spi.c Now drdy_int_pin can be
> also configured via dt.
> 
> Signed-off-by: Lukasz Czerwinski <l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Kyungmin Park <kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c |   36 +----------
>  drivers/iio/common/st_sensors/st_sensors_i2c.c  |   75 +++++++++++++++++++++-
>  drivers/iio/common/st_sensors/st_sensors_spi.c  |   77 ++++++++++++++++++++++-
>  include/linux/iio/common/st_sensors.h           |   13 +++-
>  include/linux/platform_data/st_sensors_pdata.h  |    2 +
>  5 files changed, 160 insertions(+), 43 deletions(-)
 
[...]

> +static void st_sensors_parse_platform_data(struct i2c_client *client,
> +               struct iio_dev *indio_dev)
> +{
> +       struct st_sensor_data *sdata = iio_priv(indio_dev);
> +       struct device_node *np = client->dev.of_node;
> +       struct st_sensors_platform_data *pdata = client->dev.platform_data;
> +
> +       if (pdata)
> +               sdata->drdy_int_pin = pdata->drdy_int_pin;
> +       else if (np)
> +               of_property_read_u8(np, "st,drdy-int-pin",
> +                       (u8 *)&sdata->drdy_int_pin);

Why the cast?

What are valid values for this propertyy and what does it mean?

No sanity checking? Are there 256 pins?

> +}
> +
> +static unsigned int st_sensors_i2c_map_irq(struct i2c_client *client,
> +               unsigned int irq_num)
> +{
> +       struct device_node *np = client->dev.of_node;
> +       struct st_sensors_platform_data *pdata = client->dev.platform_data;
> +       int index = 0;
> +
> +       if (pdata)
> +               return pdata->irqs[irq_num];
> +       else if (np) {
> +               switch (irq_num) {
> +               case ST_SENSORS_INT1:
> +                       index = of_property_match_string(np,
> +                                       "interrupt-names",
> +                                       ST_SENSORS_DRDY_IRQ_NAME);
> +                       break;
> +               case ST_SENSORS_INT2:
> +                       index = of_property_match_string(np,
> +                                       "interrupt-names",
> +                                       ST_SENSORS_EVENT_IRQ_NAME);
> +               default:
> +                       break;
> +               }
> +               return index < 0 ? 0 : irq_of_parse_and_map(np, index);
> +       }
> +       return 0;
> +}

Is there no platform_get_irq_byname equivalent for i2c devices? It seems like
naming the irq resources and using that would be a better solution.

Thanks,
Mark.

  parent reply	other threads:[~2013-10-21 11:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 16:32 [RFC v2 PATCH 00/14] iio: STMicroelectronics DT and event support Lukasz Czerwinski
     [not found] ` <1380299538-22047-1-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-27 16:32   ` [RFC v2 PATCH 01/14] iio: st_common: New interrupt interface Lukasz Czerwinski
     [not found]     ` <1380299538-22047-2-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-10-01 15:34       ` Jonathan Cameron
     [not found]         ` <524AEB97.1090806-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-10-01 16:22           ` Jonathan Cameron
2013-10-21 11:59           ` Mark Rutland
2013-10-21 11:48       ` Mark Rutland [this message]
2013-09-27 16:32   ` [RFC v2 PATCH 02/14] iio: st_accel: Add dt bindings Lukasz Czerwinski
     [not found]     ` <1380299538-22047-3-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-10-01 15:40       ` Jonathan Cameron
     [not found]         ` <524AED0A.6030707-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-10-21 11:37           ` Mark Rutland
2013-09-27 16:32   ` [RFC v2 PATCH 03/14] iio: st_gyro: " Lukasz Czerwinski
2013-09-27 16:32   ` [RFC v2 PATCH 04/14] iio: st_mang: " Lukasz Czerwinski
2013-09-27 16:32   ` [RFC v2 PATCH 05/14] iio: st_pressure: " Lukasz Czerwinski
2013-09-27 16:32   ` [RFC v2 PATCH 06/14] iio: st_common: Add threshold events support Lukasz Czerwinski
     [not found]     ` <1380299538-22047-7-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-10-01 16:09       ` Jonathan Cameron
2013-09-27 16:32   ` [RFC v2 PATCH 07/14] iio: st_accel: Add event subsystem to st_accel driver Lukasz Czerwinski
     [not found]     ` <1380299538-22047-8-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-10-01 16:17       ` Jonathan Cameron
2013-09-27 16:32   ` [RFC v2 PATCH 08/14] iio: iio_magn: Add event ops Lukasz Czerwinski
     [not found]     ` <1380299538-22047-9-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-10-01 16:21       ` Jonathan Cameron
2013-09-27 16:32   ` [RFC v2 PATCH 09/14] iio: st_gyro: " Lukasz Czerwinski
2013-09-27 16:32   ` [RFC v2 PATCH 10/14] iio: iio_press: " Lukasz Czerwinski
2013-09-27 16:32   ` [RFC v2 PATCH 11/14] Documentation: Add st_magn binding documentation Lukasz Czerwinski
     [not found]     ` <1380299538-22047-12-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-10-01 16:29       ` Jonathan Cameron
     [not found]         ` <524AF86D.7010200-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-10-01 15:49           ` Rob Herring
     [not found]             ` <524AEEFC.8010201-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-22  6:55               ` Lee Jones
2013-10-21 11:16       ` Mark Rutland
2013-09-27 16:32   ` [RFC v2 PATCH 12/14] Documentation: Add st_gyro " Lukasz Czerwinski
     [not found]     ` <1380299538-22047-13-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-10-21 11:19       ` Mark Rutland
2013-09-27 16:32   ` [RFC v2 PATCH 13/14] Documentation: Add st_pressure " Lukasz Czerwinski
     [not found]     ` <1380299538-22047-14-git-send-email-l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-10-21 11:23       ` Mark Rutland
2013-09-27 16:32   ` [RFC v2 PATCH 14/14] Documentation: Add st_accel " Lukasz Czerwinski

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=20131021114845.GF8144@kartoffel \
    --to=mark.rutland-5wv7dgnigg8@public.gmane.org \
    --cc=denis.ciocca-qxv4g6HH51o@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org \
    --cc=l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).