From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752902AbbC3NdP (ORCPT ); Mon, 30 Mar 2015 09:33:15 -0400 Received: from mga02.intel.com ([134.134.136.20]:24964 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752322AbbC3NdN (ORCPT ); Mon, 30 Mar 2015 09:33:13 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,494,1422950400"; d="scan'208";a="474423164" Date: Mon, 30 Mar 2015 16:33:07 +0300 From: Mika Westerberg To: Octavian Purdila Cc: Linus Walleij , Lars-Peter Clausen , Robert Dolca , Robert Dolca , "linux-iio@vger.kernel.org" , Jonathan Cameron , "linux-kernel@vger.kernel.org" , Hartmut Knaack , Peter Meerwald , Denis CIOCCA Subject: Re: [PATCH] IIO: Adds ACPI support for ST gyroscopes Message-ID: <20150330133307.GE1524@lahna.fi.intel.com> References: <20150326140430.GM1878@lahna.fi.intel.com> <20150326144753.GO1878@lahna.fi.intel.com> <20150327100627.GW1878@lahna.fi.intel.com> <20150330095254.GB1524@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 30, 2015 at 03:55:14PM +0300, Octavian Purdila wrote: > On Mon, Mar 30, 2015 at 12:52 PM, Mika Westerberg > wrote: > > On Fri, Mar 27, 2015 at 11:36:25AM +0100, Linus Walleij wrote: > >> On Fri, Mar 27, 2015 at 11:06 AM, Mika Westerberg > >> wrote: > >> > On Thu, Mar 26, 2015 at 06:28:19PM +0200, Octavian Purdila wrote: > >> > >> >> For the sleep case I think the GPIO controller needs to do the pin > >> >> enable and set input direction operation in it's irq_bus_sync_unlock. > >> > > >> > I wonder how DT handles all this? Is it the boot firmware that sets up > >> > the pins accordingly or is there something we are missing? > >> > >> DT systems mostly do not have firmware for power usecases, they > >> handle it all using pin control. I would more say that is a feature of > >> all-SW systems without power-firmware ideas, without ACPI and > >> without PSCI (well PSCI systems do not care about much more > >> than CPU power down in firmware anyway...) > > > > OK, thanks. > > > > In case of ACPI (where firmware does lot more) it is supposed to > > configure pins based on what is connected, if the firmware knows that. > > Due to bugs in the boot firmware that obviously does not happen in all > > cases (like this one). > > > > Ah, interesting, I was not aware that the firmware was supposed to do > the pin configuration. In this case I think your patch can be merged > as it is Mika, mine doesn't make sense anymore. Unfortunately because of bugs we can't rely that the firmware (BIOS) gets those always right :-( > This particular case is special since we did not performed the tests > on a full system that has the component integrated. We instead used > and I2C to USB bridge to which we connected the component and we > loaded the ACPI table dynamically. Regardless of how did the device appear this always works: 1) request the GPIO (with GPIOD_IN) 2) convert it to IRQ using gpiod_to_irq() Since we cannot be sure that the firmware has configured the pin properly, rather than adding automatic IRQ <-> GPIO translation for ACPI GpioInt I think we are better off if drivers explictly request their GPIOs and configure them as needed.