static int ak4535_resume(struct platform_device *pdev) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_codec *codec = socdev->card->codec; ak4535_sync(codec); ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ak4535_set_bias_level(codec, codec->suspend_bias_level); return 0; }
static int ak4535_suspend(struct platform_device *pdev, pm_message_t state) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_codec *codec = socdev->card->codec; ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; }
/* * initialise the AK4535 driver * register the mixer and dsp interfaces with the kernel */ static int ak4535_init(struct snd_soc_device *socdev) { struct snd_soc_codec *codec = socdev->card->codec; int ret = 0; codec->name = "AK4535"; codec->owner = THIS_MODULE; codec->read = ak4535_read_reg_cache; codec->write = ak4535_write; codec->set_bias_level = ak4535_set_bias_level; codec->dai = &ak4535_dai; codec->num_dai = 1; codec->reg_cache_size = ARRAY_SIZE(ak4535_reg); codec->reg_cache = kmemdup(ak4535_reg, sizeof(ak4535_reg), GFP_KERNEL); if (codec->reg_cache == NULL) return -ENOMEM; /* register pcms */ ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); if (ret < 0) { printk(KERN_ERR "ak4535: failed to create pcms\n"); goto pcm_err; } /* power on device */ ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY); snd_soc_add_controls(codec, ak4535_snd_controls, ARRAY_SIZE(ak4535_snd_controls)); ak4535_add_widgets(codec); ret = snd_soc_init_card(socdev); if (ret < 0) { printk(KERN_ERR "ak4535: failed to register card\n"); goto card_err; } return ret; card_err: snd_soc_free_pcms(socdev); snd_soc_dapm_free(socdev); pcm_err: kfree(codec->reg_cache); return ret; }
static int ak4535_probe(struct snd_soc_codec *codec) { struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec); printk(KERN_INFO "AK4535 Audio Codec %s", AK4535_VERSION); codec->control_data = ak4535->control_data; /* power on device */ ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY); snd_soc_add_controls(codec, ak4535_snd_controls, ARRAY_SIZE(ak4535_snd_controls)); ak4535_add_widgets(codec); return 0; }
static int ak4535_probe(struct snd_soc_codec *codec) { struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec); int ret; codec->control_data = ak4535->regmap; ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); if (ret < 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); return ret; } /* */ ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY); snd_soc_add_codec_controls(codec, ak4535_snd_controls, ARRAY_SIZE(ak4535_snd_controls)); return 0; }
/* power down chip */ static int ak4535_remove(struct platform_device *pdev) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_codec *codec = socdev->codec; if (codec->control_data) ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF); snd_soc_free_pcms(socdev); snd_soc_dapm_free(socdev); #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_unregister_device(codec->control_data); i2c_del_driver(&ak4535_i2c_driver); #endif kfree(codec->private_data); kfree(codec); return 0; }
static int ak4535_remove(struct snd_soc_codec *codec) { ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; }
static int ak4535_resume(struct snd_soc_codec *codec) { snd_soc_cache_sync(codec); ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; }
static int ak4535_suspend(struct snd_soc_codec *codec, pm_message_t state) { ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; }