static int wm8770_probe(struct snd_soc_codec *codec) { struct wm8770_priv *wm8770; int ret; wm8770 = snd_soc_codec_get_drvdata(codec); wm8770->codec = codec; 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; } ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); if (ret) { dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); return ret; } ret = wm8770_reset(codec); if (ret < 0) { dev_err(codec->dev, "Failed to issue reset: %d\n", ret); goto err_reg_enable; } /* latch the volume update bits */ snd_soc_update_bits(codec, WM8770_MSDIGVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_MSALGVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_VOUT1RVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_VOUT2RVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_VOUT3RVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_VOUT4RVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_DAC1RVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_DAC2RVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_DAC3RVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8770_DAC4RVOL, 0x100, 0x100); /* mute all DACs */ snd_soc_update_bits(codec, WM8770_DACMUTE, 0x10, 0x10); err_reg_enable: regulator_bulk_disable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); return ret; }
static int cs35l32_runtime_suspend(struct device *dev) { struct cs35l32_private *cs35l32 = dev_get_drvdata(dev); regcache_cache_only(cs35l32->regmap, true); regcache_mark_dirty(cs35l32->regmap); /* Hold down reset */ if (cs35l32->reset_gpio) gpiod_set_value_cansleep(cs35l32->reset_gpio, 0); /* remove power */ regulator_bulk_disable(ARRAY_SIZE(cs35l32->supplies), cs35l32->supplies); return 0; }
static int wm8994_suspend(struct device *dev) { struct wm8994 *wm8994 = dev_get_drvdata(dev); int ret; /* Don't actually go through with the suspend if the CODEC is * still active (eg, for audio passthrough from CP. */ ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_1); if (ret < 0) { dev_err(dev, "Failed to read power status: %d\n", ret); } else if (ret & WM8994_VMID_SEL_MASK) { dev_dbg(dev, "CODEC still active, ignoring suspend\n"); return 0; } /* GPIO configuration state is saved here since we may be configuring * the GPIO alternate functions even if we're not using the gpiolib * driver for them. */ ret = wm8994_read(wm8994, WM8994_GPIO_1, WM8994_NUM_GPIO_REGS * 2, &wm8994->gpio_regs); if (ret < 0) dev_err(dev, "Failed to save GPIO registers: %d\n", ret); /* For similar reasons we also stash the regulator states */ ret = wm8994_read(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS * 2, &wm8994->ldo_regs); if (ret < 0) dev_err(dev, "Failed to save LDO registers: %d\n", ret); /* Explicitly put the device into reset in case regulators * don't get disabled in order to ensure consistent restart. */ wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET, 0x8994); wm8994->suspended = true; ret = regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies); if (ret != 0) { dev_err(dev, "Failed to disable supplies: %d\n", ret); return ret; } return 0; }
static int es8328_suspend(struct snd_soc_codec *codec) { struct es8328_priv *es8328; int ret; es8328 = snd_soc_codec_get_drvdata(codec); clk_disable_unprepare(es8328->clk); ret = regulator_bulk_disable(ARRAY_SIZE(es8328->supplies), es8328->supplies); if (ret) { dev_err(codec->dev, "unable to disable regulators\n"); return ret; } return 0; }
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; }
static int cs4270_soc_suspend(struct snd_soc_codec *codec) { struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int reg, ret; reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL; if (reg < 0) return reg; ret = snd_soc_write(codec, CS4270_PWRCTL, reg); if (ret < 0) return ret; regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); return 0; }
static int twl6040_remove(struct i2c_client *client) { struct twl6040 *twl6040 = i2c_get_clientdata(client); if (twl6040->power_count) twl6040_power(twl6040, 0); devm_free_irq(&client->dev, twl6040->irq_ready, twl6040); devm_free_irq(&client->dev, twl6040->irq_th, twl6040); regmap_del_irq_chip(twl6040->irq, twl6040->irq_data); mfd_remove_devices(&client->dev); i2c_set_clientdata(client, NULL); regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies); return 0; }
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; }
static int m5mols_sensor_power(struct m5mols_info *info, bool enable) { struct v4l2_subdev *sd = &info->sd; struct i2c_client *client = v4l2_get_subdevdata(sd); const struct m5mols_platform_data *pdata = info->pdata; int ret; if (info->power == enable) return 0; if (enable) { if (info->set_power) { ret = info->set_power(&client->dev, 1); if (ret) return ret; } ret = regulator_bulk_enable(ARRAY_SIZE(supplies), supplies); if (ret) { info->set_power(&client->dev, 0); return ret; } gpio_set_value(pdata->gpio_reset, !pdata->reset_polarity); info->power = 1; return ret; } ret = regulator_bulk_disable(ARRAY_SIZE(supplies), supplies); if (ret) return ret; if (info->set_power) info->set_power(&client->dev, 0); gpio_set_value(pdata->gpio_reset, pdata->reset_polarity); info->isp_ready = 0; info->power = 0; return ret; }
static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg) { struct snd_soc_codec *codec = cs4270_codec; struct cs4270_private *cs4270 = codec->private_data; int reg, ret; reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL; if (reg < 0) return reg; ret = snd_soc_write(codec, CS4270_PWRCTL, reg); if (ret < 0) return ret; regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); return 0; }
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; }
static int tas6424_i2c_remove(struct i2c_client *client) { struct device *dev = &client->dev; struct tas6424_data *tas6424 = dev_get_drvdata(dev); int ret; snd_soc_unregister_codec(dev); cancel_delayed_work_sync(&tas6424->fault_check_work); ret = regulator_bulk_disable(ARRAY_SIZE(tas6424->supplies), tas6424->supplies); if (ret < 0) { dev_err(dev, "unable to disable supplies: %d\n", ret); return ret; } return 0; }
static int tas6424_power_off(struct snd_soc_codec *codec) { struct tas6424_data *tas6424 = snd_soc_codec_get_drvdata(codec); int ret; snd_soc_write(codec, TAS6424_CH_STATE_CTRL, TAS6424_ALL_STATE_HIZ); regcache_cache_only(tas6424->regmap, true); regcache_mark_dirty(tas6424->regmap); ret = regulator_bulk_disable(ARRAY_SIZE(tas6424->supplies), tas6424->supplies); if (ret < 0) { dev_err(codec->dev, "failed to disable supplies: %d\n", ret); return ret; } return 0; }
int arizona_dev_exit(struct arizona *arizona) { pm_runtime_disable(arizona->dev); regulator_disable(arizona->dcvdd); regulator_put(arizona->dcvdd); mfd_remove_devices(arizona->dev); arizona_free_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, arizona); arizona_free_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, arizona); arizona_free_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, arizona); arizona_irq_exit(arizona); if (arizona->pdata.reset) gpio_set_value_cansleep(arizona->pdata.reset, 0); regulator_bulk_disable(arizona->num_core_supplies, arizona->core_supplies); return 0; }
static int pmu_led_off(struct hisi_flash_ctrl_t *flash_ctrl) { struct pmu_led_private_data_t *pdata = NULL; #if 0 int rc=-1; #endif cam_debug("%s ernter.\n", __func__); if (NULL == flash_ctrl) { cam_err("%s flash_ctrl is NULL.", __func__); return -1; } if (STANDBY_MODE == flash_ctrl->state.mode) { cam_notice("%s flash led has been powered off.", __func__); return 0; } if (pum_led_flash_on == true) { //hi6401_set_gain_for_flashlight(false); pum_led_flash_on = false; } mutex_lock(flash_ctrl->hisi_flash_mutex); pdata = (struct pmu_led_private_data_t *)flash_ctrl->pdata; flash_ctrl->state.mode = STANDBY_MODE; flash_ctrl->state.data = 0; pmu_led_write(LED_CTRL2, 0); #if 0 rc = regulator_bulk_disable(1, &pdata->led_vcc); if (rc) { cam_err("failed to enable regulators %d\n", rc); return rc; } #endif boost5v_flash_led_enable(false); if(pdata!=NULL) wake_unlock(&pdata->pmu_led_wakelock); mutex_unlock(flash_ctrl->hisi_flash_mutex); return 0; }
static int wm8741_probe(struct snd_soc_codec *codec) { struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); int ret = 0; 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, SND_SOC_REGMAP); 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); dev_dbg(codec->dev, "Successful registration\n"); return ret; err_enable: regulator_bulk_disable(ARRAY_SIZE(wm8741->supplies), wm8741->supplies); err_get: return ret; }
int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd) { int ret = 0; int err; if (ssdd->power) { err = ssdd->power(dev, 0); if (err < 0) { dev_err(dev, "Platform failed to power-off the camera.\n"); ret = err; } } err = regulator_bulk_disable(ssdd->num_regulators, ssdd->regulators); if (err < 0) { dev_err(dev, "Cannot disable regulators\n"); ret = ret ? : err; }
static int wm8770_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { int ret; struct wm8770_priv *wm8770; wm8770 = snd_soc_codec_get_drvdata(codec); switch (level) { case SND_SOC_BIAS_ON: break; case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); if (ret) { dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); return ret; } regcache_sync(wm8770->regmap); /* global powerup */ snd_soc_write(codec, WM8770_PWDNCTRL, 0); } break; case SND_SOC_BIAS_OFF: /* global powerdown */ snd_soc_write(codec, WM8770_PWDNCTRL, 1); regulator_bulk_disable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); break; } codec->dapm.bias_level = level; return 0; }
int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd) { int ret = regulator_bulk_enable(ssdd->num_regulators, ssdd->regulators); if (ret < 0) { dev_err(dev, "Cannot enable regulators\n"); return ret; } if (ssdd->power) { ret = ssdd->power(dev, 1); if (ret < 0) { dev_err(dev, "Platform failed to power-on the camera.\n"); regulator_bulk_disable(ssdd->num_regulators, ssdd->regulators); } } return ret; }
int soc_camera_power_on(struct device *dev, struct soc_camera_link *icl) { int ret = regulator_bulk_enable(icl->num_regulators, icl->regulators); if (ret < 0) { dev_err(dev, "Cannot enable regulators\n"); return ret; } if (icl->power) { ret = icl->power(dev, 1); if (ret < 0) { dev_err(dev, "Platform failed to power-on the camera.\n"); regulator_bulk_disable(icl->num_regulators, icl->regulators); } } return ret; }
static int mpu3050_power_down(struct mpu3050 *mpu3050) { int ret; /* * Put MPU-3050 into sleep mode before cutting regulators. * This is important, because we may not be the sole user * of the regulator so the power may stay on after this, and * then we would be wasting power unless we go to sleep mode * first. */ ret = regmap_update_bits(mpu3050->map, MPU3050_PWR_MGM, MPU3050_PWR_MGM_SLEEP, MPU3050_PWR_MGM_SLEEP); if (ret) dev_err(mpu3050->dev, "error putting to sleep\n"); ret = regulator_bulk_disable(ARRAY_SIZE(mpu3050->regs), mpu3050->regs); if (ret) dev_err(mpu3050->dev, "error disabling regulators\n"); return 0; }
static int __maybe_unused cs35l33_runtime_resume(struct device *dev) { struct cs35l33_private *cs35l33 = dev_get_drvdata(dev); int ret; dev_dbg(dev, "%s\n", __func__); if (cs35l33->reset_gpio) gpiod_set_value_cansleep(cs35l33->reset_gpio, 0); ret = regulator_bulk_enable(cs35l33->num_core_supplies, cs35l33->core_supplies); if (ret != 0) { dev_err(dev, "Failed to enable core supplies: %d\n", ret); return ret; } regcache_cache_only(cs35l33->regmap, false); if (cs35l33->reset_gpio) gpiod_set_value_cansleep(cs35l33->reset_gpio, 1); msleep(CS35L33_BOOT_DELAY); ret = regcache_sync(cs35l33->regmap); if (ret != 0) { dev_err(dev, "Failed to restore register cache\n"); goto err; } return 0; err: regcache_cache_only(cs35l33->regmap, true); regulator_bulk_disable(cs35l33->num_core_supplies, cs35l33->core_supplies); return ret; }
int sku3_lcdc_lcd_camera_power_onoff(int on) { int rc = 0; u32 socinfo = socinfo_get_platform_type(); if (on) { if (socinfo == 0x0B) gpio_set_value_cansleep(SKU3_LCDC_LCD_CAMERA_LDO_1V8, 1); else if (socinfo == 0x0F || machine_is_msm8625_qrd7()) gpio_set_value_cansleep(SKU3_1_LCDC_LCD_CAMERA_LDO_1V8, 1); gpio_set_value_cansleep(SKU3_LCDC_LCD_CAMERA_LDO_2V8, 1); rc = regulator_bulk_enable(ARRAY_SIZE(regs_truly_lcdc), regs_truly_lcdc); if (rc) pr_err("%s: could not enable regulators: %d\n", __func__, rc); } else { if (socinfo == 0x0B) gpio_set_value_cansleep(SKU3_LCDC_LCD_CAMERA_LDO_1V8, 0); else if (socinfo == 0x0F || machine_is_msm8625_qrd7()) gpio_set_value_cansleep(SKU3_1_LCDC_LCD_CAMERA_LDO_1V8, 0); gpio_set_value_cansleep(SKU3_LCDC_LCD_CAMERA_LDO_2V8, 0); rc = regulator_bulk_disable(ARRAY_SIZE(regs_truly_lcdc), regs_truly_lcdc); if (rc) pr_err("%s: could not disable regulators: %d\n", __func__, rc); } return rc; }
static int tegra_ahci_power_on(struct ahci_host_priv *hpriv) { struct tegra_ahci_priv *tegra = hpriv->plat_data; int ret; ret = regulator_bulk_enable(ARRAY_SIZE(tegra->supplies), tegra->supplies); if (ret) return ret; ret = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_SATA, tegra->sata_clk, tegra->sata_rst); if (ret) goto disable_regulators; reset_control_assert(tegra->sata_oob_rst); reset_control_assert(tegra->sata_cold_rst); ret = ahci_platform_enable_resources(hpriv); if (ret) goto disable_power; reset_control_deassert(tegra->sata_cold_rst); reset_control_deassert(tegra->sata_oob_rst); return 0; disable_power: clk_disable_unprepare(tegra->sata_clk); tegra_powergate_power_off(TEGRA_POWERGATE_SATA); disable_regulators: regulator_bulk_disable(ARRAY_SIZE(tegra->supplies), tegra->supplies); return ret; }
static int wm8741_probe(struct snd_soc_codec *codec) { struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); int ret = 0; 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 = wm8741_reset(codec); if (ret < 0) { dev_err(codec->dev, "Failed to issue reset\n"); goto err_enable; } ret = wm8741_configure(codec); if (ret < 0) { dev_err(codec->dev, "Failed to change default settings\n"); goto err_enable; } ret = wm8741_add_controls(codec); if (ret < 0) { dev_err(codec->dev, "Failed to add controls\n"); goto err_enable; } dev_dbg(codec->dev, "Successful registration\n"); return ret; err_enable: regulator_bulk_disable(ARRAY_SIZE(wm8741->supplies), wm8741->supplies); err_get: return ret; }
static ssize_t reg_set_state(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct userspace_consumer_data *data = dev_get_drvdata(dev); bool enabled; int ret; /* * sysfs_streq() doesn't need the \n's, but we add them so the strings * will be shared with show_state(), above. */ if (sysfs_streq(buf, "enabled\n") || sysfs_streq(buf, "1")) enabled = true; else if (sysfs_streq(buf, "disabled\n") || sysfs_streq(buf, "0")) enabled = false; else { dev_err(dev, "Configuring invalid mode\n"); return count; } mutex_lock(&data->lock); if (enabled != data->enabled) { if (enabled) ret = regulator_bulk_enable(data->num_supplies, data->supplies); else ret = regulator_bulk_disable(data->num_supplies, data->supplies); if (ret == 0) data->enabled = enabled; else dev_err(dev, "Failed to configure state: %d\n", ret); } mutex_unlock(&data->lock); return count; }
static int msm_fb_lcdc_power_save(int on) { int rc = 0; /* Doing the init of the LCDC GPIOs very late as they are from an I2C-controlled IO Expander */ lcdc_toshiba_gpio_init(); if (lcdc_gpio_initialized) { gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on); gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on); rc = on ? regulator_bulk_enable( ARRAY_SIZE(regs_lcdc), regs_lcdc) : regulator_bulk_disable( ARRAY_SIZE(regs_lcdc), regs_lcdc); if (rc) pr_err("%s: could not %sable regulators: %d\n", __func__, on ? "en" : "dis", rc); } return rc; }
static int msm_fb_lcdc_power_save(int on) { int rc = 0; /* */ lcdc_toshiba_gpio_init(); if (lcdc_gpio_initialized) { gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on); gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on); rc = on ? regulator_bulk_enable( ARRAY_SIZE(regs_lcdc), regs_lcdc) : regulator_bulk_disable( ARRAY_SIZE(regs_lcdc), regs_lcdc); if (rc) pr_err("%s: could not %sable regulators: %d\n", __func__, on ? "en" : "dis", rc); } return rc; }
static int wm8994_resume(struct device *dev) { struct wm8994 *wm8994 = dev_get_drvdata(dev); int ret; /* We may have lied to the PM core about suspending */ if (!wm8994->suspended) return 0; ret = regulator_bulk_enable(wm8994->num_supplies, wm8994->supplies); if (ret != 0) { dev_err(dev, "Failed to enable supplies: %d\n", ret); return ret; } regcache_cache_only(wm8994->regmap, false); ret = regcache_sync(wm8994->regmap); if (ret != 0) { dev_err(dev, "Failed to restore register map: %d\n", ret); goto err_enable; } /* Disable LDO pulldowns while the device is active */ wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2, WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD, 0); wm8994->suspended = false; return 0; err_enable: regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies); return ret; }
static int pcm512x_suspend(struct device *dev) { struct pcm512x_priv *pcm512x = dev_get_drvdata(dev); int ret; ret = regmap_update_bits(pcm512x->regmap, PCM512x_POWER, PCM512x_RQPD, PCM512x_RQPD); if (ret != 0) { dev_err(dev, "Failed to request power down: %d\n", ret); return ret; } ret = regulator_bulk_disable(ARRAY_SIZE(pcm512x->supplies), pcm512x->supplies); if (ret != 0) { dev_err(dev, "Failed to disable supplies: %d\n", ret); return ret; } if (!IS_ERR(pcm512x->sclk)) clk_disable_unprepare(pcm512x->sclk); return 0; }