Commit 645f910f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gnss-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/gnss

Pull GNSS updates from Johan Hovold:

 - support for the reset pin found on some u-blox receivers

 - use new regulator helper for the u-blox backup supply

* tag 'gnss-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/gnss:
  gnss: ubx: add support for the reset gpio
  dt-bindings: gnss: u-blox: add "reset-gpios" binding
  gnss: ubx: use new helper to remove open coded regulator handling
parents c736c9a9 0cbbbe09
...@@ -28,6 +28,9 @@ properties: ...@@ -28,6 +28,9 @@ properties:
port or the USB host-controller port to which this device is attached, port or the USB host-controller port to which this device is attached,
depending on the bus used. Required for the DDC, SPI or USB busses. depending on the bus used. Required for the DDC, SPI or USB busses.
reset-gpios:
maxItems: 1
vcc-supply: vcc-supply:
description: > description: >
Main voltage regulator Main voltage regulator
...@@ -49,10 +52,13 @@ unevaluatedProperties: false ...@@ -49,10 +52,13 @@ unevaluatedProperties: false
examples: examples:
- | - |
#include <dt-bindings/gpio/gpio.h>
serial { serial {
gnss { gnss {
compatible = "u-blox,neo-8"; compatible = "u-blox,neo-8";
v-bckp-supply = <&gnss_v_bckp_reg>; v-bckp-supply = <&gnss_v_bckp_reg>;
vcc-supply = <&gnss_vcc_reg>; vcc-supply = <&gnss_vcc_reg>;
reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
}; };
}; };
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/gnss.h> #include <linux/gnss.h>
#include <linux/gpio/consumer.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
#include "serial.h" #include "serial.h"
struct ubx_data { struct ubx_data {
struct regulator *v_bckp;
struct regulator *vcc; struct regulator *vcc;
}; };
...@@ -66,6 +66,7 @@ static const struct gnss_serial_ops ubx_gserial_ops = { ...@@ -66,6 +66,7 @@ static const struct gnss_serial_ops ubx_gserial_ops = {
static int ubx_probe(struct serdev_device *serdev) static int ubx_probe(struct serdev_device *serdev)
{ {
struct gnss_serial *gserial; struct gnss_serial *gserial;
struct gpio_desc *reset;
struct ubx_data *data; struct ubx_data *data;
int ret; int ret;
...@@ -87,30 +88,23 @@ static int ubx_probe(struct serdev_device *serdev) ...@@ -87,30 +88,23 @@ static int ubx_probe(struct serdev_device *serdev)
goto err_free_gserial; goto err_free_gserial;
} }
data->v_bckp = devm_regulator_get_optional(&serdev->dev, "v-bckp"); ret = devm_regulator_get_enable_optional(&serdev->dev, "v-bckp");
if (IS_ERR(data->v_bckp)) { if (ret < 0 && ret != -ENODEV)
ret = PTR_ERR(data->v_bckp);
if (ret == -ENODEV)
data->v_bckp = NULL;
else
goto err_free_gserial; goto err_free_gserial;
}
if (data->v_bckp) { /* Deassert reset */
ret = regulator_enable(data->v_bckp); reset = devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD_OUT_LOW);
if (ret) if (IS_ERR(reset)) {
ret = PTR_ERR(reset);
goto err_free_gserial; goto err_free_gserial;
} }
ret = gnss_serial_register(gserial); ret = gnss_serial_register(gserial);
if (ret) if (ret)
goto err_disable_v_bckp; goto err_free_gserial;
return 0; return 0;
err_disable_v_bckp:
if (data->v_bckp)
regulator_disable(data->v_bckp);
err_free_gserial: err_free_gserial:
gnss_serial_free(gserial); gnss_serial_free(gserial);
...@@ -120,11 +114,8 @@ static int ubx_probe(struct serdev_device *serdev) ...@@ -120,11 +114,8 @@ static int ubx_probe(struct serdev_device *serdev)
static void ubx_remove(struct serdev_device *serdev) static void ubx_remove(struct serdev_device *serdev)
{ {
struct gnss_serial *gserial = serdev_device_get_drvdata(serdev); struct gnss_serial *gserial = serdev_device_get_drvdata(serdev);
struct ubx_data *data = gnss_serial_get_drvdata(gserial);
gnss_serial_deregister(gserial); gnss_serial_deregister(gserial);
if (data->v_bckp)
regulator_disable(data->v_bckp);
gnss_serial_free(gserial); gnss_serial_free(gserial);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment