Commit 963916df authored by Oleksij Rempel's avatar Oleksij Rempel Committed by John W. Linville

ath9k: make ath9k_spectral_scan_ do not depend on ath_softc

last preparation before moving ath9k_spectral_scan_ to spectral.c
Signed-off-by: default avatarOleksij Rempel <linux@rempel-privat.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ef948da5
...@@ -93,7 +93,7 @@ static int ath_set_channel(struct ath_softc *sc) ...@@ -93,7 +93,7 @@ static int ath_set_channel(struct ath_softc *sc)
/* perform spectral scan if requested. */ /* perform spectral scan if requested. */
if (test_bit(ATH_OP_SCANNING, &common->op_flags) && if (test_bit(ATH_OP_SCANNING, &common->op_flags) &&
sc->spec_priv.spectral_mode == SPECTRAL_CHANSCAN) sc->spec_priv.spectral_mode == SPECTRAL_CHANSCAN)
ath9k_spectral_scan_trigger(common); ath9k_spectral_scan_trigger(common, &sc->spec_priv);
} }
return 0; return 0;
......
...@@ -1337,10 +1337,10 @@ static void ath9k_disable_ps(struct ath_softc *sc) ...@@ -1337,10 +1337,10 @@ static void ath9k_disable_ps(struct ath_softc *sc)
ath_dbg(common, PS, "PowerSave disabled\n"); ath_dbg(common, PS, "PowerSave disabled\n");
} }
void ath9k_spectral_scan_trigger(struct ath_common *common) void ath9k_spectral_scan_trigger(struct ath_common *common,
struct ath_spec_scan_priv *spec_priv)
{ {
struct ath_softc *sc = common->priv; struct ath_hw *ah = spec_priv->ah;
struct ath_hw *ah = sc->sc_ah;
u32 rxfilter; u32 rxfilter;
if (config_enabled(CONFIG_ATH9K_TX99)) if (config_enabled(CONFIG_ATH9K_TX99))
...@@ -1362,16 +1362,16 @@ void ath9k_spectral_scan_trigger(struct ath_common *common) ...@@ -1362,16 +1362,16 @@ void ath9k_spectral_scan_trigger(struct ath_common *common)
* configuration, otherwise the register will have its values reset * configuration, otherwise the register will have its values reset
* (on my ar9220 to value 0x01002310) * (on my ar9220 to value 0x01002310)
*/ */
ath9k_spectral_scan_config(common, sc->spec_priv.spectral_mode); ath9k_spectral_scan_config(common, spec_priv, spec_priv->spectral_mode);
ath9k_hw_ops(ah)->spectral_scan_trigger(ah); ath9k_hw_ops(ah)->spectral_scan_trigger(ah);
ath_ps_ops(common)->restore(common); ath_ps_ops(common)->restore(common);
} }
int ath9k_spectral_scan_config(struct ath_common *common, int ath9k_spectral_scan_config(struct ath_common *common,
struct ath_spec_scan_priv *spec_priv,
enum spectral_mode spectral_mode) enum spectral_mode spectral_mode)
{ {
struct ath_softc *sc = common->priv; struct ath_hw *ah = spec_priv->ah;
struct ath_hw *ah = sc->sc_ah;
if (!ath9k_hw_ops(ah)->spectral_scan_trigger) { if (!ath9k_hw_ops(ah)->spectral_scan_trigger) {
ath_err(common, "spectrum analyzer not implemented on this hardware\n"); ath_err(common, "spectrum analyzer not implemented on this hardware\n");
...@@ -1380,29 +1380,29 @@ int ath9k_spectral_scan_config(struct ath_common *common, ...@@ -1380,29 +1380,29 @@ int ath9k_spectral_scan_config(struct ath_common *common,
switch (spectral_mode) { switch (spectral_mode) {
case SPECTRAL_DISABLED: case SPECTRAL_DISABLED:
sc->spec_priv.spec_config.enabled = 0; spec_priv->spec_config.enabled = 0;
break; break;
case SPECTRAL_BACKGROUND: case SPECTRAL_BACKGROUND:
/* send endless samples. /* send endless samples.
* TODO: is this really useful for "background"? * TODO: is this really useful for "background"?
*/ */
sc->spec_priv.spec_config.endless = 1; spec_priv->spec_config.endless = 1;
sc->spec_priv.spec_config.enabled = 1; spec_priv->spec_config.enabled = 1;
break; break;
case SPECTRAL_CHANSCAN: case SPECTRAL_CHANSCAN:
case SPECTRAL_MANUAL: case SPECTRAL_MANUAL:
sc->spec_priv.spec_config.endless = 0; spec_priv->spec_config.endless = 0;
sc->spec_priv.spec_config.enabled = 1; spec_priv->spec_config.enabled = 1;
break; break;
default: default:
return -1; return -1;
} }
ath_ps_ops(common)->wakeup(common); ath_ps_ops(common)->wakeup(common);
ath9k_hw_ops(ah)->spectral_scan_config(ah, &sc->spec_priv.spec_config); ath9k_hw_ops(ah)->spectral_scan_config(ah, &spec_priv->spec_config);
ath_ps_ops(common)->restore(common); ath_ps_ops(common)->restore(common);
sc->spec_priv.spectral_mode = spectral_mode; spec_priv->spectral_mode = spectral_mode;
return 0; return 0;
} }
......
...@@ -253,18 +253,18 @@ static ssize_t write_file_spec_scan_ctl(struct file *file, ...@@ -253,18 +253,18 @@ static ssize_t write_file_spec_scan_ctl(struct file *file,
buf[len] = '\0'; buf[len] = '\0';
if (strncmp("trigger", buf, 7) == 0) { if (strncmp("trigger", buf, 7) == 0) {
ath9k_spectral_scan_trigger(common); ath9k_spectral_scan_trigger(common, spec_priv);
} else if (strncmp("background", buf, 10) == 0) { } else if (strncmp("background", buf, 10) == 0) {
ath9k_spectral_scan_config(common, SPECTRAL_BACKGROUND); ath9k_spectral_scan_config(common, spec_priv, SPECTRAL_BACKGROUND);
ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n");
} else if (strncmp("chanscan", buf, 8) == 0) { } else if (strncmp("chanscan", buf, 8) == 0) {
ath9k_spectral_scan_config(common, SPECTRAL_CHANSCAN); ath9k_spectral_scan_config(common, spec_priv, SPECTRAL_CHANSCAN);
ath_dbg(common, CONFIG, "spectral scan: channel scan mode enabled\n"); ath_dbg(common, CONFIG, "spectral scan: channel scan mode enabled\n");
} else if (strncmp("manual", buf, 6) == 0) { } else if (strncmp("manual", buf, 6) == 0) {
ath9k_spectral_scan_config(common, SPECTRAL_MANUAL); ath9k_spectral_scan_config(common, spec_priv, SPECTRAL_MANUAL);
ath_dbg(common, CONFIG, "spectral scan: manual mode enabled\n"); ath_dbg(common, CONFIG, "spectral scan: manual mode enabled\n");
} else if (strncmp("disable", buf, 7) == 0) { } else if (strncmp("disable", buf, 7) == 0) {
ath9k_spectral_scan_config(common, SPECTRAL_DISABLED); ath9k_spectral_scan_config(common, spec_priv, SPECTRAL_DISABLED);
ath_dbg(common, CONFIG, "spectral scan: disabled\n"); ath_dbg(common, CONFIG, "spectral scan: disabled\n");
} else { } else {
return -EINVAL; return -EINVAL;
......
...@@ -133,8 +133,10 @@ static inline u8 spectral_bitmap_weight(u8 *bins) ...@@ -133,8 +133,10 @@ static inline u8 spectral_bitmap_weight(u8 *bins)
void ath9k_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy); void ath9k_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy);
void ath9k_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv); void ath9k_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv);
void ath9k_spectral_scan_trigger(struct ath_common *common); void ath9k_spectral_scan_trigger(struct ath_common *common,
struct ath_spec_scan_priv *spec_priv);
int ath9k_spectral_scan_config(struct ath_common *common, int ath9k_spectral_scan_config(struct ath_common *common,
struct ath_spec_scan_priv *spec_priv,
enum spectral_mode spectral_mode); enum spectral_mode spectral_mode);
#ifdef CONFIG_ATH9K_DEBUGFS #ifdef CONFIG_ATH9K_DEBUGFS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment