aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 8b6398850657..375c2aca4da6 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1823static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1823static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1824{ 1824{
1825 struct ath_softc *sc = hw->priv; 1825 struct ath_softc *sc = hw->priv;
1826 struct ath_vif *avp = (void *)vif->drv_priv;
1826 u64 tsf; 1827 u64 tsf;
1827 1828
1828 mutex_lock(&sc->mutex); 1829 mutex_lock(&sc->mutex);
1829 ath9k_ps_wakeup(sc); 1830 ath9k_ps_wakeup(sc);
1830 tsf = ath9k_hw_gettsf64(sc->sc_ah); 1831 /* Get current TSF either from HW or kernel time. */
1832 if (sc->cur_chan == avp->chanctx) {
1833 tsf = ath9k_hw_gettsf64(sc->sc_ah);
1834 } else {
1835 tsf = sc->cur_chan->tsf_val +
1836 ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
1837 }
1831 ath9k_ps_restore(sc); 1838 ath9k_ps_restore(sc);
1832 mutex_unlock(&sc->mutex); 1839 mutex_unlock(&sc->mutex);
1833 1840
@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee80211_hw *hw,
1839 u64 tsf) 1846 u64 tsf)
1840{ 1847{
1841 struct ath_softc *sc = hw->priv; 1848 struct ath_softc *sc = hw->priv;
1849 struct ath_vif *avp = (void *)vif->drv_priv;
1842 1850
1843 mutex_lock(&sc->mutex); 1851 mutex_lock(&sc->mutex);
1844 ath9k_ps_wakeup(sc); 1852 ath9k_ps_wakeup(sc);
1845 ath9k_hw_settsf64(sc->sc_ah, tsf); 1853 getrawmonotonic(&avp->chanctx->tsf_ts);
1854 if (sc->cur_chan == avp->chanctx)
1855 ath9k_hw_settsf64(sc->sc_ah, tsf);
1856 avp->chanctx->tsf_val = tsf;
1846 ath9k_ps_restore(sc); 1857 ath9k_ps_restore(sc);
1847 mutex_unlock(&sc->mutex); 1858 mutex_unlock(&sc->mutex);
1848} 1859}
@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee80211_hw *hw,
1850static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1861static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1851{ 1862{
1852 struct ath_softc *sc = hw->priv; 1863 struct ath_softc *sc = hw->priv;
1864 struct ath_vif *avp = (void *)vif->drv_priv;
1853 1865
1854 mutex_lock(&sc->mutex); 1866 mutex_lock(&sc->mutex);
1855 1867
1856 ath9k_ps_wakeup(sc); 1868 ath9k_ps_wakeup(sc);
1857 ath9k_hw_reset_tsf(sc->sc_ah); 1869 getrawmonotonic(&avp->chanctx->tsf_ts);
1870 if (sc->cur_chan == avp->chanctx)
1871 ath9k_hw_reset_tsf(sc->sc_ah);
1872 avp->chanctx->tsf_val = 0;
1858 ath9k_ps_restore(sc); 1873 ath9k_ps_restore(sc);
1859 1874
1860 mutex_unlock(&sc->mutex); 1875 mutex_unlock(&sc->mutex);