diff options
author | Esti Kummer <stkumer@localhost.localdomain> | 2008-07-18 01:52:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-04 15:09:06 -0400 |
commit | 298df1f62aa69881528bf0f1c3c14395bc447846 (patch) | |
tree | 0b372342e79a1ef5746179d57fe6c7c5ada9496b /drivers/net/wireless/iwlwifi/iwl4965-base.c | |
parent | ca579617d81baf5865498eb5fae58e453ee77c2c (diff) |
iwlwifi: corrects power_level in sysfs
This patch corrects power_level in sysfs.
Signed-off-by: Esti Kummer <ester.kummer@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 63 |
1 files changed, 20 insertions, 43 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 71f5da3fe5c4..2001b09738ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -3800,76 +3800,53 @@ static ssize_t store_power_level(struct device *d, | |||
3800 | const char *buf, size_t count) | 3800 | const char *buf, size_t count) |
3801 | { | 3801 | { |
3802 | struct iwl_priv *priv = dev_get_drvdata(d); | 3802 | struct iwl_priv *priv = dev_get_drvdata(d); |
3803 | int rc; | 3803 | int ret; |
3804 | int mode; | 3804 | int mode; |
3805 | 3805 | ||
3806 | mode = simple_strtoul(buf, NULL, 0); | 3806 | mode = simple_strtoul(buf, NULL, 0); |
3807 | mutex_lock(&priv->mutex); | 3807 | mutex_lock(&priv->mutex); |
3808 | 3808 | ||
3809 | if (!iwl_is_ready(priv)) { | 3809 | if (!iwl_is_ready(priv)) { |
3810 | rc = -EAGAIN; | 3810 | ret = -EAGAIN; |
3811 | goto out; | 3811 | goto out; |
3812 | } | 3812 | } |
3813 | 3813 | ||
3814 | rc = iwl_power_set_user_mode(priv, mode); | 3814 | ret = iwl_power_set_user_mode(priv, mode); |
3815 | if (rc) { | 3815 | if (ret) { |
3816 | IWL_DEBUG_MAC80211("failed setting power mode.\n"); | 3816 | IWL_DEBUG_MAC80211("failed setting power mode.\n"); |
3817 | goto out; | 3817 | goto out; |
3818 | } | 3818 | } |
3819 | rc = count; | 3819 | ret = count; |
3820 | 3820 | ||
3821 | out: | 3821 | out: |
3822 | mutex_unlock(&priv->mutex); | 3822 | mutex_unlock(&priv->mutex); |
3823 | return rc; | 3823 | return ret; |
3824 | } | 3824 | } |
3825 | 3825 | ||
3826 | #define MAX_WX_STRING 80 | ||
3827 | |||
3828 | /* Values are in microsecond */ | ||
3829 | static const s32 timeout_duration[] = { | ||
3830 | 350000, | ||
3831 | 250000, | ||
3832 | 75000, | ||
3833 | 37000, | ||
3834 | 25000, | ||
3835 | }; | ||
3836 | static const s32 period_duration[] = { | ||
3837 | 400000, | ||
3838 | 700000, | ||
3839 | 1000000, | ||
3840 | 1000000, | ||
3841 | 1000000 | ||
3842 | }; | ||
3843 | |||
3844 | static ssize_t show_power_level(struct device *d, | 3826 | static ssize_t show_power_level(struct device *d, |
3845 | struct device_attribute *attr, char *buf) | 3827 | struct device_attribute *attr, char *buf) |
3846 | { | 3828 | { |
3847 | struct iwl_priv *priv = dev_get_drvdata(d); | 3829 | struct iwl_priv *priv = dev_get_drvdata(d); |
3830 | int mode = priv->power_data.user_power_setting; | ||
3831 | int system = priv->power_data.system_power_setting; | ||
3848 | int level = priv->power_data.power_mode; | 3832 | int level = priv->power_data.power_mode; |
3849 | char *p = buf; | 3833 | char *p = buf; |
3850 | 3834 | ||
3851 | p += sprintf(p, "%d ", level); | 3835 | switch (system) { |
3852 | switch (level) { | 3836 | case IWL_POWER_SYS_AUTO: |
3853 | case IWL_POWER_MODE_CAM: | 3837 | p += sprintf(p, "SYSTEM:auto"); |
3854 | case IWL_POWER_AC: | ||
3855 | p += sprintf(p, "(AC)"); | ||
3856 | break; | 3838 | break; |
3857 | case IWL_POWER_BATTERY: | 3839 | case IWL_POWER_SYS_AC: |
3858 | p += sprintf(p, "(BATTERY)"); | 3840 | p += sprintf(p, "SYSTEM:ac"); |
3841 | break; | ||
3842 | case IWL_POWER_SYS_BATTERY: | ||
3843 | p += sprintf(p, "SYSTEM:battery"); | ||
3859 | break; | 3844 | break; |
3860 | default: | ||
3861 | p += sprintf(p, | ||
3862 | "(Timeout %dms, Period %dms)", | ||
3863 | timeout_duration[level - 1] / 1000, | ||
3864 | period_duration[level - 1] / 1000); | ||
3865 | } | 3845 | } |
3866 | /* | 3846 | |
3867 | if (!(priv->power_mode & IWL_POWER_ENABLED)) | 3847 | p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO)?"fixed":"auto"); |
3868 | p += sprintf(p, " OFF\n"); | 3848 | p += sprintf(p, "\tINDEX:%d", level); |
3869 | else | 3849 | p += sprintf(p, "\n"); |
3870 | p += sprintf(p, " \n"); | ||
3871 | */ | ||
3872 | p += sprintf(p, " \n"); | ||
3873 | return (p - buf + 1); | 3850 | return (p - buf + 1); |
3874 | } | 3851 | } |
3875 | 3852 | ||