void __msm_gpio_set_config_direction(unsigned gpio, int input, int val) { if (input) clr_gpio_bits(BIT(GPIO_OE_BIT), GPIO_CONFIG(gpio)); else { __msm_gpio_set_inout(gpio, val); set_gpio_bits(BIT(GPIO_OE_BIT), GPIO_CONFIG(gpio)); } }
void tlmm_before_sleep_set_configs(void) { int res; unsigned i; //only set tlmms before sleep when it's enabled if (!before_sleep_table_enabled) return; printk("%s(), before_sleep_table_enabled=%d\n", __func__, before_sleep_table_enabled); for(i = 0; i < TLMM_NUM_GPIO; ++i) { unsigned cfg; int gpio; int dir; int func; int output_val = 0; cfg = before_sleep_table_configs[i]; gpio = GPIO_PIN(cfg); if(gpio != i)//(cfg & ~0x20000000) == 0 || continue; output_val = HAL_OUTPUT_VAL(cfg); //Clear the output value //cfg &= ~0x40000000; dir = GPIO_DIR(cfg); func = GPIO_FUNC(cfg); printk("%s(), [%d]: 0x%x\n", __func__, i, cfg); res = gpio_tlmm_config((cfg & ~0x40000000), GPIO_CFG_ENABLE); if(res < 0) { printk("Error: Config failed.\n"); } if((func == 0) && (dir == 1)) // gpio output __msm_gpio_set_inout(i, output_val); } }