void power_init(void)
{
    /* Charger detect */
    and_l(~0x01000000, &GPIO1_ENABLE);
    or_l(0x01000000, &GPIO1_FUNCTION);
    
    pcf50606_init();
}
示例#2
0
void power_init(void)
{
    /* Configure GPA6 as input and wait a short while */
    GPIOA_DIR &= ~(1<<6);

    udelay(10);

    /* Value of GPA6 determines PMU chip type */
    if (GPIOA & (1<<6))
    {
        pmu = PCF50635;

        pcf50635_init();
        
        /* Clear pending interrupts from pcf50635 */
        unsigned char data[5]; /* 0 = INT1, 1 = INT2, 2 = INT3, ... 4 = INT5 */
        pcf50635_read_multiple(PCF5063X_REG_INT1, data, 5);
    }
    else
    {
        pmu = PCF50606;

        /* Configure GPA6 for output (backlight enable) */
        GPIOA_DIR |= (1<<6);

        pcf50606_init();

        /* Clear pending interrupts */
        unsigned char data[3]; /* 0 = INT1, 1 = INT2, 2 = INT3 */
        pcf50606_read_multiple(0x02, data, 3);
    }

#ifndef BOOTLOADER
        IEN |= EXT3_IRQ_MASK;   /* Unmask EXT3 */
#endif
}