diff options
author | Vasily Khoruzhick <anarsoul@gmail.com> | 2011-01-21 15:44:49 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-03 16:38:26 -0500 |
commit | 75abde4d193fe300a2c1d3ee7f632eb777aa48b2 (patch) | |
tree | d6c8b835de0e28d43094d7c15c3c625436c6b628 /drivers/net/wireless/libertas/main.c | |
parent | 16f775befc1ccf67e6b223c4d9bb17ac3502ab2c (diff) |
libertas: Prepare stuff for if_spi.c pm support
To support suspend/resume in if_spi we need two things:
- re-setup fw in lbs_resume(), because if_spi powercycles card;
- don't touch hwaddr on second lbs_update_hw_spec() call for same
reason;
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 6836a6dd9853..ca8149cd5bd9 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -539,6 +539,43 @@ static int lbs_thread(void *data) | |||
539 | return 0; | 539 | return 0; |
540 | } | 540 | } |
541 | 541 | ||
542 | /** | ||
543 | * @brief This function gets the HW spec from the firmware and sets | ||
544 | * some basic parameters. | ||
545 | * | ||
546 | * @param priv A pointer to struct lbs_private structure | ||
547 | * @return 0 or -1 | ||
548 | */ | ||
549 | static int lbs_setup_firmware(struct lbs_private *priv) | ||
550 | { | ||
551 | int ret = -1; | ||
552 | s16 curlevel = 0, minlevel = 0, maxlevel = 0; | ||
553 | |||
554 | lbs_deb_enter(LBS_DEB_FW); | ||
555 | |||
556 | /* Read MAC address from firmware */ | ||
557 | memset(priv->current_addr, 0xff, ETH_ALEN); | ||
558 | ret = lbs_update_hw_spec(priv); | ||
559 | if (ret) | ||
560 | goto done; | ||
561 | |||
562 | /* Read power levels if available */ | ||
563 | ret = lbs_get_tx_power(priv, &curlevel, &minlevel, &maxlevel); | ||
564 | if (ret == 0) { | ||
565 | priv->txpower_cur = curlevel; | ||
566 | priv->txpower_min = minlevel; | ||
567 | priv->txpower_max = maxlevel; | ||
568 | } | ||
569 | |||
570 | /* Send cmd to FW to enable 11D function */ | ||
571 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_11D_ENABLE, 1); | ||
572 | |||
573 | lbs_set_mac_control(priv); | ||
574 | done: | ||
575 | lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); | ||
576 | return ret; | ||
577 | } | ||
578 | |||
542 | int lbs_suspend(struct lbs_private *priv) | 579 | int lbs_suspend(struct lbs_private *priv) |
543 | { | 580 | { |
544 | int ret; | 581 | int ret; |
@@ -584,47 +621,13 @@ int lbs_resume(struct lbs_private *priv) | |||
584 | lbs_pr_err("deep sleep activation failed: %d\n", ret); | 621 | lbs_pr_err("deep sleep activation failed: %d\n", ret); |
585 | } | 622 | } |
586 | 623 | ||
587 | lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); | 624 | if (priv->setup_fw_on_resume) |
588 | return ret; | 625 | ret = lbs_setup_firmware(priv); |
589 | } | ||
590 | EXPORT_SYMBOL_GPL(lbs_resume); | ||
591 | |||
592 | /** | ||
593 | * @brief This function gets the HW spec from the firmware and sets | ||
594 | * some basic parameters. | ||
595 | * | ||
596 | * @param priv A pointer to struct lbs_private structure | ||
597 | * @return 0 or -1 | ||
598 | */ | ||
599 | static int lbs_setup_firmware(struct lbs_private *priv) | ||
600 | { | ||
601 | int ret = -1; | ||
602 | s16 curlevel = 0, minlevel = 0, maxlevel = 0; | ||
603 | |||
604 | lbs_deb_enter(LBS_DEB_FW); | ||
605 | |||
606 | /* Read MAC address from firmware */ | ||
607 | memset(priv->current_addr, 0xff, ETH_ALEN); | ||
608 | ret = lbs_update_hw_spec(priv); | ||
609 | if (ret) | ||
610 | goto done; | ||
611 | |||
612 | /* Read power levels if available */ | ||
613 | ret = lbs_get_tx_power(priv, &curlevel, &minlevel, &maxlevel); | ||
614 | if (ret == 0) { | ||
615 | priv->txpower_cur = curlevel; | ||
616 | priv->txpower_min = minlevel; | ||
617 | priv->txpower_max = maxlevel; | ||
618 | } | ||
619 | 626 | ||
620 | /* Send cmd to FW to enable 11D function */ | ||
621 | ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_11D_ENABLE, 1); | ||
622 | |||
623 | lbs_set_mac_control(priv); | ||
624 | done: | ||
625 | lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); | 627 | lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); |
626 | return ret; | 628 | return ret; |
627 | } | 629 | } |
630 | EXPORT_SYMBOL_GPL(lbs_resume); | ||
628 | 631 | ||
629 | /** | 632 | /** |
630 | * This function handles the timeout of command sending. | 633 | * This function handles the timeout of command sending. |