1. 17 Jan, 2020 4 commits
    • Lyude Paul's avatar
      drm/i915: Fix DPCD register order in intel_dp_aux_enable_backlight() · 662884a9
      Lyude Paul authored
      For eDP panels, it appears it's expected that so long as the panel is in
      DPCD control mode that the brightness value is never set to 0. Instead,
      if the desired effect is to set the panel's backlight to 0 we're
      expected to simply turn off the backlight through the
      DP_EDP_DISPLAY_CONTROL_REGISTER.
      
      We already do the latter correctly in intel_dp_aux_disable_backlight().
      But, we make the mistake of writing the DPCD registers in the wrong
      order when enabling the backlight in intel_dp_aux_enable_backlight()
      since we currently enable the backlight through
      DP_EDP_DISPLAY_CONTROL_REGISTER before writing the brightness level. On
      the X1 Extreme 2nd Generation, this appears to have the potential of
      confusing the panel in such a way that further attempts to set the
      brightness don't actually change the backlight as expected and leave it
      off. Presumably, this happens because the incorrect register writing
      order briefly leaves the panel with DPCD mode enabled and a 0 brightness
      level set.
      
      So, reverse the order we write the DPCD registers when enabling the
      panel backlight so that we write the brightness value first, and enable
      the backlight second. This fix appears to be the final bit needed to get
      the backlight on the ThinkPad X1 Extreme 2nd Generation's AMOLED screen
      working.
      Tested-by: default avatarAceLan Kao <acelan.kao@canonical.com>
      Tested-by: default avatarPerry Yuan <pyuan@redhat.com>
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200116211623.53799-4-lyude@redhat.com
      662884a9
    • Lyude Paul's avatar
      drm/i915: Assume 100% brightness when not in DPCD control mode · 79946723
      Lyude Paul authored
      Currently we always determine the initial panel brightness level by
      simply reading the value from DP_EDP_BACKLIGHT_BRIGHTNESS_MSB/LSB. This
      seems wrong though, because if the panel is not currently in DPCD
      control mode there's not really any reason why there would be any
      brightness value programmed in the first place.
      
      This appears to be the case on the Lenovo ThinkPad X1 Extreme 2nd
      Generation, where the default value in these registers is always 0 on
      boot despite the fact the panel runs at max brightness by default.
      Getting the initial brightness value correct here is important as well,
      since the panel on this laptop doesn't behave well if it's ever put into
      DPCD control mode while the brightness level is programmed to 0.
      
      So, let's fix this by checking what the current backlight control mode
      is before reading the brightness level. If it's in DPCD control mode, we
      return the programmed brightness level. Otherwise we assume 100%
      brightness and return the highest possible brightness level. This also
      prevents us from accidentally programming a brightness level of 0.
      
      This is one of the many fixes that gets backlight controls working on
      the ThinkPad X1 Extreme 2nd Generation with optional 4K AMOLED screen.
      
      Changes since v1:
      * s/DP_EDP_DISPLAY_CONTROL_REGISTER/DP_EDP_BACKLIGHT_MODE_SET_REGISTER/
        - Jani
      Tested-by: default avatarAceLan Kao <acelan.kao@canonical.com>
      Tested-by: default avatarPerry Yuan <pyuan@redhat.com>
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200116211623.53799-3-lyude@redhat.com
      79946723
    • Lyude Paul's avatar
      drm/i915: Fix eDP DPCD aux max backlight calculations · fde7266f
      Lyude Paul authored
      Max backlight value for the panel was being calculated using byte
      count i.e. 0xffff if 2 bytes are supported for backlight brightness
      and 0xff if 1 byte is supported. However, EDP_PWMGEN_BIT_COUNT
      determines the number of active control bits used for the brightness
      setting. Thus, even if the panel uses 2 byte setting, it might not use
      all the control bits. Thus, max backlight should be set based on the
      value of EDP_PWMGEN_BIT_COUNT instead of assuming 65535 or 255.
      
      Additionally, EDP_PWMGEN_BIT_COUNT was being updated based on the VBT
      frequency which results in a different max backlight value. Thus,
      setting of EDP_PWMGEN_BIT_COUNT is moved to setup phase instead of
      enable so that max backlight can be calculated correctly. Only the
      frequency divider is set during the enable phase using the value of
      EDP_PWMGEN_BIT_COUNT.
      
      This is based off the original patch series from Furquan Shaikh
      <furquan@google.com>:
      
      https://patchwork.freedesktop.org/patch/317255/?series=62326&rev=3
      
      Changes since original patch:
      * Remove unused intel_dp variable in intel_dp_aux_setup_backlight()
      * Fix checkpatch issues
      * Make sure that we rewrite the pwmgen bit count whenever we bring the
        panel out of D3 mode
      
      v2 by Jani:
      * rebase
      * fix readb return value check
      
      Cc: Furquan Shaikh <furquan@google.com>
      Tested-by: default avatarAceLan Kao <acelan.kao@canonical.com>
      Tested-by: default avatarPerry Yuan <pyuan@redhat.com>
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200116211623.53799-2-lyude@redhat.com
      fde7266f
    • Vivek Kasireddy's avatar
      drm/i915/dsi: Lookup the i2c bus from ACPI NS only if CONFIG_ACPI=y (v2) · 960287ca
      Vivek Kasireddy authored
      Perform the i2c bus/adapter lookup from ACPI Namespace only if ACPI is
      enabled in the kernel config. If ACPI is not enabled or if the lookup
      fails, we'll fallback to using the VBT for identifying the i2c bus.
      
      v2: Add fixes tag (Jani)
      
      Fixes: 8cbf89db ("drm/i915/dsi: Parse the I2C element from the VBT MIPI sequence block (v3)")
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Bob Paauwe <bob.j.paauwe@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarVivek Kasireddy <vivek.kasireddy@intel.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200115012305.27395-1-vivek.kasireddy@intel.com
      960287ca
  2. 16 Jan, 2020 7 commits
  3. 15 Jan, 2020 7 commits
  4. 14 Jan, 2020 13 commits
  5. 13 Jan, 2020 8 commits
  6. 11 Jan, 2020 1 commit