soc-dai.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef _SOC_DAI_H
  2. #define _SOC_DAI_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
  7. #define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
  8. #define SND_SOC_DAIFMT_INV_MASK 0x0f00
  9. #define SND_SOC_DAIFMT_MASTER_MASK 0xf000
  10. #define SND_SOC_DAIFMT_CBM_CFM (1 << 12) /* codec clk & FRM master */
  11. #define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk slave & FRM master */
  12. #define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame slave */
  13. #define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM slave */
  14. #define SND_SOC_DAIFMT_I2S 1 /* I2S mode */
  15. #define SND_SOC_DAIFMT_RIGHT_J 2 /* Right Justified mode */
  16. #define SND_SOC_DAIFMT_LEFT_J 3 /* Left Justified mode */
  17. #define SND_SOC_DAIFMT_DSP_A 4 /* L data MSB after FRM LRC */
  18. #define SND_SOC_DAIFMT_DSP_B 5 /* L data MSB during FRM LRC */
  19. #define SND_SOC_DAIFMT_AC97 6 /* AC97 */
  20. #define SND_SOC_DAIFMT_PDM 7 /* Pulse density modulation */
  21. #define SND_SOC_DAIFMT_NB_NF (1 << 8) /* normal bit clock + frame */
  22. #define SND_SOC_DAIFMT_NB_IF (2 << 8) /* normal BCLK + inv FRM */
  23. #define SND_SOC_DAIFMT_IB_NF (3 << 8) /* invert BCLK + nor FRM */
  24. #define SND_SOC_DAIFMT_IB_IF (4 << 8) /* invert BCLK + FRM */
  25. #define TYPE_ENCODER (1 << 0)
  26. #define TYPE_DECODER (1 << 1)
  27. #define CODEC_VOL_MAX AUDIO_VOLUME_MAX
  28. #define CODEC_VOL_MIN AUDIO_VOLUME_MIN
  29. enum snd_soc_bias_level {
  30. SND_SOC_BIAS_OFF = 0,
  31. SND_SOC_BIAS_STANDBY = 1,
  32. SND_SOC_BIAS_PREPARE = 2,
  33. SND_SOC_BIAS_ON = 3,
  34. };
  35. enum {
  36. SNDRV_PCM_STREAM_PLAYBACK = 0,
  37. SNDRV_PCM_STREAM_CAPTURE,
  38. SNDRV_PCM_STREAM_MAX,
  39. };
  40. struct snd_soc_hw_params {
  41. int rates;
  42. int channels;
  43. int bits;
  44. };
  45. struct snd_pcm_substream{
  46. int stream;
  47. };
  48. struct snd_soc_dai_ops {
  49. int (*init)(void *codec_prvdata, int master);
  50. int (*hw_params)(void *codec_prvdata, struct snd_pcm_substream *substream, struct snd_soc_hw_params *params);
  51. int (*startup)(void *codec_prvdata, struct snd_pcm_substream *substream, int start);
  52. int (*set_mclk)(void *codec_prvdata, int freq, int dir);
  53. int (*set_fmt)(void *codec_prvdata, unsigned int fmt);
  54. int (*set_vol)(void *codec_prvdata, struct snd_pcm_substream *substream, int lvol, int rvol);
  55. int (*set_mute)(void *codec_prvdata, struct snd_pcm_substream *substream, int mute);
  56. };
  57. struct codec_register_inf {
  58. const char *name;
  59. uint8_t codec_type;
  60. struct snd_soc_dai_ops *ops;
  61. void *codec_prvdata;
  62. };
  63. void audio_codec_init(void);
  64. int audio_codec_register(struct codec_register_inf codec_reg_info);
  65. struct codec_register_inf *get_codec_register_inf(const char *name);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif /* _TOUCH_H */