diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 18:09:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 18:09:54 -0400 |
commit | 7ae0dea900b027cd90e8a3e14deca9a19e17638b (patch) | |
tree | 428cbe411bba90f6580ae21338276c949e91f23a /drivers/media/video/mt9m111.c | |
parent | 6c74700fdb8e3bc34c31790384a8ec16c4fefd97 (diff) | |
parent | 560afa7d85bdfb294506afd3032c315e6827824f (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (94 commits)
V4L/DVB: tvp7002: fix write to H-PLL Feedback Divider LSB register
V4L/DVB: dvb: siano: free spinlock before schedule()
V4L/DVB: media: video: pvrusb2: remove custom hex_to_bin()
V4L/DVB: drivers: usbvideo: remove custom implementation of hex_to_bin()
V4L/DVB: Report supported QAM modes on bt8xx
V4L/DVB: media: ir-keytable: null dereference in debug code
V4L/DVB: ivtv: convert to the new control framework
V4L/DVB: ivtv: convert gpio subdev to new control framework
V4L/DVB: wm8739: convert to the new control framework
V4L/DVB: cs53l32a: convert to new control framework
V4L/DVB: wm8775: convert to the new control framework
V4L/DVB: cx2341x: convert to the control framework
V4L/DVB: cx25840: convert to the new control framework
V4L/DVB: cx25840/ivtv: replace ugly priv control with s_config
V4L/DVB: saa717x: convert to the new control framework
V4L/DVB: msp3400: convert to the new control framework
V4L/DVB: saa7115: convert to the new control framework
V4L/DVB: v4l2: hook up the new control framework into the core framework
V4L/DVB: Documentation: add v4l2-controls.txt documenting the new controls API
V4L/DVB: v4l2-ctrls: Whitespace cleanups
...
Diffstat (limited to 'drivers/media/video/mt9m111.c')
-rw-r--r-- | drivers/media/video/mt9m111.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index 31cc3d04bcc4..758a4db27d65 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for MT9M111/MT9M112 CMOS Image Sensor from Micron | 2 | * Driver for MT9M111/MT9M112/MT9M131 CMOS Image Sensor from Micron/Aptina |
3 | * | 3 | * |
4 | * Copyright (C) 2008, Robert Jarzmik <robert.jarzmik@free.fr> | 4 | * Copyright (C) 2008, Robert Jarzmik <robert.jarzmik@free.fr> |
5 | * | 5 | * |
@@ -19,11 +19,14 @@ | |||
19 | #include <media/soc_camera.h> | 19 | #include <media/soc_camera.h> |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * mt9m111 and mt9m112 i2c address is 0x5d or 0x48 (depending on SAddr pin) | 22 | * MT9M111, MT9M112 and MT9M131: |
23 | * i2c address is 0x48 or 0x5d (depending on SADDR pin) | ||
23 | * The platform has to define i2c_board_info and call i2c_register_board_info() | 24 | * The platform has to define i2c_board_info and call i2c_register_board_info() |
24 | */ | 25 | */ |
25 | 26 | ||
26 | /* mt9m111: Sensor register addresses */ | 27 | /* |
28 | * Sensor core register addresses (0x000..0x0ff) | ||
29 | */ | ||
27 | #define MT9M111_CHIP_VERSION 0x000 | 30 | #define MT9M111_CHIP_VERSION 0x000 |
28 | #define MT9M111_ROW_START 0x001 | 31 | #define MT9M111_ROW_START 0x001 |
29 | #define MT9M111_COLUMN_START 0x002 | 32 | #define MT9M111_COLUMN_START 0x002 |
@@ -72,8 +75,9 @@ | |||
72 | #define MT9M111_CTXT_CTRL_LED_FLASH_EN (1 << 2) | 75 | #define MT9M111_CTXT_CTRL_LED_FLASH_EN (1 << 2) |
73 | #define MT9M111_CTXT_CTRL_VBLANK_SEL_B (1 << 1) | 76 | #define MT9M111_CTXT_CTRL_VBLANK_SEL_B (1 << 1) |
74 | #define MT9M111_CTXT_CTRL_HBLANK_SEL_B (1 << 0) | 77 | #define MT9M111_CTXT_CTRL_HBLANK_SEL_B (1 << 0) |
78 | |||
75 | /* | 79 | /* |
76 | * mt9m111: Colorpipe register addresses (0x100..0x1ff) | 80 | * Colorpipe register addresses (0x100..0x1ff) |
77 | */ | 81 | */ |
78 | #define MT9M111_OPER_MODE_CTRL 0x106 | 82 | #define MT9M111_OPER_MODE_CTRL 0x106 |
79 | #define MT9M111_OUTPUT_FORMAT_CTRL 0x108 | 83 | #define MT9M111_OUTPUT_FORMAT_CTRL 0x108 |
@@ -109,8 +113,9 @@ | |||
109 | #define MT9M111_OUTFMT_SWAP_YCbCr_C_Y (1 << 1) | 113 | #define MT9M111_OUTFMT_SWAP_YCbCr_C_Y (1 << 1) |
110 | #define MT9M111_OUTFMT_SWAP_RGB_EVEN (1 << 1) | 114 | #define MT9M111_OUTFMT_SWAP_RGB_EVEN (1 << 1) |
111 | #define MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr (1 << 0) | 115 | #define MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr (1 << 0) |
116 | |||
112 | /* | 117 | /* |
113 | * mt9m111: Camera control register addresses (0x200..0x2ff not implemented) | 118 | * Camera control register addresses (0x200..0x2ff not implemented) |
114 | */ | 119 | */ |
115 | 120 | ||
116 | #define reg_read(reg) mt9m111_reg_read(client, MT9M111_##reg) | 121 | #define reg_read(reg) mt9m111_reg_read(client, MT9M111_##reg) |
@@ -160,7 +165,8 @@ enum mt9m111_context { | |||
160 | 165 | ||
161 | struct mt9m111 { | 166 | struct mt9m111 { |
162 | struct v4l2_subdev subdev; | 167 | struct v4l2_subdev subdev; |
163 | int model; /* V4L2_IDENT_MT9M11x* codes from v4l2-chip-ident.h */ | 168 | int model; /* V4L2_IDENT_MT9M111 or V4L2_IDENT_MT9M112 code |
169 | * from v4l2-chip-ident.h */ | ||
164 | enum mt9m111_context context; | 170 | enum mt9m111_context context; |
165 | struct v4l2_rect rect; | 171 | struct v4l2_rect rect; |
166 | const struct mt9m111_datafmt *fmt; | 172 | const struct mt9m111_datafmt *fmt; |
@@ -934,7 +940,7 @@ static int mt9m111_init(struct i2c_client *client) | |||
934 | if (!ret) | 940 | if (!ret) |
935 | ret = mt9m111_set_autoexposure(client, mt9m111->autoexposure); | 941 | ret = mt9m111_set_autoexposure(client, mt9m111->autoexposure); |
936 | if (ret) | 942 | if (ret) |
937 | dev_err(&client->dev, "mt9m11x init failed: %d\n", ret); | 943 | dev_err(&client->dev, "mt9m111 init failed: %d\n", ret); |
938 | return ret; | 944 | return ret; |
939 | } | 945 | } |
940 | 946 | ||
@@ -963,27 +969,27 @@ static int mt9m111_video_probe(struct soc_camera_device *icd, | |||
963 | mt9m111->swap_rgb_even_odd = 1; | 969 | mt9m111->swap_rgb_even_odd = 1; |
964 | mt9m111->swap_rgb_red_blue = 1; | 970 | mt9m111->swap_rgb_red_blue = 1; |
965 | 971 | ||
966 | ret = mt9m111_init(client); | ||
967 | if (ret) | ||
968 | goto ei2c; | ||
969 | |||
970 | data = reg_read(CHIP_VERSION); | 972 | data = reg_read(CHIP_VERSION); |
971 | 973 | ||
972 | switch (data) { | 974 | switch (data) { |
973 | case 0x143a: /* MT9M111 */ | 975 | case 0x143a: /* MT9M111 or MT9M131 */ |
974 | mt9m111->model = V4L2_IDENT_MT9M111; | 976 | mt9m111->model = V4L2_IDENT_MT9M111; |
977 | dev_info(&client->dev, | ||
978 | "Detected a MT9M111/MT9M131 chip ID %x\n", data); | ||
975 | break; | 979 | break; |
976 | case 0x148c: /* MT9M112 */ | 980 | case 0x148c: /* MT9M112 */ |
977 | mt9m111->model = V4L2_IDENT_MT9M112; | 981 | mt9m111->model = V4L2_IDENT_MT9M112; |
982 | dev_info(&client->dev, "Detected a MT9M112 chip ID %x\n", data); | ||
978 | break; | 983 | break; |
979 | default: | 984 | default: |
980 | ret = -ENODEV; | 985 | ret = -ENODEV; |
981 | dev_err(&client->dev, | 986 | dev_err(&client->dev, |
982 | "No MT9M11x chip detected, register read %x\n", data); | 987 | "No MT9M111/MT9M112/MT9M131 chip detected register read %x\n", |
988 | data); | ||
983 | goto ei2c; | 989 | goto ei2c; |
984 | } | 990 | } |
985 | 991 | ||
986 | dev_info(&client->dev, "Detected a MT9M11x chip ID %x\n", data); | 992 | ret = mt9m111_init(client); |
987 | 993 | ||
988 | ei2c: | 994 | ei2c: |
989 | return ret; | 995 | return ret; |
@@ -1034,13 +1040,13 @@ static int mt9m111_probe(struct i2c_client *client, | |||
1034 | int ret; | 1040 | int ret; |
1035 | 1041 | ||
1036 | if (!icd) { | 1042 | if (!icd) { |
1037 | dev_err(&client->dev, "MT9M11x: missing soc-camera data!\n"); | 1043 | dev_err(&client->dev, "mt9m111: soc-camera data missing!\n"); |
1038 | return -EINVAL; | 1044 | return -EINVAL; |
1039 | } | 1045 | } |
1040 | 1046 | ||
1041 | icl = to_soc_camera_link(icd); | 1047 | icl = to_soc_camera_link(icd); |
1042 | if (!icl) { | 1048 | if (!icl) { |
1043 | dev_err(&client->dev, "MT9M11x driver needs platform data\n"); | 1049 | dev_err(&client->dev, "mt9m111: driver needs platform data\n"); |
1044 | return -EINVAL; | 1050 | return -EINVAL; |
1045 | } | 1051 | } |
1046 | 1052 | ||
@@ -1114,6 +1120,6 @@ static void __exit mt9m111_mod_exit(void) | |||
1114 | module_init(mt9m111_mod_init); | 1120 | module_init(mt9m111_mod_init); |
1115 | module_exit(mt9m111_mod_exit); | 1121 | module_exit(mt9m111_mod_exit); |
1116 | 1122 | ||
1117 | MODULE_DESCRIPTION("Micron MT9M111/MT9M112 Camera driver"); | 1123 | MODULE_DESCRIPTION("Micron/Aptina MT9M111/MT9M112/MT9M131 Camera driver"); |
1118 | MODULE_AUTHOR("Robert Jarzmik"); | 1124 | MODULE_AUTHOR("Robert Jarzmik"); |
1119 | MODULE_LICENSE("GPL"); | 1125 | MODULE_LICENSE("GPL"); |