Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
mt9m111.c File Reference
#include <linux/videodev2.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/log2.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/v4l2-mediabus.h>
#include <linux/module.h>
#include <media/soc_camera.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-chip-ident.h>

Go to the source code of this file.

Data Structures

struct  mt9m111_context
 
struct  mt9m111_datafmt
 
struct  mt9m111
 

Macros

#define MT9M111_CHIP_VERSION   0x000
 
#define MT9M111_ROW_START   0x001
 
#define MT9M111_COLUMN_START   0x002
 
#define MT9M111_WINDOW_HEIGHT   0x003
 
#define MT9M111_WINDOW_WIDTH   0x004
 
#define MT9M111_HORIZONTAL_BLANKING_B   0x005
 
#define MT9M111_VERTICAL_BLANKING_B   0x006
 
#define MT9M111_HORIZONTAL_BLANKING_A   0x007
 
#define MT9M111_VERTICAL_BLANKING_A   0x008
 
#define MT9M111_SHUTTER_WIDTH   0x009
 
#define MT9M111_ROW_SPEED   0x00a
 
#define MT9M111_EXTRA_DELAY   0x00b
 
#define MT9M111_SHUTTER_DELAY   0x00c
 
#define MT9M111_RESET   0x00d
 
#define MT9M111_READ_MODE_B   0x020
 
#define MT9M111_READ_MODE_A   0x021
 
#define MT9M111_FLASH_CONTROL   0x023
 
#define MT9M111_GREEN1_GAIN   0x02b
 
#define MT9M111_BLUE_GAIN   0x02c
 
#define MT9M111_RED_GAIN   0x02d
 
#define MT9M111_GREEN2_GAIN   0x02e
 
#define MT9M111_GLOBAL_GAIN   0x02f
 
#define MT9M111_CONTEXT_CONTROL   0x0c8
 
#define MT9M111_PAGE_MAP   0x0f0
 
#define MT9M111_BYTE_WISE_ADDR   0x0f1
 
#define MT9M111_RESET_SYNC_CHANGES   (1 << 15)
 
#define MT9M111_RESET_RESTART_BAD_FRAME   (1 << 9)
 
#define MT9M111_RESET_SHOW_BAD_FRAMES   (1 << 8)
 
#define MT9M111_RESET_RESET_SOC   (1 << 5)
 
#define MT9M111_RESET_OUTPUT_DISABLE   (1 << 4)
 
#define MT9M111_RESET_CHIP_ENABLE   (1 << 3)
 
#define MT9M111_RESET_ANALOG_STANDBY   (1 << 2)
 
#define MT9M111_RESET_RESTART_FRAME   (1 << 1)
 
#define MT9M111_RESET_RESET_MODE   (1 << 0)
 
#define MT9M111_RM_FULL_POWER_RD   (0 << 10)
 
#define MT9M111_RM_LOW_POWER_RD   (1 << 10)
 
#define MT9M111_RM_COL_SKIP_4X   (1 << 5)
 
#define MT9M111_RM_ROW_SKIP_4X   (1 << 4)
 
#define MT9M111_RM_COL_SKIP_2X   (1 << 3)
 
#define MT9M111_RM_ROW_SKIP_2X   (1 << 2)
 
#define MT9M111_RMB_MIRROR_COLS   (1 << 1)
 
#define MT9M111_RMB_MIRROR_ROWS   (1 << 0)
 
#define MT9M111_CTXT_CTRL_RESTART   (1 << 15)
 
#define MT9M111_CTXT_CTRL_DEFECTCOR_B   (1 << 12)
 
#define MT9M111_CTXT_CTRL_RESIZE_B   (1 << 10)
 
#define MT9M111_CTXT_CTRL_CTRL2_B   (1 << 9)
 
#define MT9M111_CTXT_CTRL_GAMMA_B   (1 << 8)
 
#define MT9M111_CTXT_CTRL_XENON_EN   (1 << 7)
 
#define MT9M111_CTXT_CTRL_READ_MODE_B   (1 << 3)
 
#define MT9M111_CTXT_CTRL_LED_FLASH_EN   (1 << 2)
 
#define MT9M111_CTXT_CTRL_VBLANK_SEL_B   (1 << 1)
 
#define MT9M111_CTXT_CTRL_HBLANK_SEL_B   (1 << 0)
 
#define MT9M111_OPER_MODE_CTRL   0x106
 
#define MT9M111_OUTPUT_FORMAT_CTRL   0x108
 
#define MT9M111_REDUCER_XZOOM_B   0x1a0
 
#define MT9M111_REDUCER_XSIZE_B   0x1a1
 
#define MT9M111_REDUCER_YZOOM_B   0x1a3
 
#define MT9M111_REDUCER_YSIZE_B   0x1a4
 
#define MT9M111_REDUCER_XZOOM_A   0x1a6
 
#define MT9M111_REDUCER_XSIZE_A   0x1a7
 
#define MT9M111_REDUCER_YZOOM_A   0x1a9
 
#define MT9M111_REDUCER_YSIZE_A   0x1aa
 
#define MT9M111_OUTPUT_FORMAT_CTRL2_A   0x13a
 
#define MT9M111_OUTPUT_FORMAT_CTRL2_B   0x19b
 
#define MT9M111_OPMODE_AUTOEXPO_EN   (1 << 14)
 
#define MT9M111_OPMODE_AUTOWHITEBAL_EN   (1 << 1)
 
#define MT9M111_OUTFMT_FLIP_BAYER_COL   (1 << 9)
 
#define MT9M111_OUTFMT_FLIP_BAYER_ROW   (1 << 8)
 
#define MT9M111_OUTFMT_PROCESSED_BAYER   (1 << 14)
 
#define MT9M111_OUTFMT_BYPASS_IFP   (1 << 10)
 
#define MT9M111_OUTFMT_INV_PIX_CLOCK   (1 << 9)
 
#define MT9M111_OUTFMT_RGB   (1 << 8)
 
#define MT9M111_OUTFMT_RGB565   (0 << 6)
 
#define MT9M111_OUTFMT_RGB555   (1 << 6)
 
#define MT9M111_OUTFMT_RGB444x   (2 << 6)
 
#define MT9M111_OUTFMT_RGBx444   (3 << 6)
 
#define MT9M111_OUTFMT_TST_RAMP_OFF   (0 << 4)
 
#define MT9M111_OUTFMT_TST_RAMP_COL   (1 << 4)
 
#define MT9M111_OUTFMT_TST_RAMP_ROW   (2 << 4)
 
#define MT9M111_OUTFMT_TST_RAMP_FRAME   (3 << 4)
 
#define MT9M111_OUTFMT_SHIFT_3_UP   (1 << 3)
 
#define MT9M111_OUTFMT_AVG_CHROMA   (1 << 2)
 
#define MT9M111_OUTFMT_SWAP_YCbCr_C_Y_RGB_EVEN   (1 << 1)
 
#define MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr_RGB_R_B   (1 << 0)
 
#define reg_read(reg)   mt9m111_reg_read(client, MT9M111_##reg)
 
#define reg_write(reg, val)   mt9m111_reg_write(client, MT9M111_##reg, (val))
 
#define reg_set(reg, val)   mt9m111_reg_set(client, MT9M111_##reg, (val))
 
#define reg_clear(reg, val)   mt9m111_reg_clear(client, MT9M111_##reg, (val))
 
#define reg_mask(reg, val, mask)
 
#define MT9M111_MIN_DARK_ROWS   8
 
#define MT9M111_MIN_DARK_COLS   26
 
#define MT9M111_MAX_HEIGHT   1024
 
#define MT9M111_MAX_WIDTH   1280
 

Functions

 MODULE_DEVICE_TABLE (i2c, mt9m111_id)
 
 module_i2c_driver (mt9m111_i2c_driver)
 
 MODULE_DESCRIPTION ("Micron/Aptina MT9M111/MT9M112/MT9M131 Camera driver")
 
 MODULE_AUTHOR ("Robert Jarzmik")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define MT9M111_BLUE_GAIN   0x02c

Definition at line 51 of file mt9m111.c.

#define MT9M111_BYTE_WISE_ADDR   0x0f1

Definition at line 57 of file mt9m111.c.

#define MT9M111_CHIP_VERSION   0x000

Definition at line 33 of file mt9m111.c.

#define MT9M111_COLUMN_START   0x002

Definition at line 35 of file mt9m111.c.

#define MT9M111_CONTEXT_CONTROL   0x0c8

Definition at line 55 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_CTRL2_B   (1 << 9)

Definition at line 80 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_DEFECTCOR_B   (1 << 12)

Definition at line 78 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_GAMMA_B   (1 << 8)

Definition at line 81 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_HBLANK_SEL_B   (1 << 0)

Definition at line 86 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_LED_FLASH_EN   (1 << 2)

Definition at line 84 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_READ_MODE_B   (1 << 3)

Definition at line 83 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_RESIZE_B   (1 << 10)

Definition at line 79 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_RESTART   (1 << 15)

Definition at line 77 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_VBLANK_SEL_B   (1 << 1)

Definition at line 85 of file mt9m111.c.

#define MT9M111_CTXT_CTRL_XENON_EN   (1 << 7)

Definition at line 82 of file mt9m111.c.

#define MT9M111_EXTRA_DELAY   0x00b

Definition at line 44 of file mt9m111.c.

#define MT9M111_FLASH_CONTROL   0x023

Definition at line 49 of file mt9m111.c.

#define MT9M111_GLOBAL_GAIN   0x02f

Definition at line 54 of file mt9m111.c.

#define MT9M111_GREEN1_GAIN   0x02b

Definition at line 50 of file mt9m111.c.

#define MT9M111_GREEN2_GAIN   0x02e

Definition at line 53 of file mt9m111.c.

#define MT9M111_HORIZONTAL_BLANKING_A   0x007

Definition at line 40 of file mt9m111.c.

#define MT9M111_HORIZONTAL_BLANKING_B   0x005

Definition at line 38 of file mt9m111.c.

#define MT9M111_MAX_HEIGHT   1024

Definition at line 139 of file mt9m111.c.

#define MT9M111_MAX_WIDTH   1280

Definition at line 140 of file mt9m111.c.

#define MT9M111_MIN_DARK_COLS   26

Definition at line 138 of file mt9m111.c.

#define MT9M111_MIN_DARK_ROWS   8

Definition at line 137 of file mt9m111.c.

#define MT9M111_OPER_MODE_CTRL   0x106

Definition at line 91 of file mt9m111.c.

#define MT9M111_OPMODE_AUTOEXPO_EN   (1 << 14)

Definition at line 105 of file mt9m111.c.

#define MT9M111_OPMODE_AUTOWHITEBAL_EN   (1 << 1)

Definition at line 106 of file mt9m111.c.

#define MT9M111_OUTFMT_AVG_CHROMA   (1 << 2)

Definition at line 122 of file mt9m111.c.

#define MT9M111_OUTFMT_BYPASS_IFP   (1 << 10)

Definition at line 110 of file mt9m111.c.

#define MT9M111_OUTFMT_FLIP_BAYER_COL   (1 << 9)

Definition at line 107 of file mt9m111.c.

#define MT9M111_OUTFMT_FLIP_BAYER_ROW   (1 << 8)

Definition at line 108 of file mt9m111.c.

#define MT9M111_OUTFMT_INV_PIX_CLOCK   (1 << 9)

Definition at line 111 of file mt9m111.c.

#define MT9M111_OUTFMT_PROCESSED_BAYER   (1 << 14)

Definition at line 109 of file mt9m111.c.

#define MT9M111_OUTFMT_RGB   (1 << 8)

Definition at line 112 of file mt9m111.c.

#define MT9M111_OUTFMT_RGB444x   (2 << 6)

Definition at line 115 of file mt9m111.c.

#define MT9M111_OUTFMT_RGB555   (1 << 6)

Definition at line 114 of file mt9m111.c.

#define MT9M111_OUTFMT_RGB565   (0 << 6)

Definition at line 113 of file mt9m111.c.

#define MT9M111_OUTFMT_RGBx444   (3 << 6)

Definition at line 116 of file mt9m111.c.

#define MT9M111_OUTFMT_SHIFT_3_UP   (1 << 3)

Definition at line 121 of file mt9m111.c.

#define MT9M111_OUTFMT_SWAP_YCbCr_C_Y_RGB_EVEN   (1 << 1)

Definition at line 123 of file mt9m111.c.

#define MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr_RGB_R_B   (1 << 0)

Definition at line 124 of file mt9m111.c.

#define MT9M111_OUTFMT_TST_RAMP_COL   (1 << 4)

Definition at line 118 of file mt9m111.c.

#define MT9M111_OUTFMT_TST_RAMP_FRAME   (3 << 4)

Definition at line 120 of file mt9m111.c.

#define MT9M111_OUTFMT_TST_RAMP_OFF   (0 << 4)

Definition at line 117 of file mt9m111.c.

#define MT9M111_OUTFMT_TST_RAMP_ROW   (2 << 4)

Definition at line 119 of file mt9m111.c.

#define MT9M111_OUTPUT_FORMAT_CTRL   0x108

Definition at line 92 of file mt9m111.c.

#define MT9M111_OUTPUT_FORMAT_CTRL2_A   0x13a

Definition at line 102 of file mt9m111.c.

#define MT9M111_OUTPUT_FORMAT_CTRL2_B   0x19b

Definition at line 103 of file mt9m111.c.

#define MT9M111_PAGE_MAP   0x0f0

Definition at line 56 of file mt9m111.c.

#define MT9M111_READ_MODE_A   0x021

Definition at line 48 of file mt9m111.c.

#define MT9M111_READ_MODE_B   0x020

Definition at line 47 of file mt9m111.c.

#define MT9M111_RED_GAIN   0x02d

Definition at line 52 of file mt9m111.c.

#define MT9M111_REDUCER_XSIZE_A   0x1a7

Definition at line 98 of file mt9m111.c.

#define MT9M111_REDUCER_XSIZE_B   0x1a1

Definition at line 94 of file mt9m111.c.

#define MT9M111_REDUCER_XZOOM_A   0x1a6

Definition at line 97 of file mt9m111.c.

#define MT9M111_REDUCER_XZOOM_B   0x1a0

Definition at line 93 of file mt9m111.c.

#define MT9M111_REDUCER_YSIZE_A   0x1aa

Definition at line 100 of file mt9m111.c.

#define MT9M111_REDUCER_YSIZE_B   0x1a4

Definition at line 96 of file mt9m111.c.

#define MT9M111_REDUCER_YZOOM_A   0x1a9

Definition at line 99 of file mt9m111.c.

#define MT9M111_REDUCER_YZOOM_B   0x1a3

Definition at line 95 of file mt9m111.c.

#define MT9M111_RESET   0x00d

Definition at line 46 of file mt9m111.c.

#define MT9M111_RESET_ANALOG_STANDBY   (1 << 2)

Definition at line 65 of file mt9m111.c.

#define MT9M111_RESET_CHIP_ENABLE   (1 << 3)

Definition at line 64 of file mt9m111.c.

#define MT9M111_RESET_OUTPUT_DISABLE   (1 << 4)

Definition at line 63 of file mt9m111.c.

#define MT9M111_RESET_RESET_MODE   (1 << 0)

Definition at line 67 of file mt9m111.c.

#define MT9M111_RESET_RESET_SOC   (1 << 5)

Definition at line 62 of file mt9m111.c.

#define MT9M111_RESET_RESTART_BAD_FRAME   (1 << 9)

Definition at line 60 of file mt9m111.c.

#define MT9M111_RESET_RESTART_FRAME   (1 << 1)

Definition at line 66 of file mt9m111.c.

#define MT9M111_RESET_SHOW_BAD_FRAMES   (1 << 8)

Definition at line 61 of file mt9m111.c.

#define MT9M111_RESET_SYNC_CHANGES   (1 << 15)

Definition at line 59 of file mt9m111.c.

#define MT9M111_RM_COL_SKIP_2X   (1 << 3)

Definition at line 73 of file mt9m111.c.

#define MT9M111_RM_COL_SKIP_4X   (1 << 5)

Definition at line 71 of file mt9m111.c.

#define MT9M111_RM_FULL_POWER_RD   (0 << 10)

Definition at line 69 of file mt9m111.c.

#define MT9M111_RM_LOW_POWER_RD   (1 << 10)

Definition at line 70 of file mt9m111.c.

#define MT9M111_RM_ROW_SKIP_2X   (1 << 2)

Definition at line 74 of file mt9m111.c.

#define MT9M111_RM_ROW_SKIP_4X   (1 << 4)

Definition at line 72 of file mt9m111.c.

#define MT9M111_RMB_MIRROR_COLS   (1 << 1)

Definition at line 75 of file mt9m111.c.

#define MT9M111_RMB_MIRROR_ROWS   (1 << 0)

Definition at line 76 of file mt9m111.c.

#define MT9M111_ROW_SPEED   0x00a

Definition at line 43 of file mt9m111.c.

#define MT9M111_ROW_START   0x001

Definition at line 34 of file mt9m111.c.

#define MT9M111_SHUTTER_DELAY   0x00c

Definition at line 45 of file mt9m111.c.

#define MT9M111_SHUTTER_WIDTH   0x009

Definition at line 42 of file mt9m111.c.

#define MT9M111_VERTICAL_BLANKING_A   0x008

Definition at line 41 of file mt9m111.c.

#define MT9M111_VERTICAL_BLANKING_B   0x006

Definition at line 39 of file mt9m111.c.

#define MT9M111_WINDOW_HEIGHT   0x003

Definition at line 36 of file mt9m111.c.

#define MT9M111_WINDOW_WIDTH   0x004

Definition at line 37 of file mt9m111.c.

#define reg_clear (   reg,
  val 
)    mt9m111_reg_clear(client, MT9M111_##reg, (val))

Definition at line 133 of file mt9m111.c.

#define reg_mask (   reg,
  val,
  mask 
)
Value:
mt9m111_reg_mask(client, MT9M111_##reg, \
(val), (mask))

Definition at line 134 of file mt9m111.c.

#define reg_read (   reg)    mt9m111_reg_read(client, MT9M111_##reg)

Definition at line 130 of file mt9m111.c.

#define reg_set (   reg,
  val 
)    mt9m111_reg_set(client, MT9M111_##reg, (val))

Definition at line 132 of file mt9m111.c.

#define reg_write (   reg,
  val 
)    mt9m111_reg_write(client, MT9M111_##reg, (val))

Definition at line 131 of file mt9m111.c.

Function Documentation

MODULE_AUTHOR ( "Robert Jarzmik"  )
MODULE_DESCRIPTION ( "Micron/Aptina MT9M111/MT9M112/MT9M131 Camera driver )
MODULE_DEVICE_TABLE ( i2c  ,
mt9m111_id   
)
module_i2c_driver ( mt9m111_i2c_driver  )
MODULE_LICENSE ( "GPL"  )