int power_button_pressed(void) { #if 0 struct gpio_chip power_button_chip; sprd_gpio_init(); sprd_mfp_config(&pwr_gpio_cfg, 1); sprd_gpio_request(&power_button_chip, POWER_BUTTON_GPIO_NUM); sprd_gpio_direction_input(&power_button_chip,POWER_BUTTON_GPIO_NUM); return sprd_gpio_get(&power_button_chip, POWER_BUTTON_GPIO_NUM); #else ANA_REG_OR(ANA_APB_CLK_EN, BIT_3|BIT_11); ANA_REG_SET(ADI_EIC_MASK, 0xff); udelay(3000); int status = ANA_REG_GET(ADI_EIC_DATA); //printf("eica status %x\n", status); return !!(status & (1 << 3)/*PBINT*/);//low level if pb hold #endif }
//MFP_ANA_CFG_X(CHIP_RSTN, AF0, DS1, F_PULL_DOWN,S_PULL_UP, IO_IE); int charger_connected(void) { #if 0 //mingwei struct gpio_chip chg_chip; sprd_mfp_config(&chg_gpio_cfg, 1); sprd_gpio_request(&chg_chip, CHG_GPIO_NUM); sprd_gpio_direction_input(&chg_chip,CHG_GPIO_NUM); return sprd_gpio_get(&chg_chip, CHG_GPIO_NUM); #else ANA_REG_OR(ANA_APB_CLK_EN, BIT_3|BIT_11); ANA_REG_SET(ADI_EIC_MASK, 0xff); udelay(3000); int status = ANA_REG_GET(ADI_EIC_DATA); //printf("charger_connected eica status %x\n", status); return !!(status & (1 << 2)); #endif }
static void sprd_config_keypad_pins(void) { sprd_mfp_config(keypad_func_cfg, ARRAY_SIZE(keypad_func_cfg)); }
void sprd_config_sdio_pins(void) { sprd_mfp_config(sdio_func_cfg, ARRAY_SIZE(sdio_func_cfg)); sprd_mfp_config(&sdcard_detect_gpio_cfg, 1); }