<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 16, 2017 at 2:21 PM, Pandiyan, Dhinakaran <span dir="ltr"><<a href="mailto:dhinakaran.pandiyan@intel.com" target="_blank" class="gmail-cremed cremed">dhinakaran.pandiyan@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Tue, 2017-05-16 at 13:56 -0700, Puthikorn Voravootivat wrote:<br>
><br>
><br>
> On Tue, May 16, 2017 at 1:29 PM, Pandiyan, Dhinakaran<br>
> <<a href="mailto:dhinakaran.pandiyan@intel.com" class="gmail-cremed cremed">dhinakaran.pandiyan@intel.com</a><wbr>> wrote:<br>
>         On Tue, 2017-05-16 at 11:07 -0700, Puthikorn Voravootivat<br>
>         wrote:<br>
>         ><br>
>         ><br>
>         > On Mon, May 15, 2017 at 11:21 PM, Pandiyan, Dhinakaran<br>
>         > <<a href="mailto:dhinakaran.pandiyan@intel.com" class="gmail-cremed cremed">dhinakaran.pandiyan@intel.com</a><wbr>> wrote:<br>
>         >         On Mon, 2017-05-15 at 17:43 -0700, Puthikorn<br>
>         Voravootivat<br>
>         >         wrote:<br>
>         >         ><br>
>         >         ><br>
>         >         > On Mon, May 15, 2017 at 4:07 PM, Pandiyan,<br>
>         Dhinakaran<br>
>         >         > <<a href="mailto:dhinakaran.pandiyan@intel.com" class="gmail-cremed cremed">dhinakaran.pandiyan@intel.com</a><wbr>> wrote:<br>
>         >         >         On Fri, 2017-05-12 at 17:31 -0700,<br>
>         Puthikorn<br>
>         >         Voravootivat<br>
>         >         >         wrote:<br>
>         >         >         ><br>
>         >         >         ><br>
>         >         >         ><br>
>         >         >         > On Fri, May 12, 2017 at 5:12 PM,<br>
>         Pandiyan,<br>
>         >         Dhinakaran<br>
>         >         >         > <<a href="mailto:dhinakaran.pandiyan@intel.com" class="gmail-cremed cremed">dhinakaran.pandiyan@intel.com</a><wbr>> wrote:<br>
>         >         >         >         On Thu, 2017-05-11 at 16:02<br>
>         -0700,<br>
>         >         Puthikorn<br>
>         >         >         Voravootivat<br>
>         >         >         >         wrote:<br>
>         >         >         >         > Read desired PWM frequency<br>
>         from panel<br>
>         >         vbt and<br>
>         >         >         calculate the<br>
>         >         >         >         > value for divider in DPCD<br>
>         address 0x724<br>
>         >         and 0x728<br>
>         >         >         to have<br>
>         >         >         >         > as many bits as possible for<br>
>         PWM duty<br>
>         >         cyle for<br>
>         >         >         granularity<br>
>         >         >         >         of<br>
>         >         >         >         > brightness adjustment while<br>
>         the<br>
>         >         frequency is still<br>
>         >         >         within<br>
>         >         >         >         25%<br>
>         >         >         >         > of the desired frequency.<br>
>         >         >         ><br>
>         >         >         >         I read a few eDP panel data<br>
>         sheets, the<br>
>         >         PWM<br>
>         >         >         frequencies all<br>
>         >         >         >         start from<br>
>         >         >         >         ~200Hz. If the VBT chooses this<br>
>         lowest<br>
>         >         value to<br>
>         >         >         allow for more<br>
>         >         >         >         brightness control, and then<br>
>         this patch<br>
>         >         lowers the<br>
>         >         >         value by<br>
>         >         >         >         another 25%,<br>
>         >         >         >         we'll end up below the panel<br>
>         allowed PWM<br>
>         >         frequency.<br>
>         >         >         ><br>
>         >         >         >         In fact, one of the systems I<br>
>         checked had<br>
>         >         PWM<br>
>         >         >         frequency as<br>
>         >         >         >         200Hz in VBT<br>
>         >         >         >         and the panel datasheet also had<br>
>         PWM<br>
>         >         frequency range<br>
>         >         >         starting<br>
>         >         >         >         from<br>
>         >         >         >         200Hz. Have you considered this<br>
>         case?<br>
>         >         >         ><br>
>         >         >         > The spec said "A given LCD panel<br>
>         typically has a<br>
>         >         limited<br>
>         >         >         range of<br>
>         >         >         > backlight frequency capability.<br>
>         >         >         > To limit the programmable frequency<br>
>         range,<br>
>         >         limitations are<br>
>         >         >         placed on<br>
>         >         >         > the allowable total divider ratio with<br>
>         the Sink<br>
>         >         device"<br>
>         >         >         >  So I think it should be auto cap to<br>
>         200Hz in this<br>
>         >         case.<br>
>         >         >         ><br>
>         >         >         >         -DK<br>
>         >         >         >         ><br>
>         >         >         >         > Signed-off-by: Puthikorn<br>
>         Voravootivat<br>
>         >         >         <<a href="mailto:puthik@chromium.org" class="gmail-cremed cremed">puthik@chromium.org</a>><br>
>         >         >         >         > ---<br>
>         >         >         >         ><br>
>         >         drivers/gpu/drm/i915/intel_dp_<wbr>aux_backlight.c |<br>
>         >         >         81<br>
>         >         >         >         +++++++++++++++++++++++++++<br>
>         >         >         >         >  1 file changed, 81<br>
>         insertions(+)<br>
>         >         >         >         ><br>
>         >         >         >         > diff --git<br>
>         >         ><br>
>          a/drivers/gpu/drm/i915/intel_<wbr>dp_aux_backlight.c<br>
>         >         >         ><br>
>         >          b/drivers/gpu/drm/i915/intel_<wbr>dp_aux_backlight.c<br>
>         >         >         >         > index<br>
>         0b48851013cc..6f10a2f1ab76 100644<br>
>         >         >         >         > ---<br>
>         >         ><br>
>          a/drivers/gpu/drm/i915/intel_<wbr>dp_aux_backlight.c<br>
>         >         >         >         > +++<br>
>         >         ><br>
>          b/drivers/gpu/drm/i915/intel_<wbr>dp_aux_backlight.c<br>
>         >         >         >         > @@ -113,12 +113,86 @@<br>
>         >         >         ><br>
>         >          intel_dp_aux_set_dynamic_<wbr>backlight_percent(struct<br>
>         >         >         intel_dp<br>
>         >         >         >         *intel_dp,<br>
>         >         >         >         >       }<br>
>         >         >         >         >  }<br>
>         >         >         >         ><br>
>         >         >         >         > +/*<br>
>         >         >         >         > + * Set PWM Frequency divider<br>
>         to match<br>
>         >         desired<br>
>         >         >         frequency in<br>
>         >         >         >         vbt.<br>
>         >         >         >         > + * The PWM Frequency is<br>
>         calculated as<br>
>         >         27Mhz / (F<br>
>         >         >         x P).<br>
>         >         >         >         > + * - Where F = PWM Frequency<br>
>         >         Pre-Divider value<br>
>         >         >         programmed<br>
>         >         >         >         by field 7:0 of the<br>
>         >         >         >         > + *<br>
>          EDP_BACKLIGHT_FREQ_SET<br>
>         >         register<br>
>         >         >         (DPCD<br>
>         >         >         >         Address 00728h)<br>
>         >         >         >         > + * - Where P = 2^Pn, where Pn<br>
>         is the<br>
>         >         value<br>
>         >         >         programmed by<br>
>         >         >         >         field 4:0 of the<br>
>         >         >         >         > + *<br>
>          EDP_PWMGEN_BIT_COUNT<br>
>         >         register<br>
>         >         >         (DPCD Address<br>
>         >         >         >         00724h)<br>
>         >         >         >         > + */<br>
>         >         >         >         > +static void<br>
>         >         intel_dp_aux_set_pwm_freq(<wbr>struct<br>
>         >         >         >         intel_connector *connector)<br>
>         >         >         >         > +{<br>
>         >         >         >         > +     struct drm_i915_private<br>
>         *dev_priv<br>
>         >         =<br>
>         >         >         >         to_i915(connector->base.dev);<br>
>         >         >         >         > +     struct intel_dp<br>
>         *intel_dp =<br>
>         >         >         ><br>
>         >          enc_to_intel_dp(&connector-><wbr>encoder->base);<br>
>         >         >         >         > +     int freq, fxp, fxp_min,<br>
>         fxp_max,<br>
>         >         fxp_actual,<br>
>         >         >         f = 1;<br>
>         >         >         >         > +     u8 pn, pn_min, pn_max;<br>
>         >         >         >         > +<br>
>         >         >         >         > +     /* Find desired value of<br>
>         (F x P)<br>
>         >         >         >         > +      * Note that, if F x P<br>
>         is out of<br>
>         >         supported<br>
>         >         >         range, the<br>
>         >         >         >         maximum value or<br>
>         >         >         >         > +      * minimum value will<br>
>         applied<br>
>         >         automatically.<br>
>         >         >         So no<br>
>         >         >         >         need to check that.<br>
>         >         >         >         > +      */<br>
>         >         >         >         > +     freq =<br>
>         >         dev_priv->vbt.backlight.pwm_<wbr>freq_hz;<br>
>         >         >         >         > +     DRM_DEBUG_KMS("VBT<br>
>         defined<br>
>         >         backlight<br>
>         >         >         frequency %u Hz<br>
>         >         >         >         \n", freq);<br>
>         >         >         >         > +     if (!freq) {<br>
>         >         >         >         > +<br>
>          DRM_DEBUG_KMS("Use panel<br>
>         >         default<br>
>         >         >         backlight<br>
>         >         >         >         frequency\n");<br>
>         >         >         >         > +             return;<br>
>         >         >         >         > +     }<br>
>         >         >         >         > +<br>
>         >         >         >         > +     fxp =<br>
>         >         KHz(DP_EDP_BACKLIGHT_FREQ_<wbr>BASE_KHZ) /<br>
>         >         >         freq;<br>
>         >         >         >         > +<br>
>         >         >         >         > +     /* Use highest possible<br>
>         value of<br>
>         >         Pn for more<br>
>         >         >         >         granularity of brightness<br>
>         >         >         >         > +      * adjustment while<br>
>         satifying the<br>
>         >         conditions<br>
>         >         >         below.<br>
>         >         >         >         > +      * - Pn is in the range<br>
>         of Pn_min<br>
>         >         and Pn_max<br>
>         >         >         >         > +      * - F is in the range<br>
>         of 1 and<br>
>         >         255<br>
>         >         >         >         > +      * - Effective frequency<br>
>         is within<br>
>         >         25% of<br>
>         >         >         desired<br>
>         >         >         >         frequency.<br>
>         >         >         >         > +      */<br>
>         >         >         >         > +     if<br>
>         >         (drm_dp_dpcd_readb(&intel_dp-><wbr>aux,<br>
>         >         >         >         > +<br>
>         >         >         >         DP_EDP_PWMGEN_BIT_COUNT_CAP_<wbr>MIN,<br>
>         >         &pn_min) != 1) {<br>
>         >         >         >         > +<br>
>          DRM_DEBUG_KMS("Failed to<br>
>         >         read pwmgen<br>
>         >         >         bit count<br>
>         >         >         >         cap min\n");<br>
>         >         >         >         > +             return;<br>
>         >         >         >         > +     }<br>
>         >         >         >         > +     if<br>
>         >         (drm_dp_dpcd_readb(&intel_dp-><wbr>aux,<br>
>         >         >         >         > +<br>
>         >         >         >         DP_EDP_PWMGEN_BIT_COUNT_CAP_<wbr>MAX,<br>
>         >         &pn_max) != 1) {<br>
>         >         >         >         > +<br>
>          DRM_DEBUG_KMS("Failed to<br>
>         >         read pwmgen<br>
>         >         >         bit count<br>
>         >         >         >         cap max\n");<br>
>         >         >         >         > +             return;<br>
>         >         >         >         > +     }<br>
>         >         >         >         > +     pn_min &=<br>
>         >         DP_EDP_PWMGEN_BIT_COUNT_MASK;<br>
>         >         >         >         > +     pn_max &=<br>
>         >         DP_EDP_PWMGEN_BIT_COUNT_MASK;<br>
>         >         >         >         > +<br>
>         >         >         >         > +     fxp_min = fxp * 3 / 4;<br>
>         >         >         >         > +     fxp_max = fxp * 5 / 4;<br>
>         >         >         ><br>
>         >         >         ><br>
>         >         >         >         You are allowing fxp between +/-<br>
>         25% of<br>
>         >         the actual.<br>
>         >         >         This isn't<br>
>         >         >         >         same as<br>
>         >         >         >         the "Effective frequency is<br>
>         within 25% of<br>
>         >         desired<br>
>         >         >         frequency."<br>
>         >         >         >         right? The<br>
>         >         >         >         frequency can vary between -20%<br>
>         and +33%.<br>
>         >         >         ><br>
>         >         >         ><br>
>         >         >         > You are right.<br>
>         >         >         > You want me to change commit message to<br>
>         reflect<br>
>         >         this or<br>
>         >         >         change the<br>
>         >         >         > code to<br>
>         >         >         > match the commit message?<br>
>         >         ><br>
>         >         ><br>
>         >         >         I am okay with fixing the comment and<br>
>         commit<br>
>         >         message. Is the<br>
>         >         >         25%<br>
>         >         >         arbitrary or based on the distances<br>
>         between the<br>
>         >         possible<br>
>         >         >         values? Please<br>
>         >         >         make a note in the comment if it's the<br>
>         former.<br>
>         >         ><br>
>         >         ><br>
>         >         >         >         > +     if (fxp_min < (1 <<<br>
>         pn_min) ||<br>
>         >         (255 <<<br>
>         >         >         pn_max) <<br>
>         >         >         >         fxp_max) {<br>
>         >         ><br>
>         >         ><br>
>         >         ><br>
>         >         >         >         > +<br>
>          DRM_DEBUG_KMS("VBT defined<br>
>         >         backlight<br>
>         >         >         frequency<br>
>         >         >         >         out of range\n");<br>
>         >         >         >         > +             return;<br>
>         >         >         >         > +     }<br>
>         >         >         >         > +<br>
>         >         >         >         > +     for (pn = pn_max; pn ><br>
>         pn_min;<br>
>         >         pn--) {<br>
>         >         ><br>
>         >         >         Is there a reason this is not pn >=<br>
>         pn_min?<br>
>         >         > This is bug because f value will be incorrect in<br>
>         the case<br>
>         >         that pn ==<br>
>         >         > pn_min.<br>
>         >         > Thanks for catching this.<br>
>         >         ><br>
>         ><br>
>         ><br>
>         >         Isn't that a side-effect using the right shift<br>
>         operation for<br>
>         >         division?<br>
>         > The bug is just for loop that exit too soon.<br>
>         ><br>
><br>
>         Not sure I got that, what's the invalid "f" case that you see<br>
>         with<br>
>         pn==pn_min?<br>
><br>
><br>
><br>
> if the for loop has pn > pn_min, when pn == pn_min we will exit the<br>
> loop first<br>
> without running the  f = clamp(fxp >> pn, 1, 255); in the next line.<br>
><br>
><br>
> This would fix with pn >= pn_min in for loop.<br>
><br>
<br>
</div></div>Ah! I thought you were giving me a reason to not change it to pn >=<br>
pn_min .<br>
<div><div class="gmail-h5"><br>
<br>
><br>
> We guarantee that the break statement will be called and pn won't be<br>
> pn_min - 1<br>
> because we check (fxp_min < (1 << pn_min) || (255 << pn_max) <<br>
> fxp_max) before<br>
> entering this for loop.<br>
><br>
><br>
><br>
>         >         Would DIV_ROUND_CLOSEST allow you to use pn_min?<br>
>         > It does not related to the point above, but<br>
>         DIV_ROUND_CLOSEST still<br>
>         > better than just using right shift. I will change to that in<br>
>         next<br>
>         > version.<br>
>         ><br>
>         ><br>
>         >         ><br>
>         >         >         >         > +             f = clamp(fxp >><br>
>         pn, 1,<br>
>         >         255);<br>
>         >         >         >         > +             fxp_actual = f<br>
>         << pn;<br>
>         >         >         >         > +             if (fxp_min <=<br>
>         fxp_actual<br>
>         >         &&<br>
>         >         >         fxp_actual <=<br>
>         >         >         >         fxp_max)<br>
>         >         >         >         > +                     break;<br>
>         >         >         >         > +     }<br>
>         >         >         >         > +<br>
>         >         >         >         > +     if<br>
>         >         (drm_dp_dpcd_writeb(&intel_dp-<wbr>>aux,<br>
>         >         >         >         > +<br>
>         >         >         DP_EDP_PWMGEN_BIT_COUNT, pn) <<br>
>         >         >         >         0) {<br>
>         >         >         >         > +<br>
>          DRM_DEBUG_KMS("Failed to<br>
>         >         write aux<br>
>         >         >         pwmgen bit<br>
>         >         >         >         count\n");<br>
>         >         ><br>
>         >         ><br>
>         >         >         If the number of brightness control bits<br>
>         are<br>
>         >         changing, the<br>
>         >         >         max.<br>
>         >         >         brightness value changes too.<br>
>         >         ><br>
>         >         >         Please see intel_dp_aux_setup_backlight()<wbr>.<br>
>         >         ><br>
>         >         ><br>
>         >         > I think this is fine because<br>
>         >         > - intel_dp_aux_setup_backlight() will<br>
>         >         > called intel_dp_aux_enable_backlight(<wbr>) which<br>
>         >         > called intel_dp_aux_set_pwm_freq() first before<br>
>         determine<br>
>         >         the max<br>
>         >         > brightness value.<br>
>         >         > - Also, the panel I tested does not change<br>
>         >         > BACKLIGHT_BRIGHTNESS_BYTE_<wbr>COUNT<br>
>         >         ><br>
>         >         > when changing the frequency.<br>
>         ><br>
>         ><br>
>         >         The only values I see being set for max brightness<br>
>         are 0xFFFF<br>
>         >         and 0xFF<br>
>         ><br>
>         >         if (intel_dp->edp_dpcd[2] &<br>
>         >         DP_EDP_BACKLIGHT_BRIGHTNESS_<wbr>BYTE_COUNT)<br>
>         >                 panel->backlight.max = 0xFFFF;<br>
>         >         else<br>
>         >                 panel->backlight.max = 0xFF;<br>
>         ><br>
>         >         I can't see where you are setting this based on Pn.<br>
>         Can you<br>
>         >         please point<br>
>         >         out? From what I understand, max should be 2^Pn.<br>
>         ><br>
>         ><br>
>         > It is suppose to be 0xFF or 0xFFFF only.<br>
>         ><br>
>         ><br>
>         > From eDP spec:<br>
>         > 0x702 bit 2 BACKLIGHT_BRIGHTNESS_BYTE_<wbr>COUNT<br>
>         > 0 = Indicates that the Sink device supports a 1-byte setting<br>
>         for<br>
>         > backlight brightness<br>
>         > 1 = Indicates that the Sink device supports a 2-byte setting<br>
>         for the<br>
>         > backlight brightness<br>
>         ><br>
>         ><br>
>         > 0x722 EDP_BACKLIGHT_BRIGHTNESS_MSB<br>
>         > The actual number of assigned bits for the backlight<br>
>         brightness PWM<br>
>         > generator is set by<br>
>         > field 4:0 of the EDP_PWMGEN_BIT_COUNT register (DPCD Address<br>
>         00724h).<br>
>         > Assigned bits are allocated to the MSB of the enabled<br>
>         register<br>
>         > combination<br>
>         ><br>
><br>
>         ^This makes it somewhat clear but gets confusing again.<br>
>         ><br>
>         > This means that if PWM_GEN_BIT_COUNT is less than 16 then<br>
>         the panel<br>
>         > will ignore<br>
>         > the least significant bit in EDP_BACKLIGHT_BRIGHTNESS<br>
>         register.<br>
>         ><br>
>         ><br>
>         > For example,<br>
>         > if  BACKLIGHT_BRIGHTNESS_BYTE_<wbr>COUNT == 1 and<br>
>         PWM_GEN_BIT_COUNT = 16<br>
>         > and EDP_BACKLIGHT_BRIGHTNESS == 0xabcd<br>
>         > In this case, all bits in EDP_BACKLIGHT_BRIGHTNESS will be<br>
>         used.<br>
>         ><br>
>         > 0xabcd means 0xabcd / 0xffff or (43981 / 65535) or 67.111%<br>
>         ><br>
>         ><br>
>         > if  BACKLIGHT_BRIGHTNESS_BYTE_<wbr>COUNT == 1 and<br>
>         PWM_GEN_BIT_COUNT = 12<br>
>         > and EDP_BACKLIGHT_BRIGHTNESS == 0xabcd<br>
>         ><br>
>         > In this case, the last 4 bits will be discarded.<br>
>         > 0xabcd means 0xabc / 0xfff or 2748 / 4095 or 67.106%<br>
>         ><br>
>         ><br>
>         > I think it should be fine to just have 8 or 16 bits of the<br>
>         max<br>
>         > brightness and let panel drop<br>
>         > the unneed bit to simplify the driver code.<br>
>         ><br>
><br>
>         Note:<br>
>         The number of assigned or controllable bits will have the<br>
>         ability to<br>
>         provide full brightness control. Examples:<br>
>         •<br>
>          For 10-bit operation, 000h = 0% brightness, and 3FFh = 100%<br>
>         brightness.<br>
><br>
>         Going by the logic you stated, for a 10-bit control, the MSB<br>
>         and LSB<br>
>         registers have to be written FFFFh to set 100% brightness with<br>
>         the last<br>
>         6 bits dropped off by the hardware.<br>
><br>
>         I don't like the way the spec leaves this to interpretation.<br>
>         Have you<br>
>         experimented with both 0x0ABC and 0xABCD for the 12-bit,<br>
>         BYTE_COUNT==1<br>
>         example you gave?<br>
><br>
> Yes, already test with the real panel.<br>
><br>
><br>
> Here is better test case than 0xABCD<br>
> 0xFFFF with 6, 12, 16 shows very bright screen with same brightness in<br>
> all case. (All 100%)<br>
> 0x0FFF with 6, 12, 16 bits shows dim screen. 6 bit case is slightly<br>
> dimmer than other case.<br>
> Note that the brightness are 4.76% / 6.23% / 6.25% in 6 / 12 / 16 bits<br>
> case.<br>
><br>
<br>
</div></div>Great! Thanks for confirming.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
> You can apply this patch for easy testing<br>
> <a href="https://patchwork.kernel.org/patch/6241481/" rel="noreferrer" target="_blank" class="gmail-cremed cremed">https://patchwork.kernel.org/<wbr>patch/6241481/</a><br>
><br>
><br>
><br>
>         ><br>
>         ><br>
>         >         Also, won't this function be called every time<br>
>         >         _enable_backlight() is<br>
>         >         called? Isn't doing this from setup sufficient? I<br>
>         guess,<br></div></div></blockquote><div>I looked at this a bit and look like we need to call this every time _enable() is called.</div><div>One panel that I have reset the DP_EDP_PWMGEN_BIT_COUNT (pn) to the lowest value</div><div>every time panel backlight is turned off. So doing this from setup is insufficient.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">
>         >         fixing it is an<br>
>         >         optimization that'd be nice to have but not<br>
>         necessary.<br>
>         ><br>
>         > Lets get this patch set done first. I can send in another<br>
>         patch after<br>
>         > this is go in to optimize this.<br>
><br>
>         Sure. This patch should be good to go with answers to my<br>
>         questions. The<br>
>         only thing remaining would be getting an ACK from Jani for<br>
>         adding a new<br>
>         parameter for dynamic backlight control.<br>
><br>
><br>
>         -DK<br>
><br>
>         > Probably need to add new member in struct drm_i915_private<br>
>         ><br>
>         >         ><br>
>         >         ><br>
>         >         >         >         > +             return;<br>
>         >         >         >         > +     }<br>
>         >         >         >         > +     if<br>
>         >         (drm_dp_dpcd_writeb(&intel_dp-<wbr>>aux,<br>
>         >         >         >         > +<br>
>         >         >         DP_EDP_BACKLIGHT_FREQ_SET, (u8)<br>
>         >         >         >         f) < 0) {<br>
>         >         >         >         > +<br>
>          DRM_DEBUG_KMS("Failed to<br>
>         >         write aux<br>
>         >         >         backlight<br>
>         >         >         >         freq\n");<br>
>         >         >         >         > +             return;<br>
>         >         >         >         > +     }<br>
>         >         >         >         > +}<br>
>         >         >         >         > +<br>
>         >         >         >         >  static void<br>
>         >         intel_dp_aux_enable_backlight(<wbr>struct<br>
>         >         >         >         intel_connector *connector)<br>
>         >         >         >         >  {<br>
>         >         >         >         >       struct intel_dp<br>
>         *intel_dp =<br>
>         >         >         ><br>
>         >          enc_to_intel_dp(&connector-><wbr>encoder->base);<br>
>         >         >         >         >       uint8_t dpcd_buf = 0;<br>
>         >         >         >         >       uint8_t new_dpcd_buf =<br>
>         0;<br>
>         >         >         >         >       uint8_t<br>
>         edp_backlight_mode = 0;<br>
>         >         >         >         > +     bool freq_cap;<br>
>         >         >         >         ><br>
>         >         >         >         >       if<br>
>         >         (drm_dp_dpcd_readb(&intel_dp-><wbr>aux,<br>
>         >         >         >         ><br>
>         >         >          DP_EDP_BACKLIGHT_MODE_SET_<wbr>REGISTER,<br>
>         >         >         >         &dpcd_buf) != 1) {<br>
>         >         >         >         > @@ -151,6 +225,10 @@ static<br>
>         void<br>
>         >         >         ><br>
>          intel_dp_aux_enable_backlight(<wbr>struct<br>
>         >         intel_connector<br>
>         >         >         >         *connector)<br>
>         >         >         >         ><br>
>          DRM_DEBUG_KMS("Enable<br>
>         >         dynamic<br>
>         >         >         brightness.\n");<br>
>         >         >         >         >       }<br>
>         >         >         >         ><br>
>         >         >         >         > +     freq_cap =<br>
>         intel_dp->edp_dpcd[2] &<br>
>         >         >         ><br>
>          DP_EDP_BACKLIGHT_FREQ_AUX_SET_<wbr>CAP;<br>
>         >         >         >         > +     if (freq_cap)<br>
>         >         >         >         > +             new_dpcd_buf |=<br>
>         >         >         ><br>
>          DP_EDP_BACKLIGHT_FREQ_AUX_SET_<wbr>ENABLE;<br>
>         >         >         >         > +<br>
>         >         >         >         >       if (new_dpcd_buf !=<br>
>         dpcd_buf) {<br>
>         >         >         >         >               if<br>
>         >         >         (drm_dp_dpcd_writeb(&intel_dp-<wbr>>aux,<br>
>         >         >         >         ><br>
>         >         >          DP_EDP_BACKLIGHT_MODE_SET_<wbr>REGISTER,<br>
>         >         >         >         new_dpcd_buf) < 0) {<br>
>         >         >         >         > @@ -158,6 +236,9 @@ static<br>
>         void<br>
>         >         >         ><br>
>          intel_dp_aux_enable_backlight(<wbr>struct<br>
>         >         intel_connector<br>
>         >         >         >         *connector)<br>
>         >         >         >         >               }<br>
>         >         >         >         >       }<br>
>         >         >         >         ><br>
>         >         >         >         > +     if (freq_cap)<br>
>         >         >         >         > +<br>
>         >         >          intel_dp_aux_set_pwm_freq(<wbr>connector);<br>
>         >         >         >         > +<br>
>         >         >         >         ><br>
>          set_aux_backlight_enable(<wbr>intel_dp,<br>
>         >         true);<br>
>         >         >         >         ><br>
>         >          intel_dp_aux_set_backlight(<wbr>connector,<br>
>         >         >         ><br>
>          connector->panel.backlight.<wbr>level);<br>
>         >         >         >         >  }<br>
>         >         >         ><br>
>         >         >         ><br>
>         >         >         ><br>
>         >         >         ><br>
>         >         ><br>
>         >         >         ><br>
>         ______________________________<wbr>_________________<br>
>         >         >         > Intel-gfx mailing list<br>
>         >         >         > <a href="mailto:Intel-gfx@lists.freedesktop.org" class="gmail-cremed cremed">Intel-gfx@lists.freedesktop.<wbr>org</a><br>
>         >         >         ><br>
>         ><br>
>          <a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank" class="gmail-cremed cremed">https://lists.freedesktop.org/<wbr>mailman/listinfo/intel-gfx</a><br>
>         >         ><br>
>         >         ><br>
>         >         ><br>
>         >         > ______________________________<wbr>_________________<br>
>         >         > Intel-gfx mailing list<br>
>         >         > <a href="mailto:Intel-gfx@lists.freedesktop.org" class="gmail-cremed cremed">Intel-gfx@lists.freedesktop.<wbr>org</a><br>
>         >         ><br>
>         <a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank" class="gmail-cremed cremed">https://lists.freedesktop.org/<wbr>mailman/listinfo/intel-gfx</a><br>
>         ><br>
>         ><br>
>         ><br>
>         ><br>
>         > ______________________________<wbr>_________________<br>
>         > Intel-gfx mailing list<br>
>         > <a href="mailto:Intel-gfx@lists.freedesktop.org" class="gmail-cremed cremed">Intel-gfx@lists.freedesktop.<wbr>org</a><br>
>         > <a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank" class="gmail-cremed cremed">https://lists.freedesktop.org/<wbr>mailman/listinfo/intel-gfx</a><br>
><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> Intel-gfx mailing list<br>
> <a href="mailto:Intel-gfx@lists.freedesktop.org" class="gmail-cremed cremed">Intel-gfx@lists.freedesktop.<wbr>org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank" class="gmail-cremed cremed">https://lists.freedesktop.org/<wbr>mailman/listinfo/intel-gfx</a><br>
<br>
</div></div></blockquote></div><br></div></div>