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

Commit ee8c7d29 authored by Vevek Venkatesan's avatar Vevek Venkatesan Committed by Madan Koyyalamudi
Browse files

qcacmn: refer system time for pld_is_pci_ep_awake timeout

Currently timeout for checking pld_is_pci_ep_awake in
hif_prevent_link_low_power_states might be higher than
the defined timeout depends on how long qdf_sleep takes
to get scheduled again, so avoid this uncertain timeout
adding reference to the system time.

Change-Id: I67a28d46c996ccc56680cf8e20c09a70729a33c5
CRs-Fixed: 2994746
parent 7a3e768a
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -898,15 +898,16 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif)
{
	struct hif_softc *scn = HIF_GET_SOFTC(hif);
	struct hif_ipci_softc *ipci_scn = HIF_GET_IPCI_SOFTC(scn);
	uint32_t timeout = 0;
	uint32_t start_time = 0, curr_time = 0;

	if (pld_is_pci_ep_awake(scn->qdf_dev->dev) == -ENOTSUPP)
		return 0;

	start_time = curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
	while (pld_is_pci_ep_awake(scn->qdf_dev->dev) &&
	       timeout <= EP_WAKE_RESET_DELAY_TIMEOUT_US) {
	       curr_time <= start_time + EP_WAKE_RESET_DELAY_TIMEOUT_MS) {
		qdf_sleep_us(EP_WAKE_RESET_DELAY_US);
		timeout += EP_WAKE_RESET_DELAY_US;
		curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
	}

	if (pld_is_pci_ep_awake(scn->qdf_dev->dev)) {
@@ -922,11 +923,11 @@ int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif)
	}

	ipci_scn->prevent_l1 = true;
	timeout = 0;
	start_time = curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
	while (!pld_is_pci_ep_awake(scn->qdf_dev->dev) &&
	       timeout <= EP_WAKE_DELAY_TIMEOUT_US) {
	       curr_time <= start_time + EP_WAKE_DELAY_TIMEOUT_MS) {
		qdf_sleep_us(EP_WAKE_DELAY_US);
		timeout += EP_WAKE_DELAY_US;
		curr_time = qdf_system_ticks_to_msecs(qdf_system_ticks());
	}

	if (pld_is_pci_ep_awake(scn->qdf_dev->dev) <= 0) {
+4 −4
Original line number Diff line number Diff line
@@ -65,11 +65,11 @@ struct hif_ipci_stats {

#ifdef FEATURE_HAL_DELAYED_REG_WRITE
#ifdef HAL_CONFIG_SLUB_DEBUG_ON
#define EP_WAKE_RESET_DELAY_TIMEOUT_US 3000
#define EP_WAKE_DELAY_TIMEOUT_US 7000
#define EP_WAKE_RESET_DELAY_TIMEOUT_MS 3
#define EP_WAKE_DELAY_TIMEOUT_MS 7
#else
#define EP_WAKE_RESET_DELAY_TIMEOUT_US 10000
#define EP_WAKE_DELAY_TIMEOUT_US 10000
#define EP_WAKE_RESET_DELAY_TIMEOUT_MS 10
#define EP_WAKE_DELAY_TIMEOUT_MS 10
#endif
#define EP_WAKE_RESET_DELAY_US 50
#define EP_WAKE_DELAY_US 200