diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 80a62ba112950..fa5da05d02cf1 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -595,9 +595,12 @@ void vfe_isr_reset_ack(struct vfe_device *vfe) */ void vfe_pm_domain_off(struct vfe_device *vfe) { + WARN(1, "off"); +dev_info(vfe->camss->dev, "%s/%d vfe %d vfe->genpd %pK genpd_link %pK power-count %d\n", __func__, __LINE__, vfe->id, vfe->genpd, vfe->genpd_link, vfe->power_count); if (!vfe->genpd) return; +dev_info(vfe->camss->dev, "%s/%d vfe %d vfe->genpd %pK genpd_link %pK power-count %d\n", __func__, __LINE__, vfe->id, vfe->genpd, vfe->genpd_link, vfe->power_count); device_link_del(vfe->genpd_link); vfe->genpd_link = NULL; } @@ -609,14 +612,17 @@ void vfe_pm_domain_off(struct vfe_device *vfe) int vfe_pm_domain_on(struct vfe_device *vfe) { struct camss *camss = vfe->camss; - + WARN(1, "on"); +dev_info(vfe->camss->dev, "%s/%d vfe %d vfe->genpd %pK genpd_link %pK power-count %d\n", __func__, __LINE__, vfe->id, vfe->genpd, vfe->genpd_link, vfe->power_count); if (!vfe->genpd) return 0; +dev_info(vfe->camss->dev, "%s/%d vfe %d vfe->genpd %pK genpd_link %pK power-count %d\n", __func__, __LINE__, vfe->id, vfe->genpd, vfe->genpd_link, vfe->power_count); vfe->genpd_link = device_link_add(camss->dev, vfe->genpd, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); +dev_info(vfe->camss->dev, "%s/%d vfe %d vfe->genpd %pK genpd_link %pK power-count %d\n", __func__, __LINE__, vfe->id, vfe->genpd, vfe->genpd_link, vfe->power_count); if (!vfe->genpd_link) return -EINVAL; @@ -774,6 +780,7 @@ static int vfe_check_clock_rates(struct vfe_device *vfe) return 0; } +#define vfe_bug_trace(vfe) dev_info(vfe->camss->dev, "%s/%d vfe %d power_count %d\n", __func__, __LINE__, vfe->id, vfe->power_count); /* * vfe_get - Power up and reset VFE module @@ -786,31 +793,37 @@ int vfe_get(struct vfe_device *vfe) int ret; mutex_lock(&vfe->power_lock); - if (vfe->power_count == 0) { + vfe_bug_trace(vfe); ret = vfe->res->hw_ops->pm_domain_on(vfe); if (ret < 0) goto error_pm_domain; + vfe_bug_trace(vfe); ret = pm_runtime_resume_and_get(vfe->camss->dev); if (ret < 0) goto error_domain_off; + vfe_bug_trace(vfe); ret = vfe_set_clock_rates(vfe); if (ret < 0) goto error_pm_runtime_get; + vfe_bug_trace(vfe); ret = camss_enable_clocks(vfe->nclocks, vfe->clock, vfe->camss->dev); if (ret < 0) goto error_pm_runtime_get; + vfe_bug_trace(vfe); ret = vfe_reset(vfe); if (ret < 0) goto error_reset; + vfe_bug_trace(vfe); vfe_reset_output_maps(vfe); + vfe_bug_trace(vfe); vfe_init_outputs(vfe); vfe->res->hw_ops->hw_version(vfe); @@ -821,6 +834,7 @@ int vfe_get(struct vfe_device *vfe) } vfe->power_count++; + vfe_bug_trace(vfe); mutex_unlock(&vfe->power_lock); return 0; @@ -835,7 +849,7 @@ int vfe_get(struct vfe_device *vfe) error_pm_domain: mutex_unlock(&vfe->power_lock); - +dev_info(vfe->camss->dev, "%s vfe %d err=%d\n", __func__, vfe->id, ret); return ret; } @@ -847,20 +861,32 @@ void vfe_put(struct vfe_device *vfe) { mutex_lock(&vfe->power_lock); + vfe_bug_trace(vfe); if (vfe->power_count == 0) { + vfe_bug_trace(vfe); dev_err(vfe->camss->dev, "vfe power off on power_count == 0\n"); goto exit; } else if (vfe->power_count == 1) { + vfe_bug_trace(vfe); if (vfe->was_streaming) { + vfe_bug_trace(vfe); vfe->was_streaming = 0; + vfe_bug_trace(vfe); vfe->res->hw_ops->vfe_halt(vfe); + vfe_bug_trace(vfe); } + vfe_bug_trace(vfe); camss_disable_clocks(vfe->nclocks, vfe->clock); + vfe_bug_trace(vfe); pm_runtime_put_sync(vfe->camss->dev); + vfe_bug_trace(vfe); vfe->res->hw_ops->pm_domain_off(vfe); + vfe_bug_trace(vfe); } + vfe_bug_trace(vfe); vfe->power_count--; + vfe_bug_trace(vfe); exit: mutex_unlock(&vfe->power_lock);