diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2014-07-24 11:56:17 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-07-24 11:56:17 -0700 |
commit | 59f09f2c3c62f2dcca11927bfca9e4c2b926e69d (patch) | |
tree | 99fe889dcd64c11ca62c0ff64a70221642c96726 | |
parent | 549c17410ae54605c6e7d2f17d6f3373cfb049c9 (diff) | |
parent | 5243d1444dbfc723b43481d198d5c566309e6d06 (diff) |
Merge "msm: vidc: flush queued work during device suspend"
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_v4l2_vidc.c | 30 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc.c | 6 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc_common.c | 27 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc_common.h | 1 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/venus_hfi.c | 19 | ||||
-rw-r--r-- | drivers/media/platform/msm/vidc/vidc_hfi_api.h | 1 | ||||
-rw-r--r-- | include/media/msm_vidc.h | 1 |
7 files changed, 85 insertions, 0 deletions
diff --git a/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c b/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c index 588cae79a1d9..280a8961cab2 100644 --- a/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c @@ -549,6 +549,35 @@ static const struct of_device_id msm_vidc_dt_match[] = { {} }; +static int msm_vidc_pm_suspend(struct device *pdev) +{ + struct msm_vidc_core *core; + + if (!pdev) { + dprintk(VIDC_ERR, "%s invalid device\n", __func__); + return -EINVAL; + } + + core = (struct msm_vidc_core *)pdev->platform_data; + if (!core) { + dprintk(VIDC_ERR, "%s invalid core\n", __func__); + return -EINVAL; + } + dprintk(VIDC_INFO, "%s\n", __func__); + + return msm_vidc_suspend(core->id); +} + +static int msm_vidc_pm_resume(struct device *dev) +{ + dprintk(VIDC_INFO, "%s\n", __func__); + return 0; +} + +static const struct dev_pm_ops msm_vidc_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(msm_vidc_pm_suspend, msm_vidc_pm_resume) +}; + MODULE_DEVICE_TABLE(of, msm_vidc_dt_match); static struct platform_driver msm_vidc_driver = { @@ -558,6 +587,7 @@ static struct platform_driver msm_vidc_driver = { .name = "msm_vidc_v4l2", .owner = THIS_MODULE, .of_match_table = msm_vidc_dt_match, + .pm = &msm_vidc_pm_ops, }, }; diff --git a/drivers/media/platform/msm/vidc/msm_vidc.c b/drivers/media/platform/msm/vidc/msm_vidc.c index 282942552a11..1a1218a44dfc 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_vidc.c @@ -1458,3 +1458,9 @@ int msm_vidc_close(void *instance) } EXPORT_SYMBOL(msm_vidc_close); +int msm_vidc_suspend(int core_id) +{ + return msm_comm_suspend(core_id); +} +EXPORT_SYMBOL(msm_vidc_suspend); + diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c index 8b85692f28d3..d30f4c847df2 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c @@ -2026,6 +2026,33 @@ exit: return rc; } +int msm_comm_suspend(int core_id) +{ + struct hfi_device *hdev; + struct msm_vidc_core *core; + int rc = 0; + + core = get_vidc_core(core_id); + if (!core) { + dprintk(VIDC_ERR, + "%s: Failed to find core for core_id = %d\n", + __func__, core_id); + return -EINVAL; + } + + hdev = (struct hfi_device *)core->device; + if (!hdev) { + dprintk(VIDC_ERR, "%s Invalid device handle\n", __func__); + return -EINVAL; + } + + rc = call_hfi_op(hdev, suspend, hdev->hfi_device_data); + if (rc) + dprintk(VIDC_WARN, "Failed to suspend\n"); + + return rc; +} + static int get_flipped_state(int present_state, int desired_state) { diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.h b/drivers/media/platform/msm/vidc/msm_vidc_common.h index c81f4f3e5766..a603494de1df 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.h +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.h @@ -40,6 +40,7 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags); int msm_comm_release_scratch_buffers(struct msm_vidc_inst *inst); int msm_comm_release_persist_buffers(struct msm_vidc_inst *inst); int msm_comm_force_cleanup(struct msm_vidc_inst *inst); +int msm_comm_suspend(int core_id); enum hal_extradata_id msm_comm_get_hal_extradata_index( enum v4l2_mpeg_vidc_extradata index); enum hal_buffer_layout_type msm_comm_get_hal_buffer_layout( diff --git a/drivers/media/platform/msm/vidc/venus_hfi.c b/drivers/media/platform/msm/vidc/venus_hfi.c index 8836b9dc69a4..ce996c78f47d 100644 --- a/drivers/media/platform/msm/vidc/venus_hfi.c +++ b/drivers/media/platform/msm/vidc/venus_hfi.c @@ -1427,6 +1427,24 @@ static int venus_hfi_power_enable(void *dev) static void venus_hfi_pm_hndlr(struct work_struct *work); static DECLARE_DELAYED_WORK(venus_hfi_pm_work, venus_hfi_pm_hndlr); +static int venus_hfi_suspend(void *dev) +{ + int rc = 0; + struct venus_hfi_device *device = (struct venus_hfi_device *) dev; + + if (!device) { + dprintk(VIDC_ERR, "%s invalid device\n", __func__); + return -EINVAL; + } + dprintk(VIDC_INFO, "%s\n", __func__); + + if (device->power_enabled) { + rc = flush_delayed_work(&venus_hfi_pm_work); + dprintk(VIDC_INFO, "%s flush delayed work %d\n", __func__, rc); + } + return 0; +} + static inline int venus_hfi_clk_gating_off(struct venus_hfi_device *device) { int rc = 0; @@ -4110,6 +4128,7 @@ static void venus_init_hfi_callbacks(struct hfi_device *hdev) hdev->capability_check = venus_hfi_capability_check; hdev->get_core_capabilities = venus_hfi_get_core_capabilities; hdev->power_enable = venus_hfi_power_enable; + hdev->suspend = venus_hfi_suspend; } int venus_hfi_initialize(struct hfi_device *hdev, u32 device_id, diff --git a/drivers/media/platform/msm/vidc/vidc_hfi_api.h b/drivers/media/platform/msm/vidc/vidc_hfi_api.h index ba7d403c23f7..e5b44cca5dba 100644 --- a/drivers/media/platform/msm/vidc/vidc_hfi_api.h +++ b/drivers/media/platform/msm/vidc/vidc_hfi_api.h @@ -1283,6 +1283,7 @@ struct hfi_device { int (*session_clean)(void *sess); int (*get_core_capabilities)(void); int (*power_enable)(void *dev); + int (*suspend)(void *dev); }; typedef void (*hfi_cmd_response_callback) (enum command_response cmd, diff --git a/include/media/msm_vidc.h b/include/media/msm_vidc.h index bd33284afcf3..075cf45109d4 100644 --- a/include/media/msm_vidc.h +++ b/include/media/msm_vidc.h @@ -78,6 +78,7 @@ enum session_type { }; void *msm_vidc_open(int core_id, int session_type); int msm_vidc_close(void *instance); +int msm_vidc_suspend(int core_id); int msm_vidc_querycap(void *instance, struct v4l2_capability *cap); int msm_vidc_enum_fmt(void *instance, struct v4l2_fmtdesc *f); int msm_vidc_s_fmt(void *instance, struct v4l2_format *f); |