~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/sof/amd/acp-stream.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/soc/sof/amd/acp-stream.c (Version linux-6.12-rc7) and /sound/soc/sof/amd/acp-stream.c (Version linux-4.11.12)


  1 // SPDX-License-Identifier: (GPL-2.0-only OR B      1 
  2 //                                                
  3 // This file is provided under a dual BSD/GPLv    
  4 // redistributing this file, you may do so und    
  5 //                                                
  6 // Copyright(c) 2021 Advanced Micro Devices, I    
  7 //                                                
  8 // Authors: Ajit Kumar Pandey <AjitKumar.Pande    
  9                                                   
 10 /*                                                
 11  * Hardware interface for generic AMD audio DS    
 12  */                                               
 13                                                   
 14 #include "../ops.h"                               
 15 #include "acp-dsp-offset.h"                       
 16 #include "acp.h"                                  
 17                                                   
 18 #define PTE_GRP1_OFFSET         0x00000000        
 19 #define PTE_GRP2_OFFSET         0x00800000        
 20 #define PTE_GRP3_OFFSET         0x01000000        
 21 #define PTE_GRP4_OFFSET         0x01800000        
 22 #define PTE_GRP5_OFFSET         0x02000000        
 23 #define PTE_GRP6_OFFSET         0x02800000        
 24 #define PTE_GRP7_OFFSET         0x03000000        
 25 #define PTE_GRP8_OFFSET         0x03800000        
 26                                                   
 27 int acp_dsp_stream_config(struct snd_sof_dev *    
 28 {                                                 
 29         const struct sof_amd_acp_desc *desc =     
 30         unsigned int pte_reg, pte_size, phy_ad    
 31         int stream_tag = stream->stream_tag;      
 32         u32 low, high, offset, reg_val;           
 33         dma_addr_t addr;                          
 34         int page_idx;                             
 35                                                   
 36         switch (stream_tag) {                     
 37         case 1:                                   
 38                 pte_reg = ACPAXI2AXI_ATU_BASE_    
 39                 pte_size = ACPAXI2AXI_ATU_PAGE    
 40                 offset = offsetof(struct scrat    
 41                 stream->reg_offset = PTE_GRP1_    
 42                 break;                            
 43         case 2:                                   
 44                 pte_reg = ACPAXI2AXI_ATU_BASE_    
 45                 pte_size = ACPAXI2AXI_ATU_PAGE    
 46                 offset = offsetof(struct scrat    
 47                 stream->reg_offset = PTE_GRP2_    
 48                 break;                            
 49         case 3:                                   
 50                 pte_reg = ACPAXI2AXI_ATU_BASE_    
 51                 pte_size = ACPAXI2AXI_ATU_PAGE    
 52                 offset = offsetof(struct scrat    
 53                 stream->reg_offset = PTE_GRP3_    
 54                 break;                            
 55         case 4:                                   
 56                 pte_reg = ACPAXI2AXI_ATU_BASE_    
 57                 pte_size = ACPAXI2AXI_ATU_PAGE    
 58                 offset = offsetof(struct scrat    
 59                 stream->reg_offset = PTE_GRP4_    
 60                 break;                            
 61         case 5:                                   
 62                 pte_reg = ACPAXI2AXI_ATU_BASE_    
 63                 pte_size = ACPAXI2AXI_ATU_PAGE    
 64                 offset = offsetof(struct scrat    
 65                 stream->reg_offset = PTE_GRP5_    
 66                 break;                            
 67         case 6:                                   
 68                 pte_reg = ACPAXI2AXI_ATU_BASE_    
 69                 pte_size = ACPAXI2AXI_ATU_PAGE    
 70                 offset = offsetof(struct scrat    
 71                 stream->reg_offset = PTE_GRP6_    
 72                 break;                            
 73         case 7:                                   
 74                 pte_reg = ACPAXI2AXI_ATU_BASE_    
 75                 pte_size = ACPAXI2AXI_ATU_PAGE    
 76                 offset = offsetof(struct scrat    
 77                 stream->reg_offset = PTE_GRP7_    
 78                 break;                            
 79         case 8:                                   
 80                 pte_reg = ACPAXI2AXI_ATU_BASE_    
 81                 pte_size = ACPAXI2AXI_ATU_PAGE    
 82                 offset = offsetof(struct scrat    
 83                 stream->reg_offset = PTE_GRP8_    
 84                 break;                            
 85         default:                                  
 86                 dev_err(sdev->dev, "Invalid st    
 87                 return -EINVAL;                   
 88         }                                         
 89                                                   
 90         /* write phy_addr in scratch memory */    
 91                                                   
 92         phy_addr_offset = sdev->debug_box.offs    
 93                           offsetof(struct scra    
 94         index = stream_tag - 1;                   
 95         phy_addr_offset = phy_addr_offset + in    
 96                                                   
 97         snd_sof_dsp_write(sdev, ACP_DSP_BAR, A    
 98                           phy_addr_offset, str    
 99                                                   
100         /* Group Enable */                        
101         offset = offset + sdev->debug_box.offs    
102         reg_val = desc->sram_pte_offset + offs    
103         snd_sof_dsp_write(sdev, ACP_DSP_BAR, p    
104         snd_sof_dsp_write(sdev, ACP_DSP_BAR, p    
105                                                   
106         for (page_idx = 0; page_idx < stream->    
107                 addr = snd_sgbuf_get_addr(stre    
108                                                   
109                 /* Load the low address of pag    
110                 low = lower_32_bits(addr);        
111                 high = upper_32_bits(addr);       
112                                                   
113                 snd_sof_dsp_write(sdev, ACP_DS    
114                                                   
115                 high |= BIT(31);                  
116                 snd_sof_dsp_write(sdev, ACP_DS    
117                 /* Move to next physically con    
118                 offset += 8;                      
119         }                                         
120                                                   
121         /* Flush ATU Cache after PTE Update */    
122         snd_sof_dsp_write(sdev, ACP_DSP_BAR, A    
123                                                   
124         return 0;                                 
125 }                                                 
126                                                   
127 struct acp_dsp_stream *acp_dsp_stream_get(stru    
128 {                                                 
129         struct acp_dev_data *adata = sdev->pda    
130         struct acp_dsp_stream *stream = adata-    
131         int i;                                    
132                                                   
133         for (i = 0; i < ACP_MAX_STREAM; i++, s    
134                 if (stream->active)               
135                         continue;                 
136                                                   
137                 /* return stream if tag not sp    
138                 if (!tag) {                       
139                         stream->active = 1;       
140                         return stream;            
141                 }                                 
142                                                   
143                 /* check if this is the reques    
144                 if (stream->stream_tag == tag)    
145                         stream->active = 1;       
146                         return stream;            
147                 }                                 
148         }                                         
149                                                   
150         dev_err(sdev->dev, "stream %d active o    
151         return NULL;                              
152 }                                                 
153 EXPORT_SYMBOL_NS(acp_dsp_stream_get, SND_SOC_S    
154                                                   
155 int acp_dsp_stream_put(struct snd_sof_dev *sde    
156                        struct acp_dsp_stream *    
157 {                                                 
158         struct acp_dev_data *adata = sdev->pda    
159         struct acp_dsp_stream *stream = adata-    
160         int i;                                    
161                                                   
162         /* Free an active stream */               
163         for (i = 0; i < ACP_MAX_STREAM; i++, s    
164                 if (stream == acp_stream) {       
165                         stream->active = 0;       
166                         return 0;                 
167                 }                                 
168         }                                         
169                                                   
170         dev_err(sdev->dev, "Cannot find active    
171         return -EINVAL;                           
172 }                                                 
173 EXPORT_SYMBOL_NS(acp_dsp_stream_put, SND_SOC_S    
174                                                   
175 int acp_dsp_stream_init(struct snd_sof_dev *sd    
176 {                                                 
177         struct acp_dev_data *adata = sdev->pda    
178         int i;                                    
179                                                   
180         for (i = 0; i < ACP_MAX_STREAM; i++) {    
181                 adata->stream_buf[i].sdev = sd    
182                 adata->stream_buf[i].active =     
183                 adata->stream_buf[i].stream_ta    
184         }                                         
185         return 0;                                 
186 }                                                 
187 EXPORT_SYMBOL_NS(acp_dsp_stream_init, SND_SOC_    
188                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php