From nobody Sun Feb 18 13:57:12 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 4Td6fw2JY0z59kd6; Sun, 18 Feb 2024 13:57:12 +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 4Td6fw1nZTz4qws; Sun, 18 Feb 2024 13:57:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708264632; 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=WQM8LAmbU/IgjN8aLJDxRXjOJLFEmd+P0nDnnjmzzE4=; b=FiYZv5d3laTEH/nXPYtQVxuaE7hAfrlYMy8oDmurwgZqOvVEbg1D3wv4ho40iFSHFNR7gY /EFFQI3ayCNeKAuUSGVPTHA3QGiMJGt4lQmJcRSOgSKotdi/c51G+vN2um9c1+4wNR9LwJ jJ80IkCqlaq0kqXP7cUCayvn8K4IKOw/fHS+saDtGvT6BjJXkPmNgm4EONe69CVVfwfw7m NG0dz4bUsqUYGqiT1OKXXpP8v/9SW6k6F3s6uQs28sgBDIs0x+oOoJp/rldGm/zDxASURX 9bju+5LYric1hK8l+IFgO5WS+gecQcCvOJmkcPskyzaJPpKTiTbSxxRZmz55jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708264632; 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=WQM8LAmbU/IgjN8aLJDxRXjOJLFEmd+P0nDnnjmzzE4=; b=wxLGY+23HRidGORzjEeNEyG/j2GdkvZOvOTfxB8dnBANnFtlWU3CdOH2bGpz6LJzZwENNW JK6jLQ/lHJgUqu1Wz/uOXqCoTl8XZTkw90lNCYLN5YeAcvZ8M/GlkU+JNIq852iALJb42z yYKKqh9dMiOmMwCQs+biIMJXV1I9+W3uM0p1XRusm4uNQwn7IwcoIErbSYWpQYOzyMe4Cf Aof8ujG0ZVMDrg+N6fzhKfLr5Wwzxj3NKruakigrffLRtwPxR0PD/452L5cwZEnB33bS2e saxOJNAN+8AJlAw3Cs7tg7A9lM/KqLZpGhVO+gAsevKOoqUQSkqwambRGZ18Xg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708264632; a=rsa-sha256; cv=none; b=GqG3rdOO0QgLG4c5O/zx9rP4XK4UX9/RlNC/Akk8/RMSVCB63Jmb3cO0fJjqYkWF3a5VQ8 94rQOeQVWhm2NuZKhMXl0MUlrVyDkQx0Iu65dqN45adrQFqXW0qppwnGXr0jVLMz4Onofr 5HnHxx2uvwpM94ERZ/HlZ4STGkSl/mOadg24b3m60uf+iTDsEhrr6/Si1qbtutbS6szB74 x+nHquN6aZvJFtV3aW/mA3Nlmb7xBuNwdu8iOOOHllU0fEjQ5/gf7peKuPolu1SI1+IB9t NexvuVbwom6NxqOCXgCYXcgitidHbzpC9dqM82sbkebT8zPOLmk8gndQTHQ29Q== 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 4Td6fw0rzLzt9q; Sun, 18 Feb 2024 13:57:12 +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 41IDvCuJ072512; Sun, 18 Feb 2024 13:57:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41IDvC28072509; Sun, 18 Feb 2024 13:57:12 GMT (envelope-from git) Date: Sun, 18 Feb 2024 13:57:12 GMT Message-Id: <202402181357.41IDvC28072509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: b98558e69b0a - main - 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: b98558e69b0aefbb99120a8a6ca7efbb8cafab5b Auto-Submitted: auto-generated The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=b98558e69b0aefbb99120a8a6ca7efbb8cafab5b commit b98558e69b0aefbb99120a8a6ca7efbb8cafab5b Author: Andriy Gapon AuthorDate: 2024-02-18 13:55:20 +0000 Commit: Andriy Gapon CommitDate: 2024-02-18 13:55:20 +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 MFC after: 1 month --- 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 cee2cf056f42..6ff0516acb3f 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); }