From patchwork Wed Aug 16 17:31:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13355516 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96154C001E0 for ; Wed, 16 Aug 2023 17:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345227AbjHPRbx (ORCPT ); Wed, 16 Aug 2023 13:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345217AbjHPRbb (ORCPT ); Wed, 16 Aug 2023 13:31:31 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 307542705 for ; Wed, 16 Aug 2023 10:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=P2rc7sulpjUpxzcyy8mwifg0Sx1gBl+pLQOh/S/d6iA=; b=HcSRdn 62DG2vmPkTFIT+a19BfHbwp8Dzl0YVN7sYRobbR5OkHgoc/WTqG3ae05ium51HE9 y7LU6oI3X3Wy0CN2QZhVnFWSoC76WdiE2MiCLN629V2lxYn0nimNeEmK91JpYZ3j 6/VdHgUNvQ3+cEZbUvTHERmnHag6qwIUAMROQ+fyLgH54WnWUCmhSR+/NDeBzglP JkGEmWYqrt6vaWZFGzY2rMKBxuhTgHHzhJMWxWgHTz0HQUb+gTEw5TJM1y8bZiLB 7tl3645l7IbJWZEay41qTnT8CyrBsznTaWOrS0TLPwbQYoWUptWPAx66894MD0ZW 8TmZQrznq3M57+Ag== Received: (qmail 219428 invoked from network); 16 Aug 2023 19:31:25 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 16 Aug 2023 19:31:25 +0200 X-UD-Smtp-Session: l3s3148p1@3bE2qg0DsM5ehhtV From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Geert Uytterhoeven , Johan Hovold , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] gnss: ubx: use new helper to remove open coded regulator handling Date: Wed, 16 Aug 2023 19:31:13 +0200 Message-Id: <20230816173116.1176-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230816173116.1176-1-wsa+renesas@sang-engineering.com> References: <20230816173116.1176-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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 Reviewed-by: Geert Uytterhoeven --- Change since v1: * added tag (Thanks, Geert!) 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); } From patchwork Wed Aug 16 17:31:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13355517 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1E09C04FDF for ; Wed, 16 Aug 2023 17:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345208AbjHPRby (ORCPT ); Wed, 16 Aug 2023 13:31:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345219AbjHPRbb (ORCPT ); Wed, 16 Aug 2023 13:31:31 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6981E2709 for ; Wed, 16 Aug 2023 10:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=rituae/iaeh5s9cpCUCiJveKS5FWe/oGwlrBI3xEyac=; b=funMT0 tV21G/ILisyI+GhAsjpUUi9soN9KXqmetRCqzXxzu2Se5qQotnJRHSxldYSP4Ruh rHlSV7FmjYUdzuyMBP9ychUtry9+ZXzj74cUnlHsQFClTmRn9OePOUTpc8gu529h Sxr2MGxaClC4KRblIyQYLCXJyx5MmtGZblnAAi3Q+m1JGKoJR01IATV5c52ATjVL 5AkqpnQJnYIGkyQaG2d/vMxy/RzxtDORQtx8X90obiTUuzGDpyh1V6z6eNSZIrUI YSjs1SPLVp9/KsJhJKsCloBo56PX2pET9MYFh2gnnx89DGpum9fk6HBRHkSwyqH3 lY47i6Q0lZcdwQEw== Received: (qmail 219475 invoked from network); 16 Aug 2023 19:31:26 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 16 Aug 2023 19:31:26 +0200 X-UD-Smtp-Session: l3s3148p1@7BhDqg0Dvs5ehhtV From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Johan Hovold , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Date: Wed, 16 Aug 2023 19:31:14 +0200 Message-Id: <20230816173116.1176-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230816173116.1176-1-wsa+renesas@sang-engineering.com> References: <20230816173116.1176-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Needed to enable this chip on a Renesas KingFisher board. Description copied over from the Mediatek driver which already supports it. Signed-off-by: Wolfram Sang Acked-by: Conor Dooley Reviewed-by: Geert Uytterhoeven --- Changes since v1: * dropped obvious description (Thanks, Geert!) * added missing include (Thanks, Krzysztof and Rob!) I build tested the change this time. 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 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>; }; }; From patchwork Wed Aug 16 17:31:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13355514 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F13BAC001B0 for ; Wed, 16 Aug 2023 17:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345211AbjHPRby (ORCPT ); Wed, 16 Aug 2023 13:31:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345223AbjHPRbc (ORCPT ); Wed, 16 Aug 2023 13:31:32 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAAB8270C for ; Wed, 16 Aug 2023 10:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=VcKHUn11Q66zpSkuewbK9fayGKVu5QJaVzvUdZ9guSU=; b=ZrlguP /8DrWZlezE+YMjYFXF4gt+eksVVX7yXlgU99aqvuQTVbbC/LCIKzr83EZfdTFpuR R47dvvAvWz1QB5ai6+I5sitcLFtxk05GYwwVEoONwuE1omsaJiTZNCpMJLi9VTC0 hUicQSrDbQ3xvqhWX7qR3p4hdQ/aKd/W8Y2Uwpu/VPfWUL/k6wZivY7ZyshqkVWw mNjmITXNzSWcAsHp34ODFPt0iWV5fcKXazG2UdD9gQU8mVA8mkIqLQrxL4s7bcWh bD0whVvC/YlcV1zWdj22li5qmKg0moOWkK87xFGXdylDYUSFjKYzt+FEF0LEr772 cv8oWUG2rdUQ8uWQ== Received: (qmail 219520 invoked from network); 16 Aug 2023 19:31:27 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 16 Aug 2023 19:31:27 +0200 X-UD-Smtp-Session: l3s3148p1@DSNNqg0Dzs5ehhtV From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Johan Hovold , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] gnss: ubx: add support for the reset gpio Date: Wed, 16 Aug 2023 19:31:15 +0200 Message-Id: <20230816173116.1176-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230816173116.1176-1-wsa+renesas@sang-engineering.com> References: <20230816173116.1176-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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 Reviewed-by: Geert Uytterhoeven --- Changes since v1: * proper reverse order in ubx_set_standby (Thanks, Geert!) * simplified the comment when initiall asserting the GPIO (Thanks, Geert!) drivers/gnss/ubx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c index 9b76b101ba5e..e7d151cbc8c3 100644 --- a/drivers/gnss/ubx.c +++ b/drivers/gnss/ubx.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -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; } @@ -37,6 +41,8 @@ static int ubx_set_standby(struct gnss_serial *gserial) struct ubx_data *data = gnss_serial_get_drvdata(gserial); int ret; + gpiod_set_value_cansleep(data->reset_gpio, 1); + ret = regulator_disable(data->vcc); if (ret) return ret; @@ -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 */ + 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;