diff options
Diffstat (limited to 'drivers/media/video/saa7134/saa6752hs.c')
-rw-r--r-- | drivers/media/video/saa7134/saa6752hs.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index dac720ea3b06..2bf5cf79eec1 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -169,31 +169,31 @@ static int saa6752hs_chip_command(struct i2c_client* client, | |||
169 | 169 | ||
170 | /* execute the command */ | 170 | /* execute the command */ |
171 | switch(command) { | 171 | switch(command) { |
172 | case SAA6752HS_COMMAND_RESET: | 172 | case SAA6752HS_COMMAND_RESET: |
173 | buf[0] = 0x00; | 173 | buf[0] = 0x00; |
174 | break; | 174 | break; |
175 | 175 | ||
176 | case SAA6752HS_COMMAND_STOP: | 176 | case SAA6752HS_COMMAND_STOP: |
177 | buf[0] = 0x03; | 177 | buf[0] = 0x03; |
178 | break; | 178 | break; |
179 | 179 | ||
180 | case SAA6752HS_COMMAND_START: | 180 | case SAA6752HS_COMMAND_START: |
181 | buf[0] = 0x02; | 181 | buf[0] = 0x02; |
182 | break; | 182 | break; |
183 | 183 | ||
184 | case SAA6752HS_COMMAND_PAUSE: | 184 | case SAA6752HS_COMMAND_PAUSE: |
185 | buf[0] = 0x04; | 185 | buf[0] = 0x04; |
186 | break; | 186 | break; |
187 | 187 | ||
188 | case SAA6752HS_COMMAND_RECONFIGURE: | 188 | case SAA6752HS_COMMAND_RECONFIGURE: |
189 | buf[0] = 0x05; | 189 | buf[0] = 0x05; |
190 | break; | 190 | break; |
191 | 191 | ||
192 | case SAA6752HS_COMMAND_SLEEP: | 192 | case SAA6752HS_COMMAND_SLEEP: |
193 | buf[0] = 0x06; | 193 | buf[0] = 0x06; |
194 | break; | 194 | break; |
195 | 195 | ||
196 | case SAA6752HS_COMMAND_RECONFIGURE_FORCE: | 196 | case SAA6752HS_COMMAND_RECONFIGURE_FORCE: |
197 | buf[0] = 0x07; | 197 | buf[0] = 0x07; |
198 | break; | 198 | break; |
199 | 199 | ||
@@ -201,13 +201,13 @@ static int saa6752hs_chip_command(struct i2c_client* client, | |||
201 | return -EINVAL; | 201 | return -EINVAL; |
202 | } | 202 | } |
203 | 203 | ||
204 | /* set it and wait for it to be so */ | 204 | /* set it and wait for it to be so */ |
205 | i2c_master_send(client, buf, 1); | 205 | i2c_master_send(client, buf, 1); |
206 | timeout = jiffies + HZ * 3; | 206 | timeout = jiffies + HZ * 3; |
207 | for (;;) { | 207 | for (;;) { |
208 | /* get the current status */ | 208 | /* get the current status */ |
209 | buf[0] = 0x10; | 209 | buf[0] = 0x10; |
210 | i2c_master_send(client, buf, 1); | 210 | i2c_master_send(client, buf, 1); |
211 | i2c_master_recv(client, buf, 1); | 211 | i2c_master_recv(client, buf, 1); |
212 | 212 | ||
213 | if (!(buf[0] & 0x20)) | 213 | if (!(buf[0] & 0x20)) |
@@ -223,14 +223,14 @@ static int saa6752hs_chip_command(struct i2c_client* client, | |||
223 | /* delay a bit to let encoder settle */ | 223 | /* delay a bit to let encoder settle */ |
224 | msleep(50); | 224 | msleep(50); |
225 | 225 | ||
226 | return status; | 226 | return status; |
227 | } | 227 | } |
228 | 228 | ||
229 | 229 | ||
230 | static int saa6752hs_set_bitrate(struct i2c_client* client, | 230 | static int saa6752hs_set_bitrate(struct i2c_client* client, |
231 | struct v4l2_mpeg_compression* params) | 231 | struct v4l2_mpeg_compression* params) |
232 | { | 232 | { |
233 | u8 buf[3]; | 233 | u8 buf[3]; |
234 | 234 | ||
235 | /* set the bitrate mode */ | 235 | /* set the bitrate mode */ |
236 | buf[0] = 0x71; | 236 | buf[0] = 0x71; |
@@ -242,31 +242,31 @@ static int saa6752hs_set_bitrate(struct i2c_client* client, | |||
242 | /* set the target bitrate */ | 242 | /* set the target bitrate */ |
243 | buf[0] = 0x80; | 243 | buf[0] = 0x80; |
244 | buf[1] = params->vi_bitrate.target >> 8; | 244 | buf[1] = params->vi_bitrate.target >> 8; |
245 | buf[2] = params->vi_bitrate.target & 0xff; | 245 | buf[2] = params->vi_bitrate.target & 0xff; |
246 | i2c_master_send(client, buf, 3); | 246 | i2c_master_send(client, buf, 3); |
247 | 247 | ||
248 | /* set the max bitrate */ | 248 | /* set the max bitrate */ |
249 | buf[0] = 0x81; | 249 | buf[0] = 0x81; |
250 | buf[1] = params->vi_bitrate.max >> 8; | 250 | buf[1] = params->vi_bitrate.max >> 8; |
251 | buf[2] = params->vi_bitrate.max & 0xff; | 251 | buf[2] = params->vi_bitrate.max & 0xff; |
252 | i2c_master_send(client, buf, 3); | 252 | i2c_master_send(client, buf, 3); |
253 | } else { | 253 | } else { |
254 | /* set the target bitrate (no max bitrate for CBR) */ | 254 | /* set the target bitrate (no max bitrate for CBR) */ |
255 | buf[0] = 0x81; | 255 | buf[0] = 0x81; |
256 | buf[1] = params->vi_bitrate.target >> 8; | 256 | buf[1] = params->vi_bitrate.target >> 8; |
257 | buf[2] = params->vi_bitrate.target & 0xff; | 257 | buf[2] = params->vi_bitrate.target & 0xff; |
258 | i2c_master_send(client, buf, 3); | 258 | i2c_master_send(client, buf, 3); |
259 | } | 259 | } |
260 | 260 | ||
261 | /* set the audio bitrate */ | 261 | /* set the audio bitrate */ |
262 | buf[0] = 0x94; | 262 | buf[0] = 0x94; |
263 | buf[1] = (256 == params->au_bitrate.target) ? 0 : 1; | 263 | buf[1] = (256 == params->au_bitrate.target) ? 0 : 1; |
264 | i2c_master_send(client, buf, 2); | 264 | i2c_master_send(client, buf, 2); |
265 | 265 | ||
266 | /* set the total bitrate */ | 266 | /* set the total bitrate */ |
267 | buf[0] = 0xb1; | 267 | buf[0] = 0xb1; |
268 | buf[1] = params->st_bitrate.target >> 8; | 268 | buf[1] = params->st_bitrate.target >> 8; |
269 | buf[2] = params->st_bitrate.target & 0xff; | 269 | buf[2] = params->st_bitrate.target & 0xff; |
270 | i2c_master_send(client, buf, 3); | 270 | i2c_master_send(client, buf, 3); |
271 | 271 | ||
272 | return 0; | 272 | return 0; |
@@ -386,8 +386,8 @@ static int saa6752hs_init(struct i2c_client* client) | |||
386 | buf[1] = 0x01; | 386 | buf[1] = 0x01; |
387 | i2c_master_send(client, buf, 2); | 387 | i2c_master_send(client, buf, 2); |
388 | 388 | ||
389 | /* set bitrate */ | 389 | /* set bitrate */ |
390 | saa6752hs_set_bitrate(client, &h->params); | 390 | saa6752hs_set_bitrate(client, &h->params); |
391 | 391 | ||
392 | /* Set GOP structure {3, 13} */ | 392 | /* Set GOP structure {3, 13} */ |
393 | buf[0] = 0x72; | 393 | buf[0] = 0x72; |
@@ -426,9 +426,9 @@ static int saa6752hs_init(struct i2c_client* client) | |||
426 | localPAT[sizeof(PAT) - 1] = crc & 0xFF; | 426 | localPAT[sizeof(PAT) - 1] = crc & 0xFF; |
427 | 427 | ||
428 | /* compute PMT */ | 428 | /* compute PMT */ |
429 | memcpy(localPMT, PMT, sizeof(PMT)); | 429 | memcpy(localPMT, PMT, sizeof(PMT)); |
430 | localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f); | 430 | localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f); |
431 | localPMT[4] = h->params.ts_pid_pmt & 0xff; | 431 | localPMT[4] = h->params.ts_pid_pmt & 0xff; |
432 | localPMT[15] = 0xE0 | ((h->params.ts_pid_pcr >> 8) & 0x0F); | 432 | localPMT[15] = 0xE0 | ((h->params.ts_pid_pcr >> 8) & 0x0F); |
433 | localPMT[16] = h->params.ts_pid_pcr & 0xFF; | 433 | localPMT[16] = h->params.ts_pid_pcr & 0xFF; |
434 | localPMT[20] = 0xE0 | ((h->params.ts_pid_video >> 8) & 0x0F); | 434 | localPMT[20] = 0xE0 | ((h->params.ts_pid_video >> 8) & 0x0F); |
@@ -453,7 +453,7 @@ static int saa6752hs_init(struct i2c_client* client) | |||
453 | buf[2] = h->params.ts_pid_video & 0xFF; | 453 | buf[2] = h->params.ts_pid_video & 0xFF; |
454 | i2c_master_send(client,buf,3); | 454 | i2c_master_send(client,buf,3); |
455 | 455 | ||
456 | /* Set PCR PID */ | 456 | /* Set PCR PID */ |
457 | buf[0] = 0xC4; | 457 | buf[0] = 0xC4; |
458 | buf[1] = (h->params.ts_pid_pcr >> 8) & 0xFF; | 458 | buf[1] = (h->params.ts_pid_pcr >> 8) & 0xFF; |
459 | buf[2] = h->params.ts_pid_pcr & 0xFF; | 459 | buf[2] = h->params.ts_pid_pcr & 0xFF; |
@@ -467,7 +467,7 @@ static int saa6752hs_init(struct i2c_client* client) | |||
467 | buf[0] = 0xa4; | 467 | buf[0] = 0xa4; |
468 | buf[1] = 1; | 468 | buf[1] = 1; |
469 | i2c_master_send(client, buf, 2); | 469 | i2c_master_send(client, buf, 2); |
470 | buf[1] = 0; | 470 | buf[1] = 0; |
471 | i2c_master_send(client, buf, 2); | 471 | i2c_master_send(client, buf, 2); |
472 | 472 | ||
473 | /* start it going */ | 473 | /* start it going */ |
@@ -510,10 +510,10 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) | |||
510 | { | 510 | { |
511 | struct saa6752hs_state *h; | 511 | struct saa6752hs_state *h; |
512 | 512 | ||
513 | printk("saa6752hs: chip found @ 0x%x\n", addr<<1); | 513 | printk("saa6752hs: chip found @ 0x%x\n", addr<<1); |
514 | 514 | ||
515 | if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL))) | 515 | if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL))) |
516 | return -ENOMEM; | 516 | return -ENOMEM; |
517 | memset(h,0,sizeof(*h)); | 517 | memset(h,0,sizeof(*h)); |
518 | h->client = client_template; | 518 | h->client = client_template; |
519 | h->params = param_defaults; | 519 | h->params = param_defaults; |
@@ -552,7 +552,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
552 | struct v4l2_mpeg_compression *params = arg; | 552 | struct v4l2_mpeg_compression *params = arg; |
553 | int err = 0; | 553 | int err = 0; |
554 | 554 | ||
555 | switch (cmd) { | 555 | switch (cmd) { |
556 | case VIDIOC_S_MPEGCOMP: | 556 | case VIDIOC_S_MPEGCOMP: |
557 | if (NULL == params) { | 557 | if (NULL == params) { |
558 | /* apply settings and start encoder */ | 558 | /* apply settings and start encoder */ |
@@ -566,7 +566,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
566 | break; | 566 | break; |
567 | case VIDIOC_G_FMT: | 567 | case VIDIOC_G_FMT: |
568 | { | 568 | { |
569 | struct v4l2_format *f = arg; | 569 | struct v4l2_format *f = arg; |
570 | 570 | ||
571 | if (h->video_format == SAA6752HS_VF_UNKNOWN) | 571 | if (h->video_format == SAA6752HS_VF_UNKNOWN) |
572 | h->video_format = SAA6752HS_VF_D1; | 572 | h->video_format = SAA6752HS_VF_D1; |