Lines Matching +full:8 +full:- +full:12
1 // SPDX-License-Identifier: GPL-2.0+
5 * Guochun Huang <hero.huang@rock-chips.com>
19 #include <media/v4l2-ctrls.h>
20 #include <media/v4l2-fwnode.h>
21 #include <media/v4l2-subdev.h>
22 #include <media/v4l2-device.h>
23 #include "phy-rockchip-csi2-dphy-common.h"
24 #include "phy-rockchip-samsung-dcphy.h"
37 #define PLL_EN BIT(12)
38 #define S_MASK GENMASK(10, 8)
39 #define S(x) UPDATE(x, 10, 8)
47 #define MRR_MASK GENMASK(13, 8)
48 #define MRR(x) UPDATE(x, 13, 8)
55 #define PLL_ENABLE_SEL BIT(8)
74 #define HSTX_CLK_SEL BIT(12)
77 #define T_CLK_ZERO(x) UPDATE(x, 15, 8)
80 #define T_HS_EXIT(x) UPDATE(x, 15, 8)
87 #define SKEW_CAL_RUN_TIME(x) UPDATE(x, 15, 12)
89 #define SKEW_CAL_INIT_RUN_TIME(x) UPDATE(x, 11, 8)
144 #define T_HS_ZERO(x) UPDATE(x, 15, 8)
146 #define T_HS_EXIT(x) UPDATE(x, 15, 8)
549 {3460, 16, 61, 16, 15, 16, 28, 14, 12, 23, 19},
550 {3450, 16, 61, 16, 15, 16, 28, 14, 12, 23, 19},
551 {3440, 16, 61, 16, 15, 16, 28, 14, 12, 23, 19},
552 {3430, 16, 61, 16, 15, 16, 28, 14, 12, 23, 19},
553 {3420, 16, 60, 16, 15, 16, 28, 14, 12, 23, 19},
554 {3410, 16, 60, 16, 15, 16, 28, 14, 12, 23, 18},
555 {3400, 16, 60, 15, 15, 16, 28, 14, 12, 23, 18},
556 {3390, 16, 60, 15, 15, 16, 28, 14, 12, 23, 18},
557 {3380, 16, 59, 15, 15, 16, 27, 14, 12, 23, 18},
558 {3370, 16, 59, 15, 15, 15, 28, 14, 12, 23, 18},
559 {3360, 16, 59, 15, 14, 15, 28, 14, 12, 23, 18},
560 {3350, 16, 59, 15, 14, 15, 28, 14, 12, 23, 18},
561 {3340, 16, 59, 15, 14, 15, 28, 14, 12, 22, 18},
562 {3330, 16, 58, 15, 14, 15, 28, 14, 12, 22, 18},
563 {3320, 16, 58, 15, 14, 15, 28, 13, 12, 22, 18},
564 {3310, 16, 58, 15, 14, 15, 27, 13, 12, 22, 18},
565 {3300, 16, 58, 15, 14, 15, 27, 13, 12, 22, 18},
566 {3290, 16, 57, 15, 14, 15, 27, 13, 12, 22, 18},
567 {3280, 16, 57, 15, 14, 15, 27, 13, 12, 22, 18},
568 {3270, 16, 57, 15, 14, 15, 27, 13, 12, 22, 18},
569 {3260, 15, 58, 15, 14, 15, 27, 13, 12, 22, 18},
570 {3250, 15, 57, 15, 14, 15, 27, 13, 12, 22, 18},
571 {3240, 15, 57, 15, 14, 15, 26, 13, 12, 22, 17},
572 {3230, 15, 57, 15, 14, 15, 26, 13, 12, 22, 17},
573 {3220, 15, 57, 15, 14, 15, 26, 13, 12, 22, 17},
574 {3210, 15, 56, 15, 14, 15, 26, 13, 12, 22, 17},
586 {3090, 15, 54, 14, 13, 14, 25, 12, 11, 21, 17},
587 {3080, 15, 53, 14, 13, 14, 25, 12, 11, 21, 17},
588 {3070, 14, 54, 14, 13, 14, 25, 12, 11, 21, 16},
589 {3060, 14, 54, 14, 13, 14, 25, 12, 11, 21, 16},
590 {3050, 14, 54, 14, 13, 14, 25, 12, 11, 20, 16},
591 {3040, 14, 53, 14, 13, 14, 25, 12, 11, 20, 16},
592 {3030, 14, 53, 14, 13, 14, 25, 12, 11, 20, 16},
593 {3020, 14, 53, 14, 13, 14, 24, 12, 11, 20, 16},
594 {3010, 14, 53, 14, 13, 14, 24, 12, 11, 20, 16},
595 {3000, 14, 53, 13, 13, 14, 24, 12, 11, 20, 16},
596 {2990, 14, 52, 13, 13, 14, 24, 12, 11, 20, 16},
597 {2980, 14, 52, 13, 13, 14, 24, 12, 11, 20, 16},
598 {2970, 14, 52, 13, 13, 14, 24, 12, 11, 20, 16},
599 {2960, 14, 52, 13, 13, 14, 24, 12, 11, 20, 16},
600 {2950, 14, 51, 13, 13, 13, 24, 12, 11, 20, 16},
601 {2940, 14, 51, 13, 13, 13, 24, 12, 11, 20, 16},
602 {2930, 14, 51, 13, 13, 13, 24, 12, 10, 20, 16},
603 {2920, 14, 51, 13, 13, 13, 24, 12, 10, 20, 16},
604 {2910, 14, 50, 13, 13, 13, 24, 12, 10, 20, 15},
605 {2900, 14, 50, 13, 13, 13, 24, 12, 10, 19, 15},
606 {2890, 14, 50, 13, 12, 13, 24, 12, 10, 19, 15},
607 {2880, 14, 50, 13, 12, 13, 23, 12, 10, 19, 15},
608 {2870, 13, 50, 13, 12, 13, 23, 12, 10, 19, 15},
609 {2860, 13, 50, 13, 12, 13, 23, 12, 10, 19, 15},
610 {2850, 13, 50, 13, 12, 13, 23, 11, 10, 19, 15},
611 {2840, 13, 50, 13, 12, 13, 23, 11, 10, 19, 15},
612 {2830, 13, 50, 13, 12, 13, 23, 11, 10, 19, 15},
613 {2820, 13, 49, 13, 12, 13, 23, 11, 10, 19, 15},
614 {2810, 13, 49, 13, 12, 13, 23, 11, 10, 19, 15},
615 {2800, 13, 49, 12, 12, 13, 22, 11, 10, 19, 15},
616 {2790, 13, 49, 12, 12, 13, 22, 11, 10, 19, 15},
617 {2780, 13, 48, 12, 12, 13, 22, 11, 10, 19, 15},
618 {2770, 13, 48, 12, 12, 13, 22, 11, 10, 19, 15},
619 {2760, 13, 48, 12, 12, 13, 22, 11, 10, 18, 15},
620 {2750, 13, 48, 12, 12, 13, 22, 11, 10, 18, 15},
621 {2740, 13, 47, 12, 12, 12, 23, 11, 10, 18, 14},
622 {2730, 13, 47, 12, 12, 12, 22, 11, 10, 18, 14},
623 {2720, 13, 47, 12, 12, 12, 22, 11, 10, 18, 14},
624 {2710, 13, 47, 12, 12, 12, 22, 11, 10, 18, 14},
625 {2700, 13, 47, 12, 12, 12, 22, 11, 10, 18, 14},
626 {2690, 13, 46, 12, 12, 12, 22, 11, 10, 18, 14},
627 {2680, 13, 46, 12, 12, 12, 22, 11, 10, 18, 14},
628 {2670, 12, 47, 12, 12, 12, 22, 11, 10, 18, 14},
629 {2660, 12, 47, 12, 12, 12, 21, 11, 9, 18, 14},
630 {2650, 12, 46, 12, 11, 12, 21, 11, 9, 18, 14},
631 {2640, 12, 46, 12, 11, 12, 21, 11, 9, 18, 14},
632 {2630, 12, 46, 12, 11, 12, 21, 11, 9, 18, 14},
633 {2620, 12, 46, 12, 11, 12, 21, 10, 9, 18, 14},
634 {2610, 12, 45, 12, 11, 12, 21, 10, 9, 17, 14},
635 {2600, 12, 45, 11, 11, 12, 21, 10, 9, 17, 14},
636 {2590, 12, 45, 11, 11, 12, 20, 10, 9, 17, 14},
637 {2580, 12, 45, 11, 11, 12, 20, 10, 9, 17, 14},
638 {2570, 12, 44, 11, 11, 12, 20, 10, 9, 17, 13},
639 {2560, 12, 44, 11, 11, 12, 20, 10, 9, 17, 13},
640 {2550, 12, 44, 11, 11, 12, 20, 10, 9, 17, 13},
641 {2540, 12, 44, 11, 11, 11, 21, 10, 9, 17, 13},
642 {2530, 12, 44, 11, 11, 11, 21, 10, 9, 17, 13},
643 {2520, 12, 43, 11, 11, 11, 21, 10, 9, 17, 13},
644 {2510, 12, 43, 11, 11, 11, 20, 10, 9, 17, 13},
645 {2500, 12, 43, 11, 11, 11, 20, 10, 9, 17, 13},
646 {2490, 12, 43, 11, 11, 11, 20, 10, 9, 17, 13},
647 {2480, 12, 42, 11, 11, 11, 20, 10, 9, 17, 13},
654 {2410, 11, 42, 11, 10, 11, 19, 10, 9, 16, 12},
655 {2400, 11, 41, 10, 10, 11, 19, 10, 8, 16, 12},
656 {2390, 11, 41, 10, 10, 11, 19, 10, 8, 16, 12},
657 {2380, 11, 41, 10, 10, 11, 19, 9, 8, 16, 12},
658 {2370, 11, 41, 10, 10, 11, 18, 9, 8, 16, 12},
659 {2360, 11, 41, 10, 10, 11, 18, 9, 8, 16, 12},
660 {2350, 11, 40, 10, 10, 11, 18, 9, 8, 16, 12},
661 {2340, 11, 40, 10, 10, 11, 18, 9, 8, 16, 12},
662 {2330, 11, 40, 10, 10, 10, 19, 9, 8, 16, 12},
663 {2320, 11, 40, 10, 10, 10, 19, 9, 8, 15, 12},
664 {2310, 11, 39, 10, 10, 10, 19, 9, 8, 15, 12},
665 {2300, 11, 39, 10, 10, 10, 18, 9, 8, 15, 12},
666 {2290, 11, 39, 10, 10, 10, 18, 9, 8, 15, 12},
667 {2280, 11, 39, 10, 10, 10, 18, 9, 8, 15, 12},
668 {2270, 10, 39, 10, 10, 10, 18, 9, 8, 15, 12},
669 {2260, 10, 39, 10, 10, 10, 18, 9, 8, 15, 12},
670 {2250, 10, 39, 10, 10, 10, 18, 9, 8, 15, 12},
671 {2240, 10, 39, 10, 10, 10, 18, 9, 8, 15, 11},
672 {2230, 10, 38, 10, 10, 10, 18, 9, 8, 15, 11},
673 {2220, 10, 38, 10, 10, 10, 17, 9, 8, 15, 11},
674 {2210, 10, 38, 10, 10, 10, 17, 9, 8, 15, 11},
675 {2200, 10, 38, 9, 10, 10, 17, 9, 8, 15, 11},
676 {2190, 10, 38, 9, 9, 10, 17, 9, 8, 15, 11},
677 {2180, 10, 37, 9, 9, 10, 17, 9, 8, 14, 11},
678 {2170, 10, 37, 9, 9, 10, 17, 9, 8, 14, 11},
679 {2160, 10, 37, 9, 9, 10, 17, 9, 8, 14, 11},
680 {2150, 10, 37, 9, 9, 10, 16, 8, 8, 14, 11},
681 {2140, 10, 36, 9, 9, 10, 16, 8, 8, 14, 11},
682 {2130, 10, 36, 9, 9, 10, 16, 8, 7, 14, 11},
683 {2120, 10, 36, 9, 9, 9, 17, 8, 7, 14, 11},
684 {2110, 10, 36, 9, 9, 9, 17, 8, 7, 14, 11},
685 {2100, 10, 35, 9, 9, 9, 17, 8, 7, 14, 11},
686 {2090, 10, 35, 9, 9, 9, 17, 8, 7, 14, 11},
687 {2080, 9, 36, 9, 9, 9, 16, 8, 7, 14, 11},
688 {2070, 9, 36, 9, 9, 9, 16, 8, 7, 14, 10},
689 {2060, 9, 35, 9, 9, 9, 16, 8, 7, 14, 10},
690 {2050, 9, 35, 9, 9, 9, 16, 8, 7, 14, 10},
691 {2040, 9, 35, 9, 9, 9, 16, 8, 7, 14, 10},
692 {2030, 9, 35, 9, 9, 9, 16, 8, 7, 13, 10},
693 {2020, 9, 35, 9, 9, 9, 16, 8, 7, 13, 10},
694 {2010, 9, 34, 9, 9, 9, 15, 8, 7, 13, 10},
695 {2000, 9, 34, 8, 9, 9, 15, 8, 7, 13, 10},
696 {1990, 9, 34, 8, 9, 9, 15, 8, 7, 13, 10},
697 {1980, 9, 34, 8, 9, 9, 15, 8, 7, 13, 10},
698 {1970, 9, 33, 8, 9, 9, 15, 8, 7, 13, 10},
699 {1960, 9, 33, 8, 9, 9, 15, 8, 7, 13, 10},
700 {1950, 9, 33, 8, 8, 9, 15, 8, 7, 13, 10},
701 {1940, 9, 33, 8, 8, 9, 15, 8, 7, 13, 10},
702 {1930, 9, 32, 8, 8, 9, 14, 8, 7, 13, 10},
703 {1920, 9, 32, 8, 8, 9, 14, 8, 7, 13, 10},
704 {1910, 9, 32, 8, 8, 8, 15, 7, 7, 13, 9},
705 {1900, 9, 32, 8, 8, 8, 15, 7, 7, 13, 9},
706 {1890, 9, 31, 8, 8, 8, 15, 7, 7, 12, 9},
707 {1880, 8, 32, 8, 8, 8, 15, 7, 7, 12, 9},
708 {1870, 8, 32, 8, 8, 8, 15, 7, 7, 12, 9},
709 {1860, 8, 32, 8, 8, 8, 14, 7, 6, 12, 9},
710 {1850, 8, 32, 8, 8, 8, 14, 7, 6, 12, 9},
711 {1840, 8, 31, 8, 8, 8, 14, 7, 6, 12, 9},
712 {1830, 8, 31, 8, 8, 8, 14, 7, 6, 12, 9},
713 {1820, 8, 31, 8, 8, 8, 14, 7, 6, 12, 9},
714 {1810, 8, 31, 8, 8, 8, 14, 7, 6, 12, 9},
715 {1800, 8, 30, 7, 8, 8, 14, 7, 6, 12, 9},
716 {1790, 8, 30, 7, 8, 8, 13, 7, 6, 12, 9},
717 {1780, 8, 30, 7, 8, 8, 13, 7, 6, 12, 9},
718 {1770, 8, 30, 7, 8, 8, 13, 7, 6, 12, 9},
719 {1760, 8, 29, 7, 8, 8, 13, 7, 6, 12, 9},
720 {1750, 8, 29, 7, 8, 8, 13, 7, 6, 12, 9},
721 {1740, 8, 29, 7, 8, 8, 13, 7, 6, 11, 8},
722 {1730, 8, 29, 7, 8, 8, 13, 7, 6, 11, 8},
723 {1720, 8, 29, 7, 7, 8, 13, 7, 6, 11, 8},
724 {1710, 8, 28, 7, 7, 8, 12, 7, 6, 11, 8},
725 {1700, 8, 28, 7, 7, 7, 13, 7, 6, 11, 8},
726 {1690, 8, 28, 7, 7, 7, 13, 7, 6, 11, 8},
727 {1680, 7, 29, 7, 7, 7, 13, 6, 6, 11, 8},
728 {1670, 7, 28, 7, 7, 7, 13, 6, 6, 11, 8},
729 {1660, 7, 28, 7, 7, 7, 13, 6, 6, 11, 8},
730 {1650, 7, 28, 7, 7, 7, 13, 6, 6, 11, 8},
731 {1640, 7, 28, 7, 7, 7, 12, 6, 6, 11, 8},
732 {1630, 7, 27, 7, 7, 7, 12, 6, 6, 11, 8},
733 {1620, 7, 27, 7, 7, 7, 12, 6, 6, 11, 8},
734 {1610, 7, 27, 7, 7, 7, 12, 6, 6, 11, 8},
735 {1600, 7, 27, 6, 7, 7, 12, 6, 5, 10, 8},
736 {1590, 7, 26, 6, 7, 7, 12, 6, 5, 10, 8},
737 {1580, 7, 26, 6, 7, 7, 12, 6, 5, 10, 7},
752 {1430, 57, 23, 6, 75, 57, 10, 68, 43, 8, 70},
753 {1420, 56, 23, 6, 74, 57, 9, 67, 43, 8, 70},
754 {1410, 56, 23, 6, 74, 57, 9, 67, 43, 8, 69},
755 {1400, 56, 23, 5, 74, 55, 9, 67, 41, 8, 69},
756 {1390, 55, 23, 5, 73, 55, 9, 66, 41, 8, 68},
757 {1380, 55, 23, 5, 73, 54, 9, 66, 41, 8, 68},
758 {1370, 54, 22, 5, 72, 54, 9, 66, 41, 8, 67},
759 {1360, 54, 22, 5, 72, 54, 9, 65, 40, 8, 67},
760 {1350, 54, 22, 5, 72, 53, 9, 65, 40, 8, 66},
761 {1340, 53, 22, 5, 71, 53, 9, 65, 40, 8, 66},
762 {1330, 53, 22, 5, 71, 53, 9, 64, 39, 8, 65},
763 {1320, 52, 22, 5, 71, 53, 8, 64, 40, 8, 65},
764 {1310, 52, 21, 5, 70, 53, 8, 64, 40, 8, 64},
765 {1300, 51, 21, 5, 70, 51, 8, 63, 38, 8, 64},
766 {1290, 51, 21, 5, 70, 51, 8, 63, 38, 7, 64},
767 {1280, 51, 21, 5, 69, 51, 8, 63, 38, 7, 63},
768 {1270, 50, 21, 5, 69, 50, 8, 62, 38, 7, 63},
769 {1260, 50, 20, 5, 69, 50, 8, 62, 37, 7, 62},
770 {1250, 49, 20, 5, 68, 49, 8, 62, 37, 7, 62},
771 {1240, 49, 20, 5, 68, 49, 8, 61, 37, 7, 61},
772 {1230, 49, 20, 5, 68, 49, 8, 61, 36, 7, 61},
773 {1220, 48, 20, 5, 67, 48, 8, 61, 36, 7, 60},
812 { 830, 33, 12, 3, 54, 33, 4, 47, 24, 4, 41},
813 { 820, 32, 12, 3, 54, 33, 4, 47, 24, 4, 41},
814 { 810, 32, 12, 3, 53, 33, 4, 47, 24, 4, 40},
815 { 800, 31, 12, 2, 53, 32, 4, 46, 23, 4, 40},
816 { 790, 31, 12, 2, 53, 32, 4, 46, 23, 4, 39},
817 { 780, 30, 12, 2, 52, 31, 4, 46, 23, 4, 39},
834 { 610, 24, 8, 2, 47, 26, 2, 40, 19, 3, 31},
835 { 600, 23, 8, 1, 46, 26, 2, 39, 18, 3, 30},
836 { 590, 23, 8, 1, 46, 24, 2, 39, 17, 3, 30},
837 { 580, 22, 8, 1, 46, 24, 2, 39, 17, 3, 29},
838 { 570, 22, 8, 1, 45, 23, 2, 38, 17, 3, 29},
852 { 430, 16, 5, 1, 40, 18, 0, 34, 12, 2, 22},
853 { 420, 16, 5, 1, 40, 18, 0, 33, 12, 2, 22},
854 { 410, 16, 5, 1, 40, 17, 0, 33, 12, 1, 21},
856 { 390, 15, 4, 0, 39, 17, 0, 32, 12, 1, 20},
857 { 380, 14, 4, 0, 39, 17, 0, 32, 12, 1, 20},
858 { 370, 14, 4, 0, 38, 17, 0, 32, 12, 1, 19},
862 { 330, 12, 3, 0, 37, 14, 0, 30, 9, 1, 17},
863 { 320, 12, 3, 0, 37, 14, 0, 30, 9, 1, 17},
864 { 310, 12, 3, 0, 36, 13, 0, 30, 9, 1, 16},
865 { 300, 11, 3, 0, 36, 13, 0, 29, 8, 1, 16},
866 { 290, 11, 2, 0, 36, 13, 0, 29, 8, 1, 15},
867 { 280, 10, 2, 0, 35, 12, 0, 29, 8, 1, 15},
868 { 270, 10, 2, 0, 35, 12, 0, 28, 8, 0, 14},
869 { 260, 9, 2, 0, 35, 12, 0, 28, 8, 0, 14},
870 { 250, 9, 2, 0, 34, 12, 0, 28, 8, 0, 14},
871 { 240, 9, 2, 0, 34, 12, 0, 27, 8, 0, 13},
872 { 230, 8, 1, 0, 34, 10, 0, 27, 6, 0, 13},
873 { 220, 8, 1, 0, 33, 10, 0, 27, 6, 0, 12},
874 { 210, 7, 1, 0, 33, 10, 0, 26, 6, 0, 12},
877 { 180, 6, 1, 0, 32, 8, 0, 25, 5, 0, 10},
878 { 170, 6, 0, 0, 32, 8, 0, 25, 5, 0, 10},
879 { 160, 5, 0, 0, 31, 8, 0, 24, 4, 0, 9},
880 { 150, 5, 0, 0, 31, 8, 0, 24, 5, 0, 9},
881 { 140, 5, 0, 0, 31, 8, 0, 24, 5, 0, 8},
882 { 130, 4, 0, 0, 30, 6, 0, 23, 3, 0, 8},
1091 { 1510, 16, 50, 25, 12, 23, 1 },
1092 { 1500, 16, 50, 25, 12, 23, 1 },
1093 { 1490, 16, 50, 25, 12, 23, 1 },
1094 { 1480, 16, 50, 25, 12, 23, 1 },
1095 { 1470, 16, 50, 25, 12, 23, 1 },
1096 { 1460, 16, 50, 25, 12, 22, 1 },
1097 { 1450, 15, 50, 25, 12, 22, 1 },
1098 { 1440, 15, 50, 25, 12, 22, 1 },
1099 { 1430, 15, 50, 25, 12, 22, 1 },
1100 { 1420, 15, 50, 25, 12, 22, 1 },
1101 { 1410, 15, 50, 25, 12, 22, 1 },
1123 { 1190, 12, 50, 25, 10, 18, 1 },
1124 { 1180, 12, 50, 25, 10, 18, 1 },
1125 { 1170, 12, 50, 25, 10, 18, 1 },
1126 { 1160, 12, 50, 25, 9, 18, 1 },
1127 { 1150, 12, 50, 25, 9, 18, 1 },
1128 { 1140, 12, 50, 25, 9, 17, 1 },
1129 { 1130, 12, 50, 25, 9, 17, 1 },
1130 { 1120, 12, 50, 25, 9, 17, 1 },
1131 { 1110, 12, 50, 25, 9, 17, 1 },
1137 { 1050, 11, 50, 25, 8, 16, 1 },
1138 { 1040, 11, 50, 25, 8, 16, 1 },
1139 { 1030, 11, 50, 25, 8, 16, 1 },
1140 { 1020, 10, 50, 25, 8, 16, 1 },
1141 { 1010, 10, 50, 25, 8, 15, 1 },
1142 { 1000, 10, 50, 25, 8, 15, 1 },
1143 { 990, 10, 50, 25, 8, 15, 2 },
1144 { 980, 10, 50, 25, 8, 15, 2 },
1145 { 970, 10, 50, 25, 8, 15, 2 },
1146 { 960, 10, 50, 25, 8, 15, 2 },
1147 { 950, 10, 50, 25, 8, 14, 2 },
1148 { 940, 10, 50, 25, 8, 14, 2 },
1158 { 840, 8, 50, 25, 7, 13, 2 },
1159 { 830, 8, 50, 25, 7, 13, 2 },
1160 { 820, 8, 50, 25, 7, 12, 2 },
1161 { 810, 8, 50, 25, 6, 12, 2 },
1162 { 800, 8, 50, 25, 6, 12, 2 },
1163 { 790, 8, 50, 25, 6, 12, 2 },
1164 { 780, 8, 50, 25, 6, 12, 2 },
1165 { 770, 8, 50, 25, 6, 12, 2 },
1185 { 570, 5, 50, 25, 4, 8, 2 },
1186 { 560, 5, 50, 25, 4, 8, 2 },
1187 { 550, 5, 50, 25, 4, 8, 2 },
1188 { 540, 5, 50, 25, 4, 8, 2 },
1189 { 530, 5, 50, 25, 4, 8, 2 },
1190 { 520, 5, 50, 25, 4, 8, 2 },
1191 { 510, 5, 50, 25, 4, 8, 2 },
1199 { 430, 15, 50, 25, 12, 6, 2 },
1200 { 420, 15, 50, 25, 12, 5, 2 },
1201 { 410, 15, 50, 25, 12, 5, 2 },
1207 { 350, 12, 50, 25, 10, 4, 2 },
1208 { 340, 12, 50, 25, 10, 4, 2 },
1212 { 300, 10, 50, 25, 8, 3, 2 },
1213 { 290, 10, 50, 25, 8, 3, 2 },
1214 { 280, 9, 50, 25, 8, 3, 2 },
1215 { 270, 9, 50, 25, 8, 3, 2 },
1216 { 260, 8, 50, 25, 7, 3, 2 },
1217 { 250, 8, 50, 25, 7, 3, 2 },
1218 { 240, 8, 50, 25, 7, 3, 2 },
1278 csi_dphy->dphy_param.lp_vol_ref != 3 && in samsung_mipi_dcphy_bias_block_enable()
1279 csi_dphy->dphy_param.lp_vol_ref < 0x7) { in samsung_mipi_dcphy_bias_block_enable()
1281 bias_con2 |= csi_dphy->dphy_param.lp_vol_ref; in samsung_mipi_dcphy_bias_block_enable()
1282 dev_info(samsung->dev, in samsung_mipi_dcphy_bias_block_enable()
1284 csi_dphy->dphy_param.lp_vol_ref); in samsung_mipi_dcphy_bias_block_enable()
1286 regmap_write(samsung->regmap, BIAS_CON0, 0x0010); in samsung_mipi_dcphy_bias_block_enable()
1287 regmap_write(samsung->regmap, BIAS_CON1, 0x0110); in samsung_mipi_dcphy_bias_block_enable()
1288 regmap_write(samsung->regmap, BIAS_CON2, bias_con2); in samsung_mipi_dcphy_bias_block_enable()
1294 if (samsung->c_option) in samsung_mipi_dcphy_bias_block_enable()
1295 regmap_update_bits(samsung->regmap, BIAS_CON4, in samsung_mipi_dcphy_bias_block_enable()
1305 regmap_write(samsung->regmap, DPHY_MC_GNR_CON1, T_PHY_READY(0x2000)); in samsung_mipi_dphy_lane_enable()
1306 regmap_update_bits(samsung->regmap, DPHY_MC_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1309 switch (samsung->lanes) { in samsung_mipi_dphy_lane_enable()
1311 regmap_write(samsung->regmap, DPHY_MD3_GNR_CON1, in samsung_mipi_dphy_lane_enable()
1313 regmap_update_bits(samsung->regmap, DPHY_MD3_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1317 regmap_write(samsung->regmap, COMBO_MD2_GNR_CON1, in samsung_mipi_dphy_lane_enable()
1319 regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1323 regmap_write(samsung->regmap, COMBO_MD1_GNR_CON1, in samsung_mipi_dphy_lane_enable()
1325 regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1330 regmap_write(samsung->regmap, COMBO_MD0_GNR_CON1, in samsung_mipi_dphy_lane_enable()
1332 regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1340 regmap_write(samsung->regmap, COMBO_MD0_GNR_CON1, T_PHY_READY(0x2000)); in samsung_mipi_cphy_lane_enable()
1341 regmap_write(samsung->regmap, COMBO_MD1_GNR_CON1, T_PHY_READY(0x2000)); in samsung_mipi_cphy_lane_enable()
1342 regmap_write(samsung->regmap, COMBO_MD2_GNR_CON1, T_PHY_READY(0x2000)); in samsung_mipi_cphy_lane_enable()
1344 regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, in samsung_mipi_cphy_lane_enable()
1346 regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, in samsung_mipi_cphy_lane_enable()
1348 regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, in samsung_mipi_cphy_lane_enable()
1354 regmap_update_bits(samsung->regmap, DPHY_MC_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1355 regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1356 regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1357 regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1358 regmap_update_bits(samsung->regmap, DPHY_MD3_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1363 regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_cphy_lane_disable()
1364 regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_cphy_lane_disable()
1365 regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_cphy_lane_disable()
1370 regmap_update_bits(samsung->regmap, PLL_CON0, S_MASK | P_MASK, in samsung_mipi_dcphy_pll_configure()
1371 S(samsung->pll.scaler) | P(samsung->pll.prediv)); in samsung_mipi_dcphy_pll_configure()
1373 if (samsung->pll.dsm < 0) { in samsung_mipi_dcphy_pll_configure()
1377 dsm_tmp = abs(samsung->pll.dsm); in samsung_mipi_dcphy_pll_configure()
1378 dsm_tmp = dsm_tmp - 1; in samsung_mipi_dcphy_pll_configure()
1380 regmap_write(samsung->regmap, PLL_CON1, dsm_tmp); in samsung_mipi_dcphy_pll_configure()
1382 regmap_write(samsung->regmap, PLL_CON1, samsung->pll.dsm); in samsung_mipi_dcphy_pll_configure()
1385 regmap_update_bits(samsung->regmap, PLL_CON2, in samsung_mipi_dcphy_pll_configure()
1386 M_MASK, M(samsung->pll.fbdiv)); in samsung_mipi_dcphy_pll_configure()
1388 if (samsung->pll.ssc_en) { in samsung_mipi_dcphy_pll_configure()
1389 regmap_write(samsung->regmap, PLL_CON3, in samsung_mipi_dcphy_pll_configure()
1390 MRR(samsung->pll.mrr) | MFR(samsung->pll.mfr)); in samsung_mipi_dcphy_pll_configure()
1391 regmap_update_bits(samsung->regmap, PLL_CON4, SSCG_EN, SSCG_EN); in samsung_mipi_dcphy_pll_configure()
1394 regmap_write(samsung->regmap, PLL_CON5, RESET_N_SEL | PLL_ENABLE_SEL); in samsung_mipi_dcphy_pll_configure()
1395 regmap_write(samsung->regmap, PLL_CON7, PLL_LOCK_CNT(0xf000)); in samsung_mipi_dcphy_pll_configure()
1396 regmap_write(samsung->regmap, PLL_CON8, PLL_STB_CNT(0xf000)); in samsung_mipi_dcphy_pll_configure()
1404 regmap_update_bits(samsung->regmap, PLL_CON0, PLL_EN, PLL_EN); in samsung_mipi_dcphy_pll_enable()
1406 ret = regmap_read_poll_timeout(samsung->regmap, PLL_STAT0, in samsung_mipi_dcphy_pll_enable()
1409 dev_err(samsung->dev, "DC-PHY pll is not locked\n"); in samsung_mipi_dcphy_pll_enable()
1414 regmap_update_bits(samsung->regmap, PLL_CON0, PLL_EN, 0); in samsung_mipi_dcphy_pll_disable()
1422 unsigned int lane_mbps = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_dphy_get_timing()
1428 for (i = num_timings; i > 0; i--) in samsung_mipi_dphy_get_timing()
1429 if (lane_mbps <= timings[i - 1].max_lane_mbps) in samsung_mipi_dphy_get_timing()
1435 return &timings[i - 1]; in samsung_mipi_dphy_get_timing()
1443 unsigned int lane_msps = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_cphy_get_timing()
1449 for (i = num_timings; i > 0; i--) in samsung_mipi_cphy_get_timing()
1450 if (lane_msps <= timings[i - 1].max_lane_msps) in samsung_mipi_cphy_get_timing()
1456 return &timings[i - 1]; in samsung_mipi_cphy_get_timing()
1462 unsigned int lane_hs_rate = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_cphy_timing_init()
1468 * Divide-by-2 Clock from Serial Clock. Use this when data rate is under in samsung_mipi_cphy_timing_init()
1469 * 500Msps, otherwise divide-by-16 Clock from Serial Clock in samsung_mipi_cphy_timing_init()
1474 val |= T_LPX(timing->lpx); in samsung_mipi_cphy_timing_init()
1476 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON0, val); in samsung_mipi_cphy_timing_init()
1477 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON0, val); in samsung_mipi_cphy_timing_init()
1478 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON0, val); in samsung_mipi_cphy_timing_init()
1480 val = T_HS_ZERO(timing->prebegin_3) | T_HS_PREPARE(timing->prepare_3); in samsung_mipi_cphy_timing_init()
1481 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON1, val); in samsung_mipi_cphy_timing_init()
1482 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON1, val); in samsung_mipi_cphy_timing_init()
1483 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON1, val); in samsung_mipi_cphy_timing_init()
1485 val = T_HS_EXIT(timing->hs_exit) | T_HS_TRAIL(timing->post_3); in samsung_mipi_cphy_timing_init()
1486 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON2, val); in samsung_mipi_cphy_timing_init()
1487 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON2, val); in samsung_mipi_cphy_timing_init()
1488 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON2, val); in samsung_mipi_cphy_timing_init()
1490 /* TTA-GET/TTA-GO Timing Counter register use default value */ in samsung_mipi_cphy_timing_init()
1492 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON3, val); in samsung_mipi_cphy_timing_init()
1493 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON3, val); in samsung_mipi_cphy_timing_init()
1494 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON3, val); in samsung_mipi_cphy_timing_init()
1497 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON4, 0x1f4); in samsung_mipi_cphy_timing_init()
1498 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON4, 0x1f4); in samsung_mipi_cphy_timing_init()
1499 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON4, 0x1f4); in samsung_mipi_cphy_timing_init()
1509 u64 max_fout = samsung->c_option ? MAX_CPHY_BW : MAX_DPHY_BW; in samsung_mipi_dcphy_pll_round_rate()
1554 /* -32767 ≤ K[15:0] ≤ 32767 */ in samsung_mipi_dcphy_pll_round_rate()
1555 _dsm = ((_prediv * fvco) - (2 * _fbdiv * fin)); in samsung_mipi_dcphy_pll_round_rate()
1563 delta = abs(fvco * MSEC_PER_SEC - tmp); in samsung_mipi_dcphy_pll_round_rate()
1582 dev_dbg(samsung->dev, "p: %d, m: %d, dsm:%ld, scaler: %d\n", in samsung_mipi_dcphy_pll_round_rate()
1592 unsigned int lane_hs_rate = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_dphy_clk_lane_timing_init()
1596 regmap_write(samsung->regmap, DPHY_MC_GNR_CON0, 0xf000); in samsung_mipi_dphy_clk_lane_timing_init()
1597 regmap_write(samsung->regmap, DPHY_MC_ANA_CON0, 0x7133); in samsung_mipi_dphy_clk_lane_timing_init()
1600 regmap_write(samsung->regmap, DPHY_MC_ANA_CON1, 0x0001); in samsung_mipi_dphy_clk_lane_timing_init()
1603 * Divide-by-2 Clock from Serial Clock. Use this when data rate is under in samsung_mipi_dphy_clk_lane_timing_init()
1604 * 1500Mbps, otherwise divide-by-16 Clock from Serial Clock in samsung_mipi_dphy_clk_lane_timing_init()
1609 val |= T_LPX(timing->lpx); in samsung_mipi_dphy_clk_lane_timing_init()
1611 regmap_write(samsung->regmap, DPHY_MC_TIME_CON0, val); in samsung_mipi_dphy_clk_lane_timing_init()
1613 val = T_CLK_ZERO(timing->clk_zero) | T_CLK_PREPARE(timing->clk_prepare); in samsung_mipi_dphy_clk_lane_timing_init()
1614 regmap_write(samsung->regmap, DPHY_MC_TIME_CON1, val); in samsung_mipi_dphy_clk_lane_timing_init()
1616 val = T_HS_EXIT(timing->hs_exit) | T_CLK_TRAIL(timing->clk_trail_eot); in samsung_mipi_dphy_clk_lane_timing_init()
1617 regmap_write(samsung->regmap, DPHY_MC_TIME_CON2, val); in samsung_mipi_dphy_clk_lane_timing_init()
1619 val = T_CLK_POST(timing->clk_post); in samsung_mipi_dphy_clk_lane_timing_init()
1620 regmap_write(samsung->regmap, DPHY_MC_TIME_CON3, val); in samsung_mipi_dphy_clk_lane_timing_init()
1623 regmap_write(samsung->regmap, DPHY_MC_TIME_CON4, 0x1f4); in samsung_mipi_dphy_clk_lane_timing_init()
1630 regmap_write(samsung->regmap, DPHY_MC_DESKEW_CON0, 0x9cb1); in samsung_mipi_dphy_clk_lane_timing_init()
1637 unsigned int lane_hs_rate = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_dphy_data_lane_timing_init()
1642 regmap_write(samsung->regmap, COMBO_MD0_ANA_CON0, 0x7133); in samsung_mipi_dphy_data_lane_timing_init()
1643 regmap_write(samsung->regmap, COMBO_MD1_ANA_CON0, 0x7133); in samsung_mipi_dphy_data_lane_timing_init()
1644 regmap_write(samsung->regmap, COMBO_MD2_ANA_CON0, 0x7133); in samsung_mipi_dphy_data_lane_timing_init()
1645 regmap_write(samsung->regmap, DPHY_MD3_ANA_CON0, 0x7133); in samsung_mipi_dphy_data_lane_timing_init()
1648 regmap_write(samsung->regmap, COMBO_MD0_ANA_CON1, 0x0001); in samsung_mipi_dphy_data_lane_timing_init()
1649 regmap_write(samsung->regmap, COMBO_MD1_ANA_CON1, 0x0001); in samsung_mipi_dphy_data_lane_timing_init()
1650 regmap_write(samsung->regmap, COMBO_MD2_ANA_CON1, 0x0001); in samsung_mipi_dphy_data_lane_timing_init()
1651 regmap_write(samsung->regmap, DPHY_MD3_ANA_CON1, 0x0001); in samsung_mipi_dphy_data_lane_timing_init()
1655 * Divide-by-2 Clock from Serial Clock. Use this when data rate is under in samsung_mipi_dphy_data_lane_timing_init()
1656 * 1500Mbps, otherwise divide-by-16 Clock from Serial Clock in samsung_mipi_dphy_data_lane_timing_init()
1661 val |= T_LPX(timing->lpx); in samsung_mipi_dphy_data_lane_timing_init()
1663 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON0, val); in samsung_mipi_dphy_data_lane_timing_init()
1664 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON0, val); in samsung_mipi_dphy_data_lane_timing_init()
1665 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON0, val); in samsung_mipi_dphy_data_lane_timing_init()
1666 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON0, val); in samsung_mipi_dphy_data_lane_timing_init()
1668 val = T_HS_ZERO(timing->hs_zero) | T_HS_PREPARE(timing->hs_prepare); in samsung_mipi_dphy_data_lane_timing_init()
1669 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON1, val); in samsung_mipi_dphy_data_lane_timing_init()
1670 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON1, val); in samsung_mipi_dphy_data_lane_timing_init()
1671 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON1, val); in samsung_mipi_dphy_data_lane_timing_init()
1672 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON1, val); in samsung_mipi_dphy_data_lane_timing_init()
1674 val = T_HS_EXIT(timing->hs_exit) | T_HS_TRAIL(timing->hs_trail_eot); in samsung_mipi_dphy_data_lane_timing_init()
1675 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON2, val); in samsung_mipi_dphy_data_lane_timing_init()
1676 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON2, val); in samsung_mipi_dphy_data_lane_timing_init()
1677 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON2, val); in samsung_mipi_dphy_data_lane_timing_init()
1678 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON2, val); in samsung_mipi_dphy_data_lane_timing_init()
1680 /* TTA-GET/TTA-GO Timing Counter register use default value */ in samsung_mipi_dphy_data_lane_timing_init()
1682 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON3, val); in samsung_mipi_dphy_data_lane_timing_init()
1683 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON3, val); in samsung_mipi_dphy_data_lane_timing_init()
1684 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON3, val); in samsung_mipi_dphy_data_lane_timing_init()
1685 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON3, val); in samsung_mipi_dphy_data_lane_timing_init()
1688 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON4, 0x1f4); in samsung_mipi_dphy_data_lane_timing_init()
1689 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON4, 0x1f4); in samsung_mipi_dphy_data_lane_timing_init()
1690 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON4, 0x1f4); in samsung_mipi_dphy_data_lane_timing_init()
1691 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON4, 0x1f4); in samsung_mipi_dphy_data_lane_timing_init()
1697 regmap_write(samsung->regmap, DPHY_MC_ANA_CON2, HS_VREG_AMP_ICON(2)); in samsung_mipi_dcphy_hs_vreg_amp_configure()
1702 reset_control_assert(samsung->m_phy_rst); in samsung_mipi_dphy_power_on()
1711 reset_control_deassert(samsung->m_phy_rst); in samsung_mipi_dphy_power_on()
1721 regmap_write(samsung->grf_regmap, MIPI_DCPHY_GRF_CON0, M_CPHY_MODE); in samsung_mipi_cphy_power_on()
1722 reset_control_assert(samsung->m_phy_rst); in samsung_mipi_cphy_power_on()
1731 reset_control_deassert(samsung->m_phy_rst); in samsung_mipi_cphy_power_on()
1743 pm_runtime_get_sync(samsung->dev); in samsung_mipi_dcphy_power_on()
1744 reset_control_assert(samsung->apb_rst); in samsung_mipi_dcphy_power_on()
1746 reset_control_deassert(samsung->apb_rst); in samsung_mipi_dcphy_power_on()
1747 if (atomic_read(&samsung->stream_cnt)) { in samsung_mipi_dcphy_power_on()
1748 sensor_sd = get_remote_sensor(&samsung->dphy_dev[0]->sd); in samsung_mipi_dcphy_power_on()
1749 samsung->stream_off(samsung->dphy_dev[0], &samsung->dphy_dev[0]->sd); in samsung_mipi_dcphy_power_on()
1753 samsung->stream_on(samsung->dphy_dev[0], &samsung->dphy_dev[0]->sd); in samsung_mipi_dcphy_power_on()
1787 pm_runtime_put(samsung->dev); in samsung_mipi_dcphy_power_off()
1802 unsigned long fin = div64_ul(clk_get_rate(samsung->ref_clk), MSEC_PER_SEC); in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1803 u16 prediv = samsung->pll.prediv; in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1804 u16 fbdiv = samsung->pll.fbdiv; in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1836 dev_err(samsung->dev, "failed to calc ssc parameter mfr and mrr\n"); in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1837 return -EINVAL; in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1847 unsigned long prate = clk_get_rate(samsung->ref_clk); in samsung_mipi_dcphy_pll_calc_rate()
1859 dev_dbg(samsung->dev, "%s: fin=%lu, req_rate=%llu\n", in samsung_mipi_dcphy_pll_calc_rate()
1861 dev_dbg(samsung->dev, "%s: fout=%lu, prediv=%u, fbdiv=%u\n", in samsung_mipi_dcphy_pll_calc_rate()
1864 samsung->pll.prediv = prediv; in samsung_mipi_dcphy_pll_calc_rate()
1865 samsung->pll.fbdiv = fbdiv; in samsung_mipi_dcphy_pll_calc_rate()
1866 samsung->pll.dsm = dsm; in samsung_mipi_dcphy_pll_calc_rate()
1867 samsung->pll.scaler = scaler; in samsung_mipi_dcphy_pll_calc_rate()
1868 samsung->pll.rate = fout; in samsung_mipi_dcphy_pll_calc_rate()
1878 samsung->pll.ssc_en = true; in samsung_mipi_dcphy_pll_calc_rate()
1879 samsung->pll.mfr = mfr; in samsung_mipi_dcphy_pll_calc_rate()
1880 samsung->pll.mrr = mrr; in samsung_mipi_dcphy_pll_calc_rate()
1889 unsigned long long target_rate = opts->mipi_dphy.hs_clk_rate; in samsung_mipi_dcphy_configure()
1892 samsung->c_option = (mode == PHY_MODE_MIPI_DPHY) ? false : true; in samsung_mipi_dcphy_configure()
1894 samsung->lanes = opts->mipi_dphy.lanes > 4 ? 4 : opts->mipi_dphy.lanes; in samsung_mipi_dcphy_configure()
1897 opts->mipi_dphy.hs_clk_rate = samsung->pll.rate; in samsung_mipi_dcphy_configure()
1907 local = &sd->entity.pads[CSI2_DPHY_RX_PAD_SINK]; in get_remote_sensor()
1914 sensor_me = media_entity_remote_pad(local)->entity; in get_remote_sensor()
1923 for (i = 0; i < dphy->num_sensors; ++i) in sd_to_sensor()
1924 if (dphy->sensors[i].sd == sd) in sd_to_sensor()
1925 return &dphy->sensors[i]; in sd_to_sensor()
1933 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_config_settle()
1939 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { in samsung_dcphy_rx_config_settle()
1943 } else if (sensor->mbus.type == V4L2_MBUS_CSI2_CPHY) { in samsung_dcphy_rx_config_settle()
1948 dev_err(dphy->dev, "mbus type %d is not support", in samsung_dcphy_rx_config_settle()
1949 sensor->mbus.type); in samsung_dcphy_rx_config_settle()
1954 if (hsfreq_ranges[i].range_h >= dphy->data_rate_mbps) { in samsung_dcphy_rx_config_settle()
1961 i = num_hsfreq_ranges - 1; in samsung_dcphy_rx_config_settle()
1962 dev_warn(dphy->dev, "data rate: %lld mbps, max support %d mbps", in samsung_dcphy_rx_config_settle()
1963 dphy->data_rate_mbps, hsfreq_ranges[i].range_h + 1); in samsung_dcphy_rx_config_settle()
1967 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) in samsung_dcphy_rx_config_settle()
1968 regmap_write(samsung->regmap, RX_CLK_THS_SETTLE, 0x301); in samsung_dcphy_rx_config_settle()
1970 if (sensor->lanes > 0x00) { in samsung_dcphy_rx_config_settle()
1971 regmap_update_bits(samsung->regmap, RX_LANE0_THS_SETTLE, 0x1ff, hsfreq); in samsung_dcphy_rx_config_settle()
1972 regmap_update_bits(samsung->regmap, RX_LANE0_ERR_SOT_SYNC, 0xff, sot_sync); in samsung_dcphy_rx_config_settle()
1974 if (sensor->lanes > 0x01) { in samsung_dcphy_rx_config_settle()
1975 regmap_update_bits(samsung->regmap, RX_LANE1_THS_SETTLE, 0x1ff, hsfreq); in samsung_dcphy_rx_config_settle()
1976 regmap_update_bits(samsung->regmap, RX_LANE1_ERR_SOT_SYNC, 0xff, sot_sync); in samsung_dcphy_rx_config_settle()
1978 if (sensor->lanes > 0x02) { in samsung_dcphy_rx_config_settle()
1979 regmap_update_bits(samsung->regmap, RX_LANE2_THS_SETTLE, 0x1ff, hsfreq); in samsung_dcphy_rx_config_settle()
1980 regmap_update_bits(samsung->regmap, RX_LANE2_ERR_SOT_SYNC, 0xff, sot_sync); in samsung_dcphy_rx_config_settle()
1982 if (sensor->lanes > 0x03) { in samsung_dcphy_rx_config_settle()
1983 regmap_update_bits(samsung->regmap, RX_LANE3_THS_SETTLE, 0x1ff, hsfreq); in samsung_dcphy_rx_config_settle()
1984 regmap_update_bits(samsung->regmap, RX_LANE3_ERR_SOT_SYNC, 0xff, sot_sync); in samsung_dcphy_rx_config_settle()
1991 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_config_common()
1995 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { in samsung_dcphy_rx_config_common()
1996 if (dphy->data_rate_mbps < 1500) in samsung_dcphy_rx_config_common()
1998 else if (dphy->data_rate_mbps < 2000) in samsung_dcphy_rx_config_common()
1999 dlysel = 3 << 8; in samsung_dcphy_rx_config_common()
2000 else if (dphy->data_rate_mbps < 3000) in samsung_dcphy_rx_config_common()
2001 dlysel = 2 << 8; in samsung_dcphy_rx_config_common()
2002 else if (dphy->data_rate_mbps < 4000) in samsung_dcphy_rx_config_common()
2003 dlysel = 1 << 8; in samsung_dcphy_rx_config_common()
2004 else if (dphy->data_rate_mbps < 6500) in samsung_dcphy_rx_config_common()
2006 if (dphy->dphy_param.clk_hs_term_sel > 0x7) { in samsung_dcphy_rx_config_common()
2007 dev_err(dphy->dev, "clk_hs_term_sel error param %d\n", in samsung_dcphy_rx_config_common()
2008 dphy->dphy_param.clk_hs_term_sel); in samsung_dcphy_rx_config_common()
2009 return -EINVAL; in samsung_dcphy_rx_config_common()
2011 for (i = 0; i < sensor->lanes; i++) { in samsung_dcphy_rx_config_common()
2012 if (dphy->dphy_param.data_hs_term_sel[i] > 0x7) { in samsung_dcphy_rx_config_common()
2013 dev_err(dphy->dev, "data_hs_term_sel[%d] error param %d\n", in samsung_dcphy_rx_config_common()
2015 dphy->dphy_param.data_hs_term_sel[i]); in samsung_dcphy_rx_config_common()
2016 return -EINVAL; in samsung_dcphy_rx_config_common()
2018 if (dphy->dphy_param.lp_hys_sw[i] > 0x3) { in samsung_dcphy_rx_config_common()
2019 dev_err(dphy->dev, "lp_hys_sw[%d] error param %d\n", in samsung_dcphy_rx_config_common()
2021 dphy->dphy_param.lp_hys_sw[i]); in samsung_dcphy_rx_config_common()
2022 return -EINVAL; in samsung_dcphy_rx_config_common()
2024 if (dphy->dphy_param.lp_escclk_pol_sel[i] > 0x1) { in samsung_dcphy_rx_config_common()
2025 dev_err(dphy->dev, "lp_escclk_pol_sel[%d] error param %d\n", in samsung_dcphy_rx_config_common()
2027 dphy->dphy_param.lp_escclk_pol_sel[i]); in samsung_dcphy_rx_config_common()
2028 return -EINVAL; in samsung_dcphy_rx_config_common()
2030 if (dphy->dphy_param.skew_data_cal_clk[i] > 0x1f) { in samsung_dcphy_rx_config_common()
2031 dev_err(dphy->dev, "skew_data_cal_clk[%d] error param %d\n", in samsung_dcphy_rx_config_common()
2033 dphy->dphy_param.skew_data_cal_clk[i]); in samsung_dcphy_rx_config_common()
2034 return -EINVAL; in samsung_dcphy_rx_config_common()
2037 regmap_write(samsung->regmap, RX_S0C_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2038 regmap_write(samsung->regmap, RX_S0C_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2039 regmap_write(samsung->regmap, RX_S0C_ANA_CON2, dphy->dphy_param.clk_hs_term_sel); in samsung_dcphy_rx_config_common()
2040 regmap_write(samsung->regmap, RX_S0C_ANA_CON3, 0x0600); in samsung_dcphy_rx_config_common()
2041 if (sensor->lanes > 0x00) { in samsung_dcphy_rx_config_common()
2042 regmap_write(samsung->regmap, RX_COMBO_S0D0_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2043 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2044 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON2, dlysel | in samsung_dcphy_rx_config_common()
2045 dphy->dphy_param.data_hs_term_sel[0]); in samsung_dcphy_rx_config_common()
2046 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON3, 0x0600 | in samsung_dcphy_rx_config_common()
2047 (dphy->dphy_param.lp_hys_sw[0] << 4) | in samsung_dcphy_rx_config_common()
2048 (dphy->dphy_param.lp_escclk_pol_sel[0] << 11)); in samsung_dcphy_rx_config_common()
2049 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2050 regmap_write(samsung->regmap, RX_COMBO_S0D0_DESKEW_CON2, in samsung_dcphy_rx_config_common()
2051 dphy->dphy_param.skew_data_cal_clk[0]); in samsung_dcphy_rx_config_common()
2053 if (sensor->lanes > 0x01) { in samsung_dcphy_rx_config_common()
2054 regmap_write(samsung->regmap, RX_COMBO_S0D1_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2055 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2056 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON2, dlysel | in samsung_dcphy_rx_config_common()
2057 dphy->dphy_param.data_hs_term_sel[1]); in samsung_dcphy_rx_config_common()
2058 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON3, 0x0600 | in samsung_dcphy_rx_config_common()
2059 (dphy->dphy_param.lp_hys_sw[1] << 4) | in samsung_dcphy_rx_config_common()
2060 (dphy->dphy_param.lp_escclk_pol_sel[1] << 11)); in samsung_dcphy_rx_config_common()
2061 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2062 regmap_write(samsung->regmap, RX_COMBO_S0D1_DESKEW_CON2, in samsung_dcphy_rx_config_common()
2063 dphy->dphy_param.skew_data_cal_clk[1]); in samsung_dcphy_rx_config_common()
2065 if (sensor->lanes > 0x02) { in samsung_dcphy_rx_config_common()
2066 regmap_write(samsung->regmap, RX_COMBO_S0D2_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2067 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2068 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON2, dlysel | in samsung_dcphy_rx_config_common()
2069 dphy->dphy_param.data_hs_term_sel[2]); in samsung_dcphy_rx_config_common()
2070 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON3, 0x0600 | in samsung_dcphy_rx_config_common()
2071 (dphy->dphy_param.lp_hys_sw[2] << 4) | in samsung_dcphy_rx_config_common()
2072 (dphy->dphy_param.lp_escclk_pol_sel[2] << 11)); in samsung_dcphy_rx_config_common()
2073 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2074 regmap_write(samsung->regmap, RX_COMBO_S0D2_DESKEW_CON2, in samsung_dcphy_rx_config_common()
2075 dphy->dphy_param.skew_data_cal_clk[2]); in samsung_dcphy_rx_config_common()
2077 if (sensor->lanes > 0x03) { in samsung_dcphy_rx_config_common()
2078 regmap_write(samsung->regmap, RX_S0D3_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2079 regmap_write(samsung->regmap, RX_S0D3_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2080 regmap_write(samsung->regmap, RX_S0D3_ANA_CON2, dlysel | in samsung_dcphy_rx_config_common()
2081 dphy->dphy_param.data_hs_term_sel[3]); in samsung_dcphy_rx_config_common()
2082 regmap_write(samsung->regmap, RX_S0D3_ANA_CON3, 0x0600 | in samsung_dcphy_rx_config_common()
2083 (dphy->dphy_param.lp_hys_sw[3] << 4) | in samsung_dcphy_rx_config_common()
2084 (dphy->dphy_param.lp_escclk_pol_sel[3] << 11)); in samsung_dcphy_rx_config_common()
2085 regmap_write(samsung->regmap, RX_S0D3_DESKEW_CON2, in samsung_dcphy_rx_config_common()
2086 dphy->dphy_param.skew_data_cal_clk[3]); in samsung_dcphy_rx_config_common()
2089 if (sensor->lanes > 0x00) { in samsung_dcphy_rx_config_common()
2090 regmap_write(samsung->regmap, RX_COMBO_S0D0_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2091 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2092 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON2, 0x5); in samsung_dcphy_rx_config_common()
2093 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON3, 0x600); in samsung_dcphy_rx_config_common()
2094 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON6, 0x608); in samsung_dcphy_rx_config_common()
2095 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2096 regmap_write(samsung->regmap, RX_COMBO_S0D0_CRC_CON1, 0x1500); in samsung_dcphy_rx_config_common()
2097 regmap_write(samsung->regmap, RX_COMBO_S0D0_CRC_CON2, 0x30); in samsung_dcphy_rx_config_common()
2099 if (sensor->lanes > 0x01) { in samsung_dcphy_rx_config_common()
2100 regmap_write(samsung->regmap, RX_COMBO_S0D1_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2101 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2102 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON2, 0x5); in samsung_dcphy_rx_config_common()
2103 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON3, 0x600); in samsung_dcphy_rx_config_common()
2104 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON6, 0x608); in samsung_dcphy_rx_config_common()
2105 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2106 regmap_write(samsung->regmap, RX_COMBO_S0D1_CRC_CON1, 0x1500); in samsung_dcphy_rx_config_common()
2107 regmap_write(samsung->regmap, RX_COMBO_S0D1_CRC_CON2, 0x30); in samsung_dcphy_rx_config_common()
2109 if (sensor->lanes > 0x02) { in samsung_dcphy_rx_config_common()
2110 regmap_write(samsung->regmap, RX_COMBO_S0D2_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2111 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2112 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON2, 0x5); in samsung_dcphy_rx_config_common()
2113 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON3, 0x600); in samsung_dcphy_rx_config_common()
2114 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON6, 0x608); in samsung_dcphy_rx_config_common()
2115 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2116 regmap_write(samsung->regmap, RX_COMBO_S0D2_CRC_CON1, 0x1500); in samsung_dcphy_rx_config_common()
2117 regmap_write(samsung->regmap, RX_COMBO_S0D2_CRC_CON2, 0x30); in samsung_dcphy_rx_config_common()
2126 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_lane_enable()
2130 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) in samsung_dcphy_rx_lane_enable()
2131 regmap_update_bits(samsung->regmap, RX_CLK_LANE_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2133 if (sensor->lanes > 0x00) in samsung_dcphy_rx_lane_enable()
2134 regmap_update_bits(samsung->regmap, RX_DATA_LANE0_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2135 if (sensor->lanes > 0x01) in samsung_dcphy_rx_lane_enable()
2136 regmap_update_bits(samsung->regmap, RX_DATA_LANE1_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2137 if (sensor->lanes > 0x02) in samsung_dcphy_rx_lane_enable()
2138 regmap_update_bits(samsung->regmap, RX_DATA_LANE2_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2139 if (sensor->lanes > 0x03) in samsung_dcphy_rx_lane_enable()
2140 regmap_update_bits(samsung->regmap, RX_DATA_LANE3_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2143 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { in samsung_dcphy_rx_lane_enable()
2144 ret = regmap_read_poll_timeout(samsung->regmap, RX_CLK_LANE_ENABLE, in samsung_dcphy_rx_lane_enable()
2147 dev_err(samsung->dev, "phy rx clk lane is not locked\n"); in samsung_dcphy_rx_lane_enable()
2148 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2153 if (sensor->lanes > 0x00) { in samsung_dcphy_rx_lane_enable()
2154 ret = regmap_read_poll_timeout(samsung->regmap, RX_DATA_LANE0_ENABLE, in samsung_dcphy_rx_lane_enable()
2157 dev_err(samsung->dev, "phy rx data lane 0 is not locked\n"); in samsung_dcphy_rx_lane_enable()
2158 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2161 if (sensor->lanes > 0x01) { in samsung_dcphy_rx_lane_enable()
2162 ret = regmap_read_poll_timeout(samsung->regmap, RX_DATA_LANE1_ENABLE, in samsung_dcphy_rx_lane_enable()
2165 dev_err(samsung->dev, "phy rx data lane 1 is not locked\n"); in samsung_dcphy_rx_lane_enable()
2166 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2169 if (sensor->lanes > 0x02) { in samsung_dcphy_rx_lane_enable()
2170 ret = regmap_read_poll_timeout(samsung->regmap, RX_DATA_LANE2_ENABLE, in samsung_dcphy_rx_lane_enable()
2173 dev_err(samsung->dev, "phy rx data lane 2 is not locked\n"); in samsung_dcphy_rx_lane_enable()
2174 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2178 if (sensor->lanes > 0x03) { in samsung_dcphy_rx_lane_enable()
2179 ret = regmap_read_poll_timeout(samsung->regmap, RX_DATA_LANE3_ENABLE, in samsung_dcphy_rx_lane_enable()
2182 dev_err(samsung->dev, "phy rx data lane 3 is not locked\n"); in samsung_dcphy_rx_lane_enable()
2183 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2194 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_stream_on()
2198 return -ENODEV; in samsung_dcphy_rx_stream_on()
2201 return -ENODEV; in samsung_dcphy_rx_stream_on()
2203 mutex_lock(&samsung->mutex); in samsung_dcphy_rx_stream_on()
2204 if (sensor->mbus.type == V4L2_MBUS_CSI2_CPHY) in samsung_dcphy_rx_stream_on()
2205 regmap_write(samsung->grf_regmap, MIPI_DCPHY_GRF_CON0, S_CPHY_MODE); in samsung_dcphy_rx_stream_on()
2207 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_on()
2208 reset_control_assert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_on()
2220 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_on()
2221 reset_control_deassert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_on()
2223 atomic_inc(&samsung->stream_cnt); in samsung_dcphy_rx_stream_on()
2224 mutex_unlock(&samsung->mutex); in samsung_dcphy_rx_stream_on()
2228 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_on()
2229 reset_control_deassert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_on()
2230 mutex_unlock(&samsung->mutex); in samsung_dcphy_rx_stream_on()
2231 dev_err(dphy->dev, "stream on error\n"); in samsung_dcphy_rx_stream_on()
2232 return -EINVAL; in samsung_dcphy_rx_stream_on()
2239 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_stream_off()
2244 return -ENODEV; in samsung_dcphy_rx_stream_off()
2247 return -ENODEV; in samsung_dcphy_rx_stream_off()
2249 if (atomic_dec_return(&samsung->stream_cnt)) in samsung_dcphy_rx_stream_off()
2252 mutex_lock(&samsung->mutex); in samsung_dcphy_rx_stream_off()
2253 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_off()
2254 reset_control_assert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_off()
2256 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) in samsung_dcphy_rx_stream_off()
2257 regmap_update_bits(samsung->regmap, RX_CLK_LANE_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2259 if (sensor->lanes > 0x00) in samsung_dcphy_rx_stream_off()
2260 regmap_update_bits(samsung->regmap, RX_DATA_LANE0_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2261 if (sensor->lanes > 0x01) in samsung_dcphy_rx_stream_off()
2262 regmap_update_bits(samsung->regmap, RX_DATA_LANE1_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2263 if (sensor->lanes > 0x02) in samsung_dcphy_rx_stream_off()
2264 regmap_update_bits(samsung->regmap, RX_DATA_LANE2_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2265 if (sensor->lanes > 0x03) in samsung_dcphy_rx_stream_off()
2266 regmap_update_bits(samsung->regmap, RX_DATA_LANE3_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2268 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_off()
2269 reset_control_deassert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_off()
2272 mutex_unlock(&samsung->mutex); in samsung_dcphy_rx_stream_off()
2281 pm_runtime_get_sync(samsung->dev); in samsung_mipi_dcphy_init()
2290 pm_runtime_put(samsung->dev); in samsung_mipi_dcphy_exit()
2314 struct device *dev = &pdev->dev; in samsung_mipi_dcphy_probe()
2315 struct device_node *np = dev->of_node; in samsung_mipi_dcphy_probe()
2325 return -ENOMEM; in samsung_mipi_dcphy_probe()
2327 samsung->dev = dev; in samsung_mipi_dcphy_probe()
2335 samsung->regmap = devm_regmap_init_mmio(dev, regs, in samsung_mipi_dcphy_probe()
2337 if (IS_ERR(samsung->regmap)) { in samsung_mipi_dcphy_probe()
2338 ret = PTR_ERR(samsung->regmap); in samsung_mipi_dcphy_probe()
2343 samsung->grf_regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); in samsung_mipi_dcphy_probe()
2344 if (IS_ERR(samsung->grf_regmap)) { in samsung_mipi_dcphy_probe()
2346 return PTR_ERR(samsung->grf_regmap); in samsung_mipi_dcphy_probe()
2349 samsung->ref_clk = devm_clk_get(dev, "ref"); in samsung_mipi_dcphy_probe()
2350 if (IS_ERR(samsung->ref_clk)) { in samsung_mipi_dcphy_probe()
2352 return PTR_ERR(samsung->ref_clk); in samsung_mipi_dcphy_probe()
2355 samsung->pclk = devm_clk_get(dev, "pclk"); in samsung_mipi_dcphy_probe()
2356 if (IS_ERR(samsung->pclk)) { in samsung_mipi_dcphy_probe()
2358 return PTR_ERR(samsung->pclk); in samsung_mipi_dcphy_probe()
2361 samsung->m_phy_rst = devm_reset_control_get(dev, "m_phy"); in samsung_mipi_dcphy_probe()
2362 if (IS_ERR(samsung->m_phy_rst)) { in samsung_mipi_dcphy_probe()
2364 return PTR_ERR(samsung->m_phy_rst); in samsung_mipi_dcphy_probe()
2367 samsung->s_phy_rst = devm_reset_control_get(dev, "s_phy"); in samsung_mipi_dcphy_probe()
2368 if (IS_ERR(samsung->s_phy_rst)) { in samsung_mipi_dcphy_probe()
2370 return PTR_ERR(samsung->s_phy_rst); in samsung_mipi_dcphy_probe()
2373 samsung->apb_rst = devm_reset_control_get(dev, "apb"); in samsung_mipi_dcphy_probe()
2374 if (IS_ERR(samsung->apb_rst)) { in samsung_mipi_dcphy_probe()
2376 return PTR_ERR(samsung->apb_rst); in samsung_mipi_dcphy_probe()
2379 samsung->grf_apb_rst = devm_reset_control_get(dev, "grf"); in samsung_mipi_dcphy_probe()
2380 if (IS_ERR(samsung->grf_apb_rst)) { in samsung_mipi_dcphy_probe()
2382 return PTR_ERR(samsung->grf_apb_rst); in samsung_mipi_dcphy_probe()
2387 dev_err(dev, "failed to create MIPI Dc-PHY\n"); in samsung_mipi_dcphy_probe()
2399 samsung->stream_on = samsung_dcphy_rx_stream_on; in samsung_mipi_dcphy_probe()
2400 samsung->stream_off = samsung_dcphy_rx_stream_off; in samsung_mipi_dcphy_probe()
2401 mutex_init(&samsung->mutex); in samsung_mipi_dcphy_probe()
2411 pm_runtime_disable(samsung->dev); in samsung_mipi_dcphy_remove()
2412 mutex_destroy(&samsung->mutex); in samsung_mipi_dcphy_remove()
2421 clk_disable_unprepare(samsung->pclk); in samsung_mipi_dcphy_runtime_suspend()
2422 clk_disable_unprepare(samsung->ref_clk); in samsung_mipi_dcphy_runtime_suspend()
2431 clk_prepare_enable(samsung->pclk); in samsung_mipi_dcphy_runtime_resume()
2432 clk_prepare_enable(samsung->ref_clk); in samsung_mipi_dcphy_runtime_resume()
2444 .compatible = "rockchip,rk3588-mipi-dcphy",
2452 .name = "samsung-mipi-dcphy",
2461 MODULE_AUTHOR("Guochun Huang<hero.huang@rock-chips.com>");