* [PATCH 0/3] gnss: ubx: updates to support the Renesas KingFisher board
@ 2023-07-12 11:37 Wolfram Sang
2023-07-12 11:37 ` [PATCH 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Wolfram Sang @ 2023-07-12 11:37 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: Wolfram Sang, devicetree, Johan Hovold, linux-kernel
For that, we need "reset-gpio" support (patches 2+3). But first,
simplify regulator handling with a new helper (patch 1).
Changes since RFC v2:
* dropped DTS patch because the binding is clear now and we can upstream
it separately
* added binding documentation
* rebased to 6.5-rc1
Wolfram Sang (3):
gnss: ubx: use new helper to remove open coded regulator handling
dt-bindings: gnss: u-blox: add "reset-gpios" binding
gnss: ubx: add support for the reset gpio
.../bindings/gnss/u-blox,neo-6m.yaml | 7 ++++
drivers/gnss/ubx.c | 35 ++++++++-----------
2 files changed, 22 insertions(+), 20 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] gnss: ubx: use new helper to remove open coded regulator handling
2023-07-12 11:37 [PATCH 0/3] gnss: ubx: updates to support the Renesas KingFisher board Wolfram Sang
@ 2023-07-12 11:37 ` Wolfram Sang
2023-07-12 11:50 ` Geert Uytterhoeven
2023-07-12 11:37 ` [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
2023-07-12 11:37 ` [PATCH 3/3] gnss: ubx: add support for the reset gpio Wolfram Sang
2 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2023-07-12 11:37 UTC (permalink / raw)
To: linux-renesas-soc
Cc: Wolfram Sang, Johan Hovold, Liam Girdwood, Mark Brown, linux-kernel
v_bckp shall always be enabled as long as the device exists. We now have
a regulator helper for that, use it.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/gnss/ubx.c | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c
index c951be202ca2..9b76b101ba5e 100644
--- a/drivers/gnss/ubx.c
+++ b/drivers/gnss/ubx.c
@@ -17,7 +17,6 @@
#include "serial.h"
struct ubx_data {
- struct regulator *v_bckp;
struct regulator *vcc;
};
@@ -87,30 +86,16 @@ static int ubx_probe(struct serdev_device *serdev)
goto err_free_gserial;
}
- data->v_bckp = devm_regulator_get_optional(&serdev->dev, "v-bckp");
- if (IS_ERR(data->v_bckp)) {
- ret = PTR_ERR(data->v_bckp);
- if (ret == -ENODEV)
- data->v_bckp = NULL;
- else
- goto err_free_gserial;
- }
-
- if (data->v_bckp) {
- ret = regulator_enable(data->v_bckp);
- if (ret)
- goto err_free_gserial;
- }
+ ret = devm_regulator_get_enable_optional(&serdev->dev, "v-bckp");
+ if (ret < 0 && ret != -ENODEV)
+ goto err_free_gserial;
ret = gnss_serial_register(gserial);
if (ret)
- goto err_disable_v_bckp;
+ goto err_free_gserial;
return 0;
-err_disable_v_bckp:
- if (data->v_bckp)
- regulator_disable(data->v_bckp);
err_free_gserial:
gnss_serial_free(gserial);
@@ -120,11 +105,8 @@ static int ubx_probe(struct serdev_device *serdev)
static void ubx_remove(struct serdev_device *serdev)
{
struct gnss_serial *gserial = serdev_device_get_drvdata(serdev);
- struct ubx_data *data = gnss_serial_get_drvdata(gserial);
gnss_serial_deregister(gserial);
- if (data->v_bckp)
- regulator_disable(data->v_bckp);
gnss_serial_free(gserial);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding
2023-07-12 11:37 [PATCH 0/3] gnss: ubx: updates to support the Renesas KingFisher board Wolfram Sang
2023-07-12 11:37 ` [PATCH 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
@ 2023-07-12 11:37 ` Wolfram Sang
2023-07-12 11:48 ` Krzysztof Kozlowski
` (2 more replies)
2023-07-12 11:37 ` [PATCH 3/3] gnss: ubx: add support for the reset gpio Wolfram Sang
2 siblings, 3 replies; 9+ messages in thread
From: Wolfram Sang @ 2023-07-12 11:37 UTC (permalink / raw)
To: linux-renesas-soc
Cc: Wolfram Sang, Johan Hovold, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, devicetree, linux-kernel
Needed to enable this chip on a Renesas KingFisher board. Description
copied over from the Mediatek driver which already supports it.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml b/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
index 4835a280b3bf..8f6992b97ca6 100644
--- a/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
+++ b/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
@@ -41,6 +41,12 @@ properties:
description: >
Backup voltage regulator
+ reset-gpios:
+ maxItems: 1
+ description: >
+ An optional reset line, with names such as RESET or NRESET.
+ If the line is active low it should be flagged with GPIO_ACTIVE_LOW.
+
required:
- compatible
- vcc-supply
@@ -54,5 +60,6 @@ examples:
compatible = "u-blox,neo-8";
v-bckp-supply = <&gnss_v_bckp_reg>;
vcc-supply = <&gnss_vcc_reg>;
+ reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
};
};
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] gnss: ubx: add support for the reset gpio
2023-07-12 11:37 [PATCH 0/3] gnss: ubx: updates to support the Renesas KingFisher board Wolfram Sang
2023-07-12 11:37 ` [PATCH 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
2023-07-12 11:37 ` [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
@ 2023-07-12 11:37 ` Wolfram Sang
2023-07-12 11:58 ` Geert Uytterhoeven
2 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2023-07-12 11:37 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: Wolfram Sang, Johan Hovold, linux-kernel
Tested with a Renesas KingFisher board. Because my GNSS device is hooked
up via UART and I2C simultaneously, I could verify functionality by
opening/closing the GNSS device using UART and see if the corresponding
I2C device was visible on the bus.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/gnss/ubx.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c
index 9b76b101ba5e..cb0612100644 100644
--- a/drivers/gnss/ubx.c
+++ b/drivers/gnss/ubx.c
@@ -7,6 +7,7 @@
#include <linux/errno.h>
#include <linux/gnss.h>
+#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
@@ -18,6 +19,7 @@
struct ubx_data {
struct regulator *vcc;
+ struct gpio_desc *reset_gpio;
};
static int ubx_set_active(struct gnss_serial *gserial)
@@ -29,6 +31,8 @@ static int ubx_set_active(struct gnss_serial *gserial)
if (ret)
return ret;
+ gpiod_set_value_cansleep(data->reset_gpio, 0);
+
return 0;
}
@@ -41,6 +45,8 @@ static int ubx_set_standby(struct gnss_serial *gserial)
if (ret)
return ret;
+ gpiod_set_value_cansleep(data->reset_gpio, 1);
+
return 0;
}
@@ -90,6 +96,13 @@ static int ubx_probe(struct serdev_device *serdev)
if (ret < 0 && ret != -ENODEV)
goto err_free_gserial;
+ /* Start with reset asserted (GPIO must be active low!) */
+ data->reset_gpio = devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(data->reset_gpio)) {
+ ret = PTR_ERR(data->reset_gpio);
+ goto err_free_gserial;
+ }
+
ret = gnss_serial_register(gserial);
if (ret)
goto err_free_gserial;
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding
2023-07-12 11:37 ` [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
@ 2023-07-12 11:48 ` Krzysztof Kozlowski
2023-07-12 11:52 ` Geert Uytterhoeven
2023-07-12 12:16 ` Rob Herring
2 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-12 11:48 UTC (permalink / raw)
To: Wolfram Sang, linux-renesas-soc
Cc: Johan Hovold, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
devicetree, linux-kernel
On 12/07/2023 13:37, Wolfram Sang wrote:
> Needed to enable this chip on a Renesas KingFisher board. Description
> copied over from the Mediatek driver which already supports it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml b/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
> index 4835a280b3bf..8f6992b97ca6 100644
> --- a/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
> +++ b/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
> @@ -41,6 +41,12 @@ properties:
> description: >
> Backup voltage regulator
>
> + reset-gpios:
> + maxItems: 1
> + description: >
> + An optional reset line, with names such as RESET or NRESET.
> + If the line is active low it should be flagged with GPIO_ACTIVE_LOW.
> +
> required:
> - compatible
> - vcc-supply
> @@ -54,5 +60,6 @@ examples:
> compatible = "u-blox,neo-8";
> v-bckp-supply = <&gnss_v_bckp_reg>;
> vcc-supply = <&gnss_vcc_reg>;
> + reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
This should complain with errors, because of missing header for the
defines, so usual disclaimer:
It does not look like you tested the bindings, at least after quick
look. Please run `make dt_binding_check` (see
Documentation/devicetree/bindings/writing-schema.rst for instructions).
Maybe you need to update your dtschema and yamllint.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] gnss: ubx: use new helper to remove open coded regulator handling
2023-07-12 11:37 ` [PATCH 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
@ 2023-07-12 11:50 ` Geert Uytterhoeven
0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2023-07-12 11:50 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-renesas-soc, Johan Hovold, Liam Girdwood, Mark Brown, linux-kernel
On Wed, Jul 12, 2023 at 1:40 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> v_bckp shall always be enabled as long as the device exists. We now have
> a regulator helper for that, use it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding
2023-07-12 11:37 ` [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
2023-07-12 11:48 ` Krzysztof Kozlowski
@ 2023-07-12 11:52 ` Geert Uytterhoeven
2023-07-12 12:16 ` Rob Herring
2 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2023-07-12 11:52 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-renesas-soc, Johan Hovold, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, devicetree, linux-kernel
Hi Wolfram,
On Wed, Jul 12, 2023 at 1:40 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> Needed to enable this chip on a Renesas KingFisher board. Description
> copied over from the Mediatek driver which already supports it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Thanks for your patch!
> --- a/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
> +++ b/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
> @@ -41,6 +41,12 @@ properties:
> description: >
> Backup voltage regulator
>
> + reset-gpios:
> + maxItems: 1
> + description: >
> + An optional reset line, with names such as RESET or NRESET.
> + If the line is active low it should be flagged with GPIO_ACTIVE_LOW.
I think you can drop the description, as it describes only the obvious.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] gnss: ubx: add support for the reset gpio
2023-07-12 11:37 ` [PATCH 3/3] gnss: ubx: add support for the reset gpio Wolfram Sang
@ 2023-07-12 11:58 ` Geert Uytterhoeven
0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2023-07-12 11:58 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-renesas-soc, Johan Hovold, linux-kernel
Hi Wolfram,
On Wed, Jul 12, 2023 at 1:40 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> Tested with a Renesas KingFisher board. Because my GNSS device is hooked
> up via UART and I2C simultaneously, I could verify functionality by
> opening/closing the GNSS device using UART and see if the corresponding
> I2C device was visible on the bus.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Thanks for your patch!
> --- a/drivers/gnss/ubx.c
> +++ b/drivers/gnss/ubx.c
> @@ -29,6 +31,8 @@ static int ubx_set_active(struct gnss_serial *gserial)
> if (ret)
> return ret;
>
> + gpiod_set_value_cansleep(data->reset_gpio, 0);
> +
> return 0;
> }
>
> @@ -41,6 +45,8 @@ static int ubx_set_standby(struct gnss_serial *gserial)
> if (ret)
> return ret;
>
> + gpiod_set_value_cansleep(data->reset_gpio, 1);
Please assert reset before disabling the regulator, for symmetry
with ubx_set_active().
> +
> return 0;
> }
>
> @@ -90,6 +96,13 @@ static int ubx_probe(struct serdev_device *serdev)
> if (ret < 0 && ret != -ENODEV)
> goto err_free_gserial;
>
> + /* Start with reset asserted (GPIO must be active low!) */
Does it have to be active low?
The description in your DT bindings suggest both active low and active
high are possible.
I think you just wanted to express that GPIOD_OUT_HIGH means asserted,
i.e. low for the common case of an active-low reset?
> + data->reset_gpio = devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD_OUT_HIGH);
> + if (IS_ERR(data->reset_gpio)) {
> + ret = PTR_ERR(data->reset_gpio);
> + goto err_free_gserial;
> + }
> +
> ret = gnss_serial_register(gserial);
> if (ret)
> goto err_free_gserial;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding
2023-07-12 11:37 ` [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
2023-07-12 11:48 ` Krzysztof Kozlowski
2023-07-12 11:52 ` Geert Uytterhoeven
@ 2023-07-12 12:16 ` Rob Herring
2 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2023-07-12 12:16 UTC (permalink / raw)
To: Wolfram Sang
Cc: Johan Hovold, Conor Dooley, linux-renesas-soc, Rob Herring,
devicetree, Krzysztof Kozlowski, linux-kernel
On Wed, 12 Jul 2023 13:37:30 +0200, Wolfram Sang wrote:
> Needed to enable this chip on a Renesas KingFisher board. Description
> copied over from the Mediatek driver which already supports it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/gnss/u-blox,neo-6m.example.dts:23.40-41 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/gnss/u-blox,neo-6m.example.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1500: dt_binding_check] Error 2
make: *** [Makefile:234: __sub-make] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230712113731.3306-3-wsa+renesas@sang-engineering.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-07-12 12:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-12 11:37 [PATCH 0/3] gnss: ubx: updates to support the Renesas KingFisher board Wolfram Sang
2023-07-12 11:37 ` [PATCH 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
2023-07-12 11:50 ` Geert Uytterhoeven
2023-07-12 11:37 ` [PATCH 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
2023-07-12 11:48 ` Krzysztof Kozlowski
2023-07-12 11:52 ` Geert Uytterhoeven
2023-07-12 12:16 ` Rob Herring
2023-07-12 11:37 ` [PATCH 3/3] gnss: ubx: add support for the reset gpio Wolfram Sang
2023-07-12 11:58 ` Geert Uytterhoeven
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.