Kalle Valo <kvalo@xxxxxxxxxxxxxx> writes: > Loic Poulain <loic.poulain@xxxxxxxxxx> writes: > >> If the modem crashes for any reason, we may not be able to detect >> it at MHI level (MHI registers not reachable anymore). >> >> This patch implements a health-check mechanism to check regularly >> that device is alive (MHI layer can communicate with). If device >> is not alive (because a crash or unexpected reset), the recovery >> procedure is triggered. >> >> Tested successfully with Telit FN980m module. >> >> Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxx> >> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> >> Reviewed-by: Hemant Kumar <hemantk@xxxxxxxxxxxxxx> > > [...] > >> +#define HEALTH_CHECK_PERIOD (HZ * 2) > > [...] > >> +static void health_check(struct timer_list *t) >> +{ >> + struct mhi_pci_device *mhi_pdev = from_timer(mhi_pdev, t, health_check_timer); >> + struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; >> + >> + if (!mhi_pci_is_alive(mhi_cntrl)) { >> + dev_err(mhi_cntrl->cntrl_dev, "Device died\n"); >> + queue_work(system_long_wq, &mhi_pdev->recovery_work); >> + return; >> + } >> + >> + /* reschedule in two seconds */ >> + mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); >> +} > > Sorry for the late reply, I see that this is already applied. But I > wonder how this 2s polling affects battery life? Especially I'm worried > about increased power consumption with ath11k on laptops. Nevermind, I didn't realise that this is for pci_generic and ath11k does not use it. Sorry for the noise. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches