twl4030-gpio: pullup/pulldown init
Subsystems (4)
PATCH 1/2 twl4030-gpio: pullup/pulldown init
From: David Brownell <[email protected]>
Finish moving initialization of pullups and pulldowns for twl4030 GPIOs into board specific init. Remove partial/incorrect init code for that from the hsmmc glue.
Doing this right requires some attention from board init logic, based on how the TWL chip is wired. Letting digital inputs float will waste power. Everyone with board schematics should update their board init code so it matches their boards; meanwhile, this returns to "current" behavior (all pullups disabled) but finally offers a way to do it "right".
Note that the ULPI pins won't need this attention (muxed against gpio{3-5,9-12,14} pins), and neither will ones with external pullups or pulldowns (conventional for MMC/SD card detect).
---
This partially reverses the effect of patch 0002 of the series Felipe has been refreshing, in the sense that all pullups (and pullups) are again disabled. HOWEVER it fills in that hole by providing a way boards can fix that -- example in patch #2.
arch/arm/mach-omap2/hsmmc.c | 6 --- drivers/gpio/twl4030-gpio.c | 78 +++++++++++++++++++++--------------------- include/linux/i2c/twl4030.h | 7 +++ 3 files changed, 46 insertions(+), 45 deletions(-)
arch/arm/mach-omap2/hsmmc.c +0 -6
@@ -27,7 +27,6 @@#define VMMC1_DEDICATED 0x2A#define VSEL_3V 0x02#define VSEL_18V 0x00 -#define TWL_GPIO_PUPDCTR1 0x13#define TWL_GPIO_IMR1A 0x1C#define TWL_GPIO_ISR1A 0x19#define LDO_CLR 0x00
@@ -65,11 +64,6 @@ static int hsmmc_late_init(struct deviceif (ret) goto err; - ret =twl4030_i2c_write_u8 (TWL4030_MODULE_GPIO ,0x02 , -TWL_GPIO_PUPDCTR1 ); -if (ret) - goto err; - ret =twl4030_set_gpio_debounce (MMC1_CD_IRQ ,TWL4030_GPIO_IS_ENABLE );if (ret) goto err;
drivers/gpio/twl4030-gpio.c +40 -38
102 lines not on this page · raw message
include/linux/i2c/twl4030.h +6 -1
@@ -62,8 +62,13 @@ struct twl4030_gpio_platform_data {int gpio_base;unsigned irq_base, irq_end; -/* for gpio-N, bit (1 << N) is set if pullup should be used */ +/* For gpio-N, bit (1 << N) in "pullups" is set if that pullup +* should be enabled. Else, if that bit is set in "pulldowns", +* that pulldown is enabled. Don't waste power by letting any +* digital inputs float... +*/ u32 pullups; +u32 pulldowns;int (*setup)(struct device *dev,unsigned gpio,unsigned ngpio);