aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/cx18/cx18-driver.c3
-rw-r--r--drivers/media/video/cx18/cx18-driver.h2
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c8
-rw-r--r--drivers/media/video/cx2341x.c73
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h2
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c8
-rw-r--r--include/media/cx2341x.h7
7 files changed, 84 insertions, 19 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index f50cf2167adc..f9df3cc5aa3d 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -587,7 +587,8 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
587 (cx->params.video_temporal_filter_mode << 1) | 587 (cx->params.video_temporal_filter_mode << 1) |
588 (cx->params.video_median_filter_type << 2); 588 (cx->params.video_median_filter_type << 2);
589 cx->params.port = CX2341X_PORT_MEMORY; 589 cx->params.port = CX2341X_PORT_MEMORY;
590 cx->params.capabilities = CX2341X_CAP_HAS_TS; 590 cx->params.capabilities = CX2341X_CAP_HAS_TS | CX2341X_CAP_HAS_AC3 |
591 CX2341X_CAP_HAS_LPCM;
591 init_waitqueue_head(&cx->cap_w); 592 init_waitqueue_head(&cx->cap_w);
592 init_waitqueue_head(&cx->mb_apu_waitq); 593 init_waitqueue_head(&cx->mb_apu_waitq);
593 init_waitqueue_head(&cx->mb_cpu_waitq); 594 init_waitqueue_head(&cx->mb_cpu_waitq);
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index 0d2edebc39b4..36809dd3d848 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -413,7 +413,7 @@ struct cx18 {
413 413
414 /* dualwatch */ 414 /* dualwatch */
415 unsigned long dualwatch_jiffies; 415 unsigned long dualwatch_jiffies;
416 u16 dualwatch_stereo_mode; 416 u32 dualwatch_stereo_mode;
417 417
418 /* Digitizer type */ 418 /* Digitizer type */
419 int digitizer; /* 0x00EF = saa7114 0x00FO = saa7115 0x0106 = mic */ 419 int digitizer; /* 0x00EF = saa7114 0x00FO = saa7115 0x0106 = mic */
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 055f6e004b2d..863d29db85eb 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -128,10 +128,10 @@ static void cx18_release_stream(struct cx18_stream *s)
128static void cx18_dualwatch(struct cx18 *cx) 128static void cx18_dualwatch(struct cx18 *cx)
129{ 129{
130 struct v4l2_tuner vt; 130 struct v4l2_tuner vt;
131 u16 new_bitmap; 131 u32 new_bitmap;
132 u16 new_stereo_mode; 132 u32 new_stereo_mode;
133 const u16 stereo_mask = 0x0300; 133 const u32 stereo_mask = 0x0300;
134 const u16 dual = 0x0200; 134 const u32 dual = 0x0200;
135 u32 h; 135 u32 h;
136 136
137 new_stereo_mode = cx->params.audio_properties & stereo_mask; 137 new_stereo_mode = cx->params.audio_properties & stereo_mask;
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
index cbbe47fb87b7..0acfacfa9436 100644
--- a/drivers/media/video/cx2341x.c
+++ b/drivers/media/video/cx2341x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * cx2341x - generic code for cx23415/6 based devices 2 * cx2341x - generic code for cx23415/6/8 based devices
3 * 3 *
4 * Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl> 4 * Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl>
5 * 5 *
@@ -30,7 +30,7 @@
30#include <media/cx2341x.h> 30#include <media/cx2341x.h>
31#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
32 32
33MODULE_DESCRIPTION("cx23415/6 driver"); 33MODULE_DESCRIPTION("cx23415/6/8 driver");
34MODULE_AUTHOR("Hans Verkuil"); 34MODULE_AUTHOR("Hans Verkuil");
35MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
36 36
@@ -45,6 +45,7 @@ const u32 cx2341x_mpeg_ctrls[] = {
45 V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, 45 V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
46 V4L2_CID_MPEG_AUDIO_ENCODING, 46 V4L2_CID_MPEG_AUDIO_ENCODING,
47 V4L2_CID_MPEG_AUDIO_L2_BITRATE, 47 V4L2_CID_MPEG_AUDIO_L2_BITRATE,
48 V4L2_CID_MPEG_AUDIO_AC3_BITRATE,
48 V4L2_CID_MPEG_AUDIO_MODE, 49 V4L2_CID_MPEG_AUDIO_MODE,
49 V4L2_CID_MPEG_AUDIO_MODE_EXTENSION, 50 V4L2_CID_MPEG_AUDIO_MODE_EXTENSION,
50 V4L2_CID_MPEG_AUDIO_EMPHASIS, 51 V4L2_CID_MPEG_AUDIO_EMPHASIS,
@@ -94,6 +95,7 @@ static const struct cx2341x_mpeg_params default_params = {
94 .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, 95 .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
95 .audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 96 .audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
96 .audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K, 97 .audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K,
98 .audio_ac3_bitrate = V4L2_MPEG_AUDIO_AC3_BITRATE_224K,
97 .audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO, 99 .audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO,
98 .audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4, 100 .audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4,
99 .audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE, 101 .audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE,
@@ -148,6 +150,9 @@ static int cx2341x_get_ctrl(const struct cx2341x_mpeg_params *params,
148 case V4L2_CID_MPEG_AUDIO_L2_BITRATE: 150 case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
149 ctrl->value = params->audio_l2_bitrate; 151 ctrl->value = params->audio_l2_bitrate;
150 break; 152 break;
153 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE:
154 ctrl->value = params->audio_ac3_bitrate;
155 break;
151 case V4L2_CID_MPEG_AUDIO_MODE: 156 case V4L2_CID_MPEG_AUDIO_MODE:
152 ctrl->value = params->audio_mode; 157 ctrl->value = params->audio_mode;
153 break; 158 break;
@@ -256,6 +261,12 @@ static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params, int busy,
256 params->audio_sampling_freq = ctrl->value; 261 params->audio_sampling_freq = ctrl->value;
257 break; 262 break;
258 case V4L2_CID_MPEG_AUDIO_ENCODING: 263 case V4L2_CID_MPEG_AUDIO_ENCODING:
264 if (busy)
265 return -EBUSY;
266 if (params->capabilities & CX2341X_CAP_HAS_AC3 &&
267 ctrl->value != V4L2_MPEG_AUDIO_ENCODING_LAYER_2 &&
268 ctrl->value != V4L2_MPEG_AUDIO_ENCODING_AC3)
269 return -EINVAL;
259 params->audio_encoding = ctrl->value; 270 params->audio_encoding = ctrl->value;
260 break; 271 break;
261 case V4L2_CID_MPEG_AUDIO_L2_BITRATE: 272 case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
@@ -263,6 +274,11 @@ static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params, int busy,
263 return -EBUSY; 274 return -EBUSY;
264 params->audio_l2_bitrate = ctrl->value; 275 params->audio_l2_bitrate = ctrl->value;
265 break; 276 break;
277 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE:
278 if (busy)
279 return -EBUSY;
280 params->audio_ac3_bitrate = ctrl->value;
281 break;
266 case V4L2_CID_MPEG_AUDIO_MODE: 282 case V4L2_CID_MPEG_AUDIO_MODE:
267 params->audio_mode = ctrl->value; 283 params->audio_mode = ctrl->value;
268 break; 284 break;
@@ -482,6 +498,12 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
482 498
483 switch (qctrl->id) { 499 switch (qctrl->id) {
484 case V4L2_CID_MPEG_AUDIO_ENCODING: 500 case V4L2_CID_MPEG_AUDIO_ENCODING:
501 if (params->capabilities & CX2341X_CAP_HAS_AC3)
502 return v4l2_ctrl_query_fill(qctrl,
503 V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
504 V4L2_MPEG_AUDIO_ENCODING_AC3, 1,
505 default_params.audio_encoding);
506
485 return v4l2_ctrl_query_fill(qctrl, 507 return v4l2_ctrl_query_fill(qctrl,
486 V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 508 V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
487 V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1, 509 V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1,
@@ -497,6 +519,12 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
497 case V4L2_CID_MPEG_AUDIO_L3_BITRATE: 519 case V4L2_CID_MPEG_AUDIO_L3_BITRATE:
498 return -EINVAL; 520 return -EINVAL;
499 521
522 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE:
523 return v4l2_ctrl_query_fill(qctrl,
524 V4L2_MPEG_AUDIO_AC3_BITRATE_48K,
525 V4L2_MPEG_AUDIO_AC3_BITRATE_448K, 1,
526 default_params.audio_ac3_bitrate);
527
500 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: 528 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
501 err = v4l2_ctrl_query_fill_std(qctrl); 529 err = v4l2_ctrl_query_fill_std(qctrl);
502 if (err == 0 && 530 if (err == 0 &&
@@ -671,6 +699,15 @@ const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
671 NULL 699 NULL
672 }; 700 };
673 701
702 static const char *mpeg_audio_encoding_l2_ac3[] = {
703 "",
704 "MPEG-1/2 Layer II",
705 "",
706 "",
707 "AC-3",
708 NULL
709 };
710
674 static const char *cx2341x_video_spatial_filter_mode_menu[] = { 711 static const char *cx2341x_video_spatial_filter_mode_menu[] = {
675 "Manual", 712 "Manual",
676 "Auto", 713 "Auto",
@@ -711,6 +748,9 @@ const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
711 case V4L2_CID_MPEG_STREAM_TYPE: 748 case V4L2_CID_MPEG_STREAM_TYPE:
712 return (p->capabilities & CX2341X_CAP_HAS_TS) ? 749 return (p->capabilities & CX2341X_CAP_HAS_TS) ?
713 mpeg_stream_type_with_ts : mpeg_stream_type_without_ts; 750 mpeg_stream_type_with_ts : mpeg_stream_type_without_ts;
751 case V4L2_CID_MPEG_AUDIO_ENCODING:
752 return (p->capabilities & CX2341X_CAP_HAS_AC3) ?
753 mpeg_audio_encoding_l2_ac3 : v4l2_ctrl_get_menu(id);
714 case V4L2_CID_MPEG_AUDIO_L1_BITRATE: 754 case V4L2_CID_MPEG_AUDIO_L1_BITRATE:
715 case V4L2_CID_MPEG_AUDIO_L3_BITRATE: 755 case V4L2_CID_MPEG_AUDIO_L3_BITRATE:
716 return NULL; 756 return NULL;
@@ -730,16 +770,34 @@ const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
730} 770}
731EXPORT_SYMBOL(cx2341x_ctrl_get_menu); 771EXPORT_SYMBOL(cx2341x_ctrl_get_menu);
732 772
773/* definitions for audio properties bits 29-28 */
774#define CX2341X_AUDIO_ENCDING_METHOD_MPEG 0
775#define CX2341X_AUDIO_ENCDING_METHOD_AC3 1
776#define CX2341X_AUDIO_ENCDING_METHOD_LPCM 2
777
733static void cx2341x_calc_audio_properties(struct cx2341x_mpeg_params *params) 778static void cx2341x_calc_audio_properties(struct cx2341x_mpeg_params *params)
734{ 779{
735 params->audio_properties = (params->audio_sampling_freq << 0) | 780 params->audio_properties =
736 ((3 - params->audio_encoding) << 2) | 781 (params->audio_sampling_freq << 0) |
737 ((1 + params->audio_l2_bitrate) << 4) |
738 (params->audio_mode << 8) | 782 (params->audio_mode << 8) |
739 (params->audio_mode_extension << 10) | 783 (params->audio_mode_extension << 10) |
740 (((params->audio_emphasis == V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17) 784 (((params->audio_emphasis == V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17)
741 ? 3 : params->audio_emphasis) << 12) | 785 ? 3 : params->audio_emphasis) << 12) |
742 (params->audio_crc << 14); 786 (params->audio_crc << 14);
787
788 if ((params->capabilities & CX2341X_CAP_HAS_AC3) &&
789 params->audio_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3) {
790 params->audio_properties |=
791 /* Not sure if this MPEG Layer II setting is required */
792 ((3 - V4L2_MPEG_AUDIO_ENCODING_LAYER_2) << 2) |
793 (params->audio_ac3_bitrate << 4) |
794 (CX2341X_AUDIO_ENCDING_METHOD_AC3 << 28);
795 } else {
796 /* Assuming MPEG Layer II */
797 params->audio_properties |=
798 ((3 - params->audio_encoding) << 2) |
799 ((1 + params->audio_l2_bitrate) << 4);
800 }
743} 801}
744 802
745int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, 803int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
@@ -1022,7 +1080,10 @@ void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix)
1022 prefix, 1080 prefix,
1023 cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ), 1081 cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ),
1024 cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_ENCODING), 1082 cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_ENCODING),
1025 cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_L2_BITRATE), 1083 cx2341x_menu_item(p,
1084 p->audio_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3
1085 ? V4L2_CID_MPEG_AUDIO_AC3_BITRATE
1086 : V4L2_CID_MPEG_AUDIO_L2_BITRATE),
1026 cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_MODE), 1087 cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_MODE),
1027 p->audio_mute ? " (muted)" : ""); 1088 p->audio_mute ? " (muted)" : "");
1028 if (p->audio_mode == V4L2_MPEG_AUDIO_MODE_JOINT_STEREO) 1089 if (p->audio_mode == V4L2_MPEG_AUDIO_MODE_JOINT_STEREO)
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index ce8d9b74357e..94f7f44d5989 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -696,7 +696,7 @@ struct ivtv {
696 u64 vbi_data_inserted; /* number of VBI bytes inserted into the MPEG stream */ 696 u64 vbi_data_inserted; /* number of VBI bytes inserted into the MPEG stream */
697 u32 last_dec_timing[3]; /* cache last retrieved pts/scr/frame values */ 697 u32 last_dec_timing[3]; /* cache last retrieved pts/scr/frame values */
698 unsigned long dualwatch_jiffies;/* jiffies value of the previous dualwatch check */ 698 unsigned long dualwatch_jiffies;/* jiffies value of the previous dualwatch check */
699 u16 dualwatch_stereo_mode; /* current detected dualwatch stereo mode */ 699 u32 dualwatch_stereo_mode; /* current detected dualwatch stereo mode */
700 700
701 701
702 /* VBI state info */ 702 /* VBI state info */
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index d594bc29f07f..617667d1ceba 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -148,10 +148,10 @@ void ivtv_release_stream(struct ivtv_stream *s)
148static void ivtv_dualwatch(struct ivtv *itv) 148static void ivtv_dualwatch(struct ivtv *itv)
149{ 149{
150 struct v4l2_tuner vt; 150 struct v4l2_tuner vt;
151 u16 new_bitmap; 151 u32 new_bitmap;
152 u16 new_stereo_mode; 152 u32 new_stereo_mode;
153 const u16 stereo_mask = 0x0300; 153 const u32 stereo_mask = 0x0300;
154 const u16 dual = 0x0200; 154 const u32 dual = 0x0200;
155 155
156 new_stereo_mode = itv->params.audio_properties & stereo_mask; 156 new_stereo_mode = itv->params.audio_properties & stereo_mask;
157 memset(&vt, 0, sizeof(vt)); 157 memset(&vt, 0, sizeof(vt));
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index 9ec4d5889ef5..2601bc71c51d 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -1,5 +1,5 @@
1/* 1/*
2 cx23415/6 header containing common defines. 2 cx23415/6/8 header containing common defines.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -28,6 +28,8 @@ enum cx2341x_port {
28enum cx2341x_cap { 28enum cx2341x_cap {
29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0, 29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
30 CX2341X_CAP_HAS_TS = 1 << 1, 30 CX2341X_CAP_HAS_TS = 1 << 1,
31 CX2341X_CAP_HAS_AC3 = 1 << 2,
32 CX2341X_CAP_HAS_LPCM = 1 << 3,
31}; 33};
32 34
33struct cx2341x_mpeg_params { 35struct cx2341x_mpeg_params {
@@ -47,11 +49,12 @@ struct cx2341x_mpeg_params {
47 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; 49 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
48 enum v4l2_mpeg_audio_encoding audio_encoding; 50 enum v4l2_mpeg_audio_encoding audio_encoding;
49 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate; 51 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate;
52 enum v4l2_mpeg_audio_ac3_bitrate audio_ac3_bitrate;
50 enum v4l2_mpeg_audio_mode audio_mode; 53 enum v4l2_mpeg_audio_mode audio_mode;
51 enum v4l2_mpeg_audio_mode_extension audio_mode_extension; 54 enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
52 enum v4l2_mpeg_audio_emphasis audio_emphasis; 55 enum v4l2_mpeg_audio_emphasis audio_emphasis;
53 enum v4l2_mpeg_audio_crc audio_crc; 56 enum v4l2_mpeg_audio_crc audio_crc;
54 u16 audio_properties; 57 u32 audio_properties;
55 u16 audio_mute; 58 u16 audio_mute;
56 59
57 /* video */ 60 /* video */