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
    
}
Esempio n. 3
0
static void cp2_rfctl_init(void)
{
	sprd_gpio_request(NULL,GPIO_CP2_RFCTL);
	sprd_gpio_direction_output(NULL, GPIO_CP2_RFCTL, 1);
	sprd_gpio_set(NULL, GPIO_CP2_RFCTL, 1);
}