Example #1
0
/*
************************************************************************************************************
*
*                                             function
*
*    函数名称:
*
*    参数列表:
*
*    返回值  :
*
*    说明    :
*
*
************************************************************************************************************
*/
int axp22_probe(void)
{
    u8    pmu_type;

    axp_i2c_config(SUNXI_AXP_22X, AXP22_ADDR);
    if(axp_i2c_read(AXP22_ADDR, BOOT_POWER22_VERSION, &pmu_type))
    {
        printf("axp read error\n");

        return -1;
    }
    pmu_type &= 0x0f;
    if(pmu_type & 0x06)
    {
        /* pmu type AXP221 */
        tick_printf("PMU: AXP221\n");

        return 0;
    }

    return -1;
}
Example #2
0
/*
************************************************************************************************************
*
*                                             function
*
*    函数名称:
*
*    参数列表:
*
*    返回值  :
*
*    说明    :
*
*
************************************************************************************************************
*/
int axp809_probe(void)
{
	u8    pmu_type;

    axp_i2c_config(SUNXI_AXP_809, AXP809_ADDR);
	if(axp_i2c_read(AXP809_ADDR, BOOT_POWER809_VERSION, &pmu_type))
	{
		printf("axp read error\n");

		return -1;
	}

    pmu_type &= 0xCF;
	if(pmu_type == 0x42)
	{
		/* pmu type AXP809 */
		tick_printf("PMU: AXP809\n");

		return 0;
	}

	return -1;
}