Skip to content

Commit 8791851

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 28a4b8d commit 8791851

File tree

1 file changed

+45
-180
lines changed

1 file changed

+45
-180
lines changed

drivers/media/i2c/imx477.c

Lines changed: 45 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,51 @@ static const struct imx477_reg mode_common_regs[] = {
476476
{0x0350, 0x00},
477477
{0xbcf1, 0x02},
478478
{0x3ff9, 0x01},
479+
{0x0220, 0x00},
480+
{0x0221, 0x11},
481+
{0x0381, 0x01},
482+
{0x0383, 0x01},
483+
{0x0385, 0x01},
484+
{0x0387, 0x01},
485+
{0x0902, 0x02},
486+
{0x3140, 0x02},
487+
{0x3c00, 0x00},
488+
{0x9e9a, 0x2f},
489+
{0x9e9b, 0x2f},
490+
{0x9e9c, 0x2f},
491+
{0x9e9d, 0x00},
492+
{0x9e9e, 0x00},
493+
{0x9e9f, 0x00},
494+
{0x0301, 0x05},
495+
{0x0303, 0x02},
496+
{0x030b, 0x02},
497+
{0x030d, 0x02},
498+
{0x030e, 0x00},
499+
{0x030f, 0x96},
500+
{0x0310, 0x01},
501+
{0x0820, 0x07},
502+
{0x0821, 0x08},
503+
{0x0822, 0x00},
504+
{0x0823, 0x00},
505+
{0x080a, 0x00},
506+
{0x080b, 0x7f},
507+
{0x080c, 0x00},
508+
{0x080d, 0x4f},
509+
{0x080e, 0x00},
510+
{0x080f, 0x77},
511+
{0x0810, 0x00},
512+
{0x0811, 0x5f},
513+
{0x0812, 0x00},
514+
{0x0813, 0x57},
515+
{0x0814, 0x00},
516+
{0x0815, 0x4f},
517+
{0x0816, 0x01},
518+
{0x0817, 0x27},
519+
{0x0818, 0x00},
520+
{0x0819, 0x3f},
521+
{0x3e20, 0x01},
522+
{0x3e37, 0x00},
523+
{0x3f50, 0x00},
479524
};
480525

481526
/* 12 mpix 10fps */
@@ -496,17 +541,8 @@ static const struct imx477_reg mode_4056x3040_regs[] = {
496541
{0x00fd, 0x0a},
497542
{0x00fe, 0x0a},
498543
{0x00ff, 0x0a},
499-
{0x0220, 0x00},
500-
{0x0221, 0x11},
501-
{0x0381, 0x01},
502-
{0x0383, 0x01},
503-
{0x0385, 0x01},
504-
{0x0387, 0x01},
505544
{0x0900, 0x00},
506545
{0x0901, 0x11},
507-
{0x0902, 0x02},
508-
{0x3140, 0x02},
509-
{0x3c00, 0x00},
510546
{0x3c01, 0x03},
511547
{0x3c02, 0xa2},
512548
{0x3f0d, 0x01},
@@ -525,12 +561,6 @@ static const struct imx477_reg mode_4056x3040_regs[] = {
525561
{0x936d, 0x28},
526562
{0x9304, 0x00},
527563
{0x9305, 0x00},
528-
{0x9e9a, 0x2f},
529-
{0x9e9b, 0x2f},
530-
{0x9e9c, 0x2f},
531-
{0x9e9d, 0x00},
532-
{0x9e9e, 0x00},
533-
{0x9e9f, 0x00},
534564
{0xa2a9, 0x60},
535565
{0xa2b7, 0x00},
536566
{0x0401, 0x00},
@@ -548,44 +578,14 @@ static const struct imx477_reg mode_4056x3040_regs[] = {
548578
{0x034d, 0xd8},
549579
{0x034e, 0x0b},
550580
{0x034f, 0xe0},
551-
{0x0301, 0x05},
552-
{0x0303, 0x02},
553581
{0x0305, 0x04},
554582
{0x0306, 0x01},
555583
{0x0307, 0x5e},
556584
{0x0309, 0x0c},
557-
{0x030b, 0x02},
558-
{0x030d, 0x02},
559-
{0x030e, 0x00},
560-
{0x030f, 0x96},
561-
{0x0310, 0x01},
562-
{0x0820, 0x07},
563-
{0x0821, 0x08},
564-
{0x0822, 0x00},
565-
{0x0823, 0x00},
566-
{0x080a, 0x00},
567-
{0x080b, 0x7f},
568-
{0x080c, 0x00},
569-
{0x080d, 0x4f},
570-
{0x080e, 0x00},
571-
{0x080f, 0x77},
572-
{0x0810, 0x00},
573-
{0x0811, 0x5f},
574-
{0x0812, 0x00},
575-
{0x0813, 0x57},
576-
{0x0814, 0x00},
577-
{0x0815, 0x4f},
578-
{0x0816, 0x01},
579-
{0x0817, 0x27},
580-
{0x0818, 0x00},
581-
{0x0819, 0x3f},
582585
{0xe04c, 0x00},
583586
{0xe04d, 0x7f},
584587
{0xe04e, 0x00},
585588
{0xe04f, 0x1f},
586-
{0x3e20, 0x01},
587-
{0x3e37, 0x00},
588-
{0x3f50, 0x00},
589589
{0x3f56, 0x02},
590590
{0x3f57, 0xae},
591591
};
@@ -602,17 +602,8 @@ static const struct imx477_reg mode_2028x1520_regs[] = {
602602
{0x0349, 0xd7},
603603
{0x034a, 0x0b},
604604
{0x034b, 0xdf},
605-
{0x0220, 0x00},
606-
{0x0221, 0x11},
607-
{0x0381, 0x01},
608-
{0x0383, 0x01},
609-
{0x0385, 0x01},
610-
{0x0387, 0x01},
611605
{0x0900, 0x01},
612606
{0x0901, 0x22},
613-
{0x0902, 0x02},
614-
{0x3140, 0x02},
615-
{0x3c00, 0x00},
616607
{0x3c01, 0x03},
617608
{0x3c02, 0xa2},
618609
{0x3f0d, 0x01},
@@ -626,12 +617,6 @@ static const struct imx477_reg mode_2028x1520_regs[] = {
626617
{0x936d, 0x5f},
627618
{0x9304, 0x00},
628619
{0x9305, 0x00},
629-
{0x9e9a, 0x2f},
630-
{0x9e9b, 0x2f},
631-
{0x9e9c, 0x2f},
632-
{0x9e9d, 0x00},
633-
{0x9e9e, 0x00},
634-
{0x9e9f, 0x00},
635620
{0xa2a9, 0x60},
636621
{0xa2b7, 0x00},
637622
{0x0401, 0x00},
@@ -649,44 +634,14 @@ static const struct imx477_reg mode_2028x1520_regs[] = {
649634
{0x034d, 0xec},
650635
{0x034e, 0x05},
651636
{0x034f, 0xf0},
652-
{0x0301, 0x05},
653-
{0x0303, 0x02},
654637
{0x0305, 0x04},
655638
{0x0306, 0x01},
656639
{0x0307, 0x5e},
657640
{0x0309, 0x0c},
658-
{0x030b, 0x02},
659-
{0x030d, 0x02},
660-
{0x030e, 0x00},
661-
{0x030f, 0x96},
662-
{0x0310, 0x01},
663-
{0x0820, 0x07},
664-
{0x0821, 0x08},
665-
{0x0822, 0x00},
666-
{0x0823, 0x00},
667-
{0x080a, 0x00},
668-
{0x080b, 0x7f},
669-
{0x080c, 0x00},
670-
{0x080d, 0x4f},
671-
{0x080e, 0x00},
672-
{0x080f, 0x77},
673-
{0x0810, 0x00},
674-
{0x0811, 0x5f},
675-
{0x0812, 0x00},
676-
{0x0813, 0x57},
677-
{0x0814, 0x00},
678-
{0x0815, 0x4f},
679-
{0x0816, 0x01},
680-
{0x0817, 0x27},
681-
{0x0818, 0x00},
682-
{0x0819, 0x3f},
683641
{0xe04c, 0x00},
684642
{0xe04d, 0x7f},
685643
{0xe04e, 0x00},
686644
{0xe04f, 0x1f},
687-
{0x3e20, 0x01},
688-
{0x3e37, 0x00},
689-
{0x3f50, 0x00},
690645
{0x3f56, 0x01},
691646
{0x3f57, 0x6c},
692647
};
@@ -703,17 +658,8 @@ static const struct imx477_reg mode_2028x1080_regs[] = {
703658
{0x0349, 0xd7},
704659
{0x034a, 0x0a},
705660
{0x034b, 0x27},
706-
{0x0220, 0x00},
707-
{0x0221, 0x11},
708-
{0x0381, 0x01},
709-
{0x0383, 0x01},
710-
{0x0385, 0x01},
711-
{0x0387, 0x01},
712661
{0x0900, 0x01},
713662
{0x0901, 0x22},
714-
{0x0902, 0x02},
715-
{0x3140, 0x02},
716-
{0x3c00, 0x00},
717663
{0x3c01, 0x03},
718664
{0x3c02, 0xa2},
719665
{0x3f0d, 0x01},
@@ -727,12 +673,6 @@ static const struct imx477_reg mode_2028x1080_regs[] = {
727673
{0x936d, 0x5f},
728674
{0x9304, 0x00},
729675
{0x9305, 0x00},
730-
{0x9e9a, 0x2f},
731-
{0x9e9b, 0x2f},
732-
{0x9e9c, 0x2f},
733-
{0x9e9d, 0x00},
734-
{0x9e9e, 0x00},
735-
{0x9e9f, 0x00},
736676
{0xa2a9, 0x60},
737677
{0xa2b7, 0x00},
738678
{0x0401, 0x00},
@@ -750,44 +690,14 @@ static const struct imx477_reg mode_2028x1080_regs[] = {
750690
{0x034d, 0xec},
751691
{0x034e, 0x04},
752692
{0x034f, 0x38},
753-
{0x0301, 0x05},
754-
{0x0303, 0x02},
755693
{0x0305, 0x04},
756694
{0x0306, 0x01},
757695
{0x0307, 0x5e},
758696
{0x0309, 0x0c},
759-
{0x030b, 0x02},
760-
{0x030d, 0x02},
761-
{0x030e, 0x00},
762-
{0x030f, 0x96},
763-
{0x0310, 0x01},
764-
{0x0820, 0x07},
765-
{0x0821, 0x08},
766-
{0x0822, 0x00},
767-
{0x0823, 0x00},
768-
{0x080a, 0x00},
769-
{0x080b, 0x7f},
770-
{0x080c, 0x00},
771-
{0x080d, 0x4f},
772-
{0x080e, 0x00},
773-
{0x080f, 0x77},
774-
{0x0810, 0x00},
775-
{0x0811, 0x5f},
776-
{0x0812, 0x00},
777-
{0x0813, 0x57},
778-
{0x0814, 0x00},
779-
{0x0815, 0x4f},
780-
{0x0816, 0x01},
781-
{0x0817, 0x27},
782-
{0x0818, 0x00},
783-
{0x0819, 0x3f},
784697
{0xe04c, 0x00},
785698
{0xe04d, 0x7f},
786699
{0xe04e, 0x00},
787700
{0xe04f, 0x1f},
788-
{0x3e20, 0x01},
789-
{0x3e37, 0x00},
790-
{0x3f50, 0x00},
791701
{0x3f56, 0x01},
792702
{0x3f57, 0x6c},
793703
};
@@ -823,17 +733,8 @@ static const struct imx477_reg mode_1332x990_regs[] = {
823733
{0x00fe, 0x0a},
824734
{0x00ff, 0x0a},
825735
{0xe013, 0x00},
826-
{0x0220, 0x00},
827-
{0x0221, 0x11},
828-
{0x0381, 0x01},
829-
{0x0383, 0x01},
830-
{0x0385, 0x01},
831-
{0x0387, 0x01},
832736
{0x0900, 0x01},
833737
{0x0901, 0x22},
834-
{0x0902, 0x02},
835-
{0x3140, 0x02},
836-
{0x3c00, 0x00},
837738
{0x3c01, 0x01},
838739
{0x3c02, 0x9c},
839740
{0x3f0d, 0x00},
@@ -852,12 +753,6 @@ static const struct imx477_reg mode_1332x990_regs[] = {
852753
{0x936d, 0x5f},
853754
{0x9304, 0x03},
854755
{0x9305, 0x80},
855-
{0x9e9a, 0x2f},
856-
{0x9e9b, 0x2f},
857-
{0x9e9c, 0x2f},
858-
{0x9e9d, 0x00},
859-
{0x9e9e, 0x00},
860-
{0x9e9f, 0x00},
861756
{0xa2a9, 0x27},
862757
{0xa2b7, 0x03},
863758
{0x0401, 0x00},
@@ -875,44 +770,14 @@ static const struct imx477_reg mode_1332x990_regs[] = {
875770
{0x034d, 0x34},
876771
{0x034e, 0x03},
877772
{0x034f, 0xde},
878-
{0x0301, 0x05},
879-
{0x0303, 0x02},
880773
{0x0305, 0x02},
881774
{0x0306, 0x00},
882775
{0x0307, 0xaf},
883776
{0x0309, 0x0a},
884-
{0x030b, 0x02},
885-
{0x030d, 0x02},
886-
{0x030e, 0x00},
887-
{0x030f, 0x96},
888-
{0x0310, 0x01},
889-
{0x0820, 0x07},
890-
{0x0821, 0x08},
891-
{0x0822, 0x00},
892-
{0x0823, 0x00},
893-
{0x080a, 0x00},
894-
{0x080b, 0x7f},
895-
{0x080c, 0x00},
896-
{0x080d, 0x4f},
897-
{0x080e, 0x00},
898-
{0x080f, 0x77},
899-
{0x0810, 0x00},
900-
{0x0811, 0x5f},
901-
{0x0812, 0x00},
902-
{0x0813, 0x57},
903-
{0x0814, 0x00},
904-
{0x0815, 0x4f},
905-
{0x0816, 0x01},
906-
{0x0817, 0x27},
907-
{0x0818, 0x00},
908-
{0x0819, 0x3f},
909777
{0xe04c, 0x00},
910778
{0xe04d, 0x5f},
911779
{0xe04e, 0x00},
912780
{0xe04f, 0x1f},
913-
{0x3e20, 0x01},
914-
{0x3e37, 0x00},
915-
{0x3f50, 0x00},
916781
{0x3f56, 0x00},
917782
{0x3f57, 0xbf},
918783
};

0 commit comments

Comments
 (0)