From nobody Sun Apr 21 12:32:26 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 4VMnp41T8Dz5J7rq; Sun, 21 Apr 2024 12:32:28 +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 4VMnp368yhz58fn; Sun, 21 Apr 2024 12:32:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713702747; 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=yM34t9iSIvEQ3cul2hPhHdbUTxYUOOPSaI+efXTQAeg=; b=P1Retb8PIEvsex3QQcbGtSzVgXmfbgwwXHKXdaHeZnIWhB4XminLf5Fy/ohGv9uSv0Gs00 Lc6MMR/8WX4UkgHDrxrEiBwdxs9ggxJYnFDzPVwkOE7uEPNPLRggp7FLDEgaeuNVcQUi7W LNz+2xnrYmD0yzi72FvZXqgBLDnPHME0YCixr6ySkadC1VUJxAw5Ay/0ZZ7m3ppxiHC7W4 12gRrfL85Y1FIoKjQa/jSo6+fWahC6XCDc5VRxlKhEkbTaI0urNeaEn4GMp1hxq7b+7qZX mS0o/Zr7nsPJLaljjfa7cZBBau9e2aB55fnu92c5MSjFCWpzcnlaE/SbYX8y1w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713702747; a=rsa-sha256; cv=none; b=r+4jHHVOMNUuHYIMAtnJJq4wKyW7TB9KmKWqN14VRb4m2PY2R0IwICEmtaCWUbCNuKCY3K usOLXcyh+fjOE4kij1UMLkNouql1o45MpLh/24B4zFsKo1naA07IYBLQbh7V653N0yuu61 jaTMYq3LTrHGgCE8BEycOOSiXHqBqdjhuuNQw/upiRoaYIdfdHkanNwsM57OHRv14S4pFQ JZ9I65Xnukjz+f4WCsrpkDviSwt7G8HcMklAX5nUB2DPMnXOo5YP1zgC0M/rZ3wXtqczzQ nmTXJi4wJjeFZrJjc4XBI2yfyNpaaukMVmHAZAq5Ck34kCeUG/sTtznzbHPc5w== 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=1713702747; 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=yM34t9iSIvEQ3cul2hPhHdbUTxYUOOPSaI+efXTQAeg=; b=tPjSC0O9UFxn4zbz0bvZ297h5I+VagcqFFGRa6naMnRD6H6YHFqrDFnYHQG9wiSTqcqbnK 7hnqMZhzQpupnFr8rW9hheK9dhef2UZfJk/AROFf5RZX/omDLMaSezsNaYei6rgYBQEFxO q/6HV7BzHoOkOYx3RpKP5RfTMr0eNyT3KYeOmMk1EUORAjvmVBMRBRqquQ3OV9g/E9Qgzs tIB5tKkTbPd8gFgrL1xnW5zVUD7ma4yCqFw12U0bMYBIgzOTdvAI6oEywfIBmmvs/raN5D 5hUBAOCSRrRFqzTAfFA+Wo2g7LPh4nSM0qPncoGHNfp/ZK0RRDsCddRaPazo3Q== 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 4VMnp26pmxz1Kvc; Sun, 21 Apr 2024 12:32:26 +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 43LCWQlh066148; Sun, 21 Apr 2024 12:32:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43LCWQTM066145; Sun, 21 Apr 2024 12:32:26 GMT (envelope-from git) Date: Sun, 21 Apr 2024 12:32:26 GMT Message-Id: <202404211232.43LCWQTM066145@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: 9c444571ab94 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 9c444571ab94ac1c148100bfc85954f7029d7f09 Auto-Submitted: auto-generated The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=9c444571ab94ac1c148100bfc85954f7029d7f09 commit 9c444571ab94ac1c148100bfc85954f7029d7f09 Author: Andriy Gapon AuthorDate: 2024-02-18 13:55:20 +0000 Commit: Andriy Gapon CommitDate: 2024-04-21 12:32:16 +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 9d1defb5bf8c..5d0c3ded0c52 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); }