harmony.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:33k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.   drivers/sound/harmony.c 
  3. This is a sound driver for ASP's and Lasi's Harmony sound chip
  4. and is unlikely to be used for anything other than on a HP PA-RISC.
  5. Harmony is found in HP 712s, 715/new and many other GSC based machines.
  6. On older 715 machines you'll find the technically identical chip 
  7. called 'Vivace'. Both Harmony and Vicace are supported by this driver.
  8. Copyright 2000 (c) Linuxcare Canada, Alex deVries <alex@linuxcare.com>
  9. Copyright 2000-2002 (c) Helge Deller <deller@gmx.de>
  10. Copyright 2001 (c) Matthieu Delahaye <delahaym@esiee.fr>
  11. Copyright 2001 (c) Jean-Christophe Vaugeois <vaugeoij@esiee.fr>
  12. TODO:
  13. - fix SNDCTL_DSP_GETOSPACE and SNDCTL_DSP_GETISPACE ioctls to
  14. return the real values
  15. - add private ioctl for selecting line- or microphone input
  16. (only one of them is available at the same time)
  17. - add module parameters
  18. - implement mmap functionality
  19. - implement gain meter ?
  20. - ...
  21. */
  22. #include <linux/delay.h>
  23. #include <linux/errno.h>
  24. #include <linux/init.h>
  25. #include <linux/ioport.h>
  26. #include <linux/types.h>
  27. #include <linux/mm.h>
  28. #include <linux/pci.h>
  29. #include <asm/gsc.h>
  30. #include <asm/io.h>
  31. #include <asm/pgalloc.h>
  32. #include "sound_config.h"
  33. #define PFX "harmony: "
  34. #define HARMONY_VERSION "V0.9a"
  35. #undef DEBUG
  36. #ifdef DEBUG
  37. # define DPRINTK printk 
  38. #else
  39. # define DPRINTK(x,...)
  40. #endif
  41. #define MAX_BUFS 10 /* maximum number of rotating buffers */
  42. #define HARMONY_BUF_SIZE 4096 /* needs to be a multiple of PAGE_SIZE (4096)! */
  43. #define CNTL_C 0x80000000
  44. #define CNTL_ST 0x00000020
  45. #define CNTL_44100 0x00000015 /* HARMONY_SR_44KHZ */
  46. #define CNTL_8000 0x00000008 /* HARMONY_SR_8KHZ */
  47. #define GAINCTL_HE 0x08000000
  48. #define GAINCTL_LE 0x04000000
  49. #define GAINCTL_SE 0x02000000
  50. #define DSTATUS_PN 0x00000200
  51. #define DSTATUS_RN 0x00000002
  52. #define DSTATUS_IE 0x80000000
  53. #define HARMONY_DF_16BIT_LINEAR 0
  54. #define HARMONY_DF_8BIT_ULAW 1
  55. #define HARMONY_DF_8BIT_ALAW 2
  56. #define HARMONY_SS_MONO 0
  57. #define HARMONY_SS_STEREO 1
  58. #define HARMONY_SR_8KHZ 0x08
  59. #define HARMONY_SR_16KHZ 0x09
  60. #define HARMONY_SR_27KHZ 0x0A
  61. #define HARMONY_SR_32KHZ 0x0B
  62. #define HARMONY_SR_48KHZ 0x0E
  63. #define HARMONY_SR_9KHZ 0x0F
  64. #define HARMONY_SR_5KHZ 0x10
  65. #define HARMONY_SR_11KHZ 0x11
  66. #define HARMONY_SR_18KHZ 0x12
  67. #define HARMONY_SR_22KHZ 0x13
  68. #define HARMONY_SR_37KHZ 0x14
  69. #define HARMONY_SR_44KHZ 0x15
  70. #define HARMONY_SR_33KHZ 0x16
  71. #define HARMONY_SR_6KHZ 0x17
  72. /*
  73.  * Some magics numbers used to auto-detect file formats
  74.  */
  75. #define HARMONY_MAGIC_8B_ULAW 1
  76. #define HARMONY_MAGIC_8B_ALAW 27
  77. #define HARMONY_MAGIC_16B_LINEAR 3
  78. #define HARMONY_MAGIC_MONO 1
  79. #define HARMONY_MAGIC_STEREO 2
  80. /*
  81.  * Channels Positions in mixer register
  82.  */
  83. #define GAIN_HE_SHIFT   27
  84. #define GAIN_HE_MASK    ( 1 << GAIN_HE_SHIFT) 
  85. #define GAIN_LE_SHIFT   26
  86. #define GAIN_LE_MASK    ( 1 << GAIN_LE_SHIFT) 
  87. #define GAIN_SE_SHIFT   25
  88. #define GAIN_SE_MASK    ( 1 << GAIN_SE_SHIFT) 
  89. #define GAIN_IS_SHIFT   24
  90. #define GAIN_IS_MASK    ( 1 << GAIN_IS_SHIFT) 
  91. #define GAIN_MA_SHIFT   20
  92. #define GAIN_MA_MASK    ( 0x0f << GAIN_MA_SHIFT) 
  93. #define GAIN_LI_SHIFT   16
  94. #define GAIN_LI_MASK    ( 0x0f << GAIN_LI_SHIFT) 
  95. #define GAIN_RI_SHIFT   12
  96. #define GAIN_RI_MASK    ( 0x0f << GAIN_RI_SHIFT) 
  97. #define GAIN_LO_SHIFT   6
  98. #define GAIN_LO_MASK    ( 0x3f << GAIN_LO_SHIFT) 
  99. #define GAIN_RO_SHIFT   0
  100. #define GAIN_RO_MASK    ( 0x3f << GAIN_RO_SHIFT) 
  101. #define MAX_OUTPUT_LEVEL (GAIN_RO_MASK >> GAIN_RO_SHIFT)
  102. #define MAX_INPUT_LEVEL  (GAIN_RI_MASK >> GAIN_RI_SHIFT)
  103. #define MAX_VOLUME_LEVEL (GAIN_MA_MASK >> GAIN_MA_SHIFT)
  104. /*
  105.  * Channels Mask in mixer register
  106.  */
  107. #define GAIN_TOTAL_SILENCE 0x00F00FFF
  108. #define GAIN_DEFAULT       0x0FF00000
  109. struct harmony_hpa {
  110. u8 unused000;
  111. u8 id;
  112. u8 teleshare_id;
  113. u8 unused003;
  114. u32 reset;
  115. u32 cntl;
  116. u32 gainctl;
  117. u32 pnxtadd;
  118. u32 pcuradd;
  119. u32 rnxtadd;
  120. u32 rcuradd;
  121. u32 dstatus;
  122. u32 ov;
  123. u32 pio;
  124. u32 unused02c;
  125. u32 unused030[3];
  126. u32 diag;
  127. };
  128. struct harmony_dev {
  129. int irq;
  130. struct harmony_hpa *hpa;
  131. u32 current_gain;
  132. u8 data_format; /* HARMONY_DF_xx_BIT_xxx */
  133. u8 sample_rate; /* HARMONY_SR_xx_KHZ */
  134. u8 stereo_select; /* HARMONY_SS_MONO or HARMONY_SS_STEREO */
  135. int format_initialized;
  136. u32 dac_rate; /* 8000 ... 48000 (Hz) */
  137. int suspended_playing;
  138. int suspended_recording;
  139. int blocked_playing;
  140. int blocked_recording;
  141. wait_queue_head_t wq_play, wq_record;
  142. int first_filled_play; /* first buffer containing data (next to play) */
  143. int nb_filled_play; 
  144. int play_offset;
  145. int first_filled_record;
  146. int nb_filled_record;
  147. int audio_open, mixer_open;
  148. int dsp_unit, mixer_unit;
  149. struct pci_dev *fake_pci_dev; /* The fake pci_dev needed for 
  150. pci_* functions under ccio. */
  151. };
  152. static struct harmony_dev harmony;
  153. /*
  154.  * Dynamic sound buffer allocation and DMA memory
  155.  */
  156. struct harmony_buffer {
  157. unsigned char *addr;
  158. dma_addr_t dma_handle;
  159. int dma_consistent; /* Zero if pci_alloc_consistent() fails */
  160. int len;
  161. };
  162. /*
  163.  * Harmony memory buffers
  164.  */
  165. static struct harmony_buffer played_buf, recorded_buf, silent, graveyard;
  166. #define CHECK_WBACK_INV_OFFSET(b,offset,len) 
  167.         do { if (!b.dma_consistent) 
  168. dma_cache_wback_inv((unsigned long)b.addr+offset,len); 
  169. } while (0) 
  170. static int __init harmony_alloc_buffer(struct harmony_buffer *b, 
  171. int buffer_count)
  172. {
  173. b->len = buffer_count * HARMONY_BUF_SIZE;
  174. b->addr = pci_alloc_consistent(harmony.fake_pci_dev, 
  175.   b->len, &b->dma_handle);
  176. if (b->addr && b->dma_handle) {
  177. b->dma_consistent = 1;
  178. DPRINTK(KERN_INFO PFX "consistent memory: 0x%lx, played_buf: 0x%lxn",
  179. (unsigned long)b->dma_handle, (unsigned long)b->addr);
  180. } else {
  181. b->dma_consistent = 0;
  182. /* kmalloc()ed memory will HPMC on ccio machines ! */
  183. b->addr = kmalloc(b->len, GFP_KERNEL);
  184. if (!b->addr) {
  185. printk(KERN_ERR PFX "couldn't allocate memoryn");
  186. return -EBUSY;
  187. }
  188. b->dma_handle = __pa(b->addr);
  189. }
  190. return 0;
  191. }
  192. static void __exit harmony_free_buffer(struct harmony_buffer *b)
  193. {
  194. if (!b->addr)
  195. return;
  196. if (b->dma_consistent)
  197. pci_free_consistent(harmony.fake_pci_dev,
  198. b->len, b->addr, b->dma_handle);
  199. else
  200. kfree(b->addr);
  201. memset(b, 0, sizeof(*b));
  202. }
  203. /*
  204.  * Low-Level sound-chip programming
  205.  */
  206. static void __inline__ harmony_wait_CNTL(void)
  207. {
  208. /* Wait until we're out of control mode */
  209. while (gsc_readl(&harmony.hpa->cntl) & CNTL_C)
  210. /* wait */ ;
  211. }
  212. static void harmony_update_control(void) 
  213. {
  214. u32 default_cntl;
  215. /* Set CNTL */
  216. default_cntl = (CNTL_C |   /* The C bit */
  217. (harmony.data_format << 6) | /* Set the data format */
  218. (harmony.stereo_select << 5) | /* Stereo select */
  219. (harmony.sample_rate)); /* Set sample rate */
  220. harmony.format_initialized = 1;
  221. /* initialize CNTL */
  222. gsc_writel(default_cntl, &harmony.hpa->cntl);
  223. }
  224. static void harmony_set_control(u8 data_format, u8 sample_rate, u8 stereo_select) 
  225. {
  226. harmony.sample_rate = sample_rate;
  227. harmony.data_format = data_format;
  228. harmony.stereo_select = stereo_select;
  229. harmony_update_control();
  230. }
  231. static void harmony_set_rate(u8 data_rate) 
  232. {
  233. harmony.sample_rate = data_rate;
  234. harmony_update_control();
  235. }
  236. static int harmony_detect_rate(int *freq)
  237. {
  238. int newrate;
  239. switch (*freq) {
  240. case 8000: newrate = HARMONY_SR_8KHZ; break;
  241. case 16000: newrate = HARMONY_SR_16KHZ; break; 
  242. case 27428: newrate = HARMONY_SR_27KHZ; break; 
  243. case 32000: newrate = HARMONY_SR_32KHZ; break; 
  244. case 48000: newrate = HARMONY_SR_48KHZ; break; 
  245. case 9600: newrate = HARMONY_SR_9KHZ; break; 
  246. case 5125: newrate = HARMONY_SR_5KHZ; break; 
  247. case 11025: newrate = HARMONY_SR_11KHZ; break; 
  248. case 18900: newrate = HARMONY_SR_18KHZ; break; 
  249. case 22050: newrate = HARMONY_SR_22KHZ; break; 
  250. case 37800: newrate = HARMONY_SR_37KHZ; break; 
  251. case 44100: newrate = HARMONY_SR_44KHZ; break; 
  252. case 33075: newrate = HARMONY_SR_33KHZ; break; 
  253. case 6615: newrate = HARMONY_SR_6KHZ; break; 
  254. default: newrate = HARMONY_SR_8KHZ; 
  255. *freq = 8000; break;
  256. }
  257. return newrate;
  258. }
  259. static void harmony_set_format(u8 data_format) 
  260. {
  261. harmony.data_format = data_format;
  262. harmony_update_control();
  263. }
  264. static void harmony_set_stereo(u8 stereo_select) 
  265. {
  266. harmony.stereo_select = stereo_select;
  267. harmony_update_control();
  268. }
  269. static void harmony_disable_interrupts(void) 
  270. {
  271. harmony_wait_CNTL();
  272. gsc_writel(0, &harmony.hpa->dstatus); 
  273. }
  274. static void harmony_enable_interrupts(void) 
  275. {
  276. harmony_wait_CNTL();
  277. gsc_writel(DSTATUS_IE, &harmony.hpa->dstatus); 
  278. }
  279. /*
  280.  * harmony_silence()
  281.  *
  282.  * This subroutine fills in a buffer starting at location start and
  283.  * silences for length bytes.  This references the current
  284.  * configuration of the audio format.
  285.  *
  286.  */
  287. static void harmony_silence(struct harmony_buffer *buffer, int start, int length) 
  288. {
  289. u8 silence_char;
  290. /* Despite what you hear, silence is different in
  291.    different audio formats.  */
  292. switch (harmony.data_format) {
  293. case HARMONY_DF_8BIT_ULAW: silence_char = 0x55; break;
  294. case HARMONY_DF_8BIT_ALAW: silence_char = 0xff; break;
  295. case HARMONY_DF_16BIT_LINEAR: /* fall through */
  296. default: silence_char = 0;
  297. }
  298. memset(buffer->addr+start, silence_char, length);
  299. }
  300. static int harmony_audio_open(struct inode *inode, struct file *file)
  301. {
  302. if (harmony.audio_open) 
  303. return -EBUSY;
  304. harmony.audio_open++;
  305. harmony.suspended_playing = harmony.suspended_recording = 1;
  306. harmony.blocked_playing   = harmony.blocked_recording   = 0;
  307. harmony.first_filled_play = harmony.first_filled_record = 0;
  308. harmony.nb_filled_play    = harmony.nb_filled_record    = 0;
  309. harmony.play_offset = 0;
  310. init_waitqueue_head(&harmony.wq_play);
  311. init_waitqueue_head(&harmony.wq_record);
  312. /* Start off in a balanced mode. */
  313. harmony_set_control(HARMONY_DF_8BIT_ULAW, HARMONY_SR_8KHZ, HARMONY_SS_MONO);
  314. harmony_update_control();
  315. harmony.format_initialized = 0;
  316. /* Clear out all the buffers and flush to cache */
  317. harmony_silence(&played_buf, 0, HARMONY_BUF_SIZE*MAX_BUFS);
  318. CHECK_WBACK_INV_OFFSET(played_buf, 0, HARMONY_BUF_SIZE*MAX_BUFS);
  319. return 0;
  320. }
  321. /*
  322.  * Release (close) the audio device.
  323.  */
  324. static int harmony_audio_release(struct inode *inode, struct file *file)
  325. {
  326. if (!harmony.audio_open) 
  327. return -EBUSY;
  328. harmony.audio_open--;
  329. return 0;
  330. }
  331. /*
  332.  * Read recorded data off the audio device.
  333.  */
  334. static ssize_t harmony_audio_read(struct file *file,
  335.                                 char *buffer,
  336.                                 size_t size_count,
  337.                                 loff_t *ppos)
  338. {
  339. int total_count = (int) size_count;
  340. int count = 0;
  341. int buf_to_read;
  342. while (count<total_count) {
  343. /* Wait until we're out of control mode */
  344. harmony_wait_CNTL();
  345. /* Figure out which buffer to fill in */
  346. if (harmony.nb_filled_record <= 2) {
  347. harmony.blocked_recording = 1;
  348.         if (harmony.suspended_recording) {
  349. harmony.suspended_recording = 0;
  350. harmony_enable_interrupts();
  351. }
  352. interruptible_sleep_on(&harmony.wq_record);
  353. harmony.blocked_recording = 0;
  354. }
  355. if (harmony.nb_filled_record < 2)
  356. return -EBUSY;
  357. buf_to_read = harmony.first_filled_record;
  358. /* Copy the page to an aligned buffer */
  359. copy_to_user(buffer+count, 
  360.      recorded_buf.addr+(HARMONY_BUF_SIZE*buf_to_read), 
  361.      HARMONY_BUF_SIZE);
  362. harmony.nb_filled_record--;
  363. harmony.first_filled_record++;
  364. harmony.first_filled_record %= MAX_BUFS;
  365. count += HARMONY_BUF_SIZE;
  366. }
  367. return count;
  368. }
  369. /*
  370.  * Here is the place where we try to recognize file format.
  371.  * Sun/NeXT .au files begin with the string .snd
  372.  * At offset 12 is specified the encoding.
  373.  * At offset 16 is specified speed rate
  374.  * At Offset 20 is specified the numbers of voices
  375.  */
  376. #define four_bytes_to_u32(start) (file_header[start] << 24)|
  377.                                   (file_header[start+1] << 16)|
  378.                                   (file_header[start+2] << 8)|
  379.                                   (file_header[start+3]);
  380. #define test_rate(tested,real_value,harmony_value) if ((tested)<=(real_value))
  381.                                                     
  382. static void harmony_format_auto_detect(const char *buffer, int block_size)
  383. {
  384. u8 file_header[24];
  385. u32 start_string;
  386. if (block_size>24) {
  387. copy_from_user(file_header, buffer, sizeof(file_header));
  388. start_string = four_bytes_to_u32(0);
  389. if ((file_header[4]==0) && (start_string==0x2E736E64)) {
  390. u32 format;
  391. u32 nb_voices;
  392. u32 speed;
  393. format = four_bytes_to_u32(12);
  394. nb_voices = four_bytes_to_u32(20);
  395. speed = four_bytes_to_u32(16);
  396. switch (format) {
  397. case HARMONY_MAGIC_8B_ULAW:
  398. harmony.data_format = HARMONY_DF_8BIT_ULAW;
  399. break;
  400. case HARMONY_MAGIC_8B_ALAW:
  401. harmony.data_format = HARMONY_DF_8BIT_ALAW;
  402. break;
  403. case HARMONY_MAGIC_16B_LINEAR:
  404. harmony.data_format = HARMONY_DF_16BIT_LINEAR;
  405. break;
  406. default:
  407. harmony_set_control(HARMONY_DF_16BIT_LINEAR,
  408. HARMONY_SR_44KHZ, HARMONY_SS_STEREO);
  409. return;
  410. }
  411. switch (nb_voices) {
  412. case HARMONY_MAGIC_MONO:
  413. harmony.stereo_select = HARMONY_SS_MONO;
  414. break;
  415. case HARMONY_MAGIC_STEREO:
  416. harmony.stereo_select = HARMONY_SS_STEREO;
  417. break;
  418. default:
  419. harmony.stereo_select = HARMONY_SS_MONO;
  420. break;
  421. }
  422. harmony_set_rate(harmony_detect_rate(&speed));
  423. harmony.dac_rate = speed;
  424. return;
  425. }
  426. }
  427. harmony_set_control(HARMONY_DF_8BIT_ULAW, HARMONY_SR_8KHZ, HARMONY_SS_MONO);
  428. }
  429. #undef four_bytes_to_u32
  430. static ssize_t harmony_audio_write(struct file *file,
  431.                                  const char *buffer,
  432.                                  size_t size_count,
  433.                                  loff_t *ppos)
  434. {
  435. int total_count = (int) size_count;
  436. int count = 0;
  437. int frame_size;
  438. int buf_to_fill;
  439. if (!harmony.format_initialized) 
  440.    harmony_format_auto_detect(buffer, total_count);
  441. while (count<total_count) {
  442. /* Wait until we're out of control mode */
  443. harmony_wait_CNTL();
  444. /* Figure out which buffer to fill in */
  445. if (harmony.nb_filled_play+2 >= MAX_BUFS && !harmony.play_offset) {
  446. harmony.blocked_playing = 1;
  447. interruptible_sleep_on(&harmony.wq_play);
  448. harmony.blocked_playing = 0;
  449. }
  450. if (harmony.nb_filled_play+2 >= MAX_BUFS && !harmony.play_offset)
  451. return -EBUSY;
  452. buf_to_fill = (harmony.first_filled_play+harmony.nb_filled_play); 
  453. if (harmony.play_offset)
  454. buf_to_fill--;
  455. buf_to_fill %= MAX_BUFS;
  456. /* Figure out the size of the frame */
  457. if ((total_count-count) > HARMONY_BUF_SIZE - harmony.play_offset) {
  458. frame_size = HARMONY_BUF_SIZE - harmony.play_offset;
  459. } else {
  460. frame_size = total_count - count;
  461. /* Clear out the buffer, since there we'll only be 
  462.    overlaying part of the old buffer with the new one */
  463. harmony_silence(&played_buf, 
  464. HARMONY_BUF_SIZE*buf_to_fill+frame_size+harmony.play_offset,
  465. HARMONY_BUF_SIZE-frame_size-harmony.play_offset);
  466. }
  467. /* Copy the page to an aligned buffer */
  468. copy_from_user(played_buf.addr + (HARMONY_BUF_SIZE*buf_to_fill) + harmony.play_offset, 
  469. buffer+count, frame_size);
  470. CHECK_WBACK_INV_OFFSET(played_buf, (HARMONY_BUF_SIZE*buf_to_fill + harmony.play_offset), 
  471. frame_size);
  472. if (!harmony.play_offset)
  473. harmony.nb_filled_play++;
  474. count += frame_size;
  475. harmony.play_offset += frame_size;
  476. harmony.play_offset %= HARMONY_BUF_SIZE;
  477. if (harmony.suspended_playing && (harmony.nb_filled_play>=4))
  478. harmony_enable_interrupts();
  479. }
  480. return count;
  481. }
  482. static unsigned int harmony_audio_poll(struct file *file,
  483.                                      struct poll_table_struct *wait)
  484. {
  485. unsigned int mask = 0;
  486. if (file->f_mode & FMODE_READ) {
  487. if (!harmony.suspended_recording)
  488. poll_wait(file, &harmony.wq_record, wait);
  489. if (harmony.nb_filled_record)
  490. mask |= POLLIN | POLLRDNORM;
  491. }
  492. if (file->f_mode & FMODE_WRITE) {
  493. if (!harmony.suspended_playing)
  494. poll_wait(file, &harmony.wq_play, wait);
  495. if (harmony.nb_filled_play)
  496. mask |= POLLOUT | POLLWRNORM;
  497. }
  498. return mask;
  499. }
  500. static int harmony_audio_ioctl(struct inode *inode,
  501.                                 struct file *file,
  502. unsigned int cmd,
  503.                                 unsigned long arg)
  504. {
  505. int ival, new_format;
  506. int frag_size, frag_buf;
  507. struct audio_buf_info info;
  508. switch (cmd) {
  509. case OSS_GETVERSION:
  510. return put_user(SOUND_VERSION, (int *) arg);
  511. case SNDCTL_DSP_GETCAPS:
  512. ival = DSP_CAP_DUPLEX;
  513. return put_user(ival, (int *) arg);
  514. case SNDCTL_DSP_GETFMTS:
  515. ival = (AFMT_S16_BE | AFMT_MU_LAW | AFMT_A_LAW ); 
  516. return put_user(ival, (int *) arg);
  517. case SNDCTL_DSP_SETFMT:
  518. if (get_user(ival, (int *) arg)) 
  519. return -EFAULT;
  520. if (ival != AFMT_QUERY) {
  521. switch (ival) {
  522. case AFMT_MU_LAW: new_format = HARMONY_DF_8BIT_ULAW; break;
  523. case AFMT_A_LAW: new_format = HARMONY_DF_8BIT_ALAW; break;
  524. case AFMT_S16_LE: /* fall through, but not really supported */
  525. case AFMT_S16_BE: new_format = HARMONY_DF_16BIT_LINEAR;
  526. ival = AFMT_S16_BE;
  527. break; 
  528. default: {
  529. DPRINTK(KERN_WARNING PFX 
  530. "unsupported sound format 0x%04x requested.n",
  531. ival);
  532. return -EINVAL;
  533. }
  534. }
  535. harmony_set_format(new_format);
  536. } else {
  537. switch (harmony.data_format) {
  538. case HARMONY_DF_8BIT_ULAW: ival = AFMT_MU_LAW; break;
  539. case HARMONY_DF_8BIT_ALAW: ival = AFMT_A_LAW;  break;
  540. case HARMONY_DF_16BIT_LINEAR: ival = AFMT_U16_BE; break;
  541. default: ival = 0;
  542. }
  543. }
  544. return put_user(ival, (int *) arg);
  545. case SOUND_PCM_READ_RATE:
  546. ival = harmony.dac_rate;
  547. return put_user(ival, (int *) arg);
  548. case SNDCTL_DSP_SPEED:
  549. if (get_user(ival, (int *) arg))
  550. return -EFAULT;
  551. harmony_set_rate(harmony_detect_rate(&ival));
  552. harmony.dac_rate = ival;
  553. return put_user(ival, (int*) arg);
  554. case SNDCTL_DSP_STEREO:
  555. if (get_user(ival, (int *) arg))
  556. return -EFAULT;
  557. if (ival != 0 && ival != 1)
  558. return -EINVAL;
  559. harmony_set_stereo(ival);
  560. return put_user(ival, (int *) arg);
  561. case SNDCTL_DSP_GETBLKSIZE:
  562. ival = HARMONY_BUF_SIZE;
  563. return put_user(ival, (int *) arg);
  564.         case SNDCTL_DSP_NONBLOCK:
  565.                 file->f_flags |= O_NONBLOCK;
  566.                 return 0;
  567.         case SNDCTL_DSP_RESET:
  568. if (!harmony.suspended_recording) {
  569. /* TODO: stop_recording() */
  570. }
  571. return 0;
  572. case SNDCTL_DSP_SETFRAGMENT:
  573. if (get_user(ival, (int *)arg))
  574. return -EFAULT;
  575. frag_size = ival & 0xffff;
  576. frag_buf = (ival>>16) & 0xffff;
  577. /* TODO: We use hardcoded fragment sizes and numbers for now */
  578. frag_size = 12;  /* 4096 == 2^12 */
  579. frag_buf  = MAX_BUFS;
  580. ival = (frag_buf << 16) + frag_size;
  581. return put_user(ival, (int *) arg);
  582. case SNDCTL_DSP_GETOSPACE:
  583. if (!(file->f_mode & FMODE_WRITE))
  584. return -EINVAL;
  585. info.fragstotal = MAX_BUFS;
  586.                 info.fragments = MAX_BUFS - harmony.nb_filled_play;
  587. info.fragsize = HARMONY_BUF_SIZE;
  588.                 info.bytes = info.fragments * info.fragsize;
  589. return copy_to_user((void *)arg, &info, sizeof(info));
  590. case SNDCTL_DSP_GETISPACE:
  591. if (!(file->f_mode & FMODE_READ))
  592. return -EINVAL;
  593. info.fragstotal = MAX_BUFS;
  594.                 info.fragments = /*MAX_BUFS-*/ harmony.nb_filled_record;
  595. info.fragsize = HARMONY_BUF_SIZE;
  596.                 info.bytes = info.fragments * info.fragsize;
  597. return copy_to_user((void *)arg, &info, sizeof(info));
  598. case SNDCTL_DSP_SYNC:
  599. return 0;
  600. }
  601. return -EINVAL;
  602. }
  603. /*
  604.  * harmony_interrupt()
  605.  *
  606.  * harmony interruption service routine
  607.  * 
  608.  */
  609. static void harmony_interrupt(int irq, void *dev, struct pt_regs *regs)
  610. {
  611. u32 dstatus;
  612. struct harmony_hpa *hpa;
  613. /* Setup the hpa */
  614. hpa = ((struct harmony_dev *)dev)->hpa;
  615. harmony_wait_CNTL();
  616. /* Read dstatus and pcuradd (the current address) */
  617. dstatus = gsc_readl(&hpa->dstatus);
  618. /* Turn off interrupts */
  619. harmony_disable_interrupts();
  620. /* Check if this is a request to get the next play buffer */
  621. if (dstatus & DSTATUS_PN) {
  622. if (!harmony.nb_filled_play) {
  623. harmony.suspended_playing = 1;
  624. gsc_writel((unsigned long)silent.dma_handle, &hpa->pnxtadd);
  625. if (!harmony.suspended_recording)
  626. harmony_enable_interrupts();
  627. } else {
  628. harmony.suspended_playing = 0;
  629. gsc_writel((unsigned long)played_buf.dma_handle + 
  630. (HARMONY_BUF_SIZE*harmony.first_filled_play),
  631. &hpa->pnxtadd);
  632. harmony.first_filled_play++;
  633. harmony.first_filled_play %= MAX_BUFS;
  634. harmony.nb_filled_play--;
  635.         harmony_enable_interrupts();
  636. }
  637. if (harmony.blocked_playing)
  638. wake_up_interruptible(&harmony.wq_play);
  639. }
  640. /* Check if we're being asked to fill in a recording buffer */
  641. if (dstatus & DSTATUS_RN) {
  642. if((harmony.nb_filled_record+2>=MAX_BUFS) || harmony.suspended_recording)
  643. {
  644. harmony.nb_filled_record = 0;
  645. harmony.first_filled_record = 0;
  646. harmony.suspended_recording = 1;
  647. gsc_writel((unsigned long)graveyard.dma_handle, &hpa->rnxtadd);
  648. if (!harmony.suspended_playing)
  649. harmony_enable_interrupts();
  650. } else {
  651. int buf_to_fill;
  652. buf_to_fill = (harmony.first_filled_record+harmony.nb_filled_record) % MAX_BUFS;
  653. CHECK_WBACK_INV_OFFSET(recorded_buf, HARMONY_BUF_SIZE*buf_to_fill, HARMONY_BUF_SIZE);
  654. gsc_writel((unsigned long)recorded_buf.dma_handle +
  655. HARMONY_BUF_SIZE*buf_to_fill,
  656. &hpa->rnxtadd);
  657. harmony.nb_filled_record++;
  658. harmony_enable_interrupts();
  659. }
  660. if (harmony.blocked_recording && harmony.nb_filled_record>3)
  661. wake_up_interruptible(&harmony.wq_record);
  662. }
  663. }
  664. /*
  665.  * Sound playing functions
  666.  */
  667. static struct file_operations harmony_audio_fops = {
  668. owner: THIS_MODULE,
  669. llseek: no_llseek,
  670. read:  harmony_audio_read,
  671. write: harmony_audio_write,
  672. poll:  harmony_audio_poll,
  673. ioctl:  harmony_audio_ioctl,
  674. open:  harmony_audio_open,
  675. release:harmony_audio_release,
  676. };
  677. static int harmony_audio_init(void)
  678. {
  679. /* Request that IRQ */
  680. if (request_irq(harmony.irq, harmony_interrupt, 0 ,"harmony", &harmony)) {
  681. printk(KERN_ERR PFX "Error requesting irq %d.n", harmony.irq);
  682. return -EFAULT;
  683. }
  684.     harmony.dsp_unit = register_sound_dsp(&harmony_audio_fops, -1);
  685. if (harmony.dsp_unit < 0) {
  686. printk(KERN_ERR PFX "Error registering dspn");
  687. free_irq(harmony.irq, &harmony);
  688. return -EFAULT;
  689. }
  690. /* Clear the buffers so you don't end up with crap in the buffers. */ 
  691. harmony_silence(&played_buf, 0, HARMONY_BUF_SIZE*MAX_BUFS);
  692. /* Make sure this makes it to cache */
  693. CHECK_WBACK_INV_OFFSET(played_buf, 0, HARMONY_BUF_SIZE*MAX_BUFS);
  694. /* Clear out the silent buffer and flush to cache */
  695. harmony_silence(&silent, 0, HARMONY_BUF_SIZE);
  696. CHECK_WBACK_INV_OFFSET(silent, 0, HARMONY_BUF_SIZE);
  697. harmony.audio_open = 0;
  698. return 0;
  699. }
  700. /*
  701.  * mixer functions 
  702.  */
  703. static void harmony_mixer_set_gain(void)
  704. {
  705. harmony_wait_CNTL();
  706. gsc_writel(harmony.current_gain, &harmony.hpa->gainctl);
  707. }
  708. /* 
  709.  *  Read gain of selected channel.
  710.  *  The OSS rate is from 0 (silent) to 100 -> need some conversions
  711.  *
  712.  *  The harmony gain are attenuation for output and monitor gain.
  713.  *                   is amplifaction for input gain
  714.  */
  715. #define to_harmony_level(level,max) ((level)*max/100)
  716. #define to_oss_level(level,max) ((level)*100/max)
  717. static int harmony_mixer_get_level(int channel)
  718. {
  719. int left_level;
  720. int right_level;
  721. switch (channel) {
  722. case SOUND_MIXER_OGAIN:
  723. left_level  = (harmony.current_gain & GAIN_LO_MASK) >> GAIN_LO_SHIFT;
  724. right_level = (harmony.current_gain & GAIN_RO_MASK) >> GAIN_RO_SHIFT;
  725. left_level  = to_oss_level(MAX_OUTPUT_LEVEL - left_level, MAX_OUTPUT_LEVEL);
  726. right_level = to_oss_level(MAX_OUTPUT_LEVEL - right_level, MAX_OUTPUT_LEVEL);
  727. return (right_level << 8)+left_level;
  728. case SOUND_MIXER_IGAIN:
  729. left_level = (harmony.current_gain & GAIN_LI_MASK) >> GAIN_LI_SHIFT;
  730. right_level= (harmony.current_gain & GAIN_RI_MASK) >> GAIN_RI_SHIFT;
  731. left_level = to_oss_level(left_level, MAX_INPUT_LEVEL);
  732. right_level= to_oss_level(right_level, MAX_INPUT_LEVEL);
  733. return (right_level << 8)+left_level;
  734. case SOUND_MIXER_VOLUME:
  735. left_level = (harmony.current_gain & GAIN_MA_MASK) >> GAIN_MA_SHIFT;
  736. left_level = to_oss_level(MAX_VOLUME_LEVEL-left_level, MAX_VOLUME_LEVEL);
  737. return left_level;
  738. }
  739. return -EINVAL;
  740. }
  741. /*
  742.  * Some conversions for the same reasons.
  743.  * We give back the new real value(s) due to
  744.  * the rescale.
  745.  */
  746. static int harmony_mixer_set_level(int channel, int value)
  747. {
  748. int left_level;
  749. int right_level;
  750. int new_left_level;
  751. int new_right_level;
  752. right_level = (value & 0x0000ff00) >> 8;
  753. left_level = value & 0x000000ff;
  754.   
  755. switch (channel) {
  756. case SOUND_MIXER_OGAIN:
  757. right_level = to_harmony_level(100-right_level, MAX_OUTPUT_LEVEL);
  758. left_level  = to_harmony_level(100-left_level, MAX_OUTPUT_LEVEL);
  759. new_right_level = to_oss_level(MAX_OUTPUT_LEVEL - right_level, MAX_OUTPUT_LEVEL);
  760. new_left_level  = to_oss_level(MAX_OUTPUT_LEVEL - left_level, MAX_OUTPUT_LEVEL);
  761. harmony.current_gain = (harmony.current_gain & ~(GAIN_LO_MASK | GAIN_RO_MASK)) 
  762. | (left_level << GAIN_LO_SHIFT) | (right_level << GAIN_RO_SHIFT);
  763. harmony_mixer_set_gain();
  764. return (new_right_level << 8) + new_left_level;
  765. case SOUND_MIXER_IGAIN:
  766. right_level = to_harmony_level(right_level, MAX_INPUT_LEVEL);
  767. left_level  = to_harmony_level(left_level, MAX_INPUT_LEVEL);
  768. new_right_level = to_oss_level(right_level, MAX_INPUT_LEVEL);
  769. new_left_level  = to_oss_level(left_level, MAX_INPUT_LEVEL);
  770. harmony.current_gain = (harmony.current_gain & ~(GAIN_LI_MASK | GAIN_RI_MASK))
  771. | (left_level << GAIN_LI_SHIFT) | (right_level << GAIN_RI_SHIFT);
  772. harmony_mixer_set_gain();
  773. return (new_right_level << 8) + new_left_level;
  774. case SOUND_MIXER_VOLUME:
  775. left_level = to_harmony_level(100-left_level, MAX_VOLUME_LEVEL);
  776. new_left_level = to_oss_level(MAX_VOLUME_LEVEL-left_level, MAX_VOLUME_LEVEL);
  777. harmony.current_gain = (harmony.current_gain & ~GAIN_MA_MASK)| (left_level << GAIN_MA_SHIFT);
  778. harmony_mixer_set_gain();
  779. return new_left_level;
  780. }
  781. return -EINVAL;
  782. }
  783. #undef to_harmony_level
  784. #undef to_oss_level
  785. /* 
  786.  * Return the selected input device (mic or line)
  787.  */
  788. static int harmony_mixer_get_recmask(void) 
  789. {
  790. int current_input_line;
  791. current_input_line = (harmony.current_gain & GAIN_IS_MASK) 
  792.     >> GAIN_IS_SHIFT;
  793. if (current_input_line) 
  794. return SOUND_MASK_MIC;
  795. return SOUND_MASK_LINE;
  796. }
  797. /*
  798.  * Set the input (only one at time, arbitrary priority to line in)
  799.  */
  800. static int harmony_mixer_set_recmask(int recmask)
  801. {
  802. int new_input_line;
  803. int new_input_mask;
  804. if ((recmask & SOUND_MASK_LINE)) {
  805. new_input_line = 0;
  806. new_input_mask = SOUND_MASK_LINE;
  807. } else  {
  808. new_input_line = 1;
  809. new_input_mask = SOUND_MASK_MIC;
  810. }
  811. harmony.current_gain = ((harmony.current_gain & ~GAIN_IS_MASK) | 
  812. (new_input_line << GAIN_IS_SHIFT ));
  813. harmony_mixer_set_gain();
  814. return new_input_mask;
  815. }
  816. /* 
  817.  * give the active outlines
  818.  */
  819. static int harmony_mixer_get_outmask(void)
  820. {
  821. int outmask = 0;
  822. if (harmony.current_gain & GAIN_HE_MASK) outmask |=SOUND_MASK_PHONEOUT;
  823. if (harmony.current_gain & GAIN_LE_MASK) outmask |=SOUND_MASK_LINE;
  824. if (harmony.current_gain & GAIN_SE_MASK) outmask |=SOUND_MASK_SPEAKER;
  825. return outmask;
  826. }
  827. static int harmony_mixer_set_outmask(int outmask)
  828. {
  829. if (outmask & SOUND_MASK_PHONEOUT) 
  830. harmony.current_gain |= GAIN_HE_MASK; 
  831. else 
  832. harmony.current_gain &= ~GAIN_HE_MASK;
  833. if (outmask & SOUND_MASK_LINE) 
  834. harmony.current_gain |= GAIN_LE_MASK;
  835. else 
  836. harmony.current_gain &= ~GAIN_LE_MASK;
  837. if (outmask & SOUND_MASK_SPEAKER) 
  838. harmony.current_gain |= GAIN_SE_MASK;
  839. else 
  840. harmony.current_gain &= ~GAIN_SE_MASK;
  841. harmony_mixer_set_gain();
  842. return (outmask & (SOUND_MASK_PHONEOUT | SOUND_MASK_LINE | SOUND_MASK_SPEAKER));
  843. }
  844. /*
  845.  * This code is inspired from sb_mixer.c
  846.  */
  847. static int harmony_mixer_ioctl(struct inode * inode, struct file * file,
  848. unsigned int cmd, unsigned long arg)
  849. {
  850. int val;
  851. int ret;
  852. if (cmd == SOUND_MIXER_INFO) {
  853. mixer_info info;
  854. memset(&info, 0, sizeof(info));
  855.                 strncpy(info.id, "harmony", sizeof(info.id)-1);
  856.                 strncpy(info.name, "Harmony audio", sizeof(info.name)-1);
  857.                 info.modify_counter = 1; /* ? */
  858.                 if (copy_to_user((void *)arg, &info, sizeof(info)))
  859.                         return -EFAULT;
  860. return 0;
  861. }
  862. if (cmd == OSS_GETVERSION)
  863. return put_user(SOUND_VERSION, (int *)arg);
  864. /* read */
  865. val = 0;
  866. if (_SIOC_DIR(cmd) & _SIOC_WRITE)
  867. if (get_user(val, (int *)arg))
  868. return -EFAULT;
  869. switch (cmd) {
  870. case MIXER_READ(SOUND_MIXER_CAPS):
  871. ret = SOUND_CAP_EXCL_INPUT;
  872. break;
  873. case MIXER_READ(SOUND_MIXER_STEREODEVS):
  874. ret = SOUND_MASK_IGAIN | SOUND_MASK_OGAIN;
  875. break;
  876. case MIXER_READ(SOUND_MIXER_RECMASK):
  877. ret = SOUND_MASK_MIC | SOUND_MASK_LINE;
  878. break;
  879. case MIXER_READ(SOUND_MIXER_DEVMASK):
  880. ret = SOUND_MASK_OGAIN | SOUND_MASK_IGAIN |
  881. SOUND_MASK_VOLUME;
  882. break;
  883. case MIXER_READ(SOUND_MIXER_OUTMASK):
  884. ret = SOUND_MASK_SPEAKER | SOUND_MASK_LINE |
  885. SOUND_MASK_PHONEOUT;
  886. break;
  887. case MIXER_WRITE(SOUND_MIXER_RECSRC):
  888. ret = harmony_mixer_set_recmask(val);
  889. break;
  890. case MIXER_READ(SOUND_MIXER_RECSRC):
  891. ret = harmony_mixer_get_recmask();
  892. break;
  893.       
  894. case MIXER_WRITE(SOUND_MIXER_OUTSRC):
  895. ret = harmony_mixer_set_outmask(val);
  896. break;
  897. case MIXER_READ(SOUND_MIXER_OUTSRC):
  898. ret = harmony_mixer_get_outmask();
  899. break;
  900. case MIXER_WRITE(SOUND_MIXER_OGAIN):
  901. case MIXER_WRITE(SOUND_MIXER_IGAIN):
  902. case MIXER_WRITE(SOUND_MIXER_VOLUME):
  903. ret = harmony_mixer_set_level(cmd & 0xff, val);
  904. break;
  905. case MIXER_READ(SOUND_MIXER_OGAIN):
  906. case MIXER_READ(SOUND_MIXER_IGAIN):
  907. case MIXER_READ(SOUND_MIXER_VOLUME):
  908. ret = harmony_mixer_get_level(cmd & 0xff);
  909. break;
  910. default:
  911. return -EINVAL;
  912. }
  913. if (put_user(ret, (int *)arg))
  914. return -EFAULT;
  915. return 0;
  916. }
  917. static int harmony_mixer_open(struct inode *inode, struct file *file)
  918. {
  919. if (harmony.mixer_open) 
  920. return -EBUSY;
  921. harmony.mixer_open++;
  922. return 0;
  923. }
  924. static int harmony_mixer_release(struct inode *inode, struct file *file)
  925. {
  926. if (!harmony.mixer_open) 
  927. return -EBUSY;
  928. harmony.mixer_open--;
  929. return 0;
  930. }
  931. static struct file_operations harmony_mixer_fops = {
  932. owner: THIS_MODULE,
  933. llseek: no_llseek,
  934. open: harmony_mixer_open,
  935. release: harmony_mixer_release,
  936. ioctl: harmony_mixer_ioctl,
  937. };
  938. /*
  939.  * Mute all the output and reset Harmony.
  940.  */
  941. static void __init harmony_mixer_reset(void)
  942. {
  943. harmony.current_gain = GAIN_TOTAL_SILENCE;
  944. harmony_mixer_set_gain();
  945. harmony_wait_CNTL();
  946. gsc_writel(1, &harmony.hpa->reset);
  947. mdelay(50); /* wait 50 ms */
  948. gsc_writel(0, &harmony.hpa->reset);
  949. harmony.current_gain = GAIN_DEFAULT;
  950. harmony_mixer_set_gain();
  951. }
  952. static int __init harmony_mixer_init(void)
  953. {
  954. /* Register the device file operations */
  955. harmony.mixer_unit = register_sound_mixer(&harmony_mixer_fops, -1);
  956. if (harmony.mixer_unit < 0) {
  957. printk(KERN_WARNING PFX "Error Registering Mixer Drivern");
  958. return -EFAULT;
  959. }
  960.   
  961. harmony_mixer_reset();
  962. harmony.mixer_open = 0;
  963. return 0;
  964. }
  965. /* 
  966.  * This is the callback that's called by the inventory hardware code 
  967.  * if it finds a match to the registered driver. 
  968.  */
  969. static int __init
  970. harmony_driver_callback(struct parisc_device *dev)
  971. {
  972. u8 id;
  973. u8 rev;
  974. u32 cntl;
  975. int ret;
  976. if (harmony.hpa) {
  977. /* We only support one Harmony at this time */
  978. printk(KERN_ERR PFX "driver already registeredn");
  979. return -EBUSY;
  980. }
  981. /* Set the HPA of harmony */
  982. harmony.hpa = (struct harmony_hpa *)dev->hpa;
  983. harmony.irq = dev->irq;
  984. if (!harmony.irq) {
  985. printk(KERN_ERR PFX "no irq foundn");
  986. return -ENODEV;
  987. }
  988. /* Grab the ID and revision from the device */
  989. id = gsc_readb(&harmony.hpa->id);
  990. if ((id | 1) != 0x15) {
  991. printk(KERN_WARNING PFX "wrong harmony id 0x%02xn", id);
  992. return -EBUSY;
  993. }
  994. cntl = gsc_readl(&harmony.hpa->cntl);
  995. rev = (cntl>>20) & 0xff;
  996. printk(KERN_INFO "Lasi Harmony Audio driver " HARMONY_VERSION ", "
  997. "h/w id %i, rev. %i at 0x%lx, IRQ %in",
  998. id, rev, dev->hpa, harmony.irq);
  999. /* Make sure the control bit isn't set, although I don't think it 
  1000.    ever is. */
  1001. if (cntl & CNTL_C) {
  1002. printk(KERN_WARNING PFX "CNTL busyn");
  1003. harmony.hpa = 0;
  1004. return -EBUSY;
  1005. }
  1006. /* a fake pci_dev is needed for pci_* functions under ccio */
  1007. harmony.fake_pci_dev = ccio_get_fake(dev);
  1008. /* Initialize the memory buffers */
  1009. if (harmony_alloc_buffer(&played_buf, MAX_BUFS) || 
  1010.     harmony_alloc_buffer(&recorded_buf, MAX_BUFS) ||
  1011.     harmony_alloc_buffer(&graveyard, 1) ||
  1012.     harmony_alloc_buffer(&silent, 1)) {
  1013. ret = -EBUSY;
  1014. goto out_err;
  1015. }
  1016. /* Initialize /dev/mixer and /dev/audio  */
  1017. if ((ret=harmony_mixer_init())) 
  1018. goto out_err;
  1019. if ((ret=harmony_audio_init())) 
  1020. goto out_err;
  1021. return 0;
  1022. out_err:
  1023. harmony.hpa = 0;
  1024. harmony_free_buffer(&played_buf);
  1025. harmony_free_buffer(&recorded_buf);
  1026. harmony_free_buffer(&graveyard);
  1027. harmony_free_buffer(&silent);
  1028. return ret;
  1029. }
  1030. static struct parisc_device_id harmony_tbl[] = {
  1031.  /* { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007A }, Bushmaster/Flounder */
  1032.  { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007B }, /* 712/715 Audio */
  1033.  { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007E }, /* Pace Audio */
  1034.  { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007F }, /* Outfield / Coral II */
  1035.  { 0, }
  1036. };
  1037. MODULE_DEVICE_TABLE(parisc, harmony_tbl);
  1038. static struct parisc_driver harmony_driver = {
  1039. name: "Lasi Harmony",
  1040. id_table: harmony_tbl,
  1041. probe: harmony_driver_callback,
  1042. };
  1043. static int __init init_harmony(void)
  1044. {
  1045. return register_parisc_driver(&harmony_driver);
  1046. }
  1047. static void __exit cleanup_harmony(void)
  1048. {
  1049. free_irq(harmony.irq, &harmony);
  1050. unregister_sound_mixer(harmony.mixer_unit);
  1051. unregister_sound_dsp(harmony.dsp_unit);
  1052. harmony_free_buffer(&played_buf);
  1053. harmony_free_buffer(&recorded_buf);
  1054. harmony_free_buffer(&graveyard);
  1055. harmony_free_buffer(&silent);
  1056. unregister_parisc_driver(&harmony_driver);
  1057. }
  1058. EXPORT_NO_SYMBOLS;
  1059. MODULE_AUTHOR("Alex DeVries <alex@linuxcare.com>");
  1060. MODULE_DESCRIPTION("Harmony sound driver");
  1061. MODULE_LICENSE("GPL");
  1062. module_init(init_harmony);
  1063. module_exit(cleanup_harmony);