int mntn_need_save_log(ereset_module etype)
{
    unsigned int   uflag = 0;
    switch (etype)
    {
    case BSP_RESET_MODULE_CCORE:
	uflag = himntn_modem_resetlog;
	break;
    case BSP_RESET_MODULE_HIFI:
	uflag = himntn_hifi_resetlog;
	break;
    case BSP_RESET_MODULE_MCU:
	uflag = himntn_gobal_resetlog;
	break;
    default:
       MNTN_FILESYS_PRINT(KERN_ERR"mntn_err: Wrong module type when saving log data!\n");
	break;
    }

    if (0 == uflag)
    {
        return 0;
    }
    else
    {
        if ((get_boot_into_recovery_flag()==1)&& (mntn_read_nogui_flag()==0))
	{
	    return 0;
	}
	return 1;
    }
}
void hisifb_backlight_register(struct platform_device *pdev)
{
	struct hisi_fb_data_type *hisifd = NULL;
#ifdef CONFIG_FB_BACKLIGHT
	struct backlight_device *pbd = NULL;
	struct fb_info *fbi = NULL;
	char name[16] = {0};
	struct backlight_properties props;
#endif

	BUG_ON(pdev == NULL);
	hisifd = platform_get_drvdata(pdev);
	BUG_ON(hisifd == NULL);

	hisifd->backlight.bl_updated = 0;
	hisifd->backlight.bl_level_old = 0;
	hisifd->backlight.frame_updated = 0;
	sema_init(&hisifd->backlight.bl_sem, 1);
#ifdef CONFIG_HISI_FB_BACKLIGHT_DELAY
	INIT_DELAYED_WORK(&hisifd->backlight.bl_worker, hisifb_bl_workqueue_handler);
#endif

	if (lcd_backlight_registered)
		return;

	is_recovery_mode = (int)get_boot_into_recovery_flag();

#ifdef CONFIG_FB_BACKLIGHT
	fbi = hisifd->fbi;

	snprintf(name, sizeof(name), "hisifb%d_bl", hisifd->index);
	props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
	props.brightness = FB_BACKLIGHT_LEVELS - 1;
	pbd = backlight_device_register(name, fbi->dev, hisifd,
		&hisi_fb_bl_ops, &props);
	if (IS_ERR(pbd)) {
		fbi->bl_dev = NULL;
		HISI_FB_ERR("backlight_device_register failed!\n");
	}

	fbi->bl_dev = pbd;
	fb_bl_default_curve(fbi, 0,
		hisifd->panel_info.bl_min, hisifd->panel_info.bl_max);
#else
	/* android supports only one lcd-backlight/lcd for now */
	if (led_classdev_register(&pdev->dev, &backlight_led)) {
		HISI_FB_ERR("led_classdev_register failed!\n");
		return;
	}
#endif

	INIT_WORK(&(hisifd->backlight.sbl_work), hisifb_sbl_work);
	hisifd->backlight.sbl_queue = create_singlethread_workqueue(K3_DSS_SBL_WORKQUEUE);
	if (!hisifd->backlight.sbl_queue) {
		HISI_FB_ERR("failed to create sbl_queue!\n");
		return ;
	}

	lcd_backlight_registered = 1;
}
/*
static int app_info_show(struct seq_file *m, void *v)
{
	int len = 0;
	len = seq_printf(m,"recovery_flag:\n%d\n"
                                        "charge_flag:\n%d\n"
                                        "reset_normal_flag:\n%d\n",
                                        (int)get_boot_into_recovery_flag(),
                                        (int)get_pd_charge_flag(),
                                        (int)resetmode_is_normal());
	return 0;
}
*/
static int app_info_show(struct seq_file *m, void *v)
{
	int len = 0;
	len = seq_printf(m,"recovery_flag:\n%d\n"
                                        "charge_flag:\n%d\n",
                                        (int)get_boot_into_recovery_flag(),
                                        (int)get_pd_charge_flag());
	return 0;
}
static int app_tag_read_proc(char *page, char **start, off_t off,
				 int count, int *eof, void *data)
{
	int len = 0;
	u32 charge_flag = 0;
	u32 recovery_flag = 0;
	u32 reset_normal_flag = 0;

	recovery_flag = get_boot_into_recovery_flag();
	charge_flag = get_pd_charge_flag();
	reset_normal_flag = resetmode_is_normal();

	len = snprintf(page, PAGE_SIZE,
					"recovery_flag:\n%d\n"
					"charge_flag:\n%d\n"
					"reset_normal_flag:\n%d\n",
					recovery_flag,
					charge_flag,
					reset_normal_flag);

	return proc_calc_metrics(page, start, off, count, eof, len);
}
int altek6045_exec_cmd(const hwextisp_intf_t* i, hwextisp_config_data_t *data)
{
    int rc = 0;
    u8 *in_buf = NULL, *out_buf = NULL;
    u32 opcode, dir_type, block_response, out_len, in_len, bulk_len;
    bool out_to_block, out_from_block;

    if (get_boot_into_recovery_flag()||(misp_cmd_filter==1)) {
        cam_info("%s cmd=0x%x is blocked", __func__, data->cmd);
        return 0;
    }

    if(((data->cmd & 0x0000FFFF )!= 0x2106)&&((data->cmd & 0x0000FFFF )!= 0x2105))
        cam_info("%s cmd=0x%x", __func__, data->cmd);

    dir_type = (data->cmd & EXTISP_CMD_DIR_FLAG_MASK)>>EXTISP_CMD_DIR_FLAG_SHIT;
    block_response = (data->cmd & EXTISP_CMD_RESP_FLAG_MASK)>>EXTISP_CMD_RESP_FLAG_SHIT;
    out_len = (data->cmd & EXTISP_CMD_OUT_LEN_MASK)>>EXTISP_CMD_OUT_LEN_SHIT;
    in_len = (data->cmd & EXTISP_CMD_IN_LEN_MASK)>>EXTISP_CMD_IN_LEN_SHIT;
    opcode = (data->cmd & EXTISP_CMD_OPCODE_MASK)>>EXTISP_CMD_OPCODE_SHIT;
    out_buf = in_buf = data->u.buf;
    out_to_block = (EXTISP_BLOCK_RESPONSE_CMD == block_response)? true: false;
    out_from_block = (EXTISP_BLOCK_WRITE_CMD == block_response) ? true : false;

    /* allocate kernel buf: override out_buf out_len*/
    if (out_to_block) {
        out_len = data->ext_buf.user_buf_len;
        if (out_len > 4096) {
            cam_err("%s invalid ext_buf_len=%d", __func__, out_len);
            return -EINVAL;
        }
        out_buf = kmalloc(out_len, GFP_KERNEL);
        if (NULL == out_buf) {
            cam_err("%s kmalloc failed", __func__);
            return -ENOMEM;;
        }
        memset(out_buf,0,out_len);
    }

    if(out_from_block) {
        bulk_len = data->ext_buf.user_buf_len;
        out_buf = kmalloc(bulk_len, GFP_KERNEL);
        if(copy_from_user(out_buf, data->ext_buf.user_buf_ptr, bulk_len)) {
            cam_err("%s copy from user failed", __func__);
            rc = -EFAULT;
        }
    }

    if (EXTISP_INOUT_CMD == dir_type) {
        if(out_from_block) {
            rc = misp_exec_write_block_res((u16)opcode, in_buf, in_len,
                                           out_to_block, out_buf,bulk_len, out_len);
        } else {
            rc = misp_exec_bidir_cmd((u16)opcode, data->u.buf, in_len,
                                     out_to_block, out_buf, out_len);
        }
    } else if (EXTISP_SET_CMD == dir_type) {
        if(out_from_block) {
            rc = misp_exec_write_block((u16)opcode, in_buf, in_len, out_buf, bulk_len);
        } else {
            rc = misp_exec_unidir_cmd((u16)opcode, true,
                                      out_to_block, in_buf, in_len);
        }
    } else if (EXTISP_GET_CMD == dir_type) {
        rc = misp_exec_unidir_cmd((u16)opcode, false,
                                  out_to_block, out_buf, out_len);
    } else {
        cam_err("%s unkown cmd direction", __func__);
        rc = -EINVAL;
    }

    /* reclaimed kernel buf*/
    if (out_to_block) {
        if (copy_to_user(data->ext_buf.user_buf_ptr, out_buf, out_len)) {
            cam_err("%s copy to user failed", __func__);
            rc = -EFAULT;
        }
        kfree(out_buf);
        out_buf = NULL;
    }
    if(out_from_block) {
        if(out_buf) {
            kfree(out_buf);
        }
    }
    out_buf = NULL;

    return rc;
}