本文整理汇总了C++中regulator_bulk_get函数的典型用法代码示例。如果您正苦于以下问题:C++ regulator_bulk_get函数的具体用法?C++ regulator_bulk_get怎么用?C++ regulator_bulk_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了regulator_bulk_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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>*/
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}