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

TOMOYO Linux Cross Reference
Linux/sound/ac97_bus.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/ac97_bus.c (Version linux-6.12-rc7) and /sound/ac97_bus.c (Version unix-v6-master)


  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 
  2 /*                                                
  3  * Linux driver model AC97 bus interface          
  4  *                                                
  5  * Author:      Nicolas Pitre                     
  6  * Created:     Jan 14, 2005                      
  7  * Copyright:   (C) MontaVista Software Inc.      
  8  */                                               
  9                                                   
 10 #include <linux/module.h>                         
 11 #include <linux/init.h>                           
 12 #include <linux/device.h>                         
 13 #include <linux/string.h>                         
 14 #include <sound/ac97_codec.h>                     
 15                                                   
 16 /*                                                
 17  * snd_ac97_check_id() - Reads and checks the     
 18  * @ac97: The AC97 device to check                
 19  * @id: The ID to compare to                      
 20  * @id_mask: Mask that is applied to the devic    
 21  *                                                
 22  * If @id is 0 this function returns true if t    
 23  * a valid ID. If @id is non 0 this functions     
 24  * matches the read vendor ID. Otherwise the f    
 25  */                                               
 26 static bool snd_ac97_check_id(struct snd_ac97     
 27         unsigned int id_mask)                     
 28 {                                                 
 29         ac97->id = ac97->bus->ops->read(ac97,     
 30         ac97->id |= ac97->bus->ops->read(ac97,    
 31                                                   
 32         if (ac97->id == 0x0 || ac97->id == 0xf    
 33                 return false;                     
 34                                                   
 35         if (id != 0 && id != (ac97->id & id_ma    
 36                 return false;                     
 37                                                   
 38         return true;                              
 39 }                                                 
 40                                                   
 41 /**                                               
 42  * snd_ac97_reset() - Reset AC'97 device          
 43  * @ac97: The AC'97 device to reset               
 44  * @try_warm: Try a warm reset first              
 45  * @id: Expected device vendor ID                 
 46  * @id_mask: Mask that is applied to the devic    
 47  *                                                
 48  * This function resets the AC'97 device. If @    
 49  * first performs a warm reset. If the warm re    
 50  * returns 1. Otherwise or if @try_warm is fal    
 51  * followed by a warm reset. If this is succes    
 52  * otherwise a negative error code. If @id is     
 53  * accepted, otherwise only the ID that matche    
 54  */                                               
 55 int snd_ac97_reset(struct snd_ac97 *ac97, bool    
 56         unsigned int id_mask)                     
 57 {                                                 
 58         const struct snd_ac97_bus_ops *ops = a    
 59                                                   
 60         if (try_warm && ops->warm_reset) {        
 61                 ops->warm_reset(ac97);            
 62                 if (snd_ac97_check_id(ac97, id    
 63                         return 1;                 
 64         }                                         
 65                                                   
 66         if (ops->reset)                           
 67                 ops->reset(ac97);                 
 68         if (ops->warm_reset)                      
 69                 ops->warm_reset(ac97);            
 70                                                   
 71         if (snd_ac97_check_id(ac97, id, id_mas    
 72                 return 0;                         
 73                                                   
 74         return -ENODEV;                           
 75 }                                                 
 76 EXPORT_SYMBOL_GPL(snd_ac97_reset);                
 77                                                   
 78 const struct bus_type ac97_bus_type = {           
 79         .name           = "ac97",                 
 80 };                                                
 81                                                   
 82 static int __init ac97_bus_init(void)             
 83 {                                                 
 84         return bus_register(&ac97_bus_type);      
 85 }                                                 
 86                                                   
 87 subsys_initcall(ac97_bus_init);                   
 88                                                   
 89 static void __exit ac97_bus_exit(void)            
 90 {                                                 
 91         bus_unregister(&ac97_bus_type);           
 92 }                                                 
 93                                                   
 94 module_exit(ac97_bus_exit);                       
 95                                                   
 96 EXPORT_SYMBOL(ac97_bus_type);                     
 97                                                   
 98 MODULE_DESCRIPTION("Legacy AC97 bus interface"    
 99 MODULE_LICENSE("GPL");                            
100                                                   

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