initval.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef __SOUND_INITVAL_H
  2. #define __SOUND_INITVAL_H
  3. /*
  4. * Init values for soundcard modules
  5. * Copyright (c) by Jaroslav Kysela <perex@perex.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_IOPORT
  49. static long snd_legacy_find_free_ioport(long *port_table, long size)
  50. {
  51. while (*port_table != -1) {
  52. if (request_region(*port_table, size, "ALSA test")) {
  53. release_region(*port_table, size);
  54. return *port_table;
  55. }
  56. port_table++;
  57. }
  58. return -1;
  59. }
  60. #endif
  61. #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
  62. #include <linux/interrupt.h>
  63. static irqreturn_t snd_legacy_empty_irq_handler(int irq, void *dev_id)
  64. {
  65. return IRQ_HANDLED;
  66. }
  67. static int snd_legacy_find_free_irq(int *irq_table)
  68. {
  69. while (*irq_table != -1) {
  70. if (!request_irq(*irq_table, snd_legacy_empty_irq_handler,
  71. IRQF_PROBE_SHARED, "ALSA Test IRQ",
  72. (void *) irq_table)) {
  73. free_irq(*irq_table, (void *) irq_table);
  74. return *irq_table;
  75. }
  76. irq_table++;
  77. }
  78. return -1;
  79. }
  80. #endif
  81. #ifdef SNDRV_LEGACY_FIND_FREE_DMA
  82. static int snd_legacy_find_free_dma(int *dma_table)
  83. {
  84. while (*dma_table != -1) {
  85. if (!request_dma(*dma_table, "ALSA Test DMA")) {
  86. free_dma(*dma_table);
  87. return *dma_table;
  88. }
  89. dma_table++;
  90. }
  91. return -1;
  92. }
  93. #endif
  94. #endif /* __SOUND_INITVAL_H */