s3c6400_pcm.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Common audio handling for the SA11x0
  3. *
  4. * Copyright (c) 2000 Nicolas Pitre <nico@cam.org>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License.
  8. */
  9. /*
  10. * Buffer Management
  11. */
  12. typedef struct {
  13. int offset; /* current offset */
  14. char *data; /* points to actual buffer */
  15. dma_addr_t dma_addr; /* physical buffer address */
  16. int dma_ref; /* DMA refcount */
  17. int master; /* owner for buffer allocation, contain size when true */
  18. } audio_buf_t;
  19. typedef struct {
  20. char *id; /* identification string */
  21. struct device *dev; /* device */
  22. audio_buf_t *buffers; /* pointer to audio buffer structures */
  23. u_int dma; /* user fragment index */
  24. u_int subchannel; /* user fragment index */
  25. u_int usr_head; /* user fragment index */
  26. u_int dma_head; /* DMA fragment index to go */
  27. u_int dma_tail; /* DMA fragment index to complete */
  28. u_int fragsize; /* fragment i.e. buffer size */
  29. u_int nbfrags; /* nbr of fragments i.e. buffers */
  30. u_int pending_frags; /* Fragments sent to DMA */
  31. int bytecount; /* nbr of processed bytes */
  32. int free_bufnum; /* nbr of processed bytes */
  33. int fragcount; /* nbr of fragment transitions */
  34. struct semaphore sem; /* account for fragment usage */
  35. wait_queue_head_t wq; /* for poll */
  36. int mapped:1; /* mmap()'ed buffers */
  37. int active:1; /* actually in progress */
  38. int stopped:1; /* might be active but stopped */
  39. } audio_stream_t;
  40. /*
  41. * State structure for one instance
  42. */
  43. typedef struct {
  44. audio_stream_t *output_stream;
  45. audio_stream_t *input_stream_line;
  46. audio_stream_t *input_stream_mic;
  47. audio_stream_t *input_stream;
  48. int rd_ref:1; /* open reference for recording */
  49. int wr_ref:1; /* open reference for playback */
  50. int need_tx_for_rx:1; /* if data must be sent while receiving */
  51. void *data;
  52. void (*hw_init)(int *);
  53. void (*hw_shutdown)(void *);
  54. int (*client_ioctl)(struct inode *, struct file *, uint, ulong);
  55. struct semaphore sem; /* to protect against races in attach() */
  56. int sound_mode;
  57. } audio_state_t;
  58. #define STEREO 2
  59. #define MONO 1
  60. #define CONFIG_MIC_PATH
  61. /*
  62. * Functions exported by this module
  63. */
  64. //extern int s3c64xx_audio_attach( struct inode *inode, struct file *file,
  65. extern int s3c_audio_attach( struct inode *inode, struct file *file,
  66. audio_state_t *state);
  67. int s3c64xx_audio_suspend(audio_state_t *s, u32 state, u32 level);
  68. int s3c64xx_audio_resume(audio_state_t *s, u32 level);
  69. /*
  70. * exported by this module
  71. */
  72. enum {
  73. SUSPEND_NOTIFY,
  74. SUSPEND_SAVE_STATE,
  75. SUSPEND_DISABLE,
  76. SUSPEND_POWER_DOWN,
  77. };
  78. enum {
  79. RESUME_POWER_ON,
  80. RESUME_RESTORE_STATE,
  81. RESUME_ENABLE,
  82. };
  83. #ifdef CONFIG_SOUND_S3C6400_I2S
  84. extern int wm8753_set_mic1_path(void);
  85. extern int wm8753_set_linein_path(void);
  86. extern int wm8753_set_hpout_path(void);
  87. #endif