[PATCH] rt2500usb: improve powersaving reliability

From: Ondrej Zary
Date: Wed Mar 24 2010 - 18:07:50 EST


According to my debugging, retrying 5 times (REGISTER_BUSY_COUNT) does not
provide enough time for the device to enter the required state. Sometimes,
the device needs 12 to 15 retries. Increase it to 20 to be sure.

This improves powersaving reliability but one problem still remains: power
state change sometimes fails completely - the bpp_state and rf_state get
stuck and cannot be changed anymore.

Signed-off-by: Ondrej Zary <linux@xxxxxxxxxxxxxxxxxxxx>

--- linux-2.6.34-rc2-orig/drivers/net/wireless/rt2x00/rt2500usb.c 2010-03-20 02:17:57.000000000 +0100
+++ linux-2.6.34-rc2/drivers/net/wireless/rt2x00/rt2500usb.c 2010-03-24 22:55:53.000000000 +0100
@@ -968,7 +968,7 @@ static int rt2500usb_set_state(struct rt
* We must wait until the register indicates that the
* device has entered the correct state.
*/
- for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
+ for (i = 0; i < 20; i++) {
rt2500usb_register_read(rt2x00dev, MAC_CSR17, &reg2);
bbp_state = rt2x00_get_field16(reg2, MAC_CSR17_BBP_CURR_STATE);
rf_state = rt2x00_get_field16(reg2, MAC_CSR17_RF_CURR_STATE);


--
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/