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

C++ regulator_bulk_get函数代码示例

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

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



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

示例1: qrf6285_init_regs

static int qrf6285_init_regs(void)
{
	struct regulator_bulk_data regs[ARRAY_SIZE(vreg_info)];
	int i, rc;

	for (i = 0; i < ARRAY_SIZE(regs); i++) {
		regs[i].supply = vreg_info[i].vreg_id;
		regs[i].min_uV = vreg_info[i].level_min;
		regs[i].max_uV = vreg_info[i].level_max;
	}

	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs), regs);
	if (rc) {
		pr_err("%s: could not get regulators: %d\n", __func__, rc);
		goto out;
	}

	for (i = 0; i < ARRAY_SIZE(regs); i++)
		vreg_info[i].reg = regs[i].consumer;

	return 0;

out:
	return rc;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:25,代码来源:qcomwlan7x27a_pwrif.c


示例2: msm_camera_vreg_init

void __init msm_camera_vreg_init(void)
{
	int rc;
	platform_add_devices(camera_devices,
				ARRAY_SIZE(camera_devices));

	if (!machine_is_msm7627a_qrd1())
		register_i2c_devices();

	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not get regulators: %d\n", __func__, rc);
		return;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not set voltages: %d\n", __func__, rc);
		return;
	}

	if (machine_is_msm7627a_qrd1())
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_qrd,
				ARRAY_SIZE(i2c_camera_devices_qrd));
	else
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices,
				ARRAY_SIZE(i2c_camera_devices));
}
开发者ID:jomeister15,项目名称:ICS-SGH-I727-kernel,代码行数:32,代码来源:board-msm7627a-camera.c


示例3: ft5x06_ts_power_on

static int ft5x06_ts_power_on(bool on)
{
	int rc;

	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_ft5x06), regs_ft5x06);
	if (rc) {
		printk("%s: could not get regulators: %d\n",
				__func__, rc);
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_ft5x06), regs_ft5x06);
	if (rc) {
		printk("%s: could not set voltages: %d\n",
				__func__, rc);
	}

	rc = on ?
		regulator_bulk_enable(ARRAY_SIZE(regs_ft5x06), regs_ft5x06) :
		regulator_bulk_disable(ARRAY_SIZE(regs_ft5x06), regs_ft5x06);

	if (rc)
		pr_err("%s: could not %sable regulators: %d\n",
				__func__, on ? "en" : "dis", rc);
	else
		msleep(50);

	return rc;
}
开发者ID:DeltaDroidTeam,项目名称:android_kernel_dns_s4503,代码行数:28,代码来源:board-msm7627a_d9-io.c


示例4: wm8741_probe

static int wm8741_probe(struct snd_soc_codec *codec)
{
	struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
	int ret = 0;
	int i;

	for (i = 0; i < ARRAY_SIZE(wm8741->supplies); i++)
		wm8741->supplies[i].supply = wm8741_supply_names[i];

	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8741->supplies),
				 wm8741->supplies);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
		goto err;
	}

	ret = regulator_bulk_enable(ARRAY_SIZE(wm8741->supplies),
				    wm8741->supplies);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
		goto err_get;
	}

	ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8741->control_type);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
		goto err_enable;
	}

	ret = wm8741_reset(codec);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to issue reset\n");
		goto err_enable;
	}

	/* Change some default settings - latch VU */
	snd_soc_update_bits(codec, WM8741_DACLLSB_ATTENUATION,
			    WM8741_UPDATELL, WM8741_UPDATELL);
	snd_soc_update_bits(codec, WM8741_DACLMSB_ATTENUATION,
			    WM8741_UPDATELM, WM8741_UPDATELM);
	snd_soc_update_bits(codec, WM8741_DACRLSB_ATTENUATION,
			    WM8741_UPDATERL, WM8741_UPDATERL);
	snd_soc_update_bits(codec, WM8741_DACRMSB_ATTENUATION,
			    WM8741_UPDATERM, WM8741_UPDATERM);

	snd_soc_add_controls(codec, wm8741_snd_controls,
			     ARRAY_SIZE(wm8741_snd_controls));
	wm8741_add_widgets(codec);

	dev_dbg(codec->dev, "Successful registration\n");
	return ret;

err_enable:
	regulator_bulk_disable(ARRAY_SIZE(wm8741->supplies), wm8741->supplies);
err_get:
	regulator_bulk_free(ARRAY_SIZE(wm8741->supplies), wm8741->supplies);
err:
	return ret;
}
开发者ID:454053205,项目名称:linux,代码行数:59,代码来源:wm8741.c


示例5: wm8731_probe

static int wm8731_probe(struct snd_soc_codec *codec)
{
	struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
	int ret = 0, i;

	codec->control_data = wm8731->regmap;
	ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
		return ret;
	}

	for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
		wm8731->supplies[i].supply = wm8731_supply_names[i];

	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8731->supplies),
				 wm8731->supplies);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
		return ret;
	}

	ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies),
				    wm8731->supplies);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
		goto err_regulator_get;
	}

	ret = wm8731_reset(codec);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
		goto err_regulator_enable;
	}

	wm8731_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	/* Latch the update bits */
	snd_soc_update_bits(codec, WM8731_LOUT1V, 0x100, 0);
	snd_soc_update_bits(codec, WM8731_ROUT1V, 0x100, 0);
	snd_soc_update_bits(codec, WM8731_LINVOL, 0x100, 0);
	snd_soc_update_bits(codec, WM8731_RINVOL, 0x100, 0);

	/* Disable bypass path by default */
	snd_soc_update_bits(codec, WM8731_APANA, 0x8, 0);

	/* Regulators will have been enabled by bias management */
	regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);

	return 0;

err_regulator_enable:
	regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
err_regulator_get:
	regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);

	return ret;
}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:58,代码来源:wm8731.c


示例6: driver_probe

static int driver_probe(struct platform_device *pdev)
{
    struct device *dev = &pdev->dev;
    struct device_node *np = dev->of_node;
    struct resource res;
    printk("======dev %p   %s     %d\n",dev,__FUNCTION__,__LINE__);
    int ret = 0;
    IMG_ASSERT(pdev->resource[0].flags == IORESOURCE_MEM);
    IMG_ASSERT(pdev->resource[1].flags == IORESOURCE_IRQ);
    printk("VDEC %s   %d   \n", __FUNCTION__, __LINE__);
    //power_on(1);
    if (NULL == np)
    {
        printk("the device node is null\n");
        return -1;
    }
    printk("VDEC %s   %d   \n", __FUNCTION__, __LINE__);
    printk("======dev %p   %s     %d\n",dev,__FUNCTION__,__LINE__);

    module_irq =  irq_of_parse_and_map(np,0);
    printk("%s, %d,module_irq = %d\n",__func__,__LINE__,module_irq);

    ret = of_address_to_resource(np,0,&res);
    if (ret == 0)
    {
        vdec_reg_paddr = res.start;
        vdec_reg_size = resource_size(&res);
        printk("%s, %d,vdec_reg_vaddr = %#llx,vdec_reg_size = %#x\n", __func__, __LINE__, vdec_reg_paddr, vdec_reg_size);
    }

    vdec_reg_vaddr = of_iomap(np, 0);
    if (NULL == vdec_reg_vaddr) {
        printk("get reg base addr failed\n");
    }

    /*start j00140427 add clock and regulator*/
    gvdec_regulator.supply = "ldo_vdec";

    ret = regulator_bulk_get(dev, 1, &gvdec_regulator);
    if (ret) {
        printk("couldn't get regulators %d\n\r", ret);
        return -1;
    }

    gvdec_clk = of_clk_get(np,0);
    if (IS_ERR(gvdec_clk))
    {
        printk("get vdec clock failed\n");
        ret =  PTR_ERR(gvdec_clk);
        regulator_put(gvdec_regulator.consumer);
        memset(&gvdec_regulator,0,sizeof(gvdec_regulator));
        return -1;
    }
    /*end j00140427 add clock and regulator*/
    gbDevDetected = IMG_TRUE;
    return 0;
}
开发者ID:mildrock,项目名称:overlay_plane_display,代码行数:57,代码来源:sysdev_hisi.c


示例7: wm8737_probe

static int wm8737_probe(struct snd_soc_codec *codec)
{
	struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec);
	int ret, i;

	ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8737->control_type);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
		return ret;
	}

	for (i = 0; i < ARRAY_SIZE(wm8737->supplies); i++)
		wm8737->supplies[i].supply = wm8737_supply_names[i];

	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8737->supplies),
				 wm8737->supplies);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
		return ret;
	}

	ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies),
				    wm8737->supplies);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
		goto err_get;
	}

	ret = wm8737_reset(codec);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to issue reset\n");
		goto err_enable;
	}

	snd_soc_update_bits(codec, WM8737_LEFT_PGA_VOLUME, WM8737_LVU,
			    WM8737_LVU);
	snd_soc_update_bits(codec, WM8737_RIGHT_PGA_VOLUME, WM8737_RVU,
			    WM8737_RVU);

	wm8737_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	/* Bias level configuration will have done an extra enable */
	regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies);

	snd_soc_add_controls(codec, wm8737_snd_controls,
			     ARRAY_SIZE(wm8737_snd_controls));
	wm8737_add_widgets(codec);

	return 0;

err_enable:
	regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies);
err_get:
	regulator_bulk_free(ARRAY_SIZE(wm8737->supplies), wm8737->supplies);

	return ret;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:57,代码来源:wm8737.c


示例8: m6mo_mipi_cam_power

int m6mo_mipi_cam_power(int enable)
{
	struct regulator_bulk_data supplies[5];
	int num_consumers = ARRAY_SIZE(supplies);
	unsigned int gpio, front_gpio;
	int ret;

	pr_info("%s():%d\n", __FUNCTION__, enable);

	if (machine_is_m030()) {
		supplies[0].supply = "cam_isp_1.8v";
		supplies[1].supply = "cam_isp_core";
		supplies[2].supply = "cam_sensor_2.7v";
		supplies[3].supply = "cam_sensor_1.2v";
		supplies[4].supply = "cam_af_2.7v";
		gpio = M030_GPIO_CAMERA0_RST;
		front_gpio = M030_GPIO_CAMERA1_PDN;
	} else {
		supplies[0].supply = "cam_1.8v";
		supplies[1].supply = "cam0_isp_1.2v";
		supplies[2].supply = "cam0_sensor_1.2v";
		supplies[3].supply = "cam0_sensor_2.7v";
		supplies[4].supply = "cam0_af_2.7v";
		gpio = BACK_CAM_RST;
		front_gpio = FRONT_CAM_DOWN;
	}
	
	ret = regulator_bulk_get(NULL, num_consumers, supplies);
	if (ret) {
		pr_err("%s():regulator_bulk_get failed\n", __func__);
		return ret;
	}

	if (enable) {
		gpio_set_value(front_gpio, 1);
		ret = regulator_bulk_enable(num_consumers, supplies);
		gpio_set_value(gpio, 1);
	}
	else {
		gpio_set_value(gpio, 0);
		ret = regulator_bulk_disable(num_consumers, supplies);
		gpio_set_value(front_gpio, 0);
	}
	if (ret) {
		pr_err("%s():regulator_bulk_%sable failed\n", __func__, enable?"en":"dis");
		goto exit_regulator;
	}

	usleep_range(5000, 5000);

exit_regulator:
	regulator_bulk_free(num_consumers, supplies);
	
	return ret;
}
开发者ID:Abioy,项目名称:meizu-mx-kernel,代码行数:55,代码来源:mx_camera.c


示例9: atmel_ts_platform_init

static int atmel_ts_platform_init(struct i2c_client *client)
{
	int rc;
	struct device *dev = &client->dev;

	rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel);
	if (rc) {
		dev_err(dev, "%s: could not get regulators: %d\n",
				__func__, rc);
		goto out;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
	if (rc) {
		dev_err(dev, "%s: could not set voltages: %d\n",
				__func__, rc);
		goto reg_free;
	}

	rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
				GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
				GPIO_CFG_8MA), GPIO_CFG_ENABLE);
	if (rc) {
		dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
			__func__, ATMEL_TS_GPIO_IRQ);
		goto reg_free;
	}

	/* configure touchscreen interrupt gpio */
	rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
	if (rc) {
		dev_err(dev, "%s: unable to request gpio %d\n",
			__func__, ATMEL_TS_GPIO_IRQ);
		goto ts_gpio_tlmm_unconfig;
	}

	rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
	if (rc < 0) {
		dev_err(dev, "%s: unable to set the direction of gpio %d\n",
			__func__, ATMEL_TS_GPIO_IRQ);
		goto free_ts_gpio;
	}
	return 0;

free_ts_gpio:
	gpio_free(ATMEL_TS_GPIO_IRQ);
ts_gpio_tlmm_unconfig:
	gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
				GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_2MA), GPIO_CFG_DISABLE);
reg_free:
	regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
out:
	return rc;
}
开发者ID:HONO,项目名称:CM10_Kernel,代码行数:55,代码来源:board-msm7x27a.c


示例10: cs4270_probe

/**
 * cs4270_probe - ASoC probe function
 * @pdev: platform device
 *
 * This function is called when ASoC has all the pieces it needs to
 * instantiate a sound driver.
 */
static int cs4270_probe(struct platform_device *pdev)
{
	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
	struct snd_soc_codec *codec = cs4270_codec;
	struct cs4270_private *cs4270 = codec->private_data;
	int i, ret;

	/* Connect the codec to the socdev.  snd_soc_new_pcms() needs this. */
	socdev->card->codec = codec;

	/* Register PCMs */
	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
	if (ret < 0) {
		dev_err(codec->dev, "failed to create pcms\n");
		return ret;
	}

	/* Add the non-DAPM controls */
	ret = snd_soc_add_controls(codec, cs4270_snd_controls,
				ARRAY_SIZE(cs4270_snd_controls));
	if (ret < 0) {
		dev_err(codec->dev, "failed to add controls\n");
		goto error_free_pcms;
	}

	/* get the power supply regulators */
	for (i = 0; i < ARRAY_SIZE(supply_names); i++)
		cs4270->supplies[i].supply = supply_names[i];

	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(cs4270->supplies),
				 cs4270->supplies);
	if (ret < 0)
		goto error_free_pcms;

	ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
				    cs4270->supplies);
	if (ret < 0)
		goto error_free_regulators;

	return 0;

error_free_regulators:
	regulator_bulk_free(ARRAY_SIZE(cs4270->supplies),
			    cs4270->supplies);

error_free_pcms:
	snd_soc_free_pcms(socdev);

	return ret;
}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:57,代码来源:cs4270.c


示例11: msm_camera_vreg_enable

static void msm_camera_vreg_enable(struct platform_device *pdev)
{
/*<BU5D09497  lijuan 00152865  20100514 begin*/
#ifndef CONFIG_HUAWEI_CAMERA
	int count, rc;

	struct device *dev = &pdev->dev;

	/* Use gp6 and gp16 if and only if dev name matches. */
	if (!strncmp(pdev->name, "msm_camera_sn12m0pz", 20))
		count = ARRAY_SIZE(regs);
	else
		count = ARRAY_SIZE(regs) - 2;

	rc = regulator_bulk_get(dev, count, regs);

	if (rc) {
		dev_err(dev, "%s: could not get regulators: %d\n",
				__func__, rc);
		return;
	}

	rc = regulator_bulk_set_voltage(count, regs);

	if (rc) {
		dev_err(dev, "%s: could not set voltages: %d\n",
				__func__, rc);
		goto reg_free;
	}

	rc = regulator_bulk_enable(count, regs);

	if (rc) {
		dev_err(dev, "%s: could not enable regulators: %d\n",
				__func__, rc);
		goto reg_free;
	}

	reg_count = count;
	return;

reg_free:
	regulator_bulk_free(count, regs);
	return;
#endif
/*BU5D09497  lijuan 00152865  20100514 end>*/
}
开发者ID:CrysisLTU,项目名称:Project-X5pro-Kernel-u8800pro,代码行数:47,代码来源:msm_io_vfe31.c


示例12: wm8741_i2c_probe

static int wm8741_i2c_probe(struct i2c_client *i2c,
			    const struct i2c_device_id *id)
{
	struct wm8741_priv *wm8741;
	int ret, i;

	wm8741 = kzalloc(sizeof(struct wm8741_priv), GFP_KERNEL);
	if (wm8741 == NULL)
		return -ENOMEM;

	for (i = 0; i < ARRAY_SIZE(wm8741->supplies); i++)
		wm8741->supplies[i].supply = wm8741_supply_names[i];

	ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8741->supplies),
				 wm8741->supplies);
	if (ret != 0) {
		dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
		goto err;
	}

	ret = regulator_bulk_enable(ARRAY_SIZE(wm8741->supplies),
				    wm8741->supplies);
	if (ret != 0) {
		dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
		goto err_get;
	}

	i2c_set_clientdata(i2c, wm8741);
	wm8741->control_type = SND_SOC_I2C;

	ret =  snd_soc_register_codec(&i2c->dev,
			&soc_codec_dev_wm8741, &wm8741_dai, 1);
	if (ret < 0)
		goto err_enable;
	return ret;

err_enable:
	regulator_bulk_disable(ARRAY_SIZE(wm8741->supplies), wm8741->supplies);

err_get:
	regulator_bulk_free(ARRAY_SIZE(wm8741->supplies), wm8741->supplies);
err:
	kfree(wm8741);
	return ret;
}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:45,代码来源:wm8741.c


示例13: mipi_power_control

static int mipi_power_control(struct mipi_dsim_device *dsim, unsigned int enable)
{
	int ret;

	ret = regulator_bulk_get(NULL, ARRAY_SIZE(mipi_supplies), mipi_supplies);
	if (ret) {
		pr_err("%s: failed to get regulators: %d\n", __func__, ret);
		return ret;
	}

	if (enable)
		regulator_bulk_enable(ARRAY_SIZE(mipi_supplies), mipi_supplies);
	else
		regulator_bulk_disable(ARRAY_SIZE(mipi_supplies), mipi_supplies);

	regulator_bulk_free(ARRAY_SIZE(mipi_supplies), mipi_supplies);

	return 0;
}
开发者ID:Biktorgj,项目名称:Android_b2_Kernel,代码行数:19,代码来源:board-universal5260-display.c


示例14: ov7690_cam_power

static int ov7690_cam_power(int enable)
{
	struct regulator_bulk_data supplies[2];
	int num_consumers = ARRAY_SIZE(supplies);
	unsigned int gpio;
	int ret;

	pr_info("%s():%d\n", __FUNCTION__, enable);

	if (machine_is_m030()) {
		supplies[0].supply = "cam_isp_1.8v";
		supplies[1].supply = "cam_front_2.8v";
		gpio = M030_GPIO_CAMERA1_PDN;
	} else {
		supplies[0].supply = "cam_1.8v";
		supplies[1].supply = "cam1_2.8v";
		gpio = FRONT_CAM_DOWN;
	}

	ret = regulator_bulk_get(NULL, num_consumers, supplies);
	if (ret) {
		pr_err("%s():regulator_bulk_get failed\n", __func__);
		return ret;
	}

	if (enable) {
		ret = regulator_bulk_enable(num_consumers, supplies);
	}
	else {
		ret = regulator_bulk_disable(num_consumers, supplies);
	}
	if (ret) {
		pr_err("%s():regulator_bulk_%sable failed\n", __func__, enable?"en":"dis");
		goto exit_regulator;
	}

	usleep_range(5000, 5000);

exit_regulator:
	regulator_bulk_free(num_consumers, supplies);
	
	return ret;
}
开发者ID:Abioy,项目名称:meizu-mx-kernel,代码行数:43,代码来源:mx_camera.c


示例15: msm7627a_camera_init

void __init msm7627a_camera_init(void)
{
	int rc;

#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1()) {
		qrd1_camera_gpio_cfg();
		platform_add_devices(camera_devices_qrd,
				ARRAY_SIZE(camera_devices_qrd));
	} else
		platform_add_devices(camera_devices_msm,
				ARRAY_SIZE(camera_devices_msm));
#endif
	if (!machine_is_msm7627a_qrd1())
		register_i2c_devices();
	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not get regulators: %d\n", __func__, rc);
		return;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not set voltages: %d\n", __func__, rc);
		return;
	}

#if defined(CONFIG_MSM_CAMERA_V4L2)
	msm7x27a_init_cam();
#endif
#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1())
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_qrd,
				ARRAY_SIZE(i2c_camera_devices_qrd));
	else
#endif
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices,
				ARRAY_SIZE(i2c_camera_devices));
}
开发者ID:4ptiv4,项目名称:d2usc-tw-jb,代码行数:43,代码来源:board-msm7627a-camera.c


示例16: lcd_power_on

static int lcd_power_on(struct lcd_device *ld, int enable)
{
	int ret;

	ret = regulator_bulk_get(NULL, ARRAY_SIZE(panel_supplies), panel_supplies);
	if (ret) {
		pr_err("%s: failed to get regulators: %d\n", __func__, ret);
		return ret;
	}

	if (enable)
		regulator_bulk_enable(ARRAY_SIZE(panel_supplies), panel_supplies);
	else {
		regulator_bulk_disable(ARRAY_SIZE(panel_supplies), panel_supplies);
#if defined(GPIO_MLCD_RST)
		gpio_request_one(GPIO_MLCD_RST, GPIOF_OUT_INIT_LOW, "GPD1");
		gpio_free(GPIO_MLCD_RST);
#endif
	}

	regulator_bulk_free(ARRAY_SIZE(panel_supplies), panel_supplies);

	return 0;
}
开发者ID:Biktorgj,项目名称:Android_b2_Kernel,代码行数:24,代码来源:board-universal5260-display.c


示例17: wm8523_probe

static int wm8523_probe(struct snd_soc_codec *codec)
{
	struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
	int ret, i;

	wm8523->rate_constraint.list = &wm8523->rate_constraint_list[0];
	wm8523->rate_constraint.count =
		ARRAY_SIZE(wm8523->rate_constraint_list);

	ret = snd_soc_codec_set_cache_io(codec, 8, 16, wm8523->control_type);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
		return ret;
	}

	for (i = 0; i < ARRAY_SIZE(wm8523->supplies); i++)
		wm8523->supplies[i].supply = wm8523_supply_names[i];

	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8523->supplies),
				 wm8523->supplies);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
		return ret;
	}

	ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies),
				    wm8523->supplies);
	if (ret != 0) {
		dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
		goto err_get;
	}

	ret = snd_soc_read(codec, WM8523_DEVICE_ID);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to read ID register\n");
		goto err_enable;
	}
	if (ret != wm8523_reg[WM8523_DEVICE_ID]) {
		dev_err(codec->dev, "Device is not a WM8523, ID is %x\n", ret);
		ret = -EINVAL;
		goto err_enable;
	}

	ret = snd_soc_read(codec, WM8523_REVISION);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to read revision register\n");
		goto err_enable;
	}
	dev_info(codec->dev, "revision %c\n",
		 (ret & WM8523_CHIP_REV_MASK) + 'A');

	ret = wm8523_reset(codec);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to issue reset\n");
		goto err_enable;
	}

	/* Change some default settings - latch VU and enable ZC */
	snd_soc_update_bits(codec, WM8523_DAC_GAINR,
			    WM8523_DACR_VU, WM8523_DACR_VU);
	snd_soc_update_bits(codec, WM8523_DAC_CTRL3, WM8523_ZC, WM8523_ZC);

	wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	/* Bias level configuration will have done an extra enable */
	regulator_bulk_disable(ARRAY_SIZE(wm8523->supplies), wm8523->supplies);

	return 0;

err_enable:
	regulator_bulk_disable(ARRAY_SIZE(wm8523->supplies), wm8523->supplies);
err_get:
	regulator_bulk_free(ARRAY_SIZE(wm8523->supplies), wm8523->supplies);

	return ret;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:76,代码来源:wm8523.c


示例18: lis3lv02d_i2c_probe

static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client,
					const struct i2c_device_id *id)
{
	int ret = 0;
	struct lis3lv02d_platform_data *pdata = client->dev.platform_data;

#ifdef CONFIG_OF
	if (of_match_device(lis3lv02d_i2c_dt_ids, &client->dev)) {
		lis3_dev.of_node = client->dev.of_node;
		ret = lis3lv02d_init_dt(&lis3_dev);
		if (ret)
			return ret;
		pdata = lis3_dev.pdata;
	}
#endif

	if (pdata) {
		if ((pdata->driver_features & LIS3_USE_BLOCK_READ) &&
			(i2c_check_functionality(client->adapter,
						I2C_FUNC_SMBUS_I2C_BLOCK)))
			lis3_dev.blkread  = lis3_i2c_blockread;

		if (pdata->axis_x)
			lis3lv02d_axis_map.x = pdata->axis_x;

		if (pdata->axis_y)
			lis3lv02d_axis_map.y = pdata->axis_y;

		if (pdata->axis_z)
			lis3lv02d_axis_map.z = pdata->axis_z;

		if (pdata->setup_resources)
			ret = pdata->setup_resources();

		if (ret)
			goto fail;
	}

	lis3_dev.regulators[0].supply = reg_vdd;
	lis3_dev.regulators[1].supply = reg_vdd_io;
	ret = regulator_bulk_get(&client->dev,
				 ARRAY_SIZE(lis3_dev.regulators),
				 lis3_dev.regulators);
	if (ret < 0)
		goto fail;

	lis3_dev.pdata	  = pdata;
	lis3_dev.bus_priv = client;
	lis3_dev.init	  = lis3_i2c_init;
	lis3_dev.read	  = lis3_i2c_read;
	lis3_dev.write	  = lis3_i2c_write;
	lis3_dev.irq	  = client->irq;
	lis3_dev.ac	  = lis3lv02d_axis_map;
	lis3_dev.pm_dev	  = &client->dev;

	i2c_set_clientdata(client, &lis3_dev);

	/* Provide power over the init call */
	lis3_reg_ctrl(&lis3_dev, LIS3_REG_ON);

	ret = lis3lv02d_init_device(&lis3_dev);

	lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF);

	if (ret)
		goto fail2;
	return 0;

fail2:
	regulator_bulk_free(ARRAY_SIZE(lis3_dev.regulators),
				lis3_dev.regulators);
fail:
	if (pdata && pdata->release_resources)
		pdata->release_resources();
	return ret;
}
开发者ID:AllenDou,项目名称:linux,代码行数:76,代码来源:lis3lv02d_i2c.c


示例19: m032_mhl_power_on

#include <plat/pd.h>
#include <plat/devs.h>
#include <plat/tvout.h>

#ifdef CONFIG_MHL_DRIVER
static int m032_mhl_power_on(struct mhl_platform_data *pdata, int enable)
{
	struct regulator_bulk_data supplies[] ={
		{.supply = "vdd_ldo26",},
		{.supply = "vdd_ldo20",},
		{.supply = "MHL_1.2V",},
	};
	int num_consumers = ARRAY_SIZE(supplies);
	int ret = 0;

	ret = regulator_bulk_get(NULL, num_consumers, supplies);
	if (ret) {
		pr_err("regulator_bulk_get failed\n");
		return ret;
	}

	ret = enable ? regulator_bulk_enable(num_consumers, supplies):
			    regulator_bulk_disable(num_consumers, supplies);
	if (ret) {
		MHLPRINTK("regulator_%sable failed\n", enable ? "en" : "dis");
		return ret;
	}

	regulator_bulk_free(num_consumers, supplies);

	return 0;
开发者ID:Abioy,项目名称:meizu-mx-kernel,代码行数:31,代码来源:mx_tvout.c


示例20: lcdc_toshiba_gpio_init

static void lcdc_toshiba_gpio_init(void)
{
	int rc = 0;
	if (!lcdc_gpio_initialized) {
		if (gpio_request(GPIO_SPI_CLK, "spi_clk")) {
			pr_err("failed to request gpio spi_clk\n");
			return;
		}
		if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) {
			pr_err("failed to request gpio spi_cs0_N\n");
			goto fail_gpio6;
		}
		if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) {
			pr_err("failed to request gpio spi_mosi\n");
			goto fail_gpio5;
		}
		if (gpio_request(GPIO_SPI_MISO, "spi_miso")) {
			pr_err("failed to request gpio spi_miso\n");
			goto fail_gpio4;
		}
		if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) {
			pr_err("failed to request gpio_disp_pwr\n");
			goto fail_gpio3;
		}
		if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) {
			pr_err("failed to request gpio_bkl_en\n");
			goto fail_gpio2;
		}
		pmapp_disp_backlight_init();

		rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc), regs_lcdc);
		if (rc) {
			pr_err("%s: could not get regulators: %d\n",
					__func__, rc);
			goto fail_gpio1;
		}

		rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc),
				regs_lcdc);
		if (rc) {
			pr_err("%s: could not set voltages: %d\n",
					__func__, rc);
			goto fail_vreg;
		}
		lcdc_gpio_initialized = 1;
	}
	return;
fail_vreg:
	regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc);
fail_gpio1:
	gpio_free(GPIO_BACKLIGHT_EN);
fail_gpio2:
	gpio_free(GPIO_DISPLAY_PWR_EN);
fail_gpio3:
	gpio_free(GPIO_SPI_MISO);
fail_gpio4:
	gpio_free(GPIO_SPI_MOSI);
fail_gpio5:
	gpio_free(GPIO_SPI_CS0_N);
fail_gpio6:
	gpio_free(GPIO_SPI_CLK);
	lcdc_gpio_initialized = 0;
}
开发者ID:HONO,项目名称:CM10_Kernel,代码行数:63,代码来源:board-msm7x27a.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ regulator_bulk_set_voltage函数代码示例发布时间:2022-05-30
下一篇:
C++ regulator_bulk_enable函数代码示例发布时间: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