diff options
author | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 05:02:08 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 05:02:08 -0500 |
commit | 5501972e0b5857bc8354770d900ceb9b40c7f6b7 (patch) | |
tree | ff239422827c4cd54d2998f8851304255de31b38 /drivers/media/video/tvp5150.c | |
parent | 9d2f928ddf64ca0361562e30faf584cd33055c60 (diff) | |
parent | e952f31bce6e9f64db01f607abc46529ba57ac9e (diff) |
Merge with rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'drivers/media/video/tvp5150.c')
-rw-r--r-- | drivers/media/video/tvp5150.c | 681 |
1 files changed, 376 insertions, 305 deletions
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 1864423b3046..69d0fe159f4d 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * tvp5150 - Texas Instruments TVP5150A(M) video decoder driver | 2 | * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder driver |
3 | * | 3 | * |
4 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) | 4 | * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org) |
5 | * This code is placed under the terms of the GNU General Public License | 5 | * This code is placed under the terms of the GNU General Public License v2 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/i2c.h> | 8 | #include <linux/i2c.h> |
@@ -13,10 +13,11 @@ | |||
13 | 13 | ||
14 | #include "tvp5150_reg.h" | 14 | #include "tvp5150_reg.h" |
15 | 15 | ||
16 | MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver"); /* standard i2c insmod options */ | 16 | MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver"); |
17 | MODULE_AUTHOR("Mauro Carvalho Chehab"); | 17 | MODULE_AUTHOR("Mauro Carvalho Chehab"); |
18 | MODULE_LICENSE("GPL"); | 18 | MODULE_LICENSE("GPL"); |
19 | 19 | ||
20 | /* standard i2c insmod options */ | ||
20 | static unsigned short normal_i2c[] = { | 21 | static unsigned short normal_i2c[] = { |
21 | 0xb8 >> 1, | 22 | 0xb8 >> 1, |
22 | 0xba >> 1, | 23 | 0xba >> 1, |
@@ -29,6 +30,9 @@ static int debug = 0; | |||
29 | module_param(debug, int, 0); | 30 | module_param(debug, int, 0); |
30 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); | 31 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); |
31 | 32 | ||
33 | #define tvp5150_err(fmt, arg...) do { \ | ||
34 | printk(KERN_ERR "%s %d-%04x: " fmt, c->driver->driver.name, \ | ||
35 | i2c_adapter_id(c->adapter), c->addr , ## arg); } while (0) | ||
32 | #define tvp5150_info(fmt, arg...) do { \ | 36 | #define tvp5150_info(fmt, arg...) do { \ |
33 | printk(KERN_INFO "%s %d-%04x: " fmt, c->driver->driver.name, \ | 37 | printk(KERN_INFO "%s %d-%04x: " fmt, c->driver->driver.name, \ |
34 | i2c_adapter_id(c->adapter), c->addr , ## arg); } while (0) | 38 | i2c_adapter_id(c->adapter), c->addr , ## arg); } while (0) |
@@ -84,7 +88,7 @@ static struct v4l2_queryctrl tvp5150_qctrl[] = { | |||
84 | struct tvp5150 { | 88 | struct tvp5150 { |
85 | struct i2c_client *client; | 89 | struct i2c_client *client; |
86 | 90 | ||
87 | int norm; | 91 | v4l2_std_id norm; /* Current set standard */ |
88 | int input; | 92 | int input; |
89 | int enable; | 93 | int enable; |
90 | int bright; | 94 | int bright; |
@@ -125,310 +129,155 @@ static inline void tvp5150_write(struct i2c_client *c, unsigned char addr, | |||
125 | tvp5150_dbg(0, "i2c i/o error: rc == %d (should be 2)\n", rc); | 129 | tvp5150_dbg(0, "i2c i/o error: rc == %d (should be 2)\n", rc); |
126 | } | 130 | } |
127 | 131 | ||
132 | static void dump_reg_range(struct i2c_client *c, char *s, u8 init, const u8 end,int max_line) | ||
133 | { | ||
134 | int i=0; | ||
135 | |||
136 | while (init!=(u8)(end+1)) { | ||
137 | if ((i%max_line) == 0) { | ||
138 | if (i>0) | ||
139 | printk("\n"); | ||
140 | printk("tvp5150: %s reg 0x%02x = ",s,init); | ||
141 | } | ||
142 | printk("%02x ",tvp5150_read(c, init)); | ||
143 | |||
144 | init++; | ||
145 | i++; | ||
146 | } | ||
147 | printk("\n"); | ||
148 | } | ||
149 | |||
128 | static void dump_reg(struct i2c_client *c) | 150 | static void dump_reg(struct i2c_client *c) |
129 | { | 151 | { |
130 | printk("tvp5150: Video input source selection #1 = 0x%02x\n", | 152 | printk("tvp5150: Video input source selection #1 = 0x%02x\n", |
131 | tvp5150_read(c, TVP5150_VD_IN_SRC_SEL_1)); | 153 | tvp5150_read(c, TVP5150_VD_IN_SRC_SEL_1)); |
132 | printk("tvp5150: Analog channel controls = 0x%02x\n", | 154 | printk("tvp5150: Analog channel controls = 0x%02x\n", |
133 | tvp5150_read(c, TVP5150_ANAL_CHL_CTL)); | 155 | tvp5150_read(c, TVP5150_ANAL_CHL_CTL)); |
134 | printk("tvp5150: Operation mode controls = 0x%02x\n", | 156 | printk("tvp5150: Operation mode controls = 0x%02x\n", |
135 | tvp5150_read(c, TVP5150_OP_MODE_CTL)); | 157 | tvp5150_read(c, TVP5150_OP_MODE_CTL)); |
136 | printk("tvp5150: Miscellaneous controls = 0x%02x\n", | 158 | printk("tvp5150: Miscellaneous controls = 0x%02x\n", |
137 | tvp5150_read(c, TVP5150_MISC_CTL)); | 159 | tvp5150_read(c, TVP5150_MISC_CTL)); |
138 | printk("tvp5150: Autoswitch mask: TVP5150A / TVP5150AM = 0x%02x\n", | 160 | printk("tvp5150: Autoswitch mask= 0x%02x\n", |
139 | tvp5150_read(c, TVP5150_AUTOSW_MSK)); | 161 | tvp5150_read(c, TVP5150_AUTOSW_MSK)); |
140 | printk("tvp5150: Color killer threshold control = 0x%02x\n", | 162 | printk("tvp5150: Color killer threshold control = 0x%02x\n", |
141 | tvp5150_read(c, TVP5150_COLOR_KIL_THSH_CTL)); | 163 | tvp5150_read(c, TVP5150_COLOR_KIL_THSH_CTL)); |
142 | printk("tvp5150: Luminance processing control #1 = 0x%02x\n", | 164 | printk("tvp5150: Luminance processing controls #1 #2 and #3 = %02x %02x %02x\n", |
143 | tvp5150_read(c, TVP5150_LUMA_PROC_CTL_1)); | 165 | tvp5150_read(c, TVP5150_LUMA_PROC_CTL_1), |
144 | printk("tvp5150: Luminance processing control #2 = 0x%02x\n", | 166 | tvp5150_read(c, TVP5150_LUMA_PROC_CTL_2), |
145 | tvp5150_read(c, TVP5150_LUMA_PROC_CTL_2)); | 167 | tvp5150_read(c, TVP5150_LUMA_PROC_CTL_3)); |
146 | printk("tvp5150: Brightness control = 0x%02x\n", | 168 | printk("tvp5150: Brightness control = 0x%02x\n", |
147 | tvp5150_read(c, TVP5150_BRIGHT_CTL)); | 169 | tvp5150_read(c, TVP5150_BRIGHT_CTL)); |
148 | printk("tvp5150: Color saturation control = 0x%02x\n", | 170 | printk("tvp5150: Color saturation control = 0x%02x\n", |
149 | tvp5150_read(c, TVP5150_SATURATION_CTL)); | 171 | tvp5150_read(c, TVP5150_SATURATION_CTL)); |
150 | printk("tvp5150: Hue control = 0x%02x\n", | 172 | printk("tvp5150: Hue control = 0x%02x\n", |
151 | tvp5150_read(c, TVP5150_HUE_CTL)); | 173 | tvp5150_read(c, TVP5150_HUE_CTL)); |
152 | printk("tvp5150: Contrast control = 0x%02x\n", | 174 | printk("tvp5150: Contrast control = 0x%02x\n", |
153 | tvp5150_read(c, TVP5150_CONTRAST_CTL)); | 175 | tvp5150_read(c, TVP5150_CONTRAST_CTL)); |
154 | printk("tvp5150: Outputs and data rates select = 0x%02x\n", | 176 | printk("tvp5150: Outputs and data rates select = 0x%02x\n", |
155 | tvp5150_read(c, TVP5150_DATA_RATE_SEL)); | 177 | tvp5150_read(c, TVP5150_DATA_RATE_SEL)); |
156 | printk("tvp5150: Luminance processing control #3 = 0x%02x\n", | ||
157 | tvp5150_read(c, TVP5150_LUMA_PROC_CTL_3)); | ||
158 | printk("tvp5150: Configuration shared pins = 0x%02x\n", | 178 | printk("tvp5150: Configuration shared pins = 0x%02x\n", |
159 | tvp5150_read(c, TVP5150_CONF_SHARED_PIN)); | 179 | tvp5150_read(c, TVP5150_CONF_SHARED_PIN)); |
160 | printk("tvp5150: Active video cropping start MSB = 0x%02x\n", | 180 | printk("tvp5150: Active video cropping start = 0x%02x%02x\n", |
161 | tvp5150_read(c, TVP5150_ACT_VD_CROP_ST_MSB)); | 181 | tvp5150_read(c, TVP5150_ACT_VD_CROP_ST_MSB), |
162 | printk("tvp5150: Active video cropping start LSB = 0x%02x\n", | 182 | tvp5150_read(c, TVP5150_ACT_VD_CROP_ST_LSB)); |
163 | tvp5150_read(c, TVP5150_ACT_VD_CROP_ST_LSB)); | 183 | printk("tvp5150: Active video cropping stop = 0x%02x%02x\n", |
164 | printk("tvp5150: Active video cropping stop MSB = 0x%02x\n", | 184 | tvp5150_read(c, TVP5150_ACT_VD_CROP_STP_MSB), |
165 | tvp5150_read(c, TVP5150_ACT_VD_CROP_STP_MSB)); | 185 | tvp5150_read(c, TVP5150_ACT_VD_CROP_STP_LSB)); |
166 | printk("tvp5150: Active video cropping stop LSB = 0x%02x\n", | ||
167 | tvp5150_read(c, TVP5150_ACT_VD_CROP_STP_LSB)); | ||
168 | printk("tvp5150: Genlock/RTC = 0x%02x\n", | 186 | printk("tvp5150: Genlock/RTC = 0x%02x\n", |
169 | tvp5150_read(c, TVP5150_GENLOCK)); | 187 | tvp5150_read(c, TVP5150_GENLOCK)); |
170 | printk("tvp5150: Horizontal sync start = 0x%02x\n", | 188 | printk("tvp5150: Horizontal sync start = 0x%02x\n", |
171 | tvp5150_read(c, TVP5150_HORIZ_SYNC_START)); | 189 | tvp5150_read(c, TVP5150_HORIZ_SYNC_START)); |
172 | printk("tvp5150: Vertical blanking start = 0x%02x\n", | 190 | printk("tvp5150: Vertical blanking start = 0x%02x\n", |
173 | tvp5150_read(c, TVP5150_VERT_BLANKING_START)); | 191 | tvp5150_read(c, TVP5150_VERT_BLANKING_START)); |
174 | printk("tvp5150: Vertical blanking stop = 0x%02x\n", | 192 | printk("tvp5150: Vertical blanking stop = 0x%02x\n", |
175 | tvp5150_read(c, TVP5150_VERT_BLANKING_STOP)); | 193 | tvp5150_read(c, TVP5150_VERT_BLANKING_STOP)); |
176 | printk("tvp5150: Chrominance processing control #1 = 0x%02x\n", | 194 | printk("tvp5150: Chrominance processing control #1 and #2 = %02x %02x\n", |
177 | tvp5150_read(c, TVP5150_CHROMA_PROC_CTL_1)); | 195 | tvp5150_read(c, TVP5150_CHROMA_PROC_CTL_1), |
178 | printk("tvp5150: Chrominance processing control #2 = 0x%02x\n", | 196 | tvp5150_read(c, TVP5150_CHROMA_PROC_CTL_2)); |
179 | tvp5150_read(c, TVP5150_CHROMA_PROC_CTL_2)); | ||
180 | printk("tvp5150: Interrupt reset register B = 0x%02x\n", | 197 | printk("tvp5150: Interrupt reset register B = 0x%02x\n", |
181 | tvp5150_read(c, TVP5150_INT_RESET_REG_B)); | 198 | tvp5150_read(c, TVP5150_INT_RESET_REG_B)); |
182 | printk("tvp5150: Interrupt enable register B = 0x%02x\n", | 199 | printk("tvp5150: Interrupt enable register B = 0x%02x\n", |
183 | tvp5150_read(c, TVP5150_INT_ENABLE_REG_B)); | 200 | tvp5150_read(c, TVP5150_INT_ENABLE_REG_B)); |
184 | printk("tvp5150: Interrupt configuration register B = 0x%02x\n", | 201 | printk("tvp5150: Interrupt configuration register B = 0x%02x\n", |
185 | tvp5150_read(c, TVP5150_INTT_CONFIG_REG_B)); | 202 | tvp5150_read(c, TVP5150_INTT_CONFIG_REG_B)); |
186 | printk("tvp5150: Video standard = 0x%02x\n", | 203 | printk("tvp5150: Video standard = 0x%02x\n", |
187 | tvp5150_read(c, TVP5150_VIDEO_STD)); | 204 | tvp5150_read(c, TVP5150_VIDEO_STD)); |
188 | printk("tvp5150: Cb gain factor = 0x%02x\n", | 205 | printk("tvp5150: Chroma gain factor: Cb=0x%02x Cr=0x%02x\n", |
189 | tvp5150_read(c, TVP5150_CB_GAIN_FACT)); | 206 | tvp5150_read(c, TVP5150_CB_GAIN_FACT), |
190 | printk("tvp5150: Cr gain factor = 0x%02x\n", | 207 | tvp5150_read(c, TVP5150_CR_GAIN_FACTOR)); |
191 | tvp5150_read(c, TVP5150_CR_GAIN_FACTOR)); | ||
192 | printk("tvp5150: Macrovision on counter = 0x%02x\n", | 208 | printk("tvp5150: Macrovision on counter = 0x%02x\n", |
193 | tvp5150_read(c, TVP5150_MACROVISION_ON_CTR)); | 209 | tvp5150_read(c, TVP5150_MACROVISION_ON_CTR)); |
194 | printk("tvp5150: Macrovision off counter = 0x%02x\n", | 210 | printk("tvp5150: Macrovision off counter = 0x%02x\n", |
195 | tvp5150_read(c, TVP5150_MACROVISION_OFF_CTR)); | 211 | tvp5150_read(c, TVP5150_MACROVISION_OFF_CTR)); |
196 | printk("tvp5150: revision select (TVP5150AM1 only) = 0x%02x\n", | 212 | printk("tvp5150: ITU-R BT.656.%d timing(TVP5150AM1 only)\n", |
197 | tvp5150_read(c, TVP5150_REV_SELECT)); | 213 | (tvp5150_read(c, TVP5150_REV_SELECT)&1)?3:4); |
198 | printk("tvp5150: MSB of device ID = 0x%02x\n", | 214 | printk("tvp5150: Device ID = %02x%02x\n", |
199 | tvp5150_read(c, TVP5150_MSB_DEV_ID)); | 215 | tvp5150_read(c, TVP5150_MSB_DEV_ID), |
200 | printk("tvp5150: LSB of device ID = 0x%02x\n", | 216 | tvp5150_read(c, TVP5150_LSB_DEV_ID)); |
201 | tvp5150_read(c, TVP5150_LSB_DEV_ID)); | 217 | printk("tvp5150: ROM version = (hex) %02x.%02x\n", |
202 | printk("tvp5150: ROM major version = 0x%02x\n", | 218 | tvp5150_read(c, TVP5150_ROM_MAJOR_VER), |
203 | tvp5150_read(c, TVP5150_ROM_MAJOR_VER)); | 219 | tvp5150_read(c, TVP5150_ROM_MINOR_VER)); |
204 | printk("tvp5150: ROM minor version = 0x%02x\n", | 220 | printk("tvp5150: Vertical line count = 0x%02x%02x\n", |
205 | tvp5150_read(c, TVP5150_ROM_MINOR_VER)); | 221 | tvp5150_read(c, TVP5150_VERT_LN_COUNT_MSB), |
206 | printk("tvp5150: Vertical line count MSB = 0x%02x\n", | 222 | tvp5150_read(c, TVP5150_VERT_LN_COUNT_LSB)); |
207 | tvp5150_read(c, TVP5150_VERT_LN_COUNT_MSB)); | ||
208 | printk("tvp5150: Vertical line count LSB = 0x%02x\n", | ||
209 | tvp5150_read(c, TVP5150_VERT_LN_COUNT_LSB)); | ||
210 | printk("tvp5150: Interrupt status register B = 0x%02x\n", | 223 | printk("tvp5150: Interrupt status register B = 0x%02x\n", |
211 | tvp5150_read(c, TVP5150_INT_STATUS_REG_B)); | 224 | tvp5150_read(c, TVP5150_INT_STATUS_REG_B)); |
212 | printk("tvp5150: Interrupt active register B = 0x%02x\n", | 225 | printk("tvp5150: Interrupt active register B = 0x%02x\n", |
213 | tvp5150_read(c, TVP5150_INT_ACTIVE_REG_B)); | 226 | tvp5150_read(c, TVP5150_INT_ACTIVE_REG_B)); |
214 | printk("tvp5150: Status register #1 = 0x%02x\n", | 227 | printk("tvp5150: Status regs #1 to #5 = %02x %02x %02x %02x %02x\n", |
215 | tvp5150_read(c, TVP5150_STATUS_REG_1)); | 228 | tvp5150_read(c, TVP5150_STATUS_REG_1), |
216 | printk("tvp5150: Status register #2 = 0x%02x\n", | 229 | tvp5150_read(c, TVP5150_STATUS_REG_2), |
217 | tvp5150_read(c, TVP5150_STATUS_REG_2)); | 230 | tvp5150_read(c, TVP5150_STATUS_REG_3), |
218 | printk("tvp5150: Status register #3 = 0x%02x\n", | 231 | tvp5150_read(c, TVP5150_STATUS_REG_4), |
219 | tvp5150_read(c, TVP5150_STATUS_REG_3)); | 232 | tvp5150_read(c, TVP5150_STATUS_REG_5)); |
220 | printk("tvp5150: Status register #4 = 0x%02x\n", | 233 | |
221 | tvp5150_read(c, TVP5150_STATUS_REG_4)); | 234 | dump_reg_range(c,"Teletext filter 1", TVP5150_TELETEXT_FIL1_INI, |
222 | printk("tvp5150: Status register #5 = 0x%02x\n", | 235 | TVP5150_TELETEXT_FIL1_END,8); |
223 | tvp5150_read(c, TVP5150_STATUS_REG_5)); | 236 | dump_reg_range(c,"Teletext filter 2", TVP5150_TELETEXT_FIL2_INI, |
224 | printk("tvp5150: Closed caption data registers = 0x%02x\n", | 237 | TVP5150_TELETEXT_FIL2_END,8); |
225 | tvp5150_read(c, TVP5150_CC_DATA_REG1)); | 238 | |
226 | printk("tvp5150: Closed caption data registers = 0x%02x\n", | ||
227 | tvp5150_read(c, TVP5150_CC_DATA_REG2)); | ||
228 | printk("tvp5150: Closed caption data registers = 0x%02x\n", | ||
229 | tvp5150_read(c, TVP5150_CC_DATA_REG3)); | ||
230 | printk("tvp5150: Closed caption data registers = 0x%02x\n", | ||
231 | tvp5150_read(c, TVP5150_CC_DATA_REG4)); | ||
232 | printk("tvp5150: WSS data registers = 0x%02x\n", | ||
233 | tvp5150_read(c, TVP5150_WSS_DATA_REG1)); | ||
234 | printk("tvp5150: WSS data registers = 0x%02x\n", | ||
235 | tvp5150_read(c, TVP5150_WSS_DATA_REG2)); | ||
236 | printk("tvp5150: WSS data registers = 0x%02x\n", | ||
237 | tvp5150_read(c, TVP5150_WSS_DATA_REG3)); | ||
238 | printk("tvp5150: WSS data registers = 0x%02x\n", | ||
239 | tvp5150_read(c, TVP5150_WSS_DATA_REG4)); | ||
240 | printk("tvp5150: WSS data registers = 0x%02x\n", | ||
241 | tvp5150_read(c, TVP5150_WSS_DATA_REG5)); | ||
242 | printk("tvp5150: WSS data registers = 0x%02x\n", | ||
243 | tvp5150_read(c, TVP5150_WSS_DATA_REG6)); | ||
244 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
245 | tvp5150_read(c, TVP5150_VPS_DATA_REG1)); | ||
246 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
247 | tvp5150_read(c, TVP5150_VPS_DATA_REG2)); | ||
248 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
249 | tvp5150_read(c, TVP5150_VPS_DATA_REG3)); | ||
250 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
251 | tvp5150_read(c, TVP5150_VPS_DATA_REG4)); | ||
252 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
253 | tvp5150_read(c, TVP5150_VPS_DATA_REG5)); | ||
254 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
255 | tvp5150_read(c, TVP5150_VPS_DATA_REG6)); | ||
256 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
257 | tvp5150_read(c, TVP5150_VPS_DATA_REG7)); | ||
258 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
259 | tvp5150_read(c, TVP5150_VPS_DATA_REG8)); | ||
260 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
261 | tvp5150_read(c, TVP5150_VPS_DATA_REG9)); | ||
262 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
263 | tvp5150_read(c, TVP5150_VPS_DATA_REG10)); | ||
264 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
265 | tvp5150_read(c, TVP5150_VPS_DATA_REG11)); | ||
266 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
267 | tvp5150_read(c, TVP5150_VPS_DATA_REG12)); | ||
268 | printk("tvp5150: VPS data registers = 0x%02x\n", | ||
269 | tvp5150_read(c, TVP5150_VPS_DATA_REG13)); | ||
270 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
271 | tvp5150_read(c, TVP5150_VITC_DATA_REG1)); | ||
272 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
273 | tvp5150_read(c, TVP5150_VITC_DATA_REG2)); | ||
274 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
275 | tvp5150_read(c, TVP5150_VITC_DATA_REG3)); | ||
276 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
277 | tvp5150_read(c, TVP5150_VITC_DATA_REG4)); | ||
278 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
279 | tvp5150_read(c, TVP5150_VITC_DATA_REG5)); | ||
280 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
281 | tvp5150_read(c, TVP5150_VITC_DATA_REG6)); | ||
282 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
283 | tvp5150_read(c, TVP5150_VITC_DATA_REG7)); | ||
284 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
285 | tvp5150_read(c, TVP5150_VITC_DATA_REG8)); | ||
286 | printk("tvp5150: VITC data registers = 0x%02x\n", | ||
287 | tvp5150_read(c, TVP5150_VITC_DATA_REG9)); | ||
288 | printk("tvp5150: VBI FIFO read data = 0x%02x\n", | ||
289 | tvp5150_read(c, TVP5150_VBI_FIFO_READ_DATA)); | ||
290 | printk("tvp5150: Teletext filter 1 = 0x%02x\n", | ||
291 | tvp5150_read(c, TVP5150_TELETEXT_FIL_1_1)); | ||
292 | printk("tvp5150: Teletext filter 1 = 0x%02x\n", | ||
293 | tvp5150_read(c, TVP5150_TELETEXT_FIL_1_2)); | ||
294 | printk("tvp5150: Teletext filter 1 = 0x%02x\n", | ||
295 | tvp5150_read(c, TVP5150_TELETEXT_FIL_1_3)); | ||
296 | printk("tvp5150: Teletext filter 1 = 0x%02x\n", | ||
297 | tvp5150_read(c, TVP5150_TELETEXT_FIL_1_4)); | ||
298 | printk("tvp5150: Teletext filter 1 = 0x%02x\n", | ||
299 | tvp5150_read(c, TVP5150_TELETEXT_FIL_1_5)); | ||
300 | printk("tvp5150: Teletext filter 2 = 0x%02x\n", | ||
301 | tvp5150_read(c, TVP5150_TELETEXT_FIL_2_1)); | ||
302 | printk("tvp5150: Teletext filter 2 = 0x%02x\n", | ||
303 | tvp5150_read(c, TVP5150_TELETEXT_FIL_2_2)); | ||
304 | printk("tvp5150: Teletext filter 2 = 0x%02x\n", | ||
305 | tvp5150_read(c, TVP5150_TELETEXT_FIL_2_3)); | ||
306 | printk("tvp5150: Teletext filter 2 = 0x%02x\n", | ||
307 | tvp5150_read(c, TVP5150_TELETEXT_FIL_2_4)); | ||
308 | printk("tvp5150: Teletext filter 2 = 0x%02x\n", | ||
309 | tvp5150_read(c, TVP5150_TELETEXT_FIL_2_5)); | ||
310 | printk("tvp5150: Teletext filter enable = 0x%02x\n", | 239 | printk("tvp5150: Teletext filter enable = 0x%02x\n", |
311 | tvp5150_read(c, TVP5150_TELETEXT_FIL_ENA)); | 240 | tvp5150_read(c, TVP5150_TELETEXT_FIL_ENA)); |
312 | printk("tvp5150: Interrupt status register A = 0x%02x\n", | 241 | printk("tvp5150: Interrupt status register A = 0x%02x\n", |
313 | tvp5150_read(c, TVP5150_INT_STATUS_REG_A)); | 242 | tvp5150_read(c, TVP5150_INT_STATUS_REG_A)); |
314 | printk("tvp5150: Interrupt enable register A = 0x%02x\n", | 243 | printk("tvp5150: Interrupt enable register A = 0x%02x\n", |
315 | tvp5150_read(c, TVP5150_INT_ENABLE_REG_A)); | 244 | tvp5150_read(c, TVP5150_INT_ENABLE_REG_A)); |
316 | printk("tvp5150: Interrupt configuration = 0x%02x\n", | 245 | printk("tvp5150: Interrupt configuration = 0x%02x\n", |
317 | tvp5150_read(c, TVP5150_INT_CONF)); | 246 | tvp5150_read(c, TVP5150_INT_CONF)); |
318 | printk("tvp5150: VDP configuration RAM data = 0x%02x\n", | ||
319 | tvp5150_read(c, TVP5150_VDP_CONF_RAM_DATA)); | ||
320 | printk("tvp5150: Configuration RAM address low byte = 0x%02x\n", | ||
321 | tvp5150_read(c, TVP5150_CONF_RAM_ADDR_LOW)); | ||
322 | printk("tvp5150: Configuration RAM address high byte = 0x%02x\n", | ||
323 | tvp5150_read(c, TVP5150_CONF_RAM_ADDR_HIGH)); | ||
324 | printk("tvp5150: VDP status register = 0x%02x\n", | 247 | printk("tvp5150: VDP status register = 0x%02x\n", |
325 | tvp5150_read(c, TVP5150_VDP_STATUS_REG)); | 248 | tvp5150_read(c, TVP5150_VDP_STATUS_REG)); |
326 | printk("tvp5150: FIFO word count = 0x%02x\n", | 249 | printk("tvp5150: FIFO word count = 0x%02x\n", |
327 | tvp5150_read(c, TVP5150_FIFO_WORD_COUNT)); | 250 | tvp5150_read(c, TVP5150_FIFO_WORD_COUNT)); |
328 | printk("tvp5150: FIFO interrupt threshold = 0x%02x\n", | 251 | printk("tvp5150: FIFO interrupt threshold = 0x%02x\n", |
329 | tvp5150_read(c, TVP5150_FIFO_INT_THRESHOLD)); | 252 | tvp5150_read(c, TVP5150_FIFO_INT_THRESHOLD)); |
330 | printk("tvp5150: FIFO reset = 0x%02x\n", | 253 | printk("tvp5150: FIFO reset = 0x%02x\n", |
331 | tvp5150_read(c, TVP5150_FIFO_RESET)); | 254 | tvp5150_read(c, TVP5150_FIFO_RESET)); |
332 | printk("tvp5150: Line number interrupt = 0x%02x\n", | 255 | printk("tvp5150: Line number interrupt = 0x%02x\n", |
333 | tvp5150_read(c, TVP5150_LINE_NUMBER_INT)); | 256 | tvp5150_read(c, TVP5150_LINE_NUMBER_INT)); |
334 | printk("tvp5150: Pixel alignment register low byte = 0x%02x\n", | 257 | printk("tvp5150: Pixel alignment register = 0x%02x%02x\n", |
335 | tvp5150_read(c, TVP5150_PIX_ALIGN_REG_LOW)); | 258 | tvp5150_read(c, TVP5150_PIX_ALIGN_REG_HIGH), |
336 | printk("tvp5150: Pixel alignment register high byte = 0x%02x\n", | 259 | tvp5150_read(c, TVP5150_PIX_ALIGN_REG_LOW)); |
337 | tvp5150_read(c, TVP5150_PIX_ALIGN_REG_HIGH)); | ||
338 | printk("tvp5150: FIFO output control = 0x%02x\n", | 260 | printk("tvp5150: FIFO output control = 0x%02x\n", |
339 | tvp5150_read(c, TVP5150_FIFO_OUT_CTRL)); | 261 | tvp5150_read(c, TVP5150_FIFO_OUT_CTRL)); |
340 | printk("tvp5150: Full field enable 1 = 0x%02x\n", | 262 | printk("tvp5150: Full field enable = 0x%02x\n", |
341 | tvp5150_read(c, TVP5150_FULL_FIELD_ENA_1)); | 263 | tvp5150_read(c, TVP5150_FULL_FIELD_ENA)); |
342 | printk("tvp5150: Full field enable 2 = 0x%02x\n", | ||
343 | tvp5150_read(c, TVP5150_FULL_FIELD_ENA_2)); | ||
344 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
345 | tvp5150_read(c, TVP5150_LINE_MODE_REG_1)); | ||
346 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
347 | tvp5150_read(c, TVP5150_LINE_MODE_REG_2)); | ||
348 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
349 | tvp5150_read(c, TVP5150_LINE_MODE_REG_3)); | ||
350 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
351 | tvp5150_read(c, TVP5150_LINE_MODE_REG_4)); | ||
352 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
353 | tvp5150_read(c, TVP5150_LINE_MODE_REG_5)); | ||
354 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
355 | tvp5150_read(c, TVP5150_LINE_MODE_REG_6)); | ||
356 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
357 | tvp5150_read(c, TVP5150_LINE_MODE_REG_7)); | ||
358 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
359 | tvp5150_read(c, TVP5150_LINE_MODE_REG_8)); | ||
360 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
361 | tvp5150_read(c, TVP5150_LINE_MODE_REG_9)); | ||
362 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
363 | tvp5150_read(c, TVP5150_LINE_MODE_REG_10)); | ||
364 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
365 | tvp5150_read(c, TVP5150_LINE_MODE_REG_11)); | ||
366 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
367 | tvp5150_read(c, TVP5150_LINE_MODE_REG_12)); | ||
368 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
369 | tvp5150_read(c, TVP5150_LINE_MODE_REG_13)); | ||
370 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
371 | tvp5150_read(c, TVP5150_LINE_MODE_REG_14)); | ||
372 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
373 | tvp5150_read(c, TVP5150_LINE_MODE_REG_15)); | ||
374 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
375 | tvp5150_read(c, TVP5150_LINE_MODE_REG_16)); | ||
376 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
377 | tvp5150_read(c, TVP5150_LINE_MODE_REG_17)); | ||
378 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
379 | tvp5150_read(c, TVP5150_LINE_MODE_REG_18)); | ||
380 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
381 | tvp5150_read(c, TVP5150_LINE_MODE_REG_19)); | ||
382 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
383 | tvp5150_read(c, TVP5150_LINE_MODE_REG_20)); | ||
384 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
385 | tvp5150_read(c, TVP5150_LINE_MODE_REG_21)); | ||
386 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
387 | tvp5150_read(c, TVP5150_LINE_MODE_REG_22)); | ||
388 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
389 | tvp5150_read(c, TVP5150_LINE_MODE_REG_23)); | ||
390 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
391 | tvp5150_read(c, TVP5150_LINE_MODE_REG_24)); | ||
392 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
393 | tvp5150_read(c, TVP5150_LINE_MODE_REG_25)); | ||
394 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
395 | tvp5150_read(c, TVP5150_LINE_MODE_REG_27)); | ||
396 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
397 | tvp5150_read(c, TVP5150_LINE_MODE_REG_28)); | ||
398 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
399 | tvp5150_read(c, TVP5150_LINE_MODE_REG_29)); | ||
400 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
401 | tvp5150_read(c, TVP5150_LINE_MODE_REG_30)); | ||
402 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
403 | tvp5150_read(c, TVP5150_LINE_MODE_REG_31)); | ||
404 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
405 | tvp5150_read(c, TVP5150_LINE_MODE_REG_32)); | ||
406 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
407 | tvp5150_read(c, TVP5150_LINE_MODE_REG_33)); | ||
408 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
409 | tvp5150_read(c, TVP5150_LINE_MODE_REG_34)); | ||
410 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
411 | tvp5150_read(c, TVP5150_LINE_MODE_REG_35)); | ||
412 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
413 | tvp5150_read(c, TVP5150_LINE_MODE_REG_36)); | ||
414 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
415 | tvp5150_read(c, TVP5150_LINE_MODE_REG_37)); | ||
416 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
417 | tvp5150_read(c, TVP5150_LINE_MODE_REG_38)); | ||
418 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
419 | tvp5150_read(c, TVP5150_LINE_MODE_REG_39)); | ||
420 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
421 | tvp5150_read(c, TVP5150_LINE_MODE_REG_40)); | ||
422 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
423 | tvp5150_read(c, TVP5150_LINE_MODE_REG_41)); | ||
424 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
425 | tvp5150_read(c, TVP5150_LINE_MODE_REG_42)); | ||
426 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
427 | tvp5150_read(c, TVP5150_LINE_MODE_REG_43)); | ||
428 | printk("tvp5150: Line mode registers = 0x%02x\n", | ||
429 | tvp5150_read(c, TVP5150_LINE_MODE_REG_44)); | ||
430 | printk("tvp5150: Full field mode register = 0x%02x\n", | 264 | printk("tvp5150: Full field mode register = 0x%02x\n", |
431 | tvp5150_read(c, TVP5150_FULL_FIELD_MODE_REG)); | 265 | tvp5150_read(c, TVP5150_FULL_FIELD_MODE_REG)); |
266 | |||
267 | dump_reg_range(c,"CC data", TVP5150_CC_DATA_INI, | ||
268 | TVP5150_CC_DATA_END,8); | ||
269 | |||
270 | dump_reg_range(c,"WSS data", TVP5150_WSS_DATA_INI, | ||
271 | TVP5150_WSS_DATA_END,8); | ||
272 | |||
273 | dump_reg_range(c,"VPS data", TVP5150_VPS_DATA_INI, | ||
274 | TVP5150_VPS_DATA_END,8); | ||
275 | |||
276 | dump_reg_range(c,"VITC data", TVP5150_VITC_DATA_INI, | ||
277 | TVP5150_VITC_DATA_END,10); | ||
278 | |||
279 | dump_reg_range(c,"Line mode", TVP5150_LINE_MODE_INI, | ||
280 | TVP5150_LINE_MODE_END,8); | ||
432 | } | 281 | } |
433 | 282 | ||
434 | /**************************************************************************** | 283 | /**************************************************************************** |
@@ -593,10 +442,10 @@ static const struct i2c_reg_value tvp5150_init_default[] = { | |||
593 | TVP5150_FIFO_OUT_CTRL,0x01 | 442 | TVP5150_FIFO_OUT_CTRL,0x01 |
594 | }, | 443 | }, |
595 | { /* 0xcf */ | 444 | { /* 0xcf */ |
596 | TVP5150_FULL_FIELD_ENA_1,0x00 | 445 | TVP5150_FULL_FIELD_ENA,0x00 |
597 | }, | 446 | }, |
598 | { /* 0xd0 */ | 447 | { /* 0xd0 */ |
599 | TVP5150_FULL_FIELD_ENA_2,0x00 | 448 | TVP5150_LINE_MODE_INI,0x00 |
600 | }, | 449 | }, |
601 | { /* 0xfc */ | 450 | { /* 0xfc */ |
602 | TVP5150_FULL_FIELD_MODE_REG,0x7f | 451 | TVP5150_FULL_FIELD_MODE_REG,0x7f |
@@ -629,54 +478,101 @@ static const struct i2c_reg_value tvp5150_init_enable[] = { | |||
629 | } | 478 | } |
630 | }; | 479 | }; |
631 | 480 | ||
481 | struct tvp5150_vbi_type { | ||
482 | unsigned int vbi_type; | ||
483 | unsigned int ini_line; | ||
484 | unsigned int end_line; | ||
485 | unsigned int by_field :1; | ||
486 | }; | ||
487 | |||
632 | struct i2c_vbi_ram_value { | 488 | struct i2c_vbi_ram_value { |
633 | u16 reg; | 489 | u16 reg; |
634 | unsigned char values[26]; | 490 | struct tvp5150_vbi_type type; |
491 | unsigned char values[16]; | ||
635 | }; | 492 | }; |
636 | 493 | ||
494 | /* This struct have the values for each supported VBI Standard | ||
495 | * by | ||
496 | tvp5150_vbi_types should follow the same order as vbi_ram_default | ||
497 | * value 0 means rom position 0x10, value 1 means rom position 0x30 | ||
498 | * and so on. There are 16 possible locations from 0 to 15. | ||
499 | */ | ||
500 | |||
637 | static struct i2c_vbi_ram_value vbi_ram_default[] = | 501 | static struct i2c_vbi_ram_value vbi_ram_default[] = |
638 | { | 502 | { |
639 | {0x010, /* WST SECAM 6 */ | 503 | {0x010, /* Teletext, SECAM, WST System A */ |
640 | { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x26, 0xe6, 0xb4, 0x0e, 0x0, 0x0, 0x0, 0x10, 0x0 } | 504 | {V4L2_SLICED_TELETEXT_SECAM,6,23,1}, |
505 | { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26, | ||
506 | 0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 } | ||
641 | }, | 507 | }, |
642 | {0x030, /* WST PAL B 6 */ | 508 | {0x030, /* Teletext, PAL, WST System B */ |
643 | { 0xaa, 0xaa, 0xff, 0xff , 0x27, 0x2e, 0x20, 0x2b, 0xa6, 0x72, 0x10, 0x0, 0x0, 0x0, 0x10, 0x0 } | 509 | {V4L2_SLICED_TELETEXT_PAL_B,6,22,1}, |
510 | { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b, | ||
511 | 0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 } | ||
644 | }, | 512 | }, |
645 | {0x050, /* WST PAL C 6 */ | 513 | {0x050, /* Teletext, PAL, WST System C */ |
646 | { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x22, 0xa6, 0x98, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 } | 514 | {V4L2_SLICED_TELETEXT_PAL_C,6,22,1}, |
515 | { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22, | ||
516 | 0xa6, 0x98, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 } | ||
647 | }, | 517 | }, |
648 | {0x070, /* WST NTSC 6 */ | 518 | {0x070, /* Teletext, NTSC, WST System B */ |
649 | { 0xaa, 0xaa, 0xff, 0xff , 0x27, 0x2e, 0x20, 0x23, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 } | 519 | {V4L2_SLICED_TELETEXT_NTSC_B,10,21,1}, |
520 | { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x23, | ||
521 | 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 } | ||
650 | }, | 522 | }, |
651 | {0x090, /* NABTS, NTSC 6 */ | 523 | {0x090, /* Tetetext, NTSC NABTS System C */ |
652 | { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x22, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x15, 0x0 } | 524 | {V4L2_SLICED_TELETEXT_NTSC_C,10,21,1}, |
525 | { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22, | ||
526 | 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x15, 0x00 } | ||
653 | }, | 527 | }, |
654 | {0x0b0, /* NABTS, NTSC-J 6 */ | 528 | {0x0b0, /* Teletext, NTSC-J, NABTS System D */ |
655 | { 0xaa, 0xaa, 0xff, 0xff , 0xa7, 0x2e, 0x20, 0x23, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 } | 529 | {V4L2_SLICED_TELETEXT_NTSC_D,10,21,1}, |
530 | { 0xaa, 0xaa, 0xff, 0xff, 0xa7, 0x2e, 0x20, 0x23, | ||
531 | 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 } | ||
656 | }, | 532 | }, |
657 | {0x0d0, /* CC, PAL/SECAM 6 */ | 533 | {0x0d0, /* Closed Caption, PAL/SECAM */ |
658 | { 0xaa, 0x2a, 0xff, 0x3f , 0x04, 0x51, 0x6e, 0x02, 0xa6, 0x7b, 0x09, 0x0, 0x0, 0x0, 0x27, 0x0 } | 534 | {V4L2_SLICED_CAPTION_625,22,22,1}, |
535 | { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02, | ||
536 | 0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 } | ||
659 | }, | 537 | }, |
660 | {0x0f0, /* CC, NTSC 6 */ | 538 | {0x0f0, /* Closed Caption, NTSC */ |
661 | { 0xaa, 0x2a, 0xff, 0x3f , 0x04, 0x51, 0x6e, 0x02, 0x69, 0x8c, 0x09, 0x0, 0x0, 0x0, 0x27, 0x0 } | 539 | {V4L2_SLICED_CAPTION_525,21,21,1}, |
540 | { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02, | ||
541 | 0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 } | ||
662 | }, | 542 | }, |
663 | {0x110, /* WSS, PAL/SECAM 6 */ | 543 | {0x110, /* Wide Screen Signal, PAL/SECAM */ |
664 | { 0x5b, 0x55, 0xc5, 0xff , 0x0, 0x71, 0x6e, 0x42, 0xa6, 0xcd, 0x0f, 0x0, 0x0, 0x0, 0x3a, 0x0 } | 544 | {V4L2_SLICED_WSS_625,23,23,1}, |
545 | { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42, | ||
546 | 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 } | ||
665 | }, | 547 | }, |
666 | {0x130, /* WSS, NTSC C */ | 548 | {0x130, /* Wide Screen Signal, NTSC C */ |
667 | { 0x38, 0x00, 0x3f, 0x00 , 0x0, 0x71, 0x6e, 0x43, 0x69, 0x7c, 0x08, 0x0, 0x0, 0x0, 0x39, 0x0 } | 549 | {V4L2_SLICED_WSS_525,20,20,1}, |
550 | { 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43, | ||
551 | 0x69, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00 } | ||
668 | }, | 552 | }, |
669 | {0x150, /* VITC, PAL/SECAM 6 */ | 553 | {0x150, /* Vertical Interval Timecode (VITC), PAL/SECAM */ |
670 | { 0x0, 0x0, 0x0, 0x0 , 0x0, 0x8f, 0x6d, 0x49, 0xa6, 0x85, 0x08, 0x0, 0x0, 0x0, 0x4c, 0x0 } | 554 | {V4l2_SLICED_VITC_625,6,22,0}, |
555 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49, | ||
556 | 0xa6, 0x85, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 } | ||
671 | }, | 557 | }, |
672 | {0x170, /* VITC, NTSC 6 */ | 558 | {0x170, /* Vertical Interval Timecode (VITC), NTSC */ |
673 | { 0x0, 0x0, 0x0, 0x0 , 0x0, 0x8f, 0x6d, 0x49, 0x69, 0x94, 0x08, 0x0, 0x0, 0x0, 0x4c, 0x0 } | 559 | {V4l2_SLICED_VITC_525,10,20,0}, |
560 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49, | ||
561 | 0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 } | ||
674 | }, | 562 | }, |
563 | {0x190, /* Video Program System (VPS), PAL */ | ||
564 | {V4L2_SLICED_VPS,16,16,0}, | ||
565 | { 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d, | ||
566 | 0xa6, 0xda, 0x0b, 0x00, 0x00, 0x00, 0x60, 0x00 } | ||
567 | }, | ||
568 | /* 0x1d0 User programmable */ | ||
569 | |||
570 | /* End of struct */ | ||
675 | { (u16)-1 } | 571 | { (u16)-1 } |
676 | }; | 572 | }; |
677 | 573 | ||
678 | static int tvp5150_write_inittab(struct i2c_client *c, | 574 | static int tvp5150_write_inittab(struct i2c_client *c, |
679 | const struct i2c_reg_value *regs) | 575 | const struct i2c_reg_value *regs) |
680 | { | 576 | { |
681 | while (regs->reg != 0xff) { | 577 | while (regs->reg != 0xff) { |
682 | tvp5150_write(c, regs->reg, regs->value); | 578 | tvp5150_write(c, regs->reg, regs->value); |
@@ -686,15 +582,15 @@ static int tvp5150_write_inittab(struct i2c_client *c, | |||
686 | } | 582 | } |
687 | 583 | ||
688 | static int tvp5150_vdp_init(struct i2c_client *c, | 584 | static int tvp5150_vdp_init(struct i2c_client *c, |
689 | const struct i2c_vbi_ram_value *regs) | 585 | const struct i2c_vbi_ram_value *regs) |
690 | { | 586 | { |
691 | unsigned int i; | 587 | unsigned int i; |
692 | 588 | ||
693 | /* Disable Full Field */ | 589 | /* Disable Full Field */ |
694 | tvp5150_write(c, TVP5150_FULL_FIELD_ENA_1, 0); | 590 | tvp5150_write(c, TVP5150_FULL_FIELD_ENA, 0); |
695 | 591 | ||
696 | /* Before programming, Line mode should be at 0xff */ | 592 | /* Before programming, Line mode should be at 0xff */ |
697 | for (i=TVP5150_FULL_FIELD_ENA_2; i<=TVP5150_LINE_MODE_REG_44; i++) | 593 | for (i=TVP5150_LINE_MODE_INI; i<=TVP5150_LINE_MODE_END; i++) |
698 | tvp5150_write(c, i, 0xff); | 594 | tvp5150_write(c, i, 0xff); |
699 | 595 | ||
700 | /* Load Ram Table */ | 596 | /* Load Ram Table */ |
@@ -710,6 +606,117 @@ static int tvp5150_vdp_init(struct i2c_client *c, | |||
710 | return 0; | 606 | return 0; |
711 | } | 607 | } |
712 | 608 | ||
609 | /* Fills VBI capabilities based on i2c_vbi_ram_value struct */ | ||
610 | static void tvp5150_vbi_get_cap(const struct i2c_vbi_ram_value *regs, | ||
611 | struct v4l2_sliced_vbi_cap *cap) | ||
612 | { | ||
613 | int line; | ||
614 | |||
615 | memset(cap, 0, sizeof *cap); | ||
616 | |||
617 | while (regs->reg != (u16)-1 ) { | ||
618 | for (line=regs->type.ini_line;line<=regs->type.end_line;line++) { | ||
619 | cap->service_lines[0][line] |= regs->type.vbi_type; | ||
620 | } | ||
621 | cap->service_set |= regs->type.vbi_type; | ||
622 | |||
623 | regs++; | ||
624 | } | ||
625 | } | ||
626 | |||
627 | /* Set vbi processing | ||
628 | * type - one of tvp5150_vbi_types | ||
629 | * line - line to gather data | ||
630 | * fields: bit 0 field1, bit 1, field2 | ||
631 | * flags (default=0xf0) is a bitmask, were set means: | ||
632 | * bit 7: enable filtering null bytes on CC | ||
633 | * bit 6: send data also to FIFO | ||
634 | * bit 5: don't allow data with errors on FIFO | ||
635 | * bit 4: enable ECC when possible | ||
636 | * pix_align = pix alignment: | ||
637 | * LSB = field1 | ||
638 | * MSB = field2 | ||
639 | */ | ||
640 | static int tvp5150_set_vbi(struct i2c_client *c, | ||
641 | const struct i2c_vbi_ram_value *regs, | ||
642 | unsigned int type,u8 flags, int line, | ||
643 | const int fields) | ||
644 | { | ||
645 | struct tvp5150 *decoder = i2c_get_clientdata(c); | ||
646 | v4l2_std_id std=decoder->norm; | ||
647 | u8 reg; | ||
648 | int pos=0; | ||
649 | |||
650 | if (std == V4L2_STD_ALL) { | ||
651 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); | ||
652 | return 0; | ||
653 | } else if (std && V4L2_STD_625_50) { | ||
654 | /* Don't follow NTSC Line number convension */ | ||
655 | line += 3; | ||
656 | } | ||
657 | |||
658 | if (line<6||line>27) | ||
659 | return 0; | ||
660 | |||
661 | while (regs->reg != (u16)-1 ) { | ||
662 | if ((type & regs->type.vbi_type) && | ||
663 | (line>=regs->type.ini_line) && | ||
664 | (line<=regs->type.end_line)) { | ||
665 | type=regs->type.vbi_type; | ||
666 | break; | ||
667 | } | ||
668 | |||
669 | regs++; | ||
670 | pos++; | ||
671 | } | ||
672 | if (regs->reg == (u16)-1) | ||
673 | return 0; | ||
674 | |||
675 | type=pos | (flags & 0xf0); | ||
676 | reg=((line-6)<<1)+TVP5150_LINE_MODE_INI; | ||
677 | |||
678 | if (fields&1) { | ||
679 | tvp5150_write(c, reg, type); | ||
680 | } | ||
681 | |||
682 | if (fields&2) { | ||
683 | tvp5150_write(c, reg+1, type); | ||
684 | } | ||
685 | |||
686 | return type; | ||
687 | } | ||
688 | |||
689 | static int tvp5150_get_vbi(struct i2c_client *c, | ||
690 | const struct i2c_vbi_ram_value *regs, int line) | ||
691 | { | ||
692 | struct tvp5150 *decoder = i2c_get_clientdata(c); | ||
693 | v4l2_std_id std=decoder->norm; | ||
694 | u8 reg; | ||
695 | int pos, type=0; | ||
696 | |||
697 | if (std == V4L2_STD_ALL) { | ||
698 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); | ||
699 | return 0; | ||
700 | } else if (std && V4L2_STD_625_50) { | ||
701 | /* Don't follow NTSC Line number convension */ | ||
702 | line += 3; | ||
703 | } | ||
704 | |||
705 | if (line<6||line>27) | ||
706 | return 0; | ||
707 | |||
708 | reg=((line-6)<<1)+TVP5150_LINE_MODE_INI; | ||
709 | |||
710 | pos=tvp5150_read(c, reg)&0x0f; | ||
711 | if (pos<0x0f) | ||
712 | type=regs[pos].type.vbi_type; | ||
713 | |||
714 | pos=tvp5150_read(c, reg+1)&0x0f; | ||
715 | if (pos<0x0f) | ||
716 | type|=regs[pos].type.vbi_type; | ||
717 | |||
718 | return type; | ||
719 | } | ||
713 | static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std) | 720 | static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std) |
714 | { | 721 | { |
715 | struct tvp5150 *decoder = i2c_get_clientdata(c); | 722 | struct tvp5150 *decoder = i2c_get_clientdata(c); |
@@ -854,6 +861,69 @@ static int tvp5150_command(struct i2c_client *c, | |||
854 | *(v4l2_std_id *)arg = decoder->norm; | 861 | *(v4l2_std_id *)arg = decoder->norm; |
855 | break; | 862 | break; |
856 | 863 | ||
864 | case VIDIOC_G_SLICED_VBI_CAP: | ||
865 | { | ||
866 | struct v4l2_sliced_vbi_cap *cap = arg; | ||
867 | tvp5150_dbg(1, "VIDIOC_G_SLICED_VBI_CAP\n"); | ||
868 | |||
869 | tvp5150_vbi_get_cap(vbi_ram_default, cap); | ||
870 | break; | ||
871 | } | ||
872 | case VIDIOC_S_FMT: | ||
873 | { | ||
874 | struct v4l2_format *fmt; | ||
875 | struct v4l2_sliced_vbi_format *svbi; | ||
876 | int i; | ||
877 | |||
878 | fmt = arg; | ||
879 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) | ||
880 | return -EINVAL; | ||
881 | svbi = &fmt->fmt.sliced; | ||
882 | if (svbi->service_set != 0) { | ||
883 | for (i = 0; i <= 23; i++) { | ||
884 | svbi->service_lines[1][i] = 0; | ||
885 | |||
886 | svbi->service_lines[0][i]=tvp5150_set_vbi(c, | ||
887 | vbi_ram_default, | ||
888 | svbi->service_lines[0][i],0xf0,i,3); | ||
889 | } | ||
890 | /* Enables FIFO */ | ||
891 | tvp5150_write(c, TVP5150_FIFO_OUT_CTRL,1); | ||
892 | } else { | ||
893 | /* Disables FIFO*/ | ||
894 | tvp5150_write(c, TVP5150_FIFO_OUT_CTRL,0); | ||
895 | |||
896 | /* Disable Full Field */ | ||
897 | tvp5150_write(c, TVP5150_FULL_FIELD_ENA, 0); | ||
898 | |||
899 | /* Disable Line modes */ | ||
900 | for (i=TVP5150_LINE_MODE_INI; i<=TVP5150_LINE_MODE_END; i++) | ||
901 | tvp5150_write(c, i, 0xff); | ||
902 | } | ||
903 | break; | ||
904 | } | ||
905 | case VIDIOC_G_FMT: | ||
906 | { | ||
907 | struct v4l2_format *fmt; | ||
908 | struct v4l2_sliced_vbi_format *svbi; | ||
909 | |||
910 | int i, mask=0; | ||
911 | |||
912 | fmt = arg; | ||
913 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) | ||
914 | return -EINVAL; | ||
915 | svbi = &fmt->fmt.sliced; | ||
916 | memset(svbi, 0, sizeof(*svbi)); | ||
917 | |||
918 | for (i = 0; i <= 23; i++) { | ||
919 | svbi->service_lines[0][i]=tvp5150_get_vbi(c, | ||
920 | vbi_ram_default,i); | ||
921 | mask|=svbi->service_lines[0][i]; | ||
922 | } | ||
923 | svbi->service_set=mask; | ||
924 | break; | ||
925 | } | ||
926 | |||
857 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 927 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
858 | case VIDIOC_INT_G_REGISTER: | 928 | case VIDIOC_INT_G_REGISTER: |
859 | { | 929 | { |
@@ -878,6 +948,7 @@ static int tvp5150_command(struct i2c_client *c, | |||
878 | } | 948 | } |
879 | #endif | 949 | #endif |
880 | 950 | ||
951 | case VIDIOC_LOG_STATUS: | ||
881 | case DECODER_DUMP: | 952 | case DECODER_DUMP: |
882 | dump_reg(c); | 953 | dump_reg(c); |
883 | break; | 954 | break; |
@@ -1097,7 +1168,7 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter, | |||
1097 | 1168 | ||
1098 | rv = i2c_attach_client(c); | 1169 | rv = i2c_attach_client(c); |
1099 | 1170 | ||
1100 | core->norm = V4L2_STD_ALL; | 1171 | core->norm = V4L2_STD_ALL; /* Default is autodetect */ |
1101 | core->input = 2; | 1172 | core->input = 2; |
1102 | core->enable = 1; | 1173 | core->enable = 1; |
1103 | core->bright = 32768; | 1174 | core->bright = 32768; |