lkml.org 
[lkml]   [2018]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/4] iio: gyro: add device tree support for fxas21002c
On Tue, Sep 04, 2018 at 09:04:32PM +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 +++++++++++++++++++

Please split bindings to separate patch.

> drivers/iio/gyro/fxas21002c.c | 10 +++++-
> 2 files changed, 44 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..5f02cfa5ac82
> --- /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

This is implied, so drop it.

> + - 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

Some space before tab on these 2 lines.

> + 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@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 1668e6f3fe11..18b1f500dd3e 100644
> --- a/drivers/iio/gyro/fxas21002c.c
> +++ b/drivers/iio/gyro/fxas21002c.c
> @@ -8,7 +8,6 @@
> * Datasheet: https://www.nxp.com/docs/en/data-sheet/FXAS21002.pdf
> * TODO:
> * ODR / Scale Support
> - * Devicetree
> * Power management
> * GPIO Reset
> * Power supplies
> @@ -350,6 +349,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},
> {}
> @@ -360,6 +367,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
>
>

\
 
 \ /
  Last update: 2018-09-10 22:11    [W:0.057 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site