This is a near-complete merge; the remaining differences are build
control (#defines) and my pal/secam option checks.
Changelog:
* tda9887.c merge from video4linux
- Add skeleton support for TUNER_SET_STANDBY
- tuner mode now uses an enum
Cheers,
Phil
diff -ru ivtv-0.3.7k.orig/driver/tda9887.c ivtv-0.3.7k.tm/driver/tda9887.c
--- ivtv-0.3.7k.orig/driver/tda9887.c 2005-08-22 21:31:00.000000000 +0100
+++ ivtv-0.3.7k.tm/driver/tda9887.c 2005-08-30 02:11:29.000000000 +0100
@@ -3,6 +3,9 @@
#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/types.h>
+/* don't use video4linux compat in ivtv
+#include "compat.h"
+*/
#include <linux/videodev.h>
#include <linux/init.h>
#include <linux/errno.h>
@@ -47,44 +50,20 @@
I2C_CLIENT_INSMOD;
/* insmod options */
-#define UNSET (-1U)
static unsigned int debug = 0;
-static unsigned int port1 = UNSET;
-static unsigned int port2 = UNSET;
-static unsigned int qss = UNSET;
-static unsigned int adjust = 0x10;
-static char pal[] = "-";
-static char secam[] = "-";
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
-MODULE_PARM(debug, "i");
-MODULE_PARM(port1, "i");
-MODULE_PARM(port2, "i");
-MODULE_PARM(qss, "i" );
-MODULE_PARM(adjust, "i");
-MODULE_PARM(pal, "s");
-MODULE_PARM(secam, "s");
-#else
module_param(debug, int, 0644);
-module_param(port1, int, 0644);
-module_param(port2, int, 0644);
-module_param(qss, int, 0644);
-module_param(adjust, int, 0644);
-module_param_string(pal, pal, sizeof(pal), 0644);
-module_param_string(secam, secam, sizeof(secam), 0644);
-#endif
-
MODULE_LICENSE("GPL");
/* ---------------------------------------------------------------------- */
+#define UNSET (-1U)
#define PREFIX "tda9885/6/7: "
#define dprintk if (debug) printk
struct tda9887 {
struct i2c_client client;
v4l2_std_id std;
- unsigned int radio;
+ enum tuner_mode mode;
unsigned int config;
unsigned int pinnacle_id;
unsigned int using_v4l2;
@@ -231,7 +210,7 @@
.b = ( cNegativeFmTV |
cQSS ),
.c = ( cDeemphasisON |
- cDeemphasis50 ),
+ cDeemphasis75 ),
.e = ( cGating_36 |
cAudioIF_4_5 |
cVideoIF_45_75 ),
@@ -399,7 +378,7 @@
struct tvnorm *norm = NULL;
int i;
- if (t->radio) {
+ if (t->mode == T_RADIO) {
if (t->radio_mode == V4L2_TUNER_MODE_MONO)
norm = &radio_mono;
else
@@ -413,7 +392,7 @@
}
}
if (NULL == norm) {
- dprintk(PREFIX "Oops: no tvnorm entry found\n");
+ dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n");
return -1;
}
@@ -424,6 +403,15 @@
return 0;
}
+static unsigned int port1 = UNSET;
+static unsigned int port2 = UNSET;
+static unsigned int qss = UNSET;
+static unsigned int adjust = 0x10;
+module_param(port1, int, 0644);
+module_param(port2, int, 0644);
+module_param(qss, int, 0644);
+module_param(adjust, int, 0644);
+
static int tda9887_set_insmod(struct tda9887 *t, char *buf)
{
if (UNSET != port1) {
@@ -516,6 +504,10 @@
/* ---------------------------------------------------------------------- */
+static char pal[] = "-";
+module_param_string(pal, pal, sizeof(pal), 0644);
+static char secam[] = "-";
+module_param_string(secam, secam, sizeof(secam), 0644);
static int tda9887_fixup_std(struct tda9887 *t)
{
@@ -547,6 +539,7 @@
default:
printk(PREFIX "pal= argument not recognised\n");
break;
+
}
}
if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
@@ -603,6 +596,10 @@
tda9887_set_config(t,buf);
tda9887_set_insmod(t,buf);
+ if (t->mode == T_STANDBY) {
+ buf[1] |= cForcedMuteAudioON;
+ }
+
#if 0
/* This as-is breaks some cards, must be fixed in a
* card-specific way, probably using TDA9887_SET_CONFIG to
@@ -709,10 +706,17 @@
/* --- configuration --- */
case AUDC_SET_RADIO:
- t->radio = 1;
+ {
+ t->mode = T_RADIO;
tda9887_configure(t);
break;
-
+ }
+ case TUNER_SET_STANDBY:
+ {
+ t->mode = T_STANDBY;
+ tda9887_configure(t);
+ break;
+ }
case AUDC_CONFIG_PINNACLE:
{
int *i = arg;
@@ -745,7 +749,7 @@
struct video_channel *vc = arg;
CHECK_V4L2;
- t->radio = 0;
+ t->mode = T_ANALOG_TV;
if (vc->norm < ARRAY_SIZE(map))
t->std = map[vc->norm];
tda9887_fixup_std(t);
@@ -757,7 +761,7 @@
v4l2_std_id *id = arg;
SWITCH_V4L2;
- t->radio = 0;
+ t->mode = T_ANALOG_TV;
t->std = *id;
tda9887_fixup_std(t);
tda9887_configure(t);
@@ -769,14 +773,14 @@
SWITCH_V4L2;
if (V4L2_TUNER_ANALOG_TV == f->type) {
- if (t->radio == 0)
+ if (t->mode == T_ANALOG_TV)
return 0;
- t->radio = 0;
+ t->mode = T_ANALOG_TV;
}
if (V4L2_TUNER_RADIO == f->type) {
- if (t->radio == 1)
+ if (t->mode == T_RADIO)
return 0;
- t->radio = 1;
+ t->mode = T_RADIO;
}
tda9887_configure(t);
break;
@@ -791,7 +795,7 @@
};
struct v4l2_tuner* tuner = arg;
- if (t->radio) {
+ if (t->mode == T_RADIO) {
__u8 reg = 0;
tuner->afc=0;
if (1 == i2c_master_recv(&t->client,®,1))
@@ -803,7 +807,7 @@
{
struct v4l2_tuner* tuner = arg;
- if (t->radio) {
+ if (t->mode == T_RADIO) {
t->radio_mode = tuner->audmode;
tda9887_configure (t);
}
diff -ru ivtv-0.3.7k.orig/driver/tuner.h ivtv-0.3.7k.tm/driver/tuner.h
--- ivtv-0.3.7k.orig/driver/tuner.h 2005-08-15 15:08:45.000000000 +0100
+++ ivtv-0.3.7k.tm/driver/tuner.h 2005-08-30 01:43:50.000000000 +0100
@@ -132,6 +132,7 @@
};
#define TUNER_SET_TYPE_ADDR _IOW('T',3,int)
+#define TUNER_SET_STANDBY _IOW('T',4,int)
// End of 2.6.13 section
#define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */