summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/bt8xx
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-03-19 16:35:57 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2006-03-19 16:35:57 +0100
commitfde3e3b6816368fa44ece4a962fd3ef5ed664398 (patch)
tree22004efc3fe8489597fae89142217965b630f2b9 /linux/drivers/media/video/bt8xx
parenta54e9c36217d11493c90e0dbdef2f48625525702 (diff)
downloadmediapointer-dvb-s2-fde3e3b6816368fa44ece4a962fd3ef5ed664398.tar.gz
mediapointer-dvb-s2-fde3e3b6816368fa44ece4a962fd3ef5ed664398.tar.bz2
Implement correct msp3400 input/output routing
From: Hans Verkuil <hverkuil@xs4all.nl> - implement VIDIOC_INT_S_AUDIO_ROUTING for msp3400 and tvaudio - use the new command in bttv, pvrusb2 and em28xx. - remove the now obsolete MSP_SET_MATRIX from msp3400 (yeah!) - remove the obsolete VIDIOC_S_AUDIO from msp3400. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/bt8xx')
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-driver.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c
index 02be4c68a..56ba5940e 100644
--- a/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ b/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -38,6 +38,7 @@
#include "bttvp.h"
#include <media/v4l2-common.h>
#include <media/tvaudio.h>
+#include <media/msp3400.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/dma-mapping.h>
@@ -950,11 +951,9 @@ static int
audio_mux(struct bttv *btv, int input, int mute)
{
int gpio_val, signal;
- struct v4l2_audio aud_input;
struct v4l2_control ctrl;
struct i2c_client *c;
- memset(&aud_input, 0, sizeof(aud_input));
gpio_inout(bttv_tvcards[btv->c.type].gpiomask,
bttv_tvcards[btv->c.type].gpiomask);
signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC;
@@ -969,7 +968,6 @@ audio_mux(struct bttv *btv, int input, int mute)
gpio_val = bttv_tvcards[btv->c.type].gpiomute;
else
gpio_val = bttv_tvcards[btv->c.type].gpiomux[input];
- aud_input.index = btv->audio;
#if 0
printk("bttv%d: amux: input=%d mute=%d signal=%s gpio_mux=%d irq=%s\n",
btv->c.nr, input, mute, signal ? "yes" : "no",
@@ -983,15 +981,51 @@ audio_mux(struct bttv *btv, int input, int mute)
return 0;
ctrl.id = V4L2_CID_AUDIO_MUTE;
- /* take automute into account, just btv->mute is not enough */
- ctrl.value = mute;
+ ctrl.value = btv->mute;
bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, &ctrl);
c = btv->i2c_msp34xx_client;
- if (c)
- c->driver->command(c, VIDIOC_S_AUDIO, &aud_input);
+ if (c) {
+ struct v4l2_routing route;
+
+ /* Note: the inputs tuner/radio/extern/intern are translated
+ to msp routings. This assumes common behavior for all msp3400
+ based TV cards. When this assumption fails, then the
+ specific MSP routing must be added to the card table.
+ For now this is sufficient. */
+ switch (input) {
+ case TVAUDIO_INPUT_RADIO:
+ route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1,
+ MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART);
+ break;
+ case TVAUDIO_INPUT_EXTERN:
+ route.input = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1,
+ MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART);
+ break;
+ case TVAUDIO_INPUT_INTERN:
+ /* Yes, this is the same input as for RADIO. I doubt
+ if this is ever used. The only board with an INTERN
+ input is the BTTV_BOARD_AVERMEDIA98. I wonder how
+ that was tested. My guess is that the whole INTERN
+ input does not work. */
+ route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1,
+ MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART);
+ break;
+ case TVAUDIO_INPUT_TUNER:
+ default:
+ route.input = MSP_INPUT_DEFAULT;
+ break;
+ }
+ route.output = MSP_OUTPUT_DEFAULT;
+ c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route);
+ }
c = btv->i2c_tvaudio_client;
- if (c)
- c->driver->command(c, VIDIOC_S_AUDIO, &aud_input);
+ if (c) {
+ struct v4l2_routing route;
+
+ route.input = input;
+ route.output = 0;
+ c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route);
+ }
return 0;
}