Message ID | 1465993109-19523-16-git-send-email-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, 15 Jun 2016, Chris Wilson <chris@chris-wilson.co.uk> wrote: > Allow everyone to call intel_panel_setup_backlight() (i.e. only take > effect if we have previously been initialised for use as a panel) and, > for paranoia, allow intel_panel_cleanup_backlight() to be called > multiple times. Maybe I'm dumb or blind or both, but I don't see why this patch is needed, even in light of the following patches. Please enlighten me. BR, Jani. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Jani Nikula <jani.nikula@linux.intel.com> > --- > drivers/gpu/drm/i915/intel_drv.h | 1 + > drivers/gpu/drm/i915/intel_panel.c | 7 +++++++ > 2 files changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index 8dc67adace6b..111038e29ec3 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -201,6 +201,7 @@ struct intel_panel { > struct drm_display_mode *fixed_mode; > struct drm_display_mode *downclock_mode; > int fitting_mode; > + bool is_panel; > > /* backlight */ > struct { > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c > index f0b1602c3258..8bd076b11af1 100644 > --- a/drivers/gpu/drm/i915/intel_panel.c > +++ b/drivers/gpu/drm/i915/intel_panel.c > @@ -1670,6 +1670,9 @@ int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe) > struct intel_panel *panel = &intel_connector->panel; > int ret; > > + if (!panel->is_panel) > + return 0; > + > if (!dev_priv->vbt.backlight.present) { > if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) { > DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n"); > @@ -1709,6 +1712,9 @@ void intel_panel_destroy_backlight(struct drm_connector *connector) > struct intel_connector *intel_connector = to_intel_connector(connector); > struct intel_panel *panel = &intel_connector->panel; > > + if (!panel->backlight.present) > + return; > + > /* dispose of the pwm */ > if (panel->backlight.pwm) > pwm_put(panel->backlight.pwm); > @@ -1796,6 +1802,7 @@ int intel_panel_init(struct intel_panel *panel, > > panel->fixed_mode = fixed_mode; > panel->downclock_mode = downclock_mode; > + panel->is_panel = true; > > return 0; > }
On Thu, Jun 16, 2016 at 09:34:05AM +0300, Jani Nikula wrote: > On Wed, 15 Jun 2016, Chris Wilson <chris@chris-wilson.co.uk> wrote: > > Allow everyone to call intel_panel_setup_backlight() (i.e. only take > > effect if we have previously been initialised for use as a panel) and, > > for paranoia, allow intel_panel_cleanup_backlight() to be called > > multiple times. > > Maybe I'm dumb or blind or both, but I don't see why this patch is > needed, even in light of the following patches. Please enlighten me. It was for having symmetric intel_panel_setup_backlight() and intel_panel_destroy_backlight(), as they called from asymmetric code paths currently. Since Ville asked to keep the asymmetry, this can be dropped if you see no other merit to having the embedded struct marked as being initialised. -Chris
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 8dc67adace6b..111038e29ec3 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -201,6 +201,7 @@ struct intel_panel { struct drm_display_mode *fixed_mode; struct drm_display_mode *downclock_mode; int fitting_mode; + bool is_panel; /* backlight */ struct { diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index f0b1602c3258..8bd076b11af1 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -1670,6 +1670,9 @@ int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe) struct intel_panel *panel = &intel_connector->panel; int ret; + if (!panel->is_panel) + return 0; + if (!dev_priv->vbt.backlight.present) { if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) { DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n"); @@ -1709,6 +1712,9 @@ void intel_panel_destroy_backlight(struct drm_connector *connector) struct intel_connector *intel_connector = to_intel_connector(connector); struct intel_panel *panel = &intel_connector->panel; + if (!panel->backlight.present) + return; + /* dispose of the pwm */ if (panel->backlight.pwm) pwm_put(panel->backlight.pwm); @@ -1796,6 +1802,7 @@ int intel_panel_init(struct intel_panel *panel, panel->fixed_mode = fixed_mode; panel->downclock_mode = downclock_mode; + panel->is_panel = true; return 0; }
Allow everyone to call intel_panel_setup_backlight() (i.e. only take effect if we have previously been initialised for use as a panel) and, for paranoia, allow intel_panel_cleanup_backlight() to be called multiple times. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Jani Nikula <jani.nikula@linux.intel.com> --- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_panel.c | 7 +++++++ 2 files changed, 8 insertions(+)