diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-04-16 19:34:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-07 15:02:10 -0400 |
commit | 6f4083aadd57e3da12fa4e67fcadaec23138a315 (patch) | |
tree | d824f8591b67b8d575b225928af84d491528736a /drivers/net | |
parent | 947b13a7ccd31d8adbf41f466d6a1c770461596a (diff) |
iwlwifi: cleanup set_pwr_src
This patch cleans up semantic of set_pwr_src
set_pwr_src is now part of apm handlers group
in iwlcore
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-csr.h | 9 |
4 files changed, 28 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index f318c50a1a8f..69a355bbb97a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -492,7 +492,7 @@ int iwl4965_hw_rxq_stop(struct iwl_priv *priv) | |||
492 | return 0; | 492 | return 0; |
493 | } | 493 | } |
494 | 494 | ||
495 | static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) | 495 | static int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) |
496 | { | 496 | { |
497 | int ret; | 497 | int ret; |
498 | unsigned long flags; | 498 | unsigned long flags; |
@@ -504,20 +504,21 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) | |||
504 | return ret; | 504 | return ret; |
505 | } | 505 | } |
506 | 506 | ||
507 | if (!pwr_max) { | 507 | if (src == IWL_PWR_SRC_VAUX) { |
508 | u32 val; | 508 | u32 val; |
509 | |||
510 | ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, | 509 | ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, |
511 | &val); | 510 | &val); |
512 | 511 | ||
513 | if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) | 512 | if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) { |
514 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 513 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, |
515 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, | 514 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, |
516 | ~APMG_PS_CTRL_MSK_PWR_SRC); | 515 | ~APMG_PS_CTRL_MSK_PWR_SRC); |
517 | } else | 516 | } |
517 | } else { | ||
518 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 518 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, |
519 | APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, | 519 | APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, |
520 | ~APMG_PS_CTRL_MSK_PWR_SRC); | 520 | ~APMG_PS_CTRL_MSK_PWR_SRC); |
521 | } | ||
521 | 522 | ||
522 | iwl_release_nic_access(priv); | 523 | iwl_release_nic_access(priv); |
523 | spin_unlock_irqrestore(&priv->lock, flags); | 524 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -747,7 +748,8 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv) | |||
747 | 748 | ||
748 | IWL_DEBUG_INFO("HW Revision ID = 0x%X\n", rev_id); | 749 | IWL_DEBUG_INFO("HW Revision ID = 0x%X\n", rev_id); |
749 | 750 | ||
750 | iwl4965_nic_set_pwr_src(priv, 1); | 751 | rc = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN); |
752 | |||
751 | spin_lock_irqsave(&priv->lock, flags); | 753 | spin_lock_irqsave(&priv->lock, flags); |
752 | 754 | ||
753 | if ((rev_id & 0x80) == 0x80 && (rev_id & 0x7f) < 8) { | 755 | if ((rev_id & 0x80) == 0x80 && (rev_id & 0x7f) < 8) { |
@@ -4272,6 +4274,9 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
4272 | .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, | 4274 | .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, |
4273 | .alive_notify = iwl4965_alive_notify, | 4275 | .alive_notify = iwl4965_alive_notify, |
4274 | .load_ucode = iwl4965_load_bsm, | 4276 | .load_ucode = iwl4965_load_bsm, |
4277 | .apm_ops = { | ||
4278 | .set_pwr_src = iwl4965_set_pwr_src, | ||
4279 | }, | ||
4275 | .eeprom_ops = { | 4280 | .eeprom_ops = { |
4276 | .verify_signature = iwlcore_eeprom_verify_signature, | 4281 | .verify_signature = iwlcore_eeprom_verify_signature, |
4277 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, | 4282 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index b51243f46938..2c26d020103e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -252,6 +252,11 @@ struct iwl4965_clip_group { | |||
252 | 252 | ||
253 | /* Power management (not Tx power) structures */ | 253 | /* Power management (not Tx power) structures */ |
254 | 254 | ||
255 | enum iwl_pwr_src { | ||
256 | IWL_PWR_SRC_VMAIN, | ||
257 | IWL_PWR_SRC_VAUX, | ||
258 | }; | ||
259 | |||
255 | struct iwl4965_power_vec_entry { | 260 | struct iwl4965_power_vec_entry { |
256 | struct iwl4965_powertable_cmd cmd; | 261 | struct iwl4965_powertable_cmd cmd; |
257 | u8 no_dtim; | 262 | u8 no_dtim; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index dcbd411a4767..51f61fb844f0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -115,6 +115,9 @@ struct iwl_lib_ops { | |||
115 | int (*load_ucode)(struct iwl_priv *priv); | 115 | int (*load_ucode)(struct iwl_priv *priv); |
116 | /* rfkill */ | 116 | /* rfkill */ |
117 | void (*radio_kill_sw)(struct iwl_priv *priv, int disable_radio); | 117 | void (*radio_kill_sw)(struct iwl_priv *priv, int disable_radio); |
118 | struct { | ||
119 | int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); | ||
120 | } apm_ops; | ||
118 | /* eeprom operations (as defined in iwl-eeprom.h) */ | 121 | /* eeprom operations (as defined in iwl-eeprom.h) */ |
119 | struct iwl_eeprom_ops eeprom_ops; | 122 | struct iwl_eeprom_ops eeprom_ops; |
120 | }; | 123 | }; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index 12725796ea5f..a59f48b02f05 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -170,6 +170,10 @@ | |||
170 | #define CSR49_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL1 | \ | 170 | #define CSR49_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL1 | \ |
171 | CSR_FH_INT_BIT_TX_CHNL0) | 171 | CSR_FH_INT_BIT_TX_CHNL0) |
172 | 172 | ||
173 | /* GPIO */ | ||
174 | #define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) | ||
175 | #define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) | ||
176 | #define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC (0x00000200) | ||
173 | 177 | ||
174 | /* RESET */ | 178 | /* RESET */ |
175 | #define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) | 179 | #define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) |
@@ -206,11 +210,6 @@ | |||
206 | #define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) | 210 | #define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) |
207 | #define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) | 211 | #define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) |
208 | 212 | ||
209 | /* GPIO */ | ||
210 | #define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) | ||
211 | #define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) | ||
212 | #define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC CSR_GPIO_IN_BIT_AUX_POWER | ||
213 | |||
214 | /* GI Chicken Bits */ | 213 | /* GI Chicken Bits */ |
215 | #define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) | 214 | #define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) |
216 | #define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) | 215 | #define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) |