Re: [PATCH] [OMAP] GPIO Module disable if all pins inactive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Varadarajan, Charu Latha had written, on 10/23/2009 11:05 PM, the following:
 #endif
+     if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
+             if (!bank->>gpio_status) {
+                     ctrl = __raw_readl(bank->>base + OMAP24XX_GPIO_CTRL);
+                     /* Module is enabled, clocks are not gated */
+                     ctrl &= 0xFFFFFFFE;
+                     __raw_writel(ctrl, bank->>base + OMAP24XX_GPIO_CTRL);
+             }
+             bank->>gpio_status |= 1 << offset;
+     }
why do this every time a gpio is enabled? why not do this iff gpio was
never used before.. how about the following:
The module is enabled only when gpio_status 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 free() API when all GPIOs in a particular module becomes inactive. The module is re-enabled in request() API when a GPIO is requested from the module that was previously disabled.
Thanks.

if (!bank->>gpio_status && (cpu_is_omap24xx() || cpu_is_omap34xx() ||
cpu_is_omap44xx())) {
       u32 ctrl = __raw_readl(bank->>base + OMAP24XX_GPIO_CTRL);
       /* Module is enabled, clocks are not gated */
       ctrl &= 0xFFFFFFFE;
       __raw_writel(ctrl, bank->>base + OMAP24XX_GPIO_CTRL);
}
bank->>gpio_status |= 1 << offset;
Why to touch gpio_status if not used (for other than 34xx/24xx/44xx cases)?
either the gpio_status should be under a #ifdef for 34xx when defining or it should be usable by all. what it does now is do both.

my proposal is to allow gpio_status to be usable by ALL OMAPs -> maybe OMAP1 also could also use it.. I cannot comment - but it does look to have scope of usage beyond omap2/3/4 series?

--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux