drivers: ipa_v3: Conditionally compile out ipa wakelock code

* This is spurious and does not get destroyed, which keeps this
  wakelock as pending. Remove this code to save power.

* To enable these wakelocks again, pass `-DIPA_WAKELOCKS` as a
  cflag.

Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
Vaisakh Murali 2021-07-11 20:36:01 +05:30 committed by azrim
parent 967499fbf0
commit 6dcb992b79
No known key found for this signature in database
GPG Key ID: 497F8FB059B45D1C
3 changed files with 20 additions and 4 deletions

View File

@ -5600,6 +5600,7 @@ void ipa3_dec_client_disable_clks_no_block(
&ipa_dec_clients_disable_clks_on_wq_work, 0);
}
#ifdef IPA_WAKELOCKS
/**
* ipa3_inc_acquire_wakelock() - Increase active clients counter, and
* acquire wakelock if necessary
@ -5640,6 +5641,7 @@ void ipa3_dec_release_wakelock(void)
__pm_relax(&ipa3_ctx->w_lock);
spin_unlock_irqrestore(&ipa3_ctx->wakelock_ref_cnt.spinlock, flags);
}
#endif
int ipa3_set_clock_plan_from_pm(int idx)
{
@ -5837,11 +5839,13 @@ void ipa3_suspend_handler(enum ipa_irq_type interrupt,
atomic_set(
&ipa3_ctx->transport_pm.dec_clients,
1);
#ifdef IPA_WAKELOCKS
/*
* acquire wake lock as long as suspend
* vote is held
*/
ipa3_inc_acquire_wakelock();
#endif
ipa3_process_irq_schedule_rel();
}
mutex_unlock(pm_mutex_ptr);
@ -5918,7 +5922,9 @@ static void ipa3_transport_release_resource(struct work_struct *work)
ipa3_process_irq_schedule_rel();
} else {
atomic_set(&ipa3_ctx->transport_pm.dec_clients, 0);
#ifdef IPA_WAKELOCKS
ipa3_dec_release_wakelock();
#endif
IPA_ACTIVE_CLIENTS_DEC_SPECIAL("TRANSPORT_RESOURCE");
}
}
@ -7391,11 +7397,11 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
}
ipa3_debugfs_pre_init();
#ifdef IPA_WAKELOCKS
/* Create a wakeup source. */
wakeup_source_init(&ipa3_ctx->w_lock, "IPA_WS");
spin_lock_init(&ipa3_ctx->wakelock_ref_cnt.spinlock);
#endif
/* Initialize Power Management framework */
if (ipa3_ctx->use_ipa_pm) {
result = ipa_pm_init(&ipa3_res.pm_init);

View File

@ -804,14 +804,17 @@ static int ipa3_rx_switch_to_intr_mode(struct ipa3_sys_context *sys)
atomic_set(&sys->curr_polling_state, 0);
__ipa3_update_curr_poll_state(sys->ep->client, 0);
#ifdef IPA_WAKELOCKS
ipa3_dec_release_wakelock();
#endif
ret = gsi_config_channel_mode(sys->ep->gsi_chan_hdl,
GSI_CHAN_MODE_CALLBACK);
if ((ret != GSI_STATUS_SUCCESS) &&
!atomic_read(&sys->curr_polling_state)) {
if (ret == -GSI_STATUS_PENDING_IRQ) {
#ifdef IPA_WAKELOCKS
ipa3_inc_acquire_wakelock();
#endif
atomic_set(&sys->curr_polling_state, 1);
__ipa3_update_curr_poll_state(sys->ep->client, 1);
} else {
@ -4359,8 +4362,9 @@ void __ipa_gsi_irq_rx_scedule_poll(struct ipa3_sys_context *sys)
atomic_set(&sys->curr_polling_state, 1);
__ipa3_update_curr_poll_state(sys->ep->client, 1);
#ifdef IPA_WAKELOCKS
ipa3_inc_acquire_wakelock();
#endif
/*
* pm deactivate is done in wq context
@ -4449,7 +4453,9 @@ static void ipa_dma_gsi_irq_rx_notify_cb(struct gsi_chan_xfer_notify *notify)
/* put the gsi channel into polling mode */
gsi_config_channel_mode(sys->ep->gsi_chan_hdl,
GSI_CHAN_MODE_POLL);
#ifdef IPA_WAKELOCKS
ipa3_inc_acquire_wakelock();
#endif
atomic_set(&sys->curr_polling_state, 1);
queue_work(sys->wq, &sys->work);
}

View File

@ -1424,10 +1424,12 @@ struct ipa3_active_clients {
int bus_vote_idx;
};
#ifdef IPA_WAKELOCKS
struct ipa3_wakelock_ref_cnt {
spinlock_t spinlock;
int cnt;
};
#endif
struct ipa3_tag_completion {
struct completion comp;
@ -1974,8 +1976,10 @@ struct ipa3_context {
bool gsi_ch20_wa;
bool s1_bypass_arr[IPA_SMMU_CB_MAX];
u32 wdi_map_cnt;
#ifdef IPA_WAKELOCKS
struct wakeup_source w_lock;
struct ipa3_wakelock_ref_cnt wakelock_ref_cnt;
#endif
/* RMNET_IOCTL_INGRESS_FORMAT_AGG_DATA */
bool ipa_client_apps_wan_cons_agg_gro;
/* M-release support to know client pipes */