From nobody Sun Apr 21 12:32:05 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VMnnd68hRz5J7LY; Sun, 21 Apr 2024 12:32:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VMnnd5fZpz5831; Sun, 21 Apr 2024 12:32:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713702725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d1vmmpvjSUbmg6m8kdOCBuhJM+1iLOOltDXmrqrGo94=; b=OMLrrULqxJery37yAisP0lyo9660G77UHzarANOco7z3ITmmygJW78CN0VWsEtp3ORSU0J 591G9K+hYQ/9UHoar0XDp1Mc9nih2U0E7tmGwC4PV4gDniIOlNk749GUZ9d65Jqaou9v/U MrM1bMpCTdwiltgansh1FPjplvR/SUsd3RRBzXeB6AMe3TpERrJIQfzIyaMxzlsayAlhFU J7lhXKZvZyhzMgt6gHdx777q6h0/csyGCKse7E2l8o6cDHvrdqGjQ3AYcDURNKkIGoWe5T kFSIznUzb4SVvVz6THaFLf2ShcjaDf2FHd4IdOdYOHvVhDwaDGpwwQzBUSoa2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713702725; a=rsa-sha256; cv=none; b=t44FbC8bFbLSEQ5xsDEwOFnj3AIkYwp4mL6lh4FMN76s9dsdmDCHoYd1F3iPYk6/HqDkf4 M2qCZyLfySmLpwPZ+HAIfu8gw70W+Ls6JjJGOO99TnoW9RwS8NK4jExri3sb/XuDlHTz6F 0MxqOHSgQPsBfjKbn/w6gpKG9nRmVZgCi16jUwD9ZVdMXfj6SNqavdf2OTURtP3EB9y4AZ z3PMwRCK3QUjStxUqFFY61wRCoEBT5biR0GCcszF3VKiRr3RyLhEX2M+ceeegB9bTWuxjm Wc32k0mfXWuU8FDZXGWZNzpa7clEI+RcDO3To4Ie+WuiZtrTADvNXvMkI5D55A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713702725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d1vmmpvjSUbmg6m8kdOCBuhJM+1iLOOltDXmrqrGo94=; b=kWVvj5fQVFjp+eVMMJKISLdsGcgGyiWcagDs30xmEoVv3+uIgAPfPHhC7Wh5w45m4/dUhi 1jLE7n2EoAPbx1kaZudgx/bGEOCONNAWZoEvGZnq3S4pZwAwEbRN+l0F68NmUd+NePiBFH jDR1MXNqOblE2hb6qB88M2+q/c0oM7ee2Z3+QzAy1WjcXyUC1k1H2fam4LXvNCvCkkLDLk PAG5kj6FZ+kfSyDTDkDhyREX0sL2oO43yRfLpgKs6cveVpcpP+xtaFGuEZOmvrCPRMSxn6 FjJLnqF+KfBOee6Xf5BCK7U0aCwXdl/uuO+9sO8BjaZOJEz2fjOnds0weFri8Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VMnnd5FNgz1Kdh; Sun, 21 Apr 2024 12:32:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43LCW5Nj065950; Sun, 21 Apr 2024 12:32:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43LCW597065947; Sun, 21 Apr 2024 12:32:05 GMT (envelope-from git) Date: Sun, 21 Apr 2024 12:32:05 GMT Message-Id: <202404211232.43LCW597065947@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 43bf62a364c1 - stable/14 - aw_gpio: temporarily switch to input function if read in eint mode List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 43bf62a364c1b150cfdc64eb6b5f62ab3b48ee14 Auto-Submitted: auto-generated The branch stable/14 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=43bf62a364c1b150cfdc64eb6b5f62ab3b48ee14 commit 43bf62a364c1b150cfdc64eb6b5f62ab3b48ee14 Author: Andriy Gapon AuthorDate: 2024-02-18 13:55:20 +0000 Commit: Andriy Gapon CommitDate: 2024-04-21 12:31:50 +0000 aw_gpio: temporarily switch to input function if read in eint mode This is needed for gpiokeys driver that needs to read input state after receiving an interrupt for either edge. PR: 248138 (cherry picked from commit b98558e69b0aefbb99120a8a6ca7efbb8cafab5b) --- sys/arm/allwinner/aw_gpio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/arm/allwinner/aw_gpio.c b/sys/arm/allwinner/aw_gpio.c index 485d760f810b..1229d5bb146d 100644 --- a/sys/arm/allwinner/aw_gpio.c +++ b/sys/arm/allwinner/aw_gpio.c @@ -654,18 +654,30 @@ aw_gpio_pin_get_locked(struct aw_gpio_softc *sc,uint32_t pin, unsigned int *val) { uint32_t bank, reg_data; + int32_t func; + int err; AW_GPIO_LOCK_ASSERT(sc); if (pin > sc->conf->padconf->npins) return (EINVAL); + func = aw_gpio_get_function(sc, pin); + if (func == sc->conf->padconf->pins[pin].eint_func) { /* "pl_eintX */ + err = aw_gpio_set_function(sc, pin, AW_GPIO_INPUT); + if (err != 0) + return (err); + } + bank = sc->conf->padconf->pins[pin].port; pin = sc->conf->padconf->pins[pin].pin; reg_data = AW_GPIO_READ(sc, AW_GPIO_GP_DAT(bank)); *val = (reg_data & (1 << pin)) ? 1 : 0; + if (func == sc->conf->padconf->pins[pin].eint_func) + (void)aw_gpio_set_function(sc, pin, func); + return (0); }