]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - drivers/gpio/gpio-omap.c
omap: GPIO module enable/disable
authorCharulatha V <charu@ti.com>
Sun, 22 Nov 2009 18:11:25 +0000 (10:11 -0800)
committerTony Lindgren <tony@atomide.com>
Sun, 22 Nov 2009 18:24:33 +0000 (10:24 -0800)
commit058af1ea98675a672ad2aefca035d2e5a228d2cc
tree623536859832cea0b8e10cf854ebf2cf73d9ec08
parentedeae658b282f2d076efb3b3f39ccd8eb0c384fa
omap: GPIO module enable/disable

This patch disables a GPIO module when all pins of a GPIO
module are inactive (clock gating forced at module level) and
enables the module when any gpio in the module is requested.

The module is enabled only when "mod_usage" indicates that no GPIO
in that  module is currently active and the GPIO being requested
is the 1st one to be active in that module.

Each module would be disabled in omap_gpio_free() API when all
GPIOs in a particular module becomes inactive. The module is
re-enabled in omap_gpio_request() API when a GPIO is requested
from the module that was previously disabled.

Since individual GPIO's bookkeeping is added in this patch
via "mod_usage", the same is used in omap_set_gpio_debounce()
& omap_set_gpio_debounce_time() APIs to ensure that the gpio being
used is actually "requested" prior to being used (Nishant Menon's
<nm@ti.comSuggestion)

GPIO module level details are specific to hardware and hence
introducing this patch in low level layer (plat-omap/gpio.c)

Signed-off-by: Charulatha V <charu@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/plat-omap/gpio.c