mirror of
https://github.com/torvalds/linux.git
synced 2025-11-01 17:18:25 +02:00
drm/dp: Modify drm_edp_backlight_set_level
Modify drm_edp_backlight_set_level to be able to set the value for register in DP_EDP_PANEL_TARGET_LUMINANCE_VALUE. We multiply the level with 1000 since we get the value in Nits and the register accepts it in milliNits. --v2 -Add comment regarding the unit [Arun] Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com> Link: https://lore.kernel.org/r/20250620063445.3603086-9-suraj.kandpal@intel.com
This commit is contained in:
parent
2ff7f0c381
commit
f2db78e37f
1 changed files with 12 additions and 4 deletions
|
|
@ -3944,20 +3944,28 @@ int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_bac
|
||||||
u32 level)
|
u32 level)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
u8 buf[2] = { 0 };
|
unsigned int offset = DP_EDP_BACKLIGHT_BRIGHTNESS_MSB;
|
||||||
|
u8 buf[3] = { 0 };
|
||||||
|
|
||||||
/* The panel uses the PWM for controlling brightness levels */
|
/* The panel uses the PWM for controlling brightness levels */
|
||||||
if (!bl->aux_set)
|
if (!(bl->aux_set || bl->luminance_set))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (bl->lsb_reg_used) {
|
if (bl->luminance_set) {
|
||||||
|
level = level * 1000;
|
||||||
|
level &= 0xffffff;
|
||||||
|
buf[0] = (level & 0x0000ff);
|
||||||
|
buf[1] = (level & 0x00ff00) >> 8;
|
||||||
|
buf[2] = (level & 0xff0000) >> 16;
|
||||||
|
offset = DP_EDP_PANEL_TARGET_LUMINANCE_VALUE;
|
||||||
|
} else if (bl->lsb_reg_used) {
|
||||||
buf[0] = (level & 0xff00) >> 8;
|
buf[0] = (level & 0xff00) >> 8;
|
||||||
buf[1] = (level & 0x00ff);
|
buf[1] = (level & 0x00ff);
|
||||||
} else {
|
} else {
|
||||||
buf[0] = level;
|
buf[0] = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = drm_dp_dpcd_write_data(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, sizeof(buf));
|
ret = drm_dp_dpcd_write_data(aux, offset, buf, sizeof(buf));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
drm_err(aux->drm_dev,
|
drm_err(aux->drm_dev,
|
||||||
"%s: Failed to write aux backlight level: %d\n",
|
"%s: Failed to write aux backlight level: %d\n",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue