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

TOMOYO Linux Cross Reference
Linux/sound/soc/sof/sof-utils.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/sof-utils.c (Version linux-6.12-rc7) and /sound/soc/sof/sof-utils.c (Version linux-4.14.336)


  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) 2018-2022 Intel Corporation       
  7 //                                                
  8 // Author: Keyon Jie <yang.jie@linux.intel.com    
  9 //                                                
 10                                                   
 11 #include <linux/unaligned.h>                      
 12 #include <linux/io-64-nonatomic-lo-hi.h>          
 13 #include <linux/device.h>                         
 14 #include <sound/memalloc.h>                       
 15 #include <linux/module.h>                         
 16 #include "sof-utils.h"                            
 17                                                   
 18 /*                                                
 19  * Generic buffer page table creation.            
 20  * Take the each physical page address and dro    
 21  * bits from each (based on PAGE_SIZE). Then p    
 22  * into compressed page table.                    
 23  */                                               
 24                                                   
 25 int snd_sof_create_page_table(struct device *d    
 26                               struct snd_dma_b    
 27                               unsigned char *p    
 28 {                                                 
 29         int i, pages;                             
 30                                                   
 31         pages = snd_sgbuf_aligned_pages(size);    
 32                                                   
 33         dev_dbg(dev, "generating page table fo    
 34                 dmab->area, size, pages);         
 35                                                   
 36         for (i = 0; i < pages; i++) {             
 37                 /*                                
 38                  * The number of valid address    
 39                  * idx determines the byte pos    
 40                  * where the current page's ad    
 41                  * in the compressed page_tabl    
 42                  * This can be calculated by m    
 43                  */                               
 44                 u32 idx = (5 * i) >> 1;           
 45                 u32 pfn = snd_sgbuf_get_addr(d    
 46                 u8 *pg_table;                     
 47                                                   
 48                 pg_table = (u8 *)(page_table +    
 49                                                   
 50                 /*                                
 51                  * pagetable compression:         
 52                  * byte 0     byte 1     byte     
 53                  * ___________pfn 0__________     
 54                  * .... ....  .... ....  ....     
 55                  * It is created by:              
 56                  * 1. set current location to     
 57                  * 2. put pfn[i] at current lo    
 58                  * 3. calculate an intermediat    
 59                  *    x = (pfn[i+1] << 4) | (p    
 60                  * 4. put x at offset (current    
 61                  * 5. increment current locati    
 62                  * 6. continue to (2)             
 63                  */                               
 64                 if (i & 1)                        
 65                         put_unaligned_le32((pg    
 66                                            pg_    
 67                 else                              
 68                         put_unaligned_le32(pfn    
 69         }                                         
 70                                                   
 71         return pages;                             
 72 }                                                 
 73 EXPORT_SYMBOL(snd_sof_create_page_table);         
 74                                                   
 75 MODULE_LICENSE("Dual BSD/GPL");                   
 76 MODULE_DESCRIPTION("SOF utils");                  
 77                                                   

~ [ 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