public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant
@ 2023-11-13  0:51 Wolfram Sang
  2023-11-13  0:51 ` [PATCH v5 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Wolfram Sang @ 2023-11-13  0:51 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Wolfram Sang, devicetree, Johan Hovold, linux-kernel

The Renesas KingFisher board includes a U-Blox Neo-M8 chip with its
reset pin wired to a GPIO. To support that, we need "reset-gpio" support
(patches 2+3). But first, simplify regulator handling with a new helper
(patch 1).

Changes since v4:

* don't touch reset during open/close. Only deassert it during probe.
  [patch 3]


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          |  5 +++
 drivers/gnss/ubx.c                            | 31 +++++++------------
 2 files changed, 16 insertions(+), 20 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v5 1/3] gnss: ubx: use new helper to remove open coded regulator handling
  2023-11-13  0:51 [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
@ 2023-11-13  0:51 ` Wolfram Sang
  2023-11-13  0:51 ` [PATCH v5 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2023-11-13  0:51 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Geert Uytterhoeven, 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>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 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.35.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding
  2023-11-13  0:51 [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
  2023-11-13  0:51 ` [PATCH v5 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
@ 2023-11-13  0:51 ` Wolfram Sang
  2023-11-13  0:51 ` [PATCH v5 3/3] gnss: ubx: add support for the reset gpio Wolfram Sang
  2023-12-12  3:30 ` [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
  3 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2023-11-13  0:51 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Conor Dooley, Geert Uytterhoeven, Johan Hovold,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	linux-kernel

The Renesas KingFisher board includes a U-Blox Neo-M8 chip. This chip
has a reset pin which is also wired on the board. Introduce a binding to
support this reset pin.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml | 5 +++++
 1 file changed, 5 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..8e97e475613f 100644
--- a/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
+++ b/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
@@ -41,6 +41,9 @@ properties:
     description: >
       Backup voltage regulator
 
+  reset-gpios:
+    maxItems: 1
+
 required:
   - compatible
   - vcc-supply
@@ -49,10 +52,12 @@ unevaluatedProperties: false
 
 examples:
   - |
+    #include <dt-bindings/gpio/gpio.h>
     serial {
         gnss {
             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.35.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v5 3/3] gnss: ubx: add support for the reset gpio
  2023-11-13  0:51 [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
  2023-11-13  0:51 ` [PATCH v5 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
  2023-11-13  0:51 ` [PATCH v5 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
@ 2023-11-13  0:51 ` Wolfram Sang
  2023-12-12  3:30 ` [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
  3 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2023-11-13  0:51 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Geert Uytterhoeven, Johan Hovold, linux-kernel

The Renesas KingFisher board includes a U-Blox Neo-M8 chip. This chip
has a reset pin which is also wired on the board. When Linux starts,
reset is asserted by the firmware. Deassert the reset pin when probing
this driver.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Changes since v4:

* don't touch reset during open/close. Only deassert it during probe.

 drivers/gnss/ubx.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c
index 9b76b101ba5e..84cb50670644 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>
@@ -64,6 +65,7 @@ static const struct gnss_serial_ops ubx_gserial_ops = {
 
 static int ubx_probe(struct serdev_device *serdev)
 {
+	struct gpio_desc *reset_gpio;
 	struct gnss_serial *gserial;
 	struct ubx_data *data;
 	int ret;
@@ -90,6 +92,13 @@ static int ubx_probe(struct serdev_device *serdev)
 	if (ret < 0 && ret != -ENODEV)
 		goto err_free_gserial;
 
+	/* Deassert Reset */
+	reset_gpio = devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(reset_gpio)) {
+		ret = PTR_ERR(reset_gpio);
+		goto err_free_gserial;
+	}
+
 	ret = gnss_serial_register(gserial);
 	if (ret)
 		goto err_free_gserial;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant
  2023-11-13  0:51 [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
                   ` (2 preceding siblings ...)
  2023-11-13  0:51 ` [PATCH v5 3/3] gnss: ubx: add support for the reset gpio Wolfram Sang
@ 2023-12-12  3:30 ` Wolfram Sang
  2023-12-14 15:53   ` Wolfram Sang
  3 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2023-12-12  3:30 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: devicetree, Johan Hovold, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 472 bytes --]

On Sun, Nov 12, 2023 at 07:51:48PM -0500, Wolfram Sang wrote:
> The Renesas KingFisher board includes a U-Blox Neo-M8 chip with its
> reset pin wired to a GPIO. To support that, we need "reset-gpio" support
> (patches 2+3). But first, simplify regulator handling with a new helper
> (patch 1).
> 
> Changes since v4:
> 
> * don't touch reset during open/close. Only deassert it during probe.
>   [patch 3]

Johan, all good now?

Happy hacking,

   Wolfram

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant
  2023-12-12  3:30 ` [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
@ 2023-12-14 15:53   ` Wolfram Sang
  2023-12-15  8:34     ` Johan Hovold
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2023-12-14 15:53 UTC (permalink / raw)
  To: linux-renesas-soc, devicetree, Johan Hovold, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

On Tue, Dec 12, 2023 at 04:30:10AM +0100, Wolfram Sang wrote:
> On Sun, Nov 12, 2023 at 07:51:48PM -0500, Wolfram Sang wrote:
> > The Renesas KingFisher board includes a U-Blox Neo-M8 chip with its
> > reset pin wired to a GPIO. To support that, we need "reset-gpio" support
> > (patches 2+3). But first, simplify regulator handling with a new helper
> > (patch 1).
> > 
> > Changes since v4:
> > 
> > * don't touch reset during open/close. Only deassert it during probe.
> >   [patch 3]
> 
> Johan, all good now?

If there are no further comments, can we have this series in 6.8.?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant
  2023-12-14 15:53   ` Wolfram Sang
@ 2023-12-15  8:34     ` Johan Hovold
  2023-12-15 20:15       ` Wolfram Sang
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Hovold @ 2023-12-15  8:34 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-renesas-soc, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

On Thu, Dec 14, 2023 at 04:53:06PM +0100, Wolfram Sang wrote:
> On Tue, Dec 12, 2023 at 04:30:10AM +0100, Wolfram Sang wrote:
> > On Sun, Nov 12, 2023 at 07:51:48PM -0500, Wolfram Sang wrote:
> > > The Renesas KingFisher board includes a U-Blox Neo-M8 chip with its
> > > reset pin wired to a GPIO. To support that, we need "reset-gpio" support
> > > (patches 2+3). But first, simplify regulator handling with a new helper
> > > (patch 1).
> > > 
> > > Changes since v4:
> > > 
> > > * don't touch reset during open/close. Only deassert it during probe.
> > >   [patch 3]
> > 
> > Johan, all good now?
> 
> If there are no further comments, can we have this series in 6.8.?

All good. Now applied for 6.8.

Johan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant
  2023-12-15  8:34     ` Johan Hovold
@ 2023-12-15 20:15       ` Wolfram Sang
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2023-12-15 20:15 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-renesas-soc, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 49 bytes --]

> All good. Now applied for 6.8.

Thank you! :)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-15 20:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13  0:51 [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
2023-11-13  0:51 ` [PATCH v5 1/3] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
2023-11-13  0:51 ` [PATCH v5 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Wolfram Sang
2023-11-13  0:51 ` [PATCH v5 3/3] gnss: ubx: add support for the reset gpio Wolfram Sang
2023-12-12  3:30 ` [PATCH v5 0/3] gnss: ubx: support the reset pin of the Neo-M8 variant Wolfram Sang
2023-12-14 15:53   ` Wolfram Sang
2023-12-15  8:34     ` Johan Hovold
2023-12-15 20:15       ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox