Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abcb344b authored by Kalle Valo's avatar Kalle Valo
Browse files

ath6kl: implement suspend support



For now this is implemented so that if host supports power is kept in
the chip. If that's not supported, an error is returned and sdio stack
will remove the device during suspend.

Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 1df94a85
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "core.h"
#include "cfg80211.h"
#include "debug.h"
#include "hif-ops.h"

#define RATETAB_ENT(_rate, _rateid, _flags) {   \
	.bitrate    = (_rate),                  \
@@ -1424,6 +1425,16 @@ static int ath6kl_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
	return 0;
}

#ifdef CONFIG_PM
static int ar6k_cfg80211_suspend(struct wiphy *wiphy,
				 struct cfg80211_wowlan *wow)
{
	struct ath6kl *ar = wiphy_priv(wiphy);

	return ath6kl_hif_suspend(ar);
}
#endif

static struct cfg80211_ops ath6kl_cfg80211_ops = {
	.change_virtual_intf = ath6kl_cfg80211_change_iface,
	.scan = ath6kl_cfg80211_scan,
@@ -1443,6 +1454,9 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
	.set_pmksa = ath6kl_set_pmksa,
	.del_pmksa = ath6kl_del_pmksa,
	.flush_pmksa = ath6kl_flush_pmksa,
#ifdef CONFIG_PM
	.suspend = ar6k_cfg80211_suspend,
#endif
};

struct wireless_dev *ath6kl_cfg80211_init(struct device *dev)
+1 −0
Original line number Diff line number Diff line
@@ -544,6 +544,7 @@ void ath6kl_pspoll_event(struct ath6kl *ar, u8 aid);

void ath6kl_dtimexpiry_event(struct ath6kl *ar);
void ath6kl_disconnect(struct ath6kl *ar);
void ath6kl_deep_sleep_enable(struct ath6kl *ar);
void aggr_recv_delba_req_evt(struct ath6kl *ar, u8 tid);
void aggr_recv_addba_req_evt(struct ath6kl *ar, u8 tid, u16 seq_no,
			     u8 win_sz);
+5 −0
Original line number Diff line number Diff line
@@ -69,4 +69,9 @@ static inline void ath6kl_hif_cleanup_scatter(struct ath6kl *ar)
	return ar->hif_ops->cleanup_scatter(ar);
}

static inline int ath6kl_hif_suspend(struct ath6kl *ar)
{
	return ar->hif_ops->suspend(ar);
}

#endif
+1 −0
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ struct ath6kl_hif_ops {
	int (*scat_req_rw) (struct ath6kl *ar,
			    struct hif_scatter_req *scat_req);
	void (*cleanup_scatter)(struct ath6kl *ar);
	int (*suspend)(struct ath6kl *ar);
};

#endif
+35 −0
Original line number Diff line number Diff line
@@ -795,6 +795,41 @@ void ath6kl_disconnect(struct ath6kl *ar)
	}
}

void ath6kl_deep_sleep_enable(struct ath6kl *ar)
{
	switch (ar->sme_state) {
	case SME_CONNECTING:
		cfg80211_connect_result(ar->net_dev, ar->bssid, NULL, 0,
					NULL, 0,
					WLAN_STATUS_UNSPECIFIED_FAILURE,
					GFP_KERNEL);
		break;
	case SME_CONNECTED:
	default:
		/*
		 * FIXME: oddly enough smeState is in DISCONNECTED during
		 * suspend, why? Need to send disconnected event in that
		 * state.
		 */
		cfg80211_disconnected(ar->net_dev, 0, NULL, 0, GFP_KERNEL);
		break;
	}

	if (test_bit(CONNECTED, &ar->flag) ||
	    test_bit(CONNECT_PEND, &ar->flag))
		ath6kl_wmi_disconnect_cmd(ar->wmi);

	ar->sme_state = SME_DISCONNECTED;

	/* disable scanning */
	if (ath6kl_wmi_scanparams_cmd(ar->wmi, 0xFFFF, 0, 0, 0, 0, 0, 0, 0,
				      0, 0) != 0)
		printk(KERN_WARNING "ath6kl: failed to disable scan "
		       "during suspend\n");

	ath6kl_cfg80211_scan_complete_event(ar, -ECANCELED);
}

/* WMI Event handlers */

static const char *get_hw_id_string(u32 id)
Loading