From nobody Tue Dec 16 12:34:02 2025 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 3FDEFEB64D7 for ; Tue, 20 Jun 2023 10:39:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232208AbjFTKjo (ORCPT ); Tue, 20 Jun 2023 06:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232177AbjFTKjf (ORCPT ); Tue, 20 Jun 2023 06:39:35 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EE8210F8 for ; Tue, 20 Jun 2023 03:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=2BsJbCMG4/ENDD xROROqsb+IvXX19wdVnpIz1CwK0nE=; b=OqV+R8q+gfa60VfPGLstKbBoyp3OCH nTHQUQOdqCslu/jTAqqE2Y/vwRAsIgjR+HEzqeUuWatCdK7+qHDasbS1YouNHLW4 9nQxkOTgWZCtbXzhvomN0mwxZk0bOLuh2WdGGtpFG8+i0bYPqKxi5XmwPLlJxmU3 Urxw8OFF7x1C8= Received: (qmail 601086 invoked from network); 20 Jun 2023 12:39:26 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 20 Jun 2023 12:39:26 +0200 X-UD-Smtp-Session: l3s3148p1@nQjfQ43+uoxehhtC From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Johan Hovold , Wolfram Sang , linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 2/3] gnss: ubx: add support for the reset gpio Date: Tue, 20 Jun 2023 12:39:07 +0200 Message-Id: <20230620103909.37582-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230620103909.37582-1-wsa+renesas@sang-engineering.com> References: <20230620103909.37582-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- Changes since RFC v1: * rebased because of patches dropped * bail out correctly when requesting GPIO fails (Thanks, Dan!) drivers/gnss/ubx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c index 9b76b101ba5e..cb0612100644 100644 --- a/drivers/gnss/ubx.c +++ b/drivers/gnss/ubx.c @@ -7,6 +7,7 @@ =20 #include #include +#include #include #include #include @@ -18,6 +19,7 @@ =20 struct ubx_data { struct regulator *vcc; + struct gpio_desc *reset_gpio; }; =20 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; =20 + gpiod_set_value_cansleep(data->reset_gpio, 0); + return 0; } =20 @@ -41,6 +45,8 @@ static int ubx_set_standby(struct gnss_serial *gserial) if (ret) return ret; =20 + gpiod_set_value_cansleep(data->reset_gpio, 1); + return 0; } =20 @@ -90,6 +96,13 @@ static int ubx_probe(struct serdev_device *serdev) if (ret < 0 && ret !=3D -ENODEV) goto err_free_gserial; =20 + /* Start with reset asserted (GPIO must be active low!) */ + data->reset_gpio =3D devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD= _OUT_HIGH); + if (IS_ERR(data->reset_gpio)) { + ret =3D PTR_ERR(data->reset_gpio); + goto err_free_gserial; + } + ret =3D gnss_serial_register(gserial); if (ret) goto err_free_gserial; --=20 2.30.2