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
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __PANEL_H__
#define __PANEL_H__
#include <linux/lcd.h>
#include <linux/backlight.h>
#include <linux/spi/spi.h>
#include <linux/sysfs.h>
#include "panel_bl.h"
#include "dimming.h"
#include "panel_dimming.h"
#include "mdnie.h"
#include "copr.h"
#ifdef CONFIG_EXTEND_LIVE_CLOCK
#include "./aod/aod_drv.h"
#endif
enum {
MIPI_DSI_WR_UNKNOWN = 0,
MIPI_DSI_WR_GEN_CMD,
MIPI_DSI_WR_DSC_CMD,
MIPI_DSI_WR_PPS_CMD,
MIPI_DSI_WR_GRAM_CMD,
MIPI_DSI_WR_SRAM_CMD,
MAX_MIPI_DSI_CMD_TYPE,
};
#define CONFIG_LCD_HBM_60_STEP
#define MIPI_DCS_WRITE_GRAM_START (0x2C)
#define MIPI_DCS_WRITE_GRAM_CONTINUE (0x3C)
#define MIPI_DCS_WRITE_SIDE_RAM_START (0x4C)
#define MIPI_DCS_WRITE_SIDE_RAM_CONTINUE (0x5C)
#ifdef CONFIG_SEC_FACTORY
#define CONFIG_SUPPORT_PANEL_SWAP
#define CONFIG_SUPPORT_XTALK_MODE
#define CONFIG_SUPPORT_ISC_DEFECT
#define CONFIG_SELFMASK_FACTORY
#endif
#define CONFIG_SUPPORT_MST
#define CONFIG_SUPPORT_GRAYSPOT_TEST
#define to_panel_device(_m_) container_of(_m_, struct panel_device, _m_)
/* DUMMY PANEL NAME */
#define __pn_name__ xx_xx
#define __PN_NAME__ XX_XX
#define PN_CONCAT(a, b) _PN_CONCAT(a, b)
#define _PN_CONCAT(a, b) a ## _ ## b
#define PANEL_ID_REG (0x04)
#define PANEL_ID_LEN (3)
#define PANEL_OCTA_ID_LEN (20)
#define PANEL_POC_CHKSUM_LEN (5)
#define PANEL_POC_CTRL_LEN (4)
#define PANEL_CODE_LEN (5)
#define PANEL_COORD_LEN (4)
#define PANEL_DATE_LEN (7)
#define NORMAL_TEMPERATURE (25)
#define POWER_IS_ON(pwr) (pwr <= FB_BLANK_NORMAL)
#define UNDER_MINUS_15(temperature) (temperature <= -15)
#define UNDER_0(temperature) (temperature <= 0)
#define CAPS_IS_ON(level) (level >= 41)
struct maptbl;
struct mdnie_info;
/*
* [command types]
* 1. delay
* 2. external pin control
* 3. packet write
*/
/* common cmdinfo */
struct cmdinfo {
u32 type;
char *name;
};
/* delay command */
struct delayinfo {
u32 type;
char *name;
u32 usec;
};
#define DLYINFO(_name_) (_name_)
#define DEFINE_PANEL_UDELAY_NO_SLEEP(_name_, _usec_) \
struct delayinfo DLYINFO(_name_) = \
{ \
.name = #_name_, \
.type = CMD_TYPE_DELAY_NO_SLEEP, \
.usec = (_usec_), \
}
#define DEFINE_PANEL_MDELAY_NO_SLEEP(_name_, _msec_) \
struct delayinfo DLYINFO(_name_) = \
{ \
.name = #_name_, \
.type = CMD_TYPE_DELAY_NO_SLEEP, \
.usec = (_msec_) * 1000, \
}
#define DEFINE_PANEL_UDELAY(_name_, _usec_) \
struct delayinfo DLYINFO(_name_) = \
{ \
.name = #_name_, \
.type = CMD_TYPE_DELAY, \
.usec = (_usec_), \
}
#define DEFINE_PANEL_MDELAY(_name_, _msec_) \
struct delayinfo DLYINFO(_name_) = \
{ \
.name = #_name_, \
.type = CMD_TYPE_DELAY, \
.usec = (_msec_) * 1000, \
}
/* external pin control command */
struct pininfo {
u32 type;
char *name;
int pin;
int onoff;
};
/* packet command */
enum {
CMD_TYPE_NONE,
CMD_TYPE_DELAY,
CMD_TYPE_DELAY_NO_SLEEP,
CMD_TYPE_PINCTL,
CMD_TYPE_TX_PKT_START,
CMD_PKT_TYPE_NONE = CMD_TYPE_TX_PKT_START,
SPI_PKT_TYPE_WR,
DSI_PKT_TYPE_WR,
DSI_PKT_TYPE_COMP,
/*Command to write ddi side ram */
DSI_PKT_TYPE_WR_SR,
DSI_PKT_TYPE_WR_MEM,
DSI_PKT_TYPE_PPS,
CMD_TYPE_TX_PKT_END = DSI_PKT_TYPE_PPS,
CMD_TYPE_RD_PKT_START,
SPI_PKT_TYPE_RD = CMD_TYPE_RD_PKT_START,
#ifdef CONFIG_SUPPORT_DDI_FLASH
DSI_PKT_TYPE_RD_POC,
#endif
DSI_PKT_TYPE_RD,
CMD_TYPE_RX_PKT_END = DSI_PKT_TYPE_RD,
CMD_TYPE_RES,
CMD_TYPE_SEQ,
CMD_TYPE_KEY,
CMD_TYPE_MAP,
CMD_TYPE_DMP,
MAX_CMD_TYPE,
};
enum {
RES_UNINITIALIZED,
RES_INITIALIZED,
};
enum {
KEY_NONE,
KEY_DISABLE,
KEY_ENABLE,
};
enum cmd_level {
CMD_LEVEL_NONE,
CMD_LEVEL_1,
CMD_LEVEL_2,
CMD_LEVEL_3,
MAX_CMD_LEVEL,
};
/* key level command */
struct keyinfo {
u32 type;
char *name;
enum cmd_level level;
u32 en;
struct pktinfo *packet;
};
#define KEYINFO(_name_) PN_CONCAT(key, _name_)
#define KEYINFO_INIT(_name_, _lv_, _en_, _pkt_) \
{ \
.name = #_name_, \
.type = (CMD_TYPE_KEY), \
.level = (_lv_), \
.en = (_en_), \
.packet = (_pkt_), \
}
#define DEFINE_PANEL_KEY(_name_, _lv_, _en_, _pkt_) \
struct keyinfo KEYINFO(_name_) = KEYINFO_INIT(_name_, _lv_, _en_, _pkt_)
enum cmd_mode {
CMD_MODE_NONE,
CMD_MODE_RO,
CMD_MODE_WO,
CMD_MODE_RW,
MAX_CMD_MODE,
};
struct ldi_reg_desc {
u8 addr;
char *name;
enum cmd_mode mode;
enum cmd_level level;
bool dirty;
};
#define MAX_LDI_REG (0x100)
#define LDI_REG_DESC(_addr_, _name_, _mode_, _level_) \
[(_addr_)] = { \
.addr = (_addr_), \
.name = (_name_), \
.mode = (_mode_), \
.level = (_level_), \
.dirty = (0), \
}
struct pkt_update_info {
u32 offset;
struct maptbl *maptbl;
u32 nr_maptbl;
int (*getidx)(struct pkt_update_info *pktui);
void *pdata;
};
struct pktinfo {
u32 type;
char *name;
u32 addr;
u8 *data;
u8 offset;
u32 dlen;
struct pkt_update_info *pktui;
u32 nr_pktui;
};
struct rdinfo {
u32 type;
char *name;
u32 addr;
u32 offset;
u32 len;
u8 *data;
};
struct res_update_info {
u32 offset;
struct rdinfo *rditbl;
};
struct resinfo {
u32 type;
char *name;
int state;
u8 *data;
u32 dlen;
struct res_update_info *resui;
u32 nr_resui;
};
struct dumpinfo {
u32 type;
char *name;
struct resinfo *res;
void (*callback)(struct dumpinfo *info);
};
#define DUMPINFO_INIT(_name_, _res_, _callback_) \
{ \
.name = #_name_, \
.type = (CMD_TYPE_DMP), \
.res = (_res_), \
.callback = (_callback_), \
}
#define RESUI(_name_) PN_CONCAT(resui, _name_)
#define RESINFO(_name_) PN_CONCAT(res, _name_)
#define RDINFO(_name_) PN_CONCAT(rd, _name_)
#define RDINFO_INIT(_name_, _type_, _addr_, _offset_, _len_) \
{ \
.name = #_name_, \
.type = (_type_), \
.addr = (_addr_), \
.offset = (_offset_), \
.len = (_len_), \
}
#define DEFINE_RDINFO(_name_, _type_, _addr_, _offset_, _len_) \
struct rdinfo RDINFO(_name_) = RDINFO_INIT(_name_, _type_, _addr_, _offset_, _len_)
#define RESUI_INIT(_rditbl_, _offset_)\
{ \
.offset = (_offset_), \
.rditbl = (_rditbl_), \
}
#define DEFINE_RESUI(_name_, _rditbl_, _offset_) \
struct res_update_info RESUI(_name_)[] = \
{ \
RESUI_INIT(_rditbl_, _offset_), \
}
#define RESINFO_INIT(_name_, _arr_, _resui_) \
{ \
.name = #_name_, \
.type = (CMD_TYPE_RES), \
.state = (RES_UNINITIALIZED), \
.data = (_arr_), \
.dlen = ARRAY_SIZE((_arr_)), \
.resui = (_resui_), \
.nr_resui = (ARRAY_SIZE(_resui_)), \
}
#define DEFINE_RESOURCE(_name_, _arr_, _resui_) \
struct resinfo RESINFO(_name_) = RESINFO_INIT(_name_, _arr_, _resui_)
#define PKTUI(_name_) PN_CONCAT(pktui, _name_)
#define PKTINFO(_name_) PN_CONCAT(pkt, _name_)
#define DECLARE_PKTUI(_name_) \
struct pkt_update_info PKTUI(_name_)[]
#define DEFINE_PKTUI(_name_, _maptbl_, _update_offset_) \
struct pkt_update_info PKTUI(_name_)[] = \
{ \
{ \
.offset = (_update_offset_), \
.maptbl = (_maptbl_), \
.nr_maptbl = (1), \
.getidx = (NULL), \
}, \
}
#define PKTINFO_INIT(_name_, _type_, _arr_, _ofs_, _pktui_, _nr_pktui_) \
{ \
.name = (#_name_), \
.type = (_type_), \
.data = (_arr_), \
.offset = (_ofs_), \
.dlen = ARRAY_SIZE((_arr_)), \
.pktui = (_pktui_), \
.nr_pktui = (_nr_pktui_), \
}
#define DEFINE_PACKET(_name_, _type_, _arr_, _ofs_, _pktui_, _nr_pktui_) \
struct pktinfo PKTINFO(_name_) = PKTINFO_INIT(_name_, _type_, _arr_, _ofs_, _pktui_, _nr_pktui_)
#define DEFINE_VARIABLE_PACKET(_name_, _type_, _arr_, _ofs_) \
DEFINE_PACKET(_name_, _type_, _arr_, _ofs_, PKTUI(_name_), ARRAY_SIZE(PKTUI(_name_)))
#define DEFINE_STATIC_PACKET(_name_, _type_, _arr_, _ofs_) \
DEFINE_PACKET(_name_, _type_, _arr_, _ofs_, (NULL), (0))
#define PN_MAP_DATA_TABLE(_name_) PN_CONCAT(PN_CONCAT(__pn_name__, _name_), table)
#define PN_CMD_DATA_TABLE(_name_) PN_CONCAT(__PN_NAME__, _name_)
#define DEFINE_PN_STATIC_PACKET(_name_, _type_, _arr_) \
DEFINE_PACKET(PN_CONCAT(__pn_name__, _name_), _type_, \
PN_CONCAT(__PN_NAME__, _arr_), _ofs_, NULL, 0)
/* structure of mapping table */
struct maptbl_ops {
int (*init)(struct maptbl *tbl);
int (*getidx)(struct maptbl *tbl);
void (*copy)(struct maptbl *tbl, u8 *dst);
};
struct maptbl {
u32 type;
char *name;
int nlayer;
int nrow;
int ncol;
int sz_copy;
u8 *arr;
void *pdata;
bool initialized;
struct maptbl_ops ops;
};
#define MAPINFO(_name_) (_name_)
#define sizeof_maptbl(tbl) \
((tbl)->nlayer * (tbl)->nrow * (tbl)->ncol)
#define sizeof_layer(tbl) \
((tbl)->nrow * (tbl)->ncol)
#define sizeof_row(tbl) \
((tbl)->ncol)
#define for_each_maptbl(tbl, __pos__) \
for ((__pos__) = 0; \
(__pos__) < (sizeof_maptbl(tbl)); \
(__pos__)++)
#define for_each_layer(tbl, __pos__) \
for ((__pos__) = 0; \
(__pos__) < ((tbl)->nlayer); \
(__pos__)++)
#define for_each_row(tbl, __pos__) \
for ((__pos__) = 0; \
(__pos__) < ((tbl)->nrow); \
(__pos__)++)
#define for_each_col(tbl, __pos__) \
for ((__pos__) = 0; \
(__pos__) < ((tbl)->ncol); \
(__pos__)++)
#define DEFINE_MAPTBL(_name_, _arr_, _nlayer_, _nrow_, _ncol_, _sz_copy_, f_init, f_getidx, f_copy) \
{ \
.type = (CMD_TYPE_MAP), \
.name = _name_, \
.arr = (u8 *)(_arr_), \
.nlayer = (_nlayer_), \
.nrow = (_nrow_), \
.ncol = (_ncol_), \
.sz_copy = (_sz_copy_), \
.pdata = NULL, \
.ops = { \
.init = (f_init), \
.getidx = (f_getidx), \
.copy = (f_copy), \
}, \
}
#define DEFINE_0D_MAPTBL(_name_, f_init, f_getidx, f_copy) \
{ \
.type = (CMD_TYPE_MAP), \
.name = #_name_, \
.arr = NULL, \
.nlayer = 0, \
.nrow = 0, \
.ncol = 0, \
.sz_copy = 0, \
.pdata = NULL, \
.ops = { \
.init = (f_init), \
.getidx = (f_getidx), \
.copy = (f_copy), \
}, \
}
#define DEFINE_1D_MAPTBL(_name_, _size_, f_init, f_getidx, f_copy) \
{ \
.type = (CMD_TYPE_MAP), \
.name = #_name_, \
.arr = (u8 *)(_name_), \
.nlayer = 1, \
.nrow = ARRAY_SIZE((_name_)), \
.ncol = (_size_), \
.sz_copy = (_size_), \
.pdata = NULL, \
.ops = { \
.init = (f_init), \
.getidx = (f_getidx), \
.copy = (f_copy), \
}, \
}
#define DEFINE_2D_MAPTBL(_name_, f_init, f_getidx, f_copy) \
{ \
.type = (CMD_TYPE_MAP), \
.name = #_name_, \
.arr = (u8 *)_name_, \
.nlayer = 1, \
.nrow = ARRAY_SIZE(_name_), \
.ncol = ARRAY_SIZE((_name_)[0]), \
.sz_copy = ARRAY_SIZE((_name_)[0]), \
.pdata = NULL, \
.ops = { \
.init = f_init, \
.getidx = f_getidx, \
.copy = f_copy, \
}, \
}
#define DEFINE_3D_MAPTBL(_name_, f_init, f_getidx, f_copy) \
{ \
.type = (CMD_TYPE_MAP), \
.name = #_name_, \
.arr = (u8 *)_name_, \
.nlayer = ARRAY_SIZE(_name_), \
.nrow = ARRAY_SIZE((_name_)[0]), \
.ncol = ARRAY_SIZE((_name_)[0][0]), \
.sz_copy = ARRAY_SIZE((_name_)[0][0]),\
.pdata = NULL, \
.ops = { \
.init = f_init, \
.getidx = f_getidx, \
.copy = f_copy, \
}, \
}
u32 maptbl_index(struct maptbl *tbl, int layer, int row, int col);
int maptbl_init(struct maptbl *tbl);
int maptbl_getidx(struct maptbl *tbl);
void maptbl_copy(struct maptbl *tbl, u8 *dst);
void maptbl_memcpy(struct maptbl *dst, struct maptbl *src);
u8 *maptbl_getptr(struct maptbl *tbl);
enum PANEL_SEQ {
PANEL_INIT_SEQ,
PANEL_EXIT_SEQ,
PANEL_RES_INIT_SEQ,
#ifdef CONFIG_SUPPORT_DIM_FLASH
PANEL_DIM_FLASH_RES_INIT_SEQ,
#endif
PANEL_MAP_INIT_SEQ,
PANEL_DISPLAY_ON_SEQ,
PANEL_DISPLAY_OFF_SEQ,
PANEL_ALPM_ENTER_SEQ,
PANEL_ALPM_DELAY_SEQ,
PANEL_ALPM_EXIT_SEQ,
PANEL_SET_BL_SEQ,
#ifdef CONFIG_SUPPORT_HMD
PANEL_HMD_ON_SEQ,
PANEL_HMD_OFF_SEQ,
PANEL_HMD_BL_SEQ,
#endif
PANEL_HBM_ON_SEQ,
PANEL_HBM_OFF_SEQ,
#ifdef CONFIG_SUPPORT_DSU
PANEL_DSU_SEQ,
#endif
PANEL_MCD_ON_SEQ,
PANEL_MCD_OFF_SEQ,
PANEL_MCD_RS_ON_SEQ,
PANEL_MCD_RS_OFF_SEQ,
PANEL_MCD_RS_READ_SEQ,
#ifdef CONFIG_ACTIVE_CLOCK
PANEL_ACTIVE_CLK_IMG_SEQ,
PANEL_ACTIVE_CLK_CTRL_SEQ,
PANEL_ACTIVE_CLK_UPDATE_SEQ,
#endif
#ifdef CONFIG_SUPPORT_MST
PANEL_MST_ON_SEQ,
PANEL_MST_OFF_SEQ,
#endif
#ifdef CONFIG_SUPPORT_GRAM_CHECKSUM
PANEL_GCT_ENTER_SEQ,
PANEL_GCT_VDDM_SEQ,
PANEL_GCT_IMG_UPDATE_SEQ,
PANEL_GCT_IMG_0_UPDATE_SEQ,
PANEL_GCT_IMG_1_UPDATE_SEQ,
PANEL_GCT_EXIT_SEQ,
#endif
#ifdef CONFIG_SUPPORT_GRAYSPOT_TEST
PANEL_GRAYSPOT_ON_SEQ,
PANEL_GRAYSPOT_OFF_SEQ,
#endif
#ifdef CONFIG_SUPPORT_TDMB_TUNE
PANEL_TDMB_TUNE_SEQ,
#endif
#ifdef CONFIG_SUPPORT_ISC_DEFECT
PANEL_CHECK_ISC_DEFECT_SEQ,
#endif
PANEL_DUMP_SEQ,
PANEL_DUMMY_SEQ,
MAX_PANEL_SEQ,
};
/* structure of sequence table */
struct seqinfo {
u32 type;
char *name;
void **cmdtbl;
u32 size;
};
#define SEQINFO(_name_) (_name_)
#define SEQINFO_INIT(_name_, _cmdtbl_) \
{ \
.type = (CMD_TYPE_SEQ), \
.name = (_name_), \
.cmdtbl = (_cmdtbl_), \
.size = ARRAY_SIZE((_cmdtbl_)), \
}
struct brt_map {
int brt;
int lum;
};
struct common_panel_info {
char *ldi_name;
char *name;
char *model;
char *vendor;
u32 id;
u32 rev;
struct maptbl *maptbl;
int nr_maptbl;
struct seqinfo *seqtbl;
int nr_seqtbl;
struct rdinfo *rditbl;
int nr_rditbl;
struct resinfo *restbl;
int nr_restbl;
struct dumpinfo *dumpinfo;
int nr_dumpinfo;
struct mdnie_tune *mdnie_tune;
struct panel_dimming_info *panel_dim_info[MAX_PANEL_BL_SUBDEV];
#ifdef CONFIG_EXYNOS_DECON_LCD_COPR
struct panel_copr_data *copr_data;
#endif
#ifdef CONFIG_EXTEND_LIVE_CLOCK
struct aod_tune *aod_tune;
#endif
#ifdef CONFIG_SUPPORT_DDI_FLASH
struct panel_poc_data *poc_data;
#endif
};
enum {
OVER_ZERO,
UNDER_ZERO,
UNDER_MINUS_FIFTEEN,
DIM_OVER_ZERO,
DIM_UNDER_ZERO,
DIM_UNDER_MINUS_FIFTEEN,
TEMP_MAX,
};
enum {
POC_ONOFF_OFF,
POC_ONOFF_ON,
POC_ONOFF_MAX
};
enum {
ACL_PWRSAVE_OFF,
ACL_PWRSAVE_ON,
MAX_ACL_PWRSAVE,
};
enum {
ACL_OPR_OFF,
ACL_OPR_03P,
ACL_OPR_06P,
ACL_OPR_08P,
ACL_OPR_12P,
ACL_OPR_15P,
ACL_OPR_MAX
};
enum {
ALPM_OFF = 0,
ALPM_LOW_BR,
HLPM_LOW_BR,
ALPM_HIGH_BR,
HLPM_HIGH_BR,
};
#ifdef CONFIG_SUPPORT_XTALK_MODE
enum {
XTALK_OFF,
XTALK_ON,
};
#endif
#ifdef CONFIG_SUPPORT_GRAM_CHECKSUM
enum {
GRAM_CHKSUM_OFF,
GRAM_CHKSUM_LV_TEST_1,
GRAM_CHKSUM_LV_TEST_2,
GRAM_CHKSUM_HV_TEST_1,
GRAM_CHKSUM_HV_TEST_2,
MAX_GRAM_CHKSUM,
};
enum {
GCT_PATTERN_NONE,
GCT_PATTERN_1,
GCT_PATTERN_2,
MAX_GCT_PATTERN,
};
enum {
VDDM_ORIG,
VDDM_LV,
VDDM_HV,
MAX_VDDM,
};
enum {
GRAM_TEST_OFF,
GRAM_TEST_ON
};
#endif
enum {
MCD_RS_1_RIGHT,
MCD_RS_1_LEFT,
MCD_RS_2_RIGHT,
MCD_RS_2_LEFT,
MAX_MCD_RS,
};
enum {
DIM_TYPE_AID_DIMMING,
DIM_TYPE_DIM_FLASH,
MAX_DIM_TYPE,
};
#define MAX_PANEL (32)
#define MAX_PANEL_LUT (128)
enum {
PANEL_ID,
PANEL_MASK,
PANEL_INDEX,
};
struct panel_lut {
u32 id;
u32 mask;
u32 index;
};
struct panel_lut_info {
const char *names[MAX_PANEL];
int nr_panel;
struct panel_lut lut[MAX_PANEL_LUT];
int nr_lut;
};
struct panel_properties {
s32 temperature;
u32 siop_enable;
u32 adaptive_control;
u32 alpm_mode;
u32 cur_alpm_mode;
s32 lpm_brightness;
u32 lpm_opr;
u32 cur_lpm_opr;
u32 mcd_on;
u32 mcd_resistance;
int mcd_rs_range[MAX_MCD_RS][2];
int mcd_rs_flash_range[MAX_MCD_RS][2];
#ifdef CONFIG_SUPPORT_MST
u32 mst_on;
#endif
u32 hmd_on;
u32 hmd_brightness;
u32 lux;
#ifdef CONFIG_SUPPORT_XTALK_MODE
u32 xtalk_mode;
#endif
#ifdef CONFIG_SUPPORT_DDI_FLASH
u32 poc_op;
#endif
#ifdef CONFIG_SUPPORT_GRAM_CHECKSUM
u32 gct_on;
u32 gct_vddm;
u32 gct_pattern;
u8 gct_valid_chksum;
#endif
#ifdef CONFIG_SUPPORT_GRAYSPOT_TEST
u32 grayspot;
#endif
u32 poc_onoff;
#ifdef CONFIG_SUPPORT_TDMB_TUNE
u32 tdmb_on;
u32 cur_tdmb_on;
#endif
u32 key[MAX_CMD_LEVEL];
u32 irc_mode;
#ifdef CONFIG_SUPPORT_DIM_FLASH
bool dim_flash_on;
u32 dim_flash_state; /* success or fail */
u32 cur_dim_type; /* AID DIMMING or DIM FLASH */
#endif
};
struct panel_info {
const char *ldi_name;
unsigned char id[PANEL_ID_LEN];
unsigned char date[PANEL_DATE_LEN];
unsigned char coordinate[PANEL_COORD_LEN];
struct panel_properties props;
/* platform dependent data - ex> exynos : dsim_device */
void *pdata;
void *dim_info[MAX_PANEL_BL_SUBDEV];
void *dim_flash_info[MAX_PANEL_BL_SUBDEV];
struct maptbl *maptbl;
int nr_maptbl;
struct seqinfo *seqtbl;
int nr_seqtbl;
struct rdinfo *rditbl;
int nr_rditbl;
struct dumpinfo *dumpinfo;
int nr_dumpinfo;
struct resinfo *restbl;
int nr_restbl;
struct panel_dimming_info *panel_dim_info[MAX_PANEL_BL_SUBDEV];
struct panel_lut_info lut_info;
};
#define __PANEL_ATTR_RO(_name, _mode) __ATTR(_name, _mode, \
PN_CONCAT(_name, show), NULL)
#define __PANEL_ATTR_WO(_name, _mode) __ATTR(_name, _mode, \
NULL, PN_CONCAT(_name, store))
#define __PANEL_ATTR_RW(_name, _mode) __ATTR(_name, _mode, \
PN_CONCAT(_name, show), PN_CONCAT(_name, store))
void print_data(char *data, int size);
void print_maptbl(struct maptbl *tbl);
int register_common_panel(struct common_panel_info *info);
struct common_panel_info *find_panel(struct panel_device *panel, u32 id);
void print_panel_lut(struct panel_lut_info *lut_info);
struct seqinfo *find_panel_seqtbl(struct panel_info *panel_data, char *name);
struct seqinfo *find_index_seqtbl(struct panel_info *panel_data, u32 index);
struct pktinfo *find_packet(struct seqinfo *seqtbl, char *name);
struct pktinfo *find_packet_suffix(struct seqinfo *seqtbl, char *name);
struct maptbl *find_panel_maptbl_by_index(struct panel_info *panel, int index);
struct maptbl *find_panel_maptbl_by_name(struct panel_info *panel_data, char *name);
struct panel_dimming_info *find_panel_dimming(struct panel_info *panel_data, char *name);
int excute_seqtbl_nolock(struct panel_device *panel, struct seqinfo *seqtbl, int index);
int panel_do_seqtbl(struct panel_device *panel, struct seqinfo *seqtbl);
int panel_do_seqtbl_by_index_nolock(struct panel_device *panel, int index);
int panel_do_seqtbl_by_index(struct panel_device *panel, int index);
struct resinfo *find_panel_resource(struct panel_info *panel, char *name);
bool panel_resource_initialized(struct panel_info *panel_data, char *name);
int rescpy(u8 *dst, struct resinfo *res, u32 offset, u32 len);
int rescpy_by_name(struct panel_info *panel, u8 *dst, char *name, u32 offset, u32 len);
int resource_clear(struct resinfo *res);
int resource_clear_by_name(struct panel_info *panel_data, char *name);
int resource_copy(u8 *dst, struct resinfo *res);
int resource_copy_by_name(struct panel_info *panel_data, u8 *dst, char *name);
int resource_copy_n_clear_by_name(struct panel_info *panel_data, u8 *dst, char *name);
int get_resource_size_by_name(struct panel_info *panel_data, char *name);
int get_panel_resource_size(struct resinfo *res);
int panel_resource_update(struct panel_device *panel, struct resinfo *res);
int panel_resource_update_by_name(struct panel_device *panel, char *name);
int panel_dumpinfo_update(struct panel_device *panel, struct dumpinfo *info);
int panel_rx_nbytes(struct panel_device *panel, u32 type, u8 *buf, u8 addr, u8 pos, u8 len);
int panel_verify_tx_packet(struct panel_device *panel, u8 *table, u8 len);
int panel_set_key(struct panel_device *panel, int level, bool on);
struct pktinfo *alloc_static_packet(char *name, u32 type, u8 *data, u32 dlen);
int check_panel_active(struct panel_device *panel, const char *caller);
int read_panel_id(struct panel_device *panel, u8 *buf);
int panel_resource_prepare(struct panel_device *panel);
void print_panel_resource(struct panel_device *panel);
#ifdef CONFIG_EXYNOS_DECON_LCD_SYSFS
int panel_sysfs_probe(struct panel_device *panel);
#else
static inline int panel_sysfs_probe(struct panel_device *panel) { return 0; }
#endif
#define IS_PANEL_ACTIVE(_panel) check_panel_active(_panel, __func__)
#endif /* __PANEL_H__ */
|