コード例 #1
0
static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
{
	/* Enable writing to power configuration registers */
	twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1,
			 TWL4030_PM_MASTER_PROTECT_KEY);

	twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2,
			 TWL4030_PM_MASTER_PROTECT_KEY);

	/* Keep VUSB3V1 LDO in sleep state until VBUS/ID change detected*/
	/*twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);*/

	/* input to VUSB3V1 LDO is from VBAT, not VBUS */
	twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1);

	/* Initialize 3.1V regulator */
	twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP);

	twl->usb3v1 = devm_regulator_get(twl->dev, "usb3v1");
	if (IS_ERR(twl->usb3v1))
		return -ENODEV;

	twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE);

	/* Initialize 1.5V regulator */
	twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP);

	twl->usb1v5 = devm_regulator_get(twl->dev, "usb1v5");
	if (IS_ERR(twl->usb1v5))
		return -ENODEV;

	twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE);

	/* Initialize 1.8V regulator */
	twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V8_DEV_GRP);

	twl->usb1v8 = devm_regulator_get(twl->dev, "usb1v8");
	if (IS_ERR(twl->usb1v8))
		return -ENODEV;

	twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);

	/* disable access to power configuration registers */
	twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0,
			 TWL4030_PM_MASTER_PROTECT_KEY);

	return 0;
}
コード例 #2
0
ファイル: virtual.c プロジェクト: 3null/linux
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;
}
コード例 #3
0
ファイル: hdmi5.c プロジェクト: 513855417/linux
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;
}
コード例 #4
0
ファイル: ehci-msm2.c プロジェクト: joutcast/ASUS_A80_source
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;
}
コード例 #5
0
ファイル: ak4104.c プロジェクト: 020gzh/linux
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;
}
コード例 #6
0
ファイル: devres.c プロジェクト: mikuhatsune001/linux2.6.32
/**
 * 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;
}
コード例 #7
0
ファイル: max97236.c プロジェクト: upworkstar/AndroidAmazon
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;
}
コード例 #8
0
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;
}
コード例 #9
0
ファイル: mdss_edp.c プロジェクト: Menpiko/SnaPKernel-N6P
/*
 * 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;
}
コード例 #10
0
ファイル: hdmi.c プロジェクト: FoundYa/linux
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;
}
コード例 #11
0
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;
}
コード例 #12
0
ファイル: phy-qcom-ufs.c プロジェクト: kdave/btrfs-devel
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;
}
コード例 #13
0
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;
}
コード例 #14
0
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;
}
コード例 #15
0
ファイル: gpio-vibra.c プロジェクト: avagin/linux
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;
}
コード例 #16
0
static int mdss_dsi_regulator_init(struct platform_device *pdev)
{
    int ret;
    dsi_drv.vdd_vreg = devm_regulator_get(&pdev->dev, "vdd");
    if (IS_ERR(dsi_drv.vdd_vreg)) {
        pr_err("could not get 8941_l22, rc = %ld\n",
               PTR_ERR(dsi_drv.vdd_vreg));
        return -ENODEV;
    }

    ret = regulator_set_voltage(dsi_drv.vdd_vreg, 3000000, 3000000);
    if (ret) {
        pr_err("vdd_vreg->set_voltage failed, rc=%d\n", ret);
        return -EINVAL;
    }

    dsi_drv.vdd_io_vreg = devm_regulator_get(&pdev->dev, "vdd_io");
    if (IS_ERR(dsi_drv.vdd_io_vreg)) {
        pr_err("could not get 8941_l12, rc = %ld\n",
               PTR_ERR(dsi_drv.vdd_io_vreg));
        return -ENODEV;
    }

    ret = regulator_set_voltage(dsi_drv.vdd_io_vreg, 1800000, 1800000);
    if (ret) {
        pr_err("vdd_io_vreg->set_voltage failed, rc=%d\n", ret);
        return -EINVAL;
    }

    dsi_drv.dsi_vreg = devm_regulator_get(&pdev->dev, "vreg");
    if (IS_ERR(dsi_drv.dsi_vreg)) {
        pr_err("could not get 8941_l2, rc = %ld\n",
               PTR_ERR(dsi_drv.dsi_vreg));
        return -ENODEV;
    }

    ret = regulator_set_voltage(dsi_drv.dsi_vreg, 1200000, 1200000);
    if (ret) {
        pr_err("dsi_vreg->set_voltage failed, rc=%d\n", ret);
        return -EINVAL;
    }

    return 0;
}
コード例 #17
0
ファイル: lcd_pwrctrl.c プロジェクト: alessandroste/testBSP
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;
}
コード例 #18
0
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;
}
コード例 #19
0
ファイル: ehci-msm2.c プロジェクト: joutcast/ASUS_A80_source
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;
}
コード例 #20
0
ファイル: nouveau_platform.c プロジェクト: andyqee/linux
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;
}
コード例 #21
0
ファイル: smsc_hub.c プロジェクト: Leoyzen/Charm-Eye
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;
}
コード例 #22
0
ファイル: mdio-sun4i.c プロジェクト: 020gzh/linux
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;
}
static mali_bool kbase_platform_init(struct kbase_device *kbdev)
{
	struct device *dev = kbdev->dev;
	dev->platform_data = kbdev;

#ifdef CONFIG_REPORT_VSYNC
	kbase_dev = kbdev;
#endif

	kbdev->clk = devm_clk_get(dev, NULL);
	if (IS_ERR(kbdev->clk)) {
		printk("[mali-midgard]  Failed to get clk\n");
		return MALI_FALSE;
	}

	kbdev->regulator = devm_regulator_get(dev, KBASE_HI3635_PLATFORM_GPU_REGULATOR_NAME);
	if (IS_ERR(kbdev->regulator)) {
		printk("[mali-midgard]  Failed to get regulator\n");
		return MALI_FALSE;
	}

#ifdef CONFIG_PM_DEVFREQ
	if (of_init_opp_table(dev) ||
		opp_init_devfreq_table(dev,
			&mali_kbase_devfreq_profile.freq_table)) {
		printk("[mali-midgard]  Failed to init devfreq_table\n");
		kbdev->devfreq = NULL;
	} else {
		mali_kbase_devfreq_profile.initial_freq	= clk_get_rate(kbdev->clk);
		rcu_read_lock();
		mali_kbase_devfreq_profile.max_state = opp_get_opp_count(dev);
		rcu_read_unlock();
		kbdev->devfreq = devfreq_add_device(dev,
						&mali_kbase_devfreq_profile,
						"mali_ondemand",
						NULL);
	}

	if (IS_ERR(kbdev->devfreq)) {
		printk("[mali-midgard]  NULL pointer [kbdev->devFreq]\n");
		return MALI_FALSE;
	}

	/* make devfreq function */
	//mali_kbase_devfreq_profile.polling_ms = DEFAULT_POLLING_MS;

#if KBASE_HI3635_GPU_IRDROP_ISSUE
	/* init update work */
	sw_policy.kbdev = kbdev;
	INIT_WORK(&sw_policy.update, handle_switch_policy);
#endif /* KBASE_HI3635_GPU_IRDROP_ISSUE */
#endif
	return MALI_TRUE;
}
コード例 #24
0
ファイル: ubx.c プロジェクト: avagin/linux
static int ubx_probe(struct serdev_device *serdev)
{
	struct gnss_serial *gserial;
	struct ubx_data *data;
	int ret;

	gserial = gnss_serial_allocate(serdev, sizeof(*data));
	if (IS_ERR(gserial)) {
		ret = PTR_ERR(gserial);
		return ret;
	}

	gserial->ops = &ubx_gserial_ops;

	gserial->gdev->type = GNSS_TYPE_UBX;

	data = gnss_serial_get_drvdata(gserial);

	data->vcc = devm_regulator_get(&serdev->dev, "vcc");
	if (IS_ERR(data->vcc)) {
		ret = PTR_ERR(data->vcc);
		goto err_free_gserial;
	}

	data->v_bckp = devm_regulator_get_optional(&serdev->dev, "v-bckp");
	if (IS_ERR(data->v_bckp)) {
		ret = PTR_ERR(data->v_bckp);
		if (ret == -ENODEV)
			data->v_bckp = NULL;
		else
			goto err_free_gserial;
	}

	if (data->v_bckp) {
		ret = regulator_enable(data->v_bckp);
		if (ret)
			goto err_free_gserial;
	}

	ret = gnss_serial_register(gserial);
	if (ret)
		goto err_disable_v_bckp;

	return 0;

err_disable_v_bckp:
	if (data->v_bckp)
		regulator_disable(data->v_bckp);
err_free_gserial:
	gnss_serial_free(gserial);

	return ret;
}
コード例 #25
0
ファイル: pil-q6v4-mss.c プロジェクト: robcore/machinex
static int
pil_q6v4_proc_init(struct q6v4_data *drv, struct platform_device *pdev, int i)
{
	static const char *name[2] = { "fw", "sw" };
	const struct pil_q6v4_pdata *pdata_p = pdev->dev.platform_data;
	const struct pil_q6v4_pdata *pdata = pdata_p + i;
	char reg_name[12];
	struct pil_desc *desc;
	struct resource *res;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 1 + (i * 2));
	if (!res)
		return -EINVAL;

	drv->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
	if (!drv->base)
		return -ENOMEM;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 2 + (i * 2));
	if (!res)
		return -EINVAL;

	drv->wdog_base = devm_ioremap(&pdev->dev, res->start,
			resource_size(res));
	if (!drv->wdog_base)
		return -ENOMEM;

	snprintf(reg_name, sizeof(reg_name), "%s_core_vdd", name[i]);
	drv->vreg = devm_regulator_get(&pdev->dev, reg_name);
	if (IS_ERR(drv->vreg))
		return PTR_ERR(drv->vreg);

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

	desc = &drv->desc;
	desc->name = pdata->name;
	desc->depends_on = pdata->depends;
	desc->dev = &pdev->dev;
	desc->owner = THIS_MODULE;
	desc->proxy_timeout = 10000;
	pil_q6v4_init(drv, pdata);

	if (pas_supported(pdata->pas_id) > 0) {
		desc->ops = &pil_q6v4_modem_ops_trusted;
		dev_info(&pdev->dev, "using secure boot for %s\n", name[i]);
	} else {
		desc->ops = &pil_q6v4_modem_ops;
		dev_info(&pdev->dev, "using non-secure boot for %s\n", name[i]);
	}
	return 0;
}
コード例 #26
0
ファイル: ak4104.c プロジェクト: AlexShiLucky/linux
static int ak4104_spi_probe(struct spi_device *spi)
{
	struct ak4104_private *ak4104;
	struct gpio_desc *reset_gpiod;
	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;
	}

	reset_gpiod = devm_gpiod_get_optional(&spi->dev, "reset",
					      GPIOD_OUT_HIGH);
	if (IS_ERR(reset_gpiod) &&
	    PTR_ERR(reset_gpiod) == -EPROBE_DEFER)
		return -EPROBE_DEFER;

	/* 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 = devm_snd_soc_register_component(&spi->dev,
			&soc_component_device_ak4104, &ak4104_dai, 1);
	return ret;
}
コード例 #27
0
static int edp_regulator_init(struct edp_ctrl *ctrl)
{
    struct device *dev = &ctrl->pdev->dev;

    DBG("");
    ctrl->vdda_vreg = devm_regulator_get(dev, "vdda");
    if (IS_ERR(ctrl->vdda_vreg)) {
        pr_err("%s: Could not get vdda reg, ret = %ld\n", __func__,
               PTR_ERR(ctrl->vdda_vreg));
        ctrl->vdda_vreg = NULL;
        return PTR_ERR(ctrl->vdda_vreg);
    }
    ctrl->lvl_vreg = devm_regulator_get(dev, "lvl-vdd");
    if (IS_ERR(ctrl->lvl_vreg)) {
        pr_err("Could not get lvl-vdd reg, %ld",
               PTR_ERR(ctrl->lvl_vreg));
        ctrl->lvl_vreg = NULL;
        return PTR_ERR(ctrl->lvl_vreg);
    }

    return 0;
}
コード例 #28
0
ファイル: panel-dpi.c プロジェクト: AK101111/linux
static int panel_dpi_probe_of(struct platform_device *pdev)
{
	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
	struct device_node *node = pdev->dev.of_node;
	struct omap_dss_device *in;
	int r;
	struct display_timing timing;
	struct videomode vm;
	struct gpio_desc *gpio;

	gpio = devm_gpiod_get_optional(&pdev->dev, "enable", GPIOD_OUT_LOW);
	if (IS_ERR(gpio))
		return PTR_ERR(gpio);

	ddata->enable_gpio = gpio;

	/*
	 * Many different panels are supported by this driver and there are
	 * probably very different needs for their reset pins in regards to
	 * timing and order relative to the enable gpio. So for now it's just
	 * ensured that the reset line isn't active.
	 */
	gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW);
	if (IS_ERR(gpio))
		return PTR_ERR(gpio);

	ddata->vcc_supply = devm_regulator_get(&pdev->dev, "vcc");
	if (IS_ERR(ddata->vcc_supply))
		return PTR_ERR(ddata->vcc_supply);

	ddata->backlight_gpio = -ENOENT;

	r = of_get_display_timing(node, "panel-timing", &timing);
	if (r) {
		dev_err(&pdev->dev, "failed to get video timing\n");
		return r;
	}

	videomode_from_timing(&timing, &vm);
	videomode_to_omap_video_timings(&vm, &ddata->videomode);

	in = omapdss_of_find_source_for_first_ep(node);
	if (IS_ERR(in)) {
		dev_err(&pdev->dev, "failed to find video source\n");
		return PTR_ERR(in);
	}

	ddata->in = in;

	return 0;
}
コード例 #29
0
static int bma2x2_regulator_init(struct device *dev)
{
	int rc = 0;

	struct bma2x2_regulator_data *regdata = &bma2x2_regu_data;

	if (!regdata->reg_vdd)
		regdata->reg_vdd = devm_regulator_get(dev, regdata->id_vdd);
	if (IS_ERR_OR_NULL(regdata->reg_vdd)) {
		rc = PTR_ERR(regdata->reg_vdd);
		dev_err(dev, "%s: regulator_get failed on %s. rc=%d\n",
					__func__, regdata->id_vdd, rc);
		rc = rc ? rc : -ENODEV;
		goto err_vdd;
	} else {
		rc = regulator_set_voltage(regdata->reg_vdd, 2850000, 2850000);
		if (rc)
			goto err_vdd_set;
	}

	if (!regdata->reg_vio)
		regdata->reg_vio = devm_regulator_get(dev, regdata->id_vio);
	if (IS_ERR_OR_NULL(regdata->reg_vio)) {
		rc = PTR_ERR(regdata->reg_vio);
		dev_err(dev, "%s: regulator_get failed on %s. rc=%d\n",
					__func__, regdata->id_vio, rc);
		rc = rc ? rc : -ENODEV;
		goto err_vio;
	}
	return rc;
err_vio:
	regdata->reg_vio = NULL;
err_vdd_set:
	regulator_put(regdata->reg_vdd);
err_vdd:
	regdata->reg_vdd = NULL;
	return rc;
}
コード例 #30
0
ファイル: gpcv2.c プロジェクト: dremaker/imx6ul_linux
static int imx_gpcv2_probe(struct platform_device *pdev)
{
	int ret;
	struct regulator *pcie_reg, *mipi_reg;

	if (cpu_is_imx7d()) {
		pcie_reg = devm_regulator_get(&pdev->dev, "pcie-phy");
		if (IS_ERR(pcie_reg)) {
			ret = PTR_ERR(pcie_reg);
			dev_info(&pdev->dev, "pcie regulator not ready.\n");
			return ret;
		}
		nb_pcie.notifier_call = &imx_pcie_regulator_notify;

		ret = regulator_register_notifier(pcie_reg, &nb_pcie);
		if (ret) {
			dev_err(&pdev->dev,
				"pcie regulator notifier request failed\n");
			return ret;
		}

		mipi_reg = devm_regulator_get(&pdev->dev, "mipi-phy");
		if (IS_ERR(mipi_reg)) {
			ret = PTR_ERR(mipi_reg);
			dev_info(&pdev->dev, "mipi regulator not ready.\n");
			return ret;
		}
		nb_mipi.notifier_call = &imx_mipi_regulator_notify;

		ret = regulator_register_notifier(mipi_reg, &nb_mipi);
		if (ret) {
			dev_err(&pdev->dev,
				"mipi regulator notifier request failed.\n");
			return ret;
		}
	}
	return 0;
}