Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3891073pxk; Tue, 29 Sep 2020 08:44:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXhE4pEmlJcEJzGbaIPJS+9llyB7muNrXu1aOLP2dlJWUn08ODd/baH753lPjOjA2F/f0m X-Received: by 2002:a50:e807:: with SMTP id e7mr4045329edn.84.1601394290489; Tue, 29 Sep 2020 08:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601394290; cv=none; d=google.com; s=arc-20160816; b=1AsQ3QgZrzxs1ngiwguhRE/KnfQwhql8YEurGBLGjQp7yIU4npya+7pLVtZsTdZrmB MjQuvIBGPgbyUVXiILPVuif4F8o7V6PghzvZskvX3hW3YydvrYheqzSlFE4XDfQ5NVCp ljsJ86aCBZVXE95BkOeg4ZVS8Zh5ZpYfj74OJ+ZlMVvvx1EbYX3L3hSslEQEsMBOIZPf Cx2GjRVTPF2hGcOtqYdXdG1P+xMWohckwFKFhvvBpEimPBkjabuzGMl2s0Kls6pafbBv Nw3p1d6CTQuDCNME0pV797gy2AYMIjkwXSzwHtMeOBfaVe9Kxz5k3nuspdzttG682g2k e5tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=MbnfnWW7DO9YVlysCS28fzl/G05329wiRPwuGtme1sU=; b=xrvT8IW2ZEG44h2iuBDROHi3E+cr5dztId2vec5fPW9ubc6JvD28B3Ro5NTyqvjOww zeB7S3GyC3ElUJaXNFa3L73oyzlk29O21L9RoHKTKJdZ6cbe3bvq9qUGhmNOoIPRebjl 55I3d+7+Mb7hvBCUXVb83vAk+i0ohNlMjhB+0zzQ9aqwqqmuyeEkNGE6Y2CPqax9A6Ar 0pdTagh8faXcjmLmyedFW82yMUIF4wbKDLplScTRPrE/iRmLNWzp9Jmc4lKOoYxjJoKu 82HnxHR4W2fZPgogDiuXFHq0QIMESqfsoruqFAyFTYNHj53GqOHY1zT9ry2CTNZl46nm UGpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=asem.it Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m16si3028992edr.280.2020.09.29.08.44.27; Tue, 29 Sep 2020 08:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=asem.it Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729011AbgI2Pm7 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 29 Sep 2020 11:42:59 -0400 Received: from smtp.asem.it ([151.1.184.197]:53979 "EHLO smtp.asem.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728241AbgI2Pm6 (ORCPT ); Tue, 29 Sep 2020 11:42:58 -0400 X-Greylist: delayed 306 seconds by postgrey-1.27 at vger.kernel.org; Tue, 29 Sep 2020 11:42:57 EDT Received: from webmail.asem.it by asem.it (smtp.asem.it) (SecurityGateway 6.5.2) with ESMTP id SG000512543.MSG for ; Tue, 29 Sep 2020 17:37:47 +0200S Received: from ASAS044.asem.intra (172.16.16.44) by ASAS044.asem.intra (172.16.16.44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 29 Sep 2020 17:37:46 +0200 Received: from ASAS044.asem.intra ([::1]) by ASAS044.asem.intra ([::1]) with mapi id 15.01.1979.003; Tue, 29 Sep 2020 17:37:46 +0200 From: Flavio Suligoi To: "linux-gpio@vger.kernel.org" , "linux-acpi@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" Subject: How to use an ACPI declared GPIO in a userspace ... Thread-Topic: How to use an ACPI declared GPIO in a userspace ... Thread-Index: AdaWdniTedAZ6+9wQdyYYgE5sQ27yA== Date: Tue, 29 Sep 2020 15:37:46 +0000 Message-ID: <9152bb8be33e4192a7766eb53c6ca9af@asem.it> Accept-Language: it-IT, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.17.208] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-SGHeloLookup-Result: pass smtp.helo=webmail.asem.it (ip=172.16.16.44) X-SGSPF-Result: none (smtp.asem.it) X-SGOP-RefID: str=0001.0A09020D.5F7354CB.0052,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 (_st=1 _vt=0 _iwf=0) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, I need to expose to the userspace a GPIO, physically connected to a board push-button. This GPIO must expose a pre-defined name, such as "user-push-button", so that the userspace applications can use it without know any physical GPIO details. I can customize the board BIOS and so my goal is to add an ACPI table with a content like this: ... Scope (\_SB.GPO1) { Device (BTNS) { Name (_HID, "PRP0001") Name (_DDN, "GPIO buttons device") Name (_CRS, ResourceTemplate () { GpioIo ( Exclusive, // Not shared PullNone, // No need for pulls 0, // Debounce timeout 0, // Drive strength IoRestrictionInputOnly, // Only used as input "\\_SB.GPO1", // GPIO controller 0, ResourceConsumer, , ) // Must be 0 { 25, // GPIO number } ... I know that this GPIO can be used from other drivers. For example I successfully tested it using the "gpio-keys" device driver, giving to my GPIO a key-code and emulating in this way a keyboard key. This could be a possible solution. But I prefer to expose my GPIO as a classic GPIO, not as a keyboard key. I was wondering if there is a generic GPIO driver that I can use to expose this GPIO with its pre-defined name (caming from the ACPI table declaration), to the userspace... Best regards, Flavio