aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-05-19 12:31:28 +0200
committerJaroslav Kysela <perex@perex.cz>2008-05-19 17:28:43 +0200
commit0be9898adb6f58fee44f0fec0bbc0eac997ea9eb (patch)
tree61842c7381c7dcc4060280357a9a5fc08f4db023 /include/sound
parent[ALSA] ASoC: Make CPU and codec DAI operations have same type (diff)
downloadlinux-dev-0be9898adb6f58fee44f0fec0bbc0eac997ea9eb.tar.xz
linux-dev-0be9898adb6f58fee44f0fec0bbc0eac997ea9eb.zip
[ALSA] ASoC: Clarify API for bias configuration
Currently the ASoC core configures the bias levels in the system using a callback on codecs and machines called 'dapm_event', passing it PCI style power levels as SNDRV_CTL_POWER_ constants. This is more obscure than it needs to be and has caused confusion to driver authors, especially given that DAPM is also performing power management. Address this by renaming the callback function to 'set_bias_level' and using constants explicitly representing the off, standby, pre-on and on states which DAPM transitions through. Also unexport the API for setting bias level: there are currently no in-tree users of this API other than the core itself and it is likely that the core would need to be extended to cater for any users. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Jarkko Nikula <jarkko.nikula@nokia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc-dapm.h3
-rw-r--r--include/sound/soc.h28
2 files changed, 26 insertions, 5 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index bf4cf0c1d37f..f8223fae5804 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -221,7 +221,8 @@ int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
/* dapm events */
int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream,
int event);
-int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event);
+int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
+ enum snd_soc_bias_level level);
/* dapm sys fs - used by the core */
int snd_soc_dapm_sys_add(struct device *dev);
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 73accbcfbd2d..bca9538d9e50 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -103,6 +103,24 @@
.private_value = (unsigned long)&xenum }
/*
+ * Bias levels
+ *
+ * @ON: Bias is fully on for audio playback and capture operations.
+ * @PREPARE: Prepare for audio operations. Called before DAPM switching for
+ * stream start and stop operations.
+ * @STANDBY: Low power standby state when no playback/capture operations are
+ * in progress. NOTE: The transition time between STANDBY and ON
+ * should be as fast as possible and no longer than 10ms.
+ * @OFF: Power Off. No restrictions on transition times.
+ */
+enum snd_soc_bias_level {
+ SND_SOC_BIAS_ON,
+ SND_SOC_BIAS_PREPARE,
+ SND_SOC_BIAS_STANDBY,
+ SND_SOC_BIAS_OFF,
+};
+
+/*
* Digital Audio Interface (DAI) types
*/
#define SND_SOC_DAI_AC97 0x1
@@ -356,7 +374,8 @@ struct snd_soc_codec {
struct mutex mutex;
/* callbacks */
- int (*dapm_event)(struct snd_soc_codec *codec, int event);
+ int (*set_bias_level)(struct snd_soc_codec *,
+ enum snd_soc_bias_level level);
/* runtime */
struct snd_card *card;
@@ -378,8 +397,8 @@ struct snd_soc_codec {
/* dapm */
struct list_head dapm_widgets;
struct list_head dapm_paths;
- unsigned int dapm_state;
- unsigned int suspend_dapm_state;
+ enum snd_soc_bias_level bias_level;
+ enum snd_soc_bias_level suspend_bias_level;
struct delayed_work delayed_work;
/* codec DAI's */
@@ -449,7 +468,8 @@ struct snd_soc_machine {
int (*resume_post)(struct platform_device *pdev);
/* callbacks */
- int (*dapm_event)(struct snd_soc_machine *, int event);
+ int (*set_bias_level)(struct snd_soc_machine *,
+ enum snd_soc_bias_level level);
/* CPU <--> Codec DAI links */
struct snd_soc_dai_link *dai_link;