diff options
Diffstat (limited to 'linux/drivers/media/video/tda9887.c')
-rw-r--r-- | linux/drivers/media/video/tda9887.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/linux/drivers/media/video/tda9887.c b/linux/drivers/media/video/tda9887.c index ee2bdd1a7..9cf8a8b69 100644 --- a/linux/drivers/media/video/tda9887.c +++ b/linux/drivers/media/video/tda9887.c @@ -9,10 +9,12 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "audiochip.h" +#include "tuner.h" #include "id.h" #include "i2c-compat.h" #else #include <media/audiochip.h> +#include <media/tuner.h> #include <media/id.h> #endif @@ -53,6 +55,7 @@ struct tda9887 { struct i2c_client client; v4l2_std_id std; unsigned int radio; + unsigned int config; unsigned int pinnacle_id; unsigned int using_v4l2; }; @@ -403,6 +406,36 @@ static int tda9887_set_insmod(struct tda9887 *t, char *buf) return 0; } +static int tda9887_set_config(struct tda9887 *t, char *buf) +{ + if (t->config & TDA9887_PORT1) + buf[1] |= cOutputPort1Inactive; + if (t->config & TDA9887_PORT2) + buf[1] |= cOutputPort2Inactive; + if (t->config & TDA9887_QSS) + buf[1] |= cQSS; + if (t->config & TDA9887_INTERCARRIER) + buf[1] &= ~cQSS; + + if (t->config & TDA9887_AUTOMUTE) + buf[1] |= cAutoMuteFmActive; + if (t->config & TDA9887_DEEMPHASIS_MASK) { + buf[2] &= ~0x60; + switch (t->config & TDA9887_DEEMPHASIS_MASK) { + case TDA9887_DEEMPHASIS_NONE: + buf[2] |= cDeemphasisOFF; + break; + case TDA9887_DEEMPHASIS_50: + buf[2] |= cDeemphasisON | cDeemphasis50; + break; + case TDA9887_DEEMPHASIS_75: + buf[2] |= cDeemphasisON | cDeemphasis75; + break; + } + } + return 0; +} + /* ---------------------------------------------------------------------- */ static int tda9887_set_pinnacle(struct tda9887 *t, char *buf) @@ -505,6 +538,7 @@ static int tda9887_configure(struct tda9887 *t) if (UNSET != t->pinnacle_id) { tda9887_set_pinnacle(t,buf); } + tda9887_set_config(t,buf); tda9887_set_insmod(t,buf); dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", @@ -611,6 +645,14 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) tda9887_configure(t); break; } + case TDA9887_SET_CONFIG: + { + int *i = arg; + + t->config = *i; + tda9887_configure(t); + break; + } /* --- v4l ioctls --- */ /* take care: bttv does userspace copying, we'll get a kernel pointer here... */ |