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

Go to the source code of this file.

Data Structures

struct  regval_list
 
struct  tw9910_scale_ctrl
 
struct  tw9910_priv
 

Macros

#define GET_ID(val)   ((val & 0xF8) >> 3)
 
#define GET_REV(val)   (val & 0x07)
 
#define ID   0x00 /* Product ID Code Register */
 
#define STATUS1   0x01 /* Chip Status Register I */
 
#define INFORM   0x02 /* Input Format */
 
#define OPFORM   0x03 /* Output Format Control Register */
 
#define DLYCTR   0x04 /* Hysteresis and HSYNC Delay Control */
 
#define OUTCTR1   0x05 /* Output Control I */
 
#define ACNTL1   0x06 /* Analog Control Register 1 */
 
#define CROP_HI   0x07 /* Cropping Register, High */
 
#define VDELAY_LO   0x08 /* Vertical Delay Register, Low */
 
#define VACTIVE_LO   0x09 /* Vertical Active Register, Low */
 
#define HDELAY_LO   0x0A /* Horizontal Delay Register, Low */
 
#define HACTIVE_LO   0x0B /* Horizontal Active Register, Low */
 
#define CNTRL1   0x0C /* Control Register I */
 
#define VSCALE_LO   0x0D /* Vertical Scaling Register, Low */
 
#define SCALE_HI   0x0E /* Scaling Register, High */
 
#define HSCALE_LO   0x0F /* Horizontal Scaling Register, Low */
 
#define BRIGHT   0x10 /* BRIGHTNESS Control Register */
 
#define CONTRAST   0x11 /* CONTRAST Control Register */
 
#define SHARPNESS   0x12 /* SHARPNESS Control Register I */
 
#define SAT_U   0x13 /* Chroma (U) Gain Register */
 
#define SAT_V   0x14 /* Chroma (V) Gain Register */
 
#define HUE   0x15 /* Hue Control Register */
 
#define CORING1   0x17
 
#define CORING2   0x18 /* Coring and IF compensation */
 
#define VBICNTL   0x19 /* VBI Control Register */
 
#define ACNTL2   0x1A /* Analog Control 2 */
 
#define OUTCTR2   0x1B /* Output Control 2 */
 
#define SDT   0x1C /* Standard Selection */
 
#define SDTR   0x1D /* Standard Recognition */
 
#define TEST   0x1F /* Test Control Register */
 
#define CLMPG   0x20 /* Clamping Gain */
 
#define IAGC   0x21 /* Individual AGC Gain */
 
#define AGCGAIN   0x22 /* AGC Gain */
 
#define PEAKWT   0x23 /* White Peak Threshold */
 
#define CLMPL   0x24 /* Clamp level */
 
#define SYNCT   0x25 /* Sync Amplitude */
 
#define MISSCNT   0x26 /* Sync Miss Count Register */
 
#define PCLAMP   0x27 /* Clamp Position Register */
 
#define VCNTL1   0x28 /* Vertical Control I */
 
#define VCNTL2   0x29 /* Vertical Control II */
 
#define CKILL   0x2A /* Color Killer Level Control */
 
#define COMB   0x2B /* Comb Filter Control */
 
#define LDLY   0x2C /* Luma Delay and H Filter Control */
 
#define MISC1   0x2D /* Miscellaneous Control I */
 
#define LOOP   0x2E /* LOOP Control Register */
 
#define MISC2   0x2F /* Miscellaneous Control II */
 
#define MVSN   0x30 /* Macrovision Detection */
 
#define STATUS2   0x31 /* Chip STATUS II */
 
#define HFREF   0x32 /* H monitor */
 
#define CLMD   0x33 /* CLAMP MODE */
 
#define IDCNTL   0x34 /* ID Detection Control */
 
#define CLCNTL1   0x35 /* Clamp Control I */
 
#define ANAPLLCTL   0x4C
 
#define VBIMIN   0x4D
 
#define HSLOWCTL   0x4E
 
#define WSS3   0x4F
 
#define FILLDATA   0x50
 
#define SDID   0x51
 
#define DID   0x52
 
#define WSS1   0x53
 
#define WSS2   0x54
 
#define VVBI   0x55
 
#define LCTL6   0x56
 
#define LCTL7   0x57
 
#define LCTL8   0x58
 
#define LCTL9   0x59
 
#define LCTL10   0x5A
 
#define LCTL11   0x5B
 
#define LCTL12   0x5C
 
#define LCTL13   0x5D
 
#define LCTL14   0x5E
 
#define LCTL15   0x5F
 
#define LCTL16   0x60
 
#define LCTL17   0x61
 
#define LCTL18   0x62
 
#define LCTL19   0x63
 
#define LCTL20   0x64
 
#define LCTL21   0x65
 
#define LCTL22   0x66
 
#define LCTL23   0x67
 
#define LCTL24   0x68
 
#define LCTL25   0x69
 
#define LCTL26   0x6A
 
#define HSBEGIN   0x6B
 
#define HSEND   0x6C
 
#define OVSDLY   0x6D
 
#define OVSEND   0x6E
 
#define VBIDELAY   0x6F
 
#define FC27_ON   0x40 /* 1 : Input crystal clock frequency is 27MHz */
 
#define FC27_FF   0x00 /* 0 : Square pixel mode. */
 
#define IFSEL_S   0x10 /* 01 : S-video decoding */
 
#define IFSEL_C   0x00 /* 00 : Composite video decoding */
 
#define YSEL_M0   0x00 /* 00 : Mux0 selected */
 
#define YSEL_M1   0x04 /* 01 : Mux1 selected */
 
#define YSEL_M2   0x08 /* 10 : Mux2 selected */
 
#define YSEL_M3   0x10 /* 11 : Mux3 selected */
 
#define MODE   0x80 /* 0 : CCIR601 compatible YCrCb 4:2:2 format */
 
#define LEN   0x40 /* 0 : 8-bit YCrCb 4:2:2 output format */
 
#define LLCMODE   0x20 /* 1 : LLC output mode. */
 
#define AINC   0x10 /* Serial interface auto-indexing control */
 
#define VSCTL   0x08 /* 1 : Vertical out ctrl by DVALID */
 
#define OEN_TRI_SEL_MASK   0x07
 
#define OEN_TRI_SEL_ALL_ON   0x00 /* Enable output for Rev0/Rev1 */
 
#define OEN_TRI_SEL_ALL_OFF_r0   0x06 /* All tri-stated for Rev0 */
 
#define OEN_TRI_SEL_ALL_OFF_r1   0x07 /* All tri-stated for Rev1 */
 
#define VSP_LO   0x00 /* 0 : VS pin output polarity is active low */
 
#define VSP_HI   0x80 /* 1 : VS pin output polarity is active high. */
 
#define VSSL_VSYNC   0x00 /* 0 : VSYNC */
 
#define VSSL_VACT   0x10 /* 1 : VACT */
 
#define VSSL_FIELD   0x20 /* 2 : FIELD */
 
#define VSSL_VVALID   0x30 /* 3 : VVALID */
 
#define VSSL_ZERO   0x70 /* 7 : 0 */
 
#define HSP_LOW   0x00 /* 0 : HS pin output polarity is active low */
 
#define HSP_HI   0x08 /* 1 : HS pin output polarity is active high.*/
 
#define HSSL_HACT   0x00 /* 0 : HACT */
 
#define HSSL_HSYNC   0x01 /* 1 : HSYNC */
 
#define HSSL_DVALID   0x02 /* 2 : DVALID */
 
#define HSSL_HLOCK   0x03 /* 3 : HLOCK */
 
#define HSSL_ASYNCW   0x04 /* 4 : ASYNCW */
 
#define HSSL_ZERO   0x07 /* 7 : 0 */
 
#define SRESET
 
#define ACNTL1_PDN_MASK   0x0e
 
#define CLK_PDN   0x08 /* system clock power down */
 
#define Y_PDN   0x04 /* Luma ADC power down */
 
#define C_PDN   0x02 /* Chroma ADC power down */
 
#define ACNTL2_PDN_MASK   0x40
 
#define PLL_PDN   0x40 /* PLL power down */
 
#define RTSEL_MASK   0x07
 
#define RTSEL_VLOSS   0x00 /* 0000 = Video loss */
 
#define RTSEL_HLOCK   0x01 /* 0001 = H-lock */
 
#define RTSEL_SLOCK   0x02 /* 0010 = S-lock */
 
#define RTSEL_VLOCK   0x03 /* 0011 = V-lock */
 
#define RTSEL_MONO   0x04 /* 0100 = MONO */
 
#define RTSEL_DET50   0x05 /* 0101 = DET50 */
 
#define RTSEL_FIELD   0x06 /* 0110 = FIELD */
 
#define RTSEL_RTCO   0x07 /* 0111 = RTCO ( Real Time Control ) */
 
#define HSYNC_START   0x0260
 
#define HSYNC_END   0x0300
 

Functions

 MODULE_DEVICE_TABLE (i2c, tw9910_id)
 
 module_i2c_driver (tw9910_i2c_driver)
 
 MODULE_DESCRIPTION ("SoC Camera driver for tw9910")
 
 MODULE_AUTHOR ("Kuninori Morimoto")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define ACNTL1   0x06 /* Analog Control Register 1 */

Definition at line 45 of file tw9910.c.

#define ACNTL1_PDN_MASK   0x0e

Definition at line 183 of file tw9910.c.

#define ACNTL2   0x1A /* Analog Control 2 */

Definition at line 64 of file tw9910.c.

#define ACNTL2_PDN_MASK   0x40

Definition at line 189 of file tw9910.c.

#define AGCGAIN   0x22 /* AGC Gain */

Definition at line 71 of file tw9910.c.

#define AINC   0x10 /* Serial interface auto-indexing control */

Definition at line 152 of file tw9910.c.

#define ANAPLLCTL   0x4C

Definition at line 91 of file tw9910.c.

#define BRIGHT   0x10 /* BRIGHTNESS Control Register */

Definition at line 55 of file tw9910.c.

#define C_PDN   0x02 /* Chroma ADC power down */

Definition at line 186 of file tw9910.c.

#define CKILL   0x2A /* Color Killer Level Control */

Definition at line 79 of file tw9910.c.

#define CLCNTL1   0x35 /* Clamp Control I */

Definition at line 90 of file tw9910.c.

#define CLK_PDN   0x08 /* system clock power down */

Definition at line 184 of file tw9910.c.

#define CLMD   0x33 /* CLAMP MODE */

Definition at line 88 of file tw9910.c.

#define CLMPG   0x20 /* Clamping Gain */

Definition at line 69 of file tw9910.c.

#define CLMPL   0x24 /* Clamp level */

Definition at line 73 of file tw9910.c.

#define CNTRL1   0x0C /* Control Register I */

Definition at line 51 of file tw9910.c.

#define COMB   0x2B /* Comb Filter Control */

Definition at line 80 of file tw9910.c.

#define CONTRAST   0x11 /* CONTRAST Control Register */

Definition at line 56 of file tw9910.c.

#define CORING1   0x17

Definition at line 61 of file tw9910.c.

#define CORING2   0x18 /* Coring and IF compensation */

Definition at line 62 of file tw9910.c.

#define CROP_HI   0x07 /* Cropping Register, High */

Definition at line 46 of file tw9910.c.

#define DID   0x52

Definition at line 97 of file tw9910.c.

#define DLYCTR   0x04 /* Hysteresis and HSYNC Delay Control */

Definition at line 43 of file tw9910.c.

#define FC27_FF   0x00 /* 0 : Square pixel mode. */

Definition at line 134 of file tw9910.c.

#define FC27_ON   0x40 /* 1 : Input crystal clock frequency is 27MHz */

Definition at line 133 of file tw9910.c.

#define FILLDATA   0x50

Definition at line 95 of file tw9910.c.

#define GET_ID (   val)    ((val & 0xF8) >> 3)

Definition at line 33 of file tw9910.c.

#define GET_REV (   val)    (val & 0x07)

Definition at line 34 of file tw9910.c.

#define HACTIVE_LO   0x0B /* Horizontal Active Register, Low */

Definition at line 50 of file tw9910.c.

#define HDELAY_LO   0x0A /* Horizontal Delay Register, Low */

Definition at line 49 of file tw9910.c.

#define HFREF   0x32 /* H monitor */

Definition at line 87 of file tw9910.c.

#define HSBEGIN   0x6B

Definition at line 122 of file tw9910.c.

#define HSCALE_LO   0x0F /* Horizontal Scaling Register, Low */

Definition at line 54 of file tw9910.c.

#define HSEND   0x6C

Definition at line 123 of file tw9910.c.

#define HSLOWCTL   0x4E

Definition at line 93 of file tw9910.c.

#define HSP_HI   0x08 /* 1 : HS pin output polarity is active high.*/

Definition at line 172 of file tw9910.c.

#define HSP_LOW   0x00 /* 0 : HS pin output polarity is active low */

Definition at line 171 of file tw9910.c.

#define HSSL_ASYNCW   0x04 /* 4 : ASYNCW */

Definition at line 178 of file tw9910.c.

#define HSSL_DVALID   0x02 /* 2 : DVALID */

Definition at line 176 of file tw9910.c.

#define HSSL_HACT   0x00 /* 0 : HACT */

Definition at line 174 of file tw9910.c.

#define HSSL_HLOCK   0x03 /* 3 : HLOCK */

Definition at line 177 of file tw9910.c.

#define HSSL_HSYNC   0x01 /* 1 : HSYNC */

Definition at line 175 of file tw9910.c.

#define HSSL_ZERO   0x07 /* 7 : 0 */

Definition at line 179 of file tw9910.c.

#define HSYNC_END   0x0300

Definition at line 207 of file tw9910.c.

#define HSYNC_START   0x0260

Definition at line 206 of file tw9910.c.

#define HUE   0x15 /* Hue Control Register */

Definition at line 60 of file tw9910.c.

#define IAGC   0x21 /* Individual AGC Gain */

Definition at line 70 of file tw9910.c.

#define ID   0x00 /* Product ID Code Register */

Definition at line 39 of file tw9910.c.

#define IDCNTL   0x34 /* ID Detection Control */

Definition at line 89 of file tw9910.c.

#define IFSEL_C   0x00 /* 00 : Composite video decoding */

Definition at line 138 of file tw9910.c.

#define IFSEL_S   0x10 /* 01 : S-video decoding */

Definition at line 137 of file tw9910.c.

#define INFORM   0x02 /* Input Format */

Definition at line 41 of file tw9910.c.

#define LCTL10   0x5A

Definition at line 105 of file tw9910.c.

#define LCTL11   0x5B

Definition at line 106 of file tw9910.c.

#define LCTL12   0x5C

Definition at line 107 of file tw9910.c.

#define LCTL13   0x5D

Definition at line 108 of file tw9910.c.

#define LCTL14   0x5E

Definition at line 109 of file tw9910.c.

#define LCTL15   0x5F

Definition at line 110 of file tw9910.c.

#define LCTL16   0x60

Definition at line 111 of file tw9910.c.

#define LCTL17   0x61

Definition at line 112 of file tw9910.c.

#define LCTL18   0x62

Definition at line 113 of file tw9910.c.

#define LCTL19   0x63

Definition at line 114 of file tw9910.c.

#define LCTL20   0x64

Definition at line 115 of file tw9910.c.

#define LCTL21   0x65

Definition at line 116 of file tw9910.c.

#define LCTL22   0x66

Definition at line 117 of file tw9910.c.

#define LCTL23   0x67

Definition at line 118 of file tw9910.c.

#define LCTL24   0x68

Definition at line 119 of file tw9910.c.

#define LCTL25   0x69

Definition at line 120 of file tw9910.c.

#define LCTL26   0x6A

Definition at line 121 of file tw9910.c.

#define LCTL6   0x56

Definition at line 101 of file tw9910.c.

#define LCTL7   0x57

Definition at line 102 of file tw9910.c.

#define LCTL8   0x58

Definition at line 103 of file tw9910.c.

#define LCTL9   0x59

Definition at line 104 of file tw9910.c.

#define LDLY   0x2C /* Luma Delay and H Filter Control */

Definition at line 81 of file tw9910.c.

#define LEN   0x40 /* 0 : 8-bit YCrCb 4:2:2 output format */

Definition at line 148 of file tw9910.c.

#define LLCMODE   0x20 /* 1 : LLC output mode. */

Definition at line 150 of file tw9910.c.

#define LOOP   0x2E /* LOOP Control Register */

Definition at line 83 of file tw9910.c.

#define MISC1   0x2D /* Miscellaneous Control I */

Definition at line 82 of file tw9910.c.

#define MISC2   0x2F /* Miscellaneous Control II */

Definition at line 84 of file tw9910.c.

#define MISSCNT   0x26 /* Sync Miss Count Register */

Definition at line 75 of file tw9910.c.

#define MODE   0x80 /* 0 : CCIR601 compatible YCrCb 4:2:2 format */

Definition at line 146 of file tw9910.c.

#define MVSN   0x30 /* Macrovision Detection */

Definition at line 85 of file tw9910.c.

#define OEN_TRI_SEL_ALL_OFF_r0   0x06 /* All tri-stated for Rev0 */

Definition at line 159 of file tw9910.c.

#define OEN_TRI_SEL_ALL_OFF_r1   0x07 /* All tri-stated for Rev1 */

Definition at line 160 of file tw9910.c.

#define OEN_TRI_SEL_ALL_ON   0x00 /* Enable output for Rev0/Rev1 */

Definition at line 158 of file tw9910.c.

#define OEN_TRI_SEL_MASK   0x07

Definition at line 157 of file tw9910.c.

#define OPFORM   0x03 /* Output Format Control Register */

Definition at line 42 of file tw9910.c.

#define OUTCTR1   0x05 /* Output Control I */

Definition at line 44 of file tw9910.c.

#define OUTCTR2   0x1B /* Output Control 2 */

Definition at line 65 of file tw9910.c.

#define OVSDLY   0x6D

Definition at line 124 of file tw9910.c.

#define OVSEND   0x6E

Definition at line 125 of file tw9910.c.

#define PCLAMP   0x27 /* Clamp Position Register */

Definition at line 76 of file tw9910.c.

#define PEAKWT   0x23 /* White Peak Threshold */

Definition at line 72 of file tw9910.c.

#define PLL_PDN   0x40 /* PLL power down */

Definition at line 190 of file tw9910.c.

#define RTSEL_DET50   0x05 /* 0101 = DET50 */

Definition at line 201 of file tw9910.c.

#define RTSEL_FIELD   0x06 /* 0110 = FIELD */

Definition at line 202 of file tw9910.c.

#define RTSEL_HLOCK   0x01 /* 0001 = H-lock */

Definition at line 197 of file tw9910.c.

#define RTSEL_MASK   0x07

Definition at line 195 of file tw9910.c.

#define RTSEL_MONO   0x04 /* 0100 = MONO */

Definition at line 200 of file tw9910.c.

#define RTSEL_RTCO   0x07 /* 0111 = RTCO ( Real Time Control ) */

Definition at line 203 of file tw9910.c.

#define RTSEL_SLOCK   0x02 /* 0010 = S-lock */

Definition at line 198 of file tw9910.c.

#define RTSEL_VLOCK   0x03 /* 0011 = V-lock */

Definition at line 199 of file tw9910.c.

#define RTSEL_VLOSS   0x00 /* 0000 = Video loss */

Definition at line 196 of file tw9910.c.

#define SAT_U   0x13 /* Chroma (U) Gain Register */

Definition at line 58 of file tw9910.c.

#define SAT_V   0x14 /* Chroma (V) Gain Register */

Definition at line 59 of file tw9910.c.

#define SCALE_HI   0x0E /* Scaling Register, High */

Definition at line 53 of file tw9910.c.

#define SDID   0x51

Definition at line 96 of file tw9910.c.

#define SDT   0x1C /* Standard Selection */

Definition at line 66 of file tw9910.c.

#define SDTR   0x1D /* Standard Recognition */

Definition at line 67 of file tw9910.c.

#define SHARPNESS   0x12 /* SHARPNESS Control Register I */

Definition at line 57 of file tw9910.c.

#define SRESET
Value:
0x80 /* resets the device to its default state
* but all register content remain unchanged.
* This bit is self-resetting.
*/

Definition at line 182 of file tw9910.c.

#define STATUS1   0x01 /* Chip Status Register I */

Definition at line 40 of file tw9910.c.

#define STATUS2   0x31 /* Chip STATUS II */

Definition at line 86 of file tw9910.c.

#define SYNCT   0x25 /* Sync Amplitude */

Definition at line 74 of file tw9910.c.

#define TEST   0x1F /* Test Control Register */

Definition at line 68 of file tw9910.c.

#define VACTIVE_LO   0x09 /* Vertical Active Register, Low */

Definition at line 48 of file tw9910.c.

#define VBICNTL   0x19 /* VBI Control Register */

Definition at line 63 of file tw9910.c.

#define VBIDELAY   0x6F

Definition at line 126 of file tw9910.c.

#define VBIMIN   0x4D

Definition at line 92 of file tw9910.c.

#define VCNTL1   0x28 /* Vertical Control I */

Definition at line 77 of file tw9910.c.

#define VCNTL2   0x29 /* Vertical Control II */

Definition at line 78 of file tw9910.c.

#define VDELAY_LO   0x08 /* Vertical Delay Register, Low */

Definition at line 47 of file tw9910.c.

#define VSCALE_LO   0x0D /* Vertical Scaling Register, Low */

Definition at line 52 of file tw9910.c.

#define VSCTL   0x08 /* 1 : Vertical out ctrl by DVALID */

Definition at line 155 of file tw9910.c.

#define VSP_HI   0x80 /* 1 : VS pin output polarity is active high. */

Definition at line 164 of file tw9910.c.

#define VSP_LO   0x00 /* 0 : VS pin output polarity is active low */

Definition at line 163 of file tw9910.c.

#define VSSL_FIELD   0x20 /* 2 : FIELD */

Definition at line 168 of file tw9910.c.

#define VSSL_VACT   0x10 /* 1 : VACT */

Definition at line 167 of file tw9910.c.

#define VSSL_VSYNC   0x00 /* 0 : VSYNC */

Definition at line 166 of file tw9910.c.

#define VSSL_VVALID   0x30 /* 3 : VVALID */

Definition at line 169 of file tw9910.c.

#define VSSL_ZERO   0x70 /* 7 : 0 */

Definition at line 170 of file tw9910.c.

#define VVBI   0x55

Definition at line 100 of file tw9910.c.

#define WSS1   0x53

Definition at line 98 of file tw9910.c.

#define WSS2   0x54

Definition at line 99 of file tw9910.c.

#define WSS3   0x4F

Definition at line 94 of file tw9910.c.

#define Y_PDN   0x04 /* Luma ADC power down */

Definition at line 185 of file tw9910.c.

#define YSEL_M0   0x00 /* 00 : Mux0 selected */

Definition at line 140 of file tw9910.c.

#define YSEL_M1   0x04 /* 01 : Mux1 selected */

Definition at line 141 of file tw9910.c.

#define YSEL_M2   0x08 /* 10 : Mux2 selected */

Definition at line 142 of file tw9910.c.

#define YSEL_M3   0x10 /* 11 : Mux3 selected */

Definition at line 143 of file tw9910.c.

Function Documentation

MODULE_AUTHOR ( "Kuninori Morimoto"  )
MODULE_DESCRIPTION ( "SoC Camera driver for tw9910"  )
MODULE_DEVICE_TABLE ( i2c  ,
tw9910_id   
)
module_i2c_driver ( tw9910_i2c_driver  )
MODULE_LICENSE ( "GPL v2 )