From 0cbbbe09d49b959d0225f7f2223a8ae3b2c1964c Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Sun, 12 Nov 2023 19:51:51 -0500 Subject: gnss: ubx: add support for the reset gpio 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 Reviewed-by: Geert Uytterhoeven [ johan: rename gpio descriptor variable ] Signed-off-by: Johan Hovold --- drivers/gnss/ubx.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/gnss') diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c index 9b76b101ba5e..92402f6082c4 100644 --- a/drivers/gnss/ubx.c +++ b/drivers/gnss/ubx.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -65,6 +66,7 @@ static const struct gnss_serial_ops ubx_gserial_ops = { static int ubx_probe(struct serdev_device *serdev) { struct gnss_serial *gserial; + struct gpio_desc *reset; 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 = devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(reset)) { + ret = PTR_ERR(reset); + goto err_free_gserial; + } + ret = gnss_serial_register(gserial); if (ret) goto err_free_gserial; -- cgit v1.2.3