[PATCH 3/3] ar6k: SIWPOWER implementation

Samuel Ortiz sameo at openedhand.com
Thu Jan 31 21:43:01 CET 2008


Hi Werner,

This is a basic power management switch for ar6k, using the standard
SIWPOWER wireless extension.

Signed-off-by: Samuel Ortiz <sameo at openedhand.com>
---
 drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c |   33 ++++++++++++++--
 1 file changed, 30 insertions(+), 3 deletions(-)

Index: linux-2.6.24-rc8-omoko-svn/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c
===================================================================
--- linux-2.6.24-rc8-omoko-svn.orig/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c	2008-01-31 21:05:23.000000000 +0100
+++ linux-2.6.24-rc8-omoko-svn/drivers/sdio/function/wlan/ar6000/ar6000/wireless_ext.c	2008-01-31 21:32:49.000000000 +0100
@@ -890,7 +890,7 @@
               struct iw_request_info *info,
               struct iw_point *erq, char *key)
 {
-    AR_SOFTC_T *ar = (AR_SOFTC_T *)dev->priv;
+    AR_SOFTC_T *ar = (AR_SOFTC_T *)netdev_priv(dev);
     A_UINT8 keyIndex;
     struct ar_wep_key *wk;
 
@@ -932,6 +932,33 @@
     return 0;
 }
 
+static int ar6000_ioctl_siwpower(struct net_device *dev,
+				 struct iw_request_info *info,
+				 union iwreq_data *wrqu, char *extra)
+{
+	AR_SOFTC_T *ar = (AR_SOFTC_T *)netdev_priv(dev);
+	WMI_POWER_MODE power_mode;
+
+	if (wrqu->power.disabled)
+		power_mode = MAX_PERF_POWER;
+	else
+		power_mode = REC_POWER;
+
+	if (wmi_powermode_cmd(ar->arWmi, power_mode) < 0)
+		return -EIO;
+
+	return 0;
+}
+
+static int ar6000_ioctl_giwpower(struct net_device *dev,
+				 struct iw_request_info *info,
+				 union iwreq_data *wrqu, char *extra)
+{
+	AR_SOFTC_T *ar = (AR_SOFTC_T *)netdev_priv(dev);
+
+	return wmi_get_power_mode_cmd(ar->arWmi);
+}
+
 static int ar6000_ioctl_siwgenie(struct net_device *dev,
 				 struct iw_request_info *info,
 				 struct iw_point *dwrq,
@@ -1841,8 +1868,8 @@
     (iw_handler) ar6000_ioctl_giwretry,         /* SIOCGIWRETRY */
     (iw_handler) ar6000_ioctl_siwencode,        /* SIOCSIWENCODE */
     (iw_handler) ar6000_ioctl_giwencode,        /* SIOCGIWENCODE */
-    (iw_handler) NULL,         /* SIOCSIWPOWER */
-    (iw_handler) NULL,         /* SIOCGIWPOWER */
+    (iw_handler) ar6000_ioctl_siwpower,         /* SIOCSIWPOWER */
+    (iw_handler) ar6000_ioctl_giwpower,         /* SIOCGIWPOWER */
     (iw_handler) NULL,	/* -- hole -- */
     (iw_handler) NULL,	/* -- hole -- */
     (iw_handler) ar6000_ioctl_siwgenie,	/* SIOCSIWGENIE */





More information about the openmoko-kernel mailing list