ARM: cpu topology: Add debugfs interface for cpu_power
[cmplus.git] / include / sound / soc-dsp.h
blob033d61a2529a8996211231f96bf8856f70713c36
1 /*
2 * linux/sound/soc-dsp.h -- ALSA SoC DSP
4 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #ifndef __LINUX_SND_SOC_DSP_H
12 #define __LINUX_SND_SOC_DSP_H
14 #include <sound/pcm.h>
16 struct snd_soc_dapm_widget;
19 * Types of runtime_update to perform (e.g. originated from FE PCM ops
20 * or audio route changes triggered by muxes/mixers.
22 #define SND_SOC_DSP_UPDATE_NO 0
23 #define SND_SOC_DSP_UPDATE_BE 1
24 #define SND_SOC_DSP_UPDATE_FE 2
27 * DSP trigger ordering. Triggering flexibility is required as some DSPs
28 * require triggering before/after their clients/hosts.
30 * i.e. some clients may want to manually order this call in their PCM
31 * trigger() whilst others will just use the regular core ordering.
33 enum snd_soc_dsp_trigger {
34 SND_SOC_DSP_TRIGGER_PRE = 0,
35 SND_SOC_DSP_TRIGGER_POST,
36 SND_SOC_DSP_TRIGGER_BESPOKE,
40 * The DSP Frontend -> Backend link state.
42 enum snd_soc_dsp_link_state {
43 SND_SOC_DSP_LINK_STATE_NEW = 0, /* newly created path */
44 SND_SOC_DSP_LINK_STATE_FREE, /* path to be dismantled */
47 struct snd_soc_dsp_params {
48 struct snd_soc_pcm_runtime *be;
49 struct snd_soc_pcm_runtime *fe;
50 enum snd_soc_dsp_link_state state;
51 struct list_head list_be;
52 struct list_head list_fe;
53 struct snd_pcm_hw_params hw_params;
54 #ifdef CONFIG_DEBUG_FS
55 struct dentry *debugfs_state;
56 #endif
59 struct snd_soc_dsp_link {
60 bool capture;
61 bool playback;
62 enum snd_soc_dsp_trigger trigger[2];
65 /* FE DSP PCM ops - called by soc-core */
66 int soc_dsp_fe_dai_open(struct snd_pcm_substream *substream);
67 int soc_dsp_fe_dai_close(struct snd_pcm_substream *substream);
68 int soc_dsp_fe_dai_prepare(struct snd_pcm_substream *substream);
69 int soc_dsp_fe_dai_hw_free(struct snd_pcm_substream *substream);
70 int soc_dsp_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd);
71 int soc_dsp_fe_dai_hw_params(struct snd_pcm_substream *substream,
72 struct snd_pcm_hw_params *params);
74 /* Backend DSP trigger.
75 * Can be called by core or components depending on trigger config.
77 int soc_dsp_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, int cmd);
79 /* Is this trigger() call required for this FE and stream */
80 static inline int snd_soc_dsp_is_trigger_for_fe(struct snd_soc_pcm_runtime *fe,
81 int stream)
83 return (fe->dsp[stream].runtime_update == SND_SOC_DSP_UPDATE_FE);
86 static inline int snd_soc_dsp_is_op_for_be(struct snd_soc_pcm_runtime *fe,
87 struct snd_soc_pcm_runtime *be, int stream)
89 if ((fe->dsp[stream].runtime_update == SND_SOC_DSP_UPDATE_FE) ||
90 ((fe->dsp[stream].runtime_update == SND_SOC_DSP_UPDATE_BE) &&
91 be->dsp[stream].runtime_update))
92 return 1;
93 else
94 return 0;
97 static inline int snd_soc_dsp_platform_trigger(struct snd_pcm_substream *substream,
98 int cmd, struct snd_soc_platform *platform)
100 if (platform->driver->ops->trigger)
101 return platform->driver->ops->trigger(substream, cmd);
102 return 0;
105 int soc_dsp_fe_state_count(struct snd_soc_pcm_runtime *be, int stream,
106 enum snd_soc_dsp_state state);
108 /* Runtime update - open/close Backend DSP paths depending on mixer updates */
109 int soc_dsp_runtime_update(struct snd_soc_dapm_widget *widget);
111 /* Backend DSP suspend and resume */
112 int soc_dsp_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
113 int soc_dsp_fe_suspend(struct snd_soc_pcm_runtime *fe);
114 int soc_dsp_be_ac97_cpu_dai_suspend(struct snd_soc_pcm_runtime *fe);
115 int soc_dsp_fe_resume(struct snd_soc_pcm_runtime *fe);
116 int soc_dsp_be_ac97_cpu_dai_resume(struct snd_soc_pcm_runtime *fe);
118 /* DAPM stream events for Backend DSP paths */
119 int soc_dsp_dapm_stream_event(struct snd_soc_pcm_runtime *fe,
120 int dir, const char *stream, int event);
122 static inline struct snd_pcm_substream *snd_soc_dsp_get_substream(
123 struct snd_soc_pcm_runtime *be, int stream)
125 return be->pcm->streams[stream].substream;
128 #endif