0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ivtv-driver.h"
0010 #include "ivtv-i2c.h"
0011 #include "ivtv-cards.h"
0012 #include "ivtv-gpio.h"
0013 #include "ivtv-routing.h"
0014
0015 #include <media/drv-intf/msp3400.h>
0016 #include <media/i2c/m52790.h>
0017 #include <media/i2c/upd64031a.h>
0018 #include <media/i2c/upd64083.h>
0019
0020
0021
0022 void ivtv_audio_set_io(struct ivtv *itv)
0023 {
0024 const struct ivtv_card_audio_input *in;
0025 u32 input, output = 0;
0026
0027
0028 if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags))
0029 in = &itv->card->radio_input;
0030 else
0031 in = &itv->card->audio_inputs[itv->audio_input];
0032
0033
0034 input = in->muxer_input;
0035 if (itv->card->hw_muxer & IVTV_HW_M52790)
0036 output = M52790_OUT_STEREO;
0037 v4l2_subdev_call(itv->sd_muxer, audio, s_routing,
0038 input, output, 0);
0039
0040 input = in->audio_input;
0041 output = 0;
0042 if (itv->card->hw_audio & IVTV_HW_MSP34XX)
0043 output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
0044 ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing,
0045 input, output, 0);
0046 }
0047
0048
0049
0050 void ivtv_video_set_io(struct ivtv *itv)
0051 {
0052 int inp = itv->active_input;
0053 u32 input;
0054 u32 type;
0055
0056 v4l2_subdev_call(itv->sd_video, video, s_routing,
0057 itv->card->video_inputs[inp].video_input, 0, 0);
0058
0059 type = itv->card->video_inputs[inp].video_type;
0060
0061 if (type == IVTV_CARD_INPUT_VID_TUNER) {
0062 input = 0;
0063 } else if (type < IVTV_CARD_INPUT_COMPOSITE1) {
0064 input = 2;
0065 } else {
0066 input = 1;
0067 }
0068
0069 if (itv->card->hw_video & IVTV_HW_GPIO)
0070 ivtv_call_hw(itv, IVTV_HW_GPIO, video, s_routing,
0071 input, 0, 0);
0072
0073 if (itv->card->hw_video & IVTV_HW_UPD64031A) {
0074 if (type == IVTV_CARD_INPUT_VID_TUNER ||
0075 type >= IVTV_CARD_INPUT_COMPOSITE1) {
0076
0077 input = UPD64031A_GR_ON | UPD64031A_3DYCS_COMPOSITE;
0078 } else {
0079
0080 input = UPD64031A_GR_OFF | UPD64031A_3DYCS_DISABLE;
0081 }
0082 input |= itv->card->gr_config;
0083
0084 ivtv_call_hw(itv, IVTV_HW_UPD64031A, video, s_routing,
0085 input, 0, 0);
0086 }
0087
0088 if (itv->card->hw_video & IVTV_HW_UPD6408X) {
0089 input = UPD64083_YCS_MODE;
0090 if (type > IVTV_CARD_INPUT_VID_TUNER &&
0091 type < IVTV_CARD_INPUT_COMPOSITE1) {
0092
0093
0094 input |= UPD64083_YCNR_MODE;
0095 }
0096 else if (itv->card->hw_video & IVTV_HW_UPD64031A) {
0097
0098
0099 if (type == IVTV_CARD_INPUT_VID_TUNER ||
0100 itv->card->type == IVTV_CARD_CX23416GYC) {
0101 input |= UPD64083_EXT_Y_ADC;
0102 }
0103 }
0104 ivtv_call_hw(itv, IVTV_HW_UPD6408X, video, s_routing,
0105 input, 0, 0);
0106 }
0107 }