Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755625AbbBLMsi (ORCPT ); Thu, 12 Feb 2015 07:48:38 -0500 Received: from mga11.intel.com ([192.55.52.93]:51385 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755201AbbBLMsf (ORCPT ); Thu, 12 Feb 2015 07:48:35 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,565,1418112000"; d="scan'208";a="453663739" Date: Thu, 12 Feb 2015 14:46:23 +0200 From: Heikki Krogerus To: "Rafael J. Wysocki" Cc: Alexandre Courbot , Linus Walleij , "Rafael J. Wysocki" , Darren Hart , Arnd Bergmann , Andy Shevchenko , Mika Westerberg , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , ACPI Devel Maling List Subject: Re: [RFC PATCH] gpio: support for GPIO forwarding Message-ID: <20150212124623.GC18860@kuha.fi.intel.com> References: <1418890998-23811-1-git-send-email-heikki.krogerus@linux.intel.com> <20150123112122.GD30522@kuha.fi.intel.com> <16561596.EbsEtszXvm@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <16561596.EbsEtszXvm@vostro.rjw.lan> 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 Content-Length: 3473 Lines: 94 On Tue, Feb 10, 2015 at 04:10:04PM +0100, Rafael J. Wysocki wrote: > On Tuesday, February 10, 2015 06:32:46 PM Alexandre Courbot wrote: > > On Fri, Jan 23, 2015 at 8:21 PM, Heikki Krogerus > > wrote: > > > Hi guys, > > > > > > On Thu, Jan 22, 2015 at 05:14:22PM +0100, Rafael J. Wysocki wrote: > > >> On Thursday, January 22, 2015 11:57:55 AM Alexandre Courbot wrote: > > >> > If we decide to go ahead with the solution proposed by this patch for > > >> > practical reasons (which are good reasons indeed), I still have one > > >> > problem with its current form. > > >> > > > >> > As the discussion highlighted, this is an ACPI problem, so I'd very > > >> > much like it to be confined to the ACPI GPIO code, to be enabled only > > >> > when ACPI is, and to use function names that start with acpi_gpio. > > >> > > >> I can agree with that. > > >> > > >> > The current implementation leverages platform lookup, making said lookup > > >> > less efficient in the process and bringing confusion about its > > >> > purpose. Although the two processes are indeed similar, they are > > >> > separate things: one is a legitimate way to map GPIOs, the other is a > > >> > fixup for broken firmware. > > >> > > > >> > I suppose we all agree this is a hackish fix, so let's confine it as > > >> > much as we can. > > >> > > >> OK > > >> > > >> Heikki, any comments? > > > > > > I'm fine with that. > > > > > > That actually makes me think that we could then drop the lookup tables > > > completely and use device properties instead with the help of "generic > > > property" (attached): > > > > > > We would just need to agree on the format how to describe a gpio > > > property, document it and of course convert the current users as > > > usual. The format could be something like this as an example (I'm > > > writing this out of my head so don't shoot me if you can see it would > > > not work. Just an example): > > > > > > static const u32 example_gpio[] = { , ,爙; > > > > > > static struct dev_gen_prop example_prop[] = > > > { > > > .type = DEV_PROP_U32, > > > .name = "gpio,", > > > .nval = 2, > > > .num = &example_gpio, > > > }, > > > { }, > > > }; > > > > > > static struct platform_device example_pdev = { > > > ... > > > .dev = { > > > .gen_prop = &example_prop, > > > }, > > > } > > > > > > > > > In gpiolib.c we would then, instead of going through the lookups, > > > simply ask for that property: > > > > > > ... > > > sprintf(propname, "gpio,%s", con_id); > > > device_property_read_u32_array(dev, propname, &val, 2); > > > ... > > > desc = gpio_to_desc(val[0]); > > > flags = val[1]; > > > ... > > > > > > > > > So this is just and idea. I think it would be relatively easy to > > > implement. What do you guys think? > > > > At first sight, that looks like a very good idea and a great use of > > the device properties API. Are you willing to explore it further? Yes. If I get green light for the generic property idea, I can start thinking about this. Thanks, -- heikki -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/