static int pmic_fg_program_rdc_vals(struct pmic_fg_info *info)
{
	int ret;
	int rdc1, rdc0;
	u8 buf[2];

	ret = pmic_fg_reg_readmul(info, DC_FG_RDC1_REG, 2, buf);
	if (ret < 0) {
		dev_warn(&info->pdev->dev, "RDC reg read error\n");
		return ret;
	}

	if (buf[0] == info->cfg->rdc1 && buf[1] == info->cfg->rdc0) {
		dev_dbg(&info->pdev->dev, "RDC is already initialized\n");
		return 0;
	} else {
		dev_dbg(&info->pdev->dev, "RDC need to be initialized\n");
	}

	ret = pmic_fg_reg_writeb(info, DC_FG_RDC1_REG, info->cfg->rdc1);
	ret = pmic_fg_reg_writeb(info, DC_FG_RDC0_REG, info->cfg->rdc0);
	ret = pmic_fg_reg_clearb(info, DC_FG_TUNING_CNTL4, (1<<3));
	ret = pmic_fg_reg_setb(info, DC_FG_TUNING_CNTL4, (1<<4));

	return ret;
}
static int pmic_fg_program_rdc_vals(struct pmic_fg_info *info)
{
	int ret;
	int rdc1, rdc0;


       rdc1 = pmic_fg_reg_readb(info, DC_FG_RDC1_REG);
       if (rdc1 < 0) {
				dev_warn(&info->pdev->dev, "RDC1 reg read err!!\n");
				return ret;
       }
       rdc0 = pmic_fg_reg_readb(info, DC_FG_RDC1_REG);

       if (rdc1 == info->cfg->rdc1 && rdc0 == info->cfg->rdc0) {
				dev_info(&info->pdev->dev, "RDC is already initialized\n");
				return 0;
       } else {
				dev_info(&info->pdev->dev, "RDC need to be initialized\n");
       }

       ret = pmic_fg_reg_writeb(info, DC_FG_RDC1_REG, info->cfg->rdc1);

	ret = pmic_fg_reg_writeb(info, DC_FG_RDC0_REG, info->cfg->rdc0);


	ret = pmic_fg_reg_clearb(info, DC_FG_TUNING_CNTL4, (1<<3));
	ret = pmic_fg_reg_setb(info, DC_FG_TUNING_CNTL4, (1<<4));

	return ret;
}
static int pmic_fg_program_design_cap(struct pmic_fg_info *info)
{
	int ret;
	int cap1, cap0;
	u8 buf[2];

	ret = pmic_fg_reg_readmul(info, DC_FG_DES_CAP1_REG, 2, buf);
	if (ret < 0) {
		dev_warn(&info->pdev->dev, "CAP reg read error\n");
		return ret;
	}

	if (buf[0] == info->cfg->cap1 && buf[1] == info->cfg->cap0) {
		dev_dbg(&info->pdev->dev, "design cap is already initialized\n");
		return 0;
	} else {
		dev_dbg(&info->pdev->dev, "design cap need to be initialized\n");
	}

	//Disable coulomb meter
	ret = pmic_fg_reg_clearb(info, DC_FG_CNTL_REG, FG_CNTL_CC_EN);
	ret = pmic_fg_reg_writeb(info, DC_FG_DES_CAP1_REG, info->cfg->cap1);
	ret = pmic_fg_reg_writeb(info, DC_FG_DES_CAP0_REG, info->cfg->cap0);
	ret = pmic_fg_reg_setb(info, DC_FG_CNTL_REG, FG_CNTL_CC_EN);

	return 0;
}
static int pmic_fg_program_design_cap(struct pmic_fg_info *info)
{
	int ret;
	int cap1, cap0;
/*
	ret = pmic_fg_reg_writeb(info, DC_FG_DES_CAP1_REG, info->pdata->cap1);
	if (ret < 0)
		goto fg_prog_descap_fail;
*/
       cap1 = pmic_fg_reg_readb(info, DC_FG_DES_CAP1_REG);
       if (cap1 < 0) {
				dev_warn(&info->pdev->dev, "CAP1 reg read err!!\n");
				return ret;
      }
       cap0 = pmic_fg_reg_readb(info, DC_FG_DES_CAP0_REG);

       if (cap1 == info->cfg->cap1 && cap0 == info->cfg->cap0) {
				dev_info(&info->pdev->dev, "FG data is already initialized\n");
				return 0;
       } else {
				dev_info(&info->pdev->dev, "FG data need to be initialized\n");
       }

       /*Disable coulomb meter*/
       ret = pmic_fg_reg_clearb(info, DC_FG_CNTL_REG, FG_CNTL_CC_EN);

       ret = pmic_fg_reg_writeb(info, DC_FG_DES_CAP1_REG, info->cfg->cap1);


		ret = pmic_fg_reg_writeb(info, DC_FG_DES_CAP0_REG, info->cfg->cap0);

	ret = pmic_fg_reg_setb(info, DC_FG_CNTL_REG, FG_CNTL_CC_EN);

	return 0;
}