Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2336577rdb; Thu, 21 Sep 2023 16:02:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsXgHYi4/7Uct/JZJgdaPBNfqGVyGPe9wYSsUvk7DQ5i+ZwyZr/SUswpSwYOuJKNgidxdl X-Received: by 2002:a17:90a:b018:b0:270:b961:1c3d with SMTP id x24-20020a17090ab01800b00270b9611c3dmr6391409pjq.22.1695337348960; Thu, 21 Sep 2023 16:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695337348; cv=none; d=google.com; s=arc-20160816; b=xP+m4moNbr2bShExTGRkPaT9mcBG0Bq2o6vljvRX1IjK3wj9F7c6PceNx4BJ9mFq6C zoqGcNtX8TTypyVfanLANnQORfwrhJxYUBC7oz/LWzyzFyjA+rRf2aNbBqAL2twycsSB 3kNolcDaEe6WDxK58bSyBxLFY4rK7wxqn40bdDD6hnInhuBquLUHWF7JiJnnwK65gpp6 poPwKrAsggd9KfBkNYPEZqFBVJU2lRvvnjEnXmA+cI8f1KaPVuTVSc2LfhSaxtLZ2oh1 ZKfQ/bvlllX8RX1VK2KDmqwmqpZKzrW7SrFxDGENo4PzqTuBvPzetdvz0cX/bogmKniF WY4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uK9AT+p6I3q5cMU/FhQSmJyxMmdzZujBNmfXxX9OQ/Y=; fh=VjHho0Qv8oJSt7HJ3RgckH4LAQCZvu5o942PmtSURt4=; b=QcZpDmyITTQ8+KOqueEy/Ms7zCn4Dx706Wbs01mF2q4LIDb+IE3QR2yWbt64vMHg6y vt6mksBQR4j3pe/6PfUfdVlEXuASxSB70KBkpB2MMzFG4oGuY/fBEMXE14ugJaNNIgTN 21rALnAzm0A3/MREFKNpVlMRV/5ErBTJ9OYrt/OwX5cXiPNbToGUIjtmvHzSYarUMWwP rlhOzCwza7Xr9WzvSP3w8VBxmkRdXHKXU/6TPo55sXwm+l3yCCHkLovB6z9K7ImMH1MP cTZhA/LvMd0z6Ce3wUHsGJW1JfcFFU4ekejvoOVjqb7goLrJR/hcD6mwMZuIfSt3Malc qg6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b="Ws/F0yIJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i7-20020a17090a64c700b0026d46757b20si2557810pjm.149.2023.09.21.16.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 16:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b="Ws/F0yIJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A6DB284C80EA; Thu, 21 Sep 2023 13:17:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjIUURM (ORCPT + 99 others); Thu, 21 Sep 2023 16:17:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230396AbjIUUQr (ORCPT ); Thu, 21 Sep 2023 16:16:47 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F28B86E453 for ; Thu, 21 Sep 2023 11:58:55 -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=uK9AT+p6I3q5cMU/FhQSmJyxMmdzZujBNmfXxX9OQ/Y=; b=Ws/F0y IJEUCwYVDuBG8XEfGaRJOOmpS8LZ1ZxuugbH7mpzb9f7oJZq3wD3GmogwiFcof0U Q1l3H/AzKU8TUCiu0bQ5G5onMskbG8xMfleaDnkazoVXu5HXVfNZg2NfjELPgLWj cqBz/ZyrcF8Mj6YEgwLQPECsA73JSU2aln8IVfMSdQQY61GgFHPkIFHHwmL8Q7MQ ZZ8zdV2LM4z8mgxFS2nQ2R9N/ncsB9T5b3eRKXq/E3arY2FWc2zYO/aDWgqhW2zY NEpzmZ9zPFBC2wJ31UjWnbpqyJP1jtWIyNBigtjOkRONIsMlFW95BeLpxqzCVuHS Eop8gWjP3hHFcmyg== Received: (qmail 964496 invoked from network); 21 Sep 2023 15:32:14 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 21 Sep 2023 15:32:14 +0200 X-UD-Smtp-Session: l3s3148p1@tYwShd4FDUIuciJ+ From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Geert Uytterhoeven , Johan Hovold , linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] gnss: ubx: add support for the reset gpio Date: Thu, 21 Sep 2023 15:32:01 +0200 Message-Id: <20230921133202.5828-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230921133202.5828-1-wsa+renesas@sang-engineering.com> References: <20230921133202.5828-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 21 Sep 2023 13:17:15 -0700 (PDT) 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 --- 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; -- 2.35.1