m68knommu: remove local gettimeofday code
[wrt350n-kernel.git] / sound / ppc / snd_ps3.h
blob4b7e6fbbe5005769b6dbd059d1181ec5f5d44873
1 /*
2 * Audio support for PS3
3 * Copyright (C) 2007 Sony Computer Entertainment Inc.
4 * All rights reserved.
5 * Copyright 2006, 2007 Sony Corporation
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2 of the Licence.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #if !defined(_SND_PS3_H_)
22 #define _SND_PS3_H_
24 #include <linux/irqreturn.h>
26 #define SND_PS3_DRIVER_NAME "snd_ps3"
28 enum snd_ps3_out_channel {
29 SND_PS3_OUT_SPDIF_0,
30 SND_PS3_OUT_SPDIF_1,
31 SND_PS3_OUT_SERIAL_0,
32 SND_PS3_OUT_DEVS
35 enum snd_ps3_dma_filltype {
36 SND_PS3_DMA_FILLTYPE_FIRSTFILL,
37 SND_PS3_DMA_FILLTYPE_RUNNING,
38 SND_PS3_DMA_FILLTYPE_SILENT_FIRSTFILL,
39 SND_PS3_DMA_FILLTYPE_SILENT_RUNNING
42 enum snd_ps3_ch {
43 SND_PS3_CH_L = 0,
44 SND_PS3_CH_R = 1,
45 SND_PS3_CH_MAX = 2
48 struct snd_ps3_avsetting_info {
49 uint32_t avs_audio_ch; /* fixed */
50 uint32_t avs_audio_rate;
51 uint32_t avs_audio_width;
52 uint32_t avs_audio_format; /* fixed */
53 uint32_t avs_audio_source; /* fixed */
56 * PS3 audio 'card' instance
57 * there should be only ONE hardware.
59 struct snd_ps3_card_info {
60 struct ps3_system_bus_device *ps3_dev;
61 struct snd_card *card;
63 struct snd_pcm *pcm;
64 struct snd_pcm_substream *substream;
66 /* hvc info */
67 u64 audio_lpar_addr;
68 u64 audio_lpar_size;
70 /* registers */
71 void __iomem *mapped_mmio_vaddr;
73 /* irq */
74 u64 audio_irq_outlet;
75 unsigned int irq_no;
77 /* remember avsetting */
78 struct snd_ps3_avsetting_info avs;
80 /* dma buffer management */
81 spinlock_t dma_lock;
82 /* dma_lock start */
83 void * dma_start_vaddr[2]; /* 0 for L, 1 for R */
84 dma_addr_t dma_start_bus_addr[2];
85 size_t dma_buffer_size;
86 void * dma_last_transfer_vaddr[2];
87 void * dma_next_transfer_vaddr[2];
88 int silent;
89 /* dma_lock end */
91 int running;
93 /* null buffer */
94 void *null_buffer_start_vaddr;
95 dma_addr_t null_buffer_start_dma_addr;
97 /* start delay */
98 unsigned int start_delay;
103 /* PS3 audio DMAC block size in bytes */
104 #define PS3_AUDIO_DMAC_BLOCK_SIZE (128)
105 /* one stage (stereo) of audio FIFO in bytes */
106 #define PS3_AUDIO_FIFO_STAGE_SIZE (256)
107 /* how many stages the fifo have */
108 #define PS3_AUDIO_FIFO_STAGE_COUNT (8)
109 /* fifo size 128 bytes * 8 stages * stereo (2ch) */
110 #define PS3_AUDIO_FIFO_SIZE \
111 (PS3_AUDIO_FIFO_STAGE_SIZE * PS3_AUDIO_FIFO_STAGE_COUNT)
113 /* PS3 audio DMAC max block count in one dma shot = 128 (0x80) blocks*/
114 #define PS3_AUDIO_DMAC_MAX_BLOCKS (PS3_AUDIO_DMASIZE_BLOCKS_MASK + 1)
116 #define PS3_AUDIO_NORMAL_DMA_START_CH (0)
117 #define PS3_AUDIO_NORMAL_DMA_COUNT (8)
118 #define PS3_AUDIO_NULL_DMA_START_CH \
119 (PS3_AUDIO_NORMAL_DMA_START_CH + PS3_AUDIO_NORMAL_DMA_COUNT)
120 #define PS3_AUDIO_NULL_DMA_COUNT (2)
122 #define SND_PS3_MAX_VOL (0x0F)
123 #define SND_PS3_MIN_VOL (0x00)
124 #define SND_PS3_MIN_ATT SND_PS3_MIN_VOL
125 #define SND_PS3_MAX_ATT SND_PS3_MAX_VOL
127 #define SND_PS3_PCM_PREALLOC_SIZE \
128 (PS3_AUDIO_DMAC_BLOCK_SIZE * PS3_AUDIO_DMAC_MAX_BLOCKS * 4)
130 #define SND_PS3_DMA_REGION_SIZE \
131 (SND_PS3_PCM_PREALLOC_SIZE + PAGE_SIZE)
133 #define PS3_AUDIO_IOID (1UL)
135 #endif /* _SND_PS3_H_ */