diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-02-18 17:18:26 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:10 -0400 |
commit | 48f4dacb6759d6357036e2a37434bf8bade119c9 (patch) | |
tree | 9c678f235e5ab61775896efb47f61b2f9b089468 /drivers/media/video/vino.c | |
parent | 289596382e6aca005ca53ef20bbc44b9886cb0e0 (diff) |
V4L/DVB (10865): vino: convert to v4l2_subdev.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/vino.c')
-rw-r--r-- | drivers/media/video/vino.c | 207 |
1 files changed, 67 insertions, 140 deletions
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 308fa419ae04..96ce68a3dd95 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -287,20 +287,17 @@ struct vino_channel_settings { | |||
287 | struct video_device *vdev; | 287 | struct video_device *vdev; |
288 | }; | 288 | }; |
289 | 289 | ||
290 | struct vino_client { | ||
291 | /* the channel which owns this client: | ||
292 | * VINO_NO_CHANNEL, VINO_CHANNEL_A or VINO_CHANNEL_B */ | ||
293 | unsigned int owner; | ||
294 | struct i2c_client *driver; | ||
295 | }; | ||
296 | |||
297 | struct vino_settings { | 290 | struct vino_settings { |
298 | struct v4l2_device v4l2_dev; | 291 | struct v4l2_device v4l2_dev; |
299 | struct vino_channel_settings a; | 292 | struct vino_channel_settings a; |
300 | struct vino_channel_settings b; | 293 | struct vino_channel_settings b; |
301 | 294 | ||
302 | struct vino_client decoder; | 295 | /* the channel which owns this client: |
303 | struct vino_client camera; | 296 | * VINO_NO_CHANNEL, VINO_CHANNEL_A or VINO_CHANNEL_B */ |
297 | unsigned int decoder_owner; | ||
298 | struct v4l2_subdev *decoder; | ||
299 | unsigned int camera_owner; | ||
300 | struct v4l2_subdev *camera; | ||
304 | 301 | ||
305 | /* a lock for vino register access */ | 302 | /* a lock for vino register access */ |
306 | spinlock_t vino_lock; | 303 | spinlock_t vino_lock; |
@@ -340,6 +337,11 @@ static struct sgi_vino *vino; | |||
340 | 337 | ||
341 | static struct vino_settings *vino_drvdata; | 338 | static struct vino_settings *vino_drvdata; |
342 | 339 | ||
340 | #define camera_call(o, f, args...) \ | ||
341 | v4l2_subdev_call(vino_drvdata->camera, o, f, ##args) | ||
342 | #define decoder_call(o, f, args...) \ | ||
343 | v4l2_subdev_call(vino_drvdata->decoder, o, f, ##args) | ||
344 | |||
343 | static const char *vino_driver_name = "vino"; | 345 | static const char *vino_driver_name = "vino"; |
344 | static const char *vino_driver_description = "SGI VINO"; | 346 | static const char *vino_driver_description = "SGI VINO"; |
345 | static const char *vino_bus_name = "GIO64 bus"; | 347 | static const char *vino_bus_name = "GIO64 bus"; |
@@ -670,66 +672,12 @@ static struct i2c_algo_sgi_data i2c_sgi_vino_data = | |||
670 | .ack_timeout = 1000, | 672 | .ack_timeout = 1000, |
671 | }; | 673 | }; |
672 | 674 | ||
673 | /* | ||
674 | * There are two possible clients on VINO I2C bus, so we limit usage only | ||
675 | * to them. | ||
676 | */ | ||
677 | static int i2c_vino_client_reg(struct i2c_client *client) | ||
678 | { | ||
679 | unsigned long flags; | ||
680 | int ret = 0; | ||
681 | |||
682 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); | ||
683 | switch (client->driver->id) { | ||
684 | case I2C_DRIVERID_SAA7191: | ||
685 | if (vino_drvdata->decoder.driver) | ||
686 | ret = -EBUSY; | ||
687 | else | ||
688 | vino_drvdata->decoder.driver = client; | ||
689 | break; | ||
690 | case I2C_DRIVERID_INDYCAM: | ||
691 | if (vino_drvdata->camera.driver) | ||
692 | ret = -EBUSY; | ||
693 | else | ||
694 | vino_drvdata->camera.driver = client; | ||
695 | break; | ||
696 | default: | ||
697 | ret = -ENODEV; | ||
698 | } | ||
699 | spin_unlock_irqrestore(&vino_drvdata->input_lock, flags); | ||
700 | |||
701 | return ret; | ||
702 | } | ||
703 | |||
704 | static int i2c_vino_client_unreg(struct i2c_client *client) | ||
705 | { | ||
706 | unsigned long flags; | ||
707 | int ret = 0; | ||
708 | |||
709 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); | ||
710 | if (client == vino_drvdata->decoder.driver) { | ||
711 | if (vino_drvdata->decoder.owner != VINO_NO_CHANNEL) | ||
712 | ret = -EBUSY; | ||
713 | else | ||
714 | vino_drvdata->decoder.driver = NULL; | ||
715 | } else if (client == vino_drvdata->camera.driver) { | ||
716 | if (vino_drvdata->camera.owner != VINO_NO_CHANNEL) | ||
717 | ret = -EBUSY; | ||
718 | else | ||
719 | vino_drvdata->camera.driver = NULL; | ||
720 | } | ||
721 | spin_unlock_irqrestore(&vino_drvdata->input_lock, flags); | ||
722 | |||
723 | return ret; | ||
724 | } | ||
725 | |||
726 | static struct i2c_adapter vino_i2c_adapter = | 675 | static struct i2c_adapter vino_i2c_adapter = |
727 | { | 676 | { |
728 | .name = "VINO I2C bus", | 677 | .name = "VINO I2C bus", |
729 | .id = I2C_HW_SGI_VINO, | 678 | .id = I2C_HW_SGI_VINO, |
730 | .algo_data = &i2c_sgi_vino_data, | 679 | .algo_data = &i2c_sgi_vino_data, |
731 | .client_register = &i2c_vino_client_reg, | 680 | .owner = THIS_MODULE, |
732 | .client_unregister = &i2c_vino_client_unreg, | ||
733 | }; | 681 | }; |
734 | 682 | ||
735 | static int vino_i2c_add_bus(void) | 683 | static int vino_i2c_add_bus(void) |
@@ -742,20 +690,6 @@ static int vino_i2c_del_bus(void) | |||
742 | return i2c_del_adapter(&vino_i2c_adapter); | 690 | return i2c_del_adapter(&vino_i2c_adapter); |
743 | } | 691 | } |
744 | 692 | ||
745 | static int i2c_camera_command(unsigned int cmd, void *arg) | ||
746 | { | ||
747 | return vino_drvdata->camera.driver-> | ||
748 | driver->command(vino_drvdata->camera.driver, | ||
749 | cmd, arg); | ||
750 | } | ||
751 | |||
752 | static int i2c_decoder_command(unsigned int cmd, void *arg) | ||
753 | { | ||
754 | return vino_drvdata->decoder.driver-> | ||
755 | driver->command(vino_drvdata->decoder.driver, | ||
756 | cmd, arg); | ||
757 | } | ||
758 | |||
759 | /* VINO framebuffer/DMA descriptor management */ | 693 | /* VINO framebuffer/DMA descriptor management */ |
760 | 694 | ||
761 | static void vino_free_buffer_with_count(struct vino_framebuffer *fb, | 695 | static void vino_free_buffer_with_count(struct vino_framebuffer *fb, |
@@ -2456,9 +2390,9 @@ static int vino_is_input_owner(struct vino_channel_settings *vcs) | |||
2456 | switch(vcs->input) { | 2390 | switch(vcs->input) { |
2457 | case VINO_INPUT_COMPOSITE: | 2391 | case VINO_INPUT_COMPOSITE: |
2458 | case VINO_INPUT_SVIDEO: | 2392 | case VINO_INPUT_SVIDEO: |
2459 | return (vino_drvdata->decoder.owner == vcs->channel); | 2393 | return vino_drvdata->decoder_owner == vcs->channel; |
2460 | case VINO_INPUT_D1: | 2394 | case VINO_INPUT_D1: |
2461 | return (vino_drvdata->camera.owner == vcs->channel); | 2395 | return vino_drvdata->camera_owner == vcs->channel; |
2462 | default: | 2396 | default: |
2463 | return 0; | 2397 | return 0; |
2464 | } | 2398 | } |
@@ -2474,24 +2408,22 @@ static int vino_acquire_input(struct vino_channel_settings *vcs) | |||
2474 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); | 2408 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); |
2475 | 2409 | ||
2476 | /* First try D1 and then SAA7191 */ | 2410 | /* First try D1 and then SAA7191 */ |
2477 | if (vino_drvdata->camera.driver | 2411 | if (vino_drvdata->camera |
2478 | && (vino_drvdata->camera.owner == VINO_NO_CHANNEL)) { | 2412 | && (vino_drvdata->camera_owner == VINO_NO_CHANNEL)) { |
2479 | i2c_use_client(vino_drvdata->camera.driver); | 2413 | vino_drvdata->camera_owner = vcs->channel; |
2480 | vino_drvdata->camera.owner = vcs->channel; | ||
2481 | vcs->input = VINO_INPUT_D1; | 2414 | vcs->input = VINO_INPUT_D1; |
2482 | vcs->data_norm = VINO_DATA_NORM_D1; | 2415 | vcs->data_norm = VINO_DATA_NORM_D1; |
2483 | } else if (vino_drvdata->decoder.driver | 2416 | } else if (vino_drvdata->decoder |
2484 | && (vino_drvdata->decoder.owner == VINO_NO_CHANNEL)) { | 2417 | && (vino_drvdata->decoder_owner == VINO_NO_CHANNEL)) { |
2485 | int input; | 2418 | int input; |
2486 | int data_norm; | 2419 | int data_norm; |
2487 | v4l2_std_id norm; | 2420 | v4l2_std_id norm; |
2488 | struct v4l2_routing route = { 0, 0 }; | 2421 | struct v4l2_routing route = { 0, 0 }; |
2489 | 2422 | ||
2490 | i2c_use_client(vino_drvdata->decoder.driver); | ||
2491 | input = VINO_INPUT_COMPOSITE; | 2423 | input = VINO_INPUT_COMPOSITE; |
2492 | 2424 | ||
2493 | route.input = vino_get_saa7191_input(input); | 2425 | route.input = vino_get_saa7191_input(input); |
2494 | ret = i2c_decoder_command(VIDIOC_INT_S_VIDEO_ROUTING, &route); | 2426 | ret = decoder_call(video, s_routing, &route); |
2495 | if (ret) { | 2427 | if (ret) { |
2496 | ret = -EINVAL; | 2428 | ret = -EINVAL; |
2497 | goto out; | 2429 | goto out; |
@@ -2502,7 +2434,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs) | |||
2502 | /* Don't hold spinlocks while auto-detecting norm | 2434 | /* Don't hold spinlocks while auto-detecting norm |
2503 | * as it may take a while... */ | 2435 | * as it may take a while... */ |
2504 | 2436 | ||
2505 | ret = i2c_decoder_command(VIDIOC_QUERYSTD, &norm); | 2437 | ret = decoder_call(video, querystd, &norm); |
2506 | if (!ret) { | 2438 | if (!ret) { |
2507 | for (data_norm = 0; data_norm < 3; data_norm++) { | 2439 | for (data_norm = 0; data_norm < 3; data_norm++) { |
2508 | if (vino_data_norms[data_norm].std & norm) | 2440 | if (vino_data_norms[data_norm].std & norm) |
@@ -2510,7 +2442,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs) | |||
2510 | } | 2442 | } |
2511 | if (data_norm == 3) | 2443 | if (data_norm == 3) |
2512 | data_norm = VINO_DATA_NORM_PAL; | 2444 | data_norm = VINO_DATA_NORM_PAL; |
2513 | ret = i2c_decoder_command(VIDIOC_S_STD, &norm); | 2445 | ret = decoder_call(tuner, s_std, norm); |
2514 | } | 2446 | } |
2515 | 2447 | ||
2516 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); | 2448 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); |
@@ -2520,7 +2452,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs) | |||
2520 | goto out; | 2452 | goto out; |
2521 | } | 2453 | } |
2522 | 2454 | ||
2523 | vino_drvdata->decoder.owner = vcs->channel; | 2455 | vino_drvdata->decoder_owner = vcs->channel; |
2524 | 2456 | ||
2525 | vcs->input = input; | 2457 | vcs->input = input; |
2526 | vcs->data_norm = data_norm; | 2458 | vcs->data_norm = data_norm; |
@@ -2565,25 +2497,24 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input) | |||
2565 | switch (input) { | 2497 | switch (input) { |
2566 | case VINO_INPUT_COMPOSITE: | 2498 | case VINO_INPUT_COMPOSITE: |
2567 | case VINO_INPUT_SVIDEO: | 2499 | case VINO_INPUT_SVIDEO: |
2568 | if (!vino_drvdata->decoder.driver) { | 2500 | if (!vino_drvdata->decoder) { |
2569 | ret = -EINVAL; | 2501 | ret = -EINVAL; |
2570 | goto out; | 2502 | goto out; |
2571 | } | 2503 | } |
2572 | 2504 | ||
2573 | if (vino_drvdata->decoder.owner == VINO_NO_CHANNEL) { | 2505 | if (vino_drvdata->decoder_owner == VINO_NO_CHANNEL) { |
2574 | i2c_use_client(vino_drvdata->decoder.driver); | 2506 | vino_drvdata->decoder_owner = vcs->channel; |
2575 | vino_drvdata->decoder.owner = vcs->channel; | ||
2576 | } | 2507 | } |
2577 | 2508 | ||
2578 | if (vino_drvdata->decoder.owner == vcs->channel) { | 2509 | if (vino_drvdata->decoder_owner == vcs->channel) { |
2579 | int data_norm; | 2510 | int data_norm; |
2580 | v4l2_std_id norm; | 2511 | v4l2_std_id norm; |
2581 | struct v4l2_routing route = { 0, 0 }; | 2512 | struct v4l2_routing route = { 0, 0 }; |
2582 | 2513 | ||
2583 | route.input = vino_get_saa7191_input(input); | 2514 | route.input = vino_get_saa7191_input(input); |
2584 | ret = i2c_decoder_command(VIDIOC_INT_S_VIDEO_ROUTING, &route); | 2515 | ret = decoder_call(video, s_routing, &route); |
2585 | if (ret) { | 2516 | if (ret) { |
2586 | vino_drvdata->decoder.owner = VINO_NO_CHANNEL; | 2517 | vino_drvdata->decoder_owner = VINO_NO_CHANNEL; |
2587 | ret = -EINVAL; | 2518 | ret = -EINVAL; |
2588 | goto out; | 2519 | goto out; |
2589 | } | 2520 | } |
@@ -2593,7 +2524,7 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input) | |||
2593 | /* Don't hold spinlocks while auto-detecting norm | 2524 | /* Don't hold spinlocks while auto-detecting norm |
2594 | * as it may take a while... */ | 2525 | * as it may take a while... */ |
2595 | 2526 | ||
2596 | ret = i2c_decoder_command(VIDIOC_QUERYSTD, &norm); | 2527 | ret = decoder_call(video, querystd, &norm); |
2597 | if (!ret) { | 2528 | if (!ret) { |
2598 | for (data_norm = 0; data_norm < 3; data_norm++) { | 2529 | for (data_norm = 0; data_norm < 3; data_norm++) { |
2599 | if (vino_data_norms[data_norm].std & norm) | 2530 | if (vino_data_norms[data_norm].std & norm) |
@@ -2601,13 +2532,13 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input) | |||
2601 | } | 2532 | } |
2602 | if (data_norm == 3) | 2533 | if (data_norm == 3) |
2603 | data_norm = VINO_DATA_NORM_PAL; | 2534 | data_norm = VINO_DATA_NORM_PAL; |
2604 | ret = i2c_decoder_command(VIDIOC_S_STD, &norm); | 2535 | ret = decoder_call(tuner, s_std, norm); |
2605 | } | 2536 | } |
2606 | 2537 | ||
2607 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); | 2538 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); |
2608 | 2539 | ||
2609 | if (ret) { | 2540 | if (ret) { |
2610 | vino_drvdata->decoder.owner = VINO_NO_CHANNEL; | 2541 | vino_drvdata->decoder_owner = VINO_NO_CHANNEL; |
2611 | ret = -EINVAL; | 2542 | ret = -EINVAL; |
2612 | goto out; | 2543 | goto out; |
2613 | } | 2544 | } |
@@ -2624,36 +2555,31 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input) | |||
2624 | vcs->data_norm = vcs2->data_norm; | 2555 | vcs->data_norm = vcs2->data_norm; |
2625 | } | 2556 | } |
2626 | 2557 | ||
2627 | if (vino_drvdata->camera.owner == vcs->channel) { | 2558 | if (vino_drvdata->camera_owner == vcs->channel) { |
2628 | /* Transfer the ownership or release the input */ | 2559 | /* Transfer the ownership or release the input */ |
2629 | if (vcs2->input == VINO_INPUT_D1) { | 2560 | if (vcs2->input == VINO_INPUT_D1) { |
2630 | vino_drvdata->camera.owner = vcs2->channel; | 2561 | vino_drvdata->camera_owner = vcs2->channel; |
2631 | } else { | 2562 | } else { |
2632 | i2c_release_client(vino_drvdata->camera.driver); | 2563 | vino_drvdata->camera_owner = VINO_NO_CHANNEL; |
2633 | vino_drvdata->camera.owner = VINO_NO_CHANNEL; | ||
2634 | } | 2564 | } |
2635 | } | 2565 | } |
2636 | break; | 2566 | break; |
2637 | case VINO_INPUT_D1: | 2567 | case VINO_INPUT_D1: |
2638 | if (!vino_drvdata->camera.driver) { | 2568 | if (!vino_drvdata->camera) { |
2639 | ret = -EINVAL; | 2569 | ret = -EINVAL; |
2640 | goto out; | 2570 | goto out; |
2641 | } | 2571 | } |
2642 | 2572 | ||
2643 | if (vino_drvdata->camera.owner == VINO_NO_CHANNEL) { | 2573 | if (vino_drvdata->camera_owner == VINO_NO_CHANNEL) |
2644 | i2c_use_client(vino_drvdata->camera.driver); | 2574 | vino_drvdata->camera_owner = vcs->channel; |
2645 | vino_drvdata->camera.owner = vcs->channel; | ||
2646 | } | ||
2647 | 2575 | ||
2648 | if (vino_drvdata->decoder.owner == vcs->channel) { | 2576 | if (vino_drvdata->decoder_owner == vcs->channel) { |
2649 | /* Transfer the ownership or release the input */ | 2577 | /* Transfer the ownership or release the input */ |
2650 | if ((vcs2->input == VINO_INPUT_COMPOSITE) || | 2578 | if ((vcs2->input == VINO_INPUT_COMPOSITE) || |
2651 | (vcs2->input == VINO_INPUT_SVIDEO)) { | 2579 | (vcs2->input == VINO_INPUT_SVIDEO)) { |
2652 | vino_drvdata->decoder.owner = vcs2->channel; | 2580 | vino_drvdata->decoder_owner = vcs2->channel; |
2653 | } else { | 2581 | } else { |
2654 | i2c_release_client(vino_drvdata-> | 2582 | vino_drvdata->decoder_owner = VINO_NO_CHANNEL; |
2655 | decoder.driver); | ||
2656 | vino_drvdata->decoder.owner = VINO_NO_CHANNEL; | ||
2657 | } | 2583 | } |
2658 | } | 2584 | } |
2659 | 2585 | ||
@@ -2690,20 +2616,18 @@ static void vino_release_input(struct vino_channel_settings *vcs) | |||
2690 | /* Release ownership of the channel | 2616 | /* Release ownership of the channel |
2691 | * and if the other channel takes input from | 2617 | * and if the other channel takes input from |
2692 | * the same source, transfer the ownership */ | 2618 | * the same source, transfer the ownership */ |
2693 | if (vino_drvdata->camera.owner == vcs->channel) { | 2619 | if (vino_drvdata->camera_owner == vcs->channel) { |
2694 | if (vcs2->input == VINO_INPUT_D1) { | 2620 | if (vcs2->input == VINO_INPUT_D1) { |
2695 | vino_drvdata->camera.owner = vcs2->channel; | 2621 | vino_drvdata->camera_owner = vcs2->channel; |
2696 | } else { | 2622 | } else { |
2697 | i2c_release_client(vino_drvdata->camera.driver); | 2623 | vino_drvdata->camera_owner = VINO_NO_CHANNEL; |
2698 | vino_drvdata->camera.owner = VINO_NO_CHANNEL; | ||
2699 | } | 2624 | } |
2700 | } else if (vino_drvdata->decoder.owner == vcs->channel) { | 2625 | } else if (vino_drvdata->decoder_owner == vcs->channel) { |
2701 | if ((vcs2->input == VINO_INPUT_COMPOSITE) || | 2626 | if ((vcs2->input == VINO_INPUT_COMPOSITE) || |
2702 | (vcs2->input == VINO_INPUT_SVIDEO)) { | 2627 | (vcs2->input == VINO_INPUT_SVIDEO)) { |
2703 | vino_drvdata->decoder.owner = vcs2->channel; | 2628 | vino_drvdata->decoder_owner = vcs2->channel; |
2704 | } else { | 2629 | } else { |
2705 | i2c_release_client(vino_drvdata->decoder.driver); | 2630 | vino_drvdata->decoder_owner = VINO_NO_CHANNEL; |
2706 | vino_drvdata->decoder.owner = VINO_NO_CHANNEL; | ||
2707 | } | 2631 | } |
2708 | } | 2632 | } |
2709 | vcs->input = VINO_INPUT_NONE; | 2633 | vcs->input = VINO_INPUT_NONE; |
@@ -2742,7 +2666,7 @@ static int vino_set_data_norm(struct vino_channel_settings *vcs, | |||
2742 | * as it may take a while... */ | 2666 | * as it may take a while... */ |
2743 | 2667 | ||
2744 | norm = vino_data_norms[data_norm].std; | 2668 | norm = vino_data_norms[data_norm].std; |
2745 | err = i2c_decoder_command(VIDIOC_S_STD, &norm); | 2669 | err = decoder_call(tuner, s_std, norm); |
2746 | 2670 | ||
2747 | spin_lock_irqsave(&vino_drvdata->input_lock, *flags); | 2671 | spin_lock_irqsave(&vino_drvdata->input_lock, *flags); |
2748 | 2672 | ||
@@ -2784,7 +2708,7 @@ static int vino_int_enum_input(struct vino_channel_settings *vcs, __u32 index) | |||
2784 | unsigned long flags; | 2708 | unsigned long flags; |
2785 | 2709 | ||
2786 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); | 2710 | spin_lock_irqsave(&vino_drvdata->input_lock, flags); |
2787 | if (vino_drvdata->decoder.driver && vino_drvdata->camera.driver) { | 2711 | if (vino_drvdata->decoder && vino_drvdata->camera) { |
2788 | switch (index) { | 2712 | switch (index) { |
2789 | case 0: | 2713 | case 0: |
2790 | input = VINO_INPUT_COMPOSITE; | 2714 | input = VINO_INPUT_COMPOSITE; |
@@ -2796,7 +2720,7 @@ static int vino_int_enum_input(struct vino_channel_settings *vcs, __u32 index) | |||
2796 | input = VINO_INPUT_D1; | 2720 | input = VINO_INPUT_D1; |
2797 | break; | 2721 | break; |
2798 | } | 2722 | } |
2799 | } else if (vino_drvdata->decoder.driver) { | 2723 | } else if (vino_drvdata->decoder) { |
2800 | switch (index) { | 2724 | switch (index) { |
2801 | case 0: | 2725 | case 0: |
2802 | input = VINO_INPUT_COMPOSITE; | 2726 | input = VINO_INPUT_COMPOSITE; |
@@ -2805,7 +2729,7 @@ static int vino_int_enum_input(struct vino_channel_settings *vcs, __u32 index) | |||
2805 | input = VINO_INPUT_SVIDEO; | 2729 | input = VINO_INPUT_SVIDEO; |
2806 | break; | 2730 | break; |
2807 | } | 2731 | } |
2808 | } else if (vino_drvdata->camera.driver) { | 2732 | } else if (vino_drvdata->camera) { |
2809 | switch (index) { | 2733 | switch (index) { |
2810 | case 0: | 2734 | case 0: |
2811 | input = VINO_INPUT_D1; | 2735 | input = VINO_INPUT_D1; |
@@ -2823,7 +2747,7 @@ static __u32 vino_find_input_index(struct vino_channel_settings *vcs) | |||
2823 | __u32 index = 0; | 2747 | __u32 index = 0; |
2824 | // FIXME: detect when no inputs available | 2748 | // FIXME: detect when no inputs available |
2825 | 2749 | ||
2826 | if (vino_drvdata->decoder.driver && vino_drvdata->camera.driver) { | 2750 | if (vino_drvdata->decoder && vino_drvdata->camera) { |
2827 | switch (vcs->input) { | 2751 | switch (vcs->input) { |
2828 | case VINO_INPUT_COMPOSITE: | 2752 | case VINO_INPUT_COMPOSITE: |
2829 | index = 0; | 2753 | index = 0; |
@@ -2835,7 +2759,7 @@ static __u32 vino_find_input_index(struct vino_channel_settings *vcs) | |||
2835 | index = 2; | 2759 | index = 2; |
2836 | break; | 2760 | break; |
2837 | } | 2761 | } |
2838 | } else if (vino_drvdata->decoder.driver) { | 2762 | } else if (vino_drvdata->decoder) { |
2839 | switch (vcs->input) { | 2763 | switch (vcs->input) { |
2840 | case VINO_INPUT_COMPOSITE: | 2764 | case VINO_INPUT_COMPOSITE: |
2841 | index = 0; | 2765 | index = 0; |
@@ -2844,7 +2768,7 @@ static __u32 vino_find_input_index(struct vino_channel_settings *vcs) | |||
2844 | index = 1; | 2768 | index = 1; |
2845 | break; | 2769 | break; |
2846 | } | 2770 | } |
2847 | } else if (vino_drvdata->camera.driver) { | 2771 | } else if (vino_drvdata->camera) { |
2848 | switch (vcs->input) { | 2772 | switch (vcs->input) { |
2849 | case VINO_INPUT_D1: | 2773 | case VINO_INPUT_D1: |
2850 | index = 0; | 2774 | index = 0; |
@@ -2893,7 +2817,7 @@ static int vino_enum_input(struct file *file, void *__fh, | |||
2893 | strcpy(i->name, vino_inputs[input].name); | 2817 | strcpy(i->name, vino_inputs[input].name); |
2894 | 2818 | ||
2895 | if (input == VINO_INPUT_COMPOSITE || input == VINO_INPUT_SVIDEO) | 2819 | if (input == VINO_INPUT_COMPOSITE || input == VINO_INPUT_SVIDEO) |
2896 | i2c_decoder_command(VIDIOC_INT_G_INPUT_STATUS, &i->status); | 2820 | decoder_call(video, g_input_status, &i->status); |
2897 | return 0; | 2821 | return 0; |
2898 | } | 2822 | } |
2899 | 2823 | ||
@@ -2950,7 +2874,7 @@ static int vino_querystd(struct file *file, void *__fh, | |||
2950 | break; | 2874 | break; |
2951 | case VINO_INPUT_COMPOSITE: | 2875 | case VINO_INPUT_COMPOSITE: |
2952 | case VINO_INPUT_SVIDEO: { | 2876 | case VINO_INPUT_SVIDEO: { |
2953 | i2c_decoder_command(VIDIOC_QUERYSTD, std); | 2877 | decoder_call(video, querystd, std); |
2954 | break; | 2878 | break; |
2955 | } | 2879 | } |
2956 | default: | 2880 | default: |
@@ -3679,7 +3603,7 @@ static int vino_g_ctrl(struct file *file, void *__fh, | |||
3679 | if (err) | 3603 | if (err) |
3680 | goto out; | 3604 | goto out; |
3681 | 3605 | ||
3682 | err = i2c_camera_command(VIDIOC_G_CTRL, &control); | 3606 | err = camera_call(core, g_ctrl, control); |
3683 | if (err) | 3607 | if (err) |
3684 | err = -EINVAL; | 3608 | err = -EINVAL; |
3685 | break; | 3609 | break; |
@@ -3697,7 +3621,7 @@ static int vino_g_ctrl(struct file *file, void *__fh, | |||
3697 | if (err) | 3621 | if (err) |
3698 | goto out; | 3622 | goto out; |
3699 | 3623 | ||
3700 | err = i2c_decoder_command(VIDIOC_G_CTRL, &control); | 3624 | err = decoder_call(core, g_ctrl, control); |
3701 | if (err) | 3625 | if (err) |
3702 | err = -EINVAL; | 3626 | err = -EINVAL; |
3703 | break; | 3627 | break; |
@@ -3743,7 +3667,7 @@ static int vino_s_ctrl(struct file *file, void *__fh, | |||
3743 | err = -ERANGE; | 3667 | err = -ERANGE; |
3744 | goto out; | 3668 | goto out; |
3745 | } | 3669 | } |
3746 | err = i2c_camera_command(VIDIOC_S_CTRL, &control); | 3670 | err = camera_call(core, s_ctrl, control); |
3747 | if (err) | 3671 | if (err) |
3748 | err = -EINVAL; | 3672 | err = -EINVAL; |
3749 | break; | 3673 | break; |
@@ -3765,7 +3689,7 @@ static int vino_s_ctrl(struct file *file, void *__fh, | |||
3765 | goto out; | 3689 | goto out; |
3766 | } | 3690 | } |
3767 | 3691 | ||
3768 | err = i2c_decoder_command(VIDIOC_S_CTRL, &control); | 3692 | err = decoder_call(core, s_ctrl, control); |
3769 | if (err) | 3693 | if (err) |
3770 | err = -EINVAL; | 3694 | err = -EINVAL; |
3771 | break; | 3695 | break; |
@@ -4257,6 +4181,7 @@ static int vino_init_channel_settings(struct vino_channel_settings *vcs, | |||
4257 | 4181 | ||
4258 | static int __init vino_module_init(void) | 4182 | static int __init vino_module_init(void) |
4259 | { | 4183 | { |
4184 | unsigned short addr[] = { 0, I2C_CLIENT_END }; | ||
4260 | int ret; | 4185 | int ret; |
4261 | 4186 | ||
4262 | printk(KERN_INFO "SGI VINO driver version %s\n", | 4187 | printk(KERN_INFO "SGI VINO driver version %s\n", |
@@ -4326,10 +4251,12 @@ static int __init vino_module_init(void) | |||
4326 | } | 4251 | } |
4327 | vino_init_stage++; | 4252 | vino_init_stage++; |
4328 | 4253 | ||
4329 | #ifdef MODULE | 4254 | addr[0] = 0x45; |
4330 | request_module("saa7191"); | 4255 | vino_drvdata->decoder = v4l2_i2c_new_probed_subdev(&vino_i2c_adapter, |
4331 | request_module("indycam"); | 4256 | "saa7191", "saa7191", addr); |
4332 | #endif | 4257 | addr[0] = 0x2b; |
4258 | vino_drvdata->camera = v4l2_i2c_new_probed_subdev(&vino_i2c_adapter, | ||
4259 | "indycam", "indycam", addr); | ||
4333 | 4260 | ||
4334 | dprintk("init complete!\n"); | 4261 | dprintk("init complete!\n"); |
4335 | 4262 | ||