aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-06-23 15:13:56 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:05:24 -0400
commitb57e5578f913a304e97cb66aa0044a894ca47f2f (patch)
tree2f0210661e2f42e10e121311092b6cd1c948914a /drivers/media
parent45f87a21735804760dd7db0e2e3c609c332b15e3 (diff)
Fixes some sync issues between V4L/DVB development and GIT
Some changes didn't went ok to -git, probably due to changes at merging patches. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/bt8xx/dst_ca.c205
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c36
2 files changed, 31 insertions, 210 deletions
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c
index 6b2437501caf..fa923b9b346e 100644
--- a/drivers/media/dvb/bt8xx/dst_ca.c
+++ b/drivers/media/dvb/bt8xx/dst_ca.c
@@ -308,100 +308,6 @@ static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_s
308 return 0; 308 return 0;
309} 309}
310 310
311/* MMI */
312static int ca_get_mmi(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *mmi_msg)
313{
314 static u8 get_mmi[] = { 0x07, 0x40, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x0f };
315
316 put_checksum(&get_mmi[0], 7);
317 if ((dst_put_ci(state, get_mmi, sizeof (get_mmi), hw_msg->msg, GET_REPLY)) < 0) {
318 dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
319 return -1;
320 }
321 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
322 memcpy(mmi_msg->msg, hw_msg->msg, hw_msg->msg[4]);
323
324 return 0;
325}
326
327/**
328 * Get Menu should be the first MMI function (like open !)
329 */
330static int ca_get_menu(struct dst_state *state)
331{
332 static u8 get_menu[] = { 0x07, 0x40, 0x00, 0x00, 0x09, 0x00, 0x00, 0xff };
333
334 put_checksum(&get_menu[0], 7);
335 if ((dst_put_ci(state, get_menu, sizeof (get_menu), get_menu, NO_REPLY)) < 0) {
336 dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
337 return -1;
338 }
339 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
340
341 return 0;
342}
343
344/**
345 * MMI Enq (Enquire the application to allow user input)
346 */
347static int ca_answer_menu(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *menu_answ)
348{
349 u8 choice = 0;
350
351 static u8 answer_menu[] = { 0x08, 0x40, 0x00, 0x00, 0x0b, 0x01, 0x00, 0x01, 0xff };
352
353 /* derive answer from menu (This comes from the user) */
354 answer_menu[7] = choice;
355 put_checksum(&answer_menu[0], 7);
356 if ((dst_put_ci(state, answer_menu, sizeof (answer_menu), hw_msg->msg, NO_REPLY)) < 0) {
357 dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
358 return -1;
359 }
360 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
361
362 return 0;
363}
364
365static int ca_answer_mmi(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *answ_msg)
366{
367 u8 answer =0, length = 0;
368
369 static u8 answer_mmi[] = { 0x08, 0x40, 0x00, 0x00, 0x08, 0x01, 0x00, 0x01, 0xff };
370
371 /* derive answer from answ_msg (This comes from the user) */
372 if (answer == 0) /* 0x00 == Cancel */
373 answer_mmi[7] = 0x00;
374 else { /* 0x01 == Answer */
375 length = strlen(answ_msg->msg);
376 memcpy(&answer_mmi[8], answ_msg->msg, length);
377 answer_mmi[0] += length;
378 answer_mmi[5] += length;
379 }
380 put_checksum(&answer_mmi[0], (8 + length));
381 if ((dst_put_ci(state, answer_mmi, sizeof (answer_mmi), hw_msg->msg, GET_REPLY)) < 0) {
382 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci FAILED !");
383
384 return -1;
385 }
386 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
387
388 return 0;
389}
390
391static int ca_close_mmi(struct dst_state *state, struct ca_msg *hw_msg)
392{
393 static u8 close_mmi[] = { 0x07, 0x40, 0x00, 0x00, 0x0e, 0x00, 0x00, 0xff };
394
395 put_checksum(&close_mmi[0], 7);
396 if ((dst_put_ci(state, close_mmi, sizeof (close_mmi), hw_msg->msg, NO_REPLY)) < 0) {
397 dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
398
399 return -1;
400 }
401 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
402
403 return 0;
404}
405 311
406static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg) 312static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg)
407{ 313{
@@ -512,100 +418,6 @@ static int debug_string(u8 *msg, u32 length, u32 offset)
512 return 0; 418 return 0;
513} 419}
514 420
515/* MMI */
516static int ca_get_mmi(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *mmi_msg)
517{
518 static u8 get_mmi[] = { 0x07, 0x40, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x0f };
519
520 put_checksum(&get_mmi[0], 7);
521 if ((dst_put_ci(state, get_mmi, sizeof (get_mmi), hw_msg->msg, GET_REPLY)) < 0) {
522 dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
523 return -1;
524 }
525 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
526 memcpy(mmi_msg->msg, hw_msg->msg, hw_msg->msg[4]);
527
528 return 0;
529}
530
531/**
532 * Get Menu should be the first MMI function (like open !)
533 */
534static int ca_get_menu(struct dst_state *state)
535{
536 static u8 get_menu[] = { 0x07, 0x40, 0x00, 0x00, 0x09, 0x00, 0x00, 0xff };
537
538 put_checksum(&get_menu[0], 7);
539 if ((dst_put_ci(state, get_menu, sizeof (get_menu), get_menu, NO_REPLY)) < 0) {
540 dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
541 return -1;
542 }
543 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
544
545 return 0;
546}
547
548/**
549 * MMI Enq (Enquire the application to allow user input)
550 */
551static int ca_answer_menu(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *menu_answ)
552{
553 u8 choice = 0;
554
555 static u8 answer_menu[] = { 0x08, 0x40, 0x00, 0x00, 0x0b, 0x01, 0x00, 0x01, 0xff };
556
557 /* derive answer from menu (This comes from the user) */
558 answer_menu[7] = choice;
559 put_checksum(&answer_menu[0], 7);
560 if ((dst_put_ci(state, answer_menu, sizeof (answer_menu), hw_msg->msg, NO_REPLY)) < 0) {
561 dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
562 return -1;
563 }
564 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
565
566 return 0;
567}
568
569static int ca_answer_mmi(struct dst_state *state, struct ca_msg *hw_msg, struct ca_msg *answ_msg)
570{
571 u8 answer =0, length = 0;
572
573 static u8 answer_mmi[] = { 0x08, 0x40, 0x00, 0x00, 0x08, 0x01, 0x00, 0x01, 0xff };
574
575 /* derive answer from answ_msg (This comes from the user) */
576 if (answer == 0) /* 0x00 == Cancel */
577 answer_mmi[7] = 0x00;
578 else { /* 0x01 == Answer */
579 length = strlen(answ_msg->msg);
580 memcpy(&answer_mmi[8], answ_msg->msg, length);
581 answer_mmi[0] += length;
582 answer_mmi[5] += length;
583 }
584 put_checksum(&answer_mmi[0], (8 + length));
585 if ((dst_put_ci(state, answer_mmi, sizeof (answer_mmi), hw_msg->msg, GET_REPLY)) < 0) {
586 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci FAILED !");
587
588 return -1;
589 }
590 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
591
592 return 0;
593}
594
595static int ca_close_mmi(struct dst_state *state, struct ca_msg *hw_msg)
596{
597 static u8 close_mmi[] = { 0x07, 0x40, 0x00, 0x00, 0x0e, 0x00, 0x00, 0xff };
598
599 put_checksum(&close_mmi[0], 7);
600 if ((dst_put_ci(state, close_mmi, sizeof (close_mmi), hw_msg->msg, NO_REPLY)) < 0) {
601 dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
602
603 return -1;
604 }
605 dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
606
607 return 0;
608}
609 421
610static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) 422static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query)
611{ 423{
@@ -750,18 +562,15 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd
750 void __user *arg = (void __user *)ioctl_arg; 562 void __user *arg = (void __user *)ioctl_arg;
751 int result = 0; 563 int result = 0;
752 564
753 if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { 565 p_ca_message = kmalloc(sizeof (struct ca_msg), GFP_KERNEL);
754 dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); 566 p_ca_slot_info = kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL);
755 return -ENOMEM; 567 p_ca_caps = kmalloc(sizeof (struct ca_caps), GFP_KERNEL);
756 } 568 if (!p_ca_message || !p_ca_slot_info || !p_ca_caps) {
757 if ((p_ca_slot_info = (struct ca_slot_info *) kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL)) == NULL) {
758 dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); 569 dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure");
759 return -ENOMEM; 570 result = -ENOMEM;
760 } 571 goto free_mem_and_exit;
761 if ((p_ca_caps = (struct ca_caps *) kmalloc(sizeof (struct ca_caps), GFP_KERNEL)) == NULL) {
762 dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure");
763 return -ENOMEM;
764 } 572 }
573
765 /* We have now only the standard ioctl's, the driver is upposed to handle internals. */ 574 /* We have now only the standard ioctl's, the driver is upposed to handle internals. */
766 switch (cmd) { 575 switch (cmd) {
767 case CA_SEND_MSG: 576 case CA_SEND_MSG:
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index e8c65ddd0181..de7b9e6e932a 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -261,45 +261,57 @@ static int saa6752hs_chip_command(struct i2c_client* client,
261 261
262 262
263static int saa6752hs_set_bitrate(struct i2c_client* client, 263static int saa6752hs_set_bitrate(struct i2c_client* client,
264 struct v4l2_mpeg_compression* params) 264 struct saa6752hs_mpeg_params* params)
265{ 265{
266 u8 buf[3]; 266 u8 buf[3];
267 int tot_bitrate;
267 268
268 /* set the bitrate mode */ 269 /* set the bitrate mode */
269 buf[0] = 0x71; 270 buf[0] = 0x71;
270 buf[1] = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? 0 : 1; 271 buf[1] = (params->vi_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) ? 0 : 1;
271 i2c_master_send(client, buf, 2); 272 i2c_master_send(client, buf, 2);
272 273
273 /* set the video bitrate */ 274 /* set the video bitrate */
274 if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) { 275 if (params->vi_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) {
275 /* set the target bitrate */ 276 /* set the target bitrate */
276 buf[0] = 0x80; 277 buf[0] = 0x80;
277 buf[1] = params->vi_bitrate.target >> 8; 278 buf[1] = params->vi_bitrate >> 8;
278 buf[2] = params->vi_bitrate.target & 0xff; 279 buf[2] = params->vi_bitrate & 0xff;
279 i2c_master_send(client, buf, 3); 280 i2c_master_send(client, buf, 3);
280 281
281 /* set the max bitrate */ 282 /* set the max bitrate */
282 buf[0] = 0x81; 283 buf[0] = 0x81;
283 buf[1] = params->vi_bitrate.max >> 8; 284 buf[1] = params->vi_bitrate_peak >> 8;
284 buf[2] = params->vi_bitrate.max & 0xff; 285 buf[2] = params->vi_bitrate_peak & 0xff;
285 i2c_master_send(client, buf, 3); 286 i2c_master_send(client, buf, 3);
287 tot_bitrate = params->vi_bitrate_peak;
286 } else { 288 } else {
287 /* set the target bitrate (no max bitrate for CBR) */ 289 /* set the target bitrate (no max bitrate for CBR) */
288 buf[0] = 0x81; 290 buf[0] = 0x81;
289 buf[1] = params->vi_bitrate.target >> 8; 291 buf[1] = params->vi_bitrate >> 8;
290 buf[2] = params->vi_bitrate.target & 0xff; 292 buf[2] = params->vi_bitrate & 0xff;
291 i2c_master_send(client, buf, 3); 293 i2c_master_send(client, buf, 3);
294 tot_bitrate = params->vi_bitrate;
292 } 295 }
293 296
294 /* set the audio bitrate */ 297 /* set the audio bitrate */
295 buf[0] = 0x94; 298 buf[0] = 0x94;
296 buf[1] = (256 == params->au_bitrate.target) ? 0 : 1; 299 buf[1] = (V4L2_MPEG_AUDIO_L2_BITRATE_256K == params->au_l2_bitrate) ? 0 : 1;
297 i2c_master_send(client, buf, 2); 300 i2c_master_send(client, buf, 2);
301 tot_bitrate += (V4L2_MPEG_AUDIO_L2_BITRATE_256K == params->au_l2_bitrate) ? 256 : 384;
302
303 /* Note: the total max bitrate is determined by adding the video and audio
304 bitrates together and also adding an extra 768kbit/s to stay on the
305 safe side. If more control should be required, then an extra MPEG control
306 should be added. */
307 tot_bitrate += 768;
308 if (tot_bitrate > MPEG_TOTAL_TARGET_BITRATE_MAX)
309 tot_bitrate = MPEG_TOTAL_TARGET_BITRATE_MAX;
298 310
299 /* set the total bitrate */ 311 /* set the total bitrate */
300 buf[0] = 0xb1; 312 buf[0] = 0xb1;
301 buf[1] = params->st_bitrate.target >> 8; 313 buf[1] = tot_bitrate >> 8;
302 buf[2] = params->st_bitrate.target & 0xff; 314 buf[2] = tot_bitrate & 0xff;
303 i2c_master_send(client, buf, 3); 315 i2c_master_send(client, buf, 3);
304 316
305 return 0; 317 return 0;