Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4551171pxk; Wed, 30 Sep 2020 06:05:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq1VizPMmy0oOzqJ4CG46RtBlzXoabpHOcEyrj44KjiAPy6c4sUJICxym7zffpwW9dybH9 X-Received: by 2002:a17:906:7013:: with SMTP id n19mr2662803ejj.388.1601471132121; Wed, 30 Sep 2020 06:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601471132; cv=none; d=google.com; s=arc-20160816; b=A1B/p5ANRs4LBghr/IFDugqWFezw3XAQRBUQBB8gutyi07YPhIvmvLrP8JVEHmzOtz SflJrNr2p/16GY9Rw3lOwwnsyE21d7QsOcKzYLK1IWeEjIkurrqaWGBnnoBcVao4WeoI EsKpKeTxKWAa+ffKPoaIMg2Dkt/i55PiKot1N0wgwDWOuqvB1PZMEjz1IWA8cbUzIckG LV72Tsw/ZmEHQVyW9i0TdT8pBCbRX7HUKEXS7nJ1zTdWjIGZpWZaQDiLvjCT2V995o6z aDABR3dpimiq9gFc8AdyR0gw+jPvYvAdJncXX4BR+O+D3BYH2ftEVA5GnjFmfnvqN7OK UPnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=FuclEwdlk9MBfShIhWMhBEgcflEvMN+LOrg7o/8eYtk=; b=MJG/bFV4nLLFNBzz4NvHnjmdCPEH8UG5PNa1LZ5HAvEcaxe6hW0n5EM1eg2X0InyND u+l/HFPfkJqMwwiq1Hg8PFXPNKcebyk1drFz8ZUqNd6pft0auyN2ay3VuLNQrceF6NM0 V8G7mapqeZyOmhKlea3x2W6+m+ByjfNd1U8vaxYOJLtHuZaVcVDyfiZ2TSQoEG1TEswL Wq+rdxVH55VEq0vgIl7OeB4eksFgmaVFizI+TMbOiEAVelEa2DzuHvQK4HiB/4i7sQgL dqXRUwD1jY/B1QhUL4tvrKr8UEWdRakriJpzuqDYpP1JXWlJsE2ACGU3qVXIPj9TI8+T wdXA== 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si1287247ejm.716.2020.09.30.06.05.09; Wed, 30 Sep 2020 06:05:32 -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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729999AbgI3NBa (ORCPT + 99 others); Wed, 30 Sep 2020 09:01:30 -0400 Received: from mga12.intel.com ([192.55.52.136]:6862 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725771AbgI3NBa (ORCPT ); Wed, 30 Sep 2020 09:01:30 -0400 IronPort-SDR: g1fEK2L7fPvdIKWRO9hc22/syh4K3q1/GYPCHvqY5m7WMg0xzuSCVfpzBi5n4iEVlS8RBk7YJW IB4RbEFdUd4g== X-IronPort-AV: E=McAfee;i="6000,8403,9759"; a="141844306" X-IronPort-AV: E=Sophos;i="5.77,322,1596524400"; d="scan'208";a="141844306" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2020 06:01:20 -0700 IronPort-SDR: mqPTbeEKaXW2vX4VANFW/wqP+yBcskH+dqKVF2dBS6+Ye5CRlFNSmmLYc6F3M4JkvCQ7sElUMo cQuEXX2Ow2Kw== X-IronPort-AV: E=Sophos;i="5.77,322,1596524400"; d="scan'208";a="339079199" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2020 06:01:19 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kNbjN-00311K-Vz; Wed, 30 Sep 2020 16:01:13 +0300 Date: Wed, 30 Sep 2020 16:01:13 +0300 From: Andy Shevchenko To: Flavio Suligoi Cc: Bartosz Golaszewski , "linux-gpio@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: How to use an ACPI declared GPIO in a userspace ... Message-ID: <20200930130113.GQ3956970@smile.fi.intel.com> References: <9152bb8be33e4192a7766eb53c6ca9af@asem.it> <22753b53cd7d4dfba4ef3610f71cc462@asem.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22753b53cd7d4dfba4ef3610f71cc462@asem.it> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 12:04:43PM +0000, Flavio Suligoi wrote: > > > > > > I was wondering if there is a generic GPIO driver that I can use > > Maybe I was not so clear, but as Bart mentioned the least you can do > > is simply define line name via "gpio-line-names" property. The problem > > here is when and how you would like to have them incorporated. > > I already tried adding the "gpio-line-names" property, but the problem > is the same: no driver asks for this GPIO, as shown by the following > kernel messages: > > ACPI: Host-directed Dynamic ACPI Table Load: > ACPI: SSDT 0xFFFF994034D42A00 0000E8 (v05 ASEMsp GPIO_BTN 00000001 INTL 20200717) > ACPI: \_SB_.GPO1.BTNS: PRP0001 requires 'compatible' property > So I'll start to write a simple device driver to use this GPIO. > I'll keep you informed! > > > When: if ACPI tables are being provided by firmware which you may not > > alter, then you must use initramfs type of solution (no configfs, > > don't know about EFI var though). How: In that case you might have a > > chance to incorporate _DSD() method into *existing* _CRS() one. > > Possible impediments: if ACPI table from firmware already has a _DSD() > > defined or above is not working for some reason. In such a case you > > must upgrade entire DSDT via initramfs. > > > > > > > Adding Andy who knows ACPI GPIO well. > > > > > > > > Thanks. > > > > > > > > > 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. > > > > > > > > Right. ACPI supports properties via _DSD() method. I guess you simply didn't get. The "gpio-line-names" property of GPIO *controller* (provider!) and you are trying to do something with the *consumer* if I got it right. And of course GPIO line, which has name, has no difference in use from another w/o name assigned. You will need to request it by *consumer* either in kernel or in user space. To be more precise we have to look at your DSDT. -- With Best Regards, Andy Shevchenko