-
Notifications
You must be signed in to change notification settings - Fork 5
/
s_fb_is_hdmi_primary(mfd) && mdata->handoff_pending
5617 lines (5617 loc) · 569 KB
/
s_fb_is_hdmi_primary(mfd) && mdata->handoff_pending
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
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 1) /*
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 2) * Core MDSS framebuffer driver.
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 3) *
cadc1614708b9 (Venkata Prahlad Valluru 2019-05-07 19:58:00 +0530 4) * Copyright (c) 2008-2019, The Linux Foundation. All rights reserved.
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 5) * Copyright (C) 2007 Google Incorporated
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 6) *
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 7) * This software is licensed under the terms of the GNU General Public
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 8) * License version 2, as published by the Free Software Foundation, and
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 9) * may be copied, distributed, and modified under those terms.
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 10) *
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 11) * This program is distributed in the hope that it will be useful,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 12) * but WITHOUT ANY WARRANTY; without even the implied warranty of
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 13) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 14) * GNU General Public License for more details.
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 15) */
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 16)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 17) #define pr_fmt(fmt) "%s: " fmt, __func__
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 18)
f6fb77ca7d114 (Tatenda Chipeperekwa 2015-02-23 21:18:29 -0800 19) #include <linux/videodev2.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 20) #include <linux/bootmem.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 21) #include <linux/console.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 22) #include <linux/debugfs.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 23) #include <linux/delay.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 24) #include <linux/device.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 25) #include <linux/dma-mapping.h>
d7580b4b6570d (Jeevan Shriram 2014-03-27 10:53:40 -0700 26) #include <linux/dma-buf.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 27) #include <linux/fb.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 28) #include <linux/init.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 29) #include <linux/ioport.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 30) #include <linux/kernel.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 31) #include <linux/memory.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 32) #include <linux/mm.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 33) #include <linux/module.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 34) #include <linux/moduleparam.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 35) #include <linux/msm_mdp.h>
d8998364c926c (Ujwal Patel 2013-08-12 10:58:47 -0700 36) #include <linux/of.h>
d8998364c926c (Ujwal Patel 2013-08-12 10:58:47 -0700 37) #include <linux/of_address.h>
b1e3eee5eea67 (Clarence Ip 2016-02-23 19:01:54 -0500 38) #include <linux/of_platform.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 39) #include <linux/proc_fs.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 40) #include <linux/pm_runtime.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 41) #include <linux/slab.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 42) #include <linux/string.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 43) #include <linux/uaccess.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 44) #include <linux/version.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 45) #include <linux/vmalloc.h>
9bc30b3c612e8 (Ken Zhang 2012-11-07 18:33:16 -0500 46) #include <linux/file.h>
0df863c8161ca (Adrian Salido-Moreno 2013-10-15 20:31:50 -0700 47) #include <linux/kthread.h>
2b0ce3331c94c (Terence Hampson 2014-09-05 10:34:11 -0400 48) #include <linux/dma-buf.h>
9bc30b3c612e8 (Ken Zhang 2012-11-07 18:33:16 -0500 49) #include <sync.h>
9bc30b3c612e8 (Ken Zhang 2012-11-07 18:33:16 -0500 50) #include <sw_sync.h>
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 51)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 52) #include "mdss_fb.h"
fb9d80000c238 (Dhaval Patel 2014-03-19 17:04:29 -0700 53) #include "mdss_mdp_splash_logo.h"
64d037028cb92 (Ingrid Gallardo 2014-11-25 14:14:02 -0800 54) #define CREATE_TRACE_POINTS
64d037028cb92 (Ingrid Gallardo 2014-11-25 14:14:02 -0800 55) #include "mdss_debug.h"
ce2af4cff4d90 (Veera Sundaram Sankaran 2014-10-22 10:28:34 -0700 56) #include "mdss_smmu.h"
2707818973b22 (Ingrid Gallardo 2015-05-12 22:25:41 -0700 57) #include "mdss_mdp.h"
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 58)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 59) #ifdef CONFIG_MACH_LGE
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 60) #include <soc/qcom/lge/board_lge.h>
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 61) #include <linux/timer.h>
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 62) #include <linux/debugfs.h>
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 63) #endif
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 64) #ifdef CONFIG_LGE_DISPLAY_COMMON
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 65) #include "lge/lge_mdss_display.h"
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 66) #endif
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 67) #if defined(CONFIG_LGE_INTERVAL_MONITOR)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 68) #include "lge/lge_interval_monitor.h"
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 69) #endif
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 70)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 71) #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 72) #define MDSS_FB_NUM 3
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 73) #else
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 74) #define MDSS_FB_NUM 2
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 75) #endif
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 76)
b1e3eee5eea67 (Clarence Ip 2016-02-23 19:01:54 -0500 77) #ifndef EXPORT_COMPAT
b1e3eee5eea67 (Clarence Ip 2016-02-23 19:01:54 -0500 78) #define EXPORT_COMPAT(x)
b1e3eee5eea67 (Clarence Ip 2016-02-23 19:01:54 -0500 79) #endif
b1e3eee5eea67 (Clarence Ip 2016-02-23 19:01:54 -0500 80)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 81) #define MAX_FBI_LIST 32
fbcc005c2b893 (Aravind Venkateswaran 2014-10-30 15:03:45 -0700 82)
7f3712ee81e1a (Sravanthi Kollukuduru 2016-03-02 14:53:28 +0530 83) #ifndef TARGET_HW_MDSS_MDP3
77437745cb33f (Aravind Venkateswaran 2015-03-10 11:42:29 -0700 84) #define BLANK_FLAG_LP FB_BLANK_NORMAL
77437745cb33f (Aravind Venkateswaran 2015-03-10 11:42:29 -0700 85) #define BLANK_FLAG_ULP FB_BLANK_VSYNC_SUSPEND
7f3712ee81e1a (Sravanthi Kollukuduru 2016-03-02 14:53:28 +0530 86) #else
7f3712ee81e1a (Sravanthi Kollukuduru 2016-03-02 14:53:28 +0530 87) #define BLANK_FLAG_LP FB_BLANK_VSYNC_SUSPEND
7f3712ee81e1a (Sravanthi Kollukuduru 2016-03-02 14:53:28 +0530 88) #define BLANK_FLAG_ULP FB_BLANK_NORMAL
7f3712ee81e1a (Sravanthi Kollukuduru 2016-03-02 14:53:28 +0530 89) #endif
fbcc005c2b893 (Aravind Venkateswaran 2014-10-30 15:03:45 -0700 90)
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 91) /*
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 92) * Time period for fps calulation in micro seconds.
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 93) * Default value is set to 1 sec.
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 94) */
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 95) #define MDP_TIME_PERIOD_CALC_FPS_US 1000000
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 96)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 97) static struct fb_info *fbi_list[MAX_FBI_LIST];
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 98) static int fbi_list_index;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 99)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 100) static u32 mdss_fb_pseudo_palette[16] = {
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 101) 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 102) 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 103) 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 104) 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 105) };
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 106)
b192f3c2c194b (Xiaoming Zhou 2012-12-21 21:23:15 -0500 107) static struct msm_mdp_interface *mdp_instance;
b192f3c2c194b (Xiaoming Zhou 2012-12-21 21:23:15 -0500 108)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 109) static int mdss_fb_register(struct msm_fb_data_type *mfd);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 110) static int mdss_fb_open(struct fb_info *info, int user);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 111) static int mdss_fb_release(struct fb_info *info, int user);
a681b26df0050 (Ujwal Patel 2013-10-22 23:24:46 -0700 112) static int mdss_fb_release_all(struct fb_info *info, bool release_all);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 113) static int mdss_fb_pan_display(struct fb_var_screeninfo *var,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 114) struct fb_info *info);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 115) static int mdss_fb_check_var(struct fb_var_screeninfo *var,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 116) struct fb_info *info);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 117) static int mdss_fb_set_par(struct fb_info *info);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 118) static int mdss_fb_blank_sub(int blank_mode, struct fb_info *info,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 119) int op_enable);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 120) static int mdss_fb_suspend_sub(struct msm_fb_data_type *mfd);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 121) static int mdss_fb_ioctl(struct fb_info *info, unsigned int cmd,
75af757c1b7ba (Dhaval Patel 2015-11-04 14:01:09 -0800 122) unsigned long arg, struct file *file);
01ea04c62e5cf (Jeevan Shriram 2014-03-26 19:47:49 -0700 123) static int mdss_fb_fbmem_ion_mmap(struct fb_info *info,
01ea04c62e5cf (Jeevan Shriram 2014-03-26 19:47:49 -0700 124) struct vm_area_struct *vma);
915c2f85a0db0 (Jeevan Shriram 2014-04-28 18:04:07 -0700 125) static int mdss_fb_alloc_fb_ion_memory(struct msm_fb_data_type *mfd,
915c2f85a0db0 (Jeevan Shriram 2014-04-28 18:04:07 -0700 126) size_t size);
9bc30b3c612e8 (Ken Zhang 2012-11-07 18:33:16 -0500 127) static void mdss_fb_release_fences(struct msm_fb_data_type *mfd);
a964a547c7031 (Adrian Salido-Moreno 2013-09-19 19:52:09 -0700 128) static int __mdss_fb_sync_buf_done_callback(struct notifier_block *p,
a964a547c7031 (Adrian Salido-Moreno 2013-09-19 19:52:09 -0700 129) unsigned long val, void *data);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 130)
0df863c8161ca (Adrian Salido-Moreno 2013-10-15 20:31:50 -0700 131) static int __mdss_fb_display_thread(void *data);
272d4979007a1 (Aravind Venkateswaran 2013-11-12 14:33:16 -0800 132) static int mdss_fb_pan_idle(struct msm_fb_data_type *mfd);
5f270e6406a9a (Adrian Salido-Moreno 2012-12-14 20:18:10 -0800 133) static int mdss_fb_send_panel_event(struct msm_fb_data_type *mfd,
5f270e6406a9a (Adrian Salido-Moreno 2012-12-14 20:18:10 -0800 134) int event, void *arg);
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 135) static void mdss_fb_set_mdp_sync_pt_threshold(struct msm_fb_data_type *mfd,
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 136) int type);
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 137)
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 138) static inline void __user *to_user_ptr(uint64_t address)
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 139) {
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 140) return (void __user *)(uintptr_t)address;
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 141) }
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 142)
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 143) static inline uint64_t __user to_user_u64(void *ptr)
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 144) {
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 145) return (uint64_t)((uintptr_t)ptr);
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 146) }
687db9c75e3ca (Naseer Ahmed 2016-04-05 15:19:25 -0400 147)
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 148) void mdss_fb_no_update_notify_timer_cb(unsigned long data)
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 149) {
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 150) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)data;
561365346ee80 (Jayant Shekhar 2013-11-05 10:57:02 +0530 151) if (!mfd) {
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 152) pr_err("%s mfd NULL\n", __func__);
561365346ee80 (Jayant Shekhar 2013-11-05 10:57:02 +0530 153) return;
561365346ee80 (Jayant Shekhar 2013-11-05 10:57:02 +0530 154) }
5c39398cd9184 (Carl Vanderlip 2013-05-30 11:48:48 -0700 155) mfd->no_update.value = NOTIFY_TYPE_NO_UPDATE;
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 156) complete(&mfd->no_update.comp);
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 157) }
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 158)
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 159) void mdss_fb_bl_update_notify(struct msm_fb_data_type *mfd,
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 160) uint32_t notification_type)
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 161) {
9f2bed0126343 (Gopikrishnaiah Anandan 2015-04-27 22:23:45 -0700 162) struct mdss_overlay_private *mdp5_data = NULL;
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 163) if (!mfd) {
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 164) pr_err("%s mfd NULL\n", __func__);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 165) return;
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 166) }
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 167) mutex_lock(&mfd->update.lock);
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 168) if (mfd->update.is_suspend) {
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 169) mutex_unlock(&mfd->update.lock);
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 170) return;
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 171) }
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 172) if (mfd->update.ref_count > 0) {
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 173) mutex_unlock(&mfd->update.lock);
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 174) mfd->update.value = notification_type;
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 175) complete(&mfd->update.comp);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 176) mutex_lock(&mfd->update.lock);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 177) }
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 178) mutex_unlock(&mfd->update.lock);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 179)
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 180) mutex_lock(&mfd->no_update.lock);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 181) if (mfd->no_update.ref_count > 0) {
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 182) mutex_unlock(&mfd->no_update.lock);
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 183) mfd->no_update.value = notification_type;
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 184) complete(&mfd->no_update.comp);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 185) mutex_lock(&mfd->no_update.lock);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 186) }
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 187) mutex_unlock(&mfd->no_update.lock);
9f2bed0126343 (Gopikrishnaiah Anandan 2015-04-27 22:23:45 -0700 188) mdp5_data = mfd_to_mdp5_data(mfd);
9f2bed0126343 (Gopikrishnaiah Anandan 2015-04-27 22:23:45 -0700 189) if (mdp5_data) {
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 190) if (notification_type == NOTIFY_TYPE_BL_AD_ATTEN_UPDATE) {
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 191) mdp5_data->ad_bl_events++;
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 192) sysfs_notify_dirent(mdp5_data->ad_bl_event_sd);
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 193) } else if (notification_type == NOTIFY_TYPE_BL_UPDATE) {
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 194) mdp5_data->bl_events++;
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 195) sysfs_notify_dirent(mdp5_data->bl_event_sd);
25ee56238aea5 (Ping Li 2015-05-20 13:23:44 -0700 196) }
9f2bed0126343 (Gopikrishnaiah Anandan 2015-04-27 22:23:45 -0700 197) }
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 198) }
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 199)
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 200) static int mdss_fb_notify_update(struct msm_fb_data_type *mfd,
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 201) unsigned long *argp)
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 202) {
a637447cc1a8a (Krishna Chaitanya Parimi 2013-10-03 20:51:41 +0530 203) int ret;
dabc1a3dddd3f (Benet Clark 2014-06-24 18:49:53 -0700 204) unsigned int notify = 0x0, to_user = 0x0;
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 205)
dabc1a3dddd3f (Benet Clark 2014-06-24 18:49:53 -0700 206) ret = copy_from_user(¬ify, argp, sizeof(unsigned int));
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 207) if (ret) {
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 208) pr_err("%s:ioctl failed\n", __func__);
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 209) return ret;
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 210) }
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 211)
d00b8490439fd (Arpita Banerjee 2013-06-11 19:24:20 -0700 212) if (notify > NOTIFY_UPDATE_POWER_OFF)
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 213) return -EINVAL;
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 214)
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 215) if (notify == NOTIFY_UPDATE_INIT) {
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 216) mutex_lock(&mfd->update.lock);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 217) mfd->update.init_done = true;
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 218) mutex_unlock(&mfd->update.lock);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 219) ret = 1;
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 220) } else if (notify == NOTIFY_UPDATE_DEINIT) {
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 221) mutex_lock(&mfd->update.lock);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 222) mfd->update.init_done = false;
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 223) mutex_unlock(&mfd->update.lock);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 224) complete(&mfd->update.comp);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 225) complete(&mfd->no_update.comp);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 226) ret = 1;
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 227) } else if (mfd->update.is_suspend) {
dab2b4d7faa88 (Krishna Chaitanya Parimi 2014-01-03 18:00:50 +0530 228) to_user = NOTIFY_TYPE_SUSPEND;
dab2b4d7faa88 (Krishna Chaitanya Parimi 2014-01-03 18:00:50 +0530 229) mfd->update.is_suspend = 0;
dab2b4d7faa88 (Krishna Chaitanya Parimi 2014-01-03 18:00:50 +0530 230) ret = 1;
dab2b4d7faa88 (Krishna Chaitanya Parimi 2014-01-03 18:00:50 +0530 231) } else if (notify == NOTIFY_UPDATE_START) {
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 232) mutex_lock(&mfd->update.lock);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 233) if (mfd->update.init_done)
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 234) reinit_completion(&mfd->update.comp);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 235) else {
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 236) mutex_unlock(&mfd->update.lock);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 237) pr_err("notify update start called without init\n");
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 238) return -EINVAL;
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 239) }
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 240) mfd->update.ref_count++;
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 241) mutex_unlock(&mfd->update.lock);
7b01cf201c4e8 (Krishna Chaitanya Parimi 2014-02-28 18:48:01 +0530 242) ret = wait_for_completion_interruptible_timeout(
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 243) &mfd->update.comp, 4 * HZ);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 244) mutex_lock(&mfd->update.lock);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 245) mfd->update.ref_count--;
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 246) mutex_unlock(&mfd->update.lock);
a637447cc1a8a (Krishna Chaitanya Parimi 2013-10-03 20:51:41 +0530 247) to_user = (unsigned int)mfd->update.value;
033ee7261a03c (Krishna Chaitanya Parimi 2013-12-30 09:32:58 +0530 248) if (mfd->update.type == NOTIFY_TYPE_SUSPEND) {
033ee7261a03c (Krishna Chaitanya Parimi 2013-12-30 09:32:58 +0530 249) to_user = (unsigned int)mfd->update.type;
033ee7261a03c (Krishna Chaitanya Parimi 2013-12-30 09:32:58 +0530 250) ret = 1;
033ee7261a03c (Krishna Chaitanya Parimi 2013-12-30 09:32:58 +0530 251) }
d00b8490439fd (Arpita Banerjee 2013-06-11 19:24:20 -0700 252) } else if (notify == NOTIFY_UPDATE_STOP) {
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 253) mutex_lock(&mfd->update.lock);
acef8428426c5 (Naseer Ahmed 2016-11-09 12:14:31 -0500 254) if (mfd->update.init_done) {
acef8428426c5 (Naseer Ahmed 2016-11-09 12:14:31 -0500 255) mutex_unlock(&mfd->update.lock);
acef8428426c5 (Naseer Ahmed 2016-11-09 12:14:31 -0500 256) mutex_lock(&mfd->no_update.lock);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 257) reinit_completion(&mfd->no_update.comp);
acef8428426c5 (Naseer Ahmed 2016-11-09 12:14:31 -0500 258) } else {
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 259) mutex_unlock(&mfd->update.lock);
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 260) pr_err("notify update stop called without init\n");
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 261) return -EINVAL;
1f137a2c70474 (Krishna Chaitanya Parimi 2015-02-10 23:37:05 -0800 262) }
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 263) mfd->no_update.ref_count++;
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 264) mutex_unlock(&mfd->no_update.lock);
7b01cf201c4e8 (Krishna Chaitanya Parimi 2014-02-28 18:48:01 +0530 265) ret = wait_for_completion_interruptible_timeout(
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 266) &mfd->no_update.comp, 4 * HZ);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 267) mutex_lock(&mfd->no_update.lock);
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 268) mfd->no_update.ref_count--;
ee779a5bd98d4 (Ping Li 2014-03-17 10:06:47 -0700 269) mutex_unlock(&mfd->no_update.lock);
a637447cc1a8a (Krishna Chaitanya Parimi 2013-10-03 20:51:41 +0530 270) to_user = (unsigned int)mfd->no_update.value;
d00b8490439fd (Arpita Banerjee 2013-06-11 19:24:20 -0700 271) } else {
49036d7c0ebbd (Aravind Venkateswaran 2014-08-01 17:20:51 -0700 272) if (mdss_fb_is_power_on(mfd)) {
309facd77e16d (Terence Hampson 2014-08-28 15:18:03 -0400 273) reinit_completion(&mfd->power_off_comp);
7b01cf201c4e8 (Krishna Chaitanya Parimi 2014-02-28 18:48:01 +0530 274) ret = wait_for_completion_interruptible_timeout(
d00b8490439fd (Arpita Banerjee 2013-06-11 19:24:20 -0700 275) &mfd->power_off_comp, 1 * HZ);
d00b8490439fd (Arpita Banerjee 2013-06-11 19:24:20 -0700 276) }
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 277) }
d00b8490439fd (Arpita Banerjee 2013-06-11 19:24:20 -0700 278)
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 279) if (ret == 0)
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 280) ret = -ETIMEDOUT;
c0129578c5b78 (Carl Vanderlip 2013-05-31 11:55:22 -0700 281) else if (ret > 0)
dabc1a3dddd3f (Benet Clark 2014-06-24 18:49:53 -0700 282) ret = copy_to_user(argp, &to_user, sizeof(unsigned int));
5c39398cd9184 (Carl Vanderlip 2013-05-30 11:48:48 -0700 283) return ret;
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 284) }
7b2726a393f13 (Carl Vanderlip 2012-08-28 12:03:28 -0700 285)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 286) #if defined(CONFIG_MACH_LGE)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 287) #define BL_ENABLE_TIME_SIZE 19
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 288) char bl_enable_time[] = "01-01 00:00:00.000";
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 289) int prev_value = 0;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 290)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 291) static struct dentry *debugfs_bl_enable_time;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 292)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 293) static int bl_enable_time_show(struct seq_file *m, void *unused)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 294) {
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 295) seq_printf(m, "%s\n", bl_enable_time);
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 296) return 0;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 297) }
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 298)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 299) static int bl_enable_time_open(struct inode *inode, struct file *file)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 300) {
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 301) return single_open(file, bl_enable_time_show, NULL);
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 302) }
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 303)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 304) static const struct file_operations bl_enable_time_fops = {
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 305) .open = bl_enable_time_open,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 306) .read = seq_read,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 307) .llseek = seq_lseek,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 308) };
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 309) #endif
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 310)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 311) static int lcd_backlight_registered;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 312)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 313) #if defined(CONFIG_LGE_DISPLAY_VIDEO_ENHANCEMENT)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 314) void mdss_fb_set_bl_brightness(struct led_classdev *led_cdev,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 315) enum led_brightness value)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 316) #else
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 317) static void mdss_fb_set_bl_brightness(struct led_classdev *led_cdev,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 318) enum led_brightness value)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 319) #endif /* CONFIG_LGE_DISPLAY_VIDEO_ENHANCEMENT */
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 320) {
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 321) struct msm_fb_data_type *mfd = dev_get_drvdata(led_cdev->dev->parent);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 322) int bl_lvl;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 323)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 324) #if defined(CONFIG_MACH_LGE)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 325) struct timespec time;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 326) struct tm tmresult;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 327) int create_debugfs = 0;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 328) #endif
a506802723703 (Shimrit Malichi 2015-01-12 10:37:10 +0200 329) if (mfd->boot_notification_led) {
a506802723703 (Shimrit Malichi 2015-01-12 10:37:10 +0200 330) led_trigger_event(mfd->boot_notification_led, 0);
a506802723703 (Shimrit Malichi 2015-01-12 10:37:10 +0200 331) mfd->boot_notification_led = NULL;
a506802723703 (Shimrit Malichi 2015-01-12 10:37:10 +0200 332) }
a506802723703 (Shimrit Malichi 2015-01-12 10:37:10 +0200 333)
2d9ff87c8c075 (Ping Li 2013-11-14 03:33:12 -0500 334) if (value > mfd->panel_info->brightness_max)
2d9ff87c8c075 (Ping Li 2013-11-14 03:33:12 -0500 335) value = mfd->panel_info->brightness_max;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 336)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 337)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 338) /* This maps android backlight level 0 to 255 into
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 339) driver backlight level 0 to bl_max with rounding */
fd31eb58f8449 (Carl Vanderlip 2013-05-19 12:08:33 -0700 340) MDSS_BRIGHT_TO_BL(bl_lvl, value, mfd->panel_info->bl_max,
2d9ff87c8c075 (Ping Li 2013-11-14 03:33:12 -0500 341) mfd->panel_info->brightness_max);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 342) if (!bl_lvl && value)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 343) bl_lvl = 1;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 344)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 345) if (!IS_CALIB_MODE_BL(mfd) &&
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 346) (!mfd->ext_bl_ctrl || !value || !mfd->bl_level)) {
89d9152c0e769 (Carl Vanderlip 2013-05-17 13:52:53 -0700 347) mutex_lock(&mfd->bl_lock);
89d9152c0e769 (Carl Vanderlip 2013-05-17 13:52:53 -0700 348) mdss_fb_set_backlight(mfd, bl_lvl);
89d9152c0e769 (Carl Vanderlip 2013-05-17 13:52:53 -0700 349) mutex_unlock(&mfd->bl_lock);
89d9152c0e769 (Carl Vanderlip 2013-05-17 13:52:53 -0700 350) }
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 351)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 352) #if defined(CONFIG_MACH_LGE)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 353) if (!create_debugfs) {
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 354) debugfs_bl_enable_time = debugfs_create_file("bl_enable_time",
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 355) S_IRUGO, NULL, NULL,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 356) &bl_enable_time_fops);
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 357) create_debugfs = 1;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 358) }
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 359) if (value > 0 && prev_value == 0) {
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 360) time = __current_kernel_time();
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 361) time_to_tm(time.tv_sec, sys_tz.tz_minuteswest * 60 * (-1),
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 362) &tmresult);
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 363) snprintf(bl_enable_time,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 364) BL_ENABLE_TIME_SIZE,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 365) "%02d-%02d %02d:%02d:%02d.%03lu\n",
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 366) tmresult.tm_mon+1,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 367) tmresult.tm_mday,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 368) tmresult.tm_hour,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 369) tmresult.tm_min,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 370) tmresult.tm_sec,
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 371) (unsigned long) time.tv_nsec/1000000);
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 372) printk(KERN_EMERG "bl_enable_time:%s", bl_enable_time);
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 373) }
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 374) prev_value = value;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 375) #endif
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 376)
91939509bccbc (Xu Yang 2017-03-23 15:58:19 +0800 377) mfd->bl_level_usr = bl_lvl;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 378) }
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 379)
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 380) static enum led_brightness mdss_fb_get_bl_brightness(
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 381) struct led_classdev *led_cdev)
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 382) {
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 383) #if defined(CONFIG_LGE_DISPLAY_COMMON)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 384) return led_cdev->brightness;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 385) #else /* qct original */
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 386) struct msm_fb_data_type *mfd = dev_get_drvdata(led_cdev->dev->parent);
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 387) enum led_brightness value;
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 388)
91939509bccbc (Xu Yang 2017-03-23 15:58:19 +0800 389) MDSS_BL_TO_BRIGHT(value, mfd->bl_level_usr, mfd->panel_info->bl_max,
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 390) mfd->panel_info->brightness_max);
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 391)
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 392) return value;
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 393) #endif
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 394) }
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 395)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 396) #if defined(CONFIG_LGE_DISPLAY_VIDEO_ENHANCEMENT)
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 397) struct led_classdev backlight_led = {
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 398) #else
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 399) static struct led_classdev backlight_led = {
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 400) #endif /* CONFIG_LGE_DISPLAY_VIDEO_ENHANCEMENT */
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 401) .name = "lcd-backlight",
db74d3e4abfd7 (Shivaraj Shetty 2015-06-05 12:04:56 +0530 402) .brightness = MDSS_MAX_BL_BRIGHTNESS / 2,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 403) .brightness_set = mdss_fb_set_bl_brightness,
6baec9abc01da (Xu Yang 2017-02-15 09:29:27 +0800 404) .brightness_get = mdss_fb_get_bl_brightness,
7c78b51226bf2 (Adrian Salido-Moreno 2013-10-01 12:15:15 -0700 405) .max_brightness = MDSS_MAX_BL_BRIGHTNESS,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 406) };
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 407)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 408) static ssize_t mdss_fb_get_type(struct device *dev,
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 409) struct device_attribute *attr, char *buf)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 410) {
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 411) ssize_t ret = 0;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 412) struct fb_info *fbi = dev_get_drvdata(dev);
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 413) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 414)
059a1e16bbdac (Adrian Salido-Moreno 2012-11-14 17:16:03 -0800 415) switch (mfd->panel.type) {
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 416) case NO_PANEL:
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 417) ret = snprintf(buf, PAGE_SIZE, "no panel\n");
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 418) break;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 419) case HDMI_PANEL:
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 420) ret = snprintf(buf, PAGE_SIZE, "hdmi panel\n");
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 421) break;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 422) case LVDS_PANEL:
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 423) ret = snprintf(buf, PAGE_SIZE, "lvds panel\n");
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 424) break;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 425) case DTV_PANEL:
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 426) ret = snprintf(buf, PAGE_SIZE, "dtv panel\n");
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 427) break;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 428) case MIPI_VIDEO_PANEL:
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 429) ret = snprintf(buf, PAGE_SIZE, "mipi dsi video panel\n");
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 430) break;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 431) case MIPI_CMD_PANEL:
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 432) ret = snprintf(buf, PAGE_SIZE, "mipi dsi cmd panel\n");
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 433) break;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 434) case WRITEBACK_PANEL:
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 435) ret = snprintf(buf, PAGE_SIZE, "writeback panel\n");
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 436) break;
cfabc2bcfe357 (Chandan Uddaraju 2016-07-26 16:01:54 -0700 437) case DP_PANEL:
cfabc2bcfe357 (Chandan Uddaraju 2016-07-26 16:01:54 -0700 438) ret = snprintf(buf, PAGE_SIZE, "dp panel\n");
bd18c2ef3365c (Asaf Penso 2012-10-16 21:47:59 +0200 439) break;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 440) default:
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 441) ret = snprintf(buf, PAGE_SIZE, "unknown panel\n");
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 442) break;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 443) }
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 444)
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 445) return ret;
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 446) }
a0f6b50eb63bf (Adrian Salido-Moreno 2012-05-29 15:36:08 -0700 447)
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 448) static int mdss_fb_get_panel_xres(struct mdss_panel_info *pinfo)
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 449) {
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 450) struct mdss_panel_data *pdata;
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 451) int xres;
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 452)
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 453) pdata = container_of(pinfo, struct mdss_panel_data, panel_info);
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 454)
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 455) xres = pinfo->xres;
649c91d1cd61d (Adrian Salido-Moreno 2015-04-23 18:33:56 -0700 456) if (pdata->next && pdata->next->active)
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 457) xres += mdss_fb_get_panel_xres(&pdata->next->panel_info);
9f52ca1ecbdf6 (Ashish Garg 2017-03-26 20:19:25 +0530 458) if (pinfo->split_link_enabled)
9f52ca1ecbdf6 (Ashish Garg 2017-03-26 20:19:25 +0530 459) xres = xres * pinfo->mipi.num_of_sublinks;
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 460) return xres;
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 461) }
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 462)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 463) static inline int mdss_fb_validate_split(int left, int right,
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 464) struct msm_fb_data_type *mfd)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 465) {
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 466) int rc = -EINVAL;
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 467) u32 panel_xres = mdss_fb_get_panel_xres(mfd->panel_info);
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 468)
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 469) pr_debug("%pS: split_mode = %d left=%d right=%d panel_xres=%d\n",
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 470) __builtin_return_address(0), mfd->split_mode,
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 471) left, right, panel_xres);
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 472)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 473) /* more validate condition could be added if needed */
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 474) if (left && right) {
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 475) if (panel_xres == left + right) {
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 476) mfd->split_fb_left = left;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 477) mfd->split_fb_right = right;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 478) rc = 0;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 479) }
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 480) } else {
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 481) if (mfd->split_mode == MDP_DUAL_LM_DUAL_DISPLAY) {
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 482) mfd->split_fb_left = mfd->panel_info->xres;
44f6d6b7b256c (Adrian Salido-Moreno 2014-07-23 13:10:15 -0700 483) mfd->split_fb_right = panel_xres - mfd->split_fb_left;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 484) rc = 0;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 485) } else {
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 486) mfd->split_fb_left = mfd->split_fb_right = 0;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 487) }
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 488) }
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 489)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 490) return rc;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 491) }
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 492)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 493) static ssize_t mdss_fb_store_split(struct device *dev,
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 494) struct device_attribute *attr, const char *buf, size_t len)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 495) {
ecfab603f9dce (Dhaval Patel 2015-03-23 22:29:02 -0700 496) int data[2] = {0};
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 497) struct fb_info *fbi = dev_get_drvdata(dev);
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 498) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 499)
351537d51f5b8 (Ujwal Patel 2015-06-03 11:20:44 -0700 500) if (2 != sscanf(buf, "%d %d", &data[0], &data[1]))
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 501) pr_debug("Not able to read split values\n");
351537d51f5b8 (Ujwal Patel 2015-06-03 11:20:44 -0700 502) else if (!mdss_fb_validate_split(data[0], data[1], mfd))
351537d51f5b8 (Ujwal Patel 2015-06-03 11:20:44 -0700 503) pr_debug("split left=%d right=%d\n", data[0], data[1]);
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 504)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 505) return len;
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 506) }
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 507)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 508) static ssize_t mdss_fb_show_split(struct device *dev,
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 509) struct device_attribute *attr, char *buf)
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 510) {
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 511) ssize_t ret = 0;
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 512) struct fb_info *fbi = dev_get_drvdata(dev);
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 513) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 514) ret = snprintf(buf, PAGE_SIZE, "%d %d\n",
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 515) mfd->split_fb_left, mfd->split_fb_right);
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 516) return ret;
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 517) }
d07cc414c46bf (Huaibin Yang 2013-06-13 17:05:23 -0700 518)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 519) static void mdss_fb_get_split(struct msm_fb_data_type *mfd)
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 520) {
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 521) if ((mfd->split_mode == MDP_SPLIT_MODE_NONE) &&
65a9c296806c4 (Adrian Salido-Moreno 2015-04-23 18:36:17 -0700 522) (mfd->split_fb_left && mfd->split_fb_right))
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 523) mfd->split_mode = MDP_DUAL_LM_SINGLE_DISPLAY;
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 524)
351537d51f5b8 (Ujwal Patel 2015-06-03 11:20:44 -0700 525) pr_debug("split fb%d left=%d right=%d mode=%d\n", mfd->index,
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 526) mfd->split_fb_left, mfd->split_fb_right, mfd->split_mode);
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 527) }
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 528)
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 529) static ssize_t mdss_fb_get_src_split_info(struct device *dev,
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 530) struct device_attribute *attr, char *buf)
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 531) {
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 532) int ret = 0;
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 533) struct fb_info *fbi = dev_get_drvdata(dev);
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 534) struct msm_fb_data_type *mfd = fbi->par;
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 535)
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 536) if (is_split_lm(mfd) && (fbi->var.yres > fbi->var.xres)) {
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 537) pr_debug("always split mode enabled\n");
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 538) ret = scnprintf(buf, PAGE_SIZE,
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 539) "src_split_always\n");
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 540) }
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 541)
ffaf975ec3ace (Ujwal Patel 2014-11-14 15:02:31 -0800 542) return ret;
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 543) }
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 544)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 545) static ssize_t mdss_fb_get_thermal_level(struct device *dev,
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 546) struct device_attribute *attr, char *buf)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 547) {
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 548) struct fb_info *fbi = dev_get_drvdata(dev);
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 549) struct msm_fb_data_type *mfd = fbi->par;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 550) int ret;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 551)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 552) ret = scnprintf(buf, PAGE_SIZE, "thermal_level=%d\n",
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 553) mfd->thermal_level);
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 554)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 555) return ret;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 556) }
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 557)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 558) static ssize_t mdss_fb_set_thermal_level(struct device *dev,
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 559) struct device_attribute *attr, const char *buf, size_t count)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 560) {
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 561) struct fb_info *fbi = dev_get_drvdata(dev);
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 562) struct msm_fb_data_type *mfd = fbi->par;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 563) int rc = 0;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 564) int thermal_level = 0;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 565)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 566) rc = kstrtoint(buf, 10, &thermal_level);
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 567) if (rc) {
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 568) pr_err("kstrtoint failed. rc=%d\n", rc);
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 569) return rc;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 570) }
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 571)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 572) pr_debug("Thermal level set to %d\n", thermal_level);
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 573) mfd->thermal_level = thermal_level;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 574) sysfs_notify(&mfd->fbi->dev->kobj, NULL, "msm_fb_thermal_level");
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 575)
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 576) return count;
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 577) }
fe4c3c2f7531c (Shivaraj Shetty 2014-07-03 11:35:29 +0530 578)
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 579) static ssize_t mdss_mdp_show_blank_event(struct device *dev,
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 580) struct device_attribute *attr, char *buf)
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 581) {
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 582) struct fb_info *fbi = dev_get_drvdata(dev);
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 583) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 584) int ret;
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 585)
b9095befda98a (Aravind Venkateswaran 2014-07-28 23:24:46 -0700 586) pr_debug("fb%d panel_power_state = %d\n", mfd->index,
b9095befda98a (Aravind Venkateswaran 2014-07-28 23:24:46 -0700 587) mfd->panel_power_state);
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 588) ret = scnprintf(buf, PAGE_SIZE, "panel_power_on = %d\n",
b9095befda98a (Aravind Venkateswaran 2014-07-28 23:24:46 -0700 589) mfd->panel_power_state);
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 590)
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 591) return ret;
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 592) }
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 593)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 594) static void __mdss_fb_idle_notify_work(struct work_struct *work)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 595) {
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 596) struct delayed_work *dw = to_delayed_work(work);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 597) struct msm_fb_data_type *mfd = container_of(dw, struct msm_fb_data_type,
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 598) idle_notify_work);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 599)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 600) /* Notify idle-ness here */
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 601) pr_debug("Idle timeout %dms expired!\n", mfd->idle_time);
35589945c50c7 (Ujwal Patel 2015-02-13 12:38:24 -0800 602) if (mfd->idle_time)
35589945c50c7 (Ujwal Patel 2015-02-13 12:38:24 -0800 603) sysfs_notify(&mfd->fbi->dev->kobj, NULL, "idle_notify");
20eafef76e5ba (Vinu Deokaran 2015-07-16 16:14:30 -0700 604) mfd->idle_state = MDSS_FB_IDLE;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 605) }
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 606)
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 607)
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 608) static ssize_t mdss_fb_get_fps_info(struct device *dev,
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 609) struct device_attribute *attr, char *buf)
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 610) {
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 611) struct fb_info *fbi = dev_get_drvdata(dev);
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 612) struct msm_fb_data_type *mfd = fbi->par;
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 613) unsigned int fps_int, fps_float;
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 614)
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 615) if (mfd->panel_power_state != MDSS_PANEL_POWER_ON)
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 616) mfd->fps_info.measured_fps = 0;
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 617) fps_int = (unsigned int) mfd->fps_info.measured_fps;
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 618) fps_float = do_div(fps_int, 10);
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 619) return scnprintf(buf, PAGE_SIZE, "%d.%d\n", fps_int, fps_float);
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 620)
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 621) }
90fd65ba93d5c (Krishna Manikandan 2016-12-28 17:58:39 +0530 622)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 623) static ssize_t mdss_fb_get_idle_time(struct device *dev,
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 624) struct device_attribute *attr, char *buf)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 625) {
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 626) struct fb_info *fbi = dev_get_drvdata(dev);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 627) struct msm_fb_data_type *mfd = fbi->par;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 628) int ret;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 629)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 630) ret = scnprintf(buf, PAGE_SIZE, "%d", mfd->idle_time);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 631)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 632) return ret;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 633) }
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 634)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 635) static ssize_t mdss_fb_set_idle_time(struct device *dev,
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 636) struct device_attribute *attr, const char *buf, size_t count)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 637) {
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 638) struct fb_info *fbi = dev_get_drvdata(dev);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 639) struct msm_fb_data_type *mfd = fbi->par;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 640) int rc = 0;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 641) int idle_time = 0;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 642)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 643) rc = kstrtoint(buf, 10, &idle_time);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 644) if (rc) {
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 645) pr_err("kstrtoint failed. rc=%d\n", rc);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 646) return rc;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 647) }
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 648)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 649) pr_debug("Idle time = %d\n", idle_time);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 650) mfd->idle_time = idle_time;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 651)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 652) return count;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 653) }
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 654)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 655) static ssize_t mdss_fb_get_idle_notify(struct device *dev,
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 656) struct device_attribute *attr, char *buf)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 657) {
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 658) struct fb_info *fbi = dev_get_drvdata(dev);
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 659) struct msm_fb_data_type *mfd = fbi->par;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 660) int ret;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 661)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 662) ret = scnprintf(buf, PAGE_SIZE, "%s",
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 663) work_busy(&mfd->idle_notify_work.work) ? "no" : "yes");
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 664)
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 665) return ret;
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 666) }
824b24b09cd46 (Aravind Venkateswaran 2014-02-06 18:27:27 -0800 667)
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 668) static ssize_t mdss_fb_get_panel_info(struct device *dev,
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 669) struct device_attribute *attr, char *buf)
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 670) {
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 671) struct fb_info *fbi = dev_get_drvdata(dev);
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 672) struct msm_fb_data_type *mfd = fbi->par;
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 673) struct mdss_panel_info *pinfo = mfd->panel_info;
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 674) int ret;
3d764869b9039 (Ramkumar Radhakrishnan 2016-07-13 14:56:31 -0700 675) bool dfps_porch_mode = false;
3d764869b9039 (Ramkumar Radhakrishnan 2016-07-13 14:56:31 -0700 676)
3d764869b9039 (Ramkumar Radhakrishnan 2016-07-13 14:56:31 -0700 677) if (pinfo->dfps_update == DFPS_IMMEDIATE_PORCH_UPDATE_MODE_HFP ||
3d764869b9039 (Ramkumar Radhakrishnan 2016-07-13 14:56:31 -0700 678) pinfo->dfps_update == DFPS_IMMEDIATE_PORCH_UPDATE_MODE_VFP)
3d764869b9039 (Ramkumar Radhakrishnan 2016-07-13 14:56:31 -0700 679) dfps_porch_mode = true;
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 680)
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 681) ret = scnprintf(buf, PAGE_SIZE,
3a28acf18f5bf (Kuogee Hsieh 2014-05-01 16:02:48 -0700 682) "pu_en=%d\nxstart=%d\nwalign=%d\nystart=%d\nhalign=%d\n"
a3888ae72db32 (Jeevan Shriram 2014-09-10 15:19:01 -0700 683) "min_w=%d\nmin_h=%d\nroi_merge=%d\ndyn_fps_en=%d\n"
b9a2fe27d1ed7 (Dhaval Patel 2014-10-20 12:30:02 -0700 684) "min_fps=%d\nmax_fps=%d\npanel_name=%s\n"
f472340bf77bf (Sandeep Panda 2015-11-07 00:49:57 +0530 685) "primary_panel=%d\nis_pluggable=%d\ndisplay_id=%s\n"
3d764869b9039 (Ramkumar Radhakrishnan 2016-07-13 14:56:31 -0700 686) "is_cec_supported=%d\nis_pingpong_split=%d\n"
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 687) "dfps_porch_mode=%d\npu_roi_cnt=%d\ndual_dsi=%d\n"
19a9088e54e87 (Ray Zhang 2016-11-28 15:01:55 +0800 688) "is_hdr_enabled=%d\npeak_brightness=%d\n"
19a9088e54e87 (Ray Zhang 2016-11-28 15:01:55 +0800 689) "blackness_level=%d\naverage_brightness=%d\n"
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 690) "white_chromaticity_x=%d\nwhite_chromaticity_y=%d\n"
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 691) "red_chromaticity_x=%d\nred_chromaticity_y=%d\n"
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 692) "green_chromaticity_x=%d\ngreen_chromaticity_y=%d\n"
c388e8fc0677f (Krishna Chaitanya Devarakonda 2016-11-21 21:52:35 +0530 693) "blue_chromaticity_x=%d\nblue_chromaticity_y=%d\n"
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 694) "panel_orientation=%d\n",
5e6e59afed340 (Veera Sundaram Sankaran 2016-04-21 14:41:44 -0700 695) pinfo->partial_update_enabled,
5e6e59afed340 (Veera Sundaram Sankaran 2016-04-21 14:41:44 -0700 696) pinfo->roi_alignment.xstart_pix_align,
5e6e59afed340 (Veera Sundaram Sankaran 2016-04-21 14:41:44 -0700 697) pinfo->roi_alignment.width_pix_align,
5e6e59afed340 (Veera Sundaram Sankaran 2016-04-21 14:41:44 -0700 698) pinfo->roi_alignment.ystart_pix_align,
5e6e59afed340 (Veera Sundaram Sankaran 2016-04-21 14:41:44 -0700 699) pinfo->roi_alignment.height_pix_align,
5e6e59afed340 (Veera Sundaram Sankaran 2016-04-21 14:41:44 -0700 700) pinfo->roi_alignment.min_width,
5e6e59afed340 (Veera Sundaram Sankaran 2016-04-21 14:41:44 -0700 701) pinfo->roi_alignment.min_height,
5e6e59afed340 (Veera Sundaram Sankaran 2016-04-21 14:41:44 -0700 702) pinfo->partial_update_roi_merge,
a5d404445a8ef (Zohaib Alam 2014-09-26 13:29:03 -0400 703) pinfo->dynamic_fps, pinfo->min_fps, pinfo->max_fps,
61c19bb151cbe (Ajay Singh Parmar 2015-03-23 23:23:13 -0700 704) pinfo->panel_name, pinfo->is_prim_panel,
f472340bf77bf (Sandeep Panda 2015-11-07 00:49:57 +0530 705) pinfo->is_pluggable, pinfo->display_id,
3d764869b9039 (Ramkumar Radhakrishnan 2016-07-13 14:56:31 -0700 706) pinfo->is_cec_supported, is_pingpong_split(mfd),
d5da41a9807d9 (Veera Sundaram Sankaran 2016-10-10 17:14:32 -0700 707) dfps_porch_mode, pinfo->partial_update_enabled,
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 708) is_panel_split(mfd), pinfo->hdr_properties.hdr_enabled,
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 709) pinfo->hdr_properties.peak_brightness,
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 710) pinfo->hdr_properties.blackness_level,
19a9088e54e87 (Ray Zhang 2016-11-28 15:01:55 +0800 711) pinfo->hdr_properties.avg_brightness,
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 712) pinfo->hdr_properties.display_primaries[0],
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 713) pinfo->hdr_properties.display_primaries[1],
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 714) pinfo->hdr_properties.display_primaries[2],
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 715) pinfo->hdr_properties.display_primaries[3],
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 716) pinfo->hdr_properties.display_primaries[4],
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 717) pinfo->hdr_properties.display_primaries[5],
1e54d7815f415 (Shashank Babu Chinta Venkata 2016-11-09 19:58:26 -0800 718) pinfo->hdr_properties.display_primaries[6],
c388e8fc0677f (Krishna Chaitanya Devarakonda 2016-11-21 21:52:35 +0530 719) pinfo->hdr_properties.display_primaries[7],
be48303843a06 (SGCMarkus 2019-07-09 09:54:59 +0200 720) pinfo->panel_orientation);
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 721)
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 722) return ret;
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 723) }
a3888ae72db32 (Jeevan Shriram 2014-09-10 15:19:01 -0700 724)
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 725) static ssize_t mdss_fb_get_panel_status(struct device *dev,
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 726) struct device_attribute *attr, char *buf)
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 727) {
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 728) struct fb_info *fbi = dev_get_drvdata(dev);
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 729) struct msm_fb_data_type *mfd = fbi->par;
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 730) int ret;
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 731) int panel_status;
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 732)
3c94a189b5c38 (Dhaval Patel 2015-12-17 14:25:17 -0800 733) if (mdss_panel_is_power_off(mfd->panel_power_state)) {
3c94a189b5c38 (Dhaval Patel 2015-12-17 14:25:17 -0800 734) ret = scnprintf(buf, PAGE_SIZE, "panel_status=%s\n", "suspend");
3c94a189b5c38 (Dhaval Patel 2015-12-17 14:25:17 -0800 735) } else {
3c94a189b5c38 (Dhaval Patel 2015-12-17 14:25:17 -0800 736) panel_status = mdss_fb_send_panel_event(mfd,
e871e6fd4a447 (Sandeep Panda 2017-04-13 18:00:54 +0530 737) MDSS_EVENT_DSI_PANEL_STATUS, mfd);
3c94a189b5c38 (Dhaval Patel 2015-12-17 14:25:17 -0800 738) ret = scnprintf(buf, PAGE_SIZE, "panel_status=%s\n",
3c94a189b5c38 (Dhaval Patel 2015-12-17 14:25:17 -0800 739) panel_status > 0 ? "alive" : "dead");
3c94a189b5c38 (Dhaval Patel 2015-12-17 14:25:17 -0800 740) }
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 741)
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 742) return ret;
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 743) }
7937cdefcf8bf (Ray Zhang 2015-01-08 14:53:11 +0800 744)
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 745) static ssize_t mdss_fb_force_panel_dead(struct device *dev,
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 746) struct device_attribute *attr, const char *buf, size_t len)
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 747) {
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 748) struct fb_info *fbi = dev_get_drvdata(dev);
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 749) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 750) struct mdss_panel_data *pdata;
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 751)
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 752) pdata = dev_get_platdata(&mfd->pdev->dev);
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 753) if (!pdata) {
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 754) pr_err("no panel connected!\n");
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 755) return len;
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 756) }
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 757)
b11c90dac54ac (Shalini Krishnamoorthi 2016-06-30 14:00:04 -0700 758) if (kstrtouint(buf, 0, &pdata->panel_info.panel_force_dead))
b11c90dac54ac (Shalini Krishnamoorthi 2016-06-30 14:00:04 -0700 759) pr_err("kstrtouint buf error!\n");
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 760)
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 761) return len;
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 762) }
7aa48794fcb1e (Huaibin Yang 2015-02-11 14:13:07 -0800 763)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 764) /*
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 765) * mdss_fb_blanking_mode_switch() - Function triggers dynamic mode switch
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 766) * @mfd: Framebuffer data structure for display
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 767) * @mode: Enabled/Disable LowPowerMode
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 768) * 1: Enter into LowPowerMode
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 769) * 0: Exit from LowPowerMode
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 770) *
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 771) * This Function dynamically switches to and from video mode. This
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 772) * swtich involves the panel turning off backlight during trantision.
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 773) */
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 774) static int mdss_fb_blanking_mode_switch(struct msm_fb_data_type *mfd, int mode)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 775) {
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 776) int ret = 0;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 777) u32 bl_lvl = 0;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 778) struct mdss_panel_info *pinfo = NULL;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 779) struct mdss_panel_data *pdata;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 780)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 781) if (!mfd || !mfd->panel_info)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 782) return -EINVAL;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 783)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 784) pinfo = mfd->panel_info;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 785)
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 786) if (!pinfo->mipi.dms_mode) {
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 787) pr_warn("Panel does not support dynamic switch!\n");
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 788) return 0;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 789) }
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 790)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 791) if (mode == pinfo->mipi.mode) {
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 792) pr_debug("Already in requested mode!\n");
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 793) return 0;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 794) }
76c82ae2a89e1 (Sandeep Panda 2014-07-18 10:51:40 +0530 795) pr_debug("Enter mode: %d\n", mode);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 796)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 797) pdata = dev_get_platdata(&mfd->pdev->dev);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 798)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 799) pdata->panel_info.dynamic_switch_pending = true;
26bebe99120eb (Ujwal Patel 2015-04-22 14:51:12 -0700 800) ret = mdss_fb_pan_idle(mfd);
26bebe99120eb (Ujwal Patel 2015-04-22 14:51:12 -0700 801) if (ret) {
26bebe99120eb (Ujwal Patel 2015-04-22 14:51:12 -0700 802) pr_err("mdss_fb_pan_idle for fb%d failed. ret=%d\n",
26bebe99120eb (Ujwal Patel 2015-04-22 14:51:12 -0700 803) mfd->index, ret);
26bebe99120eb (Ujwal Patel 2015-04-22 14:51:12 -0700 804) pdata->panel_info.dynamic_switch_pending = false;
26bebe99120eb (Ujwal Patel 2015-04-22 14:51:12 -0700 805) return ret;
26bebe99120eb (Ujwal Patel 2015-04-22 14:51:12 -0700 806) }
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 807)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 808) mutex_lock(&mfd->bl_lock);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 809) bl_lvl = mfd->bl_level;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 810) mdss_fb_set_backlight(mfd, 0);
0f38e4eaebf47 (Shivaraj Shetty 2014-06-10 21:28:36 +0530 811) mutex_unlock(&mfd->bl_lock);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 812)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 813) lock_fb_info(mfd->fbi);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 814) ret = mdss_fb_blank_sub(FB_BLANK_POWERDOWN, mfd->fbi,
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 815) mfd->op_enable);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 816) if (ret) {
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 817) pr_err("can't turn off display!\n");
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 818) unlock_fb_info(mfd->fbi);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 819) return ret;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 820) }
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 821)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 822) mfd->op_enable = false;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 823)
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 824) ret = mfd->mdp.configure_panel(mfd, mode, 1);
07930a15004de (Terence Hampson 2015-01-21 13:36:24 -0500 825) mdss_fb_set_mdp_sync_pt_threshold(mfd, mfd->panel.type);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 826)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 827) mfd->op_enable = true;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 828)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 829) ret = mdss_fb_blank_sub(FB_BLANK_UNBLANK, mfd->fbi,
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 830) mfd->op_enable);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 831) if (ret) {
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 832) pr_err("can't turn on display!\n");
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 833) unlock_fb_info(mfd->fbi);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 834) return ret;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 835) }
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 836) unlock_fb_info(mfd->fbi);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 837)
0f38e4eaebf47 (Shivaraj Shetty 2014-06-10 21:28:36 +0530 838) mutex_lock(&mfd->bl_lock);
f97adf46f51a0 (Dhaval Patel 2015-10-21 10:55:51 -0700 839) mfd->allow_bl_update = true;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 840) mdss_fb_set_backlight(mfd, bl_lvl);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 841) mutex_unlock(&mfd->bl_lock);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 842)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 843) pdata->panel_info.dynamic_switch_pending = false;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 844) pdata->panel_info.is_lpm_mode = mode ? 1 : 0;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 845)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 846) if (ret) {
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 847) pr_err("can't turn on display!\n");
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 848) return ret;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 849) }
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 850)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 851) pr_debug("Exit mode: %d\n", mode);
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 852)
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 853) return 0;
41211cdb1fff1 (Sandeep Panda 2014-04-09 17:15:37 +0530 854) }
869c067a6d347 (Jeykumar Sankaran 2014-03-06 12:12:24 -0800 855)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 856) static ssize_t mdss_fb_change_dfps_mode(struct device *dev,
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 857) struct device_attribute *attr, const char *buf, size_t len)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 858) {
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 859) struct fb_info *fbi = dev_get_drvdata(dev);
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 860) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 861) struct mdss_panel_data *pdata;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 862) struct mdss_panel_info *pinfo;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 863) u32 dfps_mode;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 864)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 865) pdata = dev_get_platdata(&mfd->pdev->dev);
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 866) if (!pdata) {
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 867) pr_err("no panel connected!\n");
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 868) return len;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 869) }
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 870) pinfo = &pdata->panel_info;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 871)
b11c90dac54ac (Shalini Krishnamoorthi 2016-06-30 14:00:04 -0700 872) if (kstrtouint(buf, 0, &dfps_mode)) {
b11c90dac54ac (Shalini Krishnamoorthi 2016-06-30 14:00:04 -0700 873) pr_err("kstrtouint buf error!\n");
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 874) return len;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 875) }
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 876)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 877) if (dfps_mode >= DFPS_MODE_MAX) {
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 878) pinfo->dynamic_fps = false;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 879) return len;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 880) }
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 881)
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 882) if (mfd->idle_time != 0) {
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 883) pr_err("ERROR: Idle time is not disabled.\n");
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 884) return len;
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 885) }
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 886)
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 887) if (pinfo->current_fps != pinfo->default_fps) {
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 888) pr_err("ERROR: panel not configured to default fps\n");
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 889) return len;
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 890) }
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 891)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 892) pinfo->dynamic_fps = true;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 893) pinfo->dfps_update = dfps_mode;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 894)
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 895) if (pdata->next)
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 896) pdata->next->panel_info.dfps_update = dfps_mode;
f7bad5e06ae0f (Chandan Uddaraju 2015-12-23 11:03:49 -0800 897)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 898) return len;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 899) }
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 900)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 901) static ssize_t mdss_fb_get_dfps_mode(struct device *dev,
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 902) struct device_attribute *attr, char *buf)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 903) {
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 904) struct fb_info *fbi = dev_get_drvdata(dev);
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 905) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 906) struct mdss_panel_data *pdata;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 907) struct mdss_panel_info *pinfo;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 908) int ret;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 909)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 910) pdata = dev_get_platdata(&mfd->pdev->dev);
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 911) if (!pdata) {
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 912) pr_err("no panel connected!\n");
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 913) return -EINVAL;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 914) }
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 915) pinfo = &pdata->panel_info;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 916)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 917) ret = scnprintf(buf, PAGE_SIZE, "dfps enabled=%d mode=%d\n",
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 918) pinfo->dynamic_fps, pinfo->dfps_update);
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 919)
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 920) return ret;
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 921) }
dcd8ca273948d (Huaibin Yang 2015-02-25 23:43:31 -0800 922)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 923) static ssize_t mdss_fb_change_persist_mode(struct device *dev,
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 924) struct device_attribute *attr, const char *buf, size_t len)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 925) {
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 926) struct fb_info *fbi = dev_get_drvdata(dev);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 927) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 928) struct mdss_panel_info *pinfo = NULL;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 929) struct mdss_panel_data *pdata;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 930) int ret = 0;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 931) u32 persist_mode;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 932)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 933) if (!mfd || !mfd->panel_info) {
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 934) pr_err("%s: Panel info is NULL!\n", __func__);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 935) return len;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 936) }
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 937)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 938) pinfo = mfd->panel_info;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 939)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 940) if (kstrtouint(buf, 0, &persist_mode)) {
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 941) pr_err("kstrtouint buf error!\n");
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 942) return len;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 943) }
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 944)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 945) mutex_lock(&mfd->mdss_sysfs_lock);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 946) if (mdss_panel_is_power_off(mfd->panel_power_state)) {
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 947) pinfo->persist_mode = persist_mode;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 948) goto end;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 949) }
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 950)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 951) mutex_lock(&mfd->bl_lock);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 952)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 953) pdata = dev_get_platdata(&mfd->pdev->dev);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 954) if ((pdata) && (pdata->apply_display_setting))
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 955) ret = pdata->apply_display_setting(pdata, persist_mode);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 956)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 957) mutex_unlock(&mfd->bl_lock);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 958)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 959) if (!ret) {
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 960) pr_debug("%s: Persist mode %d\n", __func__, persist_mode);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 961) pinfo->persist_mode = persist_mode;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 962) }
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 963)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 964) end:
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 965) mutex_unlock(&mfd->mdss_sysfs_lock);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 966)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 967) return len;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 968) }
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 969)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 970) static ssize_t mdss_fb_get_persist_mode(struct device *dev,
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 971) struct device_attribute *attr, char *buf)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 972) {
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 973) struct fb_info *fbi = dev_get_drvdata(dev);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 974) struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 975) struct mdss_panel_data *pdata;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 976) struct mdss_panel_info *pinfo;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 977) int ret;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 978)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 979) pdata = dev_get_platdata(&mfd->pdev->dev);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 980) if (!pdata) {
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 981) pr_err("no panel connected!\n");
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 982) return -EINVAL;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 983) }
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 984) pinfo = &pdata->panel_info;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 985)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 986) ret = scnprintf(buf, PAGE_SIZE, "%d\n", pinfo->persist_mode);
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 987)
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 988) return ret;
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 989) }
e6819350df123 (Yahui Wang 2016-12-12 15:50:38 +0800 990)
cdc3ace6a8a1c (Abhijit Kulkarni 2017-02-08 16:41:16 -0800 991) static ssize_t mdss_fb_idle_pc_notify(struct device *dev,
cdc3ace6a8a1c (Abhijit Kulkarni 2017-02-08 16:41:16 -0800 992) struct device_attribute *attr, char *buf)
cdc3ace6a8a1c (Abhijit Kulkarni 2017-02-08 16:41:16 -0800 993) {
cdc3ace6a8a1c (Abhijit Kulkarni 2017-02-08 16:41:16 -0800 994) return scnprintf(buf, PAGE_SIZE, "idle power collapsed\n");
cdc3ace6a8a1c (Abhijit Kulkarni 2017-02-08 16:41:16 -0800 995) }
cdc3ace6a8a1c (Abhijit Kulkarni 2017-02-08 16:41:16 -0800 996)
458b074be71b4 (Ujwal Patel 2012-08-13 17:03:00 -0700 997) static DEVICE_ATTR(msm_fb_type, S_IRUGO, mdss_fb_get_type, NULL);
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 998) static DEVICE_ATTR(msm_fb_split, S_IRUGO | S_IWUSR, mdss_fb_show_split,
68e08b6ebcff3 (Jayant Shekhar 2014-04-10 16:15:16 +0530 999) mdss_fb_store_split);
93619215fa1d7 (Jayant Shekhar 2013-09-20 12:53:30 +0530 1000) static DEVICE_ATTR(show_blank_event, S_IRUGO, mdss_mdp_show_blank_event, NULL);