-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmi_disp.h
880 lines (813 loc) · 21 KB
/
mi_disp.h
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*/
#ifndef _MI_DISP_H_
#define _MI_DISP_H_
#include <linux/types.h>
#include <asm/ioctl.h>
#ifndef BIT
#define BIT(x) (1UL << (x))
#endif
#if defined(__cplusplus)
extern "C" {
#endif
enum disp_display_type {
MI_DISP_PRIMARY = 0,
MI_DISP_SECONDARY = 1,
MI_DISP_MAX,
};
enum common_feature_state {
FEATURE_OFF = 0,
FEATURE_ON = 1,
};
/* supported feature ids */
enum disp_feature_id {
DISP_FEATURE_DIMMING = 0,
DISP_FEATURE_HBM = 1,
DISP_FEATURE_HBM_FOD = 2,
DISP_FEATURE_DOZE_BRIGHTNESS = 3,
DISP_FEATURE_FOD_CALIBRATION_BRIGHTNESS = 4,
DISP_FEATURE_FOD_CALIBRATION_HBM = 5,
DISP_FEATURE_FLAT_MODE = 6,
DISP_FEATURE_CRC = 7,
DISP_FEATURE_DC = 8,
DISP_FEATURE_LOCAL_HBM = 9,
DISP_FEATURE_SENSOR_LUX = 10,
DISP_FEATURE_LOW_BRIGHTNESS_FOD = 11,
DISP_FEATURE_FP_STATUS = 12,
DISP_FEATURE_FOLD_STATUS = 13,
DISP_FEATURE_NATURE_FLAT_MODE = 14,
DISP_FEATURE_SPR_RENDER = 15,
DISP_FEATURE_AOD_TO_NORMAL = 16,
DISP_FEATURE_COLOR_INVERT = 17,
DISP_FEATURE_DC_BACKLIGHT = 18,
DISP_FEATURE_GIR = 19,
DISP_FEATURE_DBI = 20,
DISP_FEATURE_DDIC_ROUND_CORNER = 21,
DISP_FEATURE_HBM_BACKLIGHT = 22,
DISP_FEATURE_BACKLIGHT = 23,
DISP_FEATURE_BRIGHTNESS = 24,
DISP_FEATURE_LCD_HBM = 25,
DISP_FEATURE_DOZE_STATE =26,
DISP_FEATURE_PEAK_HDR_MODE = 27,
DISP_FEATURE_CABC = 28,
DISP_FEATURE_BIST_MODE = 29,
DISP_FEATURE_BIST_MODE_COLOR = 30,
DISP_FEATURE_ROUND_MODE = 31,
DISP_FEATURE_GAMUT = 32,
DISP_FEATURE_POWERSTATUS = 33,
DISP_FEATURE_SYSTEM_BUILD_VERSION = 34,
DISP_FEATURE_FRAME_DROP_COUNT = 35,
DISP_FEATURE_MAX,
};
/* feature_id: DISP_FEATURE_LOCAL_HBM corresponding feature_val */
enum local_hbm_state {
LOCAL_HBM_OFF_TO_NORMAL = 0,
LOCAL_HBM_NORMAL_WHITE_1000NIT = 1,
LOCAL_HBM_NORMAL_WHITE_750NIT = 2,
LOCAL_HBM_NORMAL_WHITE_500NIT = 3,
LOCAL_HBM_NORMAL_WHITE_110NIT = 4,
LOCAL_HBM_NORMAL_GREEN_500NIT = 5,
LOCAL_HBM_HLPM_WHITE_1000NIT = 6,
LOCAL_HBM_HLPM_WHITE_110NIT = 7,
LOCAL_HBM_OFF_TO_HLPM = 8,
LOCAL_HBM_OFF_TO_LLPM = 9,
LOCAL_HBM_OFF_TO_NORMAL_BACKLIGHT = 10,
LOCAL_HBM_OFF_TO_NORMAL_BACKLIGHT_RESTORE = 11,
LOCAL_HBM_MAX,
};
enum fod_ui_ready_state {
LOCAL_HBM_UI_NONE = 0,
GLOBAL_FOD_HBM_OVERLAY = BIT(0),
GLOBAL_FOD_ICON = BIT(1),
FOD_LOW_BRIGHTNESS_CAPTURE = BIT(2),
LOCAL_HBM_UI_READY = BIT(3)
};
/* feature_id: DISP_FEATURE_FP_STATUS corresponding feature_val */
enum fingerprint_status {
FINGERPRINT_NONE = 0,
ENROLL_START = 1,
ENROLL_STOP = 2,
AUTH_START = 3,
AUTH_STOP = 4,
HEART_RATE_START = 5,
HEART_RATE_STOP = 6,
};
/* feature_id: DISP_FEATURE_SPR_RENDER corresponding feature_val */
enum spr_render_status {
SPR_1D_RENDERING = 1,
SPR_2D_RENDERING = 2,
};
/* feature_id: DISP_FEATURE_LCD_HBM corresponding feature_val */
enum lcd_hbm_level {
LCD_HBM_OFF = 0,
LCD_HBM_L1_ON = 1,
LCD_HBM_L2_ON = 2,
LCD_HBM_L3_ON = 3,
LCD_HBM_MAX,
};
/* feature_id: DISP_FEATURE_CRC corresponding feature_val */
enum crc_mode {
CRC_OFF = 0,
CRC_SRGB = 1,
CRC_P3 = 2,
CRC_P3_D65 = 3,
CRC_P3_FLAT = 4,
CRC_SRGB_D65 = 5,
CRC_MODE_MAX,
};
/* feature_id: DISP_FEATURE_GIR corresponding feature_val */
enum gir_mode {
GIR_OFF = 0,
GIR_ON = 1,
GIR_MODE_MAX,
};
/* feature_id: DISP_FEATURE_CABC corresponding feature_val */
enum cabc_status {
LCD_CABC_OFF = 0,
LCD_CABC_UI_ON = 1,
LCD_CABC_MOVIE_ON = 2,
LCD_CABC_STILL_ON = 3,
};
struct disp_base {
__u32 flag;
__u32 disp_id;
};
/* IOCTL: MI_DISP_IOCTL_VERSION parameter */
struct disp_version {
struct disp_base base;
__u32 version;
};
/* IOCTL: MI_DISP_IOCTL_SET_FEATURE parameter */
struct disp_feature_req {
struct disp_base base;
__u32 feature_id;
__s32 feature_val;
__u32 tx_len;
__u64 tx_ptr;
__u32 rx_len;
__u64 rx_ptr;
};
/**
* enum doze_brightness_state - set doze brightness state
* @DOZE_TO_NORMAL : doze mode to normal mode
* @DOZE_BRIGHTNESS_HBM: doze mode high brightness (60 nit)
* @DOZE_BRIGHTNESS_LBM: doze mode low brightness (5 nit)
* @DOZE_BRIGHTNESS_MAX
*/
enum doze_brightness_state {
DOZE_TO_NORMAL = 0,
DOZE_BRIGHTNESS_HBM = 1,
DOZE_BRIGHTNESS_LBM = 2,
DOZE_BRIGHTNESS_MAX,
};
/* IOCTL:
* MI_DISP_IOCTL_SET_DOZE_BRIGHTNESS parameter
* MI_DISP_IOCTL_GET_DOZE_BRIGHTNESS parameter
*/
struct disp_doze_brightness_req {
struct disp_base base;
__u32 doze_brightness;
};
/* local_hbm_value value */
enum lhbm_target_brightness_state {
LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP = 0,
LHBM_TARGET_BRIGHTNESS_OFF_AUTH_STOP = 1,
LHBM_TARGET_BRIGHTNESS_WHITE_1000NIT = 2,
LHBM_TARGET_BRIGHTNESS_WHITE_110NIT = 3,
LHBM_TARGET_BRIGHTNESS_GREEN_500NIT = 4,
LHBM_TARGET_BRIGHTNESS_MAX
};
/* IOCTL: MI_DISP_IOCTL_SET_LOCAL_HBM parameter */
struct disp_local_hbm_req {
struct disp_base base;
__u32 local_hbm_value;
};
/* IOCTL:
* MI_DISP_IOCTL_GET_BRIGHTNESS parameter
* MI_DISP_IOCTL_SET_BRIGHTNESS parameter
*/
struct disp_brightness_req {
struct disp_base base;
__u32 brightness;
__u32 brightness_clone;
};
/* IOCTL: MI_DISP_IOCTL_GET_PANEL_INFO parameter */
struct disp_panel_info {
struct disp_base base;
__u32 info_len;
char *info;
};
/* IOCTL: MI_DISP_IOCTL_GET_WP_INFO parameter */
struct disp_wp_info {
struct disp_base base;
__u32 info_len;
char *info;
};
/* IOCTL: MI_DISP_IOCTL_GET_MANUFACTURER_INFO parameter */
struct disp_manufacturer_info_req {
struct disp_base base;
char *wp_info;
char *maxbrightness;
char *manufacturer_time;
__u32 wp_info_len;
__u32 max_brightness_len;
__u32 manufacturer_time_len;
};
/* IOCTL: MI_DISP_IOCTL_GET_FPS parameter */
struct disp_fps_info {
struct disp_base base;
__u32 fps;
};
enum disp_event_type {
MI_DISP_EVENT_POWER = 0,
MI_DISP_EVENT_BACKLIGHT = 1,
MI_DISP_EVENT_FOD = 2,
MI_DISP_EVENT_DOZE = 3,
MI_DISP_EVENT_FPS = 4,
MI_DISP_EVENT_BRIGHTNESS_CLONE = 5,
MI_DISP_EVENT_51_BRIGHTNESS = 6,
MI_DISP_EVENT_HBM = 7,
MI_DISP_EVENT_DC = 8,
MI_DISP_EVENT_PANEL_DEAD = 9,
MI_DISP_EVENT_PANEL_EVENT = 10,
MI_DISP_EVENT_DDIC_RESOLUTION = 11,
MI_DISP_EVENT_FLAT_MODE = 12,
MI_DISP_EVENT_MAX,
};
/* IOCTL:
* MI_DISP_IOCTL_REGISTER_EVENT parameter
* MI_DISP_IOCTL_DEREGISTER_EVENT parameter
*/
struct disp_event_req {
struct disp_base base;
__u32 type;
};
struct disp_event {
__s32 disp_id;
__u32 type;
__u32 length;
};
struct disp_event_resp {
struct disp_event base;
__u8 data[];
};
/* Define supported power modes */
enum panel_power_state {
MI_DISP_POWER_ON = 0,
MI_DISP_POWER_LP1 = 1,
MI_DISP_POWER_LP2 = 2,
MI_DISP_POWER_STANDBY = 3,
MI_DISP_POWER_SUSPEND = 4,
MI_DISP_POWER_OFF = 5,
};
/**
* enum disp_dsi_cmd_state - command set state
* @MI_DSI_CMD_LP_STATE: dsi low power mode
* @MI_DSI_CMD_HS_STATE: dsi high speed mode
* @MI_DSI_CMD_MAX_STATE
*/
enum disp_dsi_cmd_state {
MI_DSI_CMD_LP_STATE = 0,
MI_DSI_CMD_HS_STATE = 1,
MI_DSI_CMD_MAX_STATE,
};
/* IOCTL:
* MI_DISP_IOCTL_WRITE_DSI_CMD parameter
* MI_DISP_IOCTL_READ_DSI_CMD parameter
*/
struct disp_dsi_cmd_req {
struct disp_base base;
__u8 tx_state;
__u32 tx_len;
__u64 tx_ptr;
__u8 rx_state;
__u32 rx_len;
__u64 rx_ptr;
};
#if defined(__KERNEL__)
static inline int is_support_disp_id(__u32 disp_id)
{
if (disp_id < MI_DISP_MAX)
return 1;
else
return 0;
}
static inline const char *get_disp_id_name(__u32 disp_id)
{
switch (disp_id) {
case MI_DISP_PRIMARY:
return "primary";
case MI_DISP_SECONDARY:
return "secondary";
default:
return "Unknown";
}
}
static inline int is_support_doze_brightness(__u32 doze_brightness)
{
if (doze_brightness < DOZE_BRIGHTNESS_MAX)
return 1;
else
return 0;
}
static inline int is_aod_brightness(__u32 doze_brightness)
{
if (DOZE_BRIGHTNESS_HBM == doze_brightness ||
doze_brightness == DOZE_BRIGHTNESS_LBM)
return 1;
else
return 0;
}
static inline const char *get_doze_brightness_name(__u32 doze_brightness)
{
switch (doze_brightness) {
case DOZE_TO_NORMAL:
return "doze_to_normal";
case DOZE_BRIGHTNESS_HBM:
return "doze_brightness_high";
case DOZE_BRIGHTNESS_LBM:
return "doze_brightness_low";
default:
return "Unknown";
}
}
static inline int is_support_lcd_hbm_level(__u32 lcd_hbm_level)
{
if (lcd_hbm_level < LCD_HBM_MAX)
return 1;
else
return 0;
}
static inline int is_support_disp_event_type(__u32 event_type)
{
if (event_type < MI_DISP_EVENT_MAX)
return 1;
else
return 0;
}
static inline const char *get_disp_event_type_name(__u32 event_type)
{
switch (event_type) {
case MI_DISP_EVENT_POWER:
return "Power";
case MI_DISP_EVENT_BACKLIGHT:
return "Backlight";
case MI_DISP_EVENT_FOD:
return "Fod";
case MI_DISP_EVENT_DOZE:
return "Doze";
case MI_DISP_EVENT_FPS:
return "Fps";
case MI_DISP_EVENT_BRIGHTNESS_CLONE:
return "Brightness_clone";
case MI_DISP_EVENT_51_BRIGHTNESS:
return "51_brightness";
case MI_DISP_EVENT_HBM:
return "HBM";
case MI_DISP_EVENT_DC:
return "DC";
case MI_DISP_EVENT_PANEL_DEAD:
return "panel_dead";
case MI_DISP_EVENT_PANEL_EVENT:
return "panel_event";
case MI_DISP_EVENT_DDIC_RESOLUTION:
return "ddic_resolution";
case MI_DISP_EVENT_FLAT_MODE:
return "flat_mode";
default:
return "Unknown";
}
}
static inline int is_support_disp_feature_id(__u32 feature_id)
{
if (feature_id < DISP_FEATURE_MAX)
return 1;
else
return 0;
}
static inline const char *get_local_hbm_state_name(int state)
{
switch (state) {
case LOCAL_HBM_OFF_TO_NORMAL:
return "[lhbm off to nomal]";
case LOCAL_HBM_NORMAL_WHITE_1000NIT:
return "[lhbm normal white 1000nit]";
case LOCAL_HBM_NORMAL_WHITE_750NIT:
return "[lhbm normal white 750nit]";
case LOCAL_HBM_NORMAL_WHITE_500NIT:
return "[lhbm normal white 500nit]";
case LOCAL_HBM_NORMAL_WHITE_110NIT:
return "[lhbm normal white 110nit]";
case LOCAL_HBM_NORMAL_GREEN_500NIT:
return "[lhbm normal green 500nit]";
case LOCAL_HBM_HLPM_WHITE_1000NIT:
return "[lhbm H-doze to white 1000nit]";
case LOCAL_HBM_HLPM_WHITE_110NIT:
return "[lhbm H-doze to white 110nit]";
case LOCAL_HBM_OFF_TO_HLPM:
return "[lhbm off to H-doze]";
case LOCAL_HBM_OFF_TO_LLPM:
return "[lhbm off to L-doze]";
case LOCAL_HBM_OFF_TO_NORMAL_BACKLIGHT:
return "[lhbm off to nomal backlight]";
case LOCAL_HBM_OFF_TO_NORMAL_BACKLIGHT_RESTORE:
return "[lhbm off to nomal backlight restore]";
default:
return "Unknown";
}
}
static inline const char *get_fingerprint_status_name(int status)
{
switch (status) {
case FINGERPRINT_NONE:
return "none";
case ENROLL_START:
return "enroll_start";
case ENROLL_STOP:
return "enroll_stop";
case AUTH_START:
return "authenticate_start";
case AUTH_STOP:
return "authenticate_stop";
case HEART_RATE_START:
return "heart_rate_start";
case HEART_RATE_STOP:
return "heart_rate_stop";
default:
return "Unknown";
}
}
static inline const char *get_disp_feature_id_name(__u32 feature_id)
{
switch (feature_id) {
case DISP_FEATURE_DIMMING:
return "dimming";
case DISP_FEATURE_HBM:
return "hbm";
case DISP_FEATURE_HBM_FOD:
return "hbm_fod";
case DISP_FEATURE_DOZE_BRIGHTNESS:
return "doze_brightness";
case DISP_FEATURE_FOD_CALIBRATION_BRIGHTNESS:
return "fod_calibration_brightness";
case DISP_FEATURE_FOD_CALIBRATION_HBM:
return "fod_calibration_hbm";
case DISP_FEATURE_FLAT_MODE:
return "flat_mode";
case DISP_FEATURE_CRC:
return "crc";
case DISP_FEATURE_DC:
return "dc_mode";
case DISP_FEATURE_LOCAL_HBM:
return "local_hbm";
case DISP_FEATURE_SENSOR_LUX:
return "sensor_lux";
case DISP_FEATURE_LOW_BRIGHTNESS_FOD:
return "low_brightness_fod";
case DISP_FEATURE_FP_STATUS:
return "fp_status";
case DISP_FEATURE_FOLD_STATUS:
return "fold_status";
case DISP_FEATURE_NATURE_FLAT_MODE:
return "nature_flat_mode";
case DISP_FEATURE_SPR_RENDER:
return "spr_render";
case DISP_FEATURE_AOD_TO_NORMAL:
return "aod_to_normal";
case DISP_FEATURE_COLOR_INVERT:
return "color_invert";
case DISP_FEATURE_DC_BACKLIGHT:
return "dc_backlight";
case DISP_FEATURE_GIR:
return "gir";
case DISP_FEATURE_DBI:
return "dbi";
case DISP_FEATURE_DDIC_ROUND_CORNER:
return "ddic_round_corner";
case DISP_FEATURE_HBM_BACKLIGHT:
return "hbm_backlight_level";
case DISP_FEATURE_BACKLIGHT:
return "backlight";
case DISP_FEATURE_BRIGHTNESS:
return "brightness";
case DISP_FEATURE_LCD_HBM:
return "lcd_hbm";
case DISP_FEATURE_DOZE_STATE:
return "doze_state";
case DISP_FEATURE_PEAK_HDR_MODE:
return "peak_hdr_mode";
case DISP_FEATURE_CABC:
return "cabc";
case DISP_FEATURE_BIST_MODE:
return "bist_mode";
case DISP_FEATURE_BIST_MODE_COLOR:
return "bist_mode_color";
case DISP_FEATURE_ROUND_MODE:
return "round_mode";
case DISP_FEATURE_GAMUT:
return "gamut";
case DISP_FEATURE_POWERSTATUS:
return "power_status";
case DISP_FEATURE_SYSTEM_BUILD_VERSION:
return "system_build_version";
case DISP_FEATURE_FRAME_DROP_COUNT:
return "frame_drop_count";
default:
return "Unknown";
}
}
static inline const char *get_lhbm_value_name(__u32 lhbm_value)
{
switch (lhbm_value) {
case LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP:
return "LHBM_OFF_FINGER_UP";
case LHBM_TARGET_BRIGHTNESS_OFF_AUTH_STOP:
return "LHBM_OFF_AUTH_STOP";
case LHBM_TARGET_BRIGHTNESS_WHITE_1000NIT:
return "LHBM_ON_WHITE_1000NIT";
case LHBM_TARGET_BRIGHTNESS_WHITE_110NIT:
return "LHBM_ON_WHITE_110NIT";
case LHBM_TARGET_BRIGHTNESS_GREEN_500NIT:
return "LHBM_ON_GREEN_500NIT";
default:
return "Unknown";
}
}
#else
static inline int isSupportDispId(__u32 disp_id)
{
if (disp_id < MI_DISP_MAX)
return 1;
else
return 0;
}
static inline const char *getDispIdName(__u32 disp_id)
{
switch (disp_id) {
case MI_DISP_PRIMARY:
return "primary";
case MI_DISP_SECONDARY:
return "secondary";
default:
return "Unknown";
}
}
static inline int isSupportDozeBrightness(__u32 doze_brightness)
{
if (doze_brightness < DOZE_BRIGHTNESS_MAX)
return 1;
else
return 0;
}
static inline int isAodBrightness(__u32 doze_brightness)
{
if (DOZE_BRIGHTNESS_HBM == doze_brightness ||
doze_brightness == DOZE_BRIGHTNESS_LBM)
return 1;
else
return 0;
}
static inline const char *getDozeBrightnessName(__u32 doze_brightness)
{
switch (doze_brightness) {
case DOZE_TO_NORMAL:
return "doze_to_normal";
case DOZE_BRIGHTNESS_HBM:
return "doze_brightness_high";
case DOZE_BRIGHTNESS_LBM:
return "doze_brightness_low";
default:
return "Unknown";
}
}
static inline int isSupportLcdHbmLevel(__u32 lcd_hbm_level)
{
if (lcd_hbm_level < LCD_HBM_MAX)
return 1;
else
return 0;
}
static inline int isSupportDispEventType(__u32 event_type)
{
if (event_type < MI_DISP_EVENT_MAX)
return 1;
else
return 0;
}
static inline const char *getDispEventTypeName(__u32 event_type)
{
switch (event_type) {
case MI_DISP_EVENT_POWER:
return "Power";
case MI_DISP_EVENT_BACKLIGHT:
return "Backlight";
case MI_DISP_EVENT_FOD:
return "Fod";
case MI_DISP_EVENT_DOZE:
return "Doze";
case MI_DISP_EVENT_FPS:
return "Fps";
case MI_DISP_EVENT_BRIGHTNESS_CLONE:
return "Brightness_clone";
case MI_DISP_EVENT_51_BRIGHTNESS:
return "51_brightness";
case MI_DISP_EVENT_HBM:
return "HBM";
case MI_DISP_EVENT_DC:
return "DC";
case MI_DISP_EVENT_PANEL_DEAD:
return "panel_dead";
case MI_DISP_EVENT_PANEL_EVENT:
return "panel_event";
case MI_DISP_EVENT_DDIC_RESOLUTION:
return "ddic_resolution";
case MI_DISP_EVENT_FLAT_MODE:
return "flat_mode";
default:
return "Unknown";
}
}
static inline int isSupportDispFeatureId(__u32 feature_id)
{
if (feature_id < DISP_FEATURE_MAX)
return 1;
else
return 0;
}
static inline const char *getLocalHbmStateName(int state)
{
switch (state) {
case LOCAL_HBM_OFF_TO_NORMAL:
return "[lhbm off to nomal]";
case LOCAL_HBM_NORMAL_WHITE_1000NIT:
return "[lhbm normal white 1000nit]";
case LOCAL_HBM_NORMAL_WHITE_750NIT:
return "[lhbm normal white 750nit]";
case LOCAL_HBM_NORMAL_WHITE_500NIT:
return "[lhbm normal white 500nit]";
case LOCAL_HBM_NORMAL_WHITE_110NIT:
return "[lhbm normal white 110nit]";
case LOCAL_HBM_NORMAL_GREEN_500NIT:
return "[lhbm normal green 500nit]";
case LOCAL_HBM_HLPM_WHITE_1000NIT:
return "[lhbm H-doze to white 1000nit]";
case LOCAL_HBM_HLPM_WHITE_110NIT:
return "[lhbm H-doze to white 110nit]";
case LOCAL_HBM_OFF_TO_HLPM:
return "[lhbm off to H-doze]";
case LOCAL_HBM_OFF_TO_LLPM:
return "[lhbm off to L-doze]";
case LOCAL_HBM_OFF_TO_NORMAL_BACKLIGHT:
return "[lhbm off to nomal backlight]";
case LOCAL_HBM_OFF_TO_NORMAL_BACKLIGHT_RESTORE:
return "[lhbm off to nomal backlight restore]";
default:
return "Unknown";
}
}
static inline const char *getFingerprintStatusName(int status)
{
switch (status) {
case FINGERPRINT_NONE:
return "none";
case ENROLL_START:
return "enroll_start";
case ENROLL_STOP:
return "enroll_stop";
case AUTH_START:
return "authenticate_start";
case AUTH_STOP:
return "authenticate_stop";
case HEART_RATE_START:
return "heart_rate_start";
case HEART_RATE_STOP:
return "heart_rate_stop";
default:
return "Unknown";
}
}
static inline const char *getDispFeatureIdName(__u32 feature_id)
{
switch (feature_id) {
case DISP_FEATURE_DIMMING:
return "dimming";
case DISP_FEATURE_HBM:
return "hbm";
case DISP_FEATURE_HBM_FOD:
return "hbm_fod";
case DISP_FEATURE_DOZE_BRIGHTNESS:
return "doze_brightness";
case DISP_FEATURE_FOD_CALIBRATION_BRIGHTNESS:
return "fod_calibration_brightness";
case DISP_FEATURE_FOD_CALIBRATION_HBM:
return "fod_calibration_hbm";
case DISP_FEATURE_FLAT_MODE:
return "flat_mode";
case DISP_FEATURE_CRC:
return "crc";
case DISP_FEATURE_DC:
return "dc_mode";
case DISP_FEATURE_LOCAL_HBM:
return "local_hbm";
case DISP_FEATURE_SENSOR_LUX:
return "sensor_lux";
case DISP_FEATURE_LOW_BRIGHTNESS_FOD:
return "low_brightness_fod";
case DISP_FEATURE_FP_STATUS:
return "fp_status";
case DISP_FEATURE_FOLD_STATUS:
return "fold_status";
case DISP_FEATURE_NATURE_FLAT_MODE:
return "nature_flat_mode";
case DISP_FEATURE_SPR_RENDER:
return "spr_render";
case DISP_FEATURE_AOD_TO_NORMAL:
return "aod_to_normal";
case DISP_FEATURE_COLOR_INVERT:
return "color_invert";
case DISP_FEATURE_DC_BACKLIGHT:
return "dc_backlight";
case DISP_FEATURE_GIR:
return "gir";
case DISP_FEATURE_DBI:
return "dbi";
case DISP_FEATURE_DDIC_ROUND_CORNER:
return "ddic_round_corner";
case DISP_FEATURE_HBM_BACKLIGHT:
return "hbm_backlight_level";
case DISP_FEATURE_BACKLIGHT:
return "backlight";
case DISP_FEATURE_BRIGHTNESS:
return "brightness";
case DISP_FEATURE_LCD_HBM:
return "lcd_hbm";
case DISP_FEATURE_DOZE_STATE:
return "doze_state";
case DISP_FEATURE_PEAK_HDR_MODE:
return "peak_hdr_mode";
case DISP_FEATURE_CABC:
return "cabc";
case DISP_FEATURE_BIST_MODE:
return "bist_mode";
case DISP_FEATURE_BIST_MODE_COLOR:
return "bist_mode_color";
case DISP_FEATURE_ROUND_MODE:
return "round_mode";
case DISP_FEATURE_GAMUT:
return "gamut";
case DISP_FEATURE_POWERSTATUS:
return "power_status";
case DISP_FEATURE_SYSTEM_BUILD_VERSION:
return "system_build_version";
case DISP_FEATURE_FRAME_DROP_COUNT:
return "frame_drop_count";
default:
return "Unknown";
}
}
static inline const char *getLhbmValueName(__u32 lhbm_value)
{
switch (lhbm_value) {
case LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP:
return "LHBM_OFF_FINGER_UP";
case LHBM_TARGET_BRIGHTNESS_OFF_AUTH_STOP:
return "LHBM_OFF_AUTH_STOP";
case LHBM_TARGET_BRIGHTNESS_WHITE_1000NIT:
return "LHBM_ON_WHITE_1000NIT";
case LHBM_TARGET_BRIGHTNESS_WHITE_110NIT:
return "LHBM_ON_WHITE_110NIT";
case LHBM_TARGET_BRIGHTNESS_GREEN_500NIT:
return "LHBM_ON_GREEN_500NIT";
default:
return "Unknown";
}
}
#endif
#define MI_DISP_FLAG_BLOCK 0x0000
#define MI_DISP_FLAG_NONBLOCK 0x0001
#define MI_DISP_FEATURE_VERSION_MAJOR 1
#define MI_DISP_FEATURE_VERSION_MINOR 0
#define MI_DISP_FEATURE_VERSION (((MI_DISP_FEATURE_VERSION_MAJOR & 0xFF) << 8) | \
(MI_DISP_FEATURE_VERSION_MINOR & 0xFF))
#define MI_DISP_IOCTL_VERSION _IOR('D', 0x00, struct disp_version)
#define MI_DISP_IOCTL_SET_FEATURE _IOWR('D', 0x01, struct disp_feature_req)
#define MI_DISP_IOCTL_SET_DOZE_BRIGHTNESS _IOW('D', 0x02, struct disp_doze_brightness_req)
#define MI_DISP_IOCTL_GET_DOZE_BRIGHTNESS _IOR('D', 0x03, struct disp_doze_brightness_req)
#define MI_DISP_IOCTL_GET_PANEL_INFO _IOWR('D', 0x04, struct disp_panel_info)
#define MI_DISP_IOCTL_GET_WP_INFO _IOWR('D', 0x05, struct disp_wp_info)
#define MI_DISP_IOCTL_GET_FPS _IOR('D', 0x06, struct disp_fps_info)
#define MI_DISP_IOCTL_REGISTER_EVENT _IOW('D', 0x07, struct disp_event_req)
#define MI_DISP_IOCTL_DEREGISTER_EVENT _IOW('D', 0x08, struct disp_event_req)
#define MI_DISP_IOCTL_WRITE_DSI_CMD _IOW('D', 0x09, struct disp_dsi_cmd_req)
#define MI_DISP_IOCTL_READ_DSI_CMD _IOWR('D', 0x0A, struct disp_dsi_cmd_req)
#define MI_DISP_IOCTL_GET_BRIGHTNESS _IOR('D', 0x0B, struct disp_brightness_req)
#define MI_DISP_IOCTL_SET_BRIGHTNESS _IOW('D', 0x0C, struct disp_brightness_req)
#define MI_DISP_IOCTL_GET_MANUFACTURER_INFO _IOWR('D', 0x0D, struct disp_manufacturer_info_req)
#define MI_DISP_IOCTL_SET_LOCAL_HBM _IOW('D', 0x0E, struct disp_local_hbm_req)
#define MI_DISP_IOCTL_GET_FEATURE _IOWR('D', 0x0F, struct disp_feature_req)
#if defined(__cplusplus)
}
#endif
#endif /* _MI_DISP_H_ */