4 * Detection routine for the VIDC.
6 * Copyright (C) 1997 by Russell King <rmk@arm.uk.linux.org>
9 #include <linux/module.h>
10 #include <linux/kernel.h>
14 #include "sound_config.h"
15 #include "soundmodule.h"
20 void vidc_update_filler(int format
, int channels
)
24 #define TYPE(fmt,ch) (((fmt)<<2) | ((ch)&3))
26 fillertype
= TYPE(format
, channels
);
31 case TYPE(AFMT_U8
, 1):
32 vidc_filler
= vidc_fill_1x8_u
;
35 case TYPE(AFMT_U8
, 2):
36 vidc_filler
= vidc_fill_2x8_u
;
39 case TYPE(AFMT_S8
, 1):
40 vidc_filler
= vidc_fill_1x8_s
;
43 case TYPE(AFMT_S8
, 2):
44 vidc_filler
= vidc_fill_2x8_s
;
47 case TYPE(AFMT_S16_LE
, 1):
48 vidc_filler
= vidc_fill_1x16_s
;
51 case TYPE(AFMT_S16_LE
, 2):
52 vidc_filler
= vidc_fill_2x16_s
;
57 void attach_vidc(struct address_info
*hw_config
)
62 sprintf(name
, "VIDC %d-bit sound", hw_config
->card_subtype
);
63 conf_printf(name
, hw_config
);
64 memset(dma_buf
, 0, sizeof(dma_buf
));
66 for (i
= 0; i
< 2; i
++)
68 dma_buf
[i
] = get_free_page(GFP_KERNEL
);
71 dma_pbuf
[i
] = virt_to_phys(dma_buf
[i
]);
74 if (sound_alloc_dma(hw_config
->dma
, "VIDCsound"))
76 printk(KERN_ERR
"VIDCsound: can't allocate virtual DMA channel\n");
79 if (request_irq(hw_config
->irq
, vidc_sound_dma_irq
, 0, "VIDCsound", &dma_start
))
81 printk(KERN_ERR
"VIDCsound: can't allocate DMA interrupt\n");
85 // vidc_synth_init(hw_config);
86 vidc_audio_init(hw_config
);
87 vidc_mixer_init(hw_config
);
91 for (i
= 0; i
< 2; i
++)
92 free_page(dma_buf
[i
]);
93 printk(KERN_ERR
"VIDCsound: can't allocate required buffers\n");
96 int probe_vidc(struct address_info
*hw_config
)
98 hw_config
->irq
= IRQ_DMAS0
;
99 hw_config
->dma
= DMA_VIRTUAL_SOUND
;
100 hw_config
->dma2
= -1;
101 hw_config
->card_subtype
= 16;
105 void unload_vidc(struct address_info
*hw_config
)
109 free_irq(hw_config
->irq
, NULL
);
110 sound_free_dma(hw_config
->dma
);
112 for (i
= 0; i
< 2; i
++)
113 free_page(dma_buf
[i
]);
117 static struct address_info config
;
119 int init_module(void)
121 if (probe_vidc(&config
) == 0)
123 printk("VIDC 16-bit serial sound\n");
125 attach_vidc(&config
);
129 void cleanup_module(void)
131 unload_vidc(&config
);