initval.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef __SOUND_INITVAL_H
  2. #define __SOUND_INITVAL_H
  3. /*
  4. * Init values for soundcard modules
  5. * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. #define SNDRV_AUTO_PORT 1
  23. #define SNDRV_AUTO_IRQ 0xffff
  24. #define SNDRV_AUTO_DMA 0xffff
  25. #define SNDRV_AUTO_DMA_SIZE (0x7fffffff)
  26. #define SNDRV_DEFAULT_IDX1 (-1)
  27. #define SNDRV_DEFAULT_STR1 NULL
  28. #define SNDRV_DEFAULT_ENABLE1 1
  29. #define SNDRV_DEFAULT_PORT1 SNDRV_AUTO_PORT
  30. #define SNDRV_DEFAULT_IRQ1 SNDRV_AUTO_IRQ
  31. #define SNDRV_DEFAULT_DMA1 SNDRV_AUTO_DMA
  32. #define SNDRV_DEFAULT_DMA_SIZE1 SNDRV_AUTO_DMA_SIZE
  33. #define SNDRV_DEFAULT_PTR1 SNDRV_DEFAULT_STR1
  34. #define SNDRV_DEFAULT_IDX { [0 ... (SNDRV_CARDS-1)] = -1 }
  35. #define SNDRV_DEFAULT_STR { [0 ... (SNDRV_CARDS-1)] = NULL }
  36. #define SNDRV_DEFAULT_ENABLE { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
  37. #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
  38. #ifdef CONFIG_PNP
  39. #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
  40. #else
  41. #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
  42. #endif
  43. #define SNDRV_DEFAULT_PORT { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_PORT }
  44. #define SNDRV_DEFAULT_IRQ { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ }
  45. #define SNDRV_DEFAULT_DMA { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA }
  46. #define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
  47. #define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
  48. #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
  49. #include <linux/interrupt.h>
  50. static irqreturn_t snd_legacy_empty_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
  51. {
  52. return IRQ_HANDLED;
  53. }
  54. static int snd_legacy_find_free_irq(int *irq_table)
  55. {
  56. while (*irq_table != -1) {
  57. if (!request_irq(*irq_table, snd_legacy_empty_irq_handler,
  58. SA_INTERRUPT, "ALSA Test IRQ", (void *) irq_table)) {
  59. free_irq(*irq_table, (void *) irq_table);
  60. return *irq_table;
  61. }
  62. irq_table++;
  63. }
  64. return -1;
  65. }
  66. #endif
  67. #ifdef SNDRV_LEGACY_FIND_FREE_DMA
  68. static int snd_legacy_find_free_dma(int *dma_table)
  69. {
  70. while (*dma_table != -1) {
  71. if (!request_dma(*dma_table, "ALSA Test DMA")) {
  72. free_dma(*dma_table);
  73. return *dma_table;
  74. }
  75. dma_table++;
  76. }
  77. return -1;
  78. }
  79. #endif
  80. #endif /* __SOUND_INITVAL_H */