From 0a1b855c61b0c3d937aa7f37a9a1aea787859488 Mon Sep 17 00:00:00 2001 From: dodyirawan85 Date: Sun, 21 Sep 2025 18:56:53 +0700 Subject: [PATCH] Revert "disp: msm: limit display brightness max cooling device level" This reverts commit 7d3114211e30a8b819c1ce099f4b17ea33f20d61. Reason for revert: Causing display to turn off automatically on moderate and high temperature Change-Id: I501ae17414f6b4e0c34b7dec2921a90603cbb44a Signed-off-by: dodyirawan85 --- techpack/display/msm/msm_cooling_device.c | 21 +++++---------------- techpack/display/msm/msm_cooling_device.h | 3 +-- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/techpack/display/msm/msm_cooling_device.c b/techpack/display/msm/msm_cooling_device.c index c2cc26e75311..73ce8f200737 100644 --- a/techpack/display/msm/msm_cooling_device.c +++ b/techpack/display/msm/msm_cooling_device.c @@ -1,19 +1,17 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2020, The Linux Foundation. All rights reserved. */ #include #include #include "msm_cooling_device.h" -#define BRIGHTNESS_CDEV_MAX 255 - static int sde_cdev_get_max_brightness(struct thermal_cooling_device *cdev, unsigned long *state) { struct sde_cdev *disp_cdev = (struct sde_cdev *)cdev->devdata; - *state = disp_cdev->bd->props.max_brightness / disp_cdev->cdev_sf; + *state = disp_cdev->bd->props.max_brightness; return 0; } @@ -23,8 +21,7 @@ static int sde_cdev_get_cur_brightness(struct thermal_cooling_device *cdev, { struct sde_cdev *disp_cdev = (struct sde_cdev *)cdev->devdata; - *state = ((disp_cdev->bd->props.max_brightness - - disp_cdev->thermal_state) / disp_cdev->cdev_sf); + *state = disp_cdev->bd->props.max_brightness - disp_cdev->thermal_state; return 0; } @@ -35,11 +32,10 @@ static int sde_cdev_set_cur_brightness(struct thermal_cooling_device *cdev, struct sde_cdev *disp_cdev = (struct sde_cdev *)cdev->devdata; unsigned long brightness_lvl = 0; - if (state > disp_cdev->bd->props.max_brightness / disp_cdev->cdev_sf) + if (state > disp_cdev->bd->props.max_brightness) return -EINVAL; - brightness_lvl = disp_cdev->bd->props.max_brightness - - (state * disp_cdev->cdev_sf); + brightness_lvl = disp_cdev->bd->props.max_brightness - state; if (brightness_lvl == disp_cdev->thermal_state) return 0; disp_cdev->thermal_state = brightness_lvl; @@ -71,13 +67,6 @@ struct sde_cdev *backlight_cdev_register(struct device *dev, return ERR_PTR(-ENOMEM); disp_cdev->thermal_state = 0; disp_cdev->bd = bd; - - if (bd->props.max_brightness > BRIGHTNESS_CDEV_MAX) - disp_cdev->cdev_sf = (bd->props.max_brightness / - BRIGHTNESS_CDEV_MAX); - else - disp_cdev->cdev_sf = 1; - disp_cdev->cdev = thermal_of_cooling_device_register(dev->of_node, (char *)dev_name(&bd->dev), disp_cdev, &sde_cdev_ops); diff --git a/techpack/display/msm/msm_cooling_device.h b/techpack/display/msm/msm_cooling_device.h index 5533aabac892..b95bf45c3449 100644 --- a/techpack/display/msm/msm_cooling_device.h +++ b/techpack/display/msm/msm_cooling_device.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2020, The Linux Foundation. All rights reserved. */ #ifndef __SDE_THERMAL_CORE_H__ @@ -16,7 +16,6 @@ struct sde_cdev { struct thermal_cooling_device *cdev; struct backlight_device *bd; unsigned long thermal_state; - unsigned int cdev_sf; }; #ifdef CONFIG_THERMAL_OF