initval.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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)
  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. IRQF_DISABLED | IRQF_PROBE_SHARED, "ALSA Test IRQ",
  59. (void *) irq_table)) {
  60. free_irq(*irq_table, (void *) irq_table);
  61. return *irq_table;
  62. }
  63. irq_table++;
  64. }
  65. return -1;
  66. }
  67. #endif
  68. #ifdef SNDRV_LEGACY_FIND_FREE_DMA
  69. static int snd_legacy_find_free_dma(int *dma_table)
  70. {
  71. while (*dma_table != -1) {
  72. if (!request_dma(*dma_table, "ALSA Test DMA")) {
  73. free_dma(*dma_table);
  74. return *dma_table;
  75. }
  76. dma_table++;
  77. }
  78. return -1;
  79. }
  80. #endif
  81. #endif /* __SOUND_INITVAL_H */