1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Audio support for PS3
4 * Copyright (C) 2007 Sony Computer Entertainment Inc.
6 * Copyright 2006, 2007 Sony Corporation
9 #if !defined(_SND_PS3_H_)
12 #include <linux/irqreturn.h>
14 #define SND_PS3_DRIVER_NAME "snd_ps3"
16 enum snd_ps3_out_channel
{
23 enum snd_ps3_dma_filltype
{
24 SND_PS3_DMA_FILLTYPE_FIRSTFILL
,
25 SND_PS3_DMA_FILLTYPE_RUNNING
,
26 SND_PS3_DMA_FILLTYPE_SILENT_FIRSTFILL
,
27 SND_PS3_DMA_FILLTYPE_SILENT_RUNNING
36 struct snd_ps3_avsetting_info
{
37 uint32_t avs_audio_ch
; /* fixed */
38 uint32_t avs_audio_rate
;
39 uint32_t avs_audio_width
;
40 uint32_t avs_audio_format
; /* fixed */
41 uint32_t avs_audio_source
; /* fixed */
42 unsigned char avs_cs_info
[8];
45 * PS3 audio 'card' instance
46 * there should be only ONE hardware.
48 struct snd_ps3_card_info
{
49 struct ps3_system_bus_device
*ps3_dev
;
50 struct snd_card
*card
;
53 struct snd_pcm_substream
*substream
;
60 void __iomem
*mapped_mmio_vaddr
;
66 /* remember avsetting */
67 struct snd_ps3_avsetting_info avs
;
69 /* dma buffer management */
72 void * dma_start_vaddr
[2]; /* 0 for L, 1 for R */
73 dma_addr_t dma_start_bus_addr
[2];
74 size_t dma_buffer_size
;
75 void * dma_last_transfer_vaddr
[2];
76 void * dma_next_transfer_vaddr
[2];
83 void *null_buffer_start_vaddr
;
84 dma_addr_t null_buffer_start_dma_addr
;
87 unsigned int start_delay
;
92 /* PS3 audio DMAC block size in bytes */
93 #define PS3_AUDIO_DMAC_BLOCK_SIZE (128)
94 /* one stage (stereo) of audio FIFO in bytes */
95 #define PS3_AUDIO_FIFO_STAGE_SIZE (256)
96 /* how many stages the fifo have */
97 #define PS3_AUDIO_FIFO_STAGE_COUNT (8)
98 /* fifo size 128 bytes * 8 stages * stereo (2ch) */
99 #define PS3_AUDIO_FIFO_SIZE \
100 (PS3_AUDIO_FIFO_STAGE_SIZE * PS3_AUDIO_FIFO_STAGE_COUNT)
102 /* PS3 audio DMAC max block count in one dma shot = 128 (0x80) blocks*/
103 #define PS3_AUDIO_DMAC_MAX_BLOCKS (PS3_AUDIO_DMASIZE_BLOCKS_MASK + 1)
105 #define PS3_AUDIO_NORMAL_DMA_START_CH (0)
106 #define PS3_AUDIO_NORMAL_DMA_COUNT (8)
107 #define PS3_AUDIO_NULL_DMA_START_CH \
108 (PS3_AUDIO_NORMAL_DMA_START_CH + PS3_AUDIO_NORMAL_DMA_COUNT)
109 #define PS3_AUDIO_NULL_DMA_COUNT (2)
111 #define SND_PS3_MAX_VOL (0x0F)
112 #define SND_PS3_MIN_VOL (0x00)
113 #define SND_PS3_MIN_ATT SND_PS3_MIN_VOL
114 #define SND_PS3_MAX_ATT SND_PS3_MAX_VOL
116 #define SND_PS3_PCM_PREALLOC_SIZE \
117 (PS3_AUDIO_DMAC_BLOCK_SIZE * PS3_AUDIO_DMAC_MAX_BLOCKS * 4)
119 #define SND_PS3_DMA_REGION_SIZE \
120 (SND_PS3_PCM_PREALLOC_SIZE + PAGE_SIZE)
122 #define PS3_AUDIO_IOID (1UL)
124 #endif /* _SND_PS3_H_ */