0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _ZD_RF_H
0009 #define _ZD_RF_H
0010
0011 #define UW2451_RF 0x2
0012 #define UCHIP_RF 0x3
0013 #define AL2230_RF 0x4
0014 #define AL7230B_RF 0x5
0015 #define THETA_RF 0x6
0016 #define AL2210_RF 0x7
0017 #define MAXIM_NEW_RF 0x8
0018 #define UW2453_RF 0x9
0019 #define AL2230S_RF 0xa
0020 #define RALINK_RF 0xb
0021 #define INTERSIL_RF 0xc
0022 #define RF2959_RF 0xd
0023 #define MAXIM_NEW2_RF 0xe
0024 #define PHILIPS_RF 0xf
0025
0026 #define RF_CHANNEL(ch) [(ch)-1]
0027
0028
0029
0030 enum {
0031 RF_REG_BITS = 6,
0032 RF_VALUE_BITS = 18,
0033 RF_RV_BITS = RF_REG_BITS + RF_VALUE_BITS,
0034 };
0035
0036 struct zd_rf {
0037 u8 type;
0038
0039 u8 channel;
0040
0041
0042
0043 u8 update_channel_int:1;
0044
0045
0046
0047
0048
0049 u8 patch_cck_gain:1;
0050
0051
0052 void *priv;
0053
0054
0055 int (*init_hw)(struct zd_rf *rf);
0056 int (*set_channel)(struct zd_rf *rf, u8 channel);
0057 int (*switch_radio_on)(struct zd_rf *rf);
0058 int (*switch_radio_off)(struct zd_rf *rf);
0059 int (*patch_6m_band_edge)(struct zd_rf *rf, u8 channel);
0060 void (*clear)(struct zd_rf *rf);
0061 };
0062
0063 const char *zd_rf_name(u8 type);
0064 void zd_rf_init(struct zd_rf *rf);
0065 void zd_rf_clear(struct zd_rf *rf);
0066 int zd_rf_init_hw(struct zd_rf *rf, u8 type);
0067
0068 int zd_rf_scnprint_id(struct zd_rf *rf, char *buffer, size_t size);
0069
0070 int zd_rf_set_channel(struct zd_rf *rf, u8 channel);
0071
0072 int zd_switch_radio_on(struct zd_rf *rf);
0073 int zd_switch_radio_off(struct zd_rf *rf);
0074
0075 int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel);
0076 int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel);
0077
0078 static inline int zd_rf_should_update_pwr_int(struct zd_rf *rf)
0079 {
0080 return rf->update_channel_int;
0081 }
0082
0083 static inline int zd_rf_should_patch_cck_gain(struct zd_rf *rf)
0084 {
0085 return rf->patch_cck_gain;
0086 }
0087
0088 int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel);
0089 int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel);
0090
0091
0092
0093 int zd_rf_init_rf2959(struct zd_rf *rf);
0094 int zd_rf_init_al2230(struct zd_rf *rf);
0095 int zd_rf_init_al7230b(struct zd_rf *rf);
0096 int zd_rf_init_uw2453(struct zd_rf *rf);
0097
0098 #endif