From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Lyude Paul <lyude@redhat.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
nouveau@lists.freedesktop.org,
Satadru Pramanik <satadru@gmail.com>,
stable@vger.kernel.org, Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/5] drm/i915: Add support for panels with VESA backlights with PWM enable/disable
Date: Wed, 27 Oct 2021 13:03:22 +0300 [thread overview]
Message-ID: <YXkj6n/6U5ZaSRN7@intel.com> (raw)
In-Reply-To: <20211026220848.439530-2-lyude@redhat.com>
On Tue, Oct 26, 2021 at 06:08:44PM -0400, Lyude Paul wrote:
> This simply adds proper support for panel backlights that can be controlled
> via VESA's backlight control protocol, but which also require that we
> enable and disable the backlight via PWM instead of via the DPCD interface.
> We also enable this by default, in order to fix some people's backlights
> that were broken by not having this enabled.
>
> For reference, backlights that require this and use VESA's backlight
> interface tend to be laptops with hybrid GPUs, but this very well may
> change in the future.
>
> v4:
> * Make sure that we call intel_backlight_level_to_pwm() in
> intel_dp_aux_vesa_enable_backlight() - vsyrjala
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Link: https://gitlab.freedesktop.org/drm/intel/-/issues/3680
> Fixes: fe7d52bccab6 ("drm/i915/dp: Don't use DPCD backlights that need PWM enable/disable")
> Cc: <stable@vger.kernel.org> # v5.12+
Seems consistent enough.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> .../drm/i915/display/intel_dp_aux_backlight.c | 27 ++++++++++++++-----
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> index 569d17b4d00f..f05b71c01b8e 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> @@ -293,6 +293,13 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,
> struct intel_panel *panel = &connector->panel;
> struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
>
> + if (!panel->backlight.edp.vesa.info.aux_enable) {
> + u32 pwm_level = intel_backlight_invert_pwm_level(connector,
> + panel->backlight.pwm_level_max);
> +
> + panel->backlight.pwm_funcs->enable(crtc_state, conn_state, pwm_level);
> + }
> +
> drm_edp_backlight_enable(&intel_dp->aux, &panel->backlight.edp.vesa.info, level);
> }
>
> @@ -304,6 +311,10 @@ static void intel_dp_aux_vesa_disable_backlight(const struct drm_connector_state
> struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
>
> drm_edp_backlight_disable(&intel_dp->aux, &panel->backlight.edp.vesa.info);
> +
> + if (!panel->backlight.edp.vesa.info.aux_enable)
> + panel->backlight.pwm_funcs->disable(old_conn_state,
> + intel_backlight_invert_pwm_level(connector, 0));
> }
>
> static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector, enum pipe pipe)
> @@ -321,6 +332,15 @@ static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector,
> if (ret < 0)
> return ret;
>
> + if (!panel->backlight.edp.vesa.info.aux_enable) {
> + ret = panel->backlight.pwm_funcs->setup(connector, pipe);
> + if (ret < 0) {
> + drm_err(&i915->drm,
> + "Failed to setup PWM backlight controls for eDP backlight: %d\n",
> + ret);
> + return ret;
> + }
> + }
> panel->backlight.max = panel->backlight.edp.vesa.info.max;
> panel->backlight.min = 0;
> if (current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) {
> @@ -340,12 +360,7 @@ intel_dp_aux_supports_vesa_backlight(struct intel_connector *connector)
> struct intel_dp *intel_dp = intel_attached_dp(connector);
> struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>
> - /* TODO: We currently only support AUX only backlight configurations, not backlights which
> - * require a mix of PWM and AUX controls to work. In the mean time, these machines typically
> - * work just fine using normal PWM controls anyway.
> - */
> - if ((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) &&
> - drm_edp_backlight_supported(intel_dp->edp_dpcd)) {
> + if (drm_edp_backlight_supported(intel_dp->edp_dpcd)) {
> drm_dbg_kms(&i915->drm, "AUX Backlight Control Supported!\n");
> return true;
> }
> --
> 2.31.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2021-10-27 10:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211026220848.439530-1-lyude@redhat.com>
2021-10-26 22:08 ` [PATCH v4 1/5] drm/i915: Add support for panels with VESA backlights with PWM enable/disable Lyude Paul
2021-10-27 10:03 ` Ville Syrjälä [this message]
2021-10-26 22:08 ` [PATCH v4 2/5] drm/nouveau/kms/nv50-: Explicitly check DPCD backlights for aux enable/brightness Lyude Paul
2021-10-28 16:21 ` [Nouveau] " Karol Herbst
2021-10-26 22:08 ` [PATCH v4 3/5] drm/dp: Disable unsupported features in DP_EDP_BACKLIGHT_MODE_SET_REGISTER Lyude Paul
2021-10-28 18:27 ` Doug Anderson
2021-10-28 21:00 ` Lyude Paul
2021-10-26 22:08 ` [PATCH v4 4/5] drm/dp, drm/i915: Add support for VESA backlights using PWM for brightness control Lyude Paul
2021-10-26 22:08 ` [PATCH v4 5/5] drm/i915: Clarify probing order in intel_dp_aux_init_backlight_funcs() Lyude Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YXkj6n/6U5ZaSRN7@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
--cc=satadru@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox