Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>,
	intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Cc: uma.shankar@intel.com, arun.r.murthy@intel.com,
	ben.kao@intel.com, Suraj Kandpal <suraj.kandpal@intel.com>
Subject: Re: [PATCH 5/7] drm/i915/backlight: Add function to change brightness in NITS for VESA
Date: Tue, 04 Feb 2025 10:49:44 +0200	[thread overview]
Message-ID: <87bjvi6qmv.fsf@intel.com> (raw)
In-Reply-To: <20250124054631.1796456-6-suraj.kandpal@intel.com>

On Fri, 24 Jan 2025, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> Create a function that fills in the value for
> PANEL_TARGET_LUMINANCE_VALUE which helps in changing the brightness in
> NITS using VESA interface.
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>  .../drm/i915/display/intel_dp_aux_backlight.c | 29 +++++++++++++++++++
>  1 file changed, 29 insertions(+)
>
> 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 ac9a69fe3f10..d794397656dd 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> @@ -474,6 +474,30 @@ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, en
>  	return connector->panel.backlight.level;
>  }
>  
> +static int
> +intel_dp_aux_vesa_set_nits_brightness(struct intel_connector *connector, u32 level)

_set_luminance()?

Troughout the series, I'd prefer "luminance" over "nits", i.e. measure
over unit.

> +{
> +	struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
> +	u8 buf[3];
> +	int ret;
> +
> +	level = level * 1000;
> +	level &= 0xffffff;
> +	buf[0] = (level & 0x0000ff);
> +	buf[1] = (level & 0x00ff00) >> 8;
> +	buf[2] = (level & 0xff0000) >> 16;
> +
> +	ret = drm_dp_dpcd_write(&intel_dp->aux, DP_EDP_PANEL_TARGET_LUMINANCE_VALUE, buf, sizeof(buf));
> +	if (ret != sizeof(buf)) {
> +		drm_err(intel_dp->aux.drm_dev,
> +			"%s: Failed to VESA AUX Nits backlight level: %d\n",
> +			intel_dp->aux.name, ret);
> +		return -EINVAL;
> +	} else {
> +		return 0;
> +	}
> +}
> +
>  static void
>  intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, u32 level)
>  {
> @@ -481,6 +505,11 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, u3
>  	struct intel_panel *panel = &connector->panel;
>  	struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
>  
> +	if (panel->backlight.edp.vesa.nits_support) {
> +		if (!intel_dp_aux_vesa_set_nits_brightness(connector, level))
> +			return;
> +	}
> +
>  	if (!panel->backlight.edp.vesa.info.aux_set) {
>  		const u32 pwm_level = intel_backlight_level_to_pwm(connector, level);

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2025-02-04  8:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24  5:46 [PATCH 0/7] Enable Aux based Nits brightness control for eDP Suraj Kandpal
2025-01-24  5:46 ` [PATCH 1/7] drm/dp: Add eDP 1.5 bit definition Suraj Kandpal
2025-02-03  7:10   ` Kao, Ben
2025-02-04  8:44   ` Murthy, Arun R
2025-01-24  5:46 ` [PATCH 2/7] drm/i915/backlight: Use proper interface based on eDP version Suraj Kandpal
2025-02-03  7:11   ` Kao, Ben
2025-01-24  5:46 ` [PATCH 3/7] drm/i915/backlight: Check Nits based brightness control for VESA Suraj Kandpal
2025-02-03  7:11   ` Kao, Ben
2025-02-04  8:45   ` Jani Nikula
2025-02-04  9:42     ` Kandpal, Suraj
2025-01-24  5:46 ` [PATCH 4/7] drm/i915/backlight: Modify function to get VESA brightness in NITS Suraj Kandpal
2025-02-03  7:11   ` Kao, Ben
2025-01-24  5:46 ` [PATCH 5/7] drm/i915/backlight: Add function to change brightness in NITS for VESA Suraj Kandpal
2025-02-03  7:12   ` Kao, Ben
2025-02-04  8:49   ` Jani Nikula [this message]
2025-01-24  5:46 ` [PATCH 6/7] drm/i915/backlight: Setup NITS based brightness via VESA Suraj Kandpal
2025-02-03  7:12   ` Kao, Ben
2025-01-24  5:46 ` [PATCH 7/7] drm/i915/backlight: Enable Nits based brightness Suraj Kandpal
2025-02-03  7:13   ` Kao, Ben
2025-01-24  6:42 ` ✓ CI.Patch_applied: success for Enable Aux based Nits brightness control for eDP Patchwork
2025-01-24  6:43 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-24  6:45 ` ✓ CI.KUnit: success " Patchwork
2025-01-24  7:06 ` ✓ CI.Build: " Patchwork
2025-01-24  7:08 ` ✓ CI.Hooks: " Patchwork
2025-01-24  7:10 ` ✗ CI.checksparse: warning " Patchwork
2025-01-24  7:37 ` ✓ Xe.CI.BAT: success " Patchwork
2025-01-24 12:45 ` ✗ Xe.CI.Full: failure " Patchwork
2025-02-03  7:13 ` [PATCH 0/7] " Kao, Ben
  -- strict thread matches above, loose matches on Subject: below --
2025-02-04 12:50 Suraj Kandpal
2025-02-04 12:50 ` [PATCH 5/7] drm/i915/backlight: Add function to change brightness in nits for VESA Suraj Kandpal
2025-02-05 16:14   ` Murthy, Arun R
2025-02-06  5:22     ` Murthy, Arun R

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=87bjvi6qmv.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=ben.kao@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=suraj.kandpal@intel.com \
    --cc=uma.shankar@intel.com \
    /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