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

Commit 57210f7c authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by John W. Linville
Browse files

iwlagn: move iwl_suspend / iwl_resume to the transport layer



These flows needs to access the APM and a few other registers that can differ
between different transports.

Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5a878bf6
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1818,7 +1818,7 @@ int iwl_alive_start(struct iwl_priv *priv)
	/* Configure Tx antenna selection based on H/W config */
	iwlagn_send_tx_ant_config(priv, priv->cfg->valid_tx_ant);

	if (iwl_is_associated_ctx(ctx) && !priv->wowlan) {
	if (iwl_is_associated_ctx(ctx) && !priv->shrd->wowlan) {
		struct iwl_rxon_cmd *active_rxon =
				(struct iwl_rxon_cmd *)&ctx->active;
		/* apply any changes in staging */
@@ -1833,7 +1833,7 @@ int iwl_alive_start(struct iwl_priv *priv)
		iwlagn_set_rxon_chain(priv, ctx);
	}

	if (!priv->wowlan) {
	if (!priv->shrd->wowlan) {
		/* WoWLAN ucode will not reply in the same way, skip it */
		iwl_reset_run_time_calib(priv);
	}
@@ -2593,7 +2593,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,

	iwl_trans_stop_device(trans(priv));

	priv->wowlan = true;
	priv->shrd->wowlan = true;

	ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_wowlan,
					   IWL_UCODE_WOWLAN);
@@ -2693,7 +2693,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
	goto out;

 error:
	priv->wowlan = false;
	priv->shrd->wowlan = false;
	iwlagn_prepare_restart(priv);
	ieee80211_restart_hw(priv->hw);
 out:
@@ -2745,7 +2745,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
	/* we'll clear ctx->vif during iwlagn_prepare_restart() */
	vif = ctx->vif;

	priv->wowlan = false;
	priv->shrd->wowlan = false;

	device_set_wakeup_enable(priv->bus->dev, false);

+0 −41
Original line number Diff line number Diff line
@@ -1900,44 +1900,3 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
	return cpu_to_le32(res);
}
#ifdef CONFIG_PM

int iwl_suspend(struct iwl_priv *priv)
{
	/*
	 * This function is called when system goes into suspend state
	 * mac80211 will call iwl_mac_stop() from the mac80211 suspend function
	 * first but since iwl_mac_stop() has no knowledge of who the caller is,
	 * it will not call apm_ops.stop() to stop the DMA operation.
	 * Calling apm_ops.stop here to make sure we stop the DMA.
	 *
	 * But of course ... if we have configured WoWLAN then we did other
	 * things already :-)
	 */
	if (!priv->wowlan)
		iwl_apm_stop(priv);

	return 0;
}

int iwl_resume(struct iwl_priv *priv)
{
	bool hw_rfkill = false;

	iwl_enable_interrupts(priv);

	if (!(iwl_read32(priv, CSR_GP_CNTRL) &
				CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
		hw_rfkill = true;

	if (hw_rfkill)
		set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
	else
		clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status);

	wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rfkill);

	return 0;
}

#endif /* CONFIG_PM */
+0 −2
Original line number Diff line number Diff line
@@ -1280,8 +1280,6 @@ struct iwl_priv {

	u8 mac80211_registered;

	bool wowlan;

	/* eeprom -- this is in the card's little endian byte order */
	u8 *eeprom;
	int    nvm_device_type;
+2 −2
Original line number Diff line number Diff line
@@ -517,7 +517,7 @@ static int iwl_pci_suspend(struct device *device)
	 * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx.
	 */

	return iwl_suspend(shrd->priv);
	return iwl_trans_suspend(shrd->trans);
}

static int iwl_pci_resume(struct device *device)
@@ -536,7 +536,7 @@ static int iwl_pci_resume(struct device *device)
	 */
	pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);

	return iwl_resume(shrd->priv);
	return iwl_trans_resume(shrd->trans);
}

static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
+1 −1
Original line number Diff line number Diff line
@@ -348,7 +348,7 @@ static void iwl_power_build_cmd(struct iwl_priv *priv,

	dtimper = priv->hw->conf.ps_dtim_period ?: 1;

	if (priv->wowlan)
	if (priv->shrd->wowlan)
		iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper);
	else if (!priv->cfg->base_params->no_idle_support &&
		 priv->hw->conf.flags & IEEE80211_CONF_IDLE)
Loading