aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/msp3400-driver.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-03-18 19:31:00 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-03-24 14:26:56 -0500
commit8bf2f8e747700419cc5bbc56c4496774eb8f2f1f (patch)
tree94e9b7e99d2e95d4515d48247ce549540374a989 /drivers/media/video/msp3400-driver.c
parentae62e3d4a8194680023b47ab778bf1dcea8d6b42 (diff)
V4L/DVB (3577): Cleanup audio input handling
Cleanup audio input handling in bttv and tvaudio: - inputs were specified that were never used - mute was handled as a special input which led to confusing code - confusing naming made it difficult to see if the setting was for i2c or gpio. The old audiochip.h input names moved to tvaudio.h. Currently this is used both by tvaudio and msp3400 until the msp3400 implements the new msp3400-specific inputs. Detect in bttv the tvaudio and msp3400 i2c clients and use these client pointers to set the inputs directly instead of broadcasting the command. Removed AUDC_SET_INPUT. Now replaced by VIDIOC_S_AUDIO. This will be replaced again later by the new ROUTING commands. Removed VIDIOC_G_AUDIO implementations in i2c drivers: this command is a user level command and not to be used internally. It wasn't called at all anyway. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/msp3400-driver.c')
-rw-r--r--drivers/media/video/msp3400-driver.c104
1 files changed, 5 insertions, 99 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 11ea9765769..bd0b036c5ca 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -53,7 +53,7 @@
53#include <linux/videodev.h> 53#include <linux/videodev.h>
54#include <linux/videodev2.h> 54#include <linux/videodev2.h>
55#include <media/v4l2-common.h> 55#include <media/v4l2-common.h>
56#include <media/audiochip.h> 56#include <media/tvaudio.h>
57#include <linux/kthread.h> 57#include <linux/kthread.h>
58#include <linux/suspend.h> 58#include <linux/suspend.h>
59#include "msp3400.h" 59#include "msp3400.h"
@@ -585,51 +585,12 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
585static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) 585static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
586{ 586{
587 struct msp_state *state = i2c_get_clientdata(client); 587 struct msp_state *state = i2c_get_clientdata(client);
588 u16 *sarg = arg;
589 int scart = 0; 588 int scart = 0;
590 589
591 if (msp_debug >= 2) 590 if (msp_debug >= 2)
592 v4l_i2c_print_ioctl(client, cmd); 591 v4l_i2c_print_ioctl(client, cmd);
593 592
594 switch (cmd) { 593 switch (cmd) {
595 case AUDC_SET_INPUT:
596 if (*sarg == state->input)
597 break;
598 state->input = *sarg;
599 switch (*sarg) {
600 case AUDIO_RADIO:
601 /* Hauppauge uses IN2 for the radio */
602 state->mode = MSP_MODE_FM_RADIO;
603 scart = SCART_IN2;
604 break;
605 case AUDIO_EXTERN_1:
606 /* IN1 is often used for external input ... */
607 state->mode = MSP_MODE_EXTERN;
608 scart = SCART_IN1;
609 break;
610 case AUDIO_EXTERN_2:
611 /* ... sometimes it is IN2 through ;) */
612 state->mode = MSP_MODE_EXTERN;
613 scart = SCART_IN2;
614 break;
615 case AUDIO_TUNER:
616 state->mode = -1;
617 break;
618 default:
619 if (*sarg & AUDIO_MUTE)
620 msp_set_scart(client, SCART_MUTE, 0);
621 break;
622 }
623 if (scart) {
624 state->rxsubchans = V4L2_TUNER_SUB_STEREO;
625 msp_set_scart(client, scart, 0);
626 msp_write_dsp(client, 0x000d, 0x1900);
627 if (state->opmode != OPMODE_AUTOSELECT)
628 msp_set_audmode(client);
629 }
630 msp_wake_thread(client);
631 break;
632
633 case AUDC_SET_RADIO: 594 case AUDC_SET_RADIO:
634 if (state->radio) 595 if (state->radio)
635 return 0; 596 return 0;
@@ -750,82 +711,27 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
750 return 0; 711 return 0;
751 } 712 }
752 713
753 case VIDIOC_ENUMINPUT:
754 {
755 struct v4l2_input *i = arg;
756
757 if (i->index != 0)
758 return -EINVAL;
759
760 i->type = V4L2_INPUT_TYPE_TUNER;
761 switch (i->index) {
762 case AUDIO_RADIO:
763 strcpy(i->name, "Radio");
764 break;
765 case AUDIO_EXTERN_1:
766 strcpy(i->name, "Extern 1");
767 break;
768 case AUDIO_EXTERN_2:
769 strcpy(i->name, "Extern 2");
770 break;
771 case AUDIO_TUNER:
772 strcpy(i->name, "Television");
773 break;
774 default:
775 return -EINVAL;
776 }
777 return 0;
778 }
779
780 case VIDIOC_G_AUDIO:
781 {
782 struct v4l2_audio *a = arg;
783
784 memset(a, 0, sizeof(*a));
785
786 switch (a->index) {
787 case AUDIO_RADIO:
788 strcpy(a->name, "Radio");
789 break;
790 case AUDIO_EXTERN_1:
791 strcpy(a->name, "Extern 1");
792 break;
793 case AUDIO_EXTERN_2:
794 strcpy(a->name, "Extern 2");
795 break;
796 case AUDIO_TUNER:
797 strcpy(a->name, "Television");
798 break;
799 default:
800 return -EINVAL;
801 }
802
803 a->capability = V4L2_AUDCAP_STEREO;
804 a->mode = 0; /* TODO: add support for AVL */
805 break;
806 }
807
808 case VIDIOC_S_AUDIO: 714 case VIDIOC_S_AUDIO:
809 { 715 {
810 struct v4l2_audio *sarg = arg; 716 struct v4l2_audio *sarg = arg;
811 717
812 switch (sarg->index) { 718 switch (sarg->index) {
813 case AUDIO_RADIO: 719 case TVAUDIO_INPUT_RADIO:
814 /* Hauppauge uses IN2 for the radio */ 720 /* Hauppauge uses IN2 for the radio */
815 state->mode = MSP_MODE_FM_RADIO; 721 state->mode = MSP_MODE_FM_RADIO;
816 scart = SCART_IN2; 722 scart = SCART_IN2;
817 break; 723 break;
818 case AUDIO_EXTERN_1: 724 case TVAUDIO_INPUT_EXTERN:
819 /* IN1 is often used for external input ... */ 725 /* IN1 is often used for external input ... */
820 state->mode = MSP_MODE_EXTERN; 726 state->mode = MSP_MODE_EXTERN;
821 scart = SCART_IN1; 727 scart = SCART_IN1;
822 break; 728 break;
823 case AUDIO_EXTERN_2: 729 case TVAUDIO_INPUT_INTERN:
824 /* ... sometimes it is IN2 through ;) */ 730 /* ... sometimes it is IN2 through ;) */
825 state->mode = MSP_MODE_EXTERN; 731 state->mode = MSP_MODE_EXTERN;
826 scart = SCART_IN2; 732 scart = SCART_IN2;
827 break; 733 break;
828 case AUDIO_TUNER: 734 case TVAUDIO_INPUT_TUNER:
829 state->mode = -1; 735 state->mode = -1;
830 break; 736 break;
831 } 737 }