/arch/ppc/boot/

entos In-kernel qcow2 (Kernel part)OpenSLX
summaryrefslogblamecommitdiffstats
path: root/drivers/net/wireless/brcm80211/brcmsmac/channel.c
blob: cdb62b8ccc79c6c6ad6ea68269d3f03008d6e3e3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                               
                         
                         
                           






                        
                        
                  



                                                                     


                                         


                                                










                                                                   

                                      
 





                                                         




















                                                                        
                         










                                    








                                                                    



                                                                       



                                                            




                                                    


                                 
                                            











                                                     











                                                           





                                                           

                                                        
         
                                            

                                              

  















                                                                        

































                                                                               
                                                                             
 

                                             
 




                                                                                

         
                    

 
                                                              
 
                                 

 






                                                                           










































































                                                                            





                                                               

                                                  
 
                                               
 





                                                                  
 
                                                                   



               


                                                                          
                                         
                                                                

                                              
 







                                                                        












                                                                  
 
                                                                  
                                                        

                                                              
                                                            
 
                                                        








                                                             




                                                                        
                                                                       







                                                                 
                                                            
                                               



                                                                           
                                               
                                                                          


                                      




                                                                      
                                                                       





                                           
                                            






                                                      


                         
                                               


                                                         



                                                          
                              
 
                                           
                                        



                                            


                                             



                                                         
                                                    

                                             













                                                                              


                                                                      









































































































                                                                               



               

























                                                                              




                                                                   
                                                                    




                                               
                                               

                                                                              






                                                     
                    



                                                                        
                                                          
 







































                                                                        
                    













                                                                             

                                                                             














                                                                              

                                                                  



                                                               



                                               





                                                                           

















                                                                             

                                                                    


                                                                     


                                                                              












                                                             

                                                                      
 


                                                                       




                                                                  












                                                                             
/*
 * Copyright (c) 2010 Broadcom Corporation
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <linux/types.h>
#include <net/cfg80211.h>
#include <net/mac80211.h>
#include <net/regulatory.h>

#include <defs.h>
#include "pub.h"
#include "phy/phy_hal.h"
#include "main.h"
#include "stf.h"
#include "channel.h"
#include "mac80211_if.h"
#include "debug.h"

/* QDB() macro takes a dB value and converts to a quarter dB value */
#define QDB(n) ((n) * BRCMS_TXPWR_DB_FACTOR)

#define LOCALE_MIMO_IDX_bn		0
#define LOCALE_MIMO_IDX_11n		0

/* max of BAND_5G_PWR_LVLS and 14 for 2.4 GHz */
#define BRCMS_MAXPWR_MIMO_TBL_SIZE	14

/* maxpwr mapping to 5GHz band channels:
 * maxpwr[0] - channels [34-48]
 * maxpwr[1] - channels [52-60]
 * maxpwr[2] - channels [62-64]
 * maxpwr[3] - channels [100-140]
 * maxpwr[4] - channels [149-165]
 */
#define BAND_5G_PWR_LVLS	5	/* 5 power levels for 5G */

#define LC(id)	LOCALE_MIMO_IDX_ ## id

#define LOCALES(mimo2, mimo5) \
		{LC(mimo2), LC(mimo5)}

/* macro to get 5 GHz channel group index for tx power */
#define CHANNEL_POWER_IDX_5G(c) (((c) < 52) ? 0 : \
				 (((c) < 62) ? 1 : \
				 (((c) < 100) ? 2 : \
				 (((c) < 149) ? 3 : 4))))

#define BRCM_2GHZ_2412_2462	REG_RULE(2412-10, 2462+10, 40, 0, 19, 0)
#define BRCM_2GHZ_2467_2472	REG_RULE(2467-10, 2472+10, 20, 0, 19, \
					 NL80211_RRF_PASSIVE_SCAN | \
					 NL80211_RRF_NO_IBSS)

#define BRCM_5GHZ_5180_5240	REG_RULE(5180-10, 5240+10, 40, 0, 21, \
					 NL80211_RRF_PASSIVE_SCAN | \
					 NL80211_RRF_NO_IBSS)
#define BRCM_5GHZ_5260_5320	REG_RULE(5260-10, 5320+10, 40, 0, 21, \
					 NL80211_RRF_PASSIVE_SCAN | \
					 NL80211_RRF_DFS | \
					 NL80211_RRF_NO_IBSS)
#define BRCM_5GHZ_5500_5700	REG_RULE(5500-10, 5700+10, 40, 0, 21, \
					 NL80211_RRF_PASSIVE_SCAN | \
					 NL80211_RRF_DFS | \
					 NL80211_RRF_NO_IBSS)
#define BRCM_5GHZ_5745_5825	REG_RULE(5745-10, 5825+10, 40, 0, 21, \
					 NL80211_RRF_PASSIVE_SCAN | \
					 NL80211_RRF_NO_IBSS)

static const struct ieee80211_regdomain brcms_regdom_x2 = {
	.n_reg_rules = 6,
	.alpha2 = "X2",
	.reg_rules = {
		BRCM_2GHZ_2412_2462,
		BRCM_2GHZ_2467_2472,
		BRCM_5GHZ_5180_5240,
		BRCM_5GHZ_5260_5320,
		BRCM_5GHZ_5500_5700,
		BRCM_5GHZ_5745_5825,
	}
};

 /* locale per-channel tx power limits for MIMO frames