当前位置:   article > 正文

android自动亮度失效问题调查_android11自动调节亮度开关没作用

android11自动调节亮度开关没作用

一. 问题描述

1.1 现象

      手机自动亮度失效,调节亮度条屏幕闪烁

1.2 JIRA

 

1.3 结论

    1.android.hardware.light@2.0-service转换亮度值出问题,导致调节屏幕亮度异常

    2.kernel设置的最大亮度值有问题,导致无法调大最大亮度

 

二. 问题分析

2.1 基础学习

在分析之前我们得大概知道自动亮度的流程整个流程,设置亮度主要通过slpi, android.hardware.sensors@1.0-service,system_server,android.hardware.light@2.0-service,kernel来五部分来共同完成。

1.slpi部分,这部分主要是光感循环读取数据,然后通过pb_send_sensor_stream_event/pb_send_event将数据发生给子系统,子系统最后会通过qmi接口将数据传给android.hardware.sensors@1.0-service

2.android.hardware.sensors@1.0-service拿到数据后会继续传递给system_server. 这部分的具体传递过程这里就不说了,可以看一下我以前画的流程图:https://blog.csdn.net/aa787282301/article/details/84665319

3.System_server是拿到sensor 传递过来的lux数据后会进行一系列的计算,然后得出当前的亮度值,传递给android.hardware.light@2.0-service进程。

4.android.hardware.light@2.0-service进程会把亮度值写到kernel的brightnes设备节点。

5.kernel拿到亮度值后,就去改变屏幕的亮度。

 

 

2.2 详细分析

2.2.1 闪烁问题分析

有了2.1的知识基础后我们也分进程来排查问题就好了:

1.slpi的排查可以直接在上传数据的时候打印出对应的lux值,然后看看是否符合预期,例如:

  1. TCS3701_SPRINTF(LOW, sns_fw_printf, "TCS3701 pb_send_sensor_stream_event: lux: %f\n", report_data[0]);
  2. pb_send_sensor_stream_event(instance,
  3. &state->als_info.als_suid,
  4. sns_get_system_time(),
  5. SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_EVENT,
  6. SNS_STD_SENSOR_SAMPLE_STATUS_ACCURACY_HIGH,
  7. report_data,
  8. ALS_EVENT_SIZE,
  9. state->encoded_als_event_len);

然后我们直接用qxdm来看lux值是不是符合预期的,如果lux值是正确的,那我们就继续看其他进程。本节说的问题并不是tcs3701数据采集有问题,这里就不详细分析了。

2.android.hardware.sensors@1.0-service进程拿到slpi的数据后不会进过特别多的处理,会继续传递给system_server,一般情况下不会有问题。

3.system_server拿到值lux值后会做比较多的处理,过程比较复杂,我们直接看到最后,就是它要设置的亮度值:

  1. private void setDisplayBrightness(int brightness) {
  2. if (DEBUG) {
  3. Slog.d(TAG, "setDisplayBrightness("
  4. + "id=" + displayId + ", brightness=" + brightness + ")");
  5. }
  6. Trace.traceBegin(Trace.TRACE_TAG_POWER, "setDisplayBrightness("
  7. + "id=" + displayId + ", brightness=" + brightness + ")");
  8. try {
  9. mBacklight.setBrightness(brightness);
  10. Trace.traceCounter(Trace.TRACE_TAG_POWER,
  11. "ScreenBrightness", brightness);
  12. } finally {
  13. Trace.traceEnd(Trace.TRACE_TAG_POWER);
  14. }
  15. }

这里是通过mBacklight.setBrightness(brightness)来进行设置亮度,我们将DEBUG改为true,然后用手电筒照射手机,看看这里的日志是否正常:

  1. 01-01 00:06:47.649 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=95)
  2. 01-01 00:06:47.679 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=81)
  3. 01-01 00:06:47.699 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=61)
  4. 01-01 00:06:47.726 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=52)
  5. 01-01 00:06:47.743 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=43)
  6. 01-01 00:06:47.770 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=36)
  7. 01-01 00:06:47.816 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=30)
  8. 01-01 00:06:47.836 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=28)
  9. 01-01 00:06:47.863 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=27)
  10. 01-01 00:06:47.876 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=26)
  11. 01-01 00:06:47.942 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=27)
  12. 01-01 00:06:47.963 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=30)
  13. 01-01 00:06:47.984 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=41)
  14. 01-01 00:06:48.005 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=64)
  15. 01-01 00:06:48.027 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=100)
  16. 01-01 00:06:48.058 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=177)
  17. 01-01 00:06:48.082 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=203)
  18. 01-01 00:06:48.099 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=233)
  19. 01-01 00:06:48.122 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=287)
  20. 01-01 00:06:48.146 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=347)
  21. 01-01 00:06:48.161 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=413)
  22. 01-01 00:06:48.182 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=513)
  23. 01-01 00:06:48.202 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=632)
  24. 01-01 00:06:48.223 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=792)
  25. 01-01 00:06:48.248 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=886)
  26. 01-01 00:06:48.281 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=1237)
  27. 01-01 00:06:48.311 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=1611)
  28. 01-01 00:06:48.348 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=1956)
  29. 01-01 00:06:48.378 1517 2429 D LocalDisplayAdapter: setDisplayBrightness(id=0, brightness=2047)

从日志中我们能看到,亮度值随着亮度增加而增大,所以system_server的代码走到mBacklight.setBrightness(brightness)时还是正常的,我们继续往后排查。

 

4.system_server将要设置的亮度值继续传递给android.hardware.light@2.0-service进程,android.hardware.light@2.0-service进程最后会打开对应的设备节点,然后把亮度值写进去,具体代码如下:

  1. char const*const LCD_FILE
  2. = "/sys/class/leds/lcd-backlight/brightness";
  3. char const*const LCD_FILE2
  4. = "/sys/class/backlight/panel0-backlight/brightness";
  5. char const*const BUTTON_FILE
  6. = "/sys/class/leds/button-backlight/brightness";
  7. char const*const PERSISTENCE_FILE
  8. = "/sys/class/graphics/fb0/msm_fb_persist_mode";
  9. ......
  10. static int
  11. set_light_backlight(struct light_device_t* dev,
  12. struct light_state_t const* state)
  13. {
  14. int err = 0;
  15. #ifdef USE_AOSP_BACKLIGHT_SOLUTION
  16. int brightness = 0;
  17. if(rgb_to_brightness(state) == 0) {
  18. brightness = 0;
  19. } else {
  20. ALOGE("set_light_backlight state->color is %d\n", state->color);
  21. brightness = (rgb_to_brightness(state)+1)* backlight_conversion;
  22. ALOGE("%s: brightness is %d\n", __FUNCTION__, brightness);
  23. }
  24. #else
  25. int brightness = state->color & 0xfff;
  26. #endif
  27. unsigned int lpEnabled =
  28. state->brightnessMode == BRIGHTNESS_MODE_LOW_PERSISTENCE;
  29. if(!dev) {
  30. return -1;
  31. }
  32. pthread_mutex_lock(&g_lock);
  33. // Toggle low persistence mode state
  34. bool persistence_mode = ((g_last_backlight_mode != state->brightnessMode && lpEnabled) ||
  35. (!lpEnabled &&
  36. g_last_backlight_mode == BRIGHTNESS_MODE_LOW_PERSISTENCE));
  37. bool cannot_handle_persistence = !g_has_persistence_node && persistence_mode;
  38. if (g_has_persistence_node) {
  39. if (persistence_mode) {
  40. if ((err = write_int(PERSISTENCE_FILE, lpEnabled)) != 0) {
  41. ALOGE("%s: Failed to write to %s: %s\n", __FUNCTION__,
  42. PERSISTENCE_FILE, strerror(errno));
  43. }
  44. if (lpEnabled != 0) {
  45. brightness = DEFAULT_LOW_PERSISTENCE_MODE_BRIGHTNESS;
  46. }
  47. }
  48. g_last_backlight_mode = state->brightnessMode;
  49. }
  50. if (!err) {
  51. if (!access(LCD_FILE, F_OK)) {
  52. err = write_int(LCD_FILE, brightness);
  53. } else {
  54. ALOGE("%s: pzc write to %s: %d\n", __FUNCTION__,
  55. LCD_FILE2, brightness);
  56. err = write_int(LCD_FILE2, brightness);
  57. }
  58. }
  59. pthread_mutex_unlock(&g_lock);
  60. return cannot_handle_persistence ? -ENOSYS : err;
  61. }

上层更新亮度值就是往/sys/class/backlight/panel0-backlight/brightness设备节点写值,调用的write_int方法,我在代码里加了一些日志,编译出so后push进手机:

  1. pzc@pzc-OptiPlex-7050:~/code/hardware/qcom/display/liblight$ mm
  2. pzc@pzc-OptiPlex-7050:cd ~/code/out/target/product/xxx/vendor/lib64/hw
  3. pzc@pzc-OptiPlex-7050:~/code/out/target/product/xxx/vendor/lib64/hw$ adb root
  4. restarting adbd as root
  5. pzc@pzc-OptiPlex-7050:~/code/out/target/product/xxx/vendor/lib64/hw$
  6. pzc@pzc-OptiPlex-7050:~/code/out/target/product/xxx/vendor/lib64/hw$ adb remount
  7. remount succeeded
  8. pzc@pzc-OptiPlex-7050:~/code/out/target/product/xxx/vendor/lib64/hw$ adb push lights.sm6150.so /vendor/lib64/hw/
  9. lights.sm6150.so: 1 file pushed. 2.0 MB/s (68784 bytes in 0.032s)
  10. pzc@pzc-OptiPlex-7050:~/code/out/target/product/xxx/vendor/lib64/hw$ adb reboot

然后我们查看相应的日志:

  1. 130|xxx:/ $ ps -ef | grep light
  2. system 675 1 1 23:59:52 ? 00:00:01 android.hardware.light@2.0-service
  3. shell 5204 3668 5 00:02:15 pts/0 00:00:00 grep light
  4. xxx:/ $ logcat | grep 675
  5. 01-01 00:01:32.647 675 675 E qdlights: set_light_backlight state->color is 1360
  6. 01-01 00:01:32.647 675 675 E qdlights: set_light_backlight: brightness is 96
  7. 01-01 00:01:32.647 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 96
  8. 01-01 00:01:32.664 675 675 E qdlights: set_light_backlight state->color is 1420
  9. 01-01 00:01:32.664 675 675 E qdlights: set_light_backlight: brightness is 152
  10. 01-01 00:01:32.664 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 152
  11. 01-01 00:01:32.681 675 675 E qdlights: set_light_backlight state->color is 1487
  12. 01-01 00:01:32.681 675 675 E qdlights: set_light_backlight: brightness is 216
  13. 01-01 00:01:32.681 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 216
  14. 01-01 00:01:32.698 675 675 E qdlights: set_light_backlight state->color is 1558
  15. 01-01 00:01:32.698 675 675 E qdlights: set_light_backlight: brightness is 56
  16. 01-01 00:01:32.698 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 56
  17. 01-01 00:01:32.714 675 675 E qdlights: set_light_backlight state->color is 1621
  18. 01-01 00:01:32.714 675 675 E qdlights: set_light_backlight: brightness is 112
  19. 01-01 00:01:32.714 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 112
  20. 01-01 00:01:32.730 675 675 E qdlights: set_light_backlight state->color is 1687
  21. 01-01 00:01:32.730 675 675 E qdlights: set_light_backlight: brightness is 168
  22. 01-01 00:01:32.730 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 168
  23. 01-01 00:01:32.747 675 675 E qdlights: set_light_backlight state->color is 1745
  24. 01-01 00:01:32.747 675 675 E qdlights: set_light_backlight: brightness is 224
  25. 01-01 00:01:32.747 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 224
  26. 01-01 00:01:32.763 675 675 E qdlights: set_light_backlight state->color is 1795
  27. 01-01 00:01:32.763 675 675 E qdlights: set_light_backlight: brightness is 40
  28. 01-01 00:01:32.764 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 40
  29. 01-01 00:01:32.780 675 675 E qdlights: set_light_backlight state->color is 1851
  30. 01-01 00:01:32.780 675 675 E qdlights: set_light_backlight: brightness is 88
  31. 01-01 00:01:32.780 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 88
  32. 01-01 00:01:32.797 675 675 E qdlights: set_light_backlight state->color is 1903
  33. 01-01 00:01:32.798 675 675 E qdlights: set_light_backlight: brightness is 136
  34. 01-01 00:01:32.798 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 136
  35. 01-01 00:01:32.813 675 675 E qdlights: set_light_backlight state->color is 1962
  36. 01-01 00:01:32.813 675 675 E qdlights: set_light_backlight: brightness is 192
  37. 01-01 00:01:32.813 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 192
  38. 01-01 00:01:32.831 675 675 E qdlights: set_light_backlight state->color is 2018
  39. 01-01 00:01:32.831 675 675 E qdlights: set_light_backlight: brightness is 240
  40. 01-01 00:01:32.831 675 675 E qdlights: set_light_backlight: pzc write to /sys/class/backlight/panel0-backlight/brightness: 240

从这日志我们能发现state->color的值是正确的,计算过后的brightness错误了,在亮度变大的过程中brightness由0增加,到达250多又从0开始。从日志中我们就得到了和测试反馈一样的闪屏现象。

  1. #ifdef USE_AOSP_BACKLIGHT_SOLUTION
  2. int brightness = 0;
  3. if(rgb_to_brightness(state) == 0) {
  4. brightness = 0;
  5. } else {
  6. ALOGE("set_light_backlight state->color is %d\n", state->color);
  7. brightness = (rgb_to_brightness(state)+1)* backlight_conversion;
  8. ALOGE("%s: brightness is %d\n", __FUNCTION__, brightness);
  9. }
  10. #else
  11. int brightness = state->color & 0xfff;
  12. #endif

继续看能发现有个宏定义,在定义了USE_AOSP_BACKLIGHT_SOLUTION的情况下数据会经过计算,反之就&2048(屏幕亮度的最大值)。

因为这是我们自己加的代码就不详细展开了,这个宏定义是为了区分原生版本和MIUI版本的,原生版本的最大亮度值是256,MIUI版本是2048,因为这个宏被定义了导致计算出错,最终导致屏幕闪烁,解决办法只需要在我们的版本中去掉这个宏定义,然后就能解决这个闪烁的问题了。

2.2.1 亮度调不动问题分析

再解决闪烁问题之后,接着又遇到一个新问题,我们调屏幕亮度的时候调到一半就调不动了。。。。然后继续看相关日志,这次发现亮度值确实已经正确的写进了/sys/class/backlight/panel0-backlight/brightness设备节点了,但是亮度只能调节一段范围,继续打印日志分析:

  1. int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl)
  2. {
  3. ......
  4. pr_debug("backlight type:%d lvl:%d\n", bl->type, bl_lvl);
  5. if (0 == bl_lvl)
  6. dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_DIMMINGOFF);
  7. ......
  8. panel->last_bl_lvl = bl_lvl;
  9. return rc;
  10. }

我们能在kernel设置亮度的流程发现有打印日志的地方,我们把日志打印出来看一下:

  1. xxx:/ # echo "func dsi_panel_set_backlight +tp" > /d/dynamic_debug/control
  2. xxx:/ # dmesg | grep dsi_panel_set_backlight
  3. [ 63.406678] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:208
  4. [ 63.506478] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:216
  5. [ 63.524899] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:224
  6. [ 63.539299] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:240
  7. [ 63.557805] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:264
  8. [ 63.573974] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:288
  9. [ 63.592018] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:313
  10. [ 63.608887] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:345
  11. ......
  12. [ 65.219863] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:2047
  13. [ 65.237156] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:2047
  14. [ 65.256433] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:2047
  15. [ 65.271771] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:2047
  16. [ 65.289537] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:2047
  17. [ 65.305404] [689] msm-dsi-panel:[dsi_panel_set_backlight:708] backlight type:2 lvl:2047

我们能发现当我们调节亮度条时,亮度调只调了一半(上层设置的值还没到2047),kernel中对应的亮度值已经到了2047了,所以我们得看看这之前亮度值发生了什么变化,直接找到写brightness节点的入口方法:

  1. static ssize_t brightness_store(struct device *dev,
  2. struct device_attribute *attr, const char *buf, size_t count)
  3. {
  4. int rc;
  5. struct backlight_device *bd = to_backlight_device(dev);
  6. unsigned long brightness;
  7. rc = kstrtoul(buf, 0, &brightness);
  8. if (rc)
  9. return rc;
  10. bd->usr_brightness_req = brightness;
  11. pr_err("pzc brightness_store1 buf:%s\n", buf);
  12. pr_err("pzc brightness_store1 brightness:%lu\n", brightness);
  13. pr_err("pzc brightness_store1 bd->thermal_brightness_limit:%lu\n", bd->thermal_brightness_limit);
  14. pr_err("pzc brightness_store1 bd->usr_brightness_req:%lu\n", bd->usr_brightness_req);
  15. brightness = (brightness <= bd->thermal_brightness_limit) ?
  16. bd->usr_brightness_req :
  17. bd->thermal_brightness_limit;
  18. pr_err("pzc brightness_store2 brightness:%lu\n", brightness);
  19. rc = backlight_device_set_brightness(bd, brightness);
  20. return rc ? rc : count;
  21. }

这里我们能看到brightness 会和bd->thermal_brightness_limit做对比,取小的值。看着就很符合我们的日志现象,直接加个日志看看吧:

  1. [ 2513.153084] backlight: pzc brightness_store1 buf:405\x0a
  2. [ 2513.153087] backlight: pzc brightness_store1 brightness:405
  3. [ 2513.153088] backlight: pzc brightness_store1 bd->thermal_brightness_limit:255
  4. [ 2513.153089] backlight: pzc brightness_store1 bd->usr_brightness_req:405
  5. [ 2513.153090] backlight: pzc brightness_store2 brightness:255
  6. [ 2513.153092] backlight: pzc backlight_device_set_brightness 255

日志中我们能看到bd->thermal_brightness_limit就是255,这里限制了设置亮度的最大值为255,那我们接着找看看这个bd->thermal_brightness_limit的值在哪里被设置的:

  1. static int bd_cdev_set_cur_brightness(struct thermal_cooling_device *cdev,
  2. unsigned long state)
  3. {
  4. struct backlight_device *bd = (struct backlight_device *)cdev->devdata;
  5. int brightness_lvl;
  6. dump_stack();
  7. pr_err("pzc1 bd_cdev_set_cur_brightness bd->props.max_brightness:%lu\n", bd->props.max_brightness);
  8. pr_err("pzc1 bd_cdev_set_cur_brightness state:%lu\n", state);
  9. brightness_lvl = bd->props.max_brightness - state;
  10. if (brightness_lvl == bd->thermal_brightness_limit)
  11. return 0;
  12. pr_err("pzc1 brightness_store1 brightness_lvl:%lu\n", brightness_lvl);
  13. bd->thermal_brightness_limit = brightness_lvl;
  14. brightness_lvl = (bd->usr_brightness_req
  15. <= bd->thermal_brightness_limit) ?
  16. bd->usr_brightness_req :
  17. bd->thermal_brightness_limit;
  18. backlight_device_set_brightness(bd, brightness_lvl);
  19. return 0;
  20. }

这里的bd->thermal_brightness_limit = bd->props.max_brightness - state,打印日志后可以看到bd->props.max_brightness =255,state=0,我们接着看看bd->props.max_brightness在哪里被设置的:

  1. static int sde_backlight_setup(struct sde_connector *c_conn,
  2. struct drm_device *dev)
  3. {
  4. ......
  5. bl_config = &display->panel->bl_config;
  6. props.max_brightness = bl_config->brightness_max_level;
  7. props.brightness = bl_config->brightness_max_level;
  8. ......
  9. return 0;
  10. }

props.max_brightness又等于bl_config->brightness_max_level,继续看看brightness_max_level在哪里被设置的:

  1. static int dsi_panel_parse_bl_config(struct dsi_panel *panel)
  2. {
  3. ......
  4. rc = utils->read_u32(utils->data, "qcom,mdss-brightness-max-level",
  5. if (rc) {
  6. pr_debug("[%s] brigheness-max-level unspecified, defaulting to 255\n",
  7. panel->name);
  8. panel->bl_config.brightness_max_level = 255;
  9. } else {
  10. panel->bl_config.brightness_max_level = val;
  11. }
  12. ......
  13. error:
  14. return rc;
  15. }

到了这里我们最终找到了设置最大亮度的地方,是在dtbo文件中进行了配置:

qcom,mdss-brightness-max-level = <255>;

我们将这里修改为2047:

qcom,mdss-brightness-max-level = <2047>;

打包后再进行测试,自动亮度和亮度调节都恢复正常了。

三. 总结

这里一共出现了两个问题,一个是上层亮度转换出错导致了亮度值设置异常,另一个是kernel默认的最大亮度值设置错误,导致屏幕无法调节到真正的最大亮度值。在分析问题的时候可以把问题分不同的层级逐一排查缩小范围,然后再针对某个点单独进行的深入分析,能够提高不少效率。

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/643011
推荐阅读
相关标签
  

闽ICP备14008679号