aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25840
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx25840')
-rw-r--r--drivers/media/video/cx25840/Kconfig9
-rw-r--r--drivers/media/video/cx25840/Makefile2
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c46
-rw-r--r--drivers/media/video/cx25840/cx25840-vbi.c6
-rw-r--r--drivers/media/video/cx25840/cx25840.h1
5 files changed, 40 insertions, 24 deletions
diff --git a/drivers/media/video/cx25840/Kconfig b/drivers/media/video/cx25840/Kconfig
new file mode 100644
index 000000000000..854264e42ec0
--- /dev/null
+++ b/drivers/media/video/cx25840/Kconfig
@@ -0,0 +1,9 @@
1config VIDEO_CX25840
2 tristate "Conexant CX2584x audio/video decoders"
3 depends on VIDEO_DEV && I2C && EXPERIMENTAL
4 select FW_LOADER
5 ---help---
6 Support for the Conexant CX2584x audio/video decoders.
7
8 To compile this driver as a module, choose M here: the
9 module will be called cx25840
diff --git a/drivers/media/video/cx25840/Makefile b/drivers/media/video/cx25840/Makefile
index 543ebacdc9d7..32a896c23d1e 100644
--- a/drivers/media/video/cx25840/Makefile
+++ b/drivers/media/video/cx25840/Makefile
@@ -1,6 +1,6 @@
1cx25840-objs := cx25840-core.o cx25840-audio.o cx25840-firmware.o \ 1cx25840-objs := cx25840-core.o cx25840-audio.o cx25840-firmware.o \
2 cx25840-vbi.o 2 cx25840-vbi.o
3 3
4obj-$(CONFIG_VIDEO_DECODER) += cx25840.o 4obj-$(CONFIG_VIDEO_CX25840) += cx25840.o
5 5
6EXTRA_CFLAGS += -I$(src)/.. 6EXTRA_CFLAGS += -I$(src)/..
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 5588b9a5c430..8a257978056f 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -743,6 +743,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
743 743
744 memset(input, 0, sizeof(*input)); 744 memset(input, 0, sizeof(*input));
745 input->index = state->aud_input; 745 input->index = state->aud_input;
746 input->capability = V4L2_AUDCAP_STEREO;
746 break; 747 break;
747 } 748 }
748 749
@@ -753,7 +754,6 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
753 case VIDIOC_G_TUNER: 754 case VIDIOC_G_TUNER:
754 { 755 {
755 u8 mode = cx25840_read(client, 0x804); 756 u8 mode = cx25840_read(client, 0x804);
756 u8 pref = cx25840_read(client, 0x809) & 0xf;
757 u8 vpres = cx25840_read(client, 0x80a) & 0x10; 757 u8 vpres = cx25840_read(client, 0x80a) & 0x10;
758 int val = 0; 758 int val = 0;
759 759
@@ -773,44 +773,49 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
773 val |= V4L2_TUNER_SUB_MONO; 773 val |= V4L2_TUNER_SUB_MONO;
774 774
775 if (mode == 2 || mode == 4) 775 if (mode == 2 || mode == 4)
776 val |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; 776 val = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
777 777
778 if (mode & 0x10) 778 if (mode & 0x10)
779 val |= V4L2_TUNER_SUB_SAP; 779 val |= V4L2_TUNER_SUB_SAP;
780 780
781 vt->rxsubchans = val; 781 vt->rxsubchans = val;
782 782 vt->audmode = state->audmode;
783 switch (pref) {
784 case 0:
785 vt->audmode = V4L2_TUNER_MODE_MONO;
786 break;
787 case 1:
788 case 2:
789 vt->audmode = V4L2_TUNER_MODE_LANG2;
790 break;
791 case 4:
792 default:
793 vt->audmode = V4L2_TUNER_MODE_STEREO;
794 }
795 break; 783 break;
796 } 784 }
797 785
798 case VIDIOC_S_TUNER: 786 case VIDIOC_S_TUNER:
787 if (state->radio)
788 break;
789
799 switch (vt->audmode) { 790 switch (vt->audmode) {
800 case V4L2_TUNER_MODE_MONO: 791 case V4L2_TUNER_MODE_MONO:
801 case V4L2_TUNER_MODE_LANG1: 792 /* mono -> mono
802 /* Force PREF_MODE to MONO */ 793 stereo -> mono
794 bilingual -> lang1 */
803 cx25840_and_or(client, 0x809, ~0xf, 0x00); 795 cx25840_and_or(client, 0x809, ~0xf, 0x00);
804 break; 796 break;
805 case V4L2_TUNER_MODE_STEREO: 797 case V4L2_TUNER_MODE_LANG1:
806 /* Force PREF_MODE to STEREO */ 798 /* mono -> mono
799 stereo -> stereo
800 bilingual -> lang1 */
807 cx25840_and_or(client, 0x809, ~0xf, 0x04); 801 cx25840_and_or(client, 0x809, ~0xf, 0x04);
808 break; 802 break;
803 case V4L2_TUNER_MODE_STEREO:
804 /* mono -> mono
805 stereo -> stereo
806 bilingual -> lang1/lang2 */
807 cx25840_and_or(client, 0x809, ~0xf, 0x07);
808 break;
809 case V4L2_TUNER_MODE_LANG2: 809 case V4L2_TUNER_MODE_LANG2:
810 /* Force PREF_MODE to LANG2 */ 810 /* mono -> mono
811 stereo ->stereo
812 bilingual -> lang2 */
811 cx25840_and_or(client, 0x809, ~0xf, 0x01); 813 cx25840_and_or(client, 0x809, ~0xf, 0x01);
812 break; 814 break;
815 default:
816 return -EINVAL;
813 } 817 }
818 state->audmode = vt->audmode;
814 break; 819 break;
815 820
816 case VIDIOC_G_FMT: 821 case VIDIOC_G_FMT:
@@ -891,6 +896,7 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
891 state->aud_input = CX25840_AUDIO8; 896 state->aud_input = CX25840_AUDIO8;
892 state->audclk_freq = 48000; 897 state->audclk_freq = 48000;
893 state->pvr150_workaround = 0; 898 state->pvr150_workaround = 0;
899 state->audmode = V4L2_TUNER_MODE_LANG1;
894 900
895 cx25840_initialize(client, 1); 901 cx25840_initialize(client, 1);
896 902
diff --git a/drivers/media/video/cx25840/cx25840-vbi.c b/drivers/media/video/cx25840/cx25840-vbi.c
index 04d879da7d63..e96fd1f1d6dc 100644
--- a/drivers/media/video/cx25840/cx25840-vbi.c
+++ b/drivers/media/video/cx25840/cx25840-vbi.c
@@ -151,7 +151,7 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg)
151 case VIDIOC_G_FMT: 151 case VIDIOC_G_FMT:
152 { 152 {
153 static u16 lcr2vbi[] = { 153 static u16 lcr2vbi[] = {
154 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ 154 0, V4L2_SLICED_TELETEXT_PAL_B, 0, /* 1 */
155 0, V4L2_SLICED_WSS_625, 0, /* 4 */ 155 0, V4L2_SLICED_WSS_625, 0, /* 4 */
156 V4L2_SLICED_CAPTION_525, /* 6 */ 156 V4L2_SLICED_CAPTION_525, /* 6 */
157 0, 0, V4L2_SLICED_VPS, 0, 0, /* 9 */ 157 0, 0, V4L2_SLICED_VPS, 0, 0, /* 9 */
@@ -231,7 +231,7 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg)
231 for (i = 7; i <= 23; i++) { 231 for (i = 7; i <= 23; i++) {
232 for (x = 0; x <= 1; x++) { 232 for (x = 0; x <= 1; x++) {
233 switch (svbi->service_lines[1-x][i]) { 233 switch (svbi->service_lines[1-x][i]) {
234 case V4L2_SLICED_TELETEXT_B: 234 case V4L2_SLICED_TELETEXT_PAL_B:
235 lcr[i] |= 1 << (4 * x); 235 lcr[i] |= 1 << (4 * x);
236 break; 236 break;
237 case V4L2_SLICED_WSS_625: 237 case V4L2_SLICED_WSS_625:
@@ -282,7 +282,7 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg)
282 282
283 switch (id2) { 283 switch (id2) {
284 case 1: 284 case 1:
285 id2 = V4L2_SLICED_TELETEXT_B; 285 id2 = V4L2_SLICED_TELETEXT_PAL_B;
286 break; 286 break;
287 case 4: 287 case 4:
288 id2 = V4L2_SLICED_WSS_625; 288 id2 = V4L2_SLICED_WSS_625;
diff --git a/drivers/media/video/cx25840/cx25840.h b/drivers/media/video/cx25840/cx25840.h
index fd22f30dcc1b..dd70664d1dd9 100644
--- a/drivers/media/video/cx25840/cx25840.h
+++ b/drivers/media/video/cx25840/cx25840.h
@@ -78,6 +78,7 @@ struct cx25840_state {
78 enum cx25840_video_input vid_input; 78 enum cx25840_video_input vid_input;
79 enum cx25840_audio_input aud_input; 79 enum cx25840_audio_input aud_input;
80 u32 audclk_freq; 80 u32 audclk_freq;
81 int audmode;
81}; 82};
82 83
83/* ----------------------------------------------------------------------- */ 84/* ----------------------------------------------------------------------- */