<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 2, 2017 at 10:56 AM, Pandiyan, Dhinakaran <span dir="ltr"><<a href="mailto:dhinakaran.pandiyan@intel.com" target="_blank" class="cremed">dhinakaran.pandiyan@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, 2017-06-02 at 17:42 +0000, Pandiyan, Dhinakaran wrote:<br>
<br>
Somehow the CC's got removed in my previous reply, adding them back. See<br>
one additional comment below.<br>
<div><div class="h5"><br>
<br>
> On Fri, 2017-05-26 at 18:42 -0700, Puthikorn Voravootivat wrote:<br>
> > Add heuristic to decide that AUX or PWM pin should use for<br>
> > backlight brightness adjustment and modify i915 param description<br>
> > to have auto, force disable, and force enable.<br>
> ><br>
> > The heuristic to determine that using AUX pin is better than using<br>
> > PWM pin is that the panel support any of the feature list here.<br>
> > - Regional backlight brightness adjustment<br>
> > - Backlight PWM frequency set<br>
> > - More than 8 bits resolution of brightness level<br>
> > - Backlight enablement via AUX and not by BL_ENABLE pin<br>
> ><br>
> > Signed-off-by: Puthikorn Voravootivat <<a href="mailto:puthik@chromium.org" class="cremed">puthik@chromium.org</a>><br>
> > ---<br>
> >  drivers/gpu/drm/i915/i915_<wbr>params.c            |  7 +--<br>
> >  drivers/gpu/drm/i915/i915_<wbr>params.h            |  2 +-<br>
> >  drivers/gpu/drm/i915/intel_dp_<wbr>aux_backlight.c | 64 +++++++++++++++++++++++++--<br>
> >  3 files changed, 66 insertions(+), 7 deletions(-)<br>
> ><br>
> > diff --git a/drivers/gpu/drm/i915/i915_<wbr>params.c b/drivers/gpu/drm/i915/i915_<wbr>params.c<br>
> > index b6a7e363d076..3758ae1f11b4 100644<br>
> > --- a/drivers/gpu/drm/i915/i915_<wbr>params.c<br>
> > +++ b/drivers/gpu/drm/i915/i915_<wbr>params.c<br>
> > @@ -63,7 +63,7 @@ struct i915_params i915 __read_mostly = {<br>
> >     .huc_firmware_path = NULL,<br>
> >     .enable_dp_mst = true,<br>
> >     .inject_load_failure = 0,<br>
> > -   .enable_dpcd_backlight = false,<br>
> > +   .enable_dpcd_backlight = -1,<br>
> >     .enable_gvt = false,<br>
> >  };<br>
> ><br>
> > @@ -246,9 +246,10 @@ MODULE_PARM_DESC(enable_dp_<wbr>mst,<br>
> >  module_param_named_unsafe(<wbr>inject_load_failure, i915.inject_load_failure, uint, 0400);<br>
> >  MODULE_PARM_DESC(inject_load_<wbr>failure,<br>
> >     "Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)");<br>
> > -module_param_named(enable_<wbr>dpcd_backlight, i915.enable_dpcd_backlight, bool, 0600);<br>
> > +module_param_named_unsafe(<wbr>enable_dpcd_backlight, i915.enable_dpcd_backlight, int, 0600);<br>
> >  MODULE_PARM_DESC(enable_dpcd_<wbr>backlight,<br>
> > -   "Enable support for DPCD backlight control (default:false)");<br>
> > +   "Enable support for DPCD backlight control "<br>
> > +   "(-1:auto (default), 0:force disable, 1:force enabled if supported");<br>
> ><br>
> >  module_param_named(enable_gvt, i915.enable_gvt, bool, 0400);<br>
> >  MODULE_PARM_DESC(enable_gvt,<br>
> > diff --git a/drivers/gpu/drm/i915/i915_<wbr>params.h b/drivers/gpu/drm/i915/i915_<wbr>params.h<br>
> > index 34148cc8637c..ac02efce6e22 100644<br>
> > --- a/drivers/gpu/drm/i915/i915_<wbr>params.h<br>
> > +++ b/drivers/gpu/drm/i915/i915_<wbr>params.h<br>
> > @@ -66,7 +66,7 @@<br>
> >     func(bool, verbose_state_checks); \<br>
> >     func(bool, nuclear_pageflip); \<br>
> >     func(bool, enable_dp_mst); \<br>
> > -   func(bool, enable_dpcd_backlight); \<br>
> > +   func(int, enable_dpcd_backlight); \<br>
<br>
<br>
</div></div>Please move this above the bools, see comment in code that's a few lines<br>
above.<br>
<br></blockquote><div>Will do</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-DK<br>
<div><div class="h5"><br>
> >     func(bool, enable_gvt)<br>
> ><br>
> >  #define MEMBER(T, member) T member<br>
> > diff --git a/drivers/gpu/drm/i915/intel_<wbr>dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_<wbr>dp_aux_backlight.c<br>
> > index a0995c00fc84..c89aae804659 100644<br>
> > --- a/drivers/gpu/drm/i915/intel_<wbr>dp_aux_backlight.c<br>
> > +++ b/drivers/gpu/drm/i915/intel_<wbr>dp_aux_backlight.c<br>
> > @@ -43,6 +43,9 @@ static void set_aux_backlight_enable(<wbr>struct intel_dp *intel_dp, bool enable)<br>
> >     else<br>
> >             reg_val &= ~(DP_EDP_BACKLIGHT_ENABLE);<br>
> ><br>
> > +   /* TODO: If the panel also support enabling backlight via BL_ENABLE pin,<br>
> > +    * the backlight will be enabled again in _intel_edp_backlight_on()<br>
> > +    */<br>
><br>
> Unrelated hunk, please remove. This should have been included in one of<br>
> the previous patches.<br></div></div></blockquote><div>Removed</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
><br>
> >     if (drm_dp_dpcd_writeb(&intel_dp-<wbr>>aux, DP_EDP_DISPLAY_CONTROL_<wbr>REGISTER,<br>
> >                            reg_val) != 1) {<br>
> >             DRM_DEBUG_KMS("Failed to %s aux backlight\n",<br>
> > @@ -168,15 +171,66 @@ intel_dp_aux_display_control_<wbr>capable(struct intel_connector *connector)<br>
> >     /* Check the  eDP Display control capabilities registers to determine if<br>
> >      * the panel can support backlight control over the aux channel<br>
> >      */<br>
> > -   if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_<wbr>ADJUSTMENT_CAP &&<br>
> > -       (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_<wbr>AUX_SET_CAP) &&<br>
> > -       !(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_<wbr>PWM_PIN_CAP)) {<br>
> > +   if ((intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_<wbr>ADJUSTMENT_CAP) &&<br>
> > +       (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_<wbr>AUX_SET_CAP)) {<br>
> >             DRM_DEBUG_KMS("AUX Backlight Control Supported!\n");<br>
> >             return true;<br>
> >     }<br>
> >     return false;<br>
> >  }<br>
> ><br>
> > +/*<br>
> > + * Heuristic function whether we should use AUX for backlight adjustment or not.<br>
> > + *<br>
> > + * We should use AUX for backlight brightness adjustment if panel doesn't this<br>
> > + * via PWM pin or using AUX is better than using PWM pin.<br>
> > + *<br>
> > + * The heuristic to determine that using AUX pin is better than using PWM pin is<br>
> > + * that the panel support any of the feature list here.<br>
> > + * - Regional backlight brightness adjustment<br>
> > + * - Backlight PWM frequency set<br>
> > + * - More than 8 bits resolution of brightness level<br>
> > + * - Backlight enablement via AUX and not by BL_ENABLE pin<br>
> > + *<br>
> > + * If all above are not true, assume that using PWM pin is better.<br>
> > + */<br>
> > +static bool<br>
> > +intel_dp_aux_display_control_<wbr>heuristic(struct intel_connector *connector)<br>
> > +{<br>
> > +   struct intel_dp *intel_dp = enc_to_intel_dp(&connector-><wbr>encoder->base);<br>
> > +   uint8_t reg_val;<br>
> > +<br>
> > +   /* Panel doesn't support adjusting backlight brightness via PWN pin */<br>
> > +   if (!(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_BRIGHTNESS_<wbr>PWM_PIN_CAP))<br>
><br>
> Isn't BACKLIGHT_BRIGHTNESS_PWM_PIN_<wbr>CAP in edp_dpcd[2] ?<br>
><br></div></div></blockquote><div>Thank you for catching this.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
><br>
> > +           return true;<br>
> > +<br>
> > +   /* Panel supports regional backlight brightness adjustment */<br>
> > +   if (drm_dp_dpcd_readb(&intel_dp-><wbr>aux, DP_EDP_GENERAL_CAP_3,<br>
><br>
> Spec says this register is new to eDP 1.4. I don't see a check for<br>
> version.<br>
><br></div></div></blockquote><div>There is no need to check this. In not supported eDP panel, this register will read all 0s. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
><br>
> > +                         &reg_val) != 1) {<br>
> > +           DRM_DEBUG_KMS("Failed to read DPCD register 0x%x\n",<br>
> > +                          DP_EDP_GENERAL_CAP_3);<br>
> > +           return false;<br>
> > +   }<br>
> > +   if (reg_val > 0)<br>
> > +           return true;<br>
> > +<br>
> > +   /* Panel supports backlight PWM frequency set */<br>
> > +   if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_FREQ_AUX_SET_<wbr>CAP)<br>
> > +           return true;<br>
> > +<br>
> > +   /* Panel supports more than 8 bits resolution of brightness level */<br>
> > +   if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_<wbr>BYTE_COUNT)<br>
> > +           return true;<br>
><br>
> I don't know if more than 8 bits is relatively better than the<br>
> resolution PWM pin allows. I guess, we could fix that later by comparing<br>
> the number of brightness levels.<br>
><br>
> > +<br>
> > +   /* Panel supports enabling backlight via AUX but not by BL_ENABLE pin */<br>
> > +   if ((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_<wbr>CAP) &&<br>
> > +       !(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_<wbr>CAP))<br>
> > +           return true;<br>
> > +<br>
> > +   return false;<br>
> > +<br>
> > +}<br>
> > +<br>
> >  int intel_dp_aux_init_backlight_<wbr>funcs(struct intel_connector *intel_connector)<br>
> >  {<br>
> >     struct intel_panel *panel = &intel_connector->panel;<br>
> > @@ -187,6 +241,10 @@ int intel_dp_aux_init_backlight_<wbr>funcs(struct intel_connector *intel_connector)<br>
> >     if (!intel_dp_aux_display_<wbr>control_capable(intel_<wbr>connector))<br>
> >             return -ENODEV;<br>
> ><br>
> > +   if (i915.enable_dpcd_backlight == -1 &&<br>
> > +       !intel_dp_aux_display_control_<wbr>heuristic(intel_connector))<br>
> > +           return -ENODEV;<br>
> > +<br>
> >     panel->backlight.setup = intel_dp_aux_setup_backlight;<br>
> >     panel->backlight.enable = intel_dp_aux_enable_backlight;<br>
> >     panel->backlight.disable = intel_dp_aux_disable_<wbr>backlight;<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Intel-gfx mailing list<br>
> <a href="mailto:Intel-gfx@lists.freedesktop.org" class="cremed">Intel-gfx@lists.freedesktop.<wbr>org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank" class="cremed">https://lists.freedesktop.org/<wbr>mailman/listinfo/intel-gfx</a><br>
<br>
</blockquote></div><br></div></div>