#  register settings mt9p031 and mt9p006
#  PHYTEC 2012, V0.4

#  set MT9P031/006 SHUTTER
#  =======================
#  Default is 1943 lines for full frame
#  Reg 0x08 upper byte, Reg 0x09 lower byte 
#  Also be set with v4l2-ctl

0x48,0x08,0x0000	# Shutter Width 0000 xxxx
#0x48,0x09,0x0796	# Shutter Width [reg0x08=0] 0796, dez=1942 (max for full frame)
#0x48,0x09,0x05FE	# Shutter Width [reg0x08=0] 05FE, dez=1534 (max for QXGA)
#0x48,0x09,0x04AE	# Shutter Width [reg0x08=0] 04AE, dez=1198 (max for UXGA)
#0x48,0x09,0x03FE	# Shutter Width [reg0x08=0] 03FE, dez=1022 (max for SXGA)
#0x48,0x09,0x02FE	# Shutter Width [reg0x08=0] 02FE, dez=766  (max for XGA)
#0x48,0x09,0x0256	# Shutter Width [reg0x08=0] 0256, dez=598  (max for SVGA)
0x48,0x09,0x01DE	# Shutter Width [reg0x08=0] 01DE, dez=478  (max for VGA)
#0x48,0x09,0x0436	# Shutter Width [reg0x08=0] 0436, dez=1078 (max for 1080p HDTV)
#0x48,0x09,0x02CE	# Shutter Width [reg0x08=0] 02CE, dez=718  (max for 720p HDTV)
#0x48,0x08,0xFFFF	# Shutter Width [reg0x08=0] FFFF, dez=65535
#0x48,0x08,0x0000	# Shutter Width [reg0x08=0] 0000, dez=0


#  set MT9P031/006 GLOBAL GAIN
#  ===========================
#  bit [14..8] digital gain, bit [6] analog multiplier, bit[5..0] analog gain
#  gain = (1+(<dig gain>/8)) * ((1+<mult>)*(8/<analog gain>)) for more see datasheet
#  The register 0x35 (global gain) is write only(WO).
#  Please use only the Register 0x2B - 0x2E to write the gain.
#  Also be set with v4l2-ctl

0x48,0x2B,0x0020	# set gain = (1+(0/8)) * ((1+0)*(32/8)) = 4.00, green1
0x48,0x2C,0x0020	# set gain = (1+(0/8)) * ((1+0)*(32/8)) = 4.00, blue
0x48,0x2D,0x0020	# set gain = (1+(0/8)) * ((1+0)*(32/8)) = 4.00, red
0x48,0x2E,0x0020	# set gain = (1+(0/8)) * ((1+0)*(32/8)) = 4.00, green2
0x48,0x35,0x0020	# set gain = (1+(0/8)) * ((1+0)*(32/8)) = 4.00, global

#0x48,0x2x,0x0008	# set gain = (1+(0/8)) * ((1+0)*(8/8)) = 1.00 (default)
#0x48,0x2x,0x0010	# set gain = (1+(0/8)) * ((1+0)*(16/8)) = 2.00
#0x48,0x2x,0x0018	# set gain = (1+(0/8)) * ((1+0)*(24/8)) = 3.00
#0x48,0x2x,0x0020	# set gain = (1+(0/8)) * ((1+0)*(32/8)) = 4.00
#0x48,0x2x,0x0054	# set gain = (1+(0/8)) * ((1+1)*(20/8)) = 5.00
#0x48,0x2x,0x0058	# set gain = (1+(0/8)) * ((1+1)*(24/8)) = 6.00
#0x48,0x2x,0x005C	# set gain = (1+(0/8)) * ((1+1)*(28/8)) = 7.00
#0x48,0x2x,0x0060	# set gain = (1+(0/8)) * ((1+1)*(32/8)) = 8.00
#0x48,0x2x,0x0160	# set gain = (1+(1/8)) * ((1+1)*(32/8)) = 9.00
#0x48,0x2x,0x0260	# set gain = (1+(2/8)) * ((1+1)*(32/8)) = 10.00
#0x48,0x2x,0x1060	# set gain = (1+(16/8)) * ((1+1)*(32/8)) = 24.00
#0x48,0x2x,0x2060	# set gain = (1+(32/8)) * ((1+1)*(32/8)) = 40.00
#0x48,0x2x,0x3060	# set gain = (1+(48/8)) * ((1+1)*(32/8)) = 56.00
#0x48,0x2x,0x4060	# set gain = (1+(64/8)) * ((1+1)*(32/8)) = 72.00
#0x48,0x2x,0x5060	# set gain = (1+(80/8)) * ((1+1)*(32/8)) = 88.00
#0x48,0x2x,0x6060	# set gain = (1+(96/8)) * ((1+1)*(32/8)) = 104.00
#0x48,0x2x,0x7860	# set gain = (1+(120/8)) * ((1+1)*(32/8)) = 128.00


#  set MT9P031/006 TEST PATTERN
#  ============================
#  bit [6..3] pattern mode, bit [0] enable/disable
#  Aptina recommends turning off black level calibration (BLC) when Test Pattern is
#  enabled, otherswise some of the test patterns will not be properly ouput.
#  Also be set with v4l2-ctl

0x48,0xA0,0x0000	# testpattern off
#0x48,0xA0,0x0001	# testpattern on, color field
#0x48,0xA0,0x0009	# testpattern on, horizontal gradient
#0x48,0xA0,0x0011	# testpattern on, vertical gradient
#0x48,0xA0,0x0019	# testpattern on, diagonal
#0x48,0xA0,0x0021	# testpattern on, classic
#0x48,0xA0,0x0029	# testpattern on, walking 1s
#0x48,0xA0,0x0031	# testpattern on, monochrome horizontal bars
#0x48,0xA0,0x0039	# testpattern on, monochrome vertical bars
#0x48,0xA0,0x0041	# testpattern on, vertical color bars

#0x48,0xA1,0x0000	# Value for green pixels of dark rows and columns in all test patterns, and for the color field.
#0x48,0xA2,0x0000	# Value for red pixels of dark rows and columns in all test patterns, and for the color field.
#0x48,0xA3,0x0000	# Value for blue pixels of dark rows and columns in all test patterns, and for the color field.
#0x48,0xA4,0x0000	# The width of the monochrome color bars in test modes 6 and 7. This should be set to an odd value.


#  set MT9P031/006 ROW BLC
#  =======================
#  Reg 0x20 bit [6] enable/disable automatic
#  Also be set with v4l2-ctl

#0x48,0x20,0x0040,0	# set ROW BLC automatic (default), offset at reg 0x49
#0x48,0x20,0xFFBF,a	# set ROW BLC manual, offset at reg 0x4B
#0x48,0x49,0x0000	# set offset automatic ROW BLC
#0x48,0x49,0x00A8	# set offset automatic ROW BLC (0x00A8 = default)
#0x48,0x4B,0x0000	# set offset manual ROW BLC
#0x48,0x4B,0x0028	# set offset manual ROW BLC (0x0028 = default)


#  set MT9P031/006 MIRROR
#  ======================
#  set flip row and/or column
#  Also be set with v4l2-ctl
#0x48,0x20,0x3FFF,a     # without flip
#0x48,0x20,0x8000,o     # flip row, The Bayer sequence changes to "RGGB". Notes to the Column_Start set see in datasheet.
#0x48,0x20,0x4000,o     # flip column, The Bayer sequence changes to "BGGR". Notes to the Column_Start set see in datasheet.
#0x48,0x20,0xC000,o     # flip row and column, The Bayer sequence changes to "GBRG".
#						  Notes to the Column_Start set see in datasheet.
