Skip to content

Commit 3969e19

Browse files
Miguel VadilloLuis Henriques
authored andcommitted
SYSLINK:ipu-pm: Refactor ipu-pm module and fix suspend/resume
Also has compiler warning fix in AUXCLK request function syslink: ipu_pm: refactor and cleanup functions Including: - ipu_pm module code was a reviewed and reworked to remove redundant code, simplify and enhance the implementation. - Change ipu_notifications to receive proc_id. - Add IOMMU_FAULT notifier callback function. - Function to release all resources when IOMMU_FAULT event is received or when detaching, this is called in a workqueue to avoid calling context problems in the case of the FAULT event and called directly in the case of detaching. - Add the possibility to select the SRC_CLK when requesting a gptimer. - Add pr_debug traces for debugging purpose: Previosly all the errors when requesting/releasing resources were just reported to IPU using notify_event in the payload. Now kernel is printing errors/warnings/ debug messages and also reporting the error back to IPU. This is needed because IPU could be dead and not able to see/print the error ipu_pm is reporting. Change-Id: I22614bafc7cb7e3070d5bf565be6138fca5a809b Signed-off-by: Miguel Vadillo <[email protected]> syslink: ipu_pm: fix suspend/resume when no IPU image loaded ipu_pm_drv_suspend and _resume were trying to notify ipu for suspend/resume without cheking if an image was loaded leading to an error in the suspend path. Checking the handle to each proc before sending the notification is avoiding this. Suspend/resume is working now with/without an image loaded in IPU. Change-Id: I55aca1674b1cdffba9fb3247e7da605b4082a521 Signed-off-by: Miguel Vadillo <[email protected]> SYSLINK: IPU-PM: clean up warning in AUXCLK request function clean up clk_disable( ) warning in AUXCLK request function: ipu_pm_get_aux_clk( ). Change-Id: I6bcc41e220f80f4e248bef65b3ed0fc379451d98 Signed-off-by: Paul Hunt <[email protected]> SYSLINK: IPU-PM: restore IOMMU during ipu pm detach and mmu close The IPU PM during the Ducati hibernation is shutting down the IOMMU. If the User process that is using IOMMU is killed when the Ducati is in hibernation state, the board hangs due to access to IOMMU during resource cleanup. The issue was observed when the Syslink daemon is killed with Ducati in hibernation. Change-Id: Ia5bd05fe382488c33ac858657f05aee9e22a48ee Signed-off-by: Hari Kanigeri <[email protected]>
1 parent 6a24561 commit 3969e19

File tree

5 files changed

+1121
-1958
lines changed

5 files changed

+1121
-1958
lines changed

arch/arm/mach-omap2/ipu_dev.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ static char *hwmod_state_strings[] = {
4141
"_HWMOD_STATE_IDLE",
4242
"_HWMOD_STATE_DISABLED",
4343
};
44-
static void print_hwmod_state(struct omap_hwmod *oh)
44+
static void print_hwmod_state(struct omap_hwmod *oh, char *desc)
4545
{
4646
u32 _state = (u32) oh->_state;
47-
pr_info("HWMOD name = %s\n", oh->name);
47+
pr_debug("HWMOD name = %s\n", oh->name);
4848
if (_state > _HWMOD_STATE_LAST)
4949
WARN(1, "Illegal hwmod _state = %d\n", _state);
5050
else
51-
pr_info("state = %s\n", hwmod_state_strings[_state]);
51+
pr_debug("%s state = %s\n", desc, hwmod_state_strings[_state]);
5252
}
5353

5454
inline int ipu_pm_module_start(unsigned rsrc)
@@ -58,11 +58,11 @@ inline int ipu_pm_module_start(unsigned rsrc)
5858

5959
pd = ipupm_get_plat_data();
6060

61-
print_hwmod_state(pd[rsrc].oh);
61+
print_hwmod_state(pd[rsrc].oh, "Previous");
6262
ret = omap_device_enable(pd[rsrc].pdev);
6363
if (ret)
6464
pr_err("device enable failed %s", pd[rsrc].oh_name);
65-
65+
print_hwmod_state(pd[rsrc].oh, "New");
6666
return ret;
6767
}
6868
EXPORT_SYMBOL(ipu_pm_module_start);
@@ -74,8 +74,10 @@ inline int ipu_pm_module_stop(unsigned rsrc)
7474

7575
pd = ipupm_get_plat_data();
7676

77-
print_hwmod_state(pd[rsrc].oh);
77+
print_hwmod_state(pd[rsrc].oh, "Previous");
7878
ret = omap_device_shutdown(pd[rsrc].pdev);
79+
print_hwmod_state(pd[rsrc].oh, "New");
80+
7981
if (ret)
8082
pr_err("device disable failed %s", pd[rsrc].oh_name);
8183

arch/arm/mach-omap2/ipu_drv.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,24 +201,32 @@ static int ipu_pm_drv_suspend(struct device *dev)
201201
* BIOS timers could be saved locally or on Ducati
202202
*/
203203

204-
/* call our notification function */
205-
retval = ipu_pm_notifications(PM_SUSPEND, NULL);
206-
207204
/* FIXME: Currently sending SUSPEND is enough to send
208205
* Ducati to hibernate, save ctx can be called at this
209206
* point to save ctx and reset remote procs
210207
* Currently the save ctx process can be called using
211208
* which ever proc_id, maybe this will change when
212209
* Tesla support is added.
213210
*/
214-
/* sysm3 is handling hibernation of ducati currently */
215-
ipu_pm_save_ctx(SYS_M3);
211+
/* call notification function */
212+
if (ipu_pm_get_handle(APP_M3)) {
213+
retval = ipu_pm_notifications(APP_M3, PM_SUSPEND, NULL);
214+
if (retval)
215+
goto error;
216+
}
217+
if (ipu_pm_get_handle(SYS_M3)) {
218+
retval = ipu_pm_notifications(SYS_M3, PM_SUSPEND, NULL);
219+
if (retval)
220+
goto error;
221+
/* sysm3 is handling hibernation of ducati currently */
222+
ipu_pm_save_ctx(SYS_M3);
223+
}
216224

217225
/* return result, should be zero if all Ducati clients
218226
* returned zero else fail code
219227
*/
220228
}
221-
229+
error:
222230
return retval;
223231
}
224232

@@ -234,13 +242,22 @@ static int ipu_pm_drv_resume(struct device *dev)
234242
*/
235243

236244
/* call our notification function */
237-
retval = ipu_pm_notifications(PM_RESUME, NULL);
245+
if (ipu_pm_get_handle(APP_M3)) {
246+
retval = ipu_pm_notifications(APP_M3, PM_RESUME, NULL);
247+
if (retval)
248+
goto error;
249+
}
250+
if (ipu_pm_get_handle(SYS_M3)) {
251+
retval = ipu_pm_notifications(SYS_M3, PM_RESUME, NULL);
252+
if (retval)
253+
goto error;
254+
}
238255

239256
/* return result, should be zero if all Ducati clients
240257
* returned zero else fail code
241258
*/
242259
}
243-
260+
error:
244261
return retval;
245262
}
246263

drivers/dsp/syslink/devh/44xx/devh44xx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ static int devh44xx_notifier_call(struct notifier_block *nb,
122122
err = mutex_lock_interruptible(&local_gate);
123123
if (err)
124124
goto exit;
125-
err = ipu_pm_notifications(PM_PID_DEATH, (void *)my_pid);
125+
err = ipu_pm_notifications(APP_M3, PM_PID_DEATH,
126+
(void *)my_pid);
126127
if (err) {
127128
pinfo->brd_state = DEVH_BRDST_ERROR;
128129
if (!strcmp(pdata->name, "SysM3")) {

0 commit comments

Comments
 (0)