Commit 3cfba984 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] v4l: msp3400 update

From: Gerd Knorr <kraxel@bytesex.org>

This patch allows to use switch to the second external input of the msp34xx
chips.  Also has some minor cleanups and more verbose debug info.
parent c7d543e9
...@@ -1384,34 +1384,30 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -1384,34 +1384,30 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
{ {
struct msp3400c *msp = i2c_get_clientdata(client); struct msp3400c *msp = i2c_get_clientdata(client);
__u16 *sarg = arg; __u16 *sarg = arg;
#if 0 int scart = 0;
int *iarg = (int*)arg;
#endif
switch (cmd) { switch (cmd) {
case AUDC_SET_INPUT: case AUDC_SET_INPUT:
/* scart switching
- IN1 is often used for external input
- Hauppauge uses IN2 for the radio */
dprintk(KERN_DEBUG "msp34xx: AUDC_SET_INPUT(%d)\n",*sarg); dprintk(KERN_DEBUG "msp34xx: AUDC_SET_INPUT(%d)\n",*sarg);
if (*sarg == msp->input) if (*sarg == msp->input)
break; break;
msp->input = *sarg; msp->input = *sarg;
switch (*sarg) { switch (*sarg) {
case AUDIO_RADIO: case AUDIO_RADIO:
/* Hauppauge uses IN2 for the radio */
msp->mode = MSP_MODE_FM_RADIO; msp->mode = MSP_MODE_FM_RADIO;
msp->stereo = VIDEO_SOUND_STEREO; scart = SCART_IN2;
msp3400c_set_scart(client,SCART_IN2,0);
msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900);
msp3400c_setstereo(client,msp->stereo);
break; break;
case AUDIO_EXTERN: case AUDIO_EXTERN_1:
/* IN1 is often used for external input ... */
msp->mode = MSP_MODE_EXTERN; msp->mode = MSP_MODE_EXTERN;
msp->stereo = VIDEO_SOUND_STEREO; scart = SCART_IN1;
msp3400c_set_scart(client,SCART_IN1,0); break;
msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900); case AUDIO_EXTERN_2:
msp3400c_setstereo(client,msp->stereo); /* ... sometimes it is IN2 through ;) */
msp->mode = MSP_MODE_EXTERN;
scart = SCART_IN2;
break; break;
case AUDIO_TUNER: case AUDIO_TUNER:
msp->mode = -1; msp->mode = -1;
...@@ -1422,6 +1418,12 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -1422,6 +1418,12 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
msp3400c_set_scart(client,SCART_MUTE,0); msp3400c_set_scart(client,SCART_MUTE,0);
break; break;
} }
if (scart) {
msp->stereo = VIDEO_SOUND_STEREO;
msp3400c_set_scart(client,scart,0);
msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900);
msp3400c_setstereo(client,msp->stereo);
}
if (msp->active) if (msp->active)
msp->restart = 1; msp->restart = 1;
break; break;
...@@ -1487,12 +1489,15 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -1487,12 +1489,15 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
if (msp->muted) if (msp->muted)
va->flags |= VIDEO_AUDIO_MUTE; va->flags |= VIDEO_AUDIO_MUTE;
va->volume=max(msp->left,msp->right); va->volume=max(msp->left,msp->right);
va->balance=(32768*min(msp->left,msp->right))/
(va->volume ? va->volume : 1); if (0 == va->volume) {
va->balance=(msp->left<msp->right)?
(65535-va->balance) : va->balance;
if (0 == va->volume)
va->balance = 32768; va->balance = 32768;
} else {
va->balance = (32768 * min(msp->left,msp->right))
/ va->volume;
va->balance = (msp->left<msp->right) ?
(65535 - va->balance) : va->balance;
}
va->bass = msp->bass; va->bass = msp->bass;
va->treble = msp->treble; va->treble = msp->treble;
...@@ -1530,7 +1535,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -1530,7 +1535,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
{ {
struct video_channel *vc = arg; struct video_channel *vc = arg;
dprintk(KERN_DEBUG "msp34xx: VIDIOCSCHAN\n"); dprintk(KERN_DEBUG "msp34xx: VIDIOCSCHAN (norm=%d)\n",vc->norm);
msp->norm = vc->norm; msp->norm = vc->norm;
break; break;
} }
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#define AUDIO_INTERN 0x03 #define AUDIO_INTERN 0x03
#define AUDIO_OFF 0x04 #define AUDIO_OFF 0x04
#define AUDIO_ON 0x05 #define AUDIO_ON 0x05
#define AUDIO_EXTERN_1 AUDIO_EXTERN
#define AUDIO_EXTERN_2 0x06
#define AUDIO_MUTE 0x80 #define AUDIO_MUTE 0x80
#define AUDIO_UNMUTE 0x81 #define AUDIO_UNMUTE 0x81
......
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