/*****************************************************************************
 函 数 名  : his_boot_probe
 功能描述  : power on
 输入参数  :
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :
*****************************************************************************/
static int __init his_boot_probe(struct platform_device *pdev)
{
    int rt;
    u32 channel_id = ICC_CHN_IFC << 16 | IFC_RECV_FUNC_ONOFF;

#ifndef HI_ONOFF_PHONE
    /* get early param */

    /* 清除reboot flag */
    power_on_reboot_flag_set(POWER_OFF_REASON_INVALID);

    /* normal模式下 clear misc partition */
    if(NORMAL_CHARGING_MODE == get_pd_charge_flag()){
        rt = clear_misc_message();
        if(rt < 0){
            pr_dbg("clear misc message failed.\n");
            return rt;
        }
    }

    /* get power on reason */
    power_on_reason_get();

    /* get power time */
    power_on_time_get();

    /* sysfs create */
    power_on_init_attrs();

    rt = (int)sysfs_create_group(&pdev->dev.kobj, &his_boot_group);
    if (rt < 0)
    {
        pr_dbg("create sys filesystem node failed.\n");
        return rt;
    }

    /* file create and power on info record */
    rt = power_on_log_save();
    if(rt < 0){
        pr_dbg("power on log record failed.\n");
        return rt;
    }
#endif
#if 0 /* #ifdef FEATURE_E5_ONOFF */
    /* 创建开机timer */
    power_on_timer_init();
#endif
    rt = bsp_icc_event_register(channel_id, (read_cb_func)bsp_power_ctrl_read_cb, NULL, NULL, NULL);
    if(rt != 0){
        pr_dbg("icc event register failed.\n");
    }

    return rt;
}
コード例 #2
0
ファイル: power_on.c プロジェクト: samm-git/e3372h-vendor-src
/*****************************************************************************
 函 数 名  : his_boot_probe
 功能描述  : power on
 输入参数  :
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :
*****************************************************************************/
static int __init his_boot_probe(struct platform_device *pdev)
{
    int rt;
    u32 channel_id = ICC_CHN_IFC << 16 | IFC_RECV_FUNC_ONOFF;


    #if ( FEATURE_ON == MBB_MLOG )
    if (*(u32*)SRAM_ABNORMAL_REBOOT_ADDR == SRAM_ABNORAL_REBOOT_NUM)
    {
        mlog_print(MLOG_POWER, mlog_lv_info, "reboot flag POWER_OFF_REASON_CRASH\n");       
        mlog_set_statis_info("abnormal_reboot_times",1); 
    }
    *(u32*)SRAM_ABNORMAL_REBOOT_ADDR = SRAM_ABNORAL_REBOOT_CLEAR;
    #endif 



#ifndef HI_ONOFF_PHONE
    /* get early param */

    /* 清除reboot flag */
    power_on_reboot_flag_set(POWER_OFF_REASON_INVALID);

    /* normal模式下 clear misc partition */
#if (FEATURE_ON == MBB_COMMON)
#if 0
    if(NORMAL_CHARGING_MODE == get_pd_charge_flag()){
        /*在misc分区存在的情况下,才进行清除操作*/
        rt = mtd_partation_exist("misc");
        if(rt){ 
            printk("find misc partition\n"); 
            rt = clear_misc_message();
            if(rt < 0){
                pr_dbg("clear misc message failed.\n");
                return rt;
            }
        }
    }
#endif
#else
    if(NORMAL_CHARGING_MODE == get_pd_charge_flag()){
        rt = clear_misc_message();
        if(rt < 0){
            pr_dbg("clear misc message failed.\n");
            return rt;
        }
    }
#endif

#if (FEATURE_ON == MBB_COMMON)
    power_on_mode_get();
#endif

    /* get power on reason */
    power_on_reason_get();

    /* get power time */
    power_on_time_get();

    /* sysfs create */
    power_on_init_attrs();

    rt = (int)sysfs_create_group(&pdev->dev.kobj, &his_boot_group);
    if (rt < 0)
    {
        pr_dbg("create sys filesystem node failed.\n");
        return rt;
    }

    /* file create and power on info record */
    rt = power_on_log_save();
    if(rt < 0){
        pr_dbg("power on log record failed.\n");
        return rt;
    }
#endif

#ifdef FEATURE_E5_ONOFF
    /* 创建开机timer */
    power_on_timer_init();
#endif

    rt = bsp_icc_event_register(channel_id, (read_cb_func)bsp_power_ctrl_read_cb, NULL, NULL, NULL);
    if(rt != 0){
        pr_dbg("icc event register failed.\n");
    }

    return rt;
}