LITMUS^RT kernel.
aboutsummaryrefslogblamecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
blob: 2b6ce9b2674a9d899dd34a6e2b6e2622dc08c631 (plain) (tree)

























                                                                             
                      

                         
                      
                         
                       
                         
                         
                     
                      
                         
                     
                       

                                
                                
 

                                                             
                                                          
                                                           
                                                                     

                








                            


                
                         


                

                                 


                                       

                                         


                                                                   
                                                                    
  
 


                                                                            

                                                                      

                                                                       

                                                                          

                                                                           
 

                                                                   

                                                                         
           
                                                                        

                                                                              
 




                                                                           


                                           




                                                                               

 
                                                    







                                                 

                                             
                                        


                                                     







                                                 

                                              
                                        
  
 
                                                     







                                                  

                                              
                                        


                                                     







                                                  

                                              
                                        

  
 
                                                    










                                                 
          
                                            


                                                    









                                                 
                                            


                                                                   









                                                  
          
                                            


                                                                 









                                                  
          
                                            


                                                            








                                                 
                                               
                                          

  
                                                         

                                                  
                                                   

                                      
                                                                             



                                       

                                              
                                        

  
                                                         







                                                  

                                               
                                        

  




                                                                     
                                                        









                                                  
                                            

  
                                                                









                                                  



                                                              









                                                  


                                            
                                
                                                                     






                                                  
                                     

                                               



                                                                   






                                                  
                                     

                                             



                                                                 








                                                 
                                               
                                               

  









































                                                    
























                                                                              





















                                                                              










                                                             

















                                                                        




                                                                



                                                      


                                                   








                                                                               
                                                               





                                                                  

                                                                       
 

                                                             
                                   

                                                           
                                                            
                                               
                                             



                                                                              
                                             




                                                                                

                                                            
            
                                                   



                     






                                                                  
                                                      
                                                    
                                                                    

                                                    
                                                                      

                                                                    
                                               
                                                                  
                                               
                                                                         
                                                       
                                                    
                                                



                     
                                                                          



                                           
                               
                                                           
                               
                                              
                                      
                                                                 
                                                            
                    
                                                            






                                                                      




                                                                 

                                                                 
                                                        
                    
                                                       



                     

                                                            
 







                                                                                 

                                              

                       





                                                         


                                                                            
                                                         
 
                                           

                                      

                                                    


                                    

 
                                                                               




                                                                              


                                                          
 
                                                                      
                                                     
                                                                     
                                                    
                                                                      
                                                     
                                                                      
                                                     
                                                        
                                              
                                                                     
                                                    
                                                                     
                                                    
                                                                       
                                                      



                                                                                   
                                                      



                    

                                                                      

                                                                       
 



                                                             

                         
                                                           
                                     





                                                                             
                                                      









                                                     
                                                   
 



                                                                 

                                                                      




                                                                                

                                                     
                                                                         

                                                                           
                                                         


                                                                      













                                                                           

                                                                          

                                                                           





                                                             

                                                     


                                                           

                             
                                       



                                                                   












                                                     
                                                                          
                                                                   
                                                                         







                                                                             
                                                                         

                                                                           
                                                         


                                                                      

                                                                           









                                                                    



                     
                                                                             

                                                                              


                                           
 

















                                                          


                                                                        

                                                                         
 



















                                                              
 










                                                                           
                 























































                                                                                                      
 










                                                                      








                                                                        
 
                                                             
                                          
 




                                                    















                                                                             
                                                  


                                                  


                                                         

                                                      






                                                                       





                                                          
  
   
                                                              

                                                             

                                        
                                         

                                                       

                                                                          
                                                             
                
                                         
                                        

                                                                        




                                                      

                                                         
                                                               
                                  
                                                                       

                                                       
                                                             
         

 






















                                                                       

                                                             


                                                     
 


                       




                                                                          

                                                                             
                       
 







                                                                                                


                                                   











                                                                               
         
 

                                                                       







                                                            









                                                                   













                                                                          







                                                                                       
















                                                                          



                                                                         










                                                                                                             



                                                                                 




                                                                                                             





                                                                    
                           


















                                                              
                              

 

                                                   


                
                       
 



                                                                   

                             


                                                                     
                                                                            

 

                                                           


                
                       


                             



                                                                              

 


                                                             






                                                                     
                                               





                                                                                
                       
         
 






                                                                      

                                                                                                  


         




                                                                        




                                                                                  















                                                                                           


                                                                                           

 

                                                                  















                                                                        














































                                                                            
                                                                     
                                                                         
 
                                 
                                                            
                                                                              
                                   
 

                                                                  
                                                           




                                                                       
                                 
                                                    
                                                                                
                                   
 

                                                                   
                                                             






                                                                        
 


                                                                              


                             
                                                    
                                                                      
                              


                             
                                                    
                                                                       
                              





                                                        
   








                                                                            

                                                                          






                                                                               
                                                                          
















































                                                                                






                                                                      
                                                               












                                                                       
                                                                                     












                                                                                     
                      

                                                       
                                                               










                                                                       
                                                                                     











                                                                                    
   






                                                                      
                                                               
 
                                                                              
                                  


                
                                                         
                                        





                                        



                                                                           



                                                
                                       
                                                            





                                                             




                               

                       

 
                                                                
 

                                                                              
                
                
 

                                        

                        
 

                                        
 


                                                                             
 
                                        
                                                             


                       
                            
                                                            
                       





                                                               
 
                           




                                

                        

 



                                                                      
                              
                                                                     




                                           


                                                            




                                                       



                                                                                        

                              
                                                 






                                                                
                                                    
         


                                                                                




                                                                 


                                         














                                                                       


                                                  





                                                                     
                                                                     

 
   
                                                            

                                    
                                                             








                                                                          

                                                                                










                                                                         







                                                                     


                             



                                               



                                                   
                                                              



























                                                                         



                                                


                                                     



                                                                       
                                                                 





                                                              


















                                                                          



                                                    
                                                   


                                                   















                                                                  



                                                     



                                                   
   
                                                  
                                                           
                                                               
 
                                                             


                      
                                   
                              

                                                            
                                                   


                                              












                                                                        
                                           
                                                                              
                
                                       





                                                                      
                                             

                               
 
                                       
 
                                          
                 


                                   

                                          
                   

 





                                                        















                                                                                

                                                                               




                                                             
                                        
                                      
                                    
                    
                











                                                                     
 

                                 
















                                                             
                                                                          

                               
                                        
                                                         




                                                    
                                 
 
                                                                          
 






                                                                                  
                                                           
         


                                                                            
                                                     
                                        

                                                                                   
                                                             
                                                            
              
                                                                            
                          
 











                                                                          
                                    





                        
               














































                                                                          
                                                                          




                                                                          
 

                                                                            
                                                     

                                                                           
                                                     
                                                    











                                                                              
 

                                                   
                                      
 
                                                              

 
          


























                                                                            
                                                        
                                               

                                           
                                                             

                                                            
                                       
                

                         
                  
                                           


                         



                                                                        
                               

         
                                       
                                             
                                                                       
                                               

                                                 
                                                  

                           
 

                                          
 
                                                             
                  
                                                                  
                                                 
                                                             
                           
         
 

                          

                    
 

                                                             
                                                                      
         
 
                              
                                         

                                  
                         


                                                        
                         
 
                               

                                                     


                                                     
         

                 

 
                                                                  




                                                             
                                                              

























                                                        
                           


                    










                                                             
                                

                                                                              


                                                                          
         















                                                            




                                                                     

 











                                                                      






                                                             
                                      
                             
 



                                                    

                                                                       

                               

                                    

                              

                    
                                              

                               

                                                  

                                         
                                              
 

                               

                                         


                                              

                    
                                                                       




                                                                                
 
                               
                                             
                                      



                                                             
                                                                

                              
         
                       
                                                 

                     

                               

                                         
                              
 

                               

                                         
                              
 

                          
 
                               
                                             
                                      


                                                         
                                                                   


                                                             
         
                       
                                                 

                                          
 

 
                                            












                                                             
                                
 

                                                                       

                               

                                    


                              

                    
                                              

                               

                                                  




                                               
                                              
 

                               






                                                         


                                              

                    


                                                    
                                 

                                       

                                                     


                                      

                            









                                                                        
                 

                              

                   
                                                 

                     

                               






                                                       
                              
 

                               






                                                         


                              

                    
                                 

                                       

                                                     


                                      

                            









                                                                           
                 

                              

                   
                                                 



                                           




























                                                                       
                                   






                                                 
                                   




                                              


                                                    
                                 








































                                                                
                                 
























                                                                   
                                                                  
 
                                                      
                                                             
                                    
                      
 
                                                             

                                                                 
 
                                                                 


                                             
                                                  



                                                                  


                                          



                                           

                    







                                                                           
 


                                          
         

 




























                                                                   










                                                                       























                                                                          

                                                                                

                                                           
                                                                     

                                                     
         

























                                                                  
















                                                              

                                                                    
                                           
                                                             



                             


                                                       


                                         

 


                                                         
                                            




                                                                           
                                                            
 





                                                                                                  
                                                                         



                                                                                                 
                                                                   



                                             
                                              
                                      
                                                                            







                                             


























































































                                                                                                                              








                                                      




                                                             
                      
 

                                                   
                                               
                                               
 

                                         



                                                                    
                        
 
                                               













                                                   
                 



                                                                
                                               
         
 

                                                        


                                                                
 


                                                                
                                                                         
 

                                             
 

                                             

                                                                   
                                                                           


                                                  

                                              

                                                 
                                                               

                                                            
                                                           
                                                            
                                                           


                                                        
                                                    

                              
                                                    

                              
                                                    


                                                                                  
                                                    
                              
                 
 
                                      
         
 
                                                

 




























                                                                                               










                                                                         


































                                                                                                      
 

                                                                        

                                   


                                                          



                        

















                                                                            




                                                             
                                      




                                      

                                













                                                                  
                          
                                                    



                                                       
 


                                                     







                                                                        


                                                                        

         





                                                                         




                                                       
 
                                       
                              

                                         
                                             
 

                                                    


                                                                






                                                             
                                      

                                      
                      
 
 


                                


                                                    
                                                
                                  
                                              
 
                                                   
 

                                         
 
                                           
 
                        

                                       
 


                                                       
 
                                   
 
                                                 
 

                                          


                                                                           
                                               
                                      


                                               

                               
                                                                         

                              
                                                                         

                              
                                                 
                                                                         



                                        
                                               
         
 
                              
                                          
 
                                             
 
                                   
                                     

                                       
                              
                                         
 
 





                                                            

                                                                               
                                             
                                                              
                                                                     
 
                                               


                                                                     
                                                 
         
 


                                                                             

 
                                                   

                                           

                                                             
                                      
                                    
                                      
 

                                



                                  

                                     
                                         
                                                 
                                                  
 
                                  
                              
 

                                                                             
                                             
 

                                                    
 
 




                                                             
                                      

                                      
 
 


                                


                                                    
                                                                              

                                                
                                                   
                                              
 

                                         
 
                                                   
                                           
                                          
 
                                   

                                     

 



                                                

                                                          




                                                            







                                                        









                                                                                     
                                                                              

                      

 
























                                                             

                                                     
                                           
                                        
                                                             
 




                                                              

                                    

                                                                            


                                               
                                                                        
                                                 












                                                                                


         
                                                  
 





                                                                      

 
                                                    
 

 
                                                       
 
                                                                        
 

                                     

 



                                                                               
 


                                                  
                                                           


                                                   
                                                           
         

 

                                                                                
                                                                          
 




























                                                                        

 


                                                                            
 
                                                                          
 


                                                                
 








                                                                
                                                             
 
                                                  

 



                                                                                
 
                           
                                                           
 
                                                     

 
                                                        
                                                                      

                                                                         
                                           
 
                                 
                                                     

                                                            
         
 




                                                                               
 






                                                                            


                    




                                                                     



                                                               
 
                                                               
 

                      
 



                                                                    
 


                                                                 
 










                                                        
                 




















                                                                     
                              
         
 


                              
 


                                                               

 
















                                                    
           

                                                                     
 

                                        


                                                   

                                                     

                                  


                                                     

                                                                         


                                               
                                                                

 


                                                                                  
                        










                                                                              
                                                            





                                                                       
                                                                    

                                                                       


                                                             
                                        
                                            


                                                                      
                                                            










                                                                         
                                                                                                                     




                                                       


                                                                                
                                                                       

                                         


                                                                        
                                                                                                                                                      









                                                                                
                                                                              

                                                 
                                                                             




                                                




                                                             






                                                                              
                            







                                                             
                        

                      
                         

                      
                         






                                                                   

                                            

                                                                      
 
                                    



                                  





















                                                                  





                                                                     


                                                                  


































                                                                             

































                                                                               






                                                                          
                 




























                                                                           
                                                             
                                                        
                                            
                                                        
                                            


                               

































































                                                                                    





















































































































































                                                                                              






                                                                              





                                               







                                                            



                                                                     
                                                         




                                                             
                                      
                                       
                                           


                                                            
                                      
                                   
                
 
                                                      
                                        



                                       
                                       
                                       
                                                    
                                             
                              


                                        


                                              
                 
 
                                 

         
                                                       
 




                                                                                
                                          

                                                                             

                                                                    
                               

         
                                                                                 
                                             
 
                                                        





                                                                               
                                                                

                                                                             
                                                           
                                                                    

         

                                                                 
 

                                                                  
 

                                                                             


                                                                      
            


                                                                          

                            
                                             



                                               



                                                    
 
                                                    





                                                                                       

                                                                            
                                                         
                    
                                                          

         


                                                              
                                                                              





                                                            
                                                                    

                                           

                                                
                                                                      
                                                            
                        
                                                                       



                                                             
                                             

                                                             

                                                                  
                                                
                                                    


                                                            
                                                 




                                                         
 

                                                       
                                                             

                                                           
                                                                 

                                                          
                                                                


                                                       
                                                             

                                                           
                                                                 

                                                          
                                                                


                                                                    
           



                                                 

                                                                        
 

                                             
                                                 


                                         


                                            
                                                  


                                     


                   



                                                     


                                                                
                                      

                              


                                 

                               

                                                            













                                                                     


                 










                                                                                              








                                                               
 



                                                     
 


                                               
 
                                                                           
                                                               
                                                              
                                                 

                                                  





                                                               


                                                           
                                  
                                                                       
                                                                    
                                                                          
                         

                                                                         
























                                                               





                                                   




                                                             



                                                 
                                                      



















                                                                             
                                                        
                                                                         
                                              
 
                                                                   

                                                            




































                                                                      









                                                                           
                                   
                                                                  
 

                                                            



                                       
                                       
                                       
                                                          
                                             
                              


                                        


                 
                                           
 




                                                                                
                                          



                                                                              
 
                                                        





                                                                               




                                                                              
         

                             




                                                                



                                                                         
                                                             




                                                             
                                      
                               
                                           
                                  
                                                            
                                                                           
                                                           
                
                                 
                 


                                                                  
                                                    
 
                                                      
                                        



                                       
                                       
                                       
                                                    
                                             
                              





                                         


                                              
                                      





                                                                     
                              
                 
 
                                 

         

                                                                         

                                                                    
                               
         
 
                                                                                 
                                             
 
                      



                                                                          
                         
                                                                    
                








                                                                        
 







                                                                              
                                         

                                                                  




                                                                 
                                                                            
                               
                              
         
                                   
 





                                                              
                                                                   
                                               
         
 



                                            

                                                                          
 



                                                                     
 
                                                                 







                                                                                       
 
                                       
                                 
 
                 
 







                                                                                             
                 

                                            
                                 
                                            
 

















                                                                      

         


                                                
                                                     
                                                           
                          
                                                                                
                                                        


                                              
                                                   

                                           





                                                                               
                                          
 



                                                                            

                                       

                                              





                                                                              
                                           
                                                               

                                                     
                                                         





                                                           
 
                                                            
                                                   



                                                                                   
                                                                        
                    
                                                                           




                                                                                   
                                                                     
                                                                
                                                    
                                                                
                                                    
                                           
         
 
                                   
                                                            
                
                                                                                  



                                                    
         
 

                                                               
 
                                                       
                                                           

                            




                                                                    
                                                               
         
 
                                          
                                  
                                                                     
                                                                      
                                                         
                        
                                                                     


                 
                                                             
                                                             
                                                
                                                    



                                                           

                                                
 

                                                       
                                                             

                                                           
                                                                 

                                                          
                                                                


                                                       
                                                             

                                                           
                                                                 

                                                          
                                                                
 

                                                                      
           

                                                                        
 



                                                                     
 
                       
                                                                 
 
                                                           
 
                                         
 

                                                           
                                     
 
                                                  


                                     

                                                                   
                   

 



                                                                      
                                                          


                                                             

                                                            

                
                                          
 
                                                                        
                                                        
                                           
 
                   

 




























                                                                        















                                                                        





                                                             

















                                                                       




















































































                                                                                          








                                                                        
                       

                          
                                             
 
                                          


                                                          
                                                 
                


                                                          
                                                  

         
                                                              

                                   
                                                                                          


                                                                     


                                            

                                                              
                                                       

         


                                                                          


                                                                                
 





                                                            






                                     
                                   
                              



































                                                                               





                                                                         
                                               


                                                           
                                                  

                       
                                             
                               
                                                       
 







                                                         










                                                               
                                    



                                                                       
                                            







                                                                    
                                    












                                                               
                                                         







                                                                              
                                                



                                                     
                                        

 
























                                                                              
                                                                                      

                                                           






                                                             
                      



                     
                                              



























                                                         
                                                    

                       
                                                   








                                                       

 
                                                       
                                                       





                                                                 
                                        
                      
                
 

                                                                       
                                              
                         
                           
                                               
                            







                                                                       
                                                                    
                               

                               
                                                  
                                                  

                              

         
                                                                 
                                       
                                                     





                                                              
                                                                         

                                                                             
                                         

                 

                                                     
                                                                        


                                        
                                       
                
                                                           
                                                           

                                                                                                                            

                                                                    
                                         
                 
                                                      

         
                         

                                                            
        
                                    
                                                            
                                                         


                                                                                        
                                                                         
         
 
                                         

                                       
                                    


                                           
                                             
 
                 
           
                                   
            
                                         
     
                                                        
                   



                                                                      
                                                            
 

                                 
 
                                             














                                                                       









                                                                         
                                                                             
                                                                          
 
                                                               
                                                            
 
                                       












                                                                              
                                                                      
  
                                                                            











                                                                                                  

                                                
                                                           








































                                                                           
                                         







                                                                                

                                                                               
                                                                      



















                                                             

                                                                                   

                            
                                                             




                            
                                                                
                                                              
                                                                   

                                      

                                                  
                                       
                                                           

                                              
                                   

                   



                                                                            

                                         
          

                                                                              
          

                                                                               




                                                              
 
                                                 


                                                                  

                                                                            
 
                            










                                                                               





                                                           

                                                                     

         

                                                                   

                                         
                                         
                                     
                               
 

                                         
 






                                                                           

                                           
                                                                      

                                                                          

                                                                                
                         
                                                                                     
                          
         
 
                                                    
                                                                          

                                                                         
                          
         
 
                                                                         
                                                     
 
                    


                                  
                     

 
                                                                    
                                                                       
 

                                                  
                                                           
 



                                                                            
                                    




                                                                  



                                                                         
                       

         
                                                           

                                                                  







                                                                              
                                         



                                                   
                                          
            
                                          

                                                            


                                                                                   




                                                                    
                            


                                                                                       

                                                                              











                                                                          
                                                                             




                                                                          
                                                










                                                                                        
                                                                
                              
                                                                











                                                                                        
                                                        














                                                                           
                                                             


                                                            



                                           















                                                           



                    
                                                          




                                                            

                                  
 
                               




                                            
                                   
                                                                       
                                                      
 
                                                      


                                                  
                                                 
 

                                                    
                                                                      
         






                                                            
 
                               









                                                                       


                                            
 
                                                        
 
                                                      
 
                                           

                                                 
                                                 

                                                       
                                                                        



         

                                            



                                              
 




                                                        
                              



                            
                                                                      


                                 

                                                               
         

 
                                                        
 

                                               
 
                            

                       



                                                                      

                                                               


         


                                                            












                                                        

                               
 


                          





                                                                    
                                             

                                                                  
 
                                    



                                               
                                                             
                                                            

                                                        

                                                            
                                        
                                           
                            













                                                                


                                
                                                                                            
 

                                                
 




                                                                      

                                              

                                                        
                               
 
                                                 
                                                      
 
                                               
                                   

                                                                            

 




                                                                     
                                             






                                                                       
                                             

 







                                                                      
                                     

                                                                    


                                                                         


                                                        






                                                                 
                      
                                                              

                
                                                         
                
                         
 
                                        
                
                               







                                                               




                                                                  
                                                                            

                                                                        




                                









                                                                 
                      
                                                              

                
                                                         
                
                         
 
                                        
                
                               




                                                     




                                                                  
                                                                            


                                       




                                










                                                                 
                                                              

                
                                                         
                
                         
 
                                        
                
                               




                                                                     


                                                                  


                                                                        






                                                                         

                                            




                                









                                                                 
                                                              


                             
                                                         
                
                         
 
                                        
                
                               
 


                                                                  
                                                                            
 






                                                                       
                                                                    

                                            




                                


                   













                                                                             
                               



                                                         
                         
 












                                                                
                               

         

                                        
                               
 
                                                                
                                                                   
                                                                            

                                         




                                


                   







                                                                    






                                                                       
                                        

                                                            
                            
                
 












                                                                          



                                                 


                                                  
                                         

                                                    



                                                    




                                                                     
                                                      

                                                                    







                                                        


                                                 
 
                                                           

                                                          

                      
 
                                     
 

                                        


                                                                    
                                                                            
 


                                                               
 
                               
                                

                                         

                                                        
                 
 

                                                                            

                                                            

                                         
        



                                                        

                                              


                    

 
                                                          

                                                           
                                   

  
                                                                 
 

                                                         
 











                                                                 

         

                     
 





                                                              
 
                                             
 
                        
 




                                                                     
 


                                                
 
 






                                                                               
 

                                          
 




                                                                        
 




                                                                    

 








                                                                             
 



                                                                        
 





                                                                    


                                                          
 



                                                       
 






                                                                                
           

                                                                    
 







                                                                     
         
 


                                                                  
         
                                                    
 



                                             
 
 




                                                                                

                                      



                                           
 
                                                             
 







                                                                               
 








                                                                             

         












                                                                             

         



                                                                    
 


                                                          
 







                                                                            

         





















                                                                                
 
 
                                                    
 
                                    
                                           
 







































                                                                                


                                                               
                                                           


                                                                           







                                                                             





                                                            
    
































































































                                                                                          

                                                  
                                                             

                                           
                                                        
                                                                         
                                                       
                                    

                                                             

                        
                                                          



                                                                                     
 

                                                                  
 

                                    
 










                                                                                
         
 



                                                                          
 

                                                                                
           
                          
                                   
 


                                                                                
 

                                                                                
           





                                                                    
 
                                                                                    
 

                                                               
 





                                                                                


                                                                                

                                                                  
 


                                                               
 





                                                                   



                                             
                                    

                                            

                                               


                   

 

                                 




                                                                  

                                               


                      


                                                                       



                                        



                                                               

                               



                                                                  






                                                                    
                                                                            
                                                                    



                                                                                
                                                                              







                                                                           

                                          


                  


                                                                                 


                  


                                                                                     


         






















                                                                            
                                                                          









                                                                        
          


                                                                 
 
                                  

                                          
                      
 




                                                                              
                  



                                                                               
                                                              

                                                                            



                                      














                                                                               
                                                                             
                                                    
                 



                                                                            
         
                                                                       
 
                                                
                  


                                                                        

                                 
                                                             

                                                              
                                                                    



                                                                       

                                                                         
                                       
                 
























                                                                            
                                                                          
                                                    

                 
                                                                        
 





                                                          


                                        
 


                                           



                               





                                                                                   





                                                                                 
























                                                                               
                                                                 


                          
                                   
                                


                                                                   








                                                                      
                                        
                                                    
                                                                   

         

                                      


                 
                                                    

                                       
                                   

                                                                 

                                                                              

                                      

                   

                                                       


                                              
                                            



                                          
















                                                                                         
                                                             
 
                                                        









                                                                                                                            





                                         


                                                    
                                             
                                                                   
                                          

         




                                                                               
                                                            
 
                                                                    

 
                                                                   
                                                      
 
                                                                        

                                            
 

                                                         
 

                                                                           
 
                           



                                               

                                                       
 
                 

 
                                                              
 

                                                   
                           

                      



                                                                        
                                                   




                                                                                

                        
 


                          
















                                                                       

                                                       
                                                             
                                      
                                
                      
 
                                        



                                                                     
 
                                 
                                                   
 
                                   
                                                         
 
                                                                      
                                                             



                            



















                                                                             

                          
                                                       
                                                            
                                                                      
                                   
                                                                    
                                                                          
                                                                     


                                                     
                                                            
 
                                                                    
                                                            
 
                                                      
                                                             
 
                                                                       
                                                             






                                                                  
                                                                    
                                                                      
                                                                 


                                                     
                                                            
 

                                                     
                                                         
                                                   
                                   
 
                                                       
                                                         
                                                                  

                                                                         
                                                                    
                         
 

                                                                    
                                                                 
                         
                 

                                                                           
 

                                                         
                                                                   
                 


                                                                   

                                                                         
                                                                    


                                                                
                                                                 
                         
                 
 


                                                        
                                                         
                 
                                

                                    
                             

                                   


                                                                                 
                                                      
         
 
                                                 
                                              




                                                                      

                                    
                                                                  




                                                                           
                                                                      


                                                                      
                                                        
 
                                                               






                                                              

                                                              
                                                             
                                                           
 

                
                                              

                               
                                      

                               
                                         


                                 
                                 


                                    
                                                            
                      



                             

                      

                                                              


                               






                                                                          
                            


                 


                                                     
                                                                
 
                                        
 

                                                                       
                               
                                        
 
                                                            

 
                                                              
                                                   
                                                            

  





                                                             
                                 
                                                                         

                                                                       
                                                          
                                                                       
                
                                                                     

                                                                   
                                                      
                                                                   
         
 
                                                  



                                                                       




                                                           
                                                                      







                                                           
                              





                                                           
                                 
                                   
                                                                                   
                                                                         
                                          
                                                                               
                                                                         


                                                                                     
                                                                         

                                                                              
                                                                        

                                                           
                                 
                                                            
         




















                                                                     


                                                                     
         

 




                                                                         
                                                     



                                                             
                                                  

 






                                                                           
                                                      

 
  

                                                                            




                                                             
                                                               

 






                                             
                                            
                                                            
                                                      
 


                                                                   





                                                                
                                                              


                                                            


                                                            


                                                                


















                                                                  












                                                               
                                 








                                               

                                                  




                                                                                   

                               

                                     
                                       
                                       
                                         

 

                                               
                                                             
                   





                                        


                                              
                                                   
 

                               

                           

                                



                                                   

                                                   
                

                                                   
         
                                                              
 
                                                       
                                                                             
 
                                                  
                                        


                                                                            

         

                                

                                             
                                 

 








                                                                  























                                                                               
 

 





                                                             









































                                                                                








                                                                               

















































































































































                                                                                            

                                                      

                                       



                                                   
                                   

                                 

                                          



                                                  



                                                             
                                      

                                       


                                       





                                                                      
                                              

         
                               
 
                                        
 

                                   


                                   

                                         



                                                                         
                                              
 


                                                     


                                     
  

                                                            
                                                                       
 

                                                        
 





                                                                      
 
















                                                                                









                                         
                                 










                                       
                               








                                        
                                




                                                         
                                                        






                                                    
                          






                                                                 
                                                           























                                                                               
                                                        

              

                                                             



























                                                                                        
/*
 * Copyright © 2006-2007 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 * Authors:
 *	Eric Anholt <eric@anholt.net>
 */

#include <linux/dmi.h>
#include <linux/module.h>
#include <linux/input.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/vgaarb.h>
#include <drm/drm_edid.h>
#include <drm/drmP.h>
#include "intel_drv.h"
#include <drm/i915_drm.h>
#include "i915_drv.h"
#include "i915_trace.h"
#include <drm/drm_dp_helper.h>
#include <drm/drm_crtc_helper.h>
#include <linux/dma_remapping.h>

#define HAS_eDP (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))

bool intel_pipe_has_type(struct drm_crtc *crtc, int type);
static void intel_increase_pllclock(struct drm_crtc *crtc);
static void intel_crtc_update_cursor(struct drm_crtc *crtc, bool on);

typedef struct {
	/* given values */
	int n;
	int m1, m2;
	int p1, p2;
	/* derived values */
	int	dot;
	int	vco;
	int	m;
	int	p;
} intel_clock_t;

typedef struct {
	int	min, max;
} intel_range_t;

typedef struct {
	int	dot_limit;
	int	p2_slow, p2_fast;
} intel_p2_t;

#define INTEL_P2_NUM		      2
typedef struct intel_limit intel_limit_t;
struct intel_limit {
	intel_range_t   dot, vco, n, m, m1, m2, p, p1;
	intel_p2_t	    p2;
	bool (* find_pll)(const intel_limit_t *, struct drm_crtc *,
			int, int, intel_clock_t *, intel_clock_t *);
};

/* FDI */
#define IRONLAKE_FDI_FREQ		2700000 /* in kHz for mode->clock */

static bool
intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
		    int target, int refclk, intel_clock_t *match_clock,
		    intel_clock_t *best_clock);
static bool
intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
			int target, int refclk, intel_clock_t *match_clock,
			intel_clock_t *best_clock);

static bool
intel_find_pll_g4x_dp(const intel_limit_t *, struct drm_crtc *crtc,
		      int target, int refclk, intel_clock_t *match_clock,
		      intel_clock_t *best_clock);
static bool
intel_find_pll_ironlake_dp(const intel_limit_t *, struct drm_crtc *crtc,
			   int target, int refclk, intel_clock_t *match_clock,
			   intel_clock_t *best_clock);

static bool
intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc,
			int target, int refclk, intel_clock_t *match_clock,
			intel_clock_t *best_clock);

static inline u32 /* units of 100MHz */
intel_fdi_link_freq(struct drm_device *dev)
{
	if (IS_GEN5(dev)) {
		struct drm_i915_private *dev_priv = dev->dev_private;
		return (I915_READ(FDI_PLL_BIOS_0) & FDI_PLL_FB_CLOCK_MASK) + 2;
	} else
		return 27;
}

static const intel_limit_t intel_limits_i8xx_dvo = {
	.dot = { .min = 25000, .max = 350000 },
	.vco = { .min = 930000, .max = 1400000 },
	.n = { .min = 3, .max = 16 },
	.m = { .min = 96, .max = 140 },
	.m1 = { .min = 18, .max = 26 },
	.m2 = { .min = 6, .max = 16 },
	.p = { .min = 4, .max = 128 },
	.p1 = { .min = 2, .max = 33 },
	.p2 = { .dot_limit = 165000,
		.p2_slow = 4, .p2_fast = 2 },
	.find_pll = intel_find_best_PLL,
};

static const intel_limit_t intel_limits_i8xx_lvds = {
	.dot = { .min = 25000, .max = 350000 },
	.vco = { .min = 930000, .max = 1400000 },
	.n = { .min = 3, .max = 16 },
	.m = { .min = 96, .max = 140 },
	.m1 = { .min = 18, .max = 26 },
	.m2 = { .min = 6, .max = 16 },
	.p = { .min = 4, .max = 128 },
	.p1 = { .min = 1, .max = 6 },
	.p2 = { .dot_limit = 165000,
		.p2_slow = 14, .p2_fast = 7 },
	.find_pll = intel_find_best_PLL,
};

static const intel_limit_t intel_limits_i9xx_sdvo = {
	.dot = { .min = 20000, .max = 400000 },
	.vco = { .min = 1400000, .max = 2800000 },
	.n = { .min = 1, .max = 6 },
	.m = { .min = 70, .max = 120 },
	.m1 = { .min = 10, .max = 22 },
	.m2 = { .min = 5, .max = 9 },
	.p = { .min = 5, .max = 80 },
	.p1 = { .min = 1, .max = 8 },
	.p2 = { .dot_limit = 200000,
		.p2_slow = 10, .p2_fast = 5 },
	.find_pll = intel_find_best_PLL,
};

static const intel_limit_t intel_limits_i9xx_lvds = {
	.dot = { .min = 20000, .max = 400000 },
	.vco = { .min = 1400000, .max = 2800000 },
	.n = { .min = 1, .max = 6 },
	.m = { .min = 70, .max = 120 },
	.m1 = { .min = 10, .max = 22 },
	.m2 = { .min = 5, .max = 9 },
	.p = { .min = 7, .max = 98 },
	.p1 = { .min = 1, .max = 8 },
	.p2 = { .dot_limit = 112000,
		.p2_slow = 14, .p2_fast = 7 },
	.find_pll = intel_find_best_PLL,
};


static const intel_limit_t intel_limits_g4x_sdvo = {
	.dot = { .min = 25000, .max = 270000 },
	.vco = { .min = 1750000, .max = 3500000},
	.n = { .min = 1, .max = 4 },
	.m = { .min = 104, .max = 138 },
	.m1 = { .min = 17, .max = 23 },
	.m2 = { .min = 5, .max = 11 },
	.p = { .min = 10, .max = 30 },
	.p1 = { .min = 1, .max = 3},
	.p2 = { .dot_limit = 270000,
		.p2_slow = 10,
		.p2_fast = 10
	},
	.find_pll = intel_g4x_find_best_PLL,
};

static const intel_limit_t intel_limits_g4x_hdmi = {
	.dot = { .min = 22000, .max = 400000 },
	.vco = { .min = 1750000, .max = 3500000},
	.n = { .min = 1, .max = 4 },
	.m = { .min = 104, .max = 138 },
	.m1 = { .min = 16, .max = 23 },
	.m2 = { .min = 5, .max = 11 },
	.p = { .min = 5, .max = 80 },
	.p1 = { .min = 1, .max = 8},
	.p2 = { .dot_limit = 165000,
		.p2_slow = 10, .p2_fast = 5 },
	.find_pll = intel_g4x_find_best_PLL,
};

static const intel_limit_t intel_limits_g4x_single_channel_lvds = {
	.dot = { .min = 20000, .max = 115000 },
	.vco = { .min = 1750000, .max = 3500000 },
	.n = { .min = 1, .max = 3 },
	.m = { .min = 104, .max = 138 },
	.m1 = { .min = 17, .max = 23 },
	.m2 = { .min = 5, .max = 11 },
	.p = { .min = 28, .max = 112 },
	.p1 = { .min = 2, .max = 8 },
	.p2 = { .dot_limit = 0,
		.p2_slow = 14, .p2_fast = 14
	},
	.find_pll = intel_g4x_find_best_PLL,
};

static const intel_limit_t intel_limits_g4x_dual_channel_lvds = {
	.dot = { .min = 80000, .max = 224000 },
	.vco = { .min = 1750000, .max = 3500000 },
	.n = { .min = 1, .max = 3 },
	.m = { .min = 104, .max = 138 },
	.m1 = { .min = 17, .max = 23 },
	.m2 = { .min = 5, .max = 11 },
	.p = { .min = 14, .max = 42 },
	.p1 = { .min = 2, .max = 6 },
	.p2 = { .dot_limit = 0,
		.p2_slow = 7, .p2_fast = 7
	},
	.find_pll = intel_g4x_find_best_PLL,
};

static const intel_limit_t intel_limits_g4x_display_port = {
	.dot = { .min = 161670, .max = 227000 },
	.vco = { .min = 1750000, .max = 3500000},
	.n = { .min = 1, .max = 2 },
	.m = { .min = 97, .max = 108 },
	.m1 = { .min = 0x10, .max = 0x12 },
	.m2 = { .min = 0x05, .max = 0x06 },
	.p = { .min = 10, .max = 20 },
	.p1 = { .min = 1, .max = 2},
	.p2 = { .dot_limit = 0,
		.p2_slow = 10, .p2_fast = 10 },
	.find_pll = intel_find_pll_g4x_dp,
};

static const intel_limit_t intel_limits_pineview_sdvo = {
	.dot = { .min = 20000, .max = 400000},
	.vco = { .min = 1700000, .max = 3500000 },
	/* Pineview's Ncounter is a ring counter */
	.n = { .min = 3, .max = 6 },
	.m = { .min = 2, .max = 256 },
	/* Pineview only has one combined m divider, which we treat as m2. */
	.m1 = { .min = 0, .max = 0 },
	.m2 = { .min = 0, .max = 254 },
	.p = { .min = 5, .max = 80 },
	.p1 = { .min = 1, .max = 8 },
	.p2 = { .dot_limit = 200000,
		.p2_slow = 10, .p2_fast = 5 },
	.find_pll = intel_find_best_PLL,
};

static const intel_limit_t intel_limits_pineview_lvds = {
	.dot = { .min = 20000, .max = 400000 },
	.vco = { .min = 1700000, .max = 3500000 },
	.n = { .min = 3, .max = 6 },
	.m = { .min = 2, .max = 256 },
	.m1 = { .min = 0, .max = 0 },
	.m2 = { .min = 0, .max = 254 },
	.p = { .min = 7, .max = 112 },
	.p1 = { .min = 1, .max = 8 },
	.p2 = { .dot_limit = 112000,
		.p2_slow = 14, .p2_fast = 14 },
	.find_pll = intel_find_best_PLL,
};

/* Ironlake / Sandybridge
 *
 * We calculate clock using (register_value + 2) for N/M1/M2, so here
 * the range value for them is (actual_value - 2).
 */
static const intel_limit_t intel_limits_ironlake_dac = {
	.dot = { .min = 25000, .max = 350000 },
	.vco = { .min = 1760000, .max = 3510000 },
	.n = { .min = 1, .max = 5 },