From patchwork Mon Nov 13 00:51:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13453422 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 A916FC4332F for ; Mon, 13 Nov 2023 00:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbjKMAwa (ORCPT ); Sun, 12 Nov 2023 19:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjKMAw3 (ORCPT ); Sun, 12 Nov 2023 19:52:29 -0500 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AAB01BC0 for ; Sun, 12 Nov 2023 16:52:25 -0800 (PST) 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=EzZ1VatqfWxQhDUcF9TinY3eHHdZUFg/2GJwAA3DgHY=; b=lssJOr V5zSCoLdklIpXZWXwZ/QOafV4vonzgf+MLfzqzEiJwV+MN8DKruO5DHyq7R9Q5YF /8RDWLWV9MQvwqtG+xv2abqUKYH9StEFG6SWLMddiYnZZccoq72G2wx1ZB/ArU8r vX01/0oV0w3XppLRQG2A+W5n9mCNPkFzgvFuZbGlRkV8Gw7DMlhW5zhfF8LCD23P 4n+MnufLWa7ZhqEejG707kTzST/8uoqZUqsG5tTlwt4ssUQSjzXHQTHR2iYp/Zzi eZBp64D6wPExVXdDTXQkncXf7Oj9lmxOsYxyiyA0G/Sv4aE6YXRIuRrJFV7dolxv RH69LKgxyneanKhg== Received: (qmail 4084423 invoked from network); 13 Nov 2023 01:52:24 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 13 Nov 2023 01:52:24 +0100 X-UD-Smtp-Session: l3s3148p1@3s43Ff4J88AMv8XD 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 v5 1/3] gnss: ubx: use new helper to remove open coded regulator handling Date: Sun, 12 Nov 2023 19:51:49 -0500 Message-Id: <20231113005152.10656-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231113005152.10656-1-wsa+renesas@sang-engineering.com> References: <20231113005152.10656-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 --- 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 Mon Nov 13 00:51:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13453423 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 D23BFC4332F for ; Mon, 13 Nov 2023 00:52:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbjKMAwj (ORCPT ); Sun, 12 Nov 2023 19:52:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232679AbjKMAwh (ORCPT ); Sun, 12 Nov 2023 19:52:37 -0500 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E513A2688 for ; Sun, 12 Nov 2023 16:52:33 -0800 (PST) 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=TiJf9ojlNhxPnbwNmLPWFg4kCpD3p403c86z54PQPYc=; b=YE3Tog PpHPXlwO2TjuqG1Kquj3nAfm+3SUV6FEWjnc1gxJTZPfbLcZnVNrYWuUjZ+3eIkt S14S9GpmaIbJ3FKfTtYAa+Nk15KPd2dTNuClf2I6iedbeO5sfYU7QLgm7pbjX7hv C5pMdnEMvZFJXXzq2aq+htq4ZG5ZZA54g5P+hDvIvWrXaHMkMA89hLqQ9496m2if 87MnzjpPF4/AkSOLMrh/gY0gFI9mVgC9AjZlUD3Wa04WM0y/6jYY/fcFdbD6egwA 4PLCJpqI03zP1C1QALSBOCxH61ifWbA7JvD+joVPJlCPIKNIqTGBNXg+NvgBj8V5 jjZRDOjVUBVqV/fw== Received: (qmail 4084506 invoked from network); 13 Nov 2023 01:52:31 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 13 Nov 2023 01:52:31 +0100 X-UD-Smtp-Session: l3s3148p1@OwetFf4JkcIMv8XD From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Conor Dooley , Geert Uytterhoeven , Johan Hovold , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/3] dt-bindings: gnss: u-blox: add "reset-gpios" binding Date: Sun, 12 Nov 2023 19:51:50 -0500 Message-Id: <20231113005152.10656-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231113005152.10656-1-wsa+renesas@sang-engineering.com> References: <20231113005152.10656-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The Renesas KingFisher board includes a U-Blox Neo-M8 chip. This chip has a reset pin which is also wired on the board. Introduce a binding to support this reset pin. Signed-off-by: Wolfram Sang Acked-by: Conor Dooley Reviewed-by: Geert Uytterhoeven --- 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 Mon Nov 13 00:51:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13453424 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 76AFCC4167D for ; Mon, 13 Nov 2023 00:52:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232617AbjKMAwk (ORCPT ); Sun, 12 Nov 2023 19:52:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230322AbjKMAwi (ORCPT ); Sun, 12 Nov 2023 19:52:38 -0500 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3176D1BDD for ; Sun, 12 Nov 2023 16:52:35 -0800 (PST) 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=uNZI7twh1MCj378W/s61ElwRHXmJFA2B2l6wiFxkiz0=; b=U+e1p4 saoAL4Y1oOx/TTQLZnVYbWwRdR+CkxNl7Ct5ZBhX51sSG6OpZtNNlCplXlXZ+dI0 W/2gZhneNJz4flknFepJIPND1tU5x1XmrrUpgS5reC2MX+avWmTZLiLXeRVrNt6j MNnpdVHspoKZBwblbBYNI/qXLyNFaGLePruZ5OqwVJSZnaUKHHeYk+8d98GoF/Uz IgK4k/DnKBKpNR1SlEfMFkk+/dbVRK7T4ti/B3Y9cNMqx8goyEESmUocyeNCU2mT u7fWJavKYXhlc40SrK0817IqqWJq0w/iczVIYC/VSKWR9AAPUZHH8WT1kfK5ODxe zdSGfopJHBTFqFrQ== Received: (qmail 4084559 invoked from network); 13 Nov 2023 01:52:33 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 13 Nov 2023 01:52:33 +0100 X-UD-Smtp-Session: l3s3148p1@mR7NFf4JCsMMv8XD From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Geert Uytterhoeven , Johan Hovold , linux-kernel@vger.kernel.org Subject: [PATCH v5 3/3] gnss: ubx: add support for the reset gpio Date: Sun, 12 Nov 2023 19:51:51 -0500 Message-Id: <20231113005152.10656-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231113005152.10656-1-wsa+renesas@sang-engineering.com> References: <20231113005152.10656-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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 --- Changes since v4: * don't touch reset during open/close. Only deassert it during probe. drivers/gnss/ubx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c index 9b76b101ba5e..84cb50670644 100644 --- a/drivers/gnss/ubx.c +++ b/drivers/gnss/ubx.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -64,6 +65,7 @@ static const struct gnss_serial_ops ubx_gserial_ops = { static int ubx_probe(struct serdev_device *serdev) { + struct gpio_desc *reset_gpio; struct gnss_serial *gserial; 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_gpio = devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(reset_gpio)) { + ret = PTR_ERR(reset_gpio); + goto err_free_gserial; + } + ret = gnss_serial_register(gserial); if (ret) goto err_free_gserial;