From: Tomasz Duszynski <tduszyns@gmail.com>
To: Afonso Bordado <afonsobordado@az8.co>
Cc: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/4] iio: gyro: add device tree support for fxas21002c
Date: Fri, 31 Aug 2018 17:41:25 +0200 [thread overview]
Message-ID: <20180831154124.GB2679@arch> (raw)
In-Reply-To: <20180830211825.12202-2-afonsobordado@az8.co>
On Thu, Aug 30, 2018 at 10:18:23PM +0100, Afonso Bordado wrote:
> This patch adds device tree support for the fxas21002c driver, including
> bindings.
>
> Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
> ---
> .../bindings/iio/gyroscope/fsl,fxas21002c.txt | 35 +++++++++++++++++++
> drivers/iio/gyro/fxas21002c.c | 13 ++++++-
> 2 files changed, 47 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/devicetree/bindings/iio/gyroscope/fsl,fxas21002c.txt
>
> diff --git a/Documentation/devicetree/bindings/iio/gyroscope/fsl,fxas21002c.txt b/Documentation/devicetree/bindings/iio/gyroscope/fsl,fxas21002c.txt
> new file mode 100644
> index 000000000000..2feda6da5566
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/gyroscope/fsl,fxas21002c.txt
> @@ -0,0 +1,35 @@
> +* Freescale FXAS21002C Digital Angular Rate Gyroscope
> +
> +Required properties:
> +
> + - compatible: must be "fsl,fxas21002c"
> + - reg : the I2C address of the sensor
> +
> +Optional properties:
> +
> + - interrupt-parent : phandle to the parent interrupt controller.
> + see interrupt-controller/interrupts.txt
> + - interrupts : The first interrupt listed must be the one
> + connected to the INT1 pin, the second interrupt
> + listed must be the one connected to the INT2 pin.
> + The interrupts can be triggered on rising or falling
> + edges alike.
> + see interrupt-controller/interrupts.txt
> + - vdd-supply : The main voltage regulator
> + - iovdd-supply : The IO voltage regulator
> + see regulator/regulator.txt
> + - reset-gpios : GPIO used to reset the device.
> + see gpio/gpio.txt.
> + - mount-matrix : see iio/mount-matrix.txt
> +
> +Example:
> +gyroscope@0 {
By convention if node has a reg value then the address should be
reflected in the node name as well. So i suggest renaming node to
gyroscope@20.
> + compatible = "fsl,fxas21002c";
> + reg = <0x20>;
> + reset-gpios = <&gpio0 2 0>;
> + vdd-supply = <&vref>;
> + iovdd-supply = <&vref2>;
> + interrupt-parent = <&foo>;
> + interrupts = <0 IRQ_TYPE_EDGE_RISING>,
> + <1 (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)>;
> +};
> diff --git a/drivers/iio/gyro/fxas21002c.c b/drivers/iio/gyro/fxas21002c.c
> index 261b73629544..7471e9b80010 100644
> --- a/drivers/iio/gyro/fxas21002c.c
> +++ b/drivers/iio/gyro/fxas21002c.c
> @@ -8,8 +8,10 @@
> * Datasheet: https://www.nxp.com/docs/en/data-sheet/FXAS21002.pdf
> * TODO:
> * ODR / Scale Support
> - * Devicetree
> * Power management
> + * GPIO Reset
> + * Power supplies
> + * Mount Matrix
> * LowPass/HighPass Filters
> * Buffers
> * Interrupts
> @@ -345,6 +347,14 @@ static int fxas21002c_probe(struct i2c_client *client,
> return ret;
> }
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id fxas21002c_of_ids[] = {
> + {.compatible = "fsl,fxas21002c"},
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, fxas21002c_of_ids);
> +#endif
> +
> static const struct i2c_device_id fxas21002c_id[] = {
> {"fxas21002c", ID_FXAS21002C},
> {}
> @@ -355,6 +365,7 @@ MODULE_DEVICE_TABLE(i2c, fxas21002c_id);
> static struct i2c_driver fxas21002c_driver = {
> .driver = {
> .name = FXAS21002C_DRV_NAME,
> + .of_match_table = of_match_ptr(fxas21002c_of_ids),
> },
> .probe = fxas21002c_probe,
> .id_table = fxas21002c_id,
> --
> 2.18.0
>
>
next prev parent reply other threads:[~2018-08-31 15:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 21:18 [PATCH v2 1/4] iio: gyro: add support for fxas21002c Afonso Bordado
2018-08-30 21:18 ` [PATCH v2 2/4] iio: gyro: add device tree " Afonso Bordado
2018-08-31 15:41 ` Tomasz Duszynski [this message]
2018-09-02 20:50 ` Jonathan Cameron
2018-08-30 21:18 ` [PATCH v2 3/4] iio: fxas21002c: add ODR/Scale support Afonso Bordado
2018-08-30 21:18 ` [PATCH v2 4/4] MAINTAINERS: add entry for fxas21002c gyro driver Afonso Bordado
2018-09-02 20:51 ` Jonathan Cameron
2018-08-31 12:25 ` [PATCH v2 1/4] iio: gyro: add support for fxas21002c Himanshu Jha
2018-09-04 19:23 ` Afonso Bordado
2018-08-31 15:35 ` Tomasz Duszynski
2018-09-04 19:23 ` Afonso Bordado
2018-09-08 14:07 ` 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=20180831154124.GB2679@arch \
--to=tduszyns@gmail.com \
--cc=afonsobordado@az8.co \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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).