Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+17 -20
+6
Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
··· 28 28 port or the USB host-controller port to which this device is attached, 29 29 depending on the bus used. Required for the DDC, SPI or USB busses. 30 30 31 + reset-gpios: 32 + maxItems: 1 33 + 31 34 vcc-supply: 32 35 description: > 33 36 Main voltage regulator ··· 52 49 53 50 examples: 54 51 - | 52 + #include <dt-bindings/gpio/gpio.h> 53 + 55 54 serial { 56 55 gnss { 57 56 compatible = "u-blox,neo-8"; 58 57 v-bckp-supply = <&gnss_v_bckp_reg>; 59 58 vcc-supply = <&gnss_vcc_reg>; 59 + reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>; 60 60 }; 61 61 };
+11 -20
drivers/gnss/ubx.c
··· 7 7 8 8 #include <linux/errno.h> 9 9 #include <linux/gnss.h> 10 + #include <linux/gpio/consumer.h> 10 11 #include <linux/init.h> 11 12 #include <linux/kernel.h> 12 13 #include <linux/module.h> ··· 18 17 #include "serial.h" 19 18 20 19 struct ubx_data { 21 - struct regulator *v_bckp; 22 20 struct regulator *vcc; 23 21 }; 24 22 ··· 66 66 static int ubx_probe(struct serdev_device *serdev) 67 67 { 68 68 struct gnss_serial *gserial; 69 + struct gpio_desc *reset; 69 70 struct ubx_data *data; 70 71 int ret; 71 72 ··· 88 87 goto err_free_gserial; 89 88 } 90 89 91 - data->v_bckp = devm_regulator_get_optional(&serdev->dev, "v-bckp"); 92 - if (IS_ERR(data->v_bckp)) { 93 - ret = PTR_ERR(data->v_bckp); 94 - if (ret == -ENODEV) 95 - data->v_bckp = NULL; 96 - else 97 - goto err_free_gserial; 98 - } 90 + ret = devm_regulator_get_enable_optional(&serdev->dev, "v-bckp"); 91 + if (ret < 0 && ret != -ENODEV) 92 + goto err_free_gserial; 99 93 100 - if (data->v_bckp) { 101 - ret = regulator_enable(data->v_bckp); 102 - if (ret) 103 - goto err_free_gserial; 94 + /* Deassert reset */ 95 + reset = devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD_OUT_LOW); 96 + if (IS_ERR(reset)) { 97 + ret = PTR_ERR(reset); 98 + goto err_free_gserial; 104 99 } 105 100 106 101 ret = gnss_serial_register(gserial); 107 102 if (ret) 108 - goto err_disable_v_bckp; 103 + goto err_free_gserial; 109 104 110 105 return 0; 111 106 112 - err_disable_v_bckp: 113 - if (data->v_bckp) 114 - regulator_disable(data->v_bckp); 115 107 err_free_gserial: 116 108 gnss_serial_free(gserial); 117 109 ··· 114 120 static void ubx_remove(struct serdev_device *serdev) 115 121 { 116 122 struct gnss_serial *gserial = serdev_device_get_drvdata(serdev); 117 - struct ubx_data *data = gnss_serial_get_drvdata(gserial); 118 123 119 124 gnss_serial_deregister(gserial); 120 - if (data->v_bckp) 121 - regulator_disable(data->v_bckp); 122 125 gnss_serial_free(gserial); 123 126 } 124 127