static int max98504_regulator_config(struct i2c_client *i2c, bool pullup, bool on)
{
	int rc;
    #define VCC_I2C_MIN_UV	1800000
    #define VCC_I2C_MAX_UV	1800000
	#define I2C_LOAD_UA		300000

	//pr_info("[RYAN] %s\n", __func__);

	if (pullup) {
		//pr_info("[RYAN] %s I2C PULL UP.\n", __func__);

		max98504_vcc_i2c = regulator_get(&i2c->dev, "vcc_i2c");
		if (IS_ERR(max98504_vcc_i2c)) {
			rc = PTR_ERR(max98504_vcc_i2c);
			pr_info("Regulator get failed rc=%d\n",	rc);
			goto error_get_vtg_i2c;
		}
		if (regulator_count_voltages(max98504_vcc_i2c) > 0) {
			rc = regulator_set_voltage(max98504_vcc_i2c,
				VCC_I2C_MIN_UV, VCC_I2C_MAX_UV);
			if (rc) {
				pr_info("regulator set_vtg failed rc=%d\n", rc);
				goto error_set_vtg_i2c;
			}
		}

		rc = reg_set_optimum_mode_check(max98504_vcc_i2c, I2C_LOAD_UA);
		if (rc < 0) {
			pr_info("Regulator vcc_i2c set_opt failed rc=%d\n", rc);
			goto error_reg_opt_i2c;
		}
		
		rc = regulator_enable(max98504_vcc_i2c);
		if (rc) {
			pr_info("Regulator vcc_i2c enable failed rc=%d\n", rc);
			goto error_reg_en_vcc_i2c;
		}

	}
	//pr_info("[RYAN] %s OUT\n", __func__);

	return 0;

error_reg_en_vcc_i2c:
	if(pullup) reg_set_optimum_mode_check(max98504_vcc_i2c, 0);
error_reg_opt_i2c:
	regulator_disable(max98504_vcc_i2c);
error_set_vtg_i2c:
	if (regulator_count_voltages(max98504_vcc_i2c) > 0)
		regulator_set_voltage(max98504_vcc_i2c, 0,
			VCC_I2C_MAX_UV);
error_get_vtg_i2c:
	regulator_put(max98504_vcc_i2c);

	//pr_info("[RYAN] %s OUT WITH ERROR.\n", __func__);


	return rc;
}
static int max98506_regulator_config(struct device *dev)
{
	struct regulator *max98506_vcc_i2c;
	int ret;

	max98506_vcc_i2c = regulator_get(dev, "vcc_i2c");
	if (IS_ERR(max98506_vcc_i2c)) {
		ret = PTR_ERR(max98506_vcc_i2c);
		dev_err(dev, "%s: regulator get failed ret=%d\n",
				__func__, ret);
		goto err_get_vtg_i2c;
	}
	if (regulator_count_voltages(max98506_vcc_i2c) > 0) {
		ret = regulator_set_voltage(max98506_vcc_i2c,
				VCC_I2C_MIN_UV, VCC_I2C_MAX_UV);
		if (ret) {
			dev_err(dev, "%s: regulator set_vtg failed ret=%d\n",
					__func__, ret);
			goto err_set_vtg_i2c;
		}
	}

	ret = reg_set_optimum_mode_check(max98506_vcc_i2c, I2C_LOAD_UA);
	if (ret < 0) {
		dev_err(dev, "%s: regulator vcc_i2c set_opt failed ret=%d\n",
				__func__, ret);
		goto err_reg_opt_i2c;
	}

	ret = regulator_enable(max98506_vcc_i2c);
	if (ret) {
		dev_err(dev, "%s: regulator vcc_i2c enable failed ret=%d\n",
				__func__, ret);
		goto err_reg_en_vcc_i2c;
	}

	msg_maxim("min_uv:%d max_uv:%d load_ua:%d",
		VCC_I2C_MIN_UV, VCC_I2C_MAX_UV, I2C_LOAD_UA);

	return 0;

err_set_vtg_i2c:
	regulator_put(max98506_vcc_i2c);

err_get_vtg_i2c:
	if (regulator_count_voltages(max98506_vcc_i2c) > 0)
		regulator_set_voltage(max98506_vcc_i2c, 0, VCC_I2C_MAX_UV);

err_reg_en_vcc_i2c:
	reg_set_optimum_mode_check(max98506_vcc_i2c, 0);

err_reg_opt_i2c:
	regulator_disable(max98506_vcc_i2c);

	return ret;
}
static int max98504_regulator_config(struct i2c_client *i2c,
	bool pullup, bool on)
{
	struct regulator *max98504_vcc_i2c;
	int rc;
	#define VCC_I2C_MIN_UV 1800000
	#define VCC_I2C_MAX_UV 1800000
	#define I2C_LOAD_UA 300000

	msg_maxim("pullup=%d\n", pullup);

	if (pullup) {
		max98504_vcc_i2c = regulator_get(&i2c->dev, "vcc_i2c");

		if (IS_ERR(max98504_vcc_i2c)) {
			rc = PTR_ERR(max98504_vcc_i2c);
			pr_err("Regulator get failed rc=%d\n",	rc);
			return rc;
		}

		if (regulator_count_voltages(max98504_vcc_i2c) > 0) {
			rc = regulator_set_voltage(max98504_vcc_i2c,
				VCC_I2C_MIN_UV, VCC_I2C_MAX_UV);
			if (rc) {
				pr_err("regulator set_vtg failed rc=%d\n", rc);
				goto error_set_vtg_i2c;
			}
		}

		rc = reg_set_optimum_mode_check(max98504_vcc_i2c, I2C_LOAD_UA);
		if (rc < 0) {
			pr_err("Regulator vcc_i2c set_opt failed rc=%d\n", rc);
			goto error_reg_opt_i2c;
		}

		rc = regulator_enable(max98504_vcc_i2c);
		if (rc) {
			pr_err("Regulator vcc_i2c enable failed rc=%d\n", rc);
			goto error_reg_en_vcc_i2c;
		}
	}

	return 0;

error_reg_en_vcc_i2c:
	if (pullup)
		reg_set_optimum_mode_check(max98504_vcc_i2c, 0);
error_reg_opt_i2c:
	regulator_disable(max98504_vcc_i2c);
error_set_vtg_i2c:
	regulator_put(max98504_vcc_i2c);

	return rc;
}
Ejemplo n.º 4
0
static int drv2667_vreg_on(struct drv2667_data *data, bool on)
{
	int rc = 0;

	if (!on)
		goto vreg_off;

	rc = reg_set_optimum_mode_check(data->vdd, DRV2667_VTG_CURR_UA);
	if (rc < 0) {
		dev_err(&data->client->dev,
			"Regulator vdd set_opt failed rc=%d\n", rc);
		return rc;
	}

	rc = regulator_enable(data->vdd);
	if (rc < 0) {
		dev_err(&data->client->dev, "enable vdd failed\n");
		return rc;
	}

	rc = reg_set_optimum_mode_check(data->vdd_i2c, DRV2667_I2C_CURR_UA);
	if (rc < 0) {
		dev_err(&data->client->dev,
			"Regulator vdd_i2c set_opt failed rc=%d\n", rc);
		return rc;
	}

	rc = regulator_enable(data->vdd_i2c);
	if (rc < 0) {
		dev_err(&data->client->dev, "enable vdd_i2c failed\n");
		goto disable_vdd;
	}

	return rc;
vreg_off:
	regulator_disable(data->vdd_i2c);
disable_vdd:
	regulator_disable(data->vdd);
	return rc;
}
static int cw_bat_power_on(struct cw_battery *cw_bat,
					bool on) {
	int retval;

	if (on == false)
		goto power_off;

	retval = reg_set_optimum_mode_check(cw_bat->vcc_i2c, CW_VIO_LOAD_MAX_UA);
	if (retval < 0) {
		dev_err(&cw_bat->client->dev,
			"%s Regulator vcc_i2c set_opt failed rc=%d\n", __func__,
			retval);
		goto power_off;
	}

	retval = regulator_enable(cw_bat->vcc_i2c);
	if (retval) {
		dev_err(&cw_bat->client->dev,
			"%s Regulator vcc_i2c enable failed rc=%d\n", __func__,
			retval);
		goto error_reg_en_vcc_i2c;
	}

	msleep(200);
	return 0;

error_reg_en_vcc_i2c:
	reg_set_optimum_mode_check(cw_bat->vcc_i2c, 0);
	return retval;

power_off:
	reg_set_optimum_mode_check(cw_bat->vcc_i2c, 0);
	regulator_disable(cw_bat->vcc_i2c);

	msleep(100);
	return 0;
}
static void cypress_power_onoff(struct cypress_touchkey_info *info, int onoff)
{
	int ret = 0, rc = 0;

	dev_info(&info->client->dev, "%s: power %s\n",
			__func__, onoff ? "on" : "off");

	if (!info->vcc_en) {
		if (info->pdata->i2c_pull_up) {
			info->vcc_en = regulator_get(&info->client->dev,
				"vcc_en");
			if (IS_ERR(info->vcc_en)) {
				rc = PTR_ERR(info->vcc_en);
				dev_info(&info->client->dev,
					"Regulator(vcc_en) get failed rc=%d\n", rc);
				goto error_get_vtg_i2c;
			}
			if (regulator_count_voltages(info->vcc_en) > 0) {
				rc = regulator_set_voltage(info->vcc_en,
				1800000, 1800000);
				if (rc) {
					dev_info(&info->client->dev,
					"regulator(vcc_en) set_vtg failed rc=%d\n",
					rc);
					goto error_set_vtg_i2c;
				}
			}
		}
	}
	if (info->pdata->vdd_led < 0) {
		if (!info->vdd_led) {
			info->vdd_led = regulator_get(&info->client->dev,
				"vdd_led");
			if (IS_ERR(info->vdd_led)) {
				rc = PTR_ERR(info->vdd_led);
				dev_info(&info->client->dev,
					"Regulator(vdd_led) get failed rc=%d\n", rc);
				goto error_get_vtg_i2c;
			}
#if 0
			if (regulator_count_voltages(info->vdd_led) > 0) {
				rc = regulator_set_voltage(info->vdd_led,
				3300000, 3300000);
				if (rc) {
					dev_info(&info->client->dev,
					"regulator(vdd_led) set_vtg failed rc=%d\n",
					rc);
					goto error_set_vtg_i2c;
				}
			}
#endif
		}
	}
	if (onoff) {
		if (info->pdata->i2c_pull_up) {
			rc = reg_set_optimum_mode_check(info->vcc_en,
						10000);
			if (rc < 0) {
				dev_info(&info->client->dev,
				"Regulator vcc_en set_opt failed rc=%d\n",
				rc);
				goto error_reg_opt_i2c;
			}

			rc = regulator_enable(info->vcc_en);
			if (rc) {
				dev_info(&info->client->dev,
				"Regulator vcc_en enable failed rc=%d\n",
				rc);
				goto error_reg_en_vcc_en;
			}
			if (info->pdata->vdd_led < 0) {
				rc = reg_set_optimum_mode_check(info->vdd_led,
							10000);
				if (rc < 0) {
					dev_info(&info->client->dev,
					"Regulator vdd_led set_opt failed rc=%d\n",
					rc);
					goto error_reg_opt_i2c;
				}

				rc = regulator_enable(info->vdd_led);
				if (rc) {
					dev_info(&info->client->dev,
					"Regulator vdd_led enable failed rc=%d\n",
					rc);
					goto error_reg_en_vcc_en;
				}
			}
		}
	} else {
		if (info->pdata->i2c_pull_up) {
			reg_set_optimum_mode_check(info->vcc_en, 0);
			regulator_disable(info->vcc_en);
			if (info->pdata->vdd_led < 0) {
				reg_set_optimum_mode_check(info->vdd_led, 0);
				regulator_disable(info->vdd_led);
			}
		}
	}
	/*msleep(50);*/

	if (info->pdata->vdd_led > 0) {
		ret = gpio_direction_output(info->pdata->vdd_led, onoff);
		if (ret) {
			dev_info(&info->client->dev,
					"[TKEY]%s: unable to set_direction for vdd_led [%d]\n",
					__func__, info->pdata->vdd_led);
		}
		/*msleep(30);*/
	}
	return;

error_reg_en_vcc_en:
	if (info->pdata->i2c_pull_up) {
		reg_set_optimum_mode_check(info->vcc_en, 0);
		if (info->pdata->vdd_led < 0)
			reg_set_optimum_mode_check(info->vdd_led, 0);
	}
error_reg_opt_i2c:
error_set_vtg_i2c:
	regulator_put(info->vcc_en);
	if (info->pdata->vdd_led < 0)
		regulator_put(info->vdd_led);
error_get_vtg_i2c:
	return;
}
void melfas_power_onoff(struct melfas_touchkey_platform_data *pdata, int onoff)
{
	int rc = 0;

	dev_info(&pdata->client->dev, "%s: power %s\n",
			__func__, onoff ? "on" : "off");

	if (!pdata->vcc_en) {
		//if (info->pdata->i2c_pull_up) {
			pdata->vcc_en = regulator_get(&pdata->client->dev,
				"vcc_en");
			if (IS_ERR(pdata->vcc_en)) {
				rc = PTR_ERR(pdata->vcc_en);
				dev_info(&pdata->client->dev,
					"Regulator(vcc_en) get failed rc=%d\n", rc);
				goto error_get_vtg_i2c;
			}
			if (regulator_count_voltages(pdata->vcc_en) > 0) {
				rc = regulator_set_voltage(pdata->vcc_en,
				1800000, 1800000);
				if (rc) {
					dev_info(&pdata->client->dev,
					"regulator(vcc_en) set_vtg failed rc=%d\n",
					rc);
					goto error_set_vtg_i2c;
				}
			}
		//}
	}
	if (onoff) {
		//if (info->pdata->i2c_pull_up) {
			rc = reg_set_optimum_mode_check(pdata->vcc_en,
						10000);
			if (rc < 0) {
				dev_info(&pdata->client->dev,
				"Regulator vcc_en set_opt failed rc=%d\n",
				rc);
				goto error_reg_opt_i2c;
			}

			rc = regulator_enable(pdata->vcc_en);
			if (rc) {
				dev_info(&pdata->client->dev,
				"Regulator vcc_en enable failed rc=%d\n",
				rc);
				goto error_reg_en_vcc_en;
			}
		//}
	} else {
		//if (pdata->pdata->i2c_pull_up) {
			reg_set_optimum_mode_check(pdata->vcc_en, 0);
			regulator_disable(pdata->vcc_en);
		//}
	}
	msleep(50);


	return;

error_reg_en_vcc_en:
	//if (pdata->pdata->i2c_pull_up) {
		reg_set_optimum_mode_check(pdata->vcc_en, 0);
	//}
error_reg_opt_i2c:
error_set_vtg_i2c:
	regulator_put(pdata->vcc_en);
error_get_vtg_i2c:
	return;
}
void cypress_power_onoff(struct cypress_touchkey_info *info, int onoff)
{
	int ret = 0, rc = 0;

	dev_info(&info->client->dev, "%s: power %s\n",
			__func__, onoff ? "on" : "off");

	if (info->pdata->vdd_led < 0) {
		if (!info->vdd_led) {
			info->vdd_led = regulator_get(&info->client->dev,
				"vdd_led");
			if (IS_ERR(info->vdd_led)) {
				rc = PTR_ERR(info->vdd_led);
				dev_info(&info->client->dev,
					"Regulator(vdd_led) get failed rc=%d\n", rc);
				goto error_get_vtg_i2c;
			}
		}
	}
	if (onoff) {
		if (info->pdata->i2c_pull_up) {
			if (info->pdata->vdd_led < 0) {
				rc = reg_set_optimum_mode_check(info->vdd_led,
							10000);
				if (rc < 0) {
					dev_info(&info->client->dev,
					"Regulator vdd_led set_opt failed rc=%d\n",
					rc);
					goto error_reg_opt_i2c;
				}

				rc = regulator_enable(info->vdd_led);
				if (rc) {
					dev_info(&info->client->dev,
					"Regulator vdd_led enable failed rc=%d\n",
					rc);
					goto error_reg_en_vcc_en;
				}
			}
		}
	} else {
		if (info->pdata->i2c_pull_up) {
			if (info->pdata->vdd_led < 0) {
				reg_set_optimum_mode_check(info->vdd_led, 0);
				regulator_disable(info->vdd_led);
			}
		}
	}
	//msleep(50);

	ret = gpio_direction_output(info->pdata->vdd_en, onoff);
	if (ret) {
		pr_err("[TKEY]%s: unable to set_direction for mms_vdd_en [%d]\n",
				__func__, info->pdata->vdd_en);
	}

	if (info->pdata->vdd_led > 0) {
		ret = gpio_direction_output(info->pdata->vdd_led, onoff);
		if (ret) {
			dev_info(&info->client->dev,
					"[TKEY]%s: unable to set_direction for vdd_led [%d]\n",
					__func__, info->pdata->vdd_led);
		}
		//msleep(30);
	}
	return;

error_reg_en_vcc_en:
	if (info->pdata->i2c_pull_up) {
//		reg_set_optimum_mode_check(info->vcc_en, 0);
		if (info->pdata->vdd_led < 0) 
			reg_set_optimum_mode_check(info->vdd_led, 0);
	}
error_reg_opt_i2c:
//error_set_vtg_i2c:
//	regulator_put(info->vcc_en);
	if (info->pdata->vdd_led < 0) 
		regulator_put(info->vdd_led);
error_get_vtg_i2c:
	return;
}
Ejemplo n.º 9
0
static int cyttsp_power_on(struct device *dev)
{
	int rc;
    static struct regulator *vcc_ana;
    static struct regulator *vcc_i2c;

	vcc_ana = regulator_get(dev, "vdd_ana");
	if (IS_ERR(vcc_ana))
    {
		rc = PTR_ERR(vcc_ana);
		dev_err(dev, "Regulator get failed vcc_ana rc=%d\n", rc);
		return rc;
	}

	if (regulator_count_voltages(vcc_ana) > 0)
    {
		rc = regulator_set_voltage(vcc_ana, 2850000, 2850000);
		if (rc)
        {
			dev_err(dev, "Regulator set ana vtg failed rc=%d\n", rc);
			goto error_set_vtg_vcc_ana;
		}
	}
    
    rc = reg_set_optimum_mode_check(vcc_ana, 15000);
    if (rc < 0)
    {
        dev_err(dev, "Regulator vcc_ana set_opt failed rc=%d\n", rc);
        return rc;
    }
    
    rc = regulator_enable(vcc_ana);
    if (rc)
    {
        dev_err(dev, "Regulator vcc_ana enable failed rc=%d\n", rc);
        goto error_reg_en_vcc_ana;
    }
    
	vcc_i2c = regulator_get(dev, "vcc_i2c");
	if (IS_ERR(vcc_i2c))
    {
		rc = PTR_ERR(vcc_i2c);
		dev_err(dev, "Regulator get failed rc=%d\n", rc);
		goto error_reg_opt_vcc_dig;
	}
/*    
	if (regulator_count_voltages(vcc_i2c) > 0)
    {
 		rc = regulator_set_voltage(vcc_i2c, 1800000, 1800000);
		if (rc)
        {
			dev_err(dev, "Regulator set i2c vtg failed rc=%d\n", rc);
			goto error_set_vtg_i2c;
		}
	}
    
    rc = reg_set_optimum_mode_check(vcc_i2c, 10000);
    if (rc < 0)
    {
        dev_err(dev, "Regulator vcc_i2c set_opt failed rc=%d\n", rc);
        goto error_set_vtg_i2c;
    }
*/
    rc = regulator_enable(vcc_i2c);
    if (rc)
    {
        dev_err(dev, "Regulator vcc_i2c enable failed rc=%d\n", rc);
        goto error_reg_en_vcc_i2c;
    }

    msleep(100);
    
    return 0;

error_reg_en_vcc_i2c:
    reg_set_optimum_mode_check(vcc_i2c, 0);
//error_set_vtg_i2c:
//    regulator_put(vcc_i2c);
error_reg_opt_vcc_dig:
    regulator_disable(vcc_ana);
error_reg_en_vcc_ana:
    reg_set_optimum_mode_check(vcc_ana, 0);
error_set_vtg_vcc_ana:
	regulator_put(vcc_ana);
	return rc;
}
Ejemplo n.º 10
0
static int ist30xx_ldo_power_on(struct ist30xx_data *ts, bool on)
{
        int retval;

        if (on == true) {
                tsp_debug("ist30xx_ldo_power_on : On \n");
        } else {
                tsp_debug("ist30xx_ldo_power_on : Off \n");
        }

        if (on == false)
                goto power_off;

        retval = reg_set_optimum_mode_check(ts->vdd, 100000);
        if (retval < 0) {
                tsp_debug("Regulator vdd set opt failed retval = %d \n", retval);
                return retval;
        }

        retval = regulator_enable(ts->vdd);
        if (retval < 0) {
                tsp_debug("Regulator vdd enable failed retval = %d \n", retval);
                goto err_reg_en_vdd;
        }

        if (ts->pdata->i2c_pull_up) {
                retval = reg_set_optimum_mode_check(ts->vcc_i2c, 100000);
                if (retval < 0) {
                        tsp_debug("Regulator vcc_i2c set opt failed retval = %d \n", retval);
                        goto err_reg_opt_i2c;
                }

                retval = regulator_enable(ts->vcc_i2c);
                if (retval < 0) {
                        tsp_debug("Regulator vcc_i2c enable failed retval = %d \n", retval);
                        goto err_reg_en_vcc_i2c;
                }
        }

        tsp_debug("ist30xx_ldo_power_on On Done \n");
        return 0;

err_reg_en_vcc_i2c:
        reg_set_optimum_mode_check(ts->vdd, 0);
err_reg_opt_i2c:
        regulator_disable(ts->vdd);
err_reg_en_vdd:
        reg_set_optimum_mode_check(ts->vdd, 0);

        tsp_debug("ist30xx_ldo_power_on err \n");

        return retval;

power_off:
        reg_set_optimum_mode_check(ts->vdd, 0);
        regulator_disable(ts->vdd);

        if (ts->pdata->i2c_pull_up) {
                reg_set_optimum_mode_check(ts->vcc_i2c, 0);
                regulator_disable(ts->vcc_i2c);
        }

        tsp_debug("ist30xx_ldo_power_on : Off Done \n");

        return 0;
}
Ejemplo n.º 11
0
static int bu21150_power_enable(struct bu21150_data *ts, bool on)
{
	int rc = 0;

	if (!on)
		goto power_disable;

	if (regulator_count_voltages(ts->vcc_ana) > 0) {
		rc = regulator_set_voltage(ts->vcc_ana,
			BU21150_MIN_VOLTAGE_UV, BU21150_MAX_VOLTAGE_UV);
		if (rc) {
			dev_err(&ts->client->dev,
				"regulator vcc_ana set_vtg failed rc=%d\n", rc);
			return rc;
		}
	}

	rc = reg_set_optimum_mode_check(ts->vcc_ana,
						BU21150_MAX_OPS_LOAD_UA);
	if (rc < 0) {
		dev_err(&ts->client->dev,
			"Regulator vcc_ana set_opt failed rc=%d\n", rc);
		goto err_set_vcc_ana_opt_mode;
	}

	rc = regulator_enable(ts->vcc_ana);
	if (rc) {
		dev_err(&ts->client->dev,
			"Regulator vcc_ana enable failed rc=%d\n", rc);
		goto err_enable_vcc_ana;
	}

	if (regulator_count_voltages(ts->vcc_dig) > 0) {
		rc = regulator_set_voltage(ts->vcc_dig,
						BU21150_VDD_DIG_VOLTAGE_UV,
						BU21150_VDD_DIG_VOLTAGE_UV);
		if (rc) {
			dev_err(&ts->client->dev,
				"regulator vcc_dig set_vtg failed rc=%d\n", rc);
			goto err_set_vcc_dig_voltage;
		}
	}

	rc = reg_set_optimum_mode_check(ts->vcc_dig,
						BU21150_MAX_OPS_LOAD_UA);
	if (rc < 0) {
		dev_err(&ts->client->dev,
			"Regulator vcc_dig set_opt failed rc=%d\n", rc);
		goto err_set_vcc_dig_opt_mode;
	}

	rc = regulator_enable(ts->vcc_dig);
	if (rc) {
		dev_err(&ts->client->dev,
			"Regulator vcc_dig enable failed rc=%d\n", rc);
		goto err_enable_vcc_dig;
	}

	return 0;

power_disable:
	regulator_disable(ts->vcc_dig);
err_enable_vcc_dig:
	reg_set_optimum_mode_check(ts->vcc_dig, 0);
err_set_vcc_dig_opt_mode:
	if (regulator_count_voltages(ts->vcc_dig) > 0)
		regulator_set_voltage(ts->vcc_dig, 0,
					BU21150_VDD_DIG_VOLTAGE_UV);
err_set_vcc_dig_voltage:
	regulator_disable(ts->vcc_ana);
err_enable_vcc_ana:
	reg_set_optimum_mode_check(ts->vcc_ana, 0);
err_set_vcc_ana_opt_mode:
	if (regulator_count_voltages(ts->vcc_ana) > 0)
		regulator_set_voltage(ts->vcc_ana, 0, BU21150_MAX_VOLTAGE_UV);

	return rc;
}