Skip to content

Commit

Permalink
Merge pull request #2 from Motorola-SM6375-Devs/fourteen
Browse files Browse the repository at this point in the history
Revert "disp: msm: limit display brightness max cooling device level"
  • Loading branch information
ghazzor authored Sep 12, 2024
2 parents a9110dd + 98dcf3c commit 3e7f9c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
21 changes: 5 additions & 16 deletions techpack/display/msm/msm_cooling_device.c
Original file line number Diff line number Diff line change
@@ -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 <linux/err.h>
#include <linux/slab.h>
#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;
}
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions techpack/display/msm/msm_cooling_device.h
Original file line number Diff line number Diff line change
@@ -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__
Expand All @@ -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
Expand Down

0 comments on commit 3e7f9c3

Please sign in to comment.