devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Jacek Anaszewski <j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	denis.ciocca-qxv4g6HH51o@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
	Kyungmin Park
	<kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH v2] iio: lps331ap: Add support for DT
Date: Sun, 04 Aug 2013 12:55:03 +0100	[thread overview]
Message-ID: <51FE4117.3040404@kernel.org> (raw)
In-Reply-To: <1374240981-13560-2-git-send-email-j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

On 07/19/13 14:36, Jacek Anaszewski wrote:
> This patch adds DT support for the lps331ap barometer
> sensor.
> 
> Signed-off-by: Jacek Anaszewski <j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Kyungmin Park <kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
This makes sense to me and looks similar to that in existing bindings
hence,

Applied to the togreg branch of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git

Note I am one of those maintainers who has very limited knowledge of device
tree so am basing this decision on the 'it looks like existing mappings' rather
than any deep understanding.

Jonathan
> ---
>  .../devicetree/bindings/iio/pressure/lps331ap.txt  |   41 ++++++++++++++++++++
>  drivers/iio/pressure/st_pressure_i2c.c             |   11 +++++-
>  drivers/iio/pressure/st_pressure_spi.c             |   11 +++++-
>  3 files changed, 61 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/iio/pressure/lps331ap.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/pressure/lps331ap.txt b/Documentation/devicetree/bindings/iio/pressure/lps331ap.txt
> new file mode 100644
> index 0000000..e05b45e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/pressure/lps331ap.txt
> @@ -0,0 +1,41 @@
> +* STMicroelectronics LPS331AP barometer sensor
> +
> +Required properties:
> +
> +  - compatible : should be "st,lps331ap"
> +  - reg : the I2C address of the barometer
> +
> +Optional properties:
> +
> +  - drdy-int-pin : redirect DRDY on pin INT1 (1) or pin INT2 (2) (u8)
> +  - interrupt-parent : phandle to the interrupt map subnode
> +  - interrupts : interrupt mapping for LPS331AP interrupt sources:
> +		 2 sources: 0 - data ready, 1 - threshold event
> +  - irq-map : irq sub-node defining interrupt map
> +	      (all properties listed below are required):
> +      - #interrupt-cells : should be 1
> +      - #address-cells : should be 0
> +      - #size-cells : should be 0
> +      - interrupt-map : table of entries consisting of three child elements:
> +	  - unit_interrupt_specifier - 0 : data ready, 1 : threshold event
> +	  - interrupt parent phandle
> +	  - parent unit interrupt specifier consisiting of two elements:
> +	      - index of the interrupt within the controller
> +	      - flags : should be 0
> +
> +Example:
> +
> +lps331ap@5d {
> +	compatible = "st,lps331ap";
> +	reg = <0x5d>;
> +	drdy-int-pin = /bits/ 8 <2>;
> +	interrupt-parent = <&irq_map>;
> +	interrupts = <0>, <1>;
> +
> +	irq_map: irq-map {
> +		#interrupt-cells = <1>;
> +		#address-cells = <0>;
> +		#size-cells = <0>;
> +		interrupt-map = <0 &gpf0 5 0>;
> +	};
> +};
> diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
> index 7cebcc7..1683ebe 100644
> --- a/drivers/iio/pressure/st_pressure_i2c.c
> +++ b/drivers/iio/pressure/st_pressure_i2c.c
> @@ -56,15 +56,24 @@ static int st_press_i2c_remove(struct i2c_client *client)
>  }
>  
>  static const struct i2c_device_id st_press_id_table[] = {
> -	{ LPS331AP_PRESS_DEV_NAME },
> +	{ "st,lps331ap" },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(i2c, st_press_id_table);
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id lps331ap_of_match[] = {
> +	{ .compatible = "st,lps331ap", },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, lps331ap_of_match);
> +#endif
> +
>  static struct i2c_driver st_press_driver = {
>  	.driver = {
>  		.owner = THIS_MODULE,
>  		.name = "st-press-i2c",
> +		.of_match_table = of_match_ptr(lps331ap_of_match),
>  	},
>  	.probe = st_press_i2c_probe,
>  	.remove = st_press_i2c_remove,
> diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
> index 17a1490..05c30d6 100644
> --- a/drivers/iio/pressure/st_pressure_spi.c
> +++ b/drivers/iio/pressure/st_pressure_spi.c
> @@ -55,15 +55,24 @@ static int st_press_spi_remove(struct spi_device *spi)
>  }
>  
>  static const struct spi_device_id st_press_id_table[] = {
> -	{ LPS331AP_PRESS_DEV_NAME },
> +	{ "st,lps331ap" },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(spi, st_press_id_table);
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id lps331ap_of_match[] = {
> +	{ .compatible = "st,lps331ap", },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, lps331ap_of_match);
> +#endif
> +
>  static struct spi_driver st_press_driver = {
>  	.driver = {
>  		.owner = THIS_MODULE,
>  		.name = "st-press-spi",
> +		.of_match_table = of_match_ptr(lps331ap_of_match),
>  	},
>  	.probe = st_press_spi_probe,
>  	.remove = st_press_spi_remove,
> 

  parent reply	other threads:[~2013-08-04 11:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 13:36 [PATCH v2] iio:lps331ap: Add support for DT Jacek Anaszewski
     [not found] ` <1374240981-13560-1-git-send-email-j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-07-19 13:36   ` [PATCH v2] iio: lps331ap: " Jacek Anaszewski
     [not found]     ` <1374240981-13560-2-git-send-email-j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-08-04 11:55       ` Jonathan Cameron [this message]
     [not found]         ` <51FE4117.3040404-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-08-04 12:00           ` Jonathan Cameron
     [not found]             ` <51FE4267.2090409-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-08-04 12:08               ` Maxime Ripard
2013-08-04 16:22                 ` Jonathan Cameron
2013-08-04 13:30           ` Lars-Peter Clausen

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=51FE4117.3040404@kernel.org \
    --to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=denis.ciocca-qxv4g6HH51o@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=l.czerwinski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@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).