From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-renesas-soc@vger.kernel.org
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Johan Hovold <johan@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] gnss: ubx: add support for the reset gpio
Date: Wed, 12 Jul 2023 13:37:31 +0200 [thread overview]
Message-ID: <20230712113731.3306-4-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20230712113731.3306-1-wsa+renesas@sang-engineering.com>
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
next prev parent reply other threads:[~2023-07-12 11:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Wolfram Sang [this message]
2023-07-12 11:58 ` [PATCH 3/3] gnss: ubx: add support for the reset gpio Geert Uytterhoeven
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=20230712113731.3306-4-wsa+renesas@sang-engineering.com \
--to=wsa+renesas@sang-engineering.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.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
all inboxes | Powered by JetHome®