Message ID | 20180720141504.22832-3-imre.deak@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Jul 20, 2018 at 05:14:56PM +0300, Imre Deak wrote: > intel_power_domains_fini() rolls back what was done in > intel_power_domains_init_hw(), so rename and move it accordingly. This > allows us adding a cleanup function later for intel_power_domains_init() > in a cleaner way. > > No functional change. > > Cc: Ville Syrjala <ville.syrjala@linux.intel.com> > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> > Cc: Jani Nikula <jani.nikula@intel.com> > Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> > --- > drivers/gpu/drm/i915/i915_drv.c | 4 +- > drivers/gpu/drm/i915/intel_drv.h | 2 +- > drivers/gpu/drm/i915/intel_runtime_pm.c | 69 ++++++++++++++++----------------- > 3 files changed, 37 insertions(+), 38 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index 3834bd758a2e..3c984530fef9 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -709,7 +709,7 @@ static int i915_load_modeset_init(struct drm_device *dev) > intel_teardown_gmbus(dev_priv); > cleanup_csr: > intel_csr_ucode_fini(dev_priv); > - intel_power_domains_fini(dev_priv); > + intel_power_domains_fini_hw(dev_priv); > vga_switcheroo_unregister_client(pdev); > cleanup_vga_client: > vga_client_register(pdev, NULL, NULL, NULL); > @@ -1460,7 +1460,7 @@ void i915_driver_unload(struct drm_device *dev) > i915_gem_fini(dev_priv); > intel_fbc_cleanup_cfb(dev_priv); > > - intel_power_domains_fini(dev_priv); > + intel_power_domains_fini_hw(dev_priv); > > i915_driver_cleanup_hw(dev_priv); > i915_driver_cleanup_mmio(dev_priv); > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index 5b4414f06aae..32be305c0e89 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -1943,8 +1943,8 @@ int intel_psr_wait_for_idle(const struct intel_crtc_state *new_crtc_state); > > /* intel_runtime_pm.c */ > int intel_power_domains_init(struct drm_i915_private *); > -void intel_power_domains_fini(struct drm_i915_private *); > void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume); > +void intel_power_domains_fini_hw(struct drm_i915_private *); > void intel_power_domains_suspend(struct drm_i915_private *dev_priv); > void intel_power_domains_verify_state(struct drm_i915_private *dev_priv); > void bxt_display_core_init(struct drm_i915_private *dev_priv, bool resume); > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c > index 1a87176a85c1..f1742466436d 100644 > --- a/drivers/gpu/drm/i915/intel_runtime_pm.c > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c > @@ -2902,41 +2902,6 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv) > return 0; > } > > -/** > - * intel_power_domains_fini - finalizes the power domain structures > - * @dev_priv: i915 device instance > - * > - * Finalizes the power domain structures for @dev_priv depending upon the > - * supported platform. This function also disables runtime pm and ensures that > - * the device stays powered up so that the driver can be reloaded. > - */ > -void intel_power_domains_fini(struct drm_i915_private *dev_priv) > -{ > - struct device *kdev = &dev_priv->drm.pdev->dev; > - > - /* > - * The i915.ko module is still not prepared to be loaded when > - * the power well is not enabled, so just enable it in case > - * we're going to unload/reload. > - * The following also reacquires the RPM reference the core passed > - * to the driver during loading, which is dropped in > - * intel_runtime_pm_enable(). We have to hand back the control of the > - * device to the core with this reference held. > - */ > - intel_display_set_init_power(dev_priv, true); > - > - /* Remove the refcount we took to keep power well support disabled. */ > - if (!i915_modparams.disable_power_well) > - intel_display_power_put(dev_priv, POWER_DOMAIN_INIT); > - > - /* > - * Remove the refcount we took in intel_runtime_pm_enable() in case > - * the platform doesn't support runtime PM. > - */ > - if (!HAS_RUNTIME_PM(dev_priv)) > - pm_runtime_put(kdev); > -} > - > static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv) > { > struct i915_power_domains *power_domains = &dev_priv->power_domains; > @@ -3581,6 +3546,40 @@ void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume) > } > > /** > + * intel_power_domains_fini_hw - deinitialize hw power domain state > + * @dev_priv: i915 device instance > + * > + * De-initializes the display power domain HW state. It also ensures that the > + * device stays powered up so that the driver can be reloaded. > + */ > +void intel_power_domains_fini_hw(struct drm_i915_private *dev_priv) > +{ > + struct device *kdev = &dev_priv->drm.pdev->dev; > + > + /* > + * The i915.ko module is still not prepared to be loaded when > + * the power well is not enabled, so just enable it in case > + * we're going to unload/reload. > + * The following also reacquires the RPM reference the core passed > + * to the driver during loading, which is dropped in > + * intel_runtime_pm_enable(). We have to hand back the control of the > + * device to the core with this reference held. > + */ > + intel_display_set_init_power(dev_priv, true); > + > + /* Remove the refcount we took to keep power well support disabled. */ > + if (!i915_modparams.disable_power_well) > + intel_display_power_put(dev_priv, POWER_DOMAIN_INIT); > + > + /* > + * Remove the refcount we took in intel_runtime_pm_enable() in case > + * the platform doesn't support runtime PM. > + */ > + if (!HAS_RUNTIME_PM(dev_priv)) > + pm_runtime_put(kdev); > +} > + > +/** > * intel_power_domains_suspend - suspend power domain state > * @dev_priv: i915 device instance > * > -- > 2.13.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Em Sex, 2018-07-20 às 17:14 +0300, Imre Deak escreveu: > intel_power_domains_fini() rolls back what was done in > intel_power_domains_init_hw(), so rename and move it accordingly. > This > allows us adding a cleanup function later for > intel_power_domains_init() > in a cleaner way. > > No functional change. > > Cc: Ville Syrjala <ville.syrjala@linux.intel.com> > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> With the checkpatch issues fixed: Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> > Cc: Jani Nikula <jani.nikula@intel.com> > Signed-off-by: Imre Deak <imre.deak@intel.com> > --- > drivers/gpu/drm/i915/i915_drv.c | 4 +- > drivers/gpu/drm/i915/intel_drv.h | 2 +- > drivers/gpu/drm/i915/intel_runtime_pm.c | 69 ++++++++++++++++------- > ---------- > 3 files changed, 37 insertions(+), 38 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c > b/drivers/gpu/drm/i915/i915_drv.c > index 3834bd758a2e..3c984530fef9 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -709,7 +709,7 @@ static int i915_load_modeset_init(struct > drm_device *dev) > intel_teardown_gmbus(dev_priv); > cleanup_csr: > intel_csr_ucode_fini(dev_priv); > - intel_power_domains_fini(dev_priv); > + intel_power_domains_fini_hw(dev_priv); > vga_switcheroo_unregister_client(pdev); > cleanup_vga_client: > vga_client_register(pdev, NULL, NULL, NULL); > @@ -1460,7 +1460,7 @@ void i915_driver_unload(struct drm_device *dev) > i915_gem_fini(dev_priv); > intel_fbc_cleanup_cfb(dev_priv); > > - intel_power_domains_fini(dev_priv); > + intel_power_domains_fini_hw(dev_priv); > > i915_driver_cleanup_hw(dev_priv); > i915_driver_cleanup_mmio(dev_priv); > diff --git a/drivers/gpu/drm/i915/intel_drv.h > b/drivers/gpu/drm/i915/intel_drv.h > index 5b4414f06aae..32be305c0e89 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -1943,8 +1943,8 @@ int intel_psr_wait_for_idle(const struct > intel_crtc_state *new_crtc_state); > > /* intel_runtime_pm.c */ > int intel_power_domains_init(struct drm_i915_private *); > -void intel_power_domains_fini(struct drm_i915_private *); > void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, > bool resume); > +void intel_power_domains_fini_hw(struct drm_i915_private *); > void intel_power_domains_suspend(struct drm_i915_private *dev_priv); > void intel_power_domains_verify_state(struct drm_i915_private > *dev_priv); > void bxt_display_core_init(struct drm_i915_private *dev_priv, bool > resume); > diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c > b/drivers/gpu/drm/i915/intel_runtime_pm.c > index 1a87176a85c1..f1742466436d 100644 > --- a/drivers/gpu/drm/i915/intel_runtime_pm.c > +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c > @@ -2902,41 +2902,6 @@ int intel_power_domains_init(struct > drm_i915_private *dev_priv) > return 0; > } > > -/** > - * intel_power_domains_fini - finalizes the power domain structures > - * @dev_priv: i915 device instance > - * > - * Finalizes the power domain structures for @dev_priv depending > upon the > - * supported platform. This function also disables runtime pm and > ensures that > - * the device stays powered up so that the driver can be reloaded. > - */ > -void intel_power_domains_fini(struct drm_i915_private *dev_priv) > -{ > - struct device *kdev = &dev_priv->drm.pdev->dev; > - > - /* > - * The i915.ko module is still not prepared to be loaded > when > - * the power well is not enabled, so just enable it in case > - * we're going to unload/reload. > - * The following also reacquires the RPM reference the core > passed > - * to the driver during loading, which is dropped in > - * intel_runtime_pm_enable(). We have to hand back the > control of the > - * device to the core with this reference held. > - */ > - intel_display_set_init_power(dev_priv, true); > - > - /* Remove the refcount we took to keep power well support > disabled. */ > - if (!i915_modparams.disable_power_well) > - intel_display_power_put(dev_priv, > POWER_DOMAIN_INIT); > - > - /* > - * Remove the refcount we took in intel_runtime_pm_enable() > in case > - * the platform doesn't support runtime PM. > - */ > - if (!HAS_RUNTIME_PM(dev_priv)) > - pm_runtime_put(kdev); > -} > - > static void intel_power_domains_sync_hw(struct drm_i915_private > *dev_priv) > { > struct i915_power_domains *power_domains = &dev_priv- > >power_domains; > @@ -3581,6 +3546,40 @@ void intel_power_domains_init_hw(struct > drm_i915_private *dev_priv, bool resume) > } > > /** > + * intel_power_domains_fini_hw - deinitialize hw power domain state > + * @dev_priv: i915 device instance > + * > + * De-initializes the display power domain HW state. It also ensures > that the > + * device stays powered up so that the driver can be reloaded. > + */ > +void intel_power_domains_fini_hw(struct drm_i915_private *dev_priv) > +{ > + struct device *kdev = &dev_priv->drm.pdev->dev; > + > + /* > + * The i915.ko module is still not prepared to be loaded > when > + * the power well is not enabled, so just enable it in case > + * we're going to unload/reload. > + * The following also reacquires the RPM reference the core > passed > + * to the driver during loading, which is dropped in > + * intel_runtime_pm_enable(). We have to hand back the > control of the > + * device to the core with this reference held. > + */ > + intel_display_set_init_power(dev_priv, true); > + > + /* Remove the refcount we took to keep power well support > disabled. */ > + if (!i915_modparams.disable_power_well) > + intel_display_power_put(dev_priv, > POWER_DOMAIN_INIT); > + > + /* > + * Remove the refcount we took in intel_runtime_pm_enable() > in case > + * the platform doesn't support runtime PM. > + */ > + if (!HAS_RUNTIME_PM(dev_priv)) > + pm_runtime_put(kdev); > +} > + > +/** > * intel_power_domains_suspend - suspend power domain state > * @dev_priv: i915 device instance > *
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 3834bd758a2e..3c984530fef9 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -709,7 +709,7 @@ static int i915_load_modeset_init(struct drm_device *dev) intel_teardown_gmbus(dev_priv); cleanup_csr: intel_csr_ucode_fini(dev_priv); - intel_power_domains_fini(dev_priv); + intel_power_domains_fini_hw(dev_priv); vga_switcheroo_unregister_client(pdev); cleanup_vga_client: vga_client_register(pdev, NULL, NULL, NULL); @@ -1460,7 +1460,7 @@ void i915_driver_unload(struct drm_device *dev) i915_gem_fini(dev_priv); intel_fbc_cleanup_cfb(dev_priv); - intel_power_domains_fini(dev_priv); + intel_power_domains_fini_hw(dev_priv); i915_driver_cleanup_hw(dev_priv); i915_driver_cleanup_mmio(dev_priv); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 5b4414f06aae..32be305c0e89 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1943,8 +1943,8 @@ int intel_psr_wait_for_idle(const struct intel_crtc_state *new_crtc_state); /* intel_runtime_pm.c */ int intel_power_domains_init(struct drm_i915_private *); -void intel_power_domains_fini(struct drm_i915_private *); void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume); +void intel_power_domains_fini_hw(struct drm_i915_private *); void intel_power_domains_suspend(struct drm_i915_private *dev_priv); void intel_power_domains_verify_state(struct drm_i915_private *dev_priv); void bxt_display_core_init(struct drm_i915_private *dev_priv, bool resume); diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c index 1a87176a85c1..f1742466436d 100644 --- a/drivers/gpu/drm/i915/intel_runtime_pm.c +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c @@ -2902,41 +2902,6 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv) return 0; } -/** - * intel_power_domains_fini - finalizes the power domain structures - * @dev_priv: i915 device instance - * - * Finalizes the power domain structures for @dev_priv depending upon the - * supported platform. This function also disables runtime pm and ensures that - * the device stays powered up so that the driver can be reloaded. - */ -void intel_power_domains_fini(struct drm_i915_private *dev_priv) -{ - struct device *kdev = &dev_priv->drm.pdev->dev; - - /* - * The i915.ko module is still not prepared to be loaded when - * the power well is not enabled, so just enable it in case - * we're going to unload/reload. - * The following also reacquires the RPM reference the core passed - * to the driver during loading, which is dropped in - * intel_runtime_pm_enable(). We have to hand back the control of the - * device to the core with this reference held. - */ - intel_display_set_init_power(dev_priv, true); - - /* Remove the refcount we took to keep power well support disabled. */ - if (!i915_modparams.disable_power_well) - intel_display_power_put(dev_priv, POWER_DOMAIN_INIT); - - /* - * Remove the refcount we took in intel_runtime_pm_enable() in case - * the platform doesn't support runtime PM. - */ - if (!HAS_RUNTIME_PM(dev_priv)) - pm_runtime_put(kdev); -} - static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv) { struct i915_power_domains *power_domains = &dev_priv->power_domains; @@ -3581,6 +3546,40 @@ void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume) } /** + * intel_power_domains_fini_hw - deinitialize hw power domain state + * @dev_priv: i915 device instance + * + * De-initializes the display power domain HW state. It also ensures that the + * device stays powered up so that the driver can be reloaded. + */ +void intel_power_domains_fini_hw(struct drm_i915_private *dev_priv) +{ + struct device *kdev = &dev_priv->drm.pdev->dev; + + /* + * The i915.ko module is still not prepared to be loaded when + * the power well is not enabled, so just enable it in case + * we're going to unload/reload. + * The following also reacquires the RPM reference the core passed + * to the driver during loading, which is dropped in + * intel_runtime_pm_enable(). We have to hand back the control of the + * device to the core with this reference held. + */ + intel_display_set_init_power(dev_priv, true); + + /* Remove the refcount we took to keep power well support disabled. */ + if (!i915_modparams.disable_power_well) + intel_display_power_put(dev_priv, POWER_DOMAIN_INIT); + + /* + * Remove the refcount we took in intel_runtime_pm_enable() in case + * the platform doesn't support runtime PM. + */ + if (!HAS_RUNTIME_PM(dev_priv)) + pm_runtime_put(kdev); +} + +/** * intel_power_domains_suspend - suspend power domain state * @dev_priv: i915 device instance *
intel_power_domains_fini() rolls back what was done in intel_power_domains_init_hw(), so rename and move it accordingly. This allows us adding a cleanup function later for intel_power_domains_init() in a cleaner way. No functional change. Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Cc: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> --- drivers/gpu/drm/i915/i915_drv.c | 4 +- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_runtime_pm.c | 69 ++++++++++++++++----------------- 3 files changed, 37 insertions(+), 38 deletions(-)