当前位置: 首页>>代码示例>>C++>>正文


C++ regulator_set_voltage函数代码示例

本文整理汇总了C++中regulator_set_voltage函数的典型用法代码示例。如果您正苦于以下问题:C++ regulator_set_voltage函数的具体用法?C++ regulator_set_voltage怎么用?C++ regulator_set_voltage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了regulator_set_voltage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mdss_dsi_regulator_init

static int mdss_dsi_regulator_init(struct platform_device *pdev)
{
	int ret = 0;
	struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;
	struct dsi_drv_cm_data *dsi_drv = NULL;
#ifdef CONFIG_MACH_LGE
	struct device_node *node = pdev->dev.of_node;
#endif

	if (!pdev) {
		pr_err("%s: invalid input\n", __func__);
		return -EINVAL;
	}

	ctrl_pdata = platform_get_drvdata(pdev);
	if (!ctrl_pdata) {
		pr_err("%s: invalid driver data\n", __func__);
		return -EINVAL;
	}

	dsi_drv = &(ctrl_pdata->shared_pdata);
	if (ctrl_pdata->power_data.num_vreg > 0) {
		ret = msm_dss_config_vreg(&pdev->dev,
				ctrl_pdata->power_data.vreg_config,
				ctrl_pdata->power_data.num_vreg, 1);
	} else {
#ifdef CONFIG_MACH_LGE
		/* if "lge,mdss-dsi-use-vdd-supply" property is not exist, we
		 * assume that it is used in board. if don't want vdd-supply,
		 * please use "lge,mdss-dsi-use-vdd-supply=<0>" in your dtsi.
		 */
		ret = of_property_read_u32(node, "lge,mdss-dsi-use-vdd-supply",
				&mdss_dsi_use_vdd_supply);
		if (ret == -EINVAL)
			mdss_dsi_use_vdd_supply = 1;

		if (mdss_dsi_use_vdd_supply) {
			dsi_drv->vdd_vreg = devm_regulator_get(&pdev->dev, "vdd");
			if (IS_ERR(dsi_drv->vdd_vreg)) {
				pr_err("%s: could not get vdd vreg, rc = %ld\n",
						__func__, PTR_ERR(dsi_drv->vdd_vreg));
				return -ENODEV;
			}

			ret = regulator_set_voltage(dsi_drv->vdd_vreg, 3000000,
					3000000);
			if (ret) {
				pr_err("%s: set voltage failed on vdd vreg, rc=%d\n",
						__func__, ret);
				return -EINVAL;
			}
		}
#else
		dsi_drv->vdd_vreg = devm_regulator_get(&pdev->dev, "vdd");
		if (IS_ERR(dsi_drv->vdd_vreg)) {
			pr_err("%s: could not get vdda vreg, rc=%ld\n",
				__func__, PTR_ERR(dsi_drv->vdd_vreg));
			return PTR_ERR(dsi_drv->vdd_vreg);
		}

		ret = regulator_set_voltage(dsi_drv->vdd_vreg, 3000000,
				3000000);
		if (ret) {
			pr_err("%s: set voltage failed on vdda vreg, rc=%d\n",
				__func__, ret);
			return ret;
		}
#endif
		dsi_drv->vdd_io_vreg = devm_regulator_get(&pdev->dev, "vddio");
		if (IS_ERR(dsi_drv->vdd_io_vreg)) {
			pr_err("%s: could not get vddio reg, rc=%ld\n",
				__func__, PTR_ERR(dsi_drv->vdd_io_vreg));
			return PTR_ERR(dsi_drv->vdd_io_vreg);
		}

		ret = regulator_set_voltage(dsi_drv->vdd_io_vreg, 1800000,
				1800000);
		if (ret) {
			pr_err("%s: set voltage failed on vddio vreg, rc=%d\n",
				__func__, ret);
			return ret;
		}

		dsi_drv->vdda_vreg = devm_regulator_get(&pdev->dev, "vdda");
		if (IS_ERR(dsi_drv->vdda_vreg)) {
			pr_err("%s: could not get vdda vreg, rc=%ld\n",
				__func__, PTR_ERR(dsi_drv->vdda_vreg));
			return PTR_ERR(dsi_drv->vdda_vreg);
		}

		ret = regulator_set_voltage(dsi_drv->vdda_vreg, 1200000,
				1200000);
		if (ret) {
			pr_err("%s: set voltage failed on vdda vreg, rc=%d\n",
				__func__, ret);
			return ret;
		}
	}

	return 0;
//.........这里部分代码省略.........
开发者ID:AbdulrahmanAmir,项目名称:Dorimanx-LG-G2-D802-Kernel,代码行数:101,代码来源:mdss_dsi.c

示例2: mipi_dsi_panel_power

static int mipi_dsi_panel_power(int on)
{
	static struct regulator *reg_lvs5, *reg_l2;
	static int gpio36, gpio37;
	int rc;

	pr_debug("%s: on=%d\n", __func__, on);

	if (!dsi_power_on) {
		reg_lvs5 = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi1_vddio");
		if (IS_ERR_OR_NULL(reg_lvs5)) {
			pr_err("could not get 8921_lvs5, rc = %ld\n",
				PTR_ERR(reg_lvs5));
			return -ENODEV;
		}

		reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi1_pll_vdda");
		if (IS_ERR_OR_NULL(reg_l2)) {
			pr_err("could not get 8921_l2, rc = %ld\n",
				PTR_ERR(reg_l2));
			return -ENODEV;
		}

		rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
		if (rc) {
			pr_err("set_voltage l2 failed, rc=%d\n", rc);
			return -EINVAL;
		}

		gpio36 = PM8921_GPIO_PM_TO_SYS(V_LCM_N5V_EN); 
		rc = gpio_request(gpio36, "lcd_5v-");
		if (rc) {
			pr_err("request lcd_5v- failed, rc=%d\n", rc);
			return -ENODEV;
		}
		gpio37 = PM8921_GPIO_PM_TO_SYS(V_LCM_P5V_EN); 
		rc = gpio_request(gpio37, "lcd_5v+");
		if (rc) {
			pr_err("request lcd_5v+ failed, rc=%d\n", rc);
			return -ENODEV;
		}
		gpio_tlmm_config(GPIO_CFG(LCD_RST, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);

		dsi_power_on = true;
	}

	if (on) {
		if (!first_init) {
			rc = regulator_enable(reg_lvs5);
			if (rc) {
				pr_err("enable lvs5 failed, rc=%d\n", rc);
				return -ENODEV;
			}
			msleep(200);

			gpio_set_value_cansleep(gpio37, 1);
			msleep(10);
			gpio_set_value_cansleep(gpio36, 1);

			rc = regulator_set_optimum_mode(reg_l2, 100000);
			if (rc < 0) {
				pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
				return -EINVAL;
			}
			rc = regulator_enable(reg_l2);
			if (rc) {
				pr_err("enable l2 failed, rc=%d\n", rc);
				return -ENODEV;
			}
			
			msm_xo_mode_vote(wa_xo, MSM_XO_MODE_ON);

			gpio_set_value(LCD_RST, 0);
			msleep(10);
			gpio_set_value(LCD_RST, 1);
			
			msm_xo_mode_vote(wa_xo, MSM_XO_MODE_OFF);
		} else {
			
			rc = regulator_enable(reg_lvs5);
			if (rc) {
				pr_err("enable lvs5 failed, rc=%d\n", rc);
				return -ENODEV;
			}
			rc = regulator_set_optimum_mode(reg_l2, 100000);
			if (rc < 0) {
				pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
				return -EINVAL;
			}
			rc = regulator_enable(reg_l2);
			if (rc) {
				pr_err("enable l2 failed, rc=%d\n", rc);
				return -ENODEV;
			}
			
			msm_xo_mode_vote(wa_xo, MSM_XO_MODE_ON);
			msleep(10);
			msm_xo_mode_vote(wa_xo, MSM_XO_MODE_OFF);
//.........这里部分代码省略.........
开发者ID:BackupWildfireDEV,项目名称:ElementalX-Sense-5.0.2,代码行数:101,代码来源:board-monarudo-display.c

示例3: lvds_panel_power

static int lvds_panel_power(int on)
{
	static struct regulator *reg_lvs7, *reg_l2, *reg_ext_3p3v;
	static int gpio36, gpio26, mpp3;
	int rc;

	pr_debug("%s: on=%d\n", __func__, on);

	if (!lvds_power_on) {
		reg_lvs7 = regulator_get(&msm_lvds_device.dev,
				"lvds_vdda");
		if (IS_ERR_OR_NULL(reg_lvs7)) {
			pr_err("could not get 8921_lvs7, rc = %ld\n",
				PTR_ERR(reg_lvs7));
			return -ENODEV;
		}

		reg_l2 = regulator_get(&msm_lvds_device.dev,
				"lvds_pll_vdda");
		if (IS_ERR_OR_NULL(reg_l2)) {
			pr_err("could not get 8921_l2, rc = %ld\n",
				PTR_ERR(reg_l2));
			return -ENODEV;
		}

		rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
		if (rc) {
			pr_err("set_voltage l2 failed, rc=%d\n", rc);
			return -EINVAL;
		}

		reg_ext_3p3v = regulator_get(&msm_lvds_device.dev,
			"lvds_vccs_3p3v");
		if (IS_ERR_OR_NULL(reg_ext_3p3v)) {
			pr_err("could not get reg_ext_3p3v, rc = %ld\n",
			       PTR_ERR(reg_ext_3p3v));
		    return -ENODEV;
		}

		gpio26 = PM8921_GPIO_PM_TO_SYS(26);
		rc = gpio_request(gpio26, "pwm_backlight_ctrl");
		if (rc) {
			pr_err("request gpio 26 failed, rc=%d\n", rc);
			return -ENODEV;
		}

		gpio36 = PM8921_GPIO_PM_TO_SYS(36); /* lcd1_pwr_en_n */
		rc = gpio_request(gpio36, "lcd1_pwr_en_n");
		if (rc) {
			pr_err("request gpio 36 failed, rc=%d\n", rc);
			return -ENODEV;
		}

		mpp3 = PM8921_MPP_PM_TO_SYS(3);
		rc = gpio_request(mpp3, "backlight_en");
		if (rc) {
			pr_err("request mpp3 failed, rc=%d\n", rc);
			return -ENODEV;
		}

		lvds_power_on = true;
	}

	if (on) {
		rc = regulator_enable(reg_lvs7);
		if (rc) {
			pr_err("enable lvs7 failed, rc=%d\n", rc);
			return -ENODEV;
		}

		rc = regulator_set_optimum_mode(reg_l2, 100000);
		if (rc < 0) {
			pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
			return -EINVAL;
		}
		rc = regulator_enable(reg_l2);
		if (rc) {
			pr_err("enable l2 failed, rc=%d\n", rc);
			return -ENODEV;
		}

		rc = regulator_enable(reg_ext_3p3v);
		if (rc) {
			pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
			return -ENODEV;
		}

		gpio_set_value_cansleep(gpio36, 0);
		gpio_set_value_cansleep(mpp3, 1);
		if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
			gpio_set_value_cansleep(gpio26, 1);
	} else {
		if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
			gpio_set_value_cansleep(gpio26, 0);
		gpio_set_value_cansleep(mpp3, 0);
		gpio_set_value_cansleep(gpio36, 1);

		rc = regulator_disable(reg_lvs7);
		if (rc) {
			pr_err("disable reg_lvs7 failed, rc=%d\n", rc);
//.........这里部分代码省略.........
开发者ID:albert2lyu,项目名称:lge-kernel-msm7x27-3.4,代码行数:101,代码来源:board-8064-display.c

示例4: devm_kzalloc

struct q6v5_data *pil_q6v5_init(struct platform_device *pdev)
{
	struct q6v5_data *drv;
	struct resource *res;
	struct pil_desc *desc;
	int ret;

	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
	if (!drv)
		return ERR_PTR(-ENOMEM);

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qdsp6_base");
	drv->reg_base = devm_request_and_ioremap(&pdev->dev, res);
	if (!drv->reg_base)
		return ERR_PTR(-ENOMEM);

	desc = &drv->desc;
	ret = of_property_read_string(pdev->dev.of_node, "qcom,firmware-name",
				      &desc->name);
	if (ret)
		return ERR_PTR(ret);

	desc->dev = &pdev->dev;

	drv->qdsp6v5_2_0 = of_device_is_compatible(pdev->dev.of_node,
						   "qcom,pil-femto-modem");

	if (drv->qdsp6v5_2_0)
		return drv;

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "halt_base");
	drv->axi_halt_base = devm_ioremap(&pdev->dev, res->start,
					  resource_size(res));
	if (!drv->axi_halt_base)
		return ERR_PTR(-ENOMEM);

	drv->qdsp6v55 = of_device_is_compatible(pdev->dev.of_node,
						"qcom,pil-q6v55-mss");
	drv->qdsp6v55 |= of_device_is_compatible(pdev->dev.of_node,
						"qcom,pil-q6v55-lpass");
	drv->qdsp6v56 = of_device_is_compatible(pdev->dev.of_node,
						"qcom,pil-q6v56-mss");

	drv->non_elf_image = of_property_read_bool(pdev->dev.of_node,
						"qcom,mba-image-is-not-elf");

	drv->xo = devm_clk_get(&pdev->dev, "xo");
	if (IS_ERR(drv->xo))
		return ERR_CAST(drv->xo);

	drv->vreg_cx = devm_regulator_get(&pdev->dev, "vdd_cx");
	if (IS_ERR(drv->vreg_cx))
		return ERR_CAST(drv->vreg_cx);

	drv->vreg_pll = devm_regulator_get(&pdev->dev, "vdd_pll");
	if (!IS_ERR_OR_NULL(drv->vreg_pll)) {
		int voltage;
		ret = of_property_read_u32(pdev->dev.of_node, "qcom,vdd_pll",
					   &voltage);
		if (ret) {
			dev_err(&pdev->dev, "Failed to find vdd_pll voltage.\n");
			return ERR_PTR(ret);
		}

		ret = regulator_set_voltage(drv->vreg_pll, voltage, voltage);
		if (ret) {
			dev_err(&pdev->dev, "Failed to request vdd_pll voltage.\n");
			return ERR_PTR(ret);
		}

		ret = regulator_set_optimum_mode(drv->vreg_pll, 10000);
		if (ret < 0) {
			dev_err(&pdev->dev, "Failed to set vdd_pll mode.\n");
			return ERR_PTR(ret);
		}
	} else {
		 drv->vreg_pll = NULL;
	}

	return drv;
}
开发者ID:rbheromax,项目名称:android_kernel_lge_dory,代码行数:81,代码来源:pil-q6v5.c

示例5: mipi_dsi_panel_power

static int mipi_dsi_panel_power(int on)
{
	int rc = 0, retVal = 0;
	static struct regulator *reg_vdd, *reg_iovdd, *reg_vdd_mipi;
	static bool dsi_power_on = false;
	unsigned int phaseid = 0;

	pr_info("[DISPLAY] +%s(%d)\n", __func__, on);

	if (!dsi_power_on) {

		/* INIT VDD_MIPI */
		reg_vdd_mipi = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi_vdda");
		if (IS_ERR(reg_vdd_mipi)) {
			pr_err("[DISPLAY]could not get reg_vdd_mipi, rc = %ld\n",
				PTR_ERR(reg_vdd_mipi));
			retVal = -ENODEV;
			goto error;
		}
		rc = regulator_set_voltage(reg_vdd_mipi, 1200000, 1200000);
		if (rc) {
			pr_err("[DISPLAY]set_voltage VDD_MIPI failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}

		/* INIT VDD FOR LCD*/
		reg_vdd = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi_vdc");
		if (IS_ERR(reg_vdd)) {
			pr_err("[DISPLAY]could not get reg_vdd, rc = %ld\n",
				PTR_ERR(reg_vdd));
			retVal = -ENODEV;
			goto error;
		}

		rc = regulator_set_voltage(reg_vdd, 2800000, 2800000);
		if (rc) {
			pr_err("[DISPLAY]set_voltage reg_vdd failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}

		/* INIT IOVDD FOR LCD*/
		phaseid = fih_get_product_phase();
		if(phaseid == PHASE_EVM ){
		pr_info("[DISPLAY]Get L18\n");
			reg_iovdd = regulator_get(&msm_mipi_dsi1_device.dev,
				"lcd_iovdd");
		}else{
			pr_info("[DISPLAY]Get LVS2\n");
			reg_iovdd = regulator_get(&msm_mipi_dsi1_device.dev,
				"lcd_lvs2");
		}
		if (IS_ERR(reg_iovdd)) {
			pr_err("[DISPLAY]could not get reg_iovdd, rc = %ld\n",
				PTR_ERR(reg_iovdd));
			retVal = -ENODEV;
			goto error;
		}

		if(phaseid == PHASE_EVM ){
			rc = regulator_set_voltage(reg_iovdd, 1800000, 1800000);
			if (rc) {
				pr_err("[DISPLAY]set_voltage reg_iovdd failed, rc=%d\n", rc);
				rc = -ENODEV;
				goto error;
			}
		}

		dsi_power_on = true;
	}

	if (on) {
		rc = regulator_set_optimum_mode(reg_vdd_mipi, 100000);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode VDD_MIPI failed, rc=%d\n", rc);
			retVal =  -EINVAL;
			goto error;
		}
		rc = regulator_set_optimum_mode(reg_vdd, 100000);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode reg_vdd failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}
		rc = regulator_set_optimum_mode(reg_iovdd, 100000);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode reg_iovdd failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}
		rc = regulator_enable(reg_vdd_mipi);
		if (rc) {
			pr_err("[DISPLAY]enable VDD_MIPI failed, rc=%d\n", rc);
			retVal = -ENODEV;
			goto error;
		}
		rc = regulator_enable(reg_iovdd);
//.........这里部分代码省略.........
开发者ID:NoelMacwan,项目名称:SXDNickiCM11-OLD,代码行数:101,代码来源:board-8930-display.c

示例6: mipi_dsi_panel_power

static int mipi_dsi_panel_power(int on)
{
	static struct regulator *v_lcm, *v_lcmio, *v_dsivdd;
	static bool bPanelPowerOn = false;
	int rc;

	char *lcm_str = "8921_l11";
	char *lcmio_str = "8921_lvs5";
	char *dsivdd_str = "8921_l2";

	
	if (panel_type == PANEL_ID_NONE)
		return -ENODEV;

	PR_DISP_INFO("%s: state : %d\n", __func__, on);

	if (!dsi_power_on) {

		v_lcm = regulator_get(&msm_mipi_dsi1_device.dev,
				lcm_str);
		if (IS_ERR(v_lcm)) {
			PR_DISP_ERR("could not get %s, rc = %ld\n",
				lcm_str, PTR_ERR(v_lcm));
			return -ENODEV;
		}

		v_lcmio = regulator_get(&msm_mipi_dsi1_device.dev,
				lcmio_str);
		if (IS_ERR(v_lcmio)) {
			PR_DISP_ERR("could not get %s, rc = %ld\n",
				lcmio_str, PTR_ERR(v_lcmio));
			return -ENODEV;
		}


		v_dsivdd = regulator_get(&msm_mipi_dsi1_device.dev,
				dsivdd_str);
		if (IS_ERR(v_dsivdd)) {
			PR_DISP_ERR("could not get %s, rc = %ld\n",
				dsivdd_str, PTR_ERR(v_dsivdd));
			return -ENODEV;
		}

		rc = regulator_set_voltage(v_lcm, 3000000, 3000000);
		if (rc) {
			PR_DISP_ERR("%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, lcm_str, rc);
			return -EINVAL;
		}

		rc = regulator_set_voltage(v_dsivdd, 1200000, 1200000);
		if (rc) {
			PR_DISP_ERR("%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, dsivdd_str, rc);
			return -EINVAL;
		}

		rc = gpio_request(VILLE_GPIO_LCD_RSTz, "LCM_RST_N");
		if (rc) {
			PR_DISP_ERR("%s:LCM gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_LCD_RSTz, rc);
			return -EINVAL;
		}

		dsi_power_on = true;
	}

	if (on) {
		PR_DISP_INFO("%s: on\n", __func__);
		rc = regulator_set_optimum_mode(v_lcm, 100000);
		if (rc < 0) {
			PR_DISP_ERR("set_optimum_mode %s failed, rc=%d\n", lcm_str, rc);
			return -EINVAL;
		}

		rc = regulator_set_optimum_mode(v_dsivdd, 100000);
		if (rc < 0) {
			PR_DISP_ERR("set_optimum_mode %s failed, rc=%d\n", dsivdd_str, rc);
			return -EINVAL;
		}

		rc = regulator_enable(v_dsivdd);
		if (rc) {
			PR_DISP_ERR("enable regulator %s failed, rc=%d\n", dsivdd_str, rc);
			return -ENODEV;
		}
		hr_msleep(1);
		rc = regulator_enable(v_lcmio);
		if (rc) {
			PR_DISP_ERR("enable regulator %s failed, rc=%d\n", lcmio_str, rc);
			return -ENODEV;
		}

		rc = regulator_enable(v_lcm);
		if (rc) {
			PR_DISP_ERR("enable regulator %s failed, rc=%d\n", lcm_str, rc);
			return -ENODEV;
		}

		if (!mipi_lcd_on) {
			hr_msleep(10);
			gpio_set_value(VILLE_GPIO_LCD_RSTz, 1);
			hr_msleep(1);
//.........这里部分代码省略.........
开发者ID:vvadyck,项目名称:ville-4.2.2-sense5-evitaul_porting,代码行数:101,代码来源:board-ville-panel.c

示例7: sr030pc30_power

static int sr030pc30_power(struct device *dev, int flag)
{
#ifdef CONFIG_LEDS_RT8547
	static struct regulator *vcamera_vbuck5;   // 5M CORE : 1.2V

	if (!vcamera_vbuck5) {
		vcamera_vbuck5 = regulator_get(dev, "v_cam_c");
		if (IS_ERR(vcamera_vbuck5)) {
			vcamera_vbuck5 = NULL;
			pr_err(KERN_ERR "Enable vcamera_vbuck5 failed!\n");
			return -EIO;
		}
	}
#endif	
	if (flag) {
		switch_i2c_gpio_mfp(I2C_PIN);
		
		Cam_Printk("---sr030pc30_power power ON ----------\n");

		/* Sensor AVDD : 2.8V ON */
		gpio_direction_output(CAM_AVDD, 1);	

		udelay(50);

		/* Sensor IO : 1.8V ON */
		gpio_direction_output(CAM_IO, 1);	
		
		/* 5M Core : 1.2V ON */
#ifdef CONFIG_LEDS_RT8547
		regulator_set_voltage(vcamera_vbuck5, 1200000, 1200000);
		regulator_enable(vcamera_vbuck5);	
#elif CONFIG_FLED_RT5033		
		gpio_direction_output(CAM_CORE, 1);	
#endif
		
		/*  5M Core : 1.2V OFF  */
		msleep(5);
#ifdef CONFIG_LEDS_RT8547
		regulator_disable(vcamera_vbuck5);		
#elif CONFIG_FLED_RT5033
		gpio_direction_output(CAM_CORE, 0);	
#endif

		msleep(1);

		/* VT STBY Enable */
		gpio_direction_output(Sub_EN, 1);	

		/* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */
		pxa_ccic_enable_mclk(samsung_camera.pcdev, V4L2_MBUS_PARALLEL);

		msleep(1);		

		/* VT Rest Enable */
		gpio_direction_output(Sub_RST, 0);
		msleep(5);
		gpio_direction_output(Sub_RST, 1);	
		
		msleep(40);	
		/*for s5k power off maybe pull down the i2c data pin, so we have to reset i2c controller */
		samsung_camera.i2c_pxa_reset(samsung_camera.i2c);
		
	}else {
		Cam_Printk("---sr030pc30_power power OFF ----------\n");

		/* VT Rest Disable */
		gpio_direction_output(Sub_RST, 0);

		/* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */
		msleep(5);
		pxa_ccic_disable_mclk(samsung_camera.pcdev, V4L2_MBUS_PARALLEL);

		msleep(5);

		/* VT STBY Disable */
		gpio_direction_output(Sub_EN, 0);	
		
		/* Sensor IO : 1.8V OFF */
		gpio_direction_output(CAM_IO, 0);	

		/* Sensor AVDD : 2.8V OFF */
		gpio_direction_output(CAM_AVDD, 0);	


		switch_i2c_gpio_mfp(GPIO_PIN);
	}

	return 0;
}
开发者ID:C457,项目名称:android_kernel_samsung_t110,代码行数:89,代码来源:samsung_camera_golden.c

示例8: s5k43_power

static int s5k43_power(struct device *dev, int flag)
{
	static int initialized = FALSE; // for checking is  probe state	
#ifdef CONFIG_LEDS_RT8547
	static struct regulator *vcamera_vbuck5;   // 5M CORE : 1.2V

	if (!vcamera_vbuck5) {
		vcamera_vbuck5 = regulator_get(dev, "v_cam_c");
		if (IS_ERR(vcamera_vbuck5)) {
			vcamera_vbuck5 = NULL;
			pr_err(KERN_ERR "Enable vcamera_vbuck5 failed!\n");
			return -EIO;
		}
	}
#endif

	if (flag) {
		switch_i2c_gpio_mfp(I2C_PIN);
		
		Cam_Printk("---camera power ON ----------\n");
		/* Sensor AVDD : 2.8V ON */
		gpio_direction_output(CAM_AVDD, 1);	
		
		msleep(1);

		/* Sensor IO : 1.8V ON */
		gpio_direction_output(CAM_IO, 1);	
		/* AF : 2.8V ON */
		gpio_direction_output(CAM_AF, 1);	

		msleep(1);

		/* VT STBY Enable */
		gpio_direction_output(Sub_EN, 1);	
		
		/* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */
		pxa_ccic_enable_mclk(samsung_camera.pcdev, V4L2_MBUS_CSI2);	

		/* VT Rest Enable */
		gpio_direction_output(Sub_RST, 0);
		msleep(5);
		gpio_direction_output(Sub_RST, 1);	
		
		msleep(2);

		/* VT STBY Disable */
		gpio_direction_output(Sub_EN, 0);	

		/* 5M Core : 1.2V ON */
#ifdef CONFIG_LEDS_RT8547
		regulator_set_voltage(vcamera_vbuck5, 1200000, 1200000);
		regulator_enable(vcamera_vbuck5);	
#else		
		gpio_direction_output(CAM_CORE, 1);	
#endif
		msleep(1);		

		/* 5M STBY Enable */
		gpio_direction_output(Main_STBY, 1);

		/* 5M Reset Enable*/		
		gpio_direction_output(Main_RST, 0);	
		msleep(2);
		gpio_direction_output(Main_RST, 1);	

		msleep(5);		
		/*for s5k power off maybe pull down the i2c data pin, so we have to reset i2c controller */
		samsung_camera.i2c_pxa_reset(samsung_camera.i2c);
		
	}else {
		Cam_Printk("---camera power OFF ----------\n");

		if((initialized==TRUE)&&(rear_camera==FALSE))
			camera_flash_on_off(POWER_OFF);  // Flash Off
		
		/* 5M Reset Disable*/		
		gpio_direction_output(Main_RST, 0);	
		msleep(1);
		
		/* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */
		msleep(5);
		pxa_ccic_disable_mclk(samsung_camera.pcdev, V4L2_MBUS_CSI2);
		
		/* 5M STBY Disable */
		gpio_direction_output(Main_STBY, 0);	

		/* VT Rest Disable */
		gpio_direction_output(Sub_RST, 0);
		
		/*  5M Core : 1.2V OFF  */
#ifdef CONFIG_LEDS_RT8547
		regulator_disable(vcamera_vbuck5);		
#else
		gpio_direction_output(CAM_CORE, 0);	
#endif
		/* Sensor IO : 1.8V OFF */
		gpio_direction_output(CAM_IO, 0);	

		/* Sensor AVDD : 2.8V OFF */
		gpio_direction_output(CAM_AVDD, 0);	
//.........这里部分代码省略.........
开发者ID:C457,项目名称:android_kernel_samsung_t110,代码行数:101,代码来源:samsung_camera_golden.c

示例9: msm_camera_vreg_enable

static void msm_camera_vreg_enable(void)
{
#if 0	
	ldo15 = regulator_get(NULL, "8058_l15");
	if (IS_ERR(ldo15)) {
		pr_err("%s: VREG LDO15 get failed\n", __func__);
		ldo15 = NULL;
		return;
	}
	if (regulator_set_voltage(ldo15, 2850000, 2850000)) {
		pr_err("%s: VREG LDO15 set voltage failed\n",  __func__);
		goto ldo15_disable;
	}
	if (regulator_enable(ldo15)) {
		pr_err("%s: VREG LDO15 enable failed\n", __func__);
		goto ldo15_put;
	}

	lvs0 = regulator_get(NULL, "8058_lvs0");
	if (IS_ERR(lvs0)) {
		pr_err("%s: VREG LVS0 get failed\n", __func__);
		lvs0 = NULL;
		goto ldo15_disable;
	}
	if (regulator_enable(lvs0)) {
		pr_err("%s: VREG LVS0 enable failed\n", __func__);
		goto lvs0_put;
	}

	ldo25 = regulator_get(NULL, "8058_l25");
	if (IS_ERR(ldo25)) {
		pr_err("%s: VREG LDO25 get failed\n", __func__);
		ldo25 = NULL;
		goto lvs0_disable;
	}
	if (regulator_set_voltage(ldo25, 1200000, 1200000)) {
		pr_err("%s: VREG LDO25 set voltage failed\n",  __func__);
		goto ldo25_disable;
	}
	if (regulator_enable(ldo25)) {
		pr_err("%s: VREG LDO25 enable failed\n", __func__);
		goto ldo25_put;
	}
#endif
#ifdef F_SKYCAM_ICP_HD
	s2b12 = regulator_get(NULL, "8901_s2");
	if (IS_ERR(s2b12)) {
		CDBG("%s: VREG s2b12 get failed\n", __func__);
		s2b12 = NULL;
		return;
	}
	if (regulator_set_voltage(s2b12, 1300000, 1300000)) {
		CDBG("%s: VREG s2b12 set voltage failed\n",  __func__);
		regulator_disable(s2b12);
	}
	if (regulator_enable(s2b12)) {
		CDBG("%s: VREG s2b12 enable failed\n", __func__);
		regulator_put(s2b12);	
	}

	lvs3b18 = regulator_get(NULL, "8901_lvs3");
	if (IS_ERR(lvs3b18)) {
		CDBG("%s: VREG lvs3b18 get failed\n", __func__);
		lvs3b18 = NULL;
		return;
	}
	if (regulator_enable(lvs3b18)) {
		CDBG("%s: VREG lvs3b18 enable failed\n", __func__);
		regulator_disable(lvs3b18);
	}
	mvs0b18 = regulator_get(NULL, "8901_mvs0");
	if (IS_ERR(mvs0b18)) {
		CDBG("%s: VREG mvs0b18 get failed\n", __func__);
		mvs0b18 = NULL;
		return;
	}
	if (regulator_enable(mvs0b18)) {
		CDBG("%s: VREG mvs0b18 enable failed\n", __func__);
		regulator_disable(mvs0b18);
	}
	l2b28 = regulator_get(NULL, "8901_l2");
	if (IS_ERR(l2b28)) {
		CDBG("%s: VREG l2b28 get failed\n", __func__);
		l2b28 = NULL;
		return;
	}
	if (regulator_set_voltage(l2b28, 2800000, 2800000)) {
		CDBG("%s: VREG s2b12 set voltage failed\n",  __func__);
		regulator_disable(l2b28);
	}
	if (regulator_enable(l2b28)) {
		CDBG("%s: VREG s2b12 enable failed\n", __func__);
		regulator_put(l2b28);	
	}
	l3b28 = regulator_get(NULL, "8901_l3");
	if (IS_ERR(l3b28)) {
		CDBG("%s: VREG l3b28 get failed\n", __func__);
		l3b28 = NULL;
		return;
	}
//.........这里部分代码省略.........
开发者ID:Kernel-Saram,项目名称:CLUSTER_Kernel_VR,代码行数:101,代码来源:msm_io_8x60.c

示例10: mipi_dsi_cdp_panel_power

static int mipi_dsi_cdp_panel_power(int on)
{
	static struct regulator *reg_l8, *reg_l23, *reg_l2;
	/* Control backlight GPIO (24) directly when using PM8917 */
	int gpio24 = PM8917_GPIO_PM_TO_SYS(24);
	int rc;

	pr_debug("%s: state : %d\n", __func__, on);

	if (!dsi_power_on) {

		reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi_vdc");
		if (IS_ERR(reg_l8)) {
			pr_err("could not get 8038_l8, rc = %ld\n",
				PTR_ERR(reg_l8));
			return -ENODEV;
		}
		reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi_vddio");
		if (IS_ERR(reg_l23)) {
			pr_err("could not get 8038_l23, rc = %ld\n",
				PTR_ERR(reg_l23));
			return -ENODEV;
		}
		reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi_vdda");
		if (IS_ERR(reg_l2)) {
			pr_err("could not get 8038_l2, rc = %ld\n",
				PTR_ERR(reg_l2));
			return -ENODEV;
		}
		rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
		if (rc) {
			pr_err("set_voltage l8 failed, rc=%d\n", rc);
			return -EINVAL;
		}
		rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
		if (rc) {
			pr_err("set_voltage l23 failed, rc=%d\n", rc);
			return -EINVAL;
		}
		rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
		if (rc) {
			pr_err("set_voltage l2 failed, rc=%d\n", rc);
			return -EINVAL;
		}
		rc = gpio_request(DISP_RST_GPIO, "disp_rst_n");
		if (rc) {
			pr_err("request gpio DISP_RST_GPIO failed, rc=%d\n",
				rc);
			gpio_free(DISP_RST_GPIO);
			return -ENODEV;
		}
		if (machine_is_msm8930_evt()) {
			rc = gpio_direction_output(DISP_RST_GPIO, 1);
			if (rc) {
				pr_err("gpio_direction_output failed for %d gpio rc=%d\n",
						DISP_RST_GPIO, rc);
				return -ENODEV;
			}
		}

		if (!machine_is_msm8930_evt()) {
			rc = gpio_request(DISP_3D_2D_MODE, "disp_3d_2d");
			if (rc) {
				pr_err("request gpio DISP_3D_2D_MODE failed, rc=%d\n",
				 rc);
				gpio_free(DISP_3D_2D_MODE);
				return -ENODEV;
			}
			rc = gpio_direction_output(DISP_3D_2D_MODE, 0);
			if (rc) {
				pr_err("gpio_direction_output failed for %d gpio rc=%d\n",
						DISP_3D_2D_MODE, rc);
				return -ENODEV;
			}
		}
		if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) {
			rc = gpio_request(gpio24, "disp_bl");
			if (rc) {
				pr_err("request for gpio 24 failed, rc=%d\n",
					rc);
				return -ENODEV;
			}
			gpio_set_value_cansleep(gpio24, 0);
			novatek_pdata.gpio_set_backlight =
				pm8917_gpio_set_backlight;
		}
		dsi_power_on = true;
	}

	if (on) {
		rc = regulator_set_optimum_mode(reg_l8, 100000);
		if (rc < 0) {
			pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
			return -EINVAL;
		}
		rc = regulator_set_optimum_mode(reg_l23, 100000);
		if (rc < 0) {
//.........这里部分代码省略.........
开发者ID:NoelMacwan,项目名称:xperia-c2005,代码行数:101,代码来源:board-8930-display.c

示例11: hdmi_core_power

static int hdmi_core_power(int on, int show)
{
	static struct regulator *reg_8921_l23, *reg_8921_s4;
	static int prev_on;
	int rc;

	if (on == prev_on)
		return 0;

	/* TBD: PM8921 regulator instead of 8901 */
	if (!reg_8921_l23) {
		reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
		if (IS_ERR(reg_8921_l23)) {
			pr_err("could not get reg_8921_l23, rc = %ld\n",
				PTR_ERR(reg_8921_l23));
			return -ENODEV;
		}
		rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
		if (rc) {
			pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
			return -EINVAL;
		}
	}
	if (!reg_8921_s4) {
		reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
		if (IS_ERR(reg_8921_s4)) {
			pr_err("could not get reg_8921_s4, rc = %ld\n",
				PTR_ERR(reg_8921_s4));
			return -ENODEV;
		}
		rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
		if (rc) {
			pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
			return -EINVAL;
		}
	}

	if (on) {
		rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
		if (rc < 0) {
			pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
			return -EINVAL;
		}
		rc = regulator_enable(reg_8921_l23);
		if (rc) {
			pr_err("'%s' regulator enable failed, rc=%d\n",
				"hdmi_avdd", rc);
			return rc;
		}
		rc = regulator_enable(reg_8921_s4);
		if (rc) {
			pr_err("'%s' regulator enable failed, rc=%d\n",
				"hdmi_vcc", rc);
			return rc;
		}
		pr_debug("%s(on): success\n", __func__);
	} else {
		rc = regulator_disable(reg_8921_l23);
		if (rc) {
			pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
			return -ENODEV;
		}
		rc = regulator_disable(reg_8921_s4);
		if (rc) {
			pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
			return -ENODEV;
		}
		rc = regulator_set_optimum_mode(reg_8921_l23, 100);
		if (rc < 0) {
			pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
			return -EINVAL;
		}
		pr_debug("%s(off): success\n", __func__);
	}

	prev_on = on;

	return 0;
}
开发者ID:ZigZiggo,项目名称:sam-tenderloin-kernel-3.4,代码行数:79,代码来源:board-8960-display.c

示例12: mipi_dsi_panel_pwm_cfg

static void mipi_dsi_panel_pwm_cfg(void)
{
	int rc;
	static int mipi_dsi_panel_gpio_configured;
	static struct pm_gpio pwm_enable = {
		.direction        = PM_GPIO_DIR_OUT,
		.output_buffer    = PM_GPIO_OUT_BUF_CMOS,
		.output_value     = 1,
		.pull             = PM_GPIO_PULL_NO,
		.vin_sel          = PM_GPIO_VIN_VPH,
		.out_strength     = PM_GPIO_STRENGTH_HIGH,
		.function         = PM_GPIO_FUNC_NORMAL,
		.inv_int_pol      = 0,
		.disable_pin      = 0,
	};
	static struct pm_gpio pwm_mode = {
		.direction        = PM_GPIO_DIR_OUT,
		.output_buffer    = PM_GPIO_OUT_BUF_CMOS,
		.output_value     = 0,
		.pull             = PM_GPIO_PULL_NO,
		.vin_sel          = PM_GPIO_VIN_S4,
		.out_strength     = PM_GPIO_STRENGTH_HIGH,
		.function         = PM_GPIO_FUNC_2,
		.inv_int_pol      = 0,
		.disable_pin      = 0,
	};

	if (mipi_dsi_panel_gpio_configured == 0) {
		/* pm8xxx: gpio-21, Backlight Enable */
		rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(21),
					&pwm_enable);
		if (rc != 0)
			pr_err("%s: pwm_enabled failed\n", __func__);

		/* pm8xxx: gpio-24, Bl: Off, PWM mode */
		rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(24),
					&pwm_mode);
		if (rc != 0)
			pr_err("%s: pwm_mode failed\n", __func__);

		mipi_dsi_panel_gpio_configured++;
	}
}

static bool dsi_power_on;

/**
 * LiQUID panel on/off
 *
 * @param on
 *
 * @return int
 */
static int mipi_dsi_liquid_panel_power(int on)
{
	static struct regulator *reg_l2, *reg_ext_3p3v;
	static int gpio21, gpio24, gpio43;
	int rc;

	mipi_dsi_panel_pwm_cfg();
	pr_debug("%s: on=%d\n", __func__, on);

	gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
	gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
	gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */

	if (!dsi_power_on) {

		reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi_vdda");
		if (IS_ERR(reg_l2)) {
			pr_err("could not get 8921_l2, rc = %ld\n",
				PTR_ERR(reg_l2));
			return -ENODEV;
		}

		rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
		if (rc) {
			pr_err("set_voltage l2 failed, rc=%d\n", rc);
			return -EINVAL;
		}

		reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
			"vdd_lvds_3p3v");
		if (IS_ERR(reg_ext_3p3v)) {
			pr_err("could not get reg_ext_3p3v, rc = %ld\n",
			       PTR_ERR(reg_ext_3p3v));
		    return -ENODEV;
		}

		rc = gpio_request(gpio21, "disp_pwr_en_n");
		if (rc) {
			pr_err("request gpio 21 failed, rc=%d\n", rc);
			return -ENODEV;
		}

		rc = gpio_request(gpio43, "disp_rst_n");
		if (rc) {
			pr_err("request gpio 43 failed, rc=%d\n", rc);
			return -ENODEV;
//.........这里部分代码省略.........
开发者ID:ZigZiggo,项目名称:sam-tenderloin-kernel-3.4,代码行数:101,代码来源:board-8960-display.c

示例13: msm_hsusb_ldo_enable

static int msm_hsusb_ldo_enable(struct msm_hsphy *phy, int on)
{
	int rc = 0;

	dev_dbg(phy->phy.dev, "reg (%s)\n", on ? "HPM" : "LPM");

	if (!on)
		goto disable_regulators;


	rc = regulator_set_optimum_mode(phy->vdda18, USB_HSPHY_1P8_HPM_LOAD);
	if (rc < 0) {
		dev_err(phy->phy.dev, "Unable to set HPM of vdda18\n");
		return rc;
	}

	rc = regulator_set_voltage(phy->vdda18, USB_HSPHY_1P8_VOL_MIN,
						USB_HSPHY_1P8_VOL_MAX);
	if (rc) {
		dev_err(phy->phy.dev, "unable to set voltage for vdda18\n");
		goto put_vdda18_lpm;
	}

	rc = regulator_enable(phy->vdda18);
	if (rc) {
		dev_err(phy->phy.dev, "Unable to enable vdda18\n");
		goto unset_vdda18;
	}

	rc = regulator_set_optimum_mode(phy->vdda33, USB_HSPHY_3P3_HPM_LOAD);
	if (rc < 0) {
		dev_err(phy->phy.dev, "Unable to set HPM of vdda33\n");
		goto disable_vdda18;
	}

	rc = regulator_set_voltage(phy->vdda33, USB_HSPHY_3P3_VOL_MIN,
						USB_HSPHY_3P3_VOL_MAX);
	if (rc) {
		dev_err(phy->phy.dev, "unable to set voltage for vdda33\n");
		goto put_vdda33_lpm;
	}

	rc = regulator_enable(phy->vdda33);
	if (rc) {
		dev_err(phy->phy.dev, "Unable to enable vdda33\n");
		goto unset_vdda33;
	}

	return 0;

disable_regulators:
	rc = regulator_disable(phy->vdda33);
	if (rc)
		dev_err(phy->phy.dev, "Unable to disable vdda33\n");

unset_vdda33:
	rc = regulator_set_voltage(phy->vdda33, 0, USB_HSPHY_3P3_VOL_MAX);
	if (rc)
		dev_err(phy->phy.dev, "unable to set voltage for vdda33\n");

put_vdda33_lpm:
	rc = regulator_set_optimum_mode(phy->vdda33, 0);
	if (rc < 0)
		dev_err(phy->phy.dev, "Unable to set LPM of vdda33\n");

disable_vdda18:
	rc = regulator_disable(phy->vdda18);
	if (rc)
		dev_err(phy->phy.dev, "Unable to disable vdda18\n");

unset_vdda18:
	rc = regulator_set_voltage(phy->vdda18, 0, USB_HSPHY_1P8_VOL_MAX);
	if (rc)
		dev_err(phy->phy.dev, "unable to set voltage for vdda18\n");

put_vdda18_lpm:
	rc = regulator_set_optimum_mode(phy->vdda18, 0);
	if (rc < 0)
		dev_err(phy->phy.dev, "Unable to set LPM of vdda18\n");

	return rc < 0 ? rc : 0;
}
开发者ID:dianlujitao,项目名称:NX510J_5.1_kernel,代码行数:82,代码来源:phy-msm-hsusb.c

示例14: mpu3050_config_regulator

static int mpu3050_config_regulator(struct i2c_client *client, bool on)
{
	int rc = 0, i;
	int num_reg = sizeof(mpu_vreg) / sizeof(struct sensor_regulator);

	if (on) {
		for (i = 0; i < num_reg; i++) {
			mpu_vreg[i].vreg = regulator_get(&client->dev,
						mpu_vreg[i].name);
			if (IS_ERR(mpu_vreg[i].vreg)) {
				rc = PTR_ERR(mpu_vreg[i].vreg);
				pr_err("%s:regulator get failed rc=%d\n",
						__func__, rc);
				mpu_vreg[i].vreg = NULL;
				goto error_vdd;
			}

			if (regulator_count_voltages(mpu_vreg[i].vreg) > 0) {
				rc = regulator_set_voltage(mpu_vreg[i].vreg,
					mpu_vreg[i].min_uV, mpu_vreg[i].max_uV);
				if (rc) {
					pr_err("%s:set_voltage failed rc=%d\n",
						__func__, rc);
					regulator_put(mpu_vreg[i].vreg);
					mpu_vreg[i].vreg = NULL;
					goto error_vdd;
				}
			}

			rc = regulator_enable(mpu_vreg[i].vreg);
			if (rc) {
				pr_err("%s: regulator_enable failed rc =%d\n",
						__func__,
						rc);

				if (regulator_count_voltages(
					mpu_vreg[i].vreg) > 0) {
					regulator_set_voltage(mpu_vreg[i].vreg,
						0, mpu_vreg[i].max_uV);
				}
				regulator_put(mpu_vreg[i].vreg);
				mpu_vreg[i].vreg = NULL;
				goto error_vdd;
			}
		}
		return rc;
	} else {
		i = num_reg;
	}
error_vdd:
	while (--i >= 0) {
		if (!IS_ERR_OR_NULL(mpu_vreg[i].vreg)) {
			if (regulator_count_voltages(
				mpu_vreg[i].vreg) > 0) {
				regulator_set_voltage(mpu_vreg[i].vreg, 0,
						mpu_vreg[i].max_uV);
			}
			regulator_disable(mpu_vreg[i].vreg);
			regulator_put(mpu_vreg[i].vreg);
			mpu_vreg[i].vreg = NULL;
		}
	}
	return rc;
}
开发者ID:robcore,项目名称:Alucard-Kernel-jfltexx,代码行数:64,代码来源:mpu3050.c

示例15: vos_chip_power_qrf8615


//.........这里部分代码省略.........
			if (IS_ERR(wlan_clock)) {
				pr_err("Failed to get TCXO_A0 voter (%ld)\n",
						PTR_ERR(wlan_clock));
				goto fail_gpio_dir_out;
			}
		}

		rc = msm_xo_mode_vote(wlan_clock, MSM_XO_MODE_PIN_CTRL);
		if (rc < 0) {
			pr_err("Configuring TCXO to Pin controllable failed"
					"(%d)\n", rc);
			goto fail_xo_mode_vote;
		}
	} else if (!on && wlan_on) {
		if (wlan_clock != NULL)
			msm_xo_mode_vote(wlan_clock, MSM_XO_MODE_OFF);
		gpio_set_value_cansleep(wlan_gpio_deep_sleep, WLAN_RESET);
		gpio_free(wlan_gpio_deep_sleep);
	}

	/* WLAN VREG settings */
	for (i = 0; i < ARRAY_SIZE(vregs_qwlan_name); i++) {
		if (vregs_qwlan[i] == NULL) {
			vregs_qwlan[i] = regulator_get(NULL,
					vregs_qwlan_name[i]);
			if (IS_ERR(vregs_qwlan[i])) {
				pr_err("regulator get of %s failed (%ld)\n",
						vregs_qwlan_name[i],
						PTR_ERR(vregs_qwlan[i]));
				rc = PTR_ERR(vregs_qwlan[i]);
				goto vreg_get_fail;
			}
			if (vregs_qwlan_val_min[i] || vregs_qwlan_val_max[i]) {
				rc = regulator_set_voltage(vregs_qwlan[i],
						vregs_qwlan_val_min[i],
						vregs_qwlan_val_max[i]);
				if (rc) {
					pr_err("regulator_set_voltage(%s) failed\n",
							vregs_qwlan_name[i]);
					goto vreg_fail;
				}
			}
			/* vote for pin control (if needed) */
			if (vregs_is_pin_controlled[i]) {
				vregs_pc_qwlan[i] = regulator_get(NULL,
							vregs_qwlan_pc_name[i]);
				if (IS_ERR(vregs_pc_qwlan[i])) {
					pr_err("regulator get of %s failed "
						"(%ld)\n",
						vregs_qwlan_pc_name[i],
						PTR_ERR(vregs_pc_qwlan[i]));
					rc = PTR_ERR(vregs_pc_qwlan[i]);
					goto vreg_fail;
				}
			}
		}
		if (on && !wlan_on) {
			rc = regulator_enable(vregs_qwlan[i]);
			if (rc < 0) {
				pr_err("vreg %s enable failed (%d)\n",
						vregs_qwlan_name[i], rc);
				goto vreg_fail;
			}
			if (vregs_is_pin_controlled[i]) {
				rc = regulator_enable(vregs_pc_qwlan[i]);
				if (rc < 0) {
开发者ID:AmeriCanAndroid,项目名称:aca-evo3d-gsm-omega-3.0-mdj,代码行数:67,代码来源:qcomwlan_pwrif.c


注:本文中的regulator_set_voltage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。