From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546AbaHRJ2O (ORCPT ); Mon, 18 Aug 2014 05:28:14 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:45324 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbaHRJ2M (ORCPT ); Mon, 18 Aug 2014 05:28:12 -0400 Message-ID: <53F1C729.7090304@linaro.org> Date: Mon, 18 Aug 2014 11:28:09 +0200 From: Tomasz Nowicki User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Mika Westerberg , Linus Walleij CC: "Rafael J. Wysocki" , Alexandre Courbot , ACPI Devel Maling List , "linux-kernel@vger.kernel.org" , "linaro-acpi@lists.linaro.org" Subject: Re: [RFC] ACPI: Add GPIO-signaled event simulator. References: <1406217076-17150-1-git-send-email-tomasz.nowicki@linaro.org> <20140812100111.GV1657@lahna.fi.intel.com> In-Reply-To: <20140812100111.GV1657@lahna.fi.intel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.08.2014 12:01, Mika Westerberg wrote: > On Fri, Aug 08, 2014 at 02:36:02PM +0200, Linus Walleij wrote: >> On Thu, Jul 24, 2014 at 5:51 PM, Tomasz Nowicki >> wrote: >> >>> GPIO signaled events is quite new thing in Linux kernel. >>> AFAIK, there are not many board which can take advantage of it. >>> However, GPIO events are very useful feature during work on ACPI >>> subsystems. >> >> Overall this seems like a pretty nice debug feature. >> >>> This commit emulates GPIO h/w behaviour and consists on read/write >>> operation to debugfs file. GPIO device instance is still required in DSDT >>> table along with _AEI resources and event methods. >>> >>> Reading from file provides pin to GPIO device map e.g. : >>> $ cat /sys/kernel/debug/acpi/gpio_event >>> GPIO device name: /__SB.GPI0 >>> Available GPIO pin map: >>> /__SB.GPI0 <-> pin 0x100 >>> >>> Based on that, user can trigger method corresponding to device pin number: >>> $ echo "/__SB.GPI0 0x100" > /sys/kernel/debug/acpi/gpio_event >> >> I need input from Rafael and Mika as to whether this is a >> good interface. > > Maybe it would make sense to move this into drivers/gpio/gpiolib-acpi.c > and hide it behind some Kconfig entry? > > Since you already need to have DSDT/SSDT table for this to provide the > GPIO device, _AEI and the event methods, I would rather make it so that > acpi_gpiochip_request_interrupt() will add debugfs entry for each GPIO > it finds in _AEI, like: > > /sys/kernel/debug/acpi/events//n > > And you could trigger it by writing '1' or something like that to that > file. > Thanks for comments. The idea of available gpio events list under /sys/kernel/debug/acpi/events//n is worth adding. However, acpi_gpiochip_request_interrupt() would be called if we would have real GPIO H/W and related driver. Initial idea of this patch was to avoid that restriction. So there are two cases: 1. If we have GPIO chip, it is already described in DSDT/SSDT and using this patch, user could trigger events by software too. 2. None of GPIO chip, so we need to add GPIO/_AEI etc. descrition to DSDT/SSDT and pretend we have GPIO chip on board. Regards, Tomasz Nowicki