1 #include <linux/kernel.h>
4 #include <linux/sound.h>
6 #include <linux/soundcard.h>
9 #include <linux/module.h>
21 static void complete_handler_audio(
struct urb *
urb);
22 #define AUDIO_EP (0x83)
23 #define AUDIO_BUF_SIZE (512)
24 #define PERIOD_SIZE (1024 * 8)
25 #define PERIOD_MIN (4)
26 #define PERIOD_MAX PERIOD_MIN
68 runtime->
hw = snd_pd_hw_capture;
107 static int audio_buf_free(
struct poseidon *p)
134 #define AUDIO_TRAILER_SIZE (16)
135 static inline void handle_audio_data(
struct urb *
urb,
int *period_elapsed)
141 int len = urb->actual_length / stride;
142 unsigned char *
cp = urb->transfer_buffer;
154 (len * stride - cnt * stride));
172 static void complete_handler_audio(
struct urb *
urb)
176 int period_elapsed = 0;
182 if (urb->status != 0) {
188 if (urb->actual_length) {
189 handle_audio_data(urb, &period_elapsed);
197 log(
"audio urb failed (errcod = %i)", ret);
201 static int fire_audio_urb(
struct poseidon *p)
209 complete_handler_audio, pa);
214 log(
"urb err : %d", ret);
269 .open = snd_pd_capture_open,
270 .close = snd_pd_pcm_close,
272 .hw_params = snd_pd_hw_capture_params,
273 .hw_free = snd_pd_hw_capture_free,
274 .prepare = snd_pd_prepare,
275 .trigger = snd_pd_capture_trigger,
276 .pointer = snd_pd_capture_pointer,
277 .page = snd_pcm_pd_get_page,
281 int pm_alsa_suspend(
struct poseidon *p)
288 int pm_alsa_resume(
struct poseidon *p)
307 ret =
snd_pcm_new(card,
"poseidon audio", 0, 0, 1, &pcm);