Commit fb7ef983 authored by Stefan Ringel's avatar Stefan Ringel Committed by Mauro Carvalho Chehab

[media] tm6000: change to virtual inputs

change to virtual inputs
Signed-off-by: default avatarStefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 886a3c0b
This diff is collapsed.
...@@ -661,20 +661,25 @@ int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp) ...@@ -661,20 +661,25 @@ int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp)
{ {
if (dev->dev_type == TM6010) { if (dev->dev_type == TM6010) {
/* Audio crossbar setting, default SIF1 */ /* Audio crossbar setting, default SIF1 */
u8 areg_f0 = 0x03; u8 areg_f0;
switch (ainp) { switch (dev->rinput.amux) {
case TM6000_AIP_SIF1: case TM6000_AMUX_SIF1:
case TM6000_AIP_SIF2: case TM6000_AMUX_SIF2:
areg_f0 = 0x03; areg_f0 = 0x03;
break; break;
case TM6000_AIP_LINE1: case TM6000_AMUX_ADC1:
areg_f0 = 0x00; areg_f0 = 0x00;
break; break;
case TM6000_AIP_LINE2: case TM6000_AMUX_ADC2:
areg_f0 = 0x08; areg_f0 = 0x08;
break; break;
case TM6000_AMUX_I2S:
areg_f0 = 0x04;
break;
default: default:
printk(KERN_INFO "%s: audio input dosn't support\n",
dev->name);
return 0; return 0;
break; break;
} }
...@@ -682,17 +687,18 @@ int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp) ...@@ -682,17 +687,18 @@ int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp)
tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
areg_f0, 0x0f); areg_f0, 0x0f);
} else { } else {
u8 areg_eb;
/* Audio setting, default LINE1 */ /* Audio setting, default LINE1 */
u8 areg_eb = 0x00; switch (dev->rinput.amux) {
case TM6000_AMUX_ADC1:
switch (ainp) {
case TM6000_AIP_LINE1:
areg_eb = 0x00; areg_eb = 0x00;
break; break;
case TM6000_AIP_LINE2: case TM6000_AMUX_ADC2:
areg_eb = 0x04; areg_eb = 0x04;
break; break;
default: default:
printk(KERN_INFO "%s: audio input dosn't support\n",
dev->name);
return 0; return 0;
break; break;
} }
...@@ -736,16 +742,16 @@ void tm6010_set_mute_adc(struct tm6000_core *dev, u8 mute) ...@@ -736,16 +742,16 @@ void tm6010_set_mute_adc(struct tm6000_core *dev, u8 mute)
int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute) int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute)
{ {
enum tm6000_inaudio ainp; enum tm6000_mux mux;
if (dev->radio) if (dev->radio)
ainp = dev->aradio; mux = dev->rinput.amux;
else else
ainp = dev->avideo; mux = dev->vinput[dev->input].amux;
switch (ainp) { switch (mux) {
case TM6000_AIP_SIF1: case TM6000_AMUX_SIF1:
case TM6000_AIP_SIF2: case TM6000_AMUX_SIF2:
if (dev->dev_type == TM6010) if (dev->dev_type == TM6010)
tm6010_set_mute_sif(dev, mute); tm6010_set_mute_sif(dev, mute);
else { else {
...@@ -755,8 +761,8 @@ int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute) ...@@ -755,8 +761,8 @@ int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute)
return -EINVAL; return -EINVAL;
} }
break; break;
case TM6000_AIP_LINE1: case TM6000_AMUX_ADC1:
case TM6000_AIP_LINE2: case TM6000_AMUX_ADC2:
tm6010_set_mute_adc(dev, mute); tm6010_set_mute_adc(dev, mute);
break; break;
default: default:
...@@ -797,17 +803,17 @@ void tm6010_set_volume_adc(struct tm6000_core *dev, int vol) ...@@ -797,17 +803,17 @@ void tm6010_set_volume_adc(struct tm6000_core *dev, int vol)
void tm6000_set_volume(struct tm6000_core *dev, int vol) void tm6000_set_volume(struct tm6000_core *dev, int vol)
{ {
enum tm6000_inaudio ainp; enum tm6000_mux mux;
if (dev->radio) { if (dev->radio) {
ainp = dev->aradio; mux = dev->rinput.amux;
vol += 8; /* Offset to 0 dB */ vol += 8; /* Offset to 0 dB */
} else } else
ainp = dev->avideo; mux = dev->vinput[dev->input].amux;
switch (ainp) { switch (mux) {
case TM6000_AIP_SIF1: case TM6000_AMUX_SIF1:
case TM6000_AIP_SIF2: case TM6000_AMUX_SIF2:
if (dev->dev_type == TM6010) if (dev->dev_type == TM6010)
tm6010_set_volume_sif(dev, vol); tm6010_set_volume_sif(dev, vol);
else else
...@@ -815,8 +821,8 @@ void tm6000_set_volume(struct tm6000_core *dev, int vol) ...@@ -815,8 +821,8 @@ void tm6000_set_volume(struct tm6000_core *dev, int vol)
" SIF audio inputs. Please check the %s" " SIF audio inputs. Please check the %s"
" configuration.\n", dev->name); " configuration.\n", dev->name);
break; break;
case TM6000_AIP_LINE1: case TM6000_AMUX_ADC1:
case TM6000_AIP_LINE2: case TM6000_AMUX_ADC2:
tm6010_set_volume_adc(dev, vol); tm6010_set_volume_adc(dev, vol);
break; break;
default: default:
......
...@@ -40,11 +40,24 @@ ...@@ -40,11 +40,24 @@
#define TM6000_VERSION KERNEL_VERSION(0, 0, 2) #define TM6000_VERSION KERNEL_VERSION(0, 0, 2)
/* Inputs */ /* Inputs */
enum tm6000_itype { enum tm6000_itype {
TM6000_INPUT_TV = 0, TM6000_INPUT_TV = 1,
TM6000_INPUT_COMPOSITE, TM6000_INPUT_COMPOSITE1,
TM6000_INPUT_COMPOSITE2,
TM6000_INPUT_SVIDEO, TM6000_INPUT_SVIDEO,
TM6000_INPUT_DVB,
TM6000_INPUT_RADIO,
};
enum tm6000_mux {
TM6000_VMUX_VIDEO_A = 1,
TM6000_VMUX_VIDEO_B,
TM6000_VMUX_VIDEO_AB,
TM6000_AMUX_ADC1,
TM6000_AMUX_ADC2,
TM6000_AMUX_SIF1,
TM6000_AMUX_SIF2,
TM6000_AMUX_I2S,
}; };
enum tm6000_devtype { enum tm6000_devtype {
...@@ -53,12 +66,12 @@ enum tm6000_devtype { ...@@ -53,12 +66,12 @@ enum tm6000_devtype {
TM6010, TM6010,
}; };
enum tm6000_inaudio { struct tm6000_input {
TM6000_AIP_UNK = 0, enum tm6000_itype type;
TM6000_AIP_SIF1, enum tm6000_mux vmux;
TM6000_AIP_SIF2, enum tm6000_mux amux;
TM6000_AIP_LINE1, unsigned int v_gpio;
TM6000_AIP_LINE2, unsigned int a_gpio;
}; };
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
...@@ -214,6 +227,9 @@ struct tm6000_core { ...@@ -214,6 +227,9 @@ struct tm6000_core {
struct v4l2_device v4l2_dev; struct v4l2_device v4l2_dev;
int input; int input;
struct tm6000_input vinput[3]; /* video input */
struct tm6000_input rinput; /* radio input */
int freq; int freq;
unsigned int fourcc; unsigned int fourcc;
...@@ -230,8 +246,6 @@ struct tm6000_core { ...@@ -230,8 +246,6 @@ struct tm6000_core {
struct snd_tm6000_card *adev; struct snd_tm6000_card *adev;
struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */ struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */
atomic_t stream_started; /* stream should be running if true */ atomic_t stream_started; /* stream should be running if true */
enum tm6000_inaudio avideo;
enum tm6000_inaudio aradio;
struct tm6000_IR *ir; struct tm6000_IR *ir;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment