diff mbox series

[04/12] drm/msm: dpu: Don't use power_event for vbif_init_memtypes

Message ID 20181112194222.193546-5-sean@poorly.run (mailing list archive)
State New, archived
Headers show
Series drm/msm: dpu: Clean up runtime power handling | expand

Commit Message

Sean Paul Nov. 12, 2018, 7:42 p.m. UTC
From: Sean Paul <seanpaul@chromium.org>

power_events are only used for pm_runtime, and that's all handled in
dpu_kms. So just call vbif_init_memtypes at the correct times.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 21 +++------------------
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h |  1 -
 2 files changed, 3 insertions(+), 19 deletions(-)

Comments

Jeykumar Sankaran Nov. 13, 2018, 1:01 a.m. UTC | #1
On 2018-11-12 11:42, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> power_events are only used for pm_runtime, and that's all handled in
> dpu_kms. So just call vbif_init_memtypes at the correct times.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 21 +++------------------
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h |  1 -
>  2 files changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 23094d108e81..ae2bbaae923d 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -651,10 +651,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms
> *dpu_kms)
>  		dpu_hw_intr_destroy(dpu_kms->hw_intr);
>  	dpu_kms->hw_intr = NULL;
> 
> -	if (dpu_kms->power_event)
> -		dpu_power_handle_unregister_event(
> -				&dpu_kms->phandle, dpu_kms->power_event);
> -
>  	/* safe to call these more than once during shutdown */
>  	_dpu_debugfs_destroy(dpu_kms);
>  	_dpu_kms_mmu_destroy(dpu_kms);
> @@ -832,16 +828,6 @@ u64 dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms,
> char *clock_name)
>  	return clk_get_rate(clk->clk);
>  }
> 
> -static void dpu_kms_handle_power_event(u32 event_type, void *usr)
> -{
> -	struct dpu_kms *dpu_kms = usr;
> -
> -	if (!dpu_kms)
> -		return;
> -
> -	dpu_vbif_init_memtypes(dpu_kms);
> -}
> -
>  static int dpu_kms_hw_init(struct msm_kms *kms)
>  {
>  	struct dpu_kms *dpu_kms;
> @@ -1015,10 +1001,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
>  	/*
>  	 * Handle (re)initializations during power enable
>  	 */

Is this comment valid anymore?

> -	dpu_kms_handle_power_event(DPU_POWER_EVENT_ENABLE, dpu_kms);
> -	dpu_kms->power_event = dpu_power_handle_register_event(
> -			&dpu_kms->phandle, DPU_POWER_EVENT_ENABLE,
> -			dpu_kms_handle_power_event, dpu_kms, "kms");
> +	dpu_vbif_init_memtypes(dpu_kms);
> 
>  	pm_runtime_put_sync(&dpu_kms->pdev->dev);
> 
> @@ -1172,6 +1155,8 @@ static int __maybe_unused 
> dpu_runtime_resume(struct
> device *dev)
>  		return rc;
>  	}
> 
> +	dpu_vbif_init_memtypes(dpu_kms);
> +
>  	rc = dpu_power_resource_enable(&dpu_kms->phandle, true);
>  	if (rc)
>  		DPU_ERROR("resource enable failed: %d\n", rc);
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> index f2c78deb0854..5f08be187c86 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> @@ -114,7 +114,6 @@ struct dpu_kms {
>  	struct dpu_mdss_cfg *catalog;
> 
>  	struct dpu_power_handle phandle;
> -	struct dpu_power_event *power_event;
> 
>  	/* directory entry for debugfs */
>  	struct dentry *debugfs_root;
Jeykumar Sankaran Nov. 13, 2018, 1:06 a.m. UTC | #2
On 2018-11-12 11:42, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> power_events are only used for pm_runtime, and that's all handled in
> dpu_kms. So just call vbif_init_memtypes at the correct times.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 21 +++------------------
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h |  1 -
>  2 files changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 23094d108e81..ae2bbaae923d 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -651,10 +651,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms
> *dpu_kms)
>  		dpu_hw_intr_destroy(dpu_kms->hw_intr);
>  	dpu_kms->hw_intr = NULL;
> 
> -	if (dpu_kms->power_event)
> -		dpu_power_handle_unregister_event(
> -				&dpu_kms->phandle, dpu_kms->power_event);
> -
>  	/* safe to call these more than once during shutdown */
>  	_dpu_debugfs_destroy(dpu_kms);
>  	_dpu_kms_mmu_destroy(dpu_kms);
> @@ -832,16 +828,6 @@ u64 dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms,
> char *clock_name)
>  	return clk_get_rate(clk->clk);
>  }
> 
> -static void dpu_kms_handle_power_event(u32 event_type, void *usr)
> -{
> -	struct dpu_kms *dpu_kms = usr;
> -
> -	if (!dpu_kms)
> -		return;
> -
> -	dpu_vbif_init_memtypes(dpu_kms);
> -}
> -
>  static int dpu_kms_hw_init(struct msm_kms *kms)
>  {
>  	struct dpu_kms *dpu_kms;
> @@ -1015,10 +1001,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
>  	/*
>  	 * Handle (re)initializations during power enable
>  	 */
> -	dpu_kms_handle_power_event(DPU_POWER_EVENT_ENABLE, dpu_kms);
> -	dpu_kms->power_event = dpu_power_handle_register_event(
> -			&dpu_kms->phandle, DPU_POWER_EVENT_ENABLE,
> -			dpu_kms_handle_power_event, dpu_kms, "kms");
> +	dpu_vbif_init_memtypes(dpu_kms);
> 
>  	pm_runtime_put_sync(&dpu_kms->pdev->dev);
> 
> @@ -1172,6 +1155,8 @@ static int __maybe_unused 
> dpu_runtime_resume(struct
> device *dev)
>  		return rc;
>  	}
> 
> +	dpu_vbif_init_memtypes(dpu_kms);
> +
>  	rc = dpu_power_resource_enable(&dpu_kms->phandle, true);
>  	if (rc)
>  		DPU_ERROR("resource enable failed: %d\n", rc);
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> index f2c78deb0854..5f08be187c86 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> @@ -114,7 +114,6 @@ struct dpu_kms {
>  	struct dpu_mdss_cfg *catalog;
> 
>  	struct dpu_power_handle phandle;

You can get rid of the handle and header inclusions here itself
to clean up KMS from power_handle stuff!

> -	struct dpu_power_event *power_event;
> 
>  	/* directory entry for debugfs */
>  	struct dentry *debugfs_root;
Jeykumar Sankaran Nov. 13, 2018, 1:31 a.m. UTC | #3
On 2018-11-12 17:06, Jeykumar Sankaran wrote:
> On 2018-11-12 11:42, Sean Paul wrote:
>> From: Sean Paul <seanpaul@chromium.org>
>> 
>> power_events are only used for pm_runtime, and that's all handled in
>> dpu_kms. So just call vbif_init_memtypes at the correct times.
>> 
>> Signed-off-by: Sean Paul <seanpaul@chromium.org>
>> ---
>>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 21 +++------------------
>>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h |  1 -
>>  2 files changed, 3 insertions(+), 19 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> index 23094d108e81..ae2bbaae923d 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> @@ -651,10 +651,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms
>> *dpu_kms)
>>  		dpu_hw_intr_destroy(dpu_kms->hw_intr);
>>  	dpu_kms->hw_intr = NULL;
>> 
>> -	if (dpu_kms->power_event)
>> -		dpu_power_handle_unregister_event(
>> -				&dpu_kms->phandle, dpu_kms->power_event);
>> -
>>  	/* safe to call these more than once during shutdown */
>>  	_dpu_debugfs_destroy(dpu_kms);
>>  	_dpu_kms_mmu_destroy(dpu_kms);
>> @@ -832,16 +828,6 @@ u64 dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms,
>> char *clock_name)
>>  	return clk_get_rate(clk->clk);
>>  }
>> 
>> -static void dpu_kms_handle_power_event(u32 event_type, void *usr)
>> -{
>> -	struct dpu_kms *dpu_kms = usr;
>> -
>> -	if (!dpu_kms)
>> -		return;
>> -
>> -	dpu_vbif_init_memtypes(dpu_kms);
>> -}
>> -
>>  static int dpu_kms_hw_init(struct msm_kms *kms)
>>  {
>>  	struct dpu_kms *dpu_kms;
>> @@ -1015,10 +1001,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
>>  	/*
>>  	 * Handle (re)initializations during power enable
>>  	 */
>> -	dpu_kms_handle_power_event(DPU_POWER_EVENT_ENABLE, dpu_kms);
>> -	dpu_kms->power_event = dpu_power_handle_register_event(
>> -			&dpu_kms->phandle, DPU_POWER_EVENT_ENABLE,
>> -			dpu_kms_handle_power_event, dpu_kms, "kms");
>> +	dpu_vbif_init_memtypes(dpu_kms);
>> 
>>  	pm_runtime_put_sync(&dpu_kms->pdev->dev);
>> 
>> @@ -1172,6 +1155,8 @@ static int __maybe_unused 
>> dpu_runtime_resume(struct
>> device *dev)
>>  		return rc;
>>  	}
>> 
>> +	dpu_vbif_init_memtypes(dpu_kms);
>> +
>>  	rc = dpu_power_resource_enable(&dpu_kms->phandle, true);
>>  	if (rc)
>>  		DPU_ERROR("resource enable failed: %d\n", rc);
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
>> index f2c78deb0854..5f08be187c86 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
>> @@ -114,7 +114,6 @@ struct dpu_kms {
>>  	struct dpu_mdss_cfg *catalog;
>> 
>>  	struct dpu_power_handle phandle;
> 
> You can get rid of the handle and header inclusions here itself
> to clean up KMS from power_handle stuff!

nvm. I see you are taking care of this in patch 9/12.
> 
>> -	struct dpu_power_event *power_event;
>> 
>>  	/* directory entry for debugfs */
>>  	struct dentry *debugfs_root;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 23094d108e81..ae2bbaae923d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -651,10 +651,6 @@  static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)
 		dpu_hw_intr_destroy(dpu_kms->hw_intr);
 	dpu_kms->hw_intr = NULL;
 
-	if (dpu_kms->power_event)
-		dpu_power_handle_unregister_event(
-				&dpu_kms->phandle, dpu_kms->power_event);
-
 	/* safe to call these more than once during shutdown */
 	_dpu_debugfs_destroy(dpu_kms);
 	_dpu_kms_mmu_destroy(dpu_kms);
@@ -832,16 +828,6 @@  u64 dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms, char *clock_name)
 	return clk_get_rate(clk->clk);
 }
 
-static void dpu_kms_handle_power_event(u32 event_type, void *usr)
-{
-	struct dpu_kms *dpu_kms = usr;
-
-	if (!dpu_kms)
-		return;
-
-	dpu_vbif_init_memtypes(dpu_kms);
-}
-
 static int dpu_kms_hw_init(struct msm_kms *kms)
 {
 	struct dpu_kms *dpu_kms;
@@ -1015,10 +1001,7 @@  static int dpu_kms_hw_init(struct msm_kms *kms)
 	/*
 	 * Handle (re)initializations during power enable
 	 */
-	dpu_kms_handle_power_event(DPU_POWER_EVENT_ENABLE, dpu_kms);
-	dpu_kms->power_event = dpu_power_handle_register_event(
-			&dpu_kms->phandle, DPU_POWER_EVENT_ENABLE,
-			dpu_kms_handle_power_event, dpu_kms, "kms");
+	dpu_vbif_init_memtypes(dpu_kms);
 
 	pm_runtime_put_sync(&dpu_kms->pdev->dev);
 
@@ -1172,6 +1155,8 @@  static int __maybe_unused dpu_runtime_resume(struct device *dev)
 		return rc;
 	}
 
+	dpu_vbif_init_memtypes(dpu_kms);
+
 	rc = dpu_power_resource_enable(&dpu_kms->phandle, true);
 	if (rc)
 		DPU_ERROR("resource enable failed: %d\n", rc);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index f2c78deb0854..5f08be187c86 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -114,7 +114,6 @@  struct dpu_kms {
 	struct dpu_mdss_cfg *catalog;
 
 	struct dpu_power_handle phandle;
-	struct dpu_power_event *power_event;
 
 	/* directory entry for debugfs */
 	struct dentry *debugfs_root;