展锐光感自动调节亮度功能,光感数据上报对应的背光亮度设置,其实其他平台像 MTK ,高通也差不多,大同小异,主要是搜索关键字:config_autoBrightnessLevels、config_screenBrightnessBacklight,就会发现只是文件路径不太一样。
通过修改sensorhub下光感原始数据上报,或者根据实际情况去调节brightness level都能实现自动调节亮度功能的 灵敏度 ,看个人喜欢。
展锐的代码路径如下:
device\sprd\roc1\common\overlay\frameworks\base\core\res\res\values\config.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
| <!-- Array of light sensor LUX values to define our levels for auto backlight brightness support.
The N entries of this array define N 1 zones as follows:
Zone 0: 0 <= LUX < array[0]
Zone 1: array[0] <= LUX < array[1]
...
Zone N: array[N - 1] <= LUX < array[N]
Zone N + 1 array[N] <= LUX < infinity
Must be overridden in platform specific overlays -->
<integer-array name="config_autoBrightnessLevels">
<item>16</item>
<item>32</item>
<item>50</item>
<item>100</item>
<item>140</item>
<item>180</item>
<item>240</item>
<item>300</item>
<item>600</item>
<item>800</item>
<item>1000</item>
<item>2000</item>
<item>3000</item>
<item>4000</item>
<item>5000</item>
<item>6000</item>
<item>8000</item>
<item>10000</item>
<item>20000</item>
<item>30000</item>
</integer-array>
<!-- Array of desired screen brightness in nits corresponding to the lux values
in the config_autoBrightnessLevels array. As with config_screenBrightnessMinimumNits and
config_screenBrightnessMaximumNits, the display brightness is defined as the measured
brightness of an all-white image.
If this is defined then:
- config_autoBrightnessLcdBacklightValues should not be defined
- config_screenBrightnessNits must be defined
- config_screenBrightnessBacklight must be defined
This array should have size one greater than the size of the config_autoBrightnessLevels
array. The brightness values must be non-negative and non-decreasing. This must be
overridden in platform specific overlays -->
<array name="config_autoBrightnessDisplayValuesNits">
<item>10.45935</item> <!-- 0-16 -->
<item>29.25559</item> <!-- 16-32 -->
<item>34.240692</item> <!-- 32-50 -->
<item>37.514347</item> <!-- 50-100 -->
<item>40.018696</item> <!-- 100-140 -->
<item>46.885098</item> <!-- 140-180 -->
<item>51.626434</item> <!-- 180-240 -->
<item>58.610405</item> <!-- 240-300 -->
<item>66.890915</item> <!-- 300-600 -->
<item>77.61644</item> <!-- 600-800 -->
<item>90.221886</item> <!-- 800-1000 -->
<item>105.80314</item> <!-- 1000-2000 -->
<item>126.073845</item> <!-- 2000-3000 -->
<item>154.16931</item> <!-- 3000-4000 -->
<item>191.83717</item> <!-- 4000-5000 -->
<item>240.74442</item> <!-- 5000-6000 -->
<item>294.84857</item> <!-- 6000-8000 -->
<item>348.05453</item> <!-- 8000-10000 -->
<item>394.98703</item> <!-- 10000-20000 -->
<item>405.2315</item> <!-- 20000-30000 -->
<item>410.3658</item> <!-- 30000+ -->
</array>
<!-- An array describing the screen's backlight values corresponding to the brightness
values in the config_screenBrightnessNits array.
This array should be equal in size to config_screenBrightnessBacklight. -->
<integer-array name="config_screenBrightnessBacklight">
<item>0</item>
<item>5</item>
<item>10</item>
<item>15</item>
<item>20</item>
<item>25</item>
<item>30</item>
<item>35</item>
<item>40</item>
<item>45</item>
<item>60</item>
<item>75</item>
<item>90</item>
<item>105</item>
<item>120</item>
<item>135</item>
<item>150</item>
<item>165</item>
<item>180</item>
<item>195</item>
<item>210</item>
<item>225</item>
<item>240</item>
<item>255</item>
</integer-array>
|
查看光感数据上报原始值节点:
1
| cat /sys/devices/virtual/sprd_sensorhub/sensor_hub/raw_data_als
|
可以跟一下代码就会发现在 kernel 下:
kernel4.14\drivers\iio\sprd_hub\shub_core.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| static ssize_t raw_data_als_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct shub_data *sensor = dev_get_drvdata(dev);
u8 data[2];
u16 *ptr;
int err;
ptr = (u16 *)data;
if (sensor->mcu_mode <= SHUB_OPDOWNLOAD) {
dev_err(dev, "mcu_mode == SHUB_BOOT!\n");
return -EINVAL;
}
err = shub_sipc_read(sensor,
SHUB_GET_LIGHT_RAWDATA_SUBTYPE, data, sizeof(data));
if (err < 0) {
dev_err(dev, "read RegMapR_GetLightRawData failed!\n");
return err;
}
return sprintf(buf, "%d\n", ptr[0]);
}
static DEVICE_ATTR_RO(raw_data_als);
|
打赏作者
¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付: ¥1
获取中
扫码支付
您的余额不足,请更换扫码支付或 充值
打赏作者
实付 元
使用余额支付
点击重新获取
扫码支付
钱包余额 0
抵扣说明:
1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。
余额充值
举报
点击体验
DeepSeekR1满血版 
程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!
返回顶部