1 /* SPDX-License-Identifier: GPL-2.0-only */ << 2 /* 1 /* 3 * Audio support for PS3 2 * Audio support for PS3 4 * Copyright (C) 2007 Sony Computer Entertainm 3 * Copyright (C) 2007 Sony Computer Entertainment Inc. 5 * All rights reserved. 4 * All rights reserved. 6 * Copyright 2006, 2007 Sony Corporation 5 * Copyright 2006, 2007 Sony Corporation >> 6 * >> 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. >> 10 * >> 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. >> 15 * >> 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 7 */ 19 */ 8 20 9 #if !defined(_SND_PS3_H_) 21 #if !defined(_SND_PS3_H_) 10 #define _SND_PS3_H_ 22 #define _SND_PS3_H_ 11 23 12 #include <linux/irqreturn.h> 24 #include <linux/irqreturn.h> 13 25 14 #define SND_PS3_DRIVER_NAME "snd_ps3" 26 #define SND_PS3_DRIVER_NAME "snd_ps3" 15 27 16 enum snd_ps3_out_channel { 28 enum snd_ps3_out_channel { 17 SND_PS3_OUT_SPDIF_0, 29 SND_PS3_OUT_SPDIF_0, 18 SND_PS3_OUT_SPDIF_1, 30 SND_PS3_OUT_SPDIF_1, 19 SND_PS3_OUT_SERIAL_0, 31 SND_PS3_OUT_SERIAL_0, 20 SND_PS3_OUT_DEVS 32 SND_PS3_OUT_DEVS 21 }; 33 }; 22 34 23 enum snd_ps3_dma_filltype { 35 enum snd_ps3_dma_filltype { 24 SND_PS3_DMA_FILLTYPE_FIRSTFILL, 36 SND_PS3_DMA_FILLTYPE_FIRSTFILL, 25 SND_PS3_DMA_FILLTYPE_RUNNING, 37 SND_PS3_DMA_FILLTYPE_RUNNING, 26 SND_PS3_DMA_FILLTYPE_SILENT_FIRSTFILL, 38 SND_PS3_DMA_FILLTYPE_SILENT_FIRSTFILL, 27 SND_PS3_DMA_FILLTYPE_SILENT_RUNNING 39 SND_PS3_DMA_FILLTYPE_SILENT_RUNNING 28 }; 40 }; 29 41 30 enum snd_ps3_ch { 42 enum snd_ps3_ch { 31 SND_PS3_CH_L = 0, 43 SND_PS3_CH_L = 0, 32 SND_PS3_CH_R = 1, 44 SND_PS3_CH_R = 1, 33 SND_PS3_CH_MAX = 2 45 SND_PS3_CH_MAX = 2 34 }; 46 }; 35 47 36 struct snd_ps3_avsetting_info { 48 struct snd_ps3_avsetting_info { 37 uint32_t avs_audio_ch; /* fixed */ 49 uint32_t avs_audio_ch; /* fixed */ 38 uint32_t avs_audio_rate; 50 uint32_t avs_audio_rate; 39 uint32_t avs_audio_width; 51 uint32_t avs_audio_width; 40 uint32_t avs_audio_format; /* fixed */ 52 uint32_t avs_audio_format; /* fixed */ 41 uint32_t avs_audio_source; /* fixed */ 53 uint32_t avs_audio_source; /* fixed */ 42 unsigned char avs_cs_info[8]; 54 unsigned char avs_cs_info[8]; 43 }; 55 }; 44 /* 56 /* 45 * PS3 audio 'card' instance 57 * PS3 audio 'card' instance 46 * there should be only ONE hardware. 58 * there should be only ONE hardware. 47 */ 59 */ 48 struct snd_ps3_card_info { 60 struct snd_ps3_card_info { 49 struct ps3_system_bus_device *ps3_dev; 61 struct ps3_system_bus_device *ps3_dev; 50 struct snd_card *card; 62 struct snd_card *card; 51 63 52 struct snd_pcm *pcm; 64 struct snd_pcm *pcm; 53 struct snd_pcm_substream *substream; 65 struct snd_pcm_substream *substream; 54 66 55 /* hvc info */ 67 /* hvc info */ 56 u64 audio_lpar_addr; 68 u64 audio_lpar_addr; 57 u64 audio_lpar_size; 69 u64 audio_lpar_size; 58 70 59 /* registers */ 71 /* registers */ 60 void __iomem *mapped_mmio_vaddr; 72 void __iomem *mapped_mmio_vaddr; 61 73 62 /* irq */ 74 /* irq */ 63 u64 audio_irq_outlet; 75 u64 audio_irq_outlet; 64 unsigned int irq_no; 76 unsigned int irq_no; 65 77 66 /* remember avsetting */ 78 /* remember avsetting */ 67 struct snd_ps3_avsetting_info avs; 79 struct snd_ps3_avsetting_info avs; 68 80 69 /* dma buffer management */ 81 /* dma buffer management */ 70 spinlock_t dma_lock; 82 spinlock_t dma_lock; 71 /* dma_lock start */ 83 /* dma_lock start */ 72 void * dma_start_vaddr[2]; /* 84 void * dma_start_vaddr[2]; /* 0 for L, 1 for R */ 73 dma_addr_t dma_start_bus_addr[ 85 dma_addr_t dma_start_bus_addr[2]; 74 size_t dma_buffer_size; 86 size_t dma_buffer_size; 75 void * dma_last_transfer_vaddr 87 void * dma_last_transfer_vaddr[2]; 76 void * dma_next_transfer_vaddr 88 void * dma_next_transfer_vaddr[2]; 77 int silent; 89 int silent; 78 /* dma_lock end */ 90 /* dma_lock end */ 79 91 80 int running; 92 int running; 81 93 82 /* null buffer */ 94 /* null buffer */ 83 void *null_buffer_start_vaddr; 95 void *null_buffer_start_vaddr; 84 dma_addr_t null_buffer_start_dma_addr; 96 dma_addr_t null_buffer_start_dma_addr; 85 97 86 /* start delay */ 98 /* start delay */ 87 unsigned int start_delay; 99 unsigned int start_delay; 88 100 89 }; 101 }; 90 102 91 103 92 /* PS3 audio DMAC block size in bytes */ 104 /* PS3 audio DMAC block size in bytes */ 93 #define PS3_AUDIO_DMAC_BLOCK_SIZE (128) 105 #define PS3_AUDIO_DMAC_BLOCK_SIZE (128) 94 /* one stage (stereo) of audio FIFO in bytes 106 /* one stage (stereo) of audio FIFO in bytes */ 95 #define PS3_AUDIO_FIFO_STAGE_SIZE (256) 107 #define PS3_AUDIO_FIFO_STAGE_SIZE (256) 96 /* how many stages the fifo have */ 108 /* how many stages the fifo have */ 97 #define PS3_AUDIO_FIFO_STAGE_COUNT (8) 109 #define PS3_AUDIO_FIFO_STAGE_COUNT (8) 98 /* fifo size 128 bytes * 8 stages * stereo (2c 110 /* fifo size 128 bytes * 8 stages * stereo (2ch) */ 99 #define PS3_AUDIO_FIFO_SIZE \ 111 #define PS3_AUDIO_FIFO_SIZE \ 100 (PS3_AUDIO_FIFO_STAGE_SIZE * PS3_AUDIO 112 (PS3_AUDIO_FIFO_STAGE_SIZE * PS3_AUDIO_FIFO_STAGE_COUNT) 101 113 102 /* PS3 audio DMAC max block count in one dma s 114 /* PS3 audio DMAC max block count in one dma shot = 128 (0x80) blocks*/ 103 #define PS3_AUDIO_DMAC_MAX_BLOCKS (PS3_AUDIO_ 115 #define PS3_AUDIO_DMAC_MAX_BLOCKS (PS3_AUDIO_DMASIZE_BLOCKS_MASK + 1) 104 116 105 #define PS3_AUDIO_NORMAL_DMA_START_CH (0) 117 #define PS3_AUDIO_NORMAL_DMA_START_CH (0) 106 #define PS3_AUDIO_NORMAL_DMA_COUNT (8) 118 #define PS3_AUDIO_NORMAL_DMA_COUNT (8) 107 #define PS3_AUDIO_NULL_DMA_START_CH \ 119 #define PS3_AUDIO_NULL_DMA_START_CH \ 108 (PS3_AUDIO_NORMAL_DMA_START_CH + PS3_A 120 (PS3_AUDIO_NORMAL_DMA_START_CH + PS3_AUDIO_NORMAL_DMA_COUNT) 109 #define PS3_AUDIO_NULL_DMA_COUNT (2) 121 #define PS3_AUDIO_NULL_DMA_COUNT (2) 110 122 111 #define SND_PS3_MAX_VOL (0x0F) 123 #define SND_PS3_MAX_VOL (0x0F) 112 #define SND_PS3_MIN_VOL (0x00) 124 #define SND_PS3_MIN_VOL (0x00) 113 #define SND_PS3_MIN_ATT SND_PS3_MIN_VOL 125 #define SND_PS3_MIN_ATT SND_PS3_MIN_VOL 114 #define SND_PS3_MAX_ATT SND_PS3_MAX_VOL 126 #define SND_PS3_MAX_ATT SND_PS3_MAX_VOL 115 127 116 #define SND_PS3_PCM_PREALLOC_SIZE \ 128 #define SND_PS3_PCM_PREALLOC_SIZE \ 117 (PS3_AUDIO_DMAC_BLOCK_SIZE * PS3_AUDIO 129 (PS3_AUDIO_DMAC_BLOCK_SIZE * PS3_AUDIO_DMAC_MAX_BLOCKS * 4) 118 130 119 #define SND_PS3_DMA_REGION_SIZE \ 131 #define SND_PS3_DMA_REGION_SIZE \ 120 (SND_PS3_PCM_PREALLOC_SIZE + PAGE_SIZE 132 (SND_PS3_PCM_PREALLOC_SIZE + PAGE_SIZE) 121 133 122 #define PS3_AUDIO_IOID (1UL) 134 #define PS3_AUDIO_IOID (1UL) 123 135 124 #endif /* _SND_PS3_H_ */ 136 #endif /* _SND_PS3_H_ */ 125 137
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.