aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-08-07 18:41:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:50 -0400
commite312c24cf8229f9b6e76dbfd5d99eefe21f4ac0a (patch)
tree79e3b967f3905716baef4bc73b4510543b38ceb5 /drivers/net/wireless/iwlwifi/iwl3945-base.c
parentd91b1ba37744bc7fb7524516be855c9fa81142e2 (diff)
iwlwifi: automatically adjust sleep level
Depending on required latency requested by pm_qos (via mac80211) we can automatically adjust the sleep state. Also, mac80211 has a user-visible dynamic sleep feature where we are supposed to stay awake after sending/receiving frames to better receive response frames to our packets, this can be integrated into the sleep command. Currently, and this patch doesn't change that yet, we default to using sleep level 1 if PS is enabled. With a module parameter to iwlcore, automatic adjustment to changing network latency requirements can be enabled -- this isn't yet the default due to requiring more testing. The goal is to enable automatic adjustment and then go into the deepest possible sleep state possible depending on the networking latency requirements. This patch does, however, enable IEEE80211_HW_SUPPORTS_DYNAMIC_PS to avoid the double-timer (one in software and one in the device) when transmitting -- the exact timeout may be ignored but that is not of big concern. Note also that we keep the hard-coded power indices around for thermal throttling -- the specification of that calls for using the specified power levels. Those can also be selected in debugfs to allow easier testing of such parameters. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c66
1 files changed, 3 insertions, 63 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index e5fa672e8390..e617411d0c5e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3554,65 +3554,6 @@ static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, show_retry_rate,
3554 store_retry_rate); 3554 store_retry_rate);
3555 3555
3556 3556
3557static ssize_t store_power_level(struct device *d,
3558 struct device_attribute *attr,
3559 const char *buf, size_t count)
3560{
3561 struct iwl_priv *priv = dev_get_drvdata(d);
3562 int ret;
3563 unsigned long mode;
3564
3565
3566 mutex_lock(&priv->mutex);
3567
3568 ret = strict_strtoul(buf, 10, &mode);
3569 if (ret)
3570 goto out;
3571
3572 ret = iwl_power_set_user_mode(priv, mode);
3573 if (ret) {
3574 IWL_DEBUG_MAC80211(priv, "failed setting power mode.\n");
3575 goto out;
3576 }
3577 ret = count;
3578
3579 out:
3580 mutex_unlock(&priv->mutex);
3581 return ret;
3582}
3583
3584static ssize_t show_power_level(struct device *d,
3585 struct device_attribute *attr, char *buf)
3586{
3587 struct iwl_priv *priv = dev_get_drvdata(d);
3588 int level = priv->power_data.power_mode;
3589 char *p = buf;
3590
3591 p += sprintf(p, "%d\n", level);
3592 return p - buf + 1;
3593}
3594
3595static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR,
3596 show_power_level, store_power_level);
3597
3598#define MAX_WX_STRING 80
3599
3600/* Values are in microsecond */
3601static const s32 timeout_duration[] = {
3602 350000,
3603 250000,
3604 75000,
3605 37000,
3606 25000,
3607};
3608static const s32 period_duration[] = {
3609 400000,
3610 700000,
3611 1000000,
3612 1000000,
3613 1000000
3614};
3615
3616static ssize_t show_channels(struct device *d, 3557static ssize_t show_channels(struct device *d,
3617 struct device_attribute *attr, char *buf) 3558 struct device_attribute *attr, char *buf)
3618{ 3559{
@@ -3789,7 +3730,6 @@ static struct attribute *iwl3945_sysfs_entries[] = {
3789#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 3730#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
3790 &dev_attr_measurement.attr, 3731 &dev_attr_measurement.attr,
3791#endif 3732#endif
3792 &dev_attr_power_level.attr,
3793 &dev_attr_retry_rate.attr, 3733 &dev_attr_retry_rate.attr,
3794 &dev_attr_statistics.attr, 3734 &dev_attr_statistics.attr,
3795 &dev_attr_status.attr, 3735 &dev_attr_status.attr,
@@ -3854,8 +3794,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
3854 priv->qos_data.qos_cap.val = 0; 3794 priv->qos_data.qos_cap.val = 0;
3855 3795
3856 priv->rates_mask = IWL_RATES_MASK; 3796 priv->rates_mask = IWL_RATES_MASK;
3857 /* If power management is turned on, default to CAM mode */
3858 priv->power_mode = IWL_POWER_MODE_CAM;
3859 priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER; 3797 priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER;
3860 3798
3861 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { 3799 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
@@ -3902,7 +3840,9 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
3902 /* Tell mac80211 our characteristics */ 3840 /* Tell mac80211 our characteristics */
3903 hw->flags = IEEE80211_HW_SIGNAL_DBM | 3841 hw->flags = IEEE80211_HW_SIGNAL_DBM |
3904 IEEE80211_HW_NOISE_DBM | 3842 IEEE80211_HW_NOISE_DBM |
3905 IEEE80211_HW_SPECTRUM_MGMT; 3843 IEEE80211_HW_SPECTRUM_MGMT |
3844 IEEE80211_HW_SUPPORTS_PS |
3845 IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
3906 3846
3907 hw->wiphy->interface_modes = 3847 hw->wiphy->interface_modes =
3908 BIT(NL80211_IFTYPE_STATION) | 3848 BIT(NL80211_IFTYPE_STATION) |