static int aic31xx_codec_remove(struct snd_soc_codec *codec) { struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); int i; /* power down chip */ aic31xx_set_bias_level(codec, SND_SOC_BIAS_OFF); for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) regulator_unregister_notifier(aic31xx->supplies[i].consumer, &aic31xx->disable_nb[i].nb); return 0; }
static int aic31xx_codec_probe(struct snd_soc_codec *codec) { int ret = 0; struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); int i; dev_dbg(aic31xx->dev, "## %s\n", __func__); aic31xx = snd_soc_codec_get_drvdata(codec); codec->control_data = aic31xx->regmap; aic31xx->codec = codec; ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); if (ret != 0) { dev_err(codec->dev, "snd_soc_codec_set_cache_io failed %d\n", ret); return ret; } for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) { aic31xx->disable_nb[i].nb.notifier_call = aic31xx_regulator_event; aic31xx->disable_nb[i].aic31xx = aic31xx; ret = regulator_register_notifier(aic31xx->supplies[i].consumer, &aic31xx->disable_nb[i].nb); if (ret) { dev_err(codec->dev, "Failed to request regulator notifier: %d\n", ret); return ret; } } /* off, with power on */ aic31xx_set_bias_level(codec, SND_SOC_BIAS_STANDBY); aic31xx_add_controls(codec); aic31xx_add_widgets(codec); return ret; }
static int aic31xx_resume(struct snd_soc_codec *codec) { aic31xx_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; }
static int aic31xx_suspend(struct snd_soc_codec *codec) { aic31xx_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; }