From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Walleij Subject: Re: [PATCH 3/5] gpio/omap: Add DT support to GPIO driver Date: Fri, 26 Apr 2013 09:31:46 +0200 Message-ID: References: <1329321854-24490-1-git-send-email-b-cousson@ti.com> <514C79E1.4090106@wwwdotorg.org> <514CE0AB.6060207@ti.com> <515319D5.20105@wwwdotorg.org> <5155C902.7080207@wwwdotorg.org> <5165CB9D.1090202@wwwdotorg.org> <51671D7B.5060303@wwwdotorg.org> <51673D70.3010503@wwwdotorg.org> <516C31C3.9040505@wwwdotorg.org> <516C7C43.3040105@wwwdotorg.org> <516C8760.2050500@ti.com> <516D9B05.1000501@wwwdotorg.org> <516DA60A.5070000@ti.com> <516DCCA8.3070108@wwwdotorg.org> <516DDB4D.9020500@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from mail-ie0-f181.google.com ([209.85.223.181]:38179 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752907Ab3DZHbr (ORCPT ); Fri, 26 Apr 2013 03:31:47 -0400 Received: by mail-ie0-f181.google.com with SMTP id tp5so4503900ieb.40 for ; Fri, 26 Apr 2013 00:31:47 -0700 (PDT) In-Reply-To: Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: Javier Martinez Canillas Cc: Jon Hunter , Stephen Warren , Grant Likely , Alexandre Courbot , Stephen Warren , Kevin Hilman , "devicetree-discuss@lists.ozlabs.org" , "linux-omap@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" On Wed, Apr 17, 2013 at 2:41 AM, Javier Martinez Canillas wrote: So: > +static int omap_gpio_irq_domain_xlate(struct irq_domain *d, > + struct device_node *ctrlr, > + const u32 *intspec, unsigned int intsize, > + irq_hw_number_t *out_hwirq, > + unsigned int *out_type) > +{ > + int ret; > + struct gpio_bank *bank = d->host_data; > + int gpio = bank->chip.base + intspec[0]; > + > + if (WARN_ON(intsize < 2)) > + return -EINVAL; > + > + ret = gpio_request_one(gpio, GPIOF_IN, ctrlr->full_name); > + if (ret) > + return ret; So how to figure out if a device is already requesting this GPIO on some orthogonal axis? if (this_gpio_was_hogged_as_input_in_gpiolib) { ret = gpio_request_on()... } Is my suggestion, then you can explicitly mark which GPIOs shall have their IRQs implicitly translated to GPIOs and requested. Alas, this requires the DTS:es to have this hogging added, but it is fully backwards-compatible. Then the applicabl OMAP drivers (like MMC) can be fixed to do gpio_to_irq() on their pins instead of using the IRQ directly. Yours, Linus Walleij