| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifndef _SOC_DAI_H
- #define _SOC_DAI_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
- #define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
- #define SND_SOC_DAIFMT_INV_MASK 0x0f00
- #define SND_SOC_DAIFMT_MASTER_MASK 0xf000
- #define SND_SOC_DAIFMT_CBM_CFM (1 << 12) /* codec clk & FRM master */
- #define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk slave & FRM master */
- #define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame slave */
- #define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM slave */
- #define SND_SOC_DAIFMT_I2S 1 /* I2S mode */
- #define SND_SOC_DAIFMT_RIGHT_J 2 /* Right Justified mode */
- #define SND_SOC_DAIFMT_LEFT_J 3 /* Left Justified mode */
- #define SND_SOC_DAIFMT_DSP_A 4 /* L data MSB after FRM LRC */
- #define SND_SOC_DAIFMT_DSP_B 5 /* L data MSB during FRM LRC */
- #define SND_SOC_DAIFMT_AC97 6 /* AC97 */
- #define SND_SOC_DAIFMT_PDM 7 /* Pulse density modulation */
- #define SND_SOC_DAIFMT_NB_NF (1 << 8) /* normal bit clock + frame */
- #define SND_SOC_DAIFMT_NB_IF (2 << 8) /* normal BCLK + inv FRM */
- #define SND_SOC_DAIFMT_IB_NF (3 << 8) /* invert BCLK + nor FRM */
- #define SND_SOC_DAIFMT_IB_IF (4 << 8) /* invert BCLK + FRM */
- #define TYPE_ENCODER (1 << 0)
- #define TYPE_DECODER (1 << 1)
- #define CODEC_VOL_MAX AUDIO_VOLUME_MAX
- #define CODEC_VOL_MIN AUDIO_VOLUME_MIN
- enum snd_soc_bias_level {
- SND_SOC_BIAS_OFF = 0,
- SND_SOC_BIAS_STANDBY = 1,
- SND_SOC_BIAS_PREPARE = 2,
- SND_SOC_BIAS_ON = 3,
- };
- enum {
- SNDRV_PCM_STREAM_PLAYBACK = 0,
- SNDRV_PCM_STREAM_CAPTURE,
- SNDRV_PCM_STREAM_MAX,
- };
- struct snd_soc_hw_params {
- int rates;
- int channels;
- int bits;
- };
- struct snd_pcm_substream{
- int stream;
- };
- struct snd_soc_dai_ops {
- int (*init)(void *codec_prvdata, int master);
- int (*hw_params)(void *codec_prvdata, struct snd_pcm_substream *substream, struct snd_soc_hw_params *params);
- int (*startup)(void *codec_prvdata, struct snd_pcm_substream *substream, int start);
- int (*set_mclk)(void *codec_prvdata, int freq, int dir);
- int (*set_fmt)(void *codec_prvdata, unsigned int fmt);
- int (*set_vol)(void *codec_prvdata, struct snd_pcm_substream *substream, int lvol, int rvol);
- int (*set_mute)(void *codec_prvdata, struct snd_pcm_substream *substream, int mute);
- };
- struct codec_register_inf {
- const char *name;
- uint8_t codec_type;
- struct snd_soc_dai_ops *ops;
- void *codec_prvdata;
- };
- void audio_codec_init(void);
- int audio_codec_register(struct codec_register_inf codec_reg_info);
- struct codec_register_inf *get_codec_register_inf(const char *name);
- #ifdef __cplusplus
- }
- #endif
- #endif /* _TOUCH_H */
|