Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3894163pxk; Tue, 29 Sep 2020 08:49:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx71XDewZmPwkp6tbJsyYBmzE3SSxLf9MTya9Oau5fUk6talRkndsBJTAaJb1m/+79eW2nE X-Received: by 2002:a50:fb98:: with SMTP id e24mr3977957edq.130.1601394578758; Tue, 29 Sep 2020 08:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601394578; cv=none; d=google.com; s=arc-20160816; b=T1C+Iel9fGnPMRROiCBcpap4QOMk4CngXuZ9KBEwvwV8xntk05N0sit1uQd1WXUiEa y2Xvjc9hkE6GHN1ySDD87eFatvVsAAK+zdGR9qkQzJMQlTuHjtkYcoNRKg46eBunztHv 8ibRfeHO/fblbGETEVznSVvK6bEETaKaADa5Sw6gtwJbbbQFTXfLhVxuI7/U6tK1LHsr Sqta9nkdvJWk9NT+57/m4KP75c9l770+os+PETSql0PTXCwQEFeSFHueKtf11kx+nSC6 UDnPvNGOfA96cZrJH+Hggi6ev5V4vMXuIo4bl/uGgmMi5LYps76ReKtGMG9QJ+zYXky8 HznQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+fRDsNgN2uFtN5BY9cG8Ru5uS2pUVkVtSMvZ/oFCZ9E=; b=xdAbvkFvRi92bq/lFjDu1A6VUIrrpXdL8+8LqFqKuO9i0QDem/6udWIEHUjKx7C9Wr cPKx4Xb/1HXJ9sIICnUtUmri/yQaCbI8xkucx70bhuiQfWkBE+OMaVw8BYdHwF8PR6zA mzFpR/ZTinrSpEe+JnLzYJcj2iJWblK5Pu63BRJW1gdlaFHP37jYSepzIe+4rYFXd/56 GEqXosML7zUaNV0CghQANNHkAbb7t69+PTEUexqoSbDJWxeQ07miWBuV95TdfZlwCtWq NIHJXDOY1c5s8RyQ17kBJPQe9iIAHwXYgi0GmJG2DMgoyXz4satyg7nwXKy0Px/2r+DB wrGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="x9Z/6sT5"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si3031728edy.292.2020.09.29.08.49.14; Tue, 29 Sep 2020 08:49:38 -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; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="x9Z/6sT5"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728241AbgI2PsC (ORCPT + 99 others); Tue, 29 Sep 2020 11:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbgI2PsB (ORCPT ); Tue, 29 Sep 2020 11:48:01 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAFAAC061755 for ; Tue, 29 Sep 2020 08:47:59 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id u19so5319502ion.3 for ; Tue, 29 Sep 2020 08:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+fRDsNgN2uFtN5BY9cG8Ru5uS2pUVkVtSMvZ/oFCZ9E=; b=x9Z/6sT5LSTuCUR7kzaaUJSzg1TkTbzFbyQjcLWsMkHkRvIWkdk9OBzY5wawZ4ObZK 5GE+8/seStWi3GQ2XoIQUfLMGLL8Wb/RbRMbRK4xTROmLxOvecQyniFoGhAJYzvwIqS2 YRUMVpr4p1k8mNLTNTjDhtOogQyGwk2nWCAZ5yZNokL61fZFQsqyGWMo9shE9JUWxTD/ iZ1eLUkOgxOJ58kOii/fzArF7XwHyinUGcXwQW1/6Vwis9eah0+PoJPKzFU+jZHHg+El amYzX370qWMdZDMn+jMjH7gQsksOUGVTGdebAuAv2+gzvHh3MgN0bnYH2v2lEwJp6ezi uTPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+fRDsNgN2uFtN5BY9cG8Ru5uS2pUVkVtSMvZ/oFCZ9E=; b=g50gve0gtTzeLGAqo6pfQELYeX6kPX5eadf2lrTClfgkjQNLPaT4X9XF7xH6Dqzf2A MjrUbKbSVhIu5GdEDjh68P8i9FDhON7yItcLY5MMOXsSGqZ+yqRkrUEyy3jcAA7cTmJ/ V4+DiEslbedKxysdOOC6CR+sNBUAZZyHNa6lBYfZdMWhyqJxOcbgSPWV81xuFeUvNe9n zp1l/6zPPGmBcgwnKA9sDc5c+zSIODJUpWmmw1s5kQzawiM6W4pzlojWZG6Aj04+5/dA 0h18JLWTLXLtZ0BGmldaA3W8D1Nfk3HBFVCVvOJVlSH/OidaLSIqKFCv5xM7dsJD23sv 6E5A== X-Gm-Message-State: AOAM5324DxHv82fL9e0QhpAPAePIff+Y50q4qF8e69biMYpqsPVmxoA5 2mnyrwpq4uUSSgDkaRUAwJcM5J5UvbIzeXzGRWPHIQ== X-Received: by 2002:a5d:8e14:: with SMTP id e20mr2924164iod.119.1601394479066; Tue, 29 Sep 2020 08:47:59 -0700 (PDT) MIME-Version: 1.0 References: <9152bb8be33e4192a7766eb53c6ca9af@asem.it> In-Reply-To: <9152bb8be33e4192a7766eb53c6ca9af@asem.it> From: Bartosz Golaszewski Date: Tue, 29 Sep 2020 17:47:48 +0200 Message-ID: Subject: Re: How to use an ACPI declared GPIO in a userspace ... To: Flavio Suligoi , Andy Shevchenko Cc: "linux-gpio@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 5:43 PM Flavio Suligoi wrote: > > 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 Adding Andy who knows ACPI GPIO well. In general, the "gpio-line-names" property is used for that and it's supported both for device tree as well as ACPI, although I have only ever used the former. Bartosz