|
Lines 4-14
Link Here
|
| 4 |
* This file will hold API related functions, both internal (firmware api) |
4 |
* This file will hold API related functions, both internal (firmware api) |
| 5 |
* and external (v4l2, etc) |
5 |
* and external (v4l2, etc) |
| 6 |
* |
6 |
* |
|
|
7 |
* ----- |
| 8 |
* MPG600/MPG160 support by T.Adachi <tadachi@tadachi-net.com> |
| 9 |
* and Takeru KOMORIYA<komoriya@paken.org> |
| 10 |
* |
| 11 |
* AVerMedia M179 GPIO info by Chris Pinkham <cpinkham@bc2va.org> |
| 12 |
* using information provided by Jiun-Kuei Jung @ AVerMedia. |
| 7 |
*/ |
13 |
*/ |
| 8 |
|
14 |
|
| 9 |
#include "ivtv.h" |
15 |
#include "ivtv.h" |
| 10 |
#include "audiochip.h" |
16 |
#include "audiochip.h" |
| 11 |
|
17 |
|
|
|
18 |
extern struct i2c_addresses_st ivtv_i2c_addresses[]; |
| 19 |
extern struct card_function_flag_st ivtv_card_flags[]; |
| 20 |
extern struct ivtv_gpio_data_st ivtv_gpio_data[]; |
| 21 |
extern struct ivtv_msp34xx_audio_map_st ivtv_msp34xx_audio_map[]; |
| 22 |
extern struct ivtv_card_params_st ivtv_card_params[]; |
| 23 |
|
| 12 |
/* Fix the v4l2 api breakage - need to define if still using the old api */ |
24 |
/* Fix the v4l2 api breakage - need to define if still using the old api */ |
| 13 |
#ifndef VIDIOC_OVERLAY_OLD |
25 |
#ifndef VIDIOC_OVERLAY_OLD |
| 14 |
#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) |
26 |
#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) |
|
Lines 33-38
Link Here
|
| 33 |
static int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, |
45 |
static int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, |
| 34 |
unsigned int cmd, unsigned long arg); |
46 |
unsigned int cmd, unsigned long arg); |
| 35 |
static int ivtv_v4l2_pre_init(struct ivtv *itv); |
47 |
static int ivtv_v4l2_pre_init(struct ivtv *itv); |
|
|
48 |
static int ivtv_set_audio_for_msp34xx(struct ivtv *itv); |
| 49 |
static int ivtv_set_audio_for_gpio(struct ivtv *itv); |
| 36 |
|
50 |
|
| 37 |
struct file_operations ivtv_v4l2_fops = { |
51 |
struct file_operations ivtv_v4l2_fops = { |
| 38 |
owner: THIS_MODULE, |
52 |
owner: THIS_MODULE, |
|
Lines 65-71
Link Here
|
| 65 |
.index = 0, |
79 |
.index = 0, |
| 66 |
.name = "ivtv TV Tuner", |
80 |
.name = "ivtv TV Tuner", |
| 67 |
.type = V4L2_TUNER_ANALOG_TV, |
81 |
.type = V4L2_TUNER_ANALOG_TV, |
| 68 |
.capability = (V4L2_TUNER_CAP_NORM|V4L2_TUNER_CAP_STEREO), |
82 |
.capability = (V4L2_TUNER_CAP_NORM|V4L2_TUNER_CAP_STEREO |
|
|
83 |
|V4L2_TUNER_CAP_LANG1|V4L2_TUNER_CAP_LANG2), |
| 69 |
.rxsubchans = (V4L2_TUNER_SUB_STEREO), |
84 |
.rxsubchans = (V4L2_TUNER_SUB_STEREO), |
| 70 |
.audmode = V4L2_TUNER_MODE_STEREO, |
85 |
.audmode = V4L2_TUNER_MODE_STEREO, |
| 71 |
.signal = 0, |
86 |
.signal = 0, |
|
Lines 102-108
Link Here
|
| 102 |
} |
117 |
} |
| 103 |
}; |
118 |
}; |
| 104 |
|
119 |
|
| 105 |
struct v4l2_input tmk_inputs[10] = { /*values that work with the author's card */ |
120 |
struct v4l2_input tmk_pvr_inputs[10] = { /*values that work with the author's card */ |
| 106 |
{ |
121 |
{ |
| 107 |
.index = 0, |
122 |
.index = 0, |
| 108 |
.name = "Composite 0", |
123 |
.name = "Composite 0", |
|
Lines 176-181
Link Here
|
| 176 |
} |
191 |
} |
| 177 |
}; |
192 |
}; |
| 178 |
|
193 |
|
|
|
194 |
struct v4l2_input tmk_mpg_inputs[5] = { /* MPG600/MPG160/M179 */ |
| 195 |
{ |
| 196 |
.index = 0, |
| 197 |
.name = "S-Video 0", |
| 198 |
.type = V4L2_INPUT_TYPE_CAMERA, |
| 199 |
.audioset = 1, |
| 200 |
.tuner = 0, |
| 201 |
.status = 0, |
| 202 |
},{ |
| 203 |
.index = 1, |
| 204 |
.name = "N/A", |
| 205 |
.type = V4L2_INPUT_TYPE_CAMERA, |
| 206 |
.audioset = 1, |
| 207 |
.tuner = 0, |
| 208 |
.status = 0, |
| 209 |
},{ |
| 210 |
.index = 2, |
| 211 |
.name = "N/A", |
| 212 |
.type = V4L2_INPUT_TYPE_CAMERA, |
| 213 |
.audioset = 1, |
| 214 |
.tuner = 0, |
| 215 |
.status = 0, |
| 216 |
},{ |
| 217 |
.index = 3, |
| 218 |
.name = "Composite 0", |
| 219 |
.type = V4L2_INPUT_TYPE_CAMERA, |
| 220 |
.audioset = 1, |
| 221 |
.tuner = 0, |
| 222 |
.status = 0, |
| 223 |
},{ |
| 224 |
.index = 4, |
| 225 |
.name = "Tuner 0", |
| 226 |
.type = V4L2_INPUT_TYPE_TUNER, |
| 227 |
.audioset = 0, |
| 228 |
.tuner = 0, |
| 229 |
.status = 0, |
| 230 |
} |
| 231 |
}; |
| 232 |
|
| 233 |
|
| 179 |
//FIXME capability and mode might be wrong |
234 |
//FIXME capability and mode might be wrong |
| 180 |
struct v4l2_audio tmk_audio_inputs[3] = { |
235 |
struct v4l2_audio tmk_audio_inputs[3] = { |
| 181 |
{0,"Tv Tuner Audio In",0,0,}, |
236 |
{0,"Tv Tuner Audio In",0,0,}, |
|
Lines 183-195
Link Here
|
| 183 |
{2,"Radio Tuner Audio In", 0,0,}, |
238 |
{2,"Radio Tuner Audio In", 0,0,}, |
| 184 |
}; |
239 |
}; |
| 185 |
|
240 |
|
| 186 |
int tmk_audio_mapping[] = { |
|
|
| 187 |
0,3, /* Input 0 is msp input 3 */ |
| 188 |
1,1, /* input 1 is msp input 1 */ |
| 189 |
2,2, /* Input 2 is msp input 2 */ |
| 190 |
0,0 /* you're at end of list! */ |
| 191 |
}; |
| 192 |
|
| 193 |
struct v4l2_queryctrl ivtv_ctrl_menu_freq = { |
241 |
struct v4l2_queryctrl ivtv_ctrl_menu_freq = { |
| 194 |
.id = V4L2_CID_IVTV_FREQ, |
242 |
.id = V4L2_CID_IVTV_FREQ, |
| 195 |
.type = V4L2_CTRL_TYPE_MENU, |
243 |
.type = V4L2_CTRL_TYPE_MENU, |
|
Lines 211-219
Link Here
|
| 211 |
|
259 |
|
| 212 |
u32 ivtv_audio_tbl_freq[] = { |
260 |
u32 ivtv_audio_tbl_freq[] = { |
| 213 |
/* setting */ |
261 |
/* setting */ |
| 214 |
0x2 /* 32kHz binary 10 */, |
262 |
IVTV_AUDIO_32000 /* 32kHz binary 10 */, |
| 215 |
0x0 /* 44.1kHz binary 00 */, |
263 |
IVTV_AUDIO_44100 /* 44.1kHz binary 00 */, |
| 216 |
0x1 /* 48kHz binary 01 */ |
264 |
IVTV_AUDIO_48000 /* 48kHz binary 01 */ |
| 217 |
}; |
265 |
}; |
| 218 |
|
266 |
|
| 219 |
u32 ivtv_audio_mask_freq = 0x3; |
267 |
u32 ivtv_audio_mask_freq = 0x3; |
|
Lines 710-745
Link Here
|
| 710 |
/* Initialize v4l2 variables and register v4l2 device */ |
758 |
/* Initialize v4l2 variables and register v4l2 device */ |
| 711 |
int ivtv_v4l2_setup(struct ivtv *itv) { |
759 |
int ivtv_v4l2_setup(struct ivtv *itv) { |
| 712 |
int x, cont, retval; |
760 |
int x, cont, retval; |
| 713 |
|
|
|
| 714 |
IVTV_DEBUG(IVTV_DEBUG_INFO,"v4l2 setup\n"); |
| 715 |
|
761 |
|
| 716 |
//switch based on card type |
762 |
IVTV_DEBUG(IVTV_DEBUG_INFO,"v4l2 setup\n"); |
| 717 |
// and fill in appropriate v4l2 device |
763 |
/* fill in appropriate v4l2 device */ |
| 718 |
switch (itv->card_type) { |
764 |
IVTV_DEBUG(IVTV_DEBUG_INFO,"Configuring %s card\n", |
| 719 |
case IVTV_350_V1: |
765 |
ivtv_card_params[itv->card_type].card_name); |
| 720 |
IVTV_DEBUG(IVTV_DEBUG_INFO,"Configuring 350rev1 card\n"); |
766 |
itv->v4l2.streamcount = ivtv_card_params[itv->card_type].stream_count; |
| 721 |
itv->v4l2.streamcount = IVTV_350_V1_STREAMS; |
767 |
/* Disable dec yuv buffers if requested */ |
| 722 |
/* Disable dec yuv buffers if requested */ |
768 |
if (((itv->card_type == IVTV_350_V1) || (itv->card_type == IVTV_350_V2)) |
| 723 |
if (itv->options.dec_yuv_buffers == 0) itv->v4l2.streamcount--; |
769 |
&& (itv->options.dec_yuv_buffers == 0)) { |
| 724 |
itv->v4l2.capabilities = (V4L2_CAP_VIDEO_CAPTURE|V4L2_CAP_TUNER| |
770 |
itv->v4l2.streamcount--; |
| 725 |
V4L2_CAP_AUDIO|V4L2_CAP_READWRITE|V4L2_CAP_VBI_CAPTURE| |
|
|
| 726 |
V4L2_CAP_VIDEO_OUTPUT|V4L2_CAP_RADIO); |
| 727 |
break; |
| 728 |
case IVTV_250_V2: |
| 729 |
IVTV_DEBUG(IVTV_DEBUG_INFO,"Configuring 250rev2 card\n"); |
| 730 |
itv->v4l2.streamcount = IVTV_250_V2_STREAMS; |
| 731 |
itv->v4l2.capabilities = (V4L2_CAP_VIDEO_CAPTURE|V4L2_CAP_TUNER| |
| 732 |
V4L2_CAP_AUDIO|V4L2_CAP_READWRITE|V4L2_CAP_VBI_CAPTURE); |
| 733 |
break; |
| 734 |
case IVTV_250_V1: |
| 735 |
IVTV_DEBUG(IVTV_DEBUG_INFO,"Configuring 250rev1 card\n"); |
| 736 |
default: /* shouldn't happen, treat like V1 */ |
| 737 |
itv->v4l2.streamcount = IVTV_250_V1_STREAMS; |
| 738 |
itv->v4l2.capabilities = (V4L2_CAP_VIDEO_CAPTURE|V4L2_CAP_TUNER| |
| 739 |
V4L2_CAP_AUDIO|V4L2_CAP_READWRITE|V4L2_CAP_VBI_CAPTURE); |
| 740 |
|
| 741 |
break; |
| 742 |
} |
771 |
} |
|
|
772 |
itv->v4l2.capabilities = ivtv_card_params[itv->card_type].capabilities; |
| 743 |
|
773 |
|
| 744 |
/* Initial settings */ |
774 |
/* Initial settings */ |
| 745 |
itv->v4l2.codec.bitrate_mode = 0; |
775 |
itv->v4l2.codec.bitrate_mode = 0; |
|
Lines 768-774
Link Here
|
| 768 |
itv->dec_options.speed.fr_field = 1; |
798 |
itv->dec_options.speed.fr_field = 1; |
| 769 |
itv->dec_options.decbuffers = 1; |
799 |
itv->dec_options.decbuffers = 1; |
| 770 |
itv->dec_options.prebuffer = 1; |
800 |
itv->dec_options.prebuffer = 1; |
| 771 |
|
801 |
|
| 772 |
/* Allocate streams */ |
802 |
/* Allocate streams */ |
| 773 |
itv->v4l2.streams = (struct ivtv_v4l2_stream *) |
803 |
itv->v4l2.streams = (struct ivtv_v4l2_stream *) |
| 774 |
kmalloc((itv->v4l2.streamcount * |
804 |
kmalloc((itv->v4l2.streamcount * |
|
Lines 800-808
Link Here
|
| 800 |
memcpy(&itv->v4l2.streams[IVTV_ENC_STREAM_TYPE_PCM], &tmk_pcm_stream, |
830 |
memcpy(&itv->v4l2.streams[IVTV_ENC_STREAM_TYPE_PCM], &tmk_pcm_stream, |
| 801 |
sizeof(struct ivtv_v4l2_stream)); |
831 |
sizeof(struct ivtv_v4l2_stream)); |
| 802 |
|
832 |
|
| 803 |
/* Set some card-specific per-stream stuff here */ |
833 |
/* Set some card-specific per-stream stuff here */ |
| 804 |
switch (itv->card_type) { |
834 |
switch (itv->card_type) { |
| 805 |
case IVTV_350_V1: |
835 |
case IVTV_350_V1: |
|
|
836 |
case IVTV_350_V2: |
| 806 |
memcpy(&itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG], &dec_mpg_stream, |
837 |
memcpy(&itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG], &dec_mpg_stream, |
| 807 |
sizeof(struct ivtv_v4l2_stream)); |
838 |
sizeof(struct ivtv_v4l2_stream)); |
| 808 |
memcpy(&itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_VBI], &dec_vbi_stream, |
839 |
memcpy(&itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_VBI], &dec_vbi_stream, |
|
Lines 815-823
Link Here
|
| 815 |
sizeof(struct ivtv_v4l2_stream)); |
846 |
sizeof(struct ivtv_v4l2_stream)); |
| 816 |
} |
847 |
} |
| 817 |
break; |
848 |
break; |
|
|
849 |
case IVTV_MPG600: |
| 850 |
break; |
| 851 |
case IVTV_MPG160: |
| 852 |
break; |
| 853 |
case IVTV_M179: |
| 854 |
break; |
| 818 |
case IVTV_250_V2: |
855 |
case IVTV_250_V2: |
|
|
856 |
case IVTV_250_V4: |
| 819 |
break; |
857 |
break; |
| 820 |
case IVTV_250_V1: |
858 |
case IVTV_250_V1: |
|
|
859 |
case IVTV_250_V3: |
| 860 |
break; |
| 821 |
default: /* shouldn't happen, treat like V1 */ |
861 |
default: /* shouldn't happen, treat like V1 */ |
| 822 |
break; |
862 |
break; |
| 823 |
} |
863 |
} |
|
Lines 893-905
Link Here
|
| 893 |
/* Set any card-specific per-stream stuff here */ |
933 |
/* Set any card-specific per-stream stuff here */ |
| 894 |
switch (itv->card_type) { |
934 |
switch (itv->card_type) { |
| 895 |
case IVTV_350_V1: |
935 |
case IVTV_350_V1: |
|
|
936 |
case IVTV_350_V2: |
| 896 |
/* allocate buffers for decoder */ |
937 |
/* allocate buffers for decoder */ |
| 897 |
x = ivtv_init_queue(itv, |
938 |
x = ivtv_init_queue(itv, |
| 898 |
&itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG].free_q, |
939 |
&itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG].free_q, |
| 899 |
itv->options.dec_mpg_buffers, |
940 |
itv->options.dec_mpg_buffers, |
| 900 |
itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG].format.type); |
941 |
itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG].format.type); |
| 901 |
|
942 |
|
| 902 |
itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG].v4l2dev->minor = |
943 |
itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG].v4l2dev->minor = |
| 903 |
itv->num + IVTV_V4L2_DEC_OFFSET; |
944 |
itv->num + IVTV_V4L2_DEC_OFFSET; |
| 904 |
set_bit(IVTV_F_S_UNINIT, &itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG].s_flags); |
945 |
set_bit(IVTV_F_S_UNINIT, &itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_MPG].s_flags); |
| 905 |
|
946 |
|
|
Lines 924-932
Link Here
|
| 924 |
x = ivtv_init_queue(itv, |
965 |
x = ivtv_init_queue(itv, |
| 925 |
&itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_YUV].free_q, |
966 |
&itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_YUV].free_q, |
| 926 |
itv->options.dec_yuv_buffers, |
967 |
itv->options.dec_yuv_buffers, |
| 927 |
itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_YUV].format.type); |
968 |
itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_YUV].format.type); |
| 928 |
|
969 |
|
| 929 |
itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_YUV].v4l2dev->minor = |
970 |
itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_YUV].v4l2dev->minor = |
| 930 |
itv->num + IVTV_V4L2_YUV_OFFSET + IVTV_V4L2_DEC_OFFSET; |
971 |
itv->num + IVTV_V4L2_YUV_OFFSET + IVTV_V4L2_DEC_OFFSET; |
| 931 |
set_bit(IVTV_F_S_UNINIT, &itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_YUV].s_flags); |
972 |
set_bit(IVTV_F_S_UNINIT, &itv->v4l2.streams[IVTV_DEC_STREAM_TYPE_YUV].s_flags); |
| 932 |
} |
973 |
} |
|
Lines 938-945
Link Here
|
| 938 |
|
979 |
|
| 939 |
break; |
980 |
break; |
| 940 |
case IVTV_250_V2: |
981 |
case IVTV_250_V2: |
|
|
982 |
case IVTV_250_V4: |
| 941 |
break; |
983 |
break; |
| 942 |
case IVTV_250_V1: |
984 |
case IVTV_250_V1: |
|
|
985 |
case IVTV_250_V3: |
| 986 |
break; |
| 943 |
default: /* shouldn't happen, treat like V1 */ |
987 |
default: /* shouldn't happen, treat like V1 */ |
| 944 |
break; |
988 |
break; |
| 945 |
} |
989 |
} |
|
Lines 991-1016
Link Here
|
| 991 |
|
1035 |
|
| 992 |
/* After setting the audio.active param, call this to |
1036 |
/* After setting the audio.active param, call this to |
| 993 |
* get the right input.. think of it as a resolver */ |
1037 |
* get the right input.. think of it as a resolver */ |
| 994 |
int ivtv_set_audio(struct ivtv *itv, int *map) { |
1038 |
int ivtv_set_audio(struct ivtv *itv) { |
| 995 |
int input,msp_input; |
1039 |
switch (ivtv_card_flags[itv->card_type].audio_selector) { |
| 996 |
struct msp_matrix mspm; |
1040 |
case USE_MSP34XX: |
|
|
1041 |
return ivtv_set_audio_for_msp34xx(itv); |
| 1042 |
case USE_GPIO: |
| 1043 |
return ivtv_set_audio_for_gpio(itv); |
| 1044 |
} |
| 997 |
|
1045 |
|
| 998 |
do { |
1046 |
IVTV_DEBUG(IVTV_DEBUG_ERR,"Invalid card type [ivtv_set_audio]!\n"); |
| 999 |
input = *(map++); |
1047 |
return -EINVAL; |
| 1000 |
msp_input = *(map++); |
1048 |
} |
| 1001 |
if (input == itv->v4l2.audio.active) { |
1049 |
|
| 1002 |
IVTV_DEBUG(IVTV_DEBUG_INFO, |
1050 |
/* switching audio input for WIN-PVR250/350 and MSP34XX based card */ |
| 1003 |
"Setting audio to input %d\n", msp_input); |
1051 |
static int ivtv_set_audio_for_msp34xx(struct ivtv *itv) |
| 1004 |
mspm.input = msp_input; |
1052 |
{ |
| 1005 |
mspm.output = itv->v4l2.audio_output; |
1053 |
struct msp_matrix mspm; |
| 1006 |
|
1054 |
|
| 1007 |
ivtv_call_i2c_client(itv, |
1055 |
if (itv->v4l2.audio.active <= 1) { |
| 1008 |
IVTV_MSP3400_I2C_ADDR, |
1056 |
IVTV_DEBUG(IVTV_DEBUG_INFO, |
| 1009 |
MSP_SET_MATRIX, |
1057 |
"Setting audio to input %d\n", itv->v4l2.audio.active); |
| 1010 |
&mspm); |
1058 |
mspm.output = itv->v4l2.audio_output; |
| 1011 |
return 0; |
1059 |
switch (itv->v4l2.audio.active) { |
|
|
1060 |
case 0: /* Tuner Audio */ |
| 1061 |
mspm.input = ivtv_msp34xx_audio_map[itv->card_type].tuner; |
| 1062 |
break; |
| 1063 |
case 1: /* Audio-In (Line-in) */ |
| 1064 |
mspm.input = ivtv_msp34xx_audio_map[itv->card_type].line; |
| 1065 |
break; |
| 1012 |
} |
1066 |
} |
| 1013 |
} while ((msp_input !=0) || (input != 0)); |
1067 |
ivtv_call_i2c_client(itv, |
|
|
1068 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 1069 |
MSP_SET_MATRIX, |
| 1070 |
&mspm); |
| 1071 |
return 0; |
| 1072 |
} |
| 1073 |
|
| 1074 |
IVTV_DEBUG(IVTV_DEBUG_ERR,"Invalid audio input, shouldn't happen!\n"); |
| 1075 |
|
| 1076 |
return -EINVAL; |
| 1077 |
} |
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
|
| 1082 |
/* switching audio input for MPG600/MPG160/M179 (controlled by GPIO) */ |
| 1083 |
static int ivtv_set_audio_for_gpio(struct ivtv *itv) |
| 1084 |
{ |
| 1085 |
if (itv->v4l2.audio.active <= 1) { |
| 1086 |
IVTV_DEBUG(IVTV_DEBUG_INFO, |
| 1087 |
"Setting audio to input %d\n", itv->v4l2.audio.active); |
| 1088 |
switch (itv->v4l2.audio.active) { |
| 1089 |
case 0: /* Tuner Audio */ |
| 1090 |
ivtv_set_gpio_audio(itv,IVTV_GPIO_AUDIO_TUNER); |
| 1091 |
break; |
| 1092 |
case 1: /* Audio-In (Line-in) */ |
| 1093 |
ivtv_set_gpio_audio(itv,IVTV_GPIO_AUDIO_LINE); |
| 1094 |
break;; |
| 1095 |
} |
| 1096 |
ivtv_set_gpio_audio(itv,IVTV_GPIO_AUDIO_UNMUTE); |
| 1097 |
return 0; |
| 1098 |
} |
| 1014 |
|
1099 |
|
| 1015 |
IVTV_DEBUG(IVTV_DEBUG_ERR,"Invalid audio input, shouldn't happen!\n"); |
1100 |
IVTV_DEBUG(IVTV_DEBUG_ERR,"Invalid audio input, shouldn't happen!\n"); |
| 1016 |
|
1101 |
|
|
Lines 1067-1075
Link Here
|
| 1067 |
|
1152 |
|
| 1068 |
/* FIXME too much hardcoding? */ |
1153 |
/* FIXME too much hardcoding? */ |
| 1069 |
//inputs |
1154 |
//inputs |
| 1070 |
itv->v4l2.input.active = 4; |
1155 |
if ((itv->card_type == IVTV_MPG600) |
| 1071 |
itv->v4l2.input.count = 10; |
1156 |
||(itv->card_type == IVTV_MPG160) |
| 1072 |
itv->v4l2.input.table.input = tmk_inputs; |
1157 |
||(itv->card_type == IVTV_M179)) { |
|
|
1158 |
itv->v4l2.input.active = 4; |
| 1159 |
itv->v4l2.input.count = 5; |
| 1160 |
itv->v4l2.input.table.input = tmk_mpg_inputs; |
| 1161 |
} else { |
| 1162 |
itv->v4l2.input.active = 4; |
| 1163 |
itv->v4l2.input.count = 10; |
| 1164 |
itv->v4l2.input.table.input = tmk_pvr_inputs; |
| 1165 |
} |
| 1073 |
|
1166 |
|
| 1074 |
itv->v4l2.audio_output = 1; |
1167 |
itv->v4l2.audio_output = 1; |
| 1075 |
|
1168 |
|
|
Lines 1205-1211
Link Here
|
| 1205 |
itv->v4l2.audio_meta[x].table[temp]; |
1298 |
itv->v4l2.audio_meta[x].table[temp]; |
| 1206 |
} |
1299 |
} |
| 1207 |
|
1300 |
|
| 1208 |
retval = ivtv_set_audio(itv,tmk_audio_mapping); |
1301 |
retval = ivtv_set_audio(itv); |
| 1209 |
if (retval) { |
1302 |
if (retval) { |
| 1210 |
kfree(itv->v4l2.tuner.table.tuner); |
1303 |
kfree(itv->v4l2.tuner.table.tuner); |
| 1211 |
return retval; |
1304 |
return retval; |
|
Lines 1220-1228
Link Here
|
| 1220 |
struct msp_matrix mspm; |
1313 |
struct msp_matrix mspm; |
| 1221 |
|
1314 |
|
| 1222 |
/* Mute sound to avoid pop */ |
1315 |
/* Mute sound to avoid pop */ |
| 1223 |
mspm.input = 8; |
1316 |
switch (ivtv_card_flags[itv->card_type].audio_selector) { |
| 1224 |
mspm.output = itv->v4l2.audio_output; |
1317 |
case USE_MSP34XX: |
| 1225 |
ivtv_call_i2c_client(itv,IVTV_MSP3400_I2C_ADDR,MSP_SET_MATRIX,&mspm); |
1318 |
mspm.input = 8; |
|
|
1319 |
mspm.output = itv->v4l2.audio_output; |
| 1320 |
ivtv_call_i2c_client(itv, |
| 1321 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 1322 |
MSP_SET_MATRIX,&mspm); |
| 1323 |
break; |
| 1324 |
case USE_GPIO: |
| 1325 |
ivtv_set_gpio_audio(itv,IVTV_GPIO_AUDIO_MUTE); |
| 1326 |
break; |
| 1327 |
} |
| 1226 |
|
1328 |
|
| 1227 |
if (0 != ivtv_pause_encoder(itv, 0)) |
1329 |
if (0 != ivtv_pause_encoder(itv, 0)) |
| 1228 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "Mute: Error pausing stream\n"); |
1330 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "Mute: Error pausing stream\n"); |
|
Lines 1237-1243
Link Here
|
| 1237 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "Unmute: Error unpausing stream\n"); |
1339 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "Unmute: Error unpausing stream\n"); |
| 1238 |
|
1340 |
|
| 1239 |
/* Unmute */ |
1341 |
/* Unmute */ |
| 1240 |
ivtv_set_audio(itv,tmk_audio_mapping); |
1342 |
ivtv_set_audio(itv); |
| 1241 |
} |
1343 |
} |
| 1242 |
|
1344 |
|
| 1243 |
static void ivtv_select_vbi_line(struct ivtv *itv, unsigned long line, int enable, int slicing) |
1345 |
static void ivtv_select_vbi_line(struct ivtv *itv, unsigned long line, int enable, int slicing) |
|
Lines 1483-1489
Link Here
|
| 1483 |
/* Disable digitizer (saa7115) */ |
1585 |
/* Disable digitizer (saa7115) */ |
| 1484 |
IVTV_DEBUG(IVTV_DEBUG_INFO, "Disabling digitizer\n"); |
1586 |
IVTV_DEBUG(IVTV_DEBUG_INFO, "Disabling digitizer\n"); |
| 1485 |
dig=0; |
1587 |
dig=0; |
| 1486 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR, |
1588 |
ivtv_call_i2c_client(itv, |
|
|
1589 |
ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
| 1487 |
DECODER_ENABLE_OUTPUT,&dig); |
1590 |
DECODER_ENABLE_OUTPUT,&dig); |
| 1488 |
// setup VBI registers |
1591 |
// setup VBI registers |
| 1489 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR, |
1592 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR, |
|
Lines 1598-1604
Link Here
|
| 1598 |
/* enable digitizer (saa7115) */ |
1701 |
/* enable digitizer (saa7115) */ |
| 1599 |
IVTV_DEBUG(IVTV_DEBUG_INFO, "Enabling digitizer\n"); |
1702 |
IVTV_DEBUG(IVTV_DEBUG_INFO, "Enabling digitizer\n"); |
| 1600 |
dig=1; |
1703 |
dig=1; |
| 1601 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR, |
1704 |
ivtv_call_i2c_client(itv, |
|
|
1705 |
ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
| 1602 |
DECODER_ENABLE_OUTPUT,&dig); |
1706 |
DECODER_ENABLE_OUTPUT,&dig); |
| 1603 |
|
1707 |
|
| 1604 |
IVTV_DEBUG(IVTV_DEBUG_INFO, "Sleeping for 100ms\n"); |
1708 |
IVTV_DEBUG(IVTV_DEBUG_INFO, "Sleeping for 100ms\n"); |
|
Lines 2189-2201
Link Here
|
| 2189 |
case SAA7115_GET_REG: { |
2293 |
case SAA7115_GET_REG: { |
| 2190 |
struct saa7115_reg_t *saa7115_reg = (struct saa7115_reg_t *)arg; |
2294 |
struct saa7115_reg_t *saa7115_reg = (struct saa7115_reg_t *)arg; |
| 2191 |
|
2295 |
|
| 2192 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,SAA7115_GET_REG,saa7115_reg); |
2296 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2297 |
SAA7115_GET_REG,saa7115_reg); |
| 2193 |
break; |
2298 |
break; |
| 2194 |
} |
2299 |
} |
| 2195 |
case SAA7115_SET_REG: { |
2300 |
case SAA7115_SET_REG: { |
| 2196 |
struct saa7115_reg_t *saa7115_reg = (struct saa7115_reg_t *)arg; |
2301 |
struct saa7115_reg_t *saa7115_reg = (struct saa7115_reg_t *)arg; |
| 2197 |
|
2302 |
|
| 2198 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,SAA7115_SET_REG,saa7115_reg); |
2303 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2304 |
SAA7115_SET_REG,saa7115_reg); |
| 2199 |
break; |
2305 |
break; |
| 2200 |
} |
2306 |
} |
| 2201 |
#endif |
2307 |
#endif |
|
Lines 2727-2733
Link Here
|
| 2727 |
int vrate = (int)v; |
2833 |
int vrate = (int)v; |
| 2728 |
/* FIXME not obvious how this works |
2834 |
/* FIXME not obvious how this works |
| 2729 |
* (see ivtv_ctrl_query_freq[]) */ |
2835 |
* (see ivtv_ctrl_query_freq[]) */ |
| 2730 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_SET_AUDIO,&vrate); |
2836 |
ivtv_call_i2c_client(itv, |
|
|
2837 |
ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
| 2838 |
DECODER_SET_AUDIO,&vrate); |
| 2731 |
} |
2839 |
} |
| 2732 |
} else { |
2840 |
} else { |
| 2733 |
IVTV_DEBUG(IVTV_DEBUG_ERR, |
2841 |
IVTV_DEBUG(IVTV_DEBUG_ERR, |
|
Lines 2782-2790
Link Here
|
| 2782 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid brightness value: %d\n", vctrl->value); |
2890 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid brightness value: %d\n", vctrl->value); |
| 2783 |
return -EINVAL; |
2891 |
return -EINVAL; |
| 2784 |
} |
2892 |
} |
| 2785 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_GET_PICTURE,&pic); |
2893 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2894 |
DECODER_GET_PICTURE,&pic); |
| 2786 |
pic.bright = vctrl->value; |
2895 |
pic.bright = vctrl->value; |
| 2787 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_SET_PICTURE,&pic); |
2896 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2897 |
DECODER_SET_PICTURE,&pic); |
| 2788 |
break; |
2898 |
break; |
| 2789 |
} |
2899 |
} |
| 2790 |
case V4L2_CID_HUE: { |
2900 |
case V4L2_CID_HUE: { |
|
Lines 2794-2802
Link Here
|
| 2794 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid hue value: %d\n", vctrl->value); |
2904 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid hue value: %d\n", vctrl->value); |
| 2795 |
return -EINVAL; |
2905 |
return -EINVAL; |
| 2796 |
} |
2906 |
} |
| 2797 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_GET_PICTURE,&pic); |
2907 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2908 |
DECODER_GET_PICTURE,&pic); |
| 2798 |
pic.hue = vctrl->value; |
2909 |
pic.hue = vctrl->value; |
| 2799 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_SET_PICTURE,&pic); |
2910 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2911 |
DECODER_SET_PICTURE,&pic); |
| 2800 |
break; |
2912 |
break; |
| 2801 |
} |
2913 |
} |
| 2802 |
case V4L2_CID_SATURATION: { |
2914 |
case V4L2_CID_SATURATION: { |
|
Lines 2806-2814
Link Here
|
| 2806 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid saturation value: %d\n", vctrl->value); |
2918 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid saturation value: %d\n", vctrl->value); |
| 2807 |
return -EINVAL; |
2919 |
return -EINVAL; |
| 2808 |
} |
2920 |
} |
| 2809 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_GET_PICTURE,&pic); |
2921 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2922 |
DECODER_GET_PICTURE,&pic); |
| 2810 |
pic.sat = vctrl->value; |
2923 |
pic.sat = vctrl->value; |
| 2811 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_SET_PICTURE,&pic); |
2924 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2925 |
DECODER_SET_PICTURE,&pic); |
| 2812 |
break; |
2926 |
break; |
| 2813 |
} |
2927 |
} |
| 2814 |
case V4L2_CID_CONTRAST: { |
2928 |
case V4L2_CID_CONTRAST: { |
|
Lines 2818-2826
Link Here
|
| 2818 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid contrast value: %d\n", vctrl->value); |
2932 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid contrast value: %d\n", vctrl->value); |
| 2819 |
return -EINVAL; |
2933 |
return -EINVAL; |
| 2820 |
} |
2934 |
} |
| 2821 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_GET_PICTURE,&pic); |
2935 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2936 |
DECODER_GET_PICTURE,&pic); |
| 2822 |
pic.contrast = vctrl->value; |
2937 |
pic.contrast = vctrl->value; |
| 2823 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_SET_PICTURE,&pic); |
2938 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
2939 |
DECODER_SET_PICTURE,&pic); |
| 2824 |
break; |
2940 |
break; |
| 2825 |
} |
2941 |
} |
| 2826 |
case V4L2_CID_AUDIO_VOLUME: { |
2942 |
case V4L2_CID_AUDIO_VOLUME: { |
|
Lines 2830-2850
Link Here
|
| 2830 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid value for volume: %d", vctrl->value); |
2946 |
IVTV_DEBUG(IVTV_DEBUG_ERR, "ctrl: invalid value for volume: %d", vctrl->value); |
| 2831 |
return -EINVAL; |
2947 |
return -EINVAL; |
| 2832 |
} |
2948 |
} |
| 2833 |
ivtv_call_i2c_client(itv,IVTV_MSP3400_I2C_ADDR,VIDIOCGAUDIO,&va); |
2949 |
switch (ivtv_card_flags[itv->card_type].audio_selector) |
| 2834 |
va.volume = vctrl->value; |
2950 |
{ |
| 2835 |
va.mode = 0; /* keep stereo mode at automatic stereo detection */ |
2951 |
case USE_MSP34XX: |
| 2836 |
ivtv_call_i2c_client(itv,IVTV_MSP3400_I2C_ADDR,VIDIOCSAUDIO,&va); |
2952 |
ivtv_call_i2c_client(itv, |
|
|
2953 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 2954 |
VIDIOCGAUDIO,&va); |
| 2955 |
va.volume = vctrl->value; |
| 2956 |
va.mode = 0; /* keep stereo mode at automatic stereo detection */ |
| 2957 |
ivtv_call_i2c_client(itv, |
| 2958 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 2959 |
VIDIOCSAUDIO,&va); |
| 2960 |
break; |
| 2961 |
case USE_GPIO: |
| 2962 |
/* do nothing (MPG600 etc) */ |
| 2963 |
break; |
| 2964 |
} |
| 2965 |
|
| 2837 |
break; |
2966 |
break; |
| 2838 |
} |
2967 |
} |
| 2839 |
case V4L2_CID_AUDIO_MUTE: { |
2968 |
case V4L2_CID_AUDIO_MUTE: { |
| 2840 |
struct video_audio va; |
2969 |
struct video_audio va; |
| 2841 |
ivtv_call_i2c_client(itv,IVTV_MSP3400_I2C_ADDR,VIDIOCGAUDIO,&va); |
2970 |
switch (ivtv_card_flags[itv->card_type].audio_selector) { |
| 2842 |
if (vctrl->value) |
2971 |
case USE_MSP34XX: |
| 2843 |
va.flags |= VIDEO_AUDIO_MUTE; |
2972 |
ivtv_call_i2c_client(itv, |
| 2844 |
else |
2973 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 2845 |
va.flags = (va.flags & ~(VIDEO_AUDIO_MUTE)); |
2974 |
VIDIOCGAUDIO,&va); |
| 2846 |
va.mode = 0; /* keep stereo mode at automatic stereo detection */ |
2975 |
if (vctrl->value) |
| 2847 |
ivtv_call_i2c_client(itv,IVTV_MSP3400_I2C_ADDR,VIDIOCSAUDIO,&va); |
2976 |
va.flags |= VIDEO_AUDIO_MUTE; |
|
|
2977 |
else |
| 2978 |
va.flags = (va.flags & ~(VIDEO_AUDIO_MUTE)); |
| 2979 |
va.mode = 0; /* keep stereo mode at automatic stereo detection */ |
| 2980 |
ivtv_call_i2c_client(itv, |
| 2981 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 2982 |
VIDIOCSAUDIO,&va); |
| 2983 |
break; |
| 2984 |
case USE_GPIO: |
| 2985 |
if (vctrl->value) { |
| 2986 |
va.flags |= VIDEO_AUDIO_MUTE; |
| 2987 |
ivtv_set_gpio_audio(itv,IVTV_GPIO_AUDIO_MUTE); |
| 2988 |
} else { |
| 2989 |
va.flags = (va.flags & ~(VIDEO_AUDIO_MUTE)); |
| 2990 |
ivtv_set_gpio_audio(itv,IVTV_GPIO_AUDIO_UNMUTE); |
| 2991 |
} |
| 2992 |
break; |
| 2993 |
} |
| 2994 |
|
| 2848 |
break; |
2995 |
break; |
| 2849 |
} |
2996 |
} |
| 2850 |
default: |
2997 |
default: |
|
Lines 2900-2936
Link Here
|
| 2900 |
switch (vctrl->id) { |
3047 |
switch (vctrl->id) { |
| 2901 |
case V4L2_CID_BRIGHTNESS: { |
3048 |
case V4L2_CID_BRIGHTNESS: { |
| 2902 |
struct saa7114 pic; |
3049 |
struct saa7114 pic; |
| 2903 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_GET_PICTURE,&pic); |
3050 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
3051 |
DECODER_GET_PICTURE,&pic); |
| 2904 |
vctrl->value = pic.bright; |
3052 |
vctrl->value = pic.bright; |
| 2905 |
break; |
3053 |
break; |
| 2906 |
} |
3054 |
} |
| 2907 |
case V4L2_CID_HUE: { |
3055 |
case V4L2_CID_HUE: { |
| 2908 |
struct saa7114 pic; |
3056 |
struct saa7114 pic; |
| 2909 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_GET_PICTURE,&pic); |
3057 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
3058 |
DECODER_GET_PICTURE,&pic); |
| 2910 |
vctrl->value = pic.hue; |
3059 |
vctrl->value = pic.hue; |
| 2911 |
break; |
3060 |
break; |
| 2912 |
} |
3061 |
} |
| 2913 |
case V4L2_CID_SATURATION: { |
3062 |
case V4L2_CID_SATURATION: { |
| 2914 |
struct saa7114 pic; |
3063 |
struct saa7114 pic; |
| 2915 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_GET_PICTURE,&pic); |
3064 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
3065 |
DECODER_GET_PICTURE,&pic); |
| 2916 |
vctrl->value = pic.sat; |
3066 |
vctrl->value = pic.sat; |
| 2917 |
break; |
3067 |
break; |
| 2918 |
} |
3068 |
} |
| 2919 |
case V4L2_CID_CONTRAST: { |
3069 |
case V4L2_CID_CONTRAST: { |
| 2920 |
struct saa7114 pic; |
3070 |
struct saa7114 pic; |
| 2921 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR,DECODER_GET_PICTURE,&pic); |
3071 |
ivtv_call_i2c_client(itv,ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
3072 |
DECODER_GET_PICTURE,&pic); |
| 2922 |
vctrl->value = pic.contrast; |
3073 |
vctrl->value = pic.contrast; |
| 2923 |
break; |
3074 |
break; |
| 2924 |
} |
3075 |
} |
| 2925 |
case V4L2_CID_AUDIO_VOLUME: { |
3076 |
case V4L2_CID_AUDIO_VOLUME: { |
| 2926 |
struct video_audio va; |
3077 |
struct video_audio va; |
| 2927 |
ivtv_call_i2c_client(itv,IVTV_MSP3400_I2C_ADDR,VIDIOCGAUDIO,&va); |
3078 |
switch (ivtv_card_flags[itv->card_type].audio_selector) { |
|
|
3079 |
case USE_MSP34XX: |
| 3080 |
ivtv_call_i2c_client(itv, |
| 3081 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 3082 |
VIDIOCGAUDIO,&va); |
| 3083 |
break; |
| 3084 |
case USE_GPIO: |
| 3085 |
if (ivtv_card_flags[itv->card_type].vol_control) { |
| 3086 |
/* if you can control VOLUME, write code here */ |
| 3087 |
} else { |
| 3088 |
/* do nothing (MPG600 etc) */ |
| 3089 |
va.volume = 65535; /* dummy code */ |
| 3090 |
} |
| 3091 |
break; |
| 3092 |
} |
| 2928 |
vctrl->value = va.volume; |
3093 |
vctrl->value = va.volume; |
| 2929 |
break; |
3094 |
break; |
| 2930 |
} |
3095 |
} |
| 2931 |
case V4L2_CID_AUDIO_MUTE: { |
3096 |
case V4L2_CID_AUDIO_MUTE: { |
| 2932 |
struct video_audio va; |
3097 |
struct video_audio va; |
| 2933 |
ivtv_call_i2c_client(itv,IVTV_MSP3400_I2C_ADDR,VIDIOCGAUDIO,&va); |
3098 |
switch (ivtv_card_flags[itv->card_type].audio_selector) { |
|
|
3099 |
case USE_MSP34XX: |
| 3100 |
ivtv_call_i2c_client(itv, |
| 3101 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 3102 |
VIDIOCGAUDIO,&va); |
| 3103 |
break; |
| 3104 |
case USE_GPIO: |
| 3105 |
if (ivtv_card_flags[itv->card_type].vol_control) { |
| 3106 |
/* if you can control VOLUME, write code here */ |
| 3107 |
} else { |
| 3108 |
/* MPG600 etc */ |
| 3109 |
va.flags = 0; |
| 3110 |
if (ivtv_get_gpio_audio(itv,IVTV_GPIO_AUDIO_MUTE)) |
| 3111 |
va.flags = VIDEO_AUDIO_MUTE; |
| 3112 |
} |
| 3113 |
break; |
| 3114 |
} |
| 2934 |
vctrl->value = (va.flags & VIDEO_AUDIO_MUTE); |
3115 |
vctrl->value = (va.flags & VIDEO_AUDIO_MUTE); |
| 2935 |
break; |
3116 |
break; |
| 2936 |
} |
3117 |
} |
|
Lines 3035-3041
Link Here
|
| 3035 |
/* FIXME only sets resolution for now */ |
3216 |
/* FIXME only sets resolution for now */ |
| 3036 |
wind.width = vfmt->fmt.pix.width; |
3217 |
wind.width = vfmt->fmt.pix.width; |
| 3037 |
wind.height = vfmt->fmt.pix.height; |
3218 |
wind.height = vfmt->fmt.pix.height; |
| 3038 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR, |
3219 |
ivtv_call_i2c_client(itv, |
|
|
3220 |
ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
| 3039 |
DECODER_SET_SIZE,&wind); |
3221 |
DECODER_SET_SIZE,&wind); |
| 3040 |
|
3222 |
|
| 3041 |
/* FIXME switch on stream type, bounds checking */ |
3223 |
/* FIXME switch on stream type, bounds checking */ |
|
Lines 3166-3179
Link Here
|
| 3166 |
|
3348 |
|
| 3167 |
/* Tuner */ |
3349 |
/* Tuner */ |
| 3168 |
ivtv_call_i2c_client(itv, |
3350 |
ivtv_call_i2c_client(itv, |
| 3169 |
IVTV_TUNER_I2C_ADDR, |
3351 |
ivtv_i2c_addresses[itv->card_type].tuner_addr, |
| 3170 |
VIDIOCSCHAN,&v); |
3352 |
VIDIOCSCHAN,&v); |
|
|
3353 |
|
| 3171 |
/* Tuner Audio */ |
3354 |
/* Tuner Audio */ |
| 3172 |
ivtv_call_i2c_client(itv, |
3355 |
switch (ivtv_card_flags[itv->card_type].audio_selector) { |
| 3173 |
IVTV_MSP3400_I2C_ADDR, |
3356 |
case USE_MSP34XX: |
| 3174 |
VIDIOCSCHAN,&v); |
3357 |
ivtv_call_i2c_client(itv, |
|
|
3358 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 3359 |
VIDIOCSCHAN,&v); |
| 3360 |
break; |
| 3361 |
case USE_GPIO: |
| 3362 |
ivtv_set_gpio_audio(itv,IVTV_GPIO_AUDIO_TUNER); |
| 3363 |
break; |
| 3364 |
} |
| 3365 |
|
| 3175 |
/* Digitizer */ |
3366 |
/* Digitizer */ |
| 3176 |
ivtv_call_i2c_client(itv,IVTV_SAA7115_I2C_ADDR, |
3367 |
ivtv_call_i2c_client(itv, |
|
|
3368 |
ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
| 3177 |
DECODER_SET_NORM,&v.norm); |
3369 |
DECODER_SET_NORM,&v.norm); |
| 3178 |
|
3370 |
|
| 3179 |
if (itv->v4l2.standard.active == 0) { // NTSC |
3371 |
if (itv->v4l2.standard.active == 0) { // NTSC |
|
Lines 3197-3205
Link Here
|
| 3197 |
|
3389 |
|
| 3198 |
if ((vt->index < 0) || (vt->index >= itv->v4l2.tuner.count)) |
3390 |
if ((vt->index < 0) || (vt->index >= itv->v4l2.tuner.count)) |
| 3199 |
return -EINVAL; |
3391 |
return -EINVAL; |
| 3200 |
/* looks like tuner.c doesn't support selection |
3392 |
if ((itv->card_type == IVTV_MPG600) |
| 3201 |
* fallback to stereo... */ |
3393 |
||(itv->card_type == IVTV_MPG160) |
| 3202 |
vt->audmode = V4L2_TUNER_MODE_STEREO; |
3394 |
||(itv->card_type == IVTV_M179)) { |
|
|
3395 |
ivtv_set_gpio_audiomode(itv,vt->audmode); |
| 3396 |
} else { |
| 3397 |
/* looks like tuner.c doesn't support selection |
| 3398 |
* fallback to stereo... */ |
| 3399 |
vt->audmode = V4L2_TUNER_MODE_STEREO; |
| 3400 |
} |
| 3203 |
|
3401 |
|
| 3204 |
break; |
3402 |
break; |
| 3205 |
} |
3403 |
} |
|
Lines 3241-3272
Link Here
|
| 3241 |
else { |
3439 |
else { |
| 3242 |
vt->signal = 0; |
3440 |
vt->signal = 0; |
| 3243 |
} |
3441 |
} |
| 3244 |
} |
3442 |
} |
|
|
3443 |
|
| 3444 |
if ((itv->card_type == IVTV_MPG600) |
| 3445 |
||(itv->card_type == IVTV_MPG160)) { |
| 3446 |
/* MPGxxx can read tuner audio status */ |
| 3447 |
switch (ivtv_get_gpio_audiomode(itv)) { |
| 3448 |
case 0: /* mono */ |
| 3449 |
vt->rxsubchans = V4L2_TUNER_SUB_MONO; |
| 3450 |
break; |
| 3451 |
case 1: /* stereo */ |
| 3452 |
if ((vt->audmode == V4L2_TUNER_MODE_STEREO) |
| 3453 |
|| (vt->audmode == V4L2_TUNER_MODE_LANG1)) |
| 3454 |
vt->rxsubchans = V4L2_TUNER_SUB_STEREO; |
| 3455 |
else |
| 3456 |
vt->rxsubchans = V4L2_TUNER_SUB_MONO; |
| 3457 |
break; |
| 3458 |
case 2: /* multiplex */ |
| 3459 |
if (vt->audmode == V4L2_TUNER_MODE_LANG2) |
| 3460 |
vt->rxsubchans = V4L2_TUNER_SUB_LANG2 | V4L2_TUNER_SUB_MONO; |
| 3461 |
else |
| 3462 |
vt->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_MONO; |
| 3463 |
break; |
| 3464 |
} |
| 3465 |
} |
| 3466 |
|
| 3245 |
break; |
3467 |
break; |
| 3246 |
} |
3468 |
} |
| 3247 |
case MSP_SET_MATRIX: { |
3469 |
case MSP_SET_MATRIX: { |
| 3248 |
//FIXME copy_from_user needed |
3470 |
//FIXME copy_from_user needed |
| 3249 |
struct msp_matrix *mspm = (struct msp_matrix *)arg; |
3471 |
struct msp_matrix *mspm = (struct msp_matrix *)arg; |
| 3250 |
|
3472 |
|
| 3251 |
/* FIXME hardcoding! */ |
3473 |
switch (ivtv_card_flags[itv->card_type].audio_selector) { |
| 3252 |
if ((mspm->input < 1) || (mspm->input > 8)) { |
3474 |
case USE_MSP34XX: |
| 3253 |
IVTV_DEBUG(IVTV_DEBUG_ERR,"Invalid audio input!\n"); |
3475 |
/* FIXME hardcoding! */ |
| 3254 |
return -EINVAL; |
3476 |
if ((mspm->input < 1) || (mspm->input > 8)) { |
| 3255 |
} |
3477 |
IVTV_DEBUG(IVTV_DEBUG_ERR,"Invalid audio input!\n"); |
| 3256 |
if ((mspm->output < 0) || (mspm->output >= 3)) { |
3478 |
return -EINVAL; |
| 3257 |
IVTV_DEBUG(IVTV_DEBUG_ERR,"Invalid audio output!\n"); |
3479 |
} |
| 3258 |
return -EINVAL; |
3480 |
if ((mspm->output < 0) || (mspm->output > 3)) { |
| 3259 |
} |
3481 |
IVTV_DEBUG(IVTV_DEBUG_ERR,"Invalid audio output!\n"); |
| 3260 |
|
3482 |
return -EINVAL; |
| 3261 |
itv->v4l2.audio_output = mspm->output; |
3483 |
} |
| 3262 |
|
3484 |
itv->v4l2.audio_output = mspm->output; |
| 3263 |
IVTV_DEBUG(IVTV_DEBUG_INFO, |
3485 |
|
| 3264 |
"v4l2 ioctl: set matrix in=%d,out=%d\n", |
3486 |
IVTV_DEBUG(IVTV_DEBUG_INFO, |
| 3265 |
mspm->input, |
3487 |
"v4l2 ioctl: set matrix in=%d,out=%d\n", |
| 3266 |
mspm->output); |
3488 |
mspm->input, |
| 3267 |
|
3489 |
mspm->output); |
| 3268 |
ivtv_call_i2c_client(itv,IVTV_MSP3400_I2C_ADDR,MSP_SET_MATRIX, mspm); |
3490 |
|
| 3269 |
break; |
3491 |
ivtv_call_i2c_client(itv, |
|
|
3492 |
ivtv_i2c_addresses[itv->card_type].msp34xx_addr, |
| 3493 |
MSP_SET_MATRIX, mspm); |
| 3494 |
break; |
| 3495 |
case USE_GPIO: |
| 3496 |
/* do nothing */ |
| 3497 |
break; |
| 3498 |
} |
| 3270 |
} |
3499 |
} |
| 3271 |
case IVTV_IOC_G_CODEC: { |
3500 |
case IVTV_IOC_G_CODEC: { |
| 3272 |
//FIXME copy_from_user needed |
3501 |
//FIXME copy_from_user needed |
|
Lines 3293-3298
Link Here
|
| 3293 |
sizeof(struct ivtv_ioctl_codec)); |
3522 |
sizeof(struct ivtv_ioctl_codec)); |
| 3294 |
} |
3523 |
} |
| 3295 |
|
3524 |
|
|
|
3525 |
if (itv->card_type == IVTV_M179) |
| 3526 |
{ |
| 3527 |
ivtv_set_gpio_audiofreq(itv,codec->audio_bitmap & 0x03); |
| 3528 |
} |
| 3529 |
|
| 3296 |
/* VCD streamtype has some quirks. Handle them here */ |
3530 |
/* VCD streamtype has some quirks. Handle them here */ |
| 3297 |
if ((codec->stream_type == IVTV_STREAM_VCD) || |
3531 |
if ((codec->stream_type == IVTV_STREAM_VCD) || |
| 3298 |
(codec->stream_type == IVTV_STREAM_MPEG1)) { |
3532 |
(codec->stream_type == IVTV_STREAM_MPEG1)) { |
|
Lines 3301-3320
Link Here
|
| 3301 |
int tmpsize = 480; |
3535 |
int tmpsize = 480; |
| 3302 |
|
3536 |
|
| 3303 |
if (itv->v4l2.standard.active == 1) tmpsize = 576; |
3537 |
if (itv->v4l2.standard.active == 1) tmpsize = 576; |
| 3304 |
|
3538 |
|
| 3305 |
IVTV_DEBUG(IVTV_DEBUG_INFO,"ivtv ioctl: mpeg1_stream " |
3539 |
IVTV_DEBUG(IVTV_DEBUG_INFO,"ivtv ioctl: mpeg1_stream " |
| 3306 |
"size %d\n", tmpsize); |
3540 |
"size %d\n", tmpsize); |
| 3307 |
|
3541 |
|
| 3308 |
/* so far it looks like you can change width at will * |
3542 |
/* so far it looks like you can change width at will * |
| 3309 |
* but the compressor is unhappy when the height changes * |
3543 |
* but the compressor is unhappy when the height changes * |
| 3310 |
* to anything other than 240 */ |
3544 |
* to anything other than 240 */ |
| 3311 |
wind.width = 352; |
3545 |
wind.width = 352; |
| 3312 |
wind.height = tmpsize; |
3546 |
wind.height = tmpsize; |
| 3313 |
vfmt->fmt.pix.width = 352; |
3547 |
vfmt->fmt.pix.width = 352; |
| 3314 |
vfmt->fmt.pix.height = tmpsize / 2; |
3548 |
vfmt->fmt.pix.height = tmpsize / 2; |
| 3315 |
|
3549 |
|
| 3316 |
ivtv_call_i2c_client(itv, |
3550 |
ivtv_call_i2c_client(itv, |
| 3317 |
IVTV_SAA7115_I2C_ADDR,DECODER_SET_SIZE,&wind); |
3551 |
ivtv_i2c_addresses[itv->card_type].saa7115_addr, |
|
|
3552 |
DECODER_SET_SIZE,&wind); |
| 3318 |
memcpy (&itv->v4l2.streams[0].format, |
3553 |
memcpy (&itv->v4l2.streams[0].format, |
| 3319 |
vfmt, sizeof(struct v4l2_format)); |
3554 |
vfmt, sizeof(struct v4l2_format)); |
| 3320 |
} |
3555 |
} |
|
Lines 3348-3354
Link Here
|
| 3348 |
put_user(ivtv_debug, dbg_level); |
3583 |
put_user(ivtv_debug, dbg_level); |
| 3349 |
break; |
3584 |
break; |
| 3350 |
} |
3585 |
} |
| 3351 |
case VIDIOC_STREAMOFF: { |
3586 |
case VIDIOC_STREAMOFF: { |
| 3352 |
ivtv_v4l2_streamoff(id); |
3587 |
ivtv_v4l2_streamoff(id); |
| 3353 |
break; |
3588 |
break; |
| 3354 |
} |
3589 |
} |
|
Lines 3362-3365
Link Here
|
| 3362 |
} |
3597 |
} |
| 3363 |
return 0; |
3598 |
return 0; |
| 3364 |
} |
3599 |
} |
| 3365 |
|
|
|