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

Commit 1cc9b324 authored by Yeshwanth Sriram Guntuka's avatar Yeshwanth Sriram Guntuka
Browse files

qcacmn: Trigger sys wakeup for WMI command when WOW is enabled

DHCP packet is received in the IPA exception path when
system is suspending. As part of DHCP packet processing,
WMI_PEER_SET_PARAM_CMDID is sent to FW after WOW is
enabled resulting in self recovery getting triggered by
host.

Fix is to do an explicit system wakeup if a WMI command
has to be sent post WOW enablement.

Change-Id: If1904a4fe5c861deed1b35071be10cb8cc8d6407
CRs-Fixed: 2890913
parent 744bb448
Loading
Loading
Loading
Loading
+130 −0
Original line number Diff line number Diff line
@@ -324,6 +324,22 @@ enum hif_event_type {
	HIF_EVENT_SRNG_ACCESS_END,
};

/**
 * enum hif_system_pm_state - System PM state
 * HIF_SYSTEM_PM_STATE_ON: System in active state
 * HIF_SYSTEM_PM_STATE_BUS_RESUMING: bus resume in progress as part of
 *  system resume
 * HIF_SYSTEM_PM_STATE_BUS_SUSPENDING: bus suspend in progress as part of
 *  system suspend
 * HIF_SYSTEM_PM_STATE_BUS_SUSPENDED: bus suspended as part of system suspend
 */
enum hif_system_pm_state {
	HIF_SYSTEM_PM_STATE_ON,
	HIF_SYSTEM_PM_STATE_BUS_RESUMING,
	HIF_SYSTEM_PM_STATE_BUS_SUSPENDING,
	HIF_SYSTEM_PM_STATE_BUS_SUSPENDED,
};

#ifdef WLAN_FEATURE_DP_EVENT_HISTORY

/* HIF_EVENT_HIST_MAX should always be power of 2 */
@@ -1502,4 +1518,118 @@ void hif_log_ce_info(struct hif_softc *scn, uint8_t *data,
{
}
#endif

#ifdef SYSTEM_PM_CHECK
/**
 * __hif_system_pm_set_state() - Set system pm state
 * @hif: hif opaque handle
 * @state: system state
 *
 * Return:  None
 */
void __hif_system_pm_set_state(struct hif_opaque_softc *hif,
			       enum hif_system_pm_state state);

/**
 * hif_system_pm_set_state_on() - Set system pm state to ON
 * @hif: hif opaque handle
 *
 * Return:  None
 */
static inline
void hif_system_pm_set_state_on(struct hif_opaque_softc *hif)
{
	__hif_system_pm_set_state(hif, HIF_SYSTEM_PM_STATE_ON);
}

/**
 * hif_system_pm_set_state_resuming() - Set system pm state to resuming
 * @hif: hif opaque handle
 *
 * Return:  None
 */
static inline
void hif_system_pm_set_state_resuming(struct hif_opaque_softc *hif)
{
	__hif_system_pm_set_state(hif, HIF_SYSTEM_PM_STATE_BUS_RESUMING);
}

/**
 * hif_system_pm_set_state_suspending() - Set system pm state to suspending
 * @hif: hif opaque handle
 *
 * Return:  None
 */
static inline
void hif_system_pm_set_state_suspending(struct hif_opaque_softc *hif)
{
	__hif_system_pm_set_state(hif, HIF_SYSTEM_PM_STATE_BUS_SUSPENDING);
}

/**
 * hif_system_pm_set_state_suspended() - Set system pm state to suspended
 * @hif: hif opaque handle
 *
 * Return:  None
 */
static inline
void hif_system_pm_set_state_suspended(struct hif_opaque_softc *hif)
{
	__hif_system_pm_set_state(hif, HIF_SYSTEM_PM_STATE_BUS_SUSPENDED);
}

/**
 * hif_system_pm_get_state() - Get system pm state
 * @hif: hif opaque handle
 *
 * Return:  system state
 */
int32_t hif_system_pm_get_state(struct hif_opaque_softc *hif);

/**
 * hif_system_pm_state_check() - Check system state and trigger resume
 *  if required
 * @hif: hif opaque handle
 *
 * Return: 0 if system is in on state else error code
 */
int hif_system_pm_state_check(struct hif_opaque_softc *hif);
#else
static inline
void __hif_system_pm_set_state(struct hif_opaque_softc *hif,
			       enum hif_system_pm_state state)
{
}

static inline
void hif_system_pm_set_state_on(struct hif_opaque_softc *hif)
{
}

static inline
void hif_system_pm_set_state_resuming(struct hif_opaque_softc *hif)
{
}

static inline
void hif_system_pm_set_state_suspending(struct hif_opaque_softc *hif)
{
}

static inline
void hif_system_pm_set_state_suspended(struct hif_opaque_softc *hif)
{
}

static inline
int32_t hif_system_pm_get_state(struct hif_opaque_softc *hif)
{
	return 0;
}

static inline int hif_system_pm_state_check(struct hif_opaque_softc *hif)
{
	return 0;
}
#endif
#endif /* _HIF_H_ */
+39 −0
Original line number Diff line number Diff line
@@ -644,6 +644,7 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx,
	qdf_atomic_init(&scn->active_grp_tasklet_cnt);
	qdf_atomic_init(&scn->link_suspended);
	qdf_atomic_init(&scn->tasklet_from_intr);
	hif_system_pm_set_state_on(GET_HIF_OPAQUE_HDL(scn));
	qdf_mem_copy(&scn->callbacks, cbk,
		     sizeof(struct hif_driver_state_callbacks));
	scn->bus_type  = bus_type;
@@ -1724,3 +1725,41 @@ void hif_set_ce_service_max_rx_ind_flush(struct hif_opaque_softc *hif,
		hif_ctx->ce_service_max_rx_ind_flush =
						ce_service_max_rx_ind_flush;
}

#ifdef SYSTEM_PM_CHECK
void __hif_system_pm_set_state(struct hif_opaque_softc *hif,
			       enum hif_system_pm_state state)
{
	struct hif_softc *hif_ctx = HIF_GET_SOFTC(hif);

	qdf_atomic_set(&hif_ctx->sys_pm_state, state);
}

int32_t hif_system_pm_get_state(struct hif_opaque_softc *hif)
{
	struct hif_softc *hif_ctx = HIF_GET_SOFTC(hif);

	return qdf_atomic_read(&hif_ctx->sys_pm_state);
}

int hif_system_pm_state_check(struct hif_opaque_softc *hif)
{
	struct hif_softc *hif_ctx = HIF_GET_SOFTC(hif);
	int32_t sys_pm_state;

	if (!hif_ctx) {
		hif_err("hif context is null");
		return -EFAULT;
	}

	sys_pm_state = qdf_atomic_read(&hif_ctx->sys_pm_state);
	if (sys_pm_state == HIF_SYSTEM_PM_STATE_BUS_SUSPENDING ||
	    sys_pm_state == HIF_SYSTEM_PM_STATE_BUS_SUSPENDED) {
		hif_info("Triggering system wakeup");
		qdf_pm_system_wakeup();
		return -EAGAIN;
	}

	return 0;
}
#endif
+3 −0
Original line number Diff line number Diff line
@@ -256,6 +256,9 @@ struct hif_softc {
	/* Variable to track the link state change in RTPM */
	qdf_atomic_t pm_link_state;
#endif
#ifdef SYSTEM_PM_CHECK
	qdf_atomic_t sys_pm_state;
#endif
};

static inline
+16 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, 2016-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 2016-2021 The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -851,4 +851,19 @@ void htc_print_credit_history(HTC_HANDLE htc, uint32_t count,
	print(print_priv, "HTC Credit History Feature is disabled");
}
#endif

#ifdef SYSTEM_PM_CHECK
/**
 * htc_system_resume() - Send out any pending WMI/HTT
 *  messages pending in htc queues on system resume.
 * @htc: HTC handle
 *
 * Return: None
 */
void htc_system_resume(HTC_HANDLE htc);
#else
static inline void htc_system_resume(HTC_HANDLE htc)
{
}
#endif
#endif /* _HTC_API_H_ */
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, 2016-2017, 2019-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 2016-2017, 2019-2021 The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -79,6 +79,9 @@ struct htc_tx_packet_info {
/*Tag packet for runtime put in response or cleanup */
#define HTC_TX_PACKET_TAG_RTPM_PUT_RC  (HTC_TX_PACKET_TAG_USER_DEFINED + 4)

#define HTC_TX_PACKET_SYSTEM_SUSPEND   (HTC_TX_PACKET_TAG_USER_DEFINED + 5)
#define HTC_TX_PACKET_SYSTEM_RESUME    (HTC_TX_PACKET_TAG_USER_DEFINED + 6)

#define HTC_TX_PACKET_FLAG_FIXUP_NETBUF (1 << 0)
#define HTC_TX_PACKET_FLAG_HTC_HEADER_IN_NETBUF_DATA (1 << 1)

Loading