2 * linux/sound/oss/omap-audio.h
4 * Common audio handling for the OMAP processors
6 * Copyright (C) 2004 Texas Instruments, Inc.
8 * Copyright (C) 2000, 2001 Nicolas Pitre <nico@cam.org>
10 * This package is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 * 2004/08/12 Nishanth Menon - Modified to integrate Audio requirements on 1610,1710 platforms
22 * 2004/04/04 Nishanth menon - Added hooks for power management
25 #ifndef __OMAP_AUDIO_H
26 #define __OMAP_AUDIO_H
29 #include <asm/arch/dma.h>
35 int offset; /* current offset */
36 char *data; /* points to actual buffer */
37 dma_addr_t dma_addr; /* physical buffer address */
38 int dma_ref; /* DMA refcount */
39 int master; /* owner for buffer allocation, contain size when true */
43 * Structure describing the data stream related information
46 char *id; /* identification string */
47 audio_buf_t *buffers; /* pointer to audio buffer structures */
48 u_int usr_head; /* user fragment index */
49 u_int dma_head; /* DMA fragment index to go */
50 u_int dma_tail; /* DMA fragment index to complete */
51 u_int fragsize; /* fragment i.e. buffer size */
52 u_int nbfrags; /* nbr of fragments i.e. buffers */
53 u_int pending_frags; /* Fragments sent to DMA */
54 int dma_dev; /* device identifier for DMA */
56 #ifdef OMAP_DMA_CHAINING_SUPPORT
58 dma_regs_t *dma_regs; /* points to our DMA registers */
60 char started; /* to store if the chain was started or not */
61 int dma_q_head; /* DMA Channel Q Head */
62 int dma_q_tail; /* DMA Channel Q Tail */
63 char dma_q_count; /* DMA Channel Q Count */
64 char in_use; /* Is this is use? */
65 int *lch; /* Chain of channels this stream is linked to */
67 int input_or_output; /* Direction of this data stream */
68 int bytecount; /* nbr of processed bytes */
69 int fragcount; /* nbr of fragment transitions */
70 struct semaphore sem; /* account for fragment usage */
71 wait_queue_head_t wq; /* for poll */
72 int dma_spinref; /* DMA is spinning */
73 unsigned mapped:1; /* mmap()'ed buffers */
74 unsigned active:1; /* actually in progress */
75 unsigned stopped:1; /* might be active but stopped */
76 unsigned spin_idle:1; /* have DMA spin on zeros when idle */
77 unsigned linked:1; /* dma channels linked */
81 * State structure for one instance
84 struct module *owner; /* Codec module ID */
85 audio_stream_t *output_stream;
86 audio_stream_t *input_stream;
87 unsigned rd_ref:1; /* open reference for recording */
88 unsigned wr_ref:1; /* open reference for playback */
89 unsigned need_tx_for_rx:1; /* if data must be sent while receiving */
91 void (*hw_init) (void *);
92 void (*hw_shutdown) (void *);
93 int (*client_ioctl) (struct inode *, struct file *, uint, ulong);
94 int (*hw_probe) (void);
95 void (*hw_remove) (void);
96 void (*hw_cleanup) (void);
97 int (*hw_suspend) (void);
98 int (*hw_resume) (void);
99 struct pm_dev *pm_dev;
100 struct semaphore sem; /* to protect against races in attach() */
104 void audio_ldm_suspend(void *data);
106 void audio_ldm_resume(void *data);
110 /* Register a Codec using this function */
111 extern int audio_register_codec(audio_state_t * codec_state);
112 /* Un-Register a Codec using this function */
113 extern int audio_unregister_codec(audio_state_t * codec_state);
114 /* Function to provide fops of omap audio driver */
115 extern struct file_operations *audio_get_fops(void);
116 /* Function to initialize the device info for audio driver */
117 extern int audio_dev_init(void);
118 /* Function to un-initialize the device info for audio driver */
119 void audio_dev_uninit(void);
121 #endif /* End of #ifndef __OMAP_AUDIO_H */