• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ devm_regulator_get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: regulator_virtual_probe

static int regulator_virtual_probe(struct platform_device *pdev)
{
	char *reg_id = dev_get_platdata(&pdev->dev);
	struct virtual_consumer_data *drvdata;
	int ret;

	drvdata = devm_kzalloc(&pdev->dev, sizeof(struct virtual_consumer_data),
			       GFP_KERNEL);
	if (drvdata == NULL)
		return -ENOMEM;

	mutex_init(&drvdata->lock);

	drvdata->regulator = devm_regulator_get(&pdev->dev, reg_id);
	if (IS_ERR(drvdata->regulator)) {
		ret = PTR_ERR(drvdata->regulator);
		dev_err(&pdev->dev, "Failed to obtain supply '%s': %d\n",
			reg_id, ret);
		return ret;
	}

	ret = sysfs_create_group(&pdev->dev.kobj,
				 &regulator_virtual_attr_group);
	if (ret != 0) {
		dev_err(&pdev->dev,
			"Failed to create attribute group: %d\n", ret);
		return ret;
	}

	drvdata->mode = regulator_get_mode(drvdata->regulator);

	platform_set_drvdata(pdev, drvdata);

	return 0;
}
开发者ID:3null,项目名称:linux,代码行数:35,代码来源:virtual.c


示例2: hdmi_init_regulator

static int hdmi_init_regulator(void)
{
	int r;
	struct regulator *reg;

	if (hdmi.vdda_reg != NULL)
		return 0;

	reg = devm_regulator_get(&hdmi.pdev->dev, "vdda");
	if (IS_ERR(reg)) {
		DSSERR("can't get VDDA regulator\n");
		return PTR_ERR(reg);
	}

	r = regulator_set_voltage(reg, 1800000, 1800000);
	if (r) {
		devm_regulator_put(reg);
		DSSWARN("can't set the regulator voltage\n");
		return r;
	}

	hdmi.vdda_reg = reg;

	return 0;
}
开发者ID:513855417,项目名称:linux,代码行数:25,代码来源:hdmi5.c


示例3: msm_ehci_init_vbus

static int msm_ehci_init_vbus(struct msm_hcd *mhcd, int init)
{
	int rc = 0;
	struct usb_hcd *hcd = mhcd_to_hcd(mhcd);
	const struct msm_usb_host_platform_data *pdata;

	pdata = mhcd->dev->platform_data;

	if (!init) {
		if (pdata && pdata->dock_connect_irq)
			free_irq(pdata->dock_connect_irq, mhcd);
		return rc;
	}

	mhcd->vbus = devm_regulator_get(mhcd->dev, "vbus");
	if (IS_ERR(mhcd->vbus)) {
		pr_err("Unable to get vbus\n");
		return -ENODEV;
	}

	if (pdata) {
		hcd->power_budget = pdata->power_budget;

		if (pdata->dock_connect_irq) {
			rc = request_threaded_irq(pdata->dock_connect_irq, NULL,
					msm_ehci_dock_connect_irq,
					IRQF_TRIGGER_FALLING |
					IRQF_TRIGGER_RISING |
					IRQF_ONESHOT, "msm_ehci_host", mhcd);
			if (!rc)
				enable_irq_wake(pdata->dock_connect_irq);
		}
	}
	return rc;
}
开发者ID:joutcast,项目名称:ASUS_A80_source,代码行数:35,代码来源:ehci-msm2.c


示例4: ak4104_spi_probe

static int ak4104_spi_probe(struct spi_device *spi)
{
	struct device_node *np = spi->dev.of_node;
	struct ak4104_private *ak4104;
	unsigned int val;
	int ret;

	spi->bits_per_word = 8;
	spi->mode = SPI_MODE_0;
	ret = spi_setup(spi);
	if (ret < 0)
		return ret;

	ak4104 = devm_kzalloc(&spi->dev, sizeof(struct ak4104_private),
			      GFP_KERNEL);
	if (ak4104 == NULL)
		return -ENOMEM;

	ak4104->regulator = devm_regulator_get(&spi->dev, "vdd");
	if (IS_ERR(ak4104->regulator)) {
		ret = PTR_ERR(ak4104->regulator);
		dev_err(&spi->dev, "Unable to get Vdd regulator: %d\n", ret);
		return ret;
	}

	ak4104->regmap = devm_regmap_init_spi(spi, &ak4104_regmap);
	if (IS_ERR(ak4104->regmap)) {
		ret = PTR_ERR(ak4104->regmap);
		return ret;
	}

	if (np) {
		enum of_gpio_flags flags;
		int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags);

		if (gpio_is_valid(gpio)) {
			ret = devm_gpio_request_one(&spi->dev, gpio,
				     flags & OF_GPIO_ACTIVE_LOW ?
					GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
				     "ak4104 reset");
			if (ret < 0)
				return ret;
		}
	}

	/* read the 'reserved' register - according to the datasheet, it
	 * should contain 0x5b. Not a good way to verify the presence of
	 * the device, but there is no hardware ID register. */
	ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val);
	if (ret != 0)
		return ret;
	if (val != AK4104_RESERVED_VAL)
		return -ENODEV;

	spi_set_drvdata(spi, ak4104);

	ret = snd_soc_register_codec(&spi->dev,
			&soc_codec_device_ak4104, &ak4104_dai, 1);
	return ret;
}
开发者ID:020gzh,项目名称:linux,代码行数:60,代码来源:ak4104.c


示例5: devm_regulator_bulk_get

/**
 * devm_regulator_bulk_get - managed get multiple regulator consumers
 *
 * @dev:           Device to supply
 * @num_consumers: Number of consumers to register
 * @consumers:     Configuration of consumers; clients are stored here.
 *
 * @return 0 on success, an errno on failure.
 *
 * This helper function allows drivers to get several regulator
 * consumers in one operation with management, the regulators will
 * automatically be freed when the device is unbound.  If any of the
 * regulators cannot be acquired then any regulators that were
 * allocated will be freed before returning to the caller.
 */
int devm_regulator_bulk_get(struct device *dev, int num_consumers,
			    struct regulator_bulk_data *consumers)
{
	int i;
	int ret;

	for (i = 0; i < num_consumers; i++)
		consumers[i].consumer = NULL;

	for (i = 0; i < num_consumers; i++) {
		consumers[i].consumer = devm_regulator_get(dev,
							   consumers[i].supply);
		if (IS_ERR(consumers[i].consumer)) {
			ret = PTR_ERR(consumers[i].consumer);
			dev_err(dev, "Failed to get supply '%s': %d\n",
				consumers[i].supply, ret);
			consumers[i].consumer = NULL;
			goto err;
		}
	}

	return 0;

err:
	for (i = 0; i < num_consumers && consumers[i].consumer; i++)
		devm_regulator_put(consumers[i].consumer);

	return ret;
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:44,代码来源:devres.c


示例6: devm_kzalloc

static struct max97236_pdata *max97236_of_pdata(struct i2c_client *i2c)
{
	struct max97236_pdata *pdata;
	struct device_node *dn = i2c->dev.of_node;

	pdata = devm_kzalloc(&i2c->dev, sizeof(struct max97236_pdata),
			     GFP_KERNEL);
	if (!pdata)
		return NULL;

	pdata->irq_gpio = of_get_named_gpio(dn, "maxim,irq-gpio", 0);

	if (pdata->irq_gpio) {
		dev_info(&i2c->dev, "max97236: GPIO %d\n", pdata->irq_gpio);
	} else {
		dev_err(&i2c->dev, "max97236: No GPIO value found in dn\n");
	}

        pdata->vreg = devm_regulator_get(&i2c->dev, "vdd_hp_mux");
        if (IS_ERR(pdata->vreg)) {
                dev_err(&i2c->dev, "max97236: failed to get vdd hp supply");
                pdata->vreg = NULL;
        }

	return pdata;
}
开发者ID:upworkstar,项目名称:AndroidAmazon,代码行数:26,代码来源:max97236.c


示例7: qpnp_typec_parse_dt

static int qpnp_typec_parse_dt(struct qpnp_typec_chip *chip)
{
	int rc;
	struct device_node *node = chip->dev->of_node;

	/* SS-Mux configuration gpio */
	if (of_find_property(node, "qcom,ssmux-gpio", NULL)) {
		chip->ssmux_gpio = of_get_named_gpio(node, "qcom,ssmux-gpio",
				0);
		if (!gpio_is_valid(chip->ssmux_gpio)) {
			if (chip->ssmux_gpio != -EPROBE_DEFER)
				pr_err("failed to get ss-mux config gpio=%d\n",
						chip->ssmux_gpio);
			return chip->ssmux_gpio;
		}

		rc = devm_gpio_request(chip->dev, chip->ssmux_gpio,
				"typec_mux_config_gpio");
		if (rc) {
			pr_err("failed to request ss-mux gpio rc=%d\n", rc);
			return rc;
		}
	}

	/* SS-Mux regulator */
	if (of_find_property(node, "ss-mux-supply", NULL)) {
		chip->ss_mux_vreg = devm_regulator_get(chip->dev, "ss-mux");
		if (IS_ERR(chip->ss_mux_vreg))
			return PTR_ERR(chip->ss_mux_vreg);
	}

	return 0;
}
开发者ID:sztablet2016,项目名称:Android-kernel-msm-3.10,代码行数:33,代码来源:qpnp-typec.c


示例8: mdss_edp_regulator_init

/*
 * Init regulator needed for edp, 8974_l12
 */
static int mdss_edp_regulator_init(struct mdss_edp_drv_pdata *edp_drv)
{
	int ret;

	edp_drv->vdda_vreg = devm_regulator_get(&(edp_drv->pdev->dev), "vdda");
	if (IS_ERR(edp_drv->vdda_vreg)) {
		pr_err("%s: Could not get 8941_l12, ret = %ld\n", __func__,
				PTR_ERR(edp_drv->vdda_vreg));
		return -ENODEV;
	}

	ret = regulator_set_voltage(edp_drv->vdda_vreg,
			VDDA_MIN_UV, VDDA_MAX_UV);
	if (ret) {
		pr_err("%s: vdda_vreg set_voltage failed, ret=%d\n", __func__,
				ret);
		return -EINVAL;
	}

	ret = mdss_edp_regulator_on(edp_drv);
	if (ret)
		return ret;

	return 0;
}
开发者ID:Menpiko,项目名称:SnaPKernel-N6P,代码行数:28,代码来源:mdss_edp.c


示例9: hdmi_init_display

static int __init hdmi_init_display(struct omap_dss_device *dssdev)
{
	int r;

	struct gpio gpios[] = {
		{ hdmi.ct_cp_hpd_gpio, GPIOF_OUT_INIT_LOW, "hdmi_ct_cp_hpd" },
		{ hdmi.ls_oe_gpio, GPIOF_OUT_INIT_LOW, "hdmi_ls_oe" },
		{ hdmi.hpd_gpio, GPIOF_DIR_IN, "hdmi_hpd" },
	};

	DSSDBG("init_display\n");

	dss_init_hdmi_ip_ops(&hdmi.ip_data);

	if (hdmi.vdda_hdmi_dac_reg == NULL) {
		struct regulator *reg;

		reg = devm_regulator_get(&hdmi.pdev->dev, "vdda_hdmi_dac");

		if (IS_ERR(reg)) {
			DSSERR("can't get VDDA_HDMI_DAC regulator\n");
			return PTR_ERR(reg);
		}

		hdmi.vdda_hdmi_dac_reg = reg;
	}

	r = gpio_request_array(gpios, ARRAY_SIZE(gpios));
	if (r)
		return r;

	return 0;
}
开发者ID:FoundYa,项目名称:linux,代码行数:33,代码来源:hdmi.c


示例10: mitigate_inrush_probe

static int mitigate_inrush_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct device_node *np = dev->of_node;
	int i, retval;
	struct subsystem *subsys;
	struct inrush_driver_data *drv_data;

	retval = of_property_count_strings(np,
					"qcom,dependent-subsystems");
	if (IS_ERR_VALUE(retval)) {
		dev_err(dev, "Failed to get dependent subsystems\n");
		return -EINVAL;
	}

	drv_data = kzalloc((retval * sizeof(struct subsystem) +
			sizeof(struct inrush_driver_data)), GFP_KERNEL);

	if (!drv_data)
		return -ENOMEM;

	drv_data->subsystems = (void *)drv_data +
				sizeof(struct inrush_driver_data);
	drv_data->subsys_count = retval;

	for (i = 0; i < drv_data->subsys_count; i++) {
		subsys = &drv_data->subsystems[i];
		subsys->drv_data = drv_data;
		of_property_read_string_index(np, "qcom,dependent-subsystems",
					i, &subsys->name);
		subsys->nb.notifier_call = mitigate_inrush_notifier_cb;
		subsys->notif_handle =
			subsys_notif_register_notifier(subsys->name,
							&subsys->nb);
		if (IS_ERR(subsys->notif_handle)) {
			dev_err(dev, "Notifier registration failed for %s\n",
						 subsys->name);
			retval = PTR_ERR(subsys->notif_handle);
			goto err_subsys_notif;
		}
	}

	drv_data->vreg = devm_regulator_get(dev, "vdd");
	if (IS_ERR(drv_data->vreg)) {
		dev_err(dev, "Failed to get regulator\n");
		return PTR_ERR(drv_data->vreg);
	}

	return 0;

err_subsys_notif:
	for (i = 0; i < drv_data->subsys_count; i++) {
		subsys = &drv_data->subsystems[i];
		subsys_notif_unregister_notifier(subsys->notif_handle,
						&subsys->nb);
	}
	kfree(drv_data);
	return retval;
}
开发者ID:sztablet2016,项目名称:Android-kernel-msm-3.10,代码行数:59,代码来源:inrush-current-mitigation.c


示例11: __ufs_qcom_phy_init_vreg

static int __ufs_qcom_phy_init_vreg(struct device *dev,
                                    struct ufs_qcom_phy_vreg *vreg, const char *name, bool optional)
{
    int err = 0;

    char prop_name[MAX_PROP_NAME];

    vreg->name = devm_kstrdup(dev, name, GFP_KERNEL);
    if (!vreg->name) {
        err = -ENOMEM;
        goto out;
    }

    vreg->reg = devm_regulator_get(dev, name);
    if (IS_ERR(vreg->reg)) {
        err = PTR_ERR(vreg->reg);
        vreg->reg = NULL;
        if (!optional)
            dev_err(dev, "failed to get %s, %d\n", name, err);
        goto out;
    }

    if (dev->of_node) {
        snprintf(prop_name, MAX_PROP_NAME, "%s-max-microamp", name);
        err = of_property_read_u32(dev->of_node,
                                   prop_name, &vreg->max_uA);
        if (err && err != -EINVAL) {
            dev_err(dev, "%s: failed to read %s\n",
                    __func__, prop_name);
            goto out;
        } else if (err == -EINVAL || !vreg->max_uA) {
            if (regulator_count_voltages(vreg->reg) > 0) {
                dev_err(dev, "%s: %s is mandatory\n",
                        __func__, prop_name);
                goto out;
            }
            err = 0;
        }
        snprintf(prop_name, MAX_PROP_NAME, "%s-always-on", name);
        vreg->is_always_on = of_property_read_bool(dev->of_node,
                             prop_name);
    }

    if (!strcmp(name, "vdda-pll")) {
        vreg->max_uV = VDDA_PLL_MAX_UV;
        vreg->min_uV = VDDA_PLL_MIN_UV;
    } else if (!strcmp(name, "vdda-phy")) {
        vreg->max_uV = VDDA_PHY_MAX_UV;
        vreg->min_uV = VDDA_PHY_MIN_UV;
    } else if (!strcmp(name, "vddp-ref-clk")) {
        vreg->max_uV = VDDP_REF_CLK_MAX_UV;
        vreg->min_uV = VDDP_REF_CLK_MIN_UV;
    }

out:
    if (err)
        kfree(vreg->name);
    return err;
}
开发者ID:kdave,项目名称:btrfs-devel,代码行数:59,代码来源:phy-qcom-ufs.c


示例12: ili9341_init

int ili9341_init(struct platform_device *pdev,
			struct device_node *np)
{
	int rc = 0;
	rst_gpio = of_get_named_gpio(np, "qcom,rst-gpio", 0);
	cs_gpio = of_get_named_gpio(np, "qcom,cs-gpio", 0);
	ad8_gpio = of_get_named_gpio(np, "qcom,ad8-gpio", 0);
	te_gpio = of_get_named_gpio(np, "qcom,te-gpio", 0);
	if (!gpio_is_valid(rst_gpio)) {
		pr_err("%s: reset gpio not specified\n" , __func__);
		return -EINVAL;
	}
	if (!gpio_is_valid(cs_gpio)) {
		pr_err("%s: cs gpio not specified\n", __func__);
		return -EINVAL;
	}
	if (!gpio_is_valid(ad8_gpio)) {
		pr_err("%s: ad8 gpio not specified\n", __func__);
		return -EINVAL;
	}
	if (!gpio_is_valid(te_gpio)) {
		pr_err("%s: te gpio not specified\n", __func__);
		return -EINVAL;
	}
	vdd_vreg = devm_regulator_get(&pdev->dev, "vdd");
	if (IS_ERR(vdd_vreg)) {
		pr_err("%s could not get vdd,", __func__);
		return -ENODEV;
	}
	avdd_vreg = devm_regulator_get(&pdev->dev, "avdd");
	if (IS_ERR(avdd_vreg)) {
		pr_err("%s could not get avdd,", __func__);
		return -ENODEV;
	}
	rc = regulator_set_voltage(vdd_vreg, 1800000, 1800000);
	if (rc) {
		pr_err("vdd_vreg->set_voltage failed, rc=%d\n", rc);
		return -EINVAL;
	}
	rc = regulator_set_voltage(avdd_vreg, 2700000, 2700000);
	if (rc) {
		pr_err("vdd_vreg->set_voltage failed, rc=%d\n", rc);
		return -EINVAL;
	}
	return 0;
}
开发者ID:AD5GB,项目名称:wicked_kernel_lge_hammerhead,代码行数:46,代码来源:qpic_panel_ili_qvga.c


示例13: pil_mss_driver_probe

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

	desc = pil_q6v5_init(pdev);
	if (IS_ERR(desc))
		return PTR_ERR(desc);
	drv = platform_get_drvdata(pdev);
	if (drv == NULL)
		return -ENODEV;

	desc->ops = &pil_mss_ops;
	desc->owner = THIS_MODULE;
	desc->proxy_timeout = PROXY_TIMEOUT_MS;

	of_property_read_u32(pdev->dev.of_node, "qcom,pil-self-auth",
			     &drv->self_auth);
	if (drv->self_auth) {
		res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
		drv->rmb_base = devm_ioremap(&pdev->dev, res->start,
					     resource_size(res));
		if (!drv->rmb_base)
			return -ENOMEM;
	}

	res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
	drv->restart_reg = devm_ioremap(&pdev->dev, res->start,
					resource_size(res));
	if (!drv->restart_reg)
		return -ENOMEM;

	drv->vreg = devm_regulator_get(&pdev->dev, "vdd_mss");
	if (IS_ERR(drv->vreg))
		return PTR_ERR(drv->vreg);

	ret = regulator_set_voltage(drv->vreg, 1150000, 1150000);
	if (ret)
		dev_err(&pdev->dev, "Failed to set regulator's voltage.\n");

	ret = regulator_set_optimum_mode(drv->vreg, 100000);
	if (ret < 0) {
		dev_err(&pdev->dev, "Failed to set regulator's mode.\n");
		return ret;
	}

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

	drv->pil = msm_pil_register(desc);
	if (IS_ERR(drv->pil))
		return PTR_ERR(drv->pil);

	return 0;
}
开发者ID:Astrali,项目名称:kernel_msm8625q_f1,代码行数:58,代码来源:pil-q6v5-mss.c


示例14: gpio_vibrator_probe

static int gpio_vibrator_probe(struct platform_device *pdev)
{
	struct gpio_vibrator *vibrator;
	int err;

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

	vibrator->input = devm_input_allocate_device(&pdev->dev);
	if (!vibrator->input)
		return -ENOMEM;

	vibrator->vcc = devm_regulator_get(&pdev->dev, "vcc");
	err = PTR_ERR_OR_ZERO(vibrator->vcc);
	if (err) {
		if (err != -EPROBE_DEFER)
			dev_err(&pdev->dev, "Failed to request regulator: %d\n",
				err);
		return err;
	}

	vibrator->gpio = devm_gpiod_get(&pdev->dev, "enable", GPIOD_OUT_LOW);
	err = PTR_ERR_OR_ZERO(vibrator->gpio);
	if (err) {
		if (err != -EPROBE_DEFER)
			dev_err(&pdev->dev, "Failed to request main gpio: %d\n",
				err);
		return err;
	}

	INIT_WORK(&vibrator->play_work, gpio_vibrator_play_work);

	vibrator->input->name = "gpio-vibrator";
	vibrator->input->id.bustype = BUS_HOST;
	vibrator->input->close = gpio_vibrator_close;

	input_set_drvdata(vibrator->input, vibrator);
	input_set_capability(vibrator->input, EV_FF, FF_RUMBLE);

	err = input_ff_create_memless(vibrator->input, NULL,
				      gpio_vibrator_play_effect);
	if (err) {
		dev_err(&pdev->dev, "Couldn't create FF dev: %d\n", err);
		return err;
	}

	err = input_register_device(vibrator->input);
	if (err) {
		dev_err(&pdev->dev, "Couldn't register input dev: %d\n", err);
		return err;
	}

	platform_set_drvdata(pdev, vibrator);

	return 0;
}
开发者ID:avagin,项目名称:linux,代码行数:57,代码来源:gpio-vibra.c


示例15: lcd_pwrctrl_probe

static int __devinit lcd_pwrctrl_probe(struct platform_device *pdev)
{
	struct lcd_pwrctrl *lp;
	struct lcd_pwrctrl_data *pdata = pdev->dev.platform_data;
	struct device *dev = &pdev->dev;
	int err;

#ifdef CONFIG_OF
	if (dev->of_node) {
		pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
		if (!pdata) {
			dev_err(dev, "memory allocation for pdata failed\n");
			return -ENOMEM;
		}
		lcd_pwrctrl_parse_dt(dev, pdata);
	}
#endif

	if (!pdata) {
		dev_err(dev, "platform data not available\n");
		return -EINVAL;
	}

	lp = devm_kzalloc(dev, sizeof(struct lcd_pwrctrl), GFP_KERNEL);
	if (!lp) {
		dev_err(dev, "memory allocation failed for private data\n");
		return -ENOMEM;
	}

	err = gpio_request(pdata->gpio, "LCD-nRESET");
	if (err) {
		dev_err(dev, "gpio [%d] request failed\n", pdata->gpio);
		return err;
	}

	/*
	 * If power to lcd and/or lcd interface is controlled using a regulator,
	 * get the handle to the regulator for later use during power switching.
	 */
	lp->regulator = devm_regulator_get(dev, "vcc-lcd");
	if (IS_ERR(lp->regulator))
		dev_info(dev, "could not find regulator\n");

	lp->dev = dev;
	lp->pdata = pdata;
	lp->lcd = lcd_device_register(dev_name(dev), dev, lp, &lcd_pwrctrl_ops);
	if (IS_ERR(lp->lcd)) {
		dev_err(dev, "cannot register lcd device\n");
		gpio_free(pdata->gpio);
		return PTR_ERR(lp->lcd);
	}

	platform_set_drvdata(pdev, lp);
	lcd_pwrctrl_set_power(lp->lcd, FB_BLANK_NORMAL);
	return 0;
}
开发者ID:alessandroste,项目名称:testBSP,代码行数:56,代码来源:lcd_pwrctrl.c


示例16: mn885521_parse_dt

static int mn885521_parse_dt(struct device *dev, struct mn885521_platform_data *pdata)
{
	int rc = 0;

	INFO_PRINT("%s \n", __func__);

        pdata->fm_fullseg_pw_vreg = devm_regulator_get(dev, "fm_fullseg_pw");
        if (IS_ERR(pdata->fm_fullseg_pw_vreg)) {
		pdata->fm_fullseg_pw_vreg = NULL;
                pr_err("%s: could not get fm_fullseg_pw reg!\n", __func__);
                return -EINVAL;
        }else
		INFO_PRINT("%s: get fm_fullseg_pw reg\n", __func__);

        rc = regulator_set_voltage(pdata->fm_fullseg_pw_vreg, 2850000, 2850000);
        if (rc < 0) {
        	pr_err("%s: set voltage failed\n", __func__);
                return -EINVAL;
        }else
		INFO_PRINT("%s: set  fm_fullseg_pw voltage\n", __func__);

#if 0
        prop = of_find_property(dt, "mn885521,npd_reg_npd_xtal", NULL);
        if (prop) {
                pdata->npd_reg_npd_xtal = of_get_named_gpio(dt, "mn885521,npd_reg_npd_xtal", 0);
		printk("%s: pdata->npd_reg_npd_xtal = %x\n", __func__, pdata->npd_reg_npd_xtal);
        }else
		printk("%s: fail to get npd_reg_npd_xtal\n", __func__);
	

        prop = of_find_property(dt, "mn885521,nrst", NULL);
        if (prop) {
                pdata->nrst = of_get_named_gpio(dt, "mn885521,nrst", 0);
		printk("%s: pdata->nrst = %x\n", __func__, pdata->nrst);
        }

        prop = of_find_property(dt, "mn885521,spisel", NULL);
        if (prop) {
                pdata->spisel = of_get_named_gpio(dt, "mn885521,spisel", 0);
		printk("%s: pdata->spisel = %x\n", __func__, pdata->spisel);
        }

        prop = of_find_property(dt, "mn885521,sadr1", NULL);
        if (prop) {
                pdata->sadr1 = of_get_named_gpio(dt, "mn885521,sadr1", 0);
		printk("%s: pdata->sadr1 = %x\n", __func__, pdata->sadr1);
        }

        prop = of_find_property(dt, "mn885521,sadr2", NULL);
        if (prop) {
                pdata->sadr2 = of_get_named_gpio(dt, "mn885521,sadr2", 0);
		printk("%s: pdata->sadr2 = %x\n", __func__, pdata->sadr2);
        }
#endif
        return 0;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:56,代码来源:tuner_drv.c


示例17: msm_ehci_ldo_init

static int msm_ehci_ldo_init(struct msm_hcd *mhcd, int init)
{
	int rc = 0;

	if (!init)
		goto put_1p8;

	mhcd->hsusb_3p3 = devm_regulator_get(mhcd->dev, "HSUSB_3p3");
	if (IS_ERR(mhcd->hsusb_3p3)) {
		dev_err(mhcd->dev, "unable to get hsusb 3p3\n");
		return PTR_ERR(mhcd->hsusb_3p3);
	}

	rc = regulator_set_voltage(mhcd->hsusb_3p3,
			HSUSB_PHY_3P3_VOL_MIN, HSUSB_PHY_3P3_VOL_MAX);
	if (rc) {
		dev_err(mhcd->dev, "unable to set voltage level for"
				"hsusb 3p3\n");
		return rc;
	}
	mhcd->hsusb_1p8 = devm_regulator_get(mhcd->dev, "HSUSB_1p8");
	if (IS_ERR(mhcd->hsusb_1p8)) {
		dev_err(mhcd->dev, "unable to get hsusb 1p8\n");
		rc = PTR_ERR(mhcd->hsusb_1p8);
		goto put_3p3_lpm;
	}
	rc = regulator_set_voltage(mhcd->hsusb_1p8,
			HSUSB_PHY_1P8_VOL_MIN, HSUSB_PHY_1P8_VOL_MAX);
	if (rc) {
		dev_err(mhcd->dev, "unable to set voltage level for"
				"hsusb 1p8\n");
		goto put_1p8;
	}

	return 0;

put_1p8:
	regulator_set_voltage(mhcd->hsusb_1p8, 0, HSUSB_PHY_1P8_VOL_MAX);
put_3p3_lpm:
	regulator_set_voltage(mhcd->hsusb_3p3, 0, HSUSB_PHY_3P3_VOL_MAX);

	return rc;
}
开发者ID:joutcast,项目名称:ASUS_A80_source,代码行数:43,代码来源:ehci-msm2.c


示例18: nouveau_platform_probe

static int nouveau_platform_probe(struct platform_device *pdev)
{
	struct nouveau_platform_gpu *gpu;
	struct nouveau_platform_device *device;
	struct drm_device *drm;
	int err;

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

	gpu->vdd = devm_regulator_get(&pdev->dev, "vdd");
	if (IS_ERR(gpu->vdd))
		return PTR_ERR(gpu->vdd);

	gpu->rst = devm_reset_control_get(&pdev->dev, "gpu");
	if (IS_ERR(gpu->rst))
		return PTR_ERR(gpu->rst);

	gpu->clk = devm_clk_get(&pdev->dev, "gpu");
	if (IS_ERR(gpu->clk))
		return PTR_ERR(gpu->clk);

	gpu->clk_pwr = devm_clk_get(&pdev->dev, "pwr");
	if (IS_ERR(gpu->clk_pwr))
		return PTR_ERR(gpu->clk_pwr);

	err = nouveau_platform_power_up(gpu);
	if (err)
		return err;

	drm = nouveau_platform_device_create(pdev, &device);
	if (IS_ERR(drm)) {
		err = PTR_ERR(drm);
		goto power_down;
	}

	device->gpu = gpu;

	err = drm_dev_register(drm, 0);
	if (err < 0)
		goto err_unref;

	return 0;

err_unref:
	drm_dev_unref(drm);

	return 0;

power_down:
	nouveau_platform_power_down(gpu);

	return err;
}
开发者ID:andyqee,项目名称:linux,代码行数:55,代码来源:nouveau_platform.c


示例19: msm_hsic_hub_init_vdd

static int msm_hsic_hub_init_vdd(struct hsic_hub *hub, int init)
{
	int ret;

	if (!of_get_property(hub->dev->of_node, "ext-hub-vddio-supply", NULL))
		return 0;

	if (!init) {
		if (!IS_ERR(smsc_hub->hsic_hub_reg)) {
			regulator_disable(smsc_hub->hsic_hub_reg);
			regulator_set_optimum_mode(smsc_hub->hsic_hub_reg, 0);
			regulator_set_voltage(smsc_hub->hsic_hub_reg, 0,
							HSIC_HUB_VDD_VOL_MAX);
		}
		return 0;
	}

	smsc_hub->hsic_hub_reg = devm_regulator_get(hub->dev, "ext-hub-vddio");
	if (IS_ERR(smsc_hub->hsic_hub_reg)) {
		dev_dbg(hub->dev, "unable to get ext hub vddcx\n");
	} else {
		ret = regulator_set_voltage(smsc_hub->hsic_hub_reg,
				HSIC_HUB_VDD_VOL_MIN,
				HSIC_HUB_VDD_VOL_MAX);
		if (ret) {
			dev_err(hub->dev, "unable to set the voltage\n"
						"for hsic hub reg\n");
			return ret;
		}

		ret = regulator_set_optimum_mode(smsc_hub->hsic_hub_reg,
					HSIC_HUB_VDD_LOAD);
		if (ret < 0) {
			dev_err(hub->dev, "Unable to set mode of VDDCX\n");
			goto reg_optimum_mode_fail;
		}

		ret = regulator_enable(smsc_hub->hsic_hub_reg);
		if (ret) {
			dev_err(hub->dev, "unable to enable ext hub vddcx\n");
			goto reg_enable_fail;
		}
	}

	return 0;

reg_enable_fail:
	regulator_set_optimum_mode(smsc_hub->hsic_hub_reg, 0);
reg_optimum_mode_fail:
	regulator_set_voltage(smsc_hub->hsic_hub_reg, 0,
				HSIC_HUB_VDD_VOL_MAX);

	return ret;
}
开发者ID:Leoyzen,项目名称:Charm-Eye,代码行数:54,代码来源:smsc_hub.c


示例20: sun4i_mdio_probe

static int sun4i_mdio_probe(struct platform_device *pdev)
{
	struct device_node *np = pdev->dev.of_node;
	struct mii_bus *bus;
	struct sun4i_mdio_data *data;
	struct resource *res;
	int ret;

	bus = mdiobus_alloc_size(sizeof(*data));
	if (!bus)
		return -ENOMEM;

	bus->name = "sun4i_mii_bus";
	bus->read = &sun4i_mdio_read;
	bus->write = &sun4i_mdio_write;
	snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev));
	bus->parent = &pdev->dev;

	data = bus->priv;
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	data->membase = devm_ioremap_resource(&pdev->dev, res);
	if (IS_ERR(data->membase)) {
		ret = PTR_ERR(data->membase);
		goto err_out_free_mdiobus;
	}

	data->regulator = devm_regulator_get(&pdev->dev, "phy");
	if (IS_ERR(data->regulator)) {
		if (PTR_ERR(data->regulator) == -EPROBE_DEFER)
			return -EPROBE_DEFER;

		dev_info(&pdev->dev, "no regulator found\n");
		data->regulator = NULL;
	} else {
		ret = regulator_enable(data->regulator);
		if (ret)
			goto err_out_free_mdiobus;
	}

	ret = of_mdiobus_register(bus, np);
	if (ret < 0)
		goto err_out_disable_regulator;

	platform_set_drvdata(pdev, bus);

	return 0;

err_out_disable_regulator:
	if (data->regulator)
		regulator_disable(data->regulator);
err_out_free_mdiobus:
	mdiobus_free(bus);
	return ret;
}
开发者ID:020gzh,项目名称:linux,代码行数:54,代码来源:mdio-sun4i.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ devm_request_irq函数代码示例发布时间:2022-05-30
下一篇:
C++ devm_regmap_init_i2c函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap