Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp793812rdf; Fri, 3 Nov 2023 15:56:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkqQmKt4WyPjm2JxO4Zz5EUfxheZDeSKhMkVFIfEv3hvcve1lgEMTH1xGpSmXv/C0+VM1W X-Received: by 2002:a5b:5ca:0:b0:da0:5ba2:6275 with SMTP id w10-20020a5b05ca000000b00da05ba26275mr20911537ybp.34.1699052198833; Fri, 03 Nov 2023 15:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699052198; cv=none; d=google.com; s=arc-20160816; b=j/vQKU+ZgnMG4yG5iVzJQD0TI9fx1OiyQMAD62XpPOCXN+20X0YwHBKDZKPv/ywiAn PW6RqDloY29kH22S6KP/1kQc/dxld1/w3W4pr5qOPBsxuL3Xu/Cj0R/3CE13MWy0PPA7 nNY3aYYBRCjHFYuiI0fBarpy+joHi5RbNL9aWpYc7Yy80n2JyJ8UhtVKQcdieCnvchdi ECEE0AkInKqJJjgysRABkztZz1w8Xejn8NTLBADVwVz678vQvNlPUVwVT880iRD9CGfo tMlr9/CFJNoSeedeBOxGspxYALw54H2oYIdi53fTJYsdRjheYIolXW6qN02ztR9g5K6/ uqUw== 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=fmrU2g6eF1M/O9NhTkCGo0q8tJfP+vuJFadhZEhBZqk=; fh=VjHho0Qv8oJSt7HJ3RgckH4LAQCZvu5o942PmtSURt4=; b=SUSuAESvBsbw830bZ8wsueJ7qwDWCVxF4w06nGAULnnd+WYYM+RLAdRKVMZQis/yQs QggIDmZPzECA4K15XvYXjh8jL5r2SwNbGOXzhKWcwEm6PUleK1EUrAYxQlr5CzMjrVBZ Zyy4HtEoNdBWkhLUuSgFqig5UgTfcqLVKrNIhHUiovTpsDKk2wH8wf0TgAM1d7Z0JLIO Kg2wNttaL6Jz+Y0SS0m/YovaV8+vKNJnMbx+zOrmePPPWJR9FwM+wVZSCMNMmjnTulD5 AQhV3U7/5dvGansH2WLprclW8Y4xuYE2G2GxWMr6f8ZhI2++2TfqBbzpLKInk9yPYBIr Ro4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=bBNUBHkT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u33-20020a056a0009a100b006be322191dasi2542568pfg.140.2023.11.03.15.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 15:56:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=bBNUBHkT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 6F85A802F082; Fri, 3 Nov 2023 15:56:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377970AbjKCW42 (ORCPT + 99 others); Fri, 3 Nov 2023 18:56:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377673AbjKCW4U (ORCPT ); Fri, 3 Nov 2023 18:56:20 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6250ED6F for ; Fri, 3 Nov 2023 15:56:16 -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=fmrU2g6eF1M/O9NhTkCGo0q8tJfP+vuJFadhZEhBZqk=; b=bBNUBH kTPO9XBWgGHWN/xKtJuHwwsT/4ldN0N7Bfhgzj97e8bmNLSdmsfKSwXmQ2a+JTh4 /PSSBjswK0XthI/X0n4JxDWvT6U+g8aS6fYDuITqkgJ5ZeRYI7gJTW2GWQ1ia6dZ JymuzTl+Kdf8Vo4AoAXoiC6RZigjkp2IRONIBVwESm8VPKGSZk+L6Sq3FzSV+vqu KXIgzZp8TmUdoFfyLmpFlO9hT3jngZa0xI8ZaAemMahix3flJ16POcv40EC71HmR 7CDOiJd4wgTKA4v1ys9UhxFMi0RXikbIn0uSJn+/fi4sRY9hvQYltJACHQjXIaJF uGtY5dn4bCkVNh5g== Received: (qmail 1327964 invoked from network); 3 Nov 2023 23:56:14 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 3 Nov 2023 23:56:14 +0100 X-UD-Smtp-Session: l3s3148p1@xx1IaUcJEM5ehhrK From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Geert Uytterhoeven , Johan Hovold , linux-kernel@vger.kernel.org Subject: [PATCH v4 3/3] gnss: ubx: add support for the reset gpio Date: Fri, 3 Nov 2023 23:56:00 +0100 Message-Id: <20231103225601.6499-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231103225601.6499-1-wsa+renesas@sang-engineering.com> References: <20231103225601.6499-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 15:56:36 -0700 (PDT) The Renesas KingFisher board includes a U-Blox Neo-M8 chip. This chip has a reset pin which is also wired on the board. Add code to the driver to support this reset pin. 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