static void hi6401_check_pll(struct hi6401_irq *irq)
{
	unsigned long flags = 0;
	u32 ret = 0;
	u32 val = 0;

	mutex_lock(&irq->sr_mutex);
	spin_lock_irqsave(&irq->rw_lock, flags);
	writel(1, irq->reg_base_addr + (HI6401_PAGE_SELECT_REG << 2));
	udelay(1);
	ret = readl(irq->reg_base_addr + ((HI6401_PLL_PD_REG & HI6401_PAGE_OFFSET_MASK) << 2));
	udelay(1);
	if (0 == (ret & 1)) { /* HI6401_PLL_PD_BIT */
		/* pll power on */
		val = readl(irq->reg_base_addr + ((HI6401_PLL_EN_REG & HI6401_PAGE_OFFSET_MASK) << 2));
		udelay(1);
		if (0 != (val & (1 << HI6401_PLL_EN_BIT))) {
			/* pll enable */
			ret = readl(irq->reg_base_addr + ((HI6401_PLL_STATUS_REG & HI6401_PAGE_OFFSET_MASK) << 2));
			udelay(1);
			if (0 == (ret & (1 << HI6401_PLL_STATUS_BIT))) {
				pr_err("%s,line:%d reset pll.\n", __FUNCTION__, __LINE__);
				/* pll unlocked */
				hi6401_codec_dump(irq);
				if ((1 == pll_unlock_flag) && !dsm_client_ocuppy(hi6401_client)) {
					dsm_client_record(hi6401_client, "DSM_HI6401_PLL_UNLOCK ret=%d,codec=%s\n", ret, (g_dump_buf ? g_dump_buf : "null"));
					dsm_client_notify(hi6401_client, DSM_HI6401_PLL_UNLOCK);
				}
				pll_unlock_flag++;
				val &= ~(1 << HI6401_PLL_EN_BIT);
				writel(val, irq->reg_base_addr + ((HI6401_PLL_EN_REG & HI6401_PAGE_OFFSET_MASK) << 2));
				udelay(2);
				val |= (1 << HI6401_PLL_EN_BIT);
				writel(val, irq->reg_base_addr + ((HI6401_PLL_EN_REG & HI6401_PAGE_OFFSET_MASK) << 2));
				udelay(1);
			} else {
				pll_unlock_flag = 0;
				if(g_dump_buf)
					memset(g_dump_buf, 0, Hi6401_SIZE_MAX);
			}
		}
	} else {
		if (!dsm_client_ocuppy(hi6401_client)) {
			dsm_client_record(hi6401_client, "HI6401_PLL_PD_REG ret=%d\n", ret);
			dsm_client_notify(hi6401_client, DSM_HI6401_PLL_PD);
		}
	}
	spin_unlock_irqrestore(&irq->rw_lock, flags);
	mutex_unlock(&irq->sr_mutex);
}
예제 #2
0
void ft6x06_report_dsm_erro(struct ft6x06_ts_data * ft6x06_data, struct dsm_client * dsm_client, 
                                                                int type, int err_num)
{
    if(!dsm_client)
    {
        tp_log_err("%s %d: dsm_client is null!\n", __func__, __LINE__);
        return;
    }

    if(dsm_client_ocuppy(dsm_client))
    {
        tp_log_err("%s %d: dsm buffer is busy!\n", __func__, __LINE__);
        return;
    }

    switch(type)
    {
        case DSM_TP_I2C_RW_ERROR_NO:
            dsm_client_record(dsm_client,"%s %d: i2c_trans_erro, rc = %d\n", __func__,__LINE__, err_num); 
            break;
        case DSM_TP_FW_ERROR_NO:
            dsm_client_record(dsm_client,"%s %d: firmware upgrade erro!\n", __func__,__LINE__); 
            break;
        default:
            break;
    }

    ft6x06_dsm_record_basic_info(ft6x06_data, dsm_client);
    dsm_client_notify(dsm_client, type);

    return;
}
static void dsm_gpio_key_timer_func(unsigned long data)
{
	int key_press_error_found = -1;

	if (!dsm_client_ocuppy(key_dclient)) {
		key_press_error_found++;
	}

	/* judge the press count */
	if ((!key_press_error_found) && (volume_up_press_count > MAX_PRESS_KEY_COUNT)) {
		key_press_error_found++;
		dsm_client_record(key_dclient, "volume up key trigger on the abnormal style.\n");
	} else if ((!key_press_error_found) && (volume_down_press_count > MAX_PRESS_KEY_COUNT)) {
		key_press_error_found++;
		dsm_client_record(key_dclient, "volume down key trigger on the abnormal style.\n");
	}

	if (key_press_error_found > 0) {
		dsm_client_notify(key_dclient, DSM_KEY_ERROR_NO);
	} else if (!key_press_error_found) {
		dsm_client_unocuppy(key_dclient);
	} else {
		/* key_dclient preempt failed, we have nothing to do */
	}

	/* reset the statistic variable */
	volume_up_press_count = 0;
	volume_down_press_count = 0;
	mod_timer(&dsm_gpio_key_timer, jiffies + STATISTIC_INTERVAL * HZ);

	return;
}
static void cpu_buck_work(struct work_struct *work)
{
    int i = 0;
    struct cpu_buck_sample* cbs = g_cbs;
    bool already_notified = false;

    if (!fault_happened)
        return;
    while(cbs)
    {
        for (i = 0; i < cbs->info_size; ++i)
        {
            if ((cbs->cbi[i].error_mask & cbs->reg[cbs->cbi[i].reg_number]) == cbs->cbi[i].error_mask)
            {
                if (!dsm_client_ocuppy(cpu_buck_client))
                {
                    already_notified = true;
                    hwlog_info("cpu_buck record and notify: %s\n", cbs->cbi[i].error_info);
                    dsm_client_record(cpu_buck_client, "cpu_buck %s happened!\n", cbs->cbi[i].error_info);
                    dsm_client_notify(cpu_buck_client, ERROR_NO_CPU_BUCK_BASE + cbs->cbi[i].err_no);
                    break;
                }
            }
        }
        if (already_notified)
        {
            break;
        }
        cbs = cbs->cbs;
    }
}
static void gpio_keydown_timer(unsigned long data)
{
        int keydown_value;
        struct hisi_gpio_key *gpio_key = (struct hisi_gpio_key *)data;

        keydown_value = gpio_get_value((unsigned int)gpio_key->gpio_down);
        /*judge key is pressed or released.*/
        if (keydown_value == GPIO_LOW_VOLTAGE){
                wake_lock(&volume_down_key_lock);

#if defined (CONFIG_HUAWEI_DSM)
            if ((jiffies - volume_down_last_press_time) < msecs_to_jiffies(PRESS_KEY_INTERVAL)) {
                if (!dsm_client_ocuppy(key_dclient)) {
                    dsm_client_record(key_dclient, "volume down key trigger on the abnormal style.\n");
                    dsm_client_notify(key_dclient, DSM_KEY_ERROR_NO);
                }
            }
            volume_down_last_press_time = jiffies;
 #endif
	}

	schedule_delayed_work(&(gpio_key->gpio_keydown_work), 0);

	return;
}
int audio_dsm_report_num(int error_no, unsigned int mesg_no)
{
    int err = 0;

    if(NULL == audio_dclient)
    {
        printk("%s: audio_dclient did not register!\n", __func__);
        return -1;
    }

    err = dsm_client_ocuppy(audio_dclient);
    if(0 != err)
    {
        printk("%s: user buffer is busy!\n", __func__);
        return -1;
    }

    printk("%s: after dsm_client_ocuppy, error_no=0x%x, mesg_no=0x%x!\n",
        __func__, error_no, mesg_no);
    
    err = dsm_client_record(audio_dclient, "Message code = 0x%x.\n", mesg_no);

    dsm_client_notify(audio_dclient, error_no);

    return 0;
}
static void RFC_PrintIeStatus(CSMI_InformationElements *ie)
{
	if (ie->coreUnsprtdMsg || ie->coreDataTxCol || ie->coreReconfigObjection || ie->coreExError) {
		SLIMBUS_DEV_LIMIT_INFO("Core: UNSPRTD_MSG:%X DATA_TX_COL:%X RECONFIG_OBJECTION:%X EX_ERROR:%X \n",
			ie->coreUnsprtdMsg, ie->coreDataTxCol, ie->coreReconfigObjection, ie->coreExError);
	}
	if (ie->interfaceMcTxCol || ie->interfaceLostFs || ie->interfaceLostSfs || ie->interfaceLostMs || ie->interfaceDataSlotOverlap) {
		SLIMBUS_DEV_LIMIT_INFO("Interface: MC_TX_COL:%X LOST_FS:%X LOST_SFS:%X LOST_MS:%X DATA_SLOT_OVERLAP:%X\n",
			ie->interfaceMcTxCol, ie->interfaceLostFs, ie->interfaceLostSfs, ie->interfaceLostMs, ie->interfaceDataSlotOverlap);
	}
	if (ie->managerActiveManager) {
		SLIMBUS_DEV_LIMIT_INFO("Manager: ACTIVE_MANAGER:%X\n", ie->managerActiveManager);
	}
	if (ie->framerQuality || ie->framerGcTxCol || ie->framerFiTxCol || ie->framerFsTxCol || ie->framerActiveFramer) {
		SLIMBUS_DEV_LIMIT_INFO("Framer: QUALITY:%X GC_TX_COL:%X FI_TX_COL:%X FS_TX_COL:%X ACTIVE_FRAMER:%X\n",
			ie->framerQuality, ie->framerGcTxCol, ie->framerFiTxCol, ie->framerFsTxCol, ie->framerActiveFramer);
	}

	if (ie->interfaceLostFs || ie->interfaceLostSfs || ie->interfaceLostMs) {
		if (dsm_notify_limit == SLIMBUS_LOSTMS_COUNT) {
			slimbus_dump_state(SLIMBUS_DUMP_LOSTMS);
			if (!dsm_client_ocuppy(dsm_audio_client)) {
				dsm_client_record(dsm_audio_client, "DSM_HI6402_SLIMBUS_LOST_MS\n");
				dsm_client_notify(dsm_audio_client, DSM_HI6402_SLIMBUS_LOST_MS);
			}
		}
		dsm_notify_limit++;
	}
}
int mmc_all_send_cid(struct mmc_host *host, u32 *cid)
{
	int err;
	struct mmc_command cmd = {0};
#ifdef CONFIG_HUAWEI_SDCARD_DSM
	char *log_buff;
	int   buff_len;
#endif
	BUG_ON(!host);
	BUG_ON(!cid);

	cmd.opcode = MMC_ALL_SEND_CID;
	cmd.arg = 0;
	cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;

	err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
#ifdef CONFIG_HUAWEI_SDCARD_DSM
	if(!strcmp(mmc_hostname(host), "mmc1"))
	{
		 dsm_sdcard_cmd_logs[DSM_SDCARD_CMD2_R0].value = cmd.resp[0];
		 dsm_sdcard_cmd_logs[DSM_SDCARD_CMD2_R1].value = cmd.resp[1];
		 dsm_sdcard_cmd_logs[DSM_SDCARD_CMD2_R2].value = cmd.resp[2];
		 dsm_sdcard_cmd_logs[DSM_SDCARD_CMD2_R3].value = cmd.resp[3];
		 
	}

	if (err)
	{
		if(-ENOMEDIUM != err && -ETIMEDOUT != err
		&& !strcmp(mmc_hostname(host), "mmc1") && !dsm_client_ocuppy(sdcard_dclient))
		{
			log_buff = dsm_sdcard_get_log(DSM_SDCARD_CMD2_R3,err);
			buff_len = strlen(log_buff);
			dsm_client_copy(sdcard_dclient,log_buff,buff_len + 1);
			dsm_client_notify(sdcard_dclient, DSM_SDCARD_CMD2_RESP_ERR);
		}
		if(!strcmp(mmc_hostname(host),"mmc1"))
		{
		   printk(KERN_ERR "%s:send cmd2 fail,err=%d\n",mmc_hostname(host),err);
		}
		return err;
	}
#else
	if (err)
	{
	    if(!strcmp(mmc_hostname(host),"mmc1"))
		{
		   printk(KERN_ERR "%s:send cmd2 fail,err=%d\n",mmc_hostname(host),err);
		}
		return err;
	}
#endif

	memcpy(cid, cmd.resp, sizeof(u32) * 4);

	return 0;
}
/*delete mdss_mdp_get_clk_rate() to avoid panic*/
void mdp_underrun_dsm_report(unsigned long num,unsigned long underrun_cnt)
{
	/* try to get permission to use the buffer */
	if(dsm_client_ocuppy(lcd_dclient))
	{
		/* buffer is busy */
		LCD_LOG_ERR("%s: buffer is busy!\n", __func__);
		return;
	}
	dsm_client_record(lcd_dclient, "Lcd underrun detected for ctl=%d,count=%d\n",num,underrun_cnt);
	dsm_client_notify(lcd_dclient, DSM_LCD_MDSS_UNDERRUN_ERROR_NO);
}
struct hisi_hi6421v300_coul_battery_data* get_battery_data(unsigned int id_voltage)
{
    int i;
    int dsm_error_found = -1;
    int dsm_error_offset = 0;

    if (!bat_param_status)
    {
        hwlog_err("battery param is invalid\n");
        return NULL;
    }
    if(!dsm_client_ocuppy(battery_detect_dclient))
    {
        dsm_error_found++;
    }
    for(i = 0; i < hisi_bat_data_size; i++)
    {
        if((id_voltage > p_data[i]->id_identify_min) && (id_voltage <= p_data[i]->id_identify_max))
        {
            if ((id_voltage < p_data[i]->id_voltage_min) || (id_voltage > p_data[i]->id_voltage_max))
            {
                dsm_error_found++;
                dsm_error_offset = 0;
                dsm_client_record(battery_detect_dclient, "Battery id voltage:%d is out of normal range:[%d~%d],identify range:[%d~%d]!\n",id_voltage,
                    p_data[i]->id_voltage_min,p_data[i]->id_voltage_max,p_data[i]->id_identify_min,p_data[i]->id_identify_max);
            }
            break;
        }
    }
    if(i == hisi_bat_data_size)
    {
        i = 0;
        dsm_error_found++;
        dsm_error_offset = 1;
        dsm_client_record(battery_detect_dclient, "Battery id voltage:%d is invalid. Use the default battery params!\n",id_voltage);
    }
    if(dsm_error_found > 0)
    {
        dsm_client_notify(battery_detect_dclient, DSM_BATTERY_DETECT_ERROR_NO + dsm_error_offset);
    }
    else if(!dsm_error_found)
    {
        dsm_client_unocuppy(battery_detect_dclient);
    }
    else
    {
        hwlog_err("dsm battery_detect_dclient ocuppy failed!\n");
    }
    hwlog_info("current battery name is %s\n", p_data[i]->batt_brand);
    return p_data[i];
}
//cnotify format: |client name|,|error no|,|contents|
static ssize_t dsm_cnotify_store(struct device *dev,
                                 struct device_attribute *attr, const char *buf, size_t count)
{
    char client_name[CLIENT_NAME_LEN]= {0};
    int size;
    int error_no = 0;
    struct dsm_client *client = NULL;
    char *strings = NULL;
    char *ptr;

    DSM_LOG_DEBUG("%s enter\n",__func__);
    strings = (char *)kzalloc(count, GFP_KERNEL);
    if(!strings) {
        DSM_LOG_ERR("dsm write malloc failed\n");
        goto out;
    }

    memcpy(strings, buf, count);
    /*get client name*/
    ptr = dsm_strtok(strings, ",");
    if(ptr) {
        size = strlen(ptr);
        size = (size < CLIENT_NAME_LEN) ? size : (CLIENT_NAME_LEN - 1);
        memcpy(client_name, ptr, size);
    }
    /*get error no*/
    ptr = dsm_strtok(NULL, ",");
    if(ptr)
        error_no = dsm_atoi(ptr);
    /*get notify content*/
    ptr = dsm_strtok(NULL, NULL);

    DSM_LOG_INFO("client name - %s, error no - %d\n", client_name, error_no);
    if(ptr)
        DSM_LOG_INFO("content - %s\n", ptr);

    client = dsm_find_client(client_name);
    if(client && (!dsm_client_ocuppy(client))) {
        DSM_LOG_DEBUG("dsm write find client - %s\n", client_name);
        if(ptr)
            dsm_client_copy(client, ptr, strlen(ptr));
        dsm_client_notify(client, error_no);
    } else
        DSM_LOG_INFO("dsm notify can't find client - %s\n", client_name);

out:
    if(strings)
        kfree(strings);
    DSM_LOG_DEBUG("%s exit\n",__func__);
    return count;
}
예제 #12
0
static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card)
{
	int err;
	struct mmc_command cmd = {0};
#ifdef CONFIG_HUAWEI_SDCARD_DSM
	char *log_buff;
	int   buff_len;
#endif
	BUG_ON(!host);

	cmd.opcode = MMC_SELECT_CARD;

	if (card) {
		cmd.arg = card->rca << 16;
		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
	} else {
		cmd.arg = 0;
		cmd.flags = MMC_RSP_NONE | MMC_CMD_AC;
	}

	err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
#ifdef CONFIG_HUAWEI_SDCARD_DSM
	
	if(!strcmp(mmc_hostname(host), "mmc1"))
	{
		 dsm_sdcard_cmd_logs[DSM_SDCARD_CMD7].value = cmd.resp[0];
	}
	
	if (err)
	{
		if(-ENOMEDIUM != err && -ETIMEDOUT != err
		&& !strcmp(mmc_hostname(host), "mmc1") && !dsm_client_ocuppy(sdcard_dclient))
		{	
			log_buff = dsm_sdcard_get_log(DSM_SDCARD_CMD7,err);	
			buff_len = strlen(log_buff);
			dsm_client_copy(sdcard_dclient,log_buff,buff_len + 1);
			dsm_client_notify(sdcard_dclient, DSM_SDCARD_CMD7_RESP_ERR);

		}
	
		return err;
	}
#else
	if (err)
		return err;
#endif

	return 0;
}
예제 #13
0
static ssize_t dsm_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
	char client_name[CLIENT_NAME_LEN]={0};
	int size;
	struct dsm_client *client = NULL;
	char *buff = NULL;
	char *ptr;

	DSM_LOG_DEBUG("%s enter\n",__func__);
	buff = (char *)kzalloc(count, GFP_KERNEL);
	if(!buff){
		DSM_LOG_ERR("dsm write malloc failed\n");
		goto out;
	}

	if(copy_from_user(buff, buf, count)){
		DSM_LOG_ERR("dsm write copy failed\n");
		goto out;
	}

	ptr = buff;
	while(*ptr){
		if(*ptr == '\n')
			break;
		ptr++;
	}

	if(*ptr == '\n'){
		size = ptr - buff;
		size = (size < CLIENT_NAME_LEN) ? size : (CLIENT_NAME_LEN - 1);
		memcpy(client_name, buff, size);
		client = dsm_find_client(client_name);
		if(client && (!dsm_client_ocuppy(client))){
			DSM_LOG_DEBUG("dsm write find client - %s\n", client_name);
			ptr++;//ignore '/n'
			size = count - (ptr - buff);
			dsm_client_copy(client, ptr, size);
			dsm_client_notify(client, 20203);
		}else
			DSM_LOG_INFO("dsm write can't find client - %s\n", client_name);
	}else
		DSM_LOG_ERR("dsm write can't find client name\n");

out:
	if(buff)
		kfree(buff);
	DSM_LOG_DEBUG("%s exit\n",__func__);
	return count;
}
static void powerkey_timer_func(unsigned long data)
{
	if (powerkey_press_count > MAX_PRESS_KEY_COUNT) {
		if(!dsm_client_ocuppy(power_key_dclient)) {
			dsm_client_record(power_key_dclient, "powerkey trigger on the abnormal style.\n");
			dsm_client_notify(power_key_dclient, DSM_POWER_KEY_ERROR_NO);
		}
	}

	/* reset the statistic variable */
	powerkey_press_count = 0;
	mod_timer(&dsm_powerkey_timer, jiffies + STATISTIC_INTERVAL * HZ);

	return;
}
예제 #15
0
/*****************************************************************************
 函 数 名  : pastar_dsm_work_func
 功能描述  : 上报异常信息
 输入参数  : @work - work结构体
 输出参数  : 无
 返 回 值  : 无
*****************************************************************************/
void pastar_dsm_work_func(struct work_struct *work)
{
    pastar_print_info("Execuing ...");

    /* notify exception */
    if (!dsm_client_ocuppy(pastar_dclient)) 
    {
        /* record message */
		dsm_client_record(pastar_dclient, "PAStar 0x21 reg 0x%x, 0x6A reg 0x%x\n", reg_val[0], reg_val[1]);

        /* notify */
		dsm_client_notify(pastar_dclient, 30000);
	}

    return;
}
static void hisi_pmic_record_events(PMIC_MNTN_DESC *pmic_mntn)
{
    int index;

#if defined (CONFIG_HUAWEI_DSM)
    int pmic_record_error_offset = 0;
    int i = 0;
#endif

    snprintf(pmic_mntn->init_log_show, PMIC_PRINT_BUF_SIZE, "\nPMIC REGISTER DUMP\n");
    snprintf(pmic_mntn->init_log_show + strlen(pmic_mntn->init_log_show), PMIC_PRINT_BUF_SIZE, "  addr     data \n");

    for (index = 0; index < pmic_mntn->record_reg_n; index++) {
        pmic_mntn->record_event_buff[index] = hisi_pmic_reg_read(pmic_mntn->record_regs[index]);

#if defined (CONFIG_HUAWEI_DSM)
		pmic_record_error_offset = pmic_mntn->data_width * index;
		if (pmic_mntn->record_event_buff[index] & HISI_PMIC_DSM_MASK_STATE) {
			for (i = 0; i < pmic_mntn->data_width; i++) {
				if ((pmic_mntn->record_event_buff[index] & BIT(i)) \
					&& (pmic_mntn->dsm_record_regs_mask[index] & BIT(i)) \
					&& (pmic_mntn->dsm_ocp_reset_mask[index] & BIT(i))) {
					if (dsm_client_ocuppy(pmic_dsm_dclient)) {
						pr_err("pmic_dsm_dclient dsm_client_ocuppy failed\n");
					} else {
						pr_err("pmic %s happened, please pay attention!\n",
							pmic_mntn->record_exch_desc[index].event_bit_name[i]);
						dsm_client_record(pmic_dsm_dclient, "pmic %s_ocp happened, please pay attention!\n",
							pmic_mntn->record_exch_desc[index].event_bit_name[i]);
						dsm_client_notify(pmic_dsm_dclient, DSM_PMU_OCP_ERROR_NO_BASE + pmic_record_error_offset);
					}
				}
				pmic_record_error_offset++;
			}
		}
#endif

        hisi_pmic_reg_write(pmic_mntn->record_regs[index], pmic_mntn->record_event_buff[index]);
        snprintf(pmic_mntn->init_log_show + strlen(pmic_mntn->init_log_show), PMIC_PRINT_BUF_SIZE,
            "  0x%0x    0x%0x \n", pmic_mntn->record_regs[index], pmic_mntn->record_event_buff[index]);
    }
    clear_uv_mntn_resered_reg_bit();

    pr_err("%s", pmic_mntn->init_log_show);

    return;
}
void hw_wifi_dsm_client_notify(int dsm_id, const char *fmt, ...) {
    char buf[LOG_BUF_SIZE] = {0};
    va_list ap;

    va_start(ap, fmt);
    if(wifi_dsm_client && !dsm_client_ocuppy(wifi_dsm_client)) {
        if(fmt) {
            vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
            dsm_client_record(wifi_dsm_client, buf);
        }
        dsm_client_notify(wifi_dsm_client, dsm_id);
        HW_PRINT_HI("wifi dsm_client_notify success\n");
    } else {
        HW_PRINT_HI("wifi dsm_client_notify failed\n");
    }
    va_end(ap);
}
static irqreturn_t ivp_dwaxi_irq_handler(int irq, void *dev_id)
{
    ivp_warn("=======================DWAXI IRQ Trigger============================");
    ivp_warn("dwaxi triggled!SMMU maybe in reset status");
    //clear dwaxi irq
    ivp_gic_reg_write(GIC_REG_OFF_GICD_ICENABLERn, 0x80000);
    ivp_parse_dwaxi_info();
    ivp_warn("=======================DWAXI IRQ LEAVE==============================");

    if(!dsm_client_ocuppy(client_ivp))
    {
         dsm_client_record(client_ivp, "ivp\n");
         dsm_client_notify(client_ivp, DSM_IVP_DWAXI_ERROR_NO);
         ivp_info("[I/DSM] %s dsm_client_ivp_dwaxi", client_ivp->client_name);
    }

    return IRQ_HANDLED;
}
static irqreturn_t ivp_wdg_irq_handler(int irq, void *dev_id)
{
    struct ivp_device *pdev = (struct ivp_device *) dev_id;;
    ivp_warn("=======================WDG IRQ Trigger============================");
    //Clear IRQ
    ivp_hw_clr_wdg_irq();

    up(&pdev->wdg_sem);
    ivp_warn("=======================WDG IRQ LEAVE==============================");

    if(!dsm_client_ocuppy(client_ivp))
    {
        dsm_client_record(client_ivp, "ivp\n");
        dsm_client_notify(client_ivp, DSM_IVP_WATCH_ERROR_NO);
        ivp_info("[I/DSM] %s dsm_client_ivp_watach dog", client_ivp->client_name);
    }

    return IRQ_HANDLED;
}
static void inputhub_mcu_send_complete(rproc_msg_t *ack_buffer,
				rproc_msg_len_t ack_buffer_len,
				int error,
				void *data)
{
    complete(&send_complete);
    	
    if ((-ETIMEOUT) == error) {
        hwlog_err("send failed timeout\n");
	        if(!dsm_client_ocuppy(shb_dclient)){
                    dsm_client_record(shb_dclient, "IOM3RSTSTAT: 0x%x\n", read_reg32(IOM3RSTSTAT_ADDR));
                    dsm_client_record(shb_dclient, "PERRSTSTAT4: 0x%x\n", read_reg32(PERRSTSTAT4_ADDR));
                    dsm_client_record(shb_dclient, "PERSTAT5: 0x%x\n", read_reg32(PERSTAT5_ADDR));
                    dsm_client_record(shb_dclient, "IOM3CLKEN: 0x%x\n", read_reg32(IOM3CLKEN_ADDR));
                    dsm_client_notify(shb_dclient, DSM_SHB_ERR_IPC_TIMEOUT);
            }
    }else{
    hwlog_debug("send success\n");
    }	
    return;
}
int audio_dsm_report_info(int error_no, char *fmt, ...)
{
    int err = 0;
    int ret = 0;
    char dsm_report_buffer[DSM_REPORT_BUF_SIZE] = {0};
    va_list args;

    if(NULL == audio_dclient)
    {
        printk("%s: audio_dclient did not register!\n", __func__);
        return -1;
    }

    if(error_no < DSM_AUDIO_ERROR_NUM)
    {
        printk("%s: input error_no err!\n", __func__);
        return -1;
    }

    va_start(args, fmt);
    ret = vsnprintf(dsm_report_buffer, DSM_REPORT_BUF_SIZE, fmt, args);
    va_end(args);
    
    err = dsm_client_ocuppy(audio_dclient);
    if(0 != err)
    {
        printk("%s: user buffer is busy!\n", __func__);
        return -1;
    }

    printk("%s: after dsm_client_ocuppy, dsm_error_no = %d, %s\n",
            __func__, error_no, dsm_report_buffer);

    dsm_client_record(audio_dclient, "%s\n", dsm_report_buffer);
    
    dsm_client_notify(audio_dclient, error_no);
    
    return 0;
    
}
static irqreturn_t hi6402_pll_unlock_handler(int irq, void *data)
{
	struct hi6402_mbhc_platform_data *pdata =
			(struct hi6402_mbhc_platform_data *)data;

	BUG_ON(NULL == pdata);

	unsigned int i = 0;

	mutex_lock(&pdata->p_irq->pll_mutex);

	if (0 != (hi6402_irq_read(pdata->p_irq, HI6402_PLL_PD_FLAG_REG) & PLL_PD_VALUE) || 0 != (hi6402_irq_read(pdata->p_irq, HI6402_PLL_LOCK_FLAG_REG) & PLL_LOCK_VALUE)){
		pr_info("%s(%u): pll pd, ignore pll unlock irq! \n", __FUNCTION__, __LINE__);
		/* mask pll unlock irq */
		mutex_lock(&pdata->p_irq->irq_lock);
		hi6402_reg_set_bit(pdata->p_irq, HI6402_MASK_IRQ_REG_2, HI6402_MASK_PLL_UNLOCK_BIT);
		pdata->p_irq->mask2 |= 0x10;
		mutex_unlock(&pdata->p_irq->irq_lock);
	} else {
		pr_info("%s(%u): pll unlock irq! \n", __FUNCTION__, __LINE__);

		if (!dsm_client_ocuppy(dsm_audio_client)) {
			dsm_client_record(dsm_audio_client, "DSM_HI6402_PLL_UNLOCK\n");
			dsm_client_notify(dsm_audio_client, DSM_HI6402_PLL_UNLOCK);
		}

		for (i = PLL_UNLOCK_REG_START; i<= PLL_UNLOCK_REG_END; i++) {
			pr_err("%s(%u): %x is %x \n", __FUNCTION__, __LINE__, i, hi6402_irq_read(pdata->p_irq, i));
		}

		pdata->p_irq->pll_status = HI6402_PLL_RST;
		hi6402_irq_set_pll_mode(pdata->p_irq);
	}

	mutex_unlock(&pdata->p_irq->pll_mutex);

	return IRQ_HANDLED;
}
/* tp report err according to err type */
int cyttsp5_tp_report_dsm_err(struct device *dev, int type, int err_numb)
{
	tp_log_err("%s: entry! type:%d\n", __func__, type);

	if( NULL == tp_cyp_dclient ) {
		tp_log_err("%s: there is not tp_dclient!\n", __func__);
		return -1;
	}

	/* try to get permission to use the buffer */
	if(dsm_client_ocuppy(tp_cyp_dclient)) {
		/* buffer is busy */
		tp_log_err("%s: buffer is busy!\n", __func__);
		return -1;
	}

	/* tp report err according to err type */
	switch(type) {
		case DSM_TP_I2C_RW_ERROR_NO:
			/* report tp basic infomation */
			cyttsp5_dsm_record_basic_err_info(dev);
			/* report i2c infomation */
			cyttsp5_dsm_record_i2c_err_info(err_numb);
			break;
		case DSM_TP_FW_ERROR_NO:
			/* report tp basic infomation */
			cyttsp5_dsm_record_basic_err_info(dev);
			/* report fw infomation */
			cyttsp5_dsm_record_fw_err_info(err_numb);
			break;
		default:
			break;
	}
	dsm_client_notify(tp_cyp_dclient, type);

	return 0;
}
/* gsensor report err according to err type */
static ssize_t lis_gsensor_report_dsm_err(int type,bool auto_report_flag)
{
	int used_size = 0;
	struct lis3dh_acc_data  *acceld = (struct lis3dh_acc_data *)lis3dh_gs_dclient->driver_data;

	/* try to get permission to use the buffer */
	if (dsm_client_ocuppy(lis3dh_gs_dclient)) {
		/* buffer is busy */
		pr_err("[lis3dh_err]%s: buffer is busy!\n", __func__);
		return -EBUSY;
	}
	acceld->lis_gs_exception.excep_num = type;
	/* gsensor report err according to err type */
	switch (type) {
		case DSM_GS_I2C_ERROR:
			/* report i2c infomation */
			used_size = lis_gsensor_dsm_record_i2c_err_info(acceld);
			break;
		case DSM_GS_XYZ_0_ERROR:
		case DSM_GS_DATA_TIMES_NOTCHANGE_ERROR:
		case DSM_GS_DATA_ERROR:
			/* report gsensor basic infomation */
			used_size = lis_gsensor_dsm_record_basic_err_info(acceld, auto_report_flag);
			break;

		default:
			break;
	}
	/*if device is not probe successfully or client is null, don't notify dsm work func*/
	if (false == acceld->device_exist || lis3dh_gs_dclient == NULL) {
		return -ENODEV;
	}
	dsm_client_notify(lis3dh_gs_dclient, type);

	return used_size;
}
int mdss_record_dsm_err(u32 *dsi_status)
{
	if( NULL == lcd_dclient )
	{
		LCD_LOG_ERR("%s: there is no lcd_dclient!\n", __func__);
		return -1;
	}

	/* try to get permission to use the buffer */
	if(dsm_client_ocuppy(lcd_dclient))
	{
		/* buffer is busy */
		LCD_LOG_ERR("%s: buffer is busy!\n", __func__);
		return -1;
	}

	LCD_LOG_INFO("%s: entry!\n", __func__);
	if (dsi_status[0])
		dsm_client_record(lcd_dclient, "DSI_ACK_ERR_STATUS is wrong ,err number :%x\n", dsi_status[0]);

	if (dsi_status[1] & 0x0111)
		dsm_client_record(lcd_dclient, "DSI_TIMEOUT_STATUS is wrong ,err number :%x\n", dsi_status[1]);

	if (dsi_status[2] & 0x011111)
		dsm_client_record(lcd_dclient, "DSI_DLN0_PHY_ERR is wrong ,err number :%x\n", dsi_status[2]);

	if (dsi_status[3] & 0xcccc4489) 
		dsm_client_record(lcd_dclient, "DSI_FIFO_STATUS is wrong ,err number :%x\n", dsi_status[3]);

	if (dsi_status[4] & 0x80000000) 
		dsm_client_record(lcd_dclient, "DSI_STATUS is wrong ,err number :%x\n", dsi_status[4]);

	dsm_client_notify(lcd_dclient, DSM_LCD_MDSS_DSI_ISR_ERROR_NO);

	return 0;
}
int inputhub_mcu_send(const char *buf, unsigned long length)
{
    struct hisi_mbox_task *tx_task = NULL;
    mbox_msg_t *tx_buffer = NULL;
    mbox_msg_len_t len=0;
    int i = 0;
    int ret = -1;

    if(NULL==mbox)
        inputhub_mcu_connect();
    if(NULL==mbox)
        return ret;

    len = (length + sizeof(mbox_msg_t) - 1) / (sizeof(mbox_msg_t));
    //todo:send 256 bytes max one time, and repeat until buf was sent.
    tx_buffer = (mbox_msg_t *)kmalloc(sizeof(mbox_msg_t)*len, GFP_KERNEL);
    if (!tx_buffer)
        return ret;

    memcpy(tx_buffer, buf, length);
    pr_debug("inputhub_mcu_send------------->length = %d, len = %d\n", (int)length, (int)len);
    for (i = 0; i < len; i++)
        pr_debug("tx_buffer[%d] = 0x%x\n", i, tx_buffer[i]);

    tx_task = hisi_mbox_task_alloc(mbox,
                HISI_MAILBOX_RP_IOM3,
                tx_buffer,
                len,
                0,
                inputhub_mcu_send_complete,
                NULL);

    if (!tx_task) {
        kfree((void *)tx_buffer);
        return ret;
    }

    INIT_COMPLETION(send_complete);
    ret=hisi_mbox_msg_send_async(mbox,tx_task);
    if(ret)
    {
        hwlog_err("hisi_mbox_msg_send_async return %d.\n", ret);
        if (tx_task->tx_buffer)
            kfree((void *)tx_task->tx_buffer);
        tx_task->tx_buffer = NULL;
        hisi_mbox_task_free(&tx_task);
        return -1;
    }

    wait_for_completion(&send_complete);
    if ((-ETIMEOUT) == tx_task->tx_error) {
        hwlog_err("send failed timeout\n");
        if(!dsm_client_ocuppy(shb_dclient)){
            dsm_client_record(shb_dclient, "IOM3RSTSTAT: 0x%x\n", read_reg32(IOM3RSTSTAT_ADDR));
            dsm_client_record(shb_dclient, "PERRSTSTAT4: 0x%x\n", read_reg32(PERRSTSTAT4_ADDR));
            dsm_client_record(shb_dclient, "PERSTAT5: 0x%x\n", read_reg32(PERSTAT5_ADDR));
            dsm_client_record(shb_dclient, "IOM3CLKEN: 0x%x\n", read_reg32(IOM3CLKEN_ADDR));
            dsm_client_notify(shb_dclient, DSM_SHB_ERR_IPC_TIMEOUT);
        }
        ret = -1;
    }else{
        hwlog_debug("send success\n");
        ret = 0;
    }

    kfree((void *)tx_task->tx_buffer);
    tx_task->tx_buffer = NULL;
    hisi_mbox_task_free(&tx_task);
    return ret;
}
static long dsm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
    void __user *argp = (void __user *)arg;
    struct dsm_client *client = (struct dsm_client *)file->private_data;
    long ret = 0;
    int error = 0;
    char buff[CLIENT_NAME_LEN]= {0};
    struct dsm_extern_client tmp_ext_client;

    DSM_LOG_DEBUG("%s enter,\n",__func__);

    switch (cmd) {
    case DSM_IOCTL_GET_CLIENT_COUNT:
        mutex_lock(&g_dsm_server.mtx_lock);
        error = g_dsm_server.client_count;
        mutex_unlock(&g_dsm_server.mtx_lock);
        DSM_LOG_INFO("client count :%d\n", error);
        ret = copy_int_to_user(argp, error);
        break;
    case DSM_IOCTL_BIND:
        if (copy_from_user(buff, argp, CLIENT_NAME_LEN)) {
            DSM_LOG_ERR("copy from user failed\n");
            ret = -EFAULT;
        } else {
            DSM_LOG_DEBUG("try bind client %s\n", buff);
            client = dsm_find_client(buff);
            if(client) {
                dsm_bind_client(client);
                file->private_data = (void *)client;
            } else {
                ret = -ENXIO;
            }
        }
        break;
    case DSM_IOCTL_POLL_CLIENT_STATE:
        if(client && client->cops && client->cops->poll_state) {
            error = client->cops->poll_state();
            DSM_LOG_INFO("poll %s state result :%d\n", client->client_name, error);
            ret = copy_int_to_user(argp, error);
        }
        else {
            DSM_LOG_ERR("dsm client not bound or poll not support\n");
            ret = -ENXIO;
        }
        break;
    case DSM_IOCTL_FORCE_DUMP:
        if (copy_from_user(buff, argp, UINT_BUF_MAX)) {
            DSM_LOG_ERR("copy from user failed\n");
            ret = -EFAULT;
        } else {
            if(client && client->cops && client->cops->dump_func) {
                if(!dsm_client_ocuppy(client)) {
                    client->error_no = dsm_atoi(buff);
                    client->used_size = client->cops->dump_func(client->error_no,
                                        (void *)client->dump_buff, (int)client->buff_size);
                    set_bit(CBUFF_READY_BIT, &client->buff_flag);
                }
                else {
                    DSM_LOG_INFO("client %s's buff ocuppy failed\n", client->client_name);
                    ret = -EBUSY;
                }
            }
            else {
                DSM_LOG_ERR("dsm client not bound or dump not support\n");
                ret = -ENXIO;
            }
        }
        break;
    case DSM_IOCTL_GET_CLIENT_ERROR:
        if(client)
            ret = copy_int_to_user(argp, client->error_no);
        else {
            DSM_LOG_ERR("dsm find client failed\n");
            ret = -ENXIO;
        }
        break;
    case DSM_IOCTL_GET_DEVICE_NAME:
        if (client && client->device_name) {
            ret = copy_to_user(argp, client->device_name, DSM_MAX_DEVICE_NAME_LEN);
        } else {
            ret = -ENXIO;
        }
        break;
    case DSM_IOCTL_GET_IC_NAME:
        if (client && client->ic_name) {
            ret = copy_to_user(argp, client->ic_name, DSM_MAX_IC_NAME_LEN);
        } else {
            ret = -ENXIO;
        }
        break;
    case DSM_IOCTL_GET_MODULE_NAME:
        if (client && client->module_name) {
            ret = copy_to_user(argp, client->module_name, DSM_MAX_MODULE_NAME_LEN);
        } else {
            ret = -ENXIO;
        }
        break;
    case DSM_IOCTL_REGISTER_EXTERN_CLIENT:
        if (copy_from_user(&tmp_ext_client, (struct dsm_extern_client *)arg,
                           sizeof(struct dsm_extern_client))) {
            ret = -EFAULT;
        } else {
            dsm_register_extern_client(&tmp_ext_client);
        }
        break;
    default:
        DSM_LOG_ERR("unknown ioctl command :%d\n", cmd);
        ret = -EINVAL;
        break;
    }

    DSM_LOG_DEBUG("%s exit\n",__func__);
    return ret;
}
static ssize_t dsm_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
    char client_name[CLIENT_NAME_LEN]= {'\0'};
    int size, error_no = 0;
    struct dsm_client *client = NULL;
    char *buff = NULL;
    char *ptr = NULL;
#ifdef CONFIG_HUAWEI_SDCARD_VOLD
    char  err_string[20] = {0};
    int   err;
#endif
    DSM_LOG_DEBUG("%s enter\n",__func__);
    buff = (char *)kzalloc(count, GFP_KERNEL);
    if(!buff) {
        DSM_LOG_ERR("dsm write malloc failed\n");
        goto out;
    }

    if(copy_from_user(buff, buf, count)) {
        DSM_LOG_ERR("dsm write copy failed\n");
        goto out;
    }

    /*get client name*/
    ptr = dsm_strtok(buff, ",");
    if(ptr) {
        size = strlen(ptr);
        size = (size < CLIENT_NAME_LEN) ? size : (CLIENT_NAME_LEN - 1);
        memcpy(client_name, ptr, size);
    }
    /*get error no*/
    ptr = dsm_strtok(NULL, ",");
    if(ptr) {
        error_no = dsm_atoi(ptr);
    }

    /*get notify content*/
    ptr = dsm_strtok(NULL, NULL);
    DSM_LOG_INFO("client name - %s, error no - %d\n", client_name, error_no);
    if(ptr) {
        DSM_LOG_INFO("content - %s\n", ptr);
    }

    client = dsm_find_client(client_name);
#ifdef CONFIG_HUAWEI_SDCARD_VOLD
    if(client && !strncasecmp("sdcard_vold",client_name,size)&&(!dsm_client_ocuppy(client)))
    {
        DSM_LOG_DEBUG("dsm write find sdcard_vold\n");
        ptr++;
        while(*ptr) {
            if(*ptr == '\n')
                break;
            ptr++;
        }

        if(*ptr == '\n')
        {

            memcpy(err_string,ptr-SDCARD_ERR_LEN,SDCARD_ERR_LEN);
            err_string[SDCARD_ERR_LEN] = '\0';
            sscanf(err_string,"%d",&err);
            dsm_client_copy(client, ptr+1, (count - (ptr+1-buff)));
            dsm_client_notify(client, err);
        }

    }
    else if(client && (!dsm_client_ocuppy(client))) {
#else
    if(client && (!dsm_client_ocuppy(client))) {
#endif
        DSM_LOG_DEBUG("dsm write find client - %s\n", client_name);
        if(ptr)
            dsm_client_copy(client, ptr, strlen(ptr));
        dsm_client_notify(client, error_no);
    } else {
        DSM_LOG_INFO("dsm notify can't find client - %s\n", client_name);
    }

out:
    if(buff)
        kfree(buff);

    DSM_LOG_DEBUG("%s exit\n",__func__);
    return count;
}

static unsigned int dsm_poll(struct file *file, poll_table *wait)
{
    struct dsm_client *client = file->private_data;
    unsigned int mask = 0;

    DSM_LOG_DEBUG("%s enter\n",__func__);
    if(!client) {
        DSM_LOG_ERR("dsm can't poll without client\n");
        goto out;
    }
    DSM_LOG_DEBUG("client name :%s\n", client->client_name);
    poll_wait(file, &client->waitq, wait);
    if(test_bit(CBUFF_READY_BIT, &client->buff_flag))
        mask = POLLIN | POLLRDNORM;

out:
    DSM_LOG_DEBUG("%s exit, mask:%d\n",__func__, mask);
    return mask;
}

static int dsm_open(struct inode *inode, struct file *file)
{
    DSM_LOG_DEBUG("%s enter\n",__func__);
    file->private_data = NULL;
    DSM_LOG_DEBUG("%s exit\n",__func__);
    return 0;
}
static irqreturn_t hisi_powerkey_handler(int irq, void *data)
{
	struct hisi_powerkey_info *info = (struct hisi_powerkey_info *)data;

	wake_lock_timeout(&info->pwr_wake_lock, HZ);

	if (info->irq[0] == irq) {
			pr_info("[%s]response press interrupt!\n", __FUNCTION__);
			power_key_ps=true;

#if defined (CONFIG_HUAWEI_DSM)
			powerkey_press_count++;
                    if ((jiffies - powerkey_last_press_time) < msecs_to_jiffies(PRESS_KEY_INTERVAL)) {
                        if (!dsm_client_ocuppy(power_key_dclient)) {
                            dsm_client_record(power_key_dclient, "power key trigger on the abnormal style.\n");
                            dsm_client_notify(power_key_dclient, DSM_POWER_KEY_ERROR_NO);
                        }
                    }
                     powerkey_last_press_time = jiffies;
#endif
                    /* modify by songliangliang for dmd_log> */
			#if defined (CONFIG_FB_HI6220_CLCD)
			lcd_dcm_pwr_add_timer();
			#endif
			input_report_key(info->idev, KEY_POWER, POWER_KEY_PRESS);
			input_sync(info->idev);
	} else if (info->irq[1] == irq) {
			pr_info("[%s]response release interrupt!\n", __FUNCTION__);
			#if defined(CONFIG_HISILICON_PLATFORM_MAINTAIN)
                        #ifdef CONFIG_ARCH_HI6XXX
			if (check_himntn(HIMNTN_PRESS_KEY_TO_FASTBOOT)) {
				if ((VOL_UPDOWN_PRESS & gpio_key_vol_updown_press_get()) == VOL_UPDOWN_PRESS) {
					gpio_key_vol_updown_press_set_zero();
					if(is_gpio_key_vol_updown_pressed()) {
						systemError(0x25, EXCH_S_LOGDUMP, 0,0,0);
					}
				}
			}
			#elif defined(CONFIG_HISI_3635)
				if(is_fastboot_dumpmem_enable())
					if ((VOL_UPDOWN_PRESS & gpio_key_vol_updown_press_get()) == VOL_UPDOWN_PRESS) {
						gpio_key_vol_updown_press_set_zero();
						if(is_gpio_key_vol_updown_pressed()) {
							pr_info("[%s]Powerkey+VolUp_key+VolDn_key\n", __FUNCTION__);
							#ifdef CONFIG_HISI_REBOOT_TYPE
							set_watchdog_resetflag();
							#endif
							emergency_restart();
					}
				}
 			#endif
                        #endif
			input_report_key(info->idev, KEY_POWER, POWER_KEY_RELEASE);
			input_sync(info->idev);
	} else if (info->irq[2] == irq) {
			pr_info("[%s]response long press 1s interrupt!\n", __FUNCTION__);
			input_report_key(info->idev, KEY_POWER, POWER_KEY_PRESS);
			input_sync(info->idev);
	} else if (irq == info->irq[3]) {
		pr_info("[%s]response long press 8s interrupt!\n", __FUNCTION__);
	} else if (irq == info->irq[4]) {
		pr_info("[%s]response long press 10s interrupt!\n", __FUNCTION__);
	} else {
			pr_err("[%s]invalid irq %d!\n", __FUNCTION__, irq);
	}

	return IRQ_HANDLED;
}
static int tps65132_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
	int retval = 0;
	int nRet = 0;
	int vpos_target = 0;
	int vneg_target = 0;
	struct device_node *np = NULL;
	struct tps65132_device_info *di = NULL;

	np = of_find_compatible_node(NULL, NULL, DTS_COMP_TPS65132);
	if (!np) {
		pr_err("NOT FOUND device node %s!\n", DTS_COMP_TPS65132);
		retval = -ENODEV;
		goto failed_1;
	}

	gpio_vsp_enable = of_get_named_gpio(np, "gpios", 0);
	gpio_vsn_enable = of_get_named_gpio(np, "gpios", 1);

	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		pr_err("[%s,%d]: need I2C_FUNC_I2C\n",__FUNCTION__,__LINE__);
		retval = -ENODEV;
		goto failed_1;
	}

	di = kzalloc(sizeof(*di), GFP_KERNEL);
	if (!di) {
		dev_err(&client->dev, "failed to allocate device info data\n");
		retval = -ENOMEM;
		goto failed_1;
	}

	i2c_set_clientdata(client, di);
	di->dev = &client->dev;
	di->client = client;

	if (!fastboot_display_enable) {
		tps65132_start_setting();
	}

	tps65132_get_target_voltage(&vpos_target, &vneg_target);

	nRet = tps65132_reg_inited(di->client, (u8)vpos_target, (u8)vneg_target);
	if (nRet > 0) {
		pr_info("tps65132 inited needn't reset value\n");
	} else if (nRet < 0) {
		pr_err("tps65132 I2C read fail\n");
		retval = -ENODEV;
#if defined (CONFIG_HUAWEI_DSM)
		if (!dsm_client_ocuppy(lcd_dclient)) {
			dsm_client_record(lcd_dclient, "tps65132 I2C read fail\n");
			dsm_client_notify(lcd_dclient, DSM_LCD_POWER_STATUS_ERROR_NO);
		}
#endif
		goto failed_2;
	} else {
		nRet = tps65132_reg_init(di->client, (u8)vpos_target, (u8)vneg_target);
		if (nRet) {
			pr_err("tps65132_reg_init failed\n");
			retval = -ENODEV;
#if defined (CONFIG_HUAWEI_DSM)
			if (!dsm_client_ocuppy(lcd_dclient)) {
				dsm_client_record(lcd_dclient, "tps65132_reg_init failed\n");
				dsm_client_notify(lcd_dclient, DSM_LCD_POWER_STATUS_ERROR_NO);
			}
#endif
			goto failed_2;
		}
		pr_info("tps65132 inited succeed\n");
	}

	#ifdef CONFIG_HUAWEI_HW_DEV_DCT
		/* detect current device successful, set the flag as present */
		set_hw_dev_flag(DEV_I2C_DC_DC);
	#endif

failed_2:
	if (!fastboot_display_enable) {
		tps65132_finish_setting();
	}

	if (di)
		kfree(di);

failed_1:
	return retval;
}