RE: [PATCH 4/7] drm/i915/backlight: Modify function to get VESA brightness in Nits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Murthy, Arun R <arun.r.murthy@xxxxxxxxx>
> Sent: Wednesday, February 5, 2025 9:40 PM
> To: Kandpal, Suraj <suraj.kandpal@xxxxxxxxx>; intel-xe@xxxxxxxxxxxxxxxxxxxxx;
> intel-gfx@xxxxxxxxxxxxxxxxxxxxx; dri-devel@xxxxxxxxxxxxxxxxxxxxx
> Cc: Shankar, Uma <uma.shankar@xxxxxxxxx>; Nikula, Jani
> <jani.nikula@xxxxxxxxx>; Kao, Ben <ben.kao@xxxxxxxxx>
> Subject: RE: [PATCH 4/7] drm/i915/backlight: Modify function to get VESA
> brightness in Nits
> 
> > Modify vesa_get_brightness function to take into account
> > luminance_control_support and based on that read the appropriate
> > register and return the value.
> >
> > --v2
> > -Changes since we now use luminance instead of nits
> >
> > Signed-off-by: Suraj Kandpal <suraj.kandpal@xxxxxxxxx>
> > Tested-by: Ben Kao <ben.kao@xxxxxxxxx>
> > ---
> >  .../drm/i915/display/intel_dp_aux_backlight.c | 20
> > +++++++++++++++++++
> >  1 file changed, 20 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 84126e7d1716..a733b5623563 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> > @@ -451,6 +451,26 @@ intel_dp_aux_hdr_setup_backlight(struct
> > intel_connector *connector, enum pipe pi
> >  /* VESA backlight callbacks */
> >  static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector
> > *connector, enum pipe unused)  {
> > +	struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
> > +	struct intel_panel *panel = &connector->panel;
> > +	u8 buf[3];
> > +	u32 val = 0;
> > +	int ret;
> > +
> > +	if (panel->backlight.edp.vesa.luminance_control_support) {
> > +		ret = drm_dp_dpcd_read(&intel_dp->aux,
> > DP_EDP_PANEL_TARGET_LUMINANCE_VALUE, buf,
> > +				       sizeof(buf));
> > +		if (ret < 0) {
> > +			drm_err(intel_dp->aux.drm_dev,
> > +				"[CONNECTOR:%d:%s] Failed to read
> > Luminance from DPCD\n",
> > +				connector->base.base.id, connector-
> > >base.name);
> > +			return 0;
> > +		}
> > +
> > +		val |= buf[0] | buf[1] << 8 | buf[2] << 16;
> |= doesn't add any value
> Also better to add braces (buf[1] << 8)
> 
> > +		return val / 1000;
> Fractional value will be lost.
> If its expected then with the above said changes

Yes this is expected since the granularity of this reg is .001 basically taking milli nits value.
We get our level in nits hence multiply by 1000 when we write into the register and divide by 1000 when we send
The read value back.

Regards,
Suraj Kandpal

> Reviewed-by: Arun R Murthy <arun.r.murthy@xxxxxxxxx>
> 
> Thanks and Regards,
> Arun R Murthy
> --------------------
> 
> > +	}
> > +
> >  	return connector->panel.backlight.level;  }
> >
> > --
> > 2.34.1





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux