Message ID | 1408389369-22898-8-git-send-email-ville.syrjala@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, 18 Aug 2014, ville.syrjala@linux.intel.com wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > If we force vdd off warn if someone is still using it. With this > change the delayed vdd off work needs to check want_panel_vdd > itself to make sure it doesn't try to turn vdd off when someone > is using it. I think this calls for a prep cleanup patch to check and fix the uses of edp_panel_vdd_off(intel_dp, true) vs. edp_panel_vdd_off_sync(intel_dp). In particular, why are there direct calls to the latter all over the place? Seems wrong. BR, Jani. > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/i915/intel_dp.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index e6b4d4d..0fb510c 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -1241,7 +1241,9 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) > > WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); > > - if (intel_dp->want_panel_vdd || !edp_have_panel_vdd(intel_dp)) > + WARN_ON(intel_dp->want_panel_vdd); > + > + if (!edp_have_panel_vdd(intel_dp)) > return; > > DRM_DEBUG_KMS("Turning eDP VDD off\n"); > @@ -1273,7 +1275,8 @@ static void edp_panel_vdd_work(struct work_struct *__work) > struct drm_device *dev = intel_dp_to_dev(intel_dp); > > drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); > - edp_panel_vdd_off_sync(intel_dp); > + if (!intel_dp->want_panel_vdd) > + edp_panel_vdd_off_sync(intel_dp); > drm_modeset_unlock(&dev->mode_config.connection_mutex); > } > > -- > 1.8.5.5 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Tue, Aug 19, 2014 at 10:36:52AM +0300, Jani Nikula wrote: > On Mon, 18 Aug 2014, ville.syrjala@linux.intel.com wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > If we force vdd off warn if someone is still using it. With this > > change the delayed vdd off work needs to check want_panel_vdd > > itself to make sure it doesn't try to turn vdd off when someone > > is using it. > > I think this calls for a prep cleanup patch to check and fix the uses of > edp_panel_vdd_off(intel_dp, true) > vs. edp_panel_vdd_off_sync(intel_dp). In particular, why are there > direct calls to the latter all over the place? Seems wrong. edp_panel_vdd_off() should always be paired with a edp_panel_vdd_on(). If we were to call edp_panel_vdd_off() without the correct pairing we would get a warning due to want_panel_vdd==false, whereas edp_panel_vdd_off_sync() will now warn when want_panel_vdd==true. The direct calls to edp_panel_vdd_off_sync() are in places where we should not have want_panel_vdd==true (eg. system suspend) but we just want to force vdd off even if the delayed off work has alrady been scheduled. > > BR, > Jani. > > > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > --- > > drivers/gpu/drm/i915/intel_dp.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > > index e6b4d4d..0fb510c 100644 > > --- a/drivers/gpu/drm/i915/intel_dp.c > > +++ b/drivers/gpu/drm/i915/intel_dp.c > > @@ -1241,7 +1241,9 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) > > > > WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); > > > > - if (intel_dp->want_panel_vdd || !edp_have_panel_vdd(intel_dp)) > > + WARN_ON(intel_dp->want_panel_vdd); > > + > > + if (!edp_have_panel_vdd(intel_dp)) > > return; > > > > DRM_DEBUG_KMS("Turning eDP VDD off\n"); > > @@ -1273,7 +1275,8 @@ static void edp_panel_vdd_work(struct work_struct *__work) > > struct drm_device *dev = intel_dp_to_dev(intel_dp); > > > > drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); > > - edp_panel_vdd_off_sync(intel_dp); > > + if (!intel_dp->want_panel_vdd) > > + edp_panel_vdd_off_sync(intel_dp); > > drm_modeset_unlock(&dev->mode_config.connection_mutex); > > } > > > > -- > > 1.8.5.5 > > > > _______________________________________________ > > Intel-gfx mailing list > > Intel-gfx@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx > > -- > Jani Nikula, Intel Open Source Technology Center
On Tue, 19 Aug 2014, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > On Tue, Aug 19, 2014 at 10:36:52AM +0300, Jani Nikula wrote: >> On Mon, 18 Aug 2014, ville.syrjala@linux.intel.com wrote: >> > From: Ville Syrjälä <ville.syrjala@linux.intel.com> >> > >> > If we force vdd off warn if someone is still using it. With this >> > change the delayed vdd off work needs to check want_panel_vdd >> > itself to make sure it doesn't try to turn vdd off when someone >> > is using it. >> >> I think this calls for a prep cleanup patch to check and fix the uses of >> edp_panel_vdd_off(intel_dp, true) >> vs. edp_panel_vdd_off_sync(intel_dp). In particular, why are there >> direct calls to the latter all over the place? Seems wrong. > > edp_panel_vdd_off() should always be paired with a edp_panel_vdd_on(). > If we were to call edp_panel_vdd_off() without the correct pairing we > would get a warning due to want_panel_vdd==false, whereas > edp_panel_vdd_off_sync() will now warn when want_panel_vdd==true. > The direct calls to edp_panel_vdd_off_sync() are in places where we > should not have want_panel_vdd==true (eg. system suspend) but we > just want to force vdd off even if the delayed off work has alrady > been scheduled. Okay, care to add some of that as brief documentation comments for the functions in question, as follow-up? IMO detailed kernel-docs here won't be read by anyone and will just get stale. BR, Jani. > >> >> BR, >> Jani. >> >> >> > >> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> >> > --- >> > drivers/gpu/drm/i915/intel_dp.c | 7 +++++-- >> > 1 file changed, 5 insertions(+), 2 deletions(-) >> > >> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c >> > index e6b4d4d..0fb510c 100644 >> > --- a/drivers/gpu/drm/i915/intel_dp.c >> > +++ b/drivers/gpu/drm/i915/intel_dp.c >> > @@ -1241,7 +1241,9 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) >> > >> > WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); >> > >> > - if (intel_dp->want_panel_vdd || !edp_have_panel_vdd(intel_dp)) >> > + WARN_ON(intel_dp->want_panel_vdd); >> > + >> > + if (!edp_have_panel_vdd(intel_dp)) >> > return; >> > >> > DRM_DEBUG_KMS("Turning eDP VDD off\n"); >> > @@ -1273,7 +1275,8 @@ static void edp_panel_vdd_work(struct work_struct *__work) >> > struct drm_device *dev = intel_dp_to_dev(intel_dp); >> > >> > drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); >> > - edp_panel_vdd_off_sync(intel_dp); >> > + if (!intel_dp->want_panel_vdd) >> > + edp_panel_vdd_off_sync(intel_dp); >> > drm_modeset_unlock(&dev->mode_config.connection_mutex); >> > } >> > >> > -- >> > 1.8.5.5 >> > >> > _______________________________________________ >> > Intel-gfx mailing list >> > Intel-gfx@lists.freedesktop.org >> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx >> >> -- >> Jani Nikula, Intel Open Source Technology Center > > -- > Ville Syrjälä > Intel OTC
On Tue, Aug 19, 2014 at 04:37:03PM +0300, Jani Nikula wrote: > On Tue, 19 Aug 2014, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > > On Tue, Aug 19, 2014 at 10:36:52AM +0300, Jani Nikula wrote: > >> On Mon, 18 Aug 2014, ville.syrjala@linux.intel.com wrote: > >> > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > >> > > >> > If we force vdd off warn if someone is still using it. With this > >> > change the delayed vdd off work needs to check want_panel_vdd > >> > itself to make sure it doesn't try to turn vdd off when someone > >> > is using it. > >> > >> I think this calls for a prep cleanup patch to check and fix the uses of > >> edp_panel_vdd_off(intel_dp, true) > >> vs. edp_panel_vdd_off_sync(intel_dp). In particular, why are there > >> direct calls to the latter all over the place? Seems wrong. > > > > edp_panel_vdd_off() should always be paired with a edp_panel_vdd_on(). > > If we were to call edp_panel_vdd_off() without the correct pairing we > > would get a warning due to want_panel_vdd==false, whereas > > edp_panel_vdd_off_sync() will now warn when want_panel_vdd==true. > > The direct calls to edp_panel_vdd_off_sync() are in places where we > > should not have want_panel_vdd==true (eg. system suspend) but we > > just want to force vdd off even if the delayed off work has alrady > > been scheduled. > > Okay, care to add some of that as brief documentation comments for the > functions in question, as follow-up? IMO detailed kernel-docs here won't > be read by anyone and will just get stale. Hm, imo a wrappe for vdd_off_sync or would be clearer than piles of comments. Or maybe just vdd_sync, akin to all the work/time _sync functions. Our system suspend/resume code is splattered with such functions, so the code pattern should be clear with just that. Perhaps as a follow-up patch on top of all of this? -Daniel > > BR, > Jani. > > > > >> > >> BR, > >> Jani. > >> > >> > >> > > >> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > >> > --- > >> > drivers/gpu/drm/i915/intel_dp.c | 7 +++++-- > >> > 1 file changed, 5 insertions(+), 2 deletions(-) > >> > > >> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > >> > index e6b4d4d..0fb510c 100644 > >> > --- a/drivers/gpu/drm/i915/intel_dp.c > >> > +++ b/drivers/gpu/drm/i915/intel_dp.c > >> > @@ -1241,7 +1241,9 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) > >> > > >> > WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); > >> > > >> > - if (intel_dp->want_panel_vdd || !edp_have_panel_vdd(intel_dp)) > >> > + WARN_ON(intel_dp->want_panel_vdd); > >> > + > >> > + if (!edp_have_panel_vdd(intel_dp)) > >> > return; > >> > > >> > DRM_DEBUG_KMS("Turning eDP VDD off\n"); > >> > @@ -1273,7 +1275,8 @@ static void edp_panel_vdd_work(struct work_struct *__work) > >> > struct drm_device *dev = intel_dp_to_dev(intel_dp); > >> > > >> > drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); > >> > - edp_panel_vdd_off_sync(intel_dp); > >> > + if (!intel_dp->want_panel_vdd) > >> > + edp_panel_vdd_off_sync(intel_dp); > >> > drm_modeset_unlock(&dev->mode_config.connection_mutex); > >> > } > >> > > >> > -- > >> > 1.8.5.5 > >> > > >> > _______________________________________________ > >> > Intel-gfx mailing list > >> > Intel-gfx@lists.freedesktop.org > >> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx > >> > >> -- > >> Jani Nikula, Intel Open Source Technology Center > > > > -- > > Ville Syrjälä > > Intel OTC > > -- > Jani Nikula, Intel Open Source Technology Center > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index e6b4d4d..0fb510c 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1241,7 +1241,9 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); - if (intel_dp->want_panel_vdd || !edp_have_panel_vdd(intel_dp)) + WARN_ON(intel_dp->want_panel_vdd); + + if (!edp_have_panel_vdd(intel_dp)) return; DRM_DEBUG_KMS("Turning eDP VDD off\n"); @@ -1273,7 +1275,8 @@ static void edp_panel_vdd_work(struct work_struct *__work) struct drm_device *dev = intel_dp_to_dev(intel_dp); drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); - edp_panel_vdd_off_sync(intel_dp); + if (!intel_dp->want_panel_vdd) + edp_panel_vdd_off_sync(intel_dp); drm_modeset_unlock(&dev->mode_config.connection_mutex); }