Skip to content

Commit b201a9b

Browse files
committed
media: i2c: imx477: Extract more registers from mode tables to common
There are a fair number of registers duplicated in all the mode tables, so move those into the common table. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent bd0e8df commit b201a9b

File tree

1 file changed

+43
-172
lines changed

1 file changed

+43
-172
lines changed

drivers/media/i2c/imx477.c

Lines changed: 43 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,49 @@ static const struct imx477_reg mode_common_regs[] = {
516516
{0x0350, 0x00},
517517
{0xbcf1, 0x02},
518518
{0x3ff9, 0x01},
519+
{0x0220, 0x00},
520+
{0x0221, 0x11},
521+
{0x0381, 0x01},
522+
{0x0383, 0x01},
523+
{0x0385, 0x01},
524+
{0x0387, 0x01},
525+
{0x0902, 0x02},
526+
{0x3140, 0x02},
527+
{0x3c00, 0x00},
528+
{0x9e9a, 0x2f},
529+
{0x9e9b, 0x2f},
530+
{0x9e9c, 0x2f},
531+
{0x9e9d, 0x00},
532+
{0x9e9e, 0x00},
533+
{0x9e9f, 0x00},
534+
{0x0301, 0x05},
535+
{0x0303, 0x02},
536+
{0x030b, 0x02},
537+
{0x030d, 0x02},
538+
{0x0310, 0x01},
539+
{0x0820, 0x07},
540+
{0x0821, 0x08},
541+
{0x0822, 0x00},
542+
{0x0823, 0x00},
543+
{0x080a, 0x00},
544+
{0x080b, 0x7f},
545+
{0x080c, 0x00},
546+
{0x080d, 0x4f},
547+
{0x080e, 0x00},
548+
{0x080f, 0x77},
549+
{0x0810, 0x00},
550+
{0x0811, 0x5f},
551+
{0x0812, 0x00},
552+
{0x0813, 0x57},
553+
{0x0814, 0x00},
554+
{0x0815, 0x4f},
555+
{0x0816, 0x01},
556+
{0x0817, 0x27},
557+
{0x0818, 0x00},
558+
{0x0819, 0x3f},
559+
{0x3e20, 0x01},
560+
{0x3e37, 0x00},
561+
{0x3f50, 0x00},
519562
};
520563

521564
/* 12 mpix 10fps */
@@ -536,17 +579,8 @@ static const struct imx477_reg mode_4056x3040_regs[] = {
536579
{0x00fd, 0x0a},
537580
{0x00fe, 0x0a},
538581
{0x00ff, 0x0a},
539-
{0x0220, 0x00},
540-
{0x0221, 0x11},
541-
{0x0381, 0x01},
542-
{0x0383, 0x01},
543-
{0x0385, 0x01},
544-
{0x0387, 0x01},
545582
{0x0900, 0x00},
546583
{0x0901, 0x11},
547-
{0x0902, 0x02},
548-
{0x3140, 0x02},
549-
{0x3c00, 0x00},
550584
{0x3c01, 0x03},
551585
{0x3c02, 0xa2},
552586
{0x3f0d, 0x01},
@@ -565,12 +599,6 @@ static const struct imx477_reg mode_4056x3040_regs[] = {
565599
{0x936d, 0x28},
566600
{0x9304, 0x00},
567601
{0x9305, 0x00},
568-
{0x9e9a, 0x2f},
569-
{0x9e9b, 0x2f},
570-
{0x9e9c, 0x2f},
571-
{0x9e9d, 0x00},
572-
{0x9e9e, 0x00},
573-
{0x9e9f, 0x00},
574602
{0xa2a9, 0x60},
575603
{0xa2b7, 0x00},
576604
{0x0401, 0x00},
@@ -588,42 +616,14 @@ static const struct imx477_reg mode_4056x3040_regs[] = {
588616
{0x034d, 0xd8},
589617
{0x034e, 0x0b},
590618
{0x034f, 0xe0},
591-
{0x0301, 0x05},
592-
{0x0303, 0x02},
593619
{0x0305, 0x04},
594620
{0x0306, 0x01},
595621
{0x0307, 0x5e},
596622
{0x0309, 0x0c},
597-
{0x030b, 0x02},
598-
{0x030d, 0x02},
599-
{0x0310, 0x01},
600-
{0x0820, 0x07},
601-
{0x0821, 0x08},
602-
{0x0822, 0x00},
603-
{0x0823, 0x00},
604-
{0x080a, 0x00},
605-
{0x080b, 0x7f},
606-
{0x080c, 0x00},
607-
{0x080d, 0x4f},
608-
{0x080e, 0x00},
609-
{0x080f, 0x77},
610-
{0x0810, 0x00},
611-
{0x0811, 0x5f},
612-
{0x0812, 0x00},
613-
{0x0813, 0x57},
614-
{0x0814, 0x00},
615-
{0x0815, 0x4f},
616-
{0x0816, 0x01},
617-
{0x0817, 0x27},
618-
{0x0818, 0x00},
619-
{0x0819, 0x3f},
620623
{0xe04c, 0x00},
621624
{0xe04d, 0x7f},
622625
{0xe04e, 0x00},
623626
{0xe04f, 0x1f},
624-
{0x3e20, 0x01},
625-
{0x3e37, 0x00},
626-
{0x3f50, 0x00},
627627
{0x3f56, 0x02},
628628
{0x3f57, 0xae},
629629
};
@@ -640,17 +640,8 @@ static const struct imx477_reg mode_2028x1520_regs[] = {
640640
{0x0349, 0xd7},
641641
{0x034a, 0x0b},
642642
{0x034b, 0xdf},
643-
{0x0220, 0x00},
644-
{0x0221, 0x11},
645-
{0x0381, 0x01},
646-
{0x0383, 0x01},
647-
{0x0385, 0x01},
648-
{0x0387, 0x01},
649643
{0x0900, 0x01},
650644
{0x0901, 0x22},
651-
{0x0902, 0x02},
652-
{0x3140, 0x02},
653-
{0x3c00, 0x00},
654645
{0x3c01, 0x03},
655646
{0x3c02, 0xa2},
656647
{0x3f0d, 0x01},
@@ -664,12 +655,6 @@ static const struct imx477_reg mode_2028x1520_regs[] = {
664655
{0x936d, 0x5f},
665656
{0x9304, 0x00},
666657
{0x9305, 0x00},
667-
{0x9e9a, 0x2f},
668-
{0x9e9b, 0x2f},
669-
{0x9e9c, 0x2f},
670-
{0x9e9d, 0x00},
671-
{0x9e9e, 0x00},
672-
{0x9e9f, 0x00},
673658
{0xa2a9, 0x60},
674659
{0xa2b7, 0x00},
675660
{0x0401, 0x00},
@@ -687,42 +672,14 @@ static const struct imx477_reg mode_2028x1520_regs[] = {
687672
{0x034d, 0xec},
688673
{0x034e, 0x05},
689674
{0x034f, 0xf0},
690-
{0x0301, 0x05},
691-
{0x0303, 0x02},
692675
{0x0305, 0x04},
693676
{0x0306, 0x01},
694677
{0x0307, 0x5e},
695678
{0x0309, 0x0c},
696-
{0x030b, 0x02},
697-
{0x030d, 0x02},
698-
{0x0310, 0x01},
699-
{0x0820, 0x07},
700-
{0x0821, 0x08},
701-
{0x0822, 0x00},
702-
{0x0823, 0x00},
703-
{0x080a, 0x00},
704-
{0x080b, 0x7f},
705-
{0x080c, 0x00},
706-
{0x080d, 0x4f},
707-
{0x080e, 0x00},
708-
{0x080f, 0x77},
709-
{0x0810, 0x00},
710-
{0x0811, 0x5f},
711-
{0x0812, 0x00},
712-
{0x0813, 0x57},
713-
{0x0814, 0x00},
714-
{0x0815, 0x4f},
715-
{0x0816, 0x01},
716-
{0x0817, 0x27},
717-
{0x0818, 0x00},
718-
{0x0819, 0x3f},
719679
{0xe04c, 0x00},
720680
{0xe04d, 0x7f},
721681
{0xe04e, 0x00},
722682
{0xe04f, 0x1f},
723-
{0x3e20, 0x01},
724-
{0x3e37, 0x00},
725-
{0x3f50, 0x00},
726683
{0x3f56, 0x01},
727684
{0x3f57, 0x6c},
728685
};
@@ -739,17 +696,8 @@ static const struct imx477_reg mode_2028x1080_regs[] = {
739696
{0x0349, 0xd7},
740697
{0x034a, 0x0a},
741698
{0x034b, 0x27},
742-
{0x0220, 0x00},
743-
{0x0221, 0x11},
744-
{0x0381, 0x01},
745-
{0x0383, 0x01},
746-
{0x0385, 0x01},
747-
{0x0387, 0x01},
748699
{0x0900, 0x01},
749700
{0x0901, 0x22},
750-
{0x0902, 0x02},
751-
{0x3140, 0x02},
752-
{0x3c00, 0x00},
753701
{0x3c01, 0x03},
754702
{0x3c02, 0xa2},
755703
{0x3f0d, 0x01},
@@ -763,12 +711,6 @@ static const struct imx477_reg mode_2028x1080_regs[] = {
763711
{0x936d, 0x5f},
764712
{0x9304, 0x00},
765713
{0x9305, 0x00},
766-
{0x9e9a, 0x2f},
767-
{0x9e9b, 0x2f},
768-
{0x9e9c, 0x2f},
769-
{0x9e9d, 0x00},
770-
{0x9e9e, 0x00},
771-
{0x9e9f, 0x00},
772714
{0xa2a9, 0x60},
773715
{0xa2b7, 0x00},
774716
{0x0401, 0x00},
@@ -786,42 +728,14 @@ static const struct imx477_reg mode_2028x1080_regs[] = {
786728
{0x034d, 0xec},
787729
{0x034e, 0x04},
788730
{0x034f, 0x38},
789-
{0x0301, 0x05},
790-
{0x0303, 0x02},
791731
{0x0305, 0x04},
792732
{0x0306, 0x01},
793733
{0x0307, 0x5e},
794734
{0x0309, 0x0c},
795-
{0x030b, 0x02},
796-
{0x030d, 0x02},
797-
{0x0310, 0x01},
798-
{0x0820, 0x07},
799-
{0x0821, 0x08},
800-
{0x0822, 0x00},
801-
{0x0823, 0x00},
802-
{0x080a, 0x00},
803-
{0x080b, 0x7f},
804-
{0x080c, 0x00},
805-
{0x080d, 0x4f},
806-
{0x080e, 0x00},
807-
{0x080f, 0x77},
808-
{0x0810, 0x00},
809-
{0x0811, 0x5f},
810-
{0x0812, 0x00},
811-
{0x0813, 0x57},
812-
{0x0814, 0x00},
813-
{0x0815, 0x4f},
814-
{0x0816, 0x01},
815-
{0x0817, 0x27},
816-
{0x0818, 0x00},
817-
{0x0819, 0x3f},
818735
{0xe04c, 0x00},
819736
{0xe04d, 0x7f},
820737
{0xe04e, 0x00},
821738
{0xe04f, 0x1f},
822-
{0x3e20, 0x01},
823-
{0x3e37, 0x00},
824-
{0x3f50, 0x00},
825739
{0x3f56, 0x01},
826740
{0x3f57, 0x6c},
827741
};
@@ -857,17 +771,8 @@ static const struct imx477_reg mode_1332x990_regs[] = {
857771
{0x00fe, 0x0a},
858772
{0x00ff, 0x0a},
859773
{0xe013, 0x00},
860-
{0x0220, 0x00},
861-
{0x0221, 0x11},
862-
{0x0381, 0x01},
863-
{0x0383, 0x01},
864-
{0x0385, 0x01},
865-
{0x0387, 0x01},
866774
{0x0900, 0x01},
867775
{0x0901, 0x22},
868-
{0x0902, 0x02},
869-
{0x3140, 0x02},
870-
{0x3c00, 0x00},
871776
{0x3c01, 0x01},
872777
{0x3c02, 0x9c},
873778
{0x3f0d, 0x00},
@@ -886,12 +791,6 @@ static const struct imx477_reg mode_1332x990_regs[] = {
886791
{0x936d, 0x5f},
887792
{0x9304, 0x03},
888793
{0x9305, 0x80},
889-
{0x9e9a, 0x2f},
890-
{0x9e9b, 0x2f},
891-
{0x9e9c, 0x2f},
892-
{0x9e9d, 0x00},
893-
{0x9e9e, 0x00},
894-
{0x9e9f, 0x00},
895794
{0xa2a9, 0x27},
896795
{0xa2b7, 0x03},
897796
{0x0401, 0x00},
@@ -909,42 +808,14 @@ static const struct imx477_reg mode_1332x990_regs[] = {
909808
{0x034d, 0x34},
910809
{0x034e, 0x03},
911810
{0x034f, 0xde},
912-
{0x0301, 0x05},
913-
{0x0303, 0x02},
914811
{0x0305, 0x02},
915812
{0x0306, 0x00},
916813
{0x0307, 0xaf},
917814
{0x0309, 0x0a},
918-
{0x030b, 0x02},
919-
{0x030d, 0x02},
920-
{0x0310, 0x01},
921-
{0x0820, 0x07},
922-
{0x0821, 0x08},
923-
{0x0822, 0x00},
924-
{0x0823, 0x00},
925-
{0x080a, 0x00},
926-
{0x080b, 0x7f},
927-
{0x080c, 0x00},
928-
{0x080d, 0x4f},
929-
{0x080e, 0x00},
930-
{0x080f, 0x77},
931-
{0x0810, 0x00},
932-
{0x0811, 0x5f},
933-
{0x0812, 0x00},
934-
{0x0813, 0x57},
935-
{0x0814, 0x00},
936-
{0x0815, 0x4f},
937-
{0x0816, 0x01},
938-
{0x0817, 0x27},
939-
{0x0818, 0x00},
940-
{0x0819, 0x3f},
941815
{0xe04c, 0x00},
942816
{0xe04d, 0x5f},
943817
{0xe04e, 0x00},
944818
{0xe04f, 0x1f},
945-
{0x3e20, 0x01},
946-
{0x3e37, 0x00},
947-
{0x3f50, 0x00},
948819
{0x3f56, 0x00},
949820
{0x3f57, 0xbf},
950821
};

0 commit comments

Comments
 (0)