Commit 0d175a40 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: tuner update

This is an update for the v4l tuner modules (tuner.o + tda9887.o).
Changes:

  * fix two tuner config entries.
  * switch insmod options to new 2.6-ish style.
  * add suspend/resume functions.

The patch also removes all trailing whitespaces.  I've a script to remove them
from my sources now, that should kill those no-op whitespace changes in my
patches after merging this initial cleanup.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 82642f64
...@@ -535,6 +535,11 @@ static int tda9887_configure(struct tda9887 *t) ...@@ -535,6 +535,11 @@ static int tda9887_configure(struct tda9887 *t)
tda9887_set_config(t,buf); tda9887_set_config(t,buf);
tda9887_set_insmod(t,buf); tda9887_set_insmod(t,buf);
if (t->std & V4L2_STD_SECAM_L) {
/* secam fixup (FIXME: move this to tvnorms array?) */
buf[1] &= ~cOutputPort2Inactive;
}
dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n",
buf[1],buf[2],buf[3]); buf[1],buf[2],buf[3]);
if (debug > 1) if (debug > 1)
...@@ -565,7 +570,7 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -565,7 +570,7 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind)
return -ENOMEM; return -ENOMEM;
memset(t,0,sizeof(*t)); memset(t,0,sizeof(*t));
t->client = client_template; t->client = client_template;
t->std = 0;; t->std = 0;
t->pinnacle_id = UNSET; t->pinnacle_id = UNSET;
i2c_set_clientdata(&t->client, t); i2c_set_clientdata(&t->client, t);
i2c_attach_client(&t->client); i2c_attach_client(&t->client);
...@@ -712,6 +717,22 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -712,6 +717,22 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
return 0; return 0;
} }
static int tda9887_suspend(struct device * dev, u32 state, u32 level)
{
dprintk("tda9887: suspend\n");
return 0;
}
static int tda9887_resume(struct device * dev, u32 level)
{
struct i2c_client *c = container_of(dev, struct i2c_client, dev);
struct tda9887 *t = i2c_get_clientdata(c);
dprintk("tda9887: resume\n");
tda9887_configure(t);
return 0;
}
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static struct i2c_driver driver = { static struct i2c_driver driver = {
...@@ -722,6 +743,10 @@ static struct i2c_driver driver = { ...@@ -722,6 +743,10 @@ static struct i2c_driver driver = {
.attach_adapter = tda9887_probe, .attach_adapter = tda9887_probe,
.detach_client = tda9887_detach, .detach_client = tda9887_detach,
.command = tda9887_command, .command = tda9887_command,
.driver = {
.suspend = tda9887_suspend,
.resume = tda9887_resume,
},
}; };
static struct i2c_client client_template = static struct i2c_client client_template =
{ {
......
/*
* $Id: tuner.c,v 1.27 2004/10/20 09:43:34 kraxel Exp $
*/
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -15,30 +20,34 @@ ...@@ -15,30 +20,34 @@
#include <media/tuner.h> #include <media/tuner.h>
#include <media/audiochip.h> #include <media/audiochip.h>
/* Addresses to scan */ #define UNSET (-1U)
/* standard i2c insmod options */
static unsigned short normal_i2c[] = {I2C_CLIENT_END}; static unsigned short normal_i2c[] = {I2C_CLIENT_END};
static unsigned short normal_i2c_range[] = {0x60,0x6f,I2C_CLIENT_END}; static unsigned short normal_i2c_range[] = {0x60,0x6f,I2C_CLIENT_END};
I2C_CLIENT_INSMOD; I2C_CLIENT_INSMOD;
#define UNSET (-1U) /* insmod options used at init time => read/only */
/* insmod options */
static unsigned int debug = 0;
static unsigned int type = UNSET; static unsigned int type = UNSET;
static unsigned int addr = 0; static unsigned int addr = 0;
static unsigned int tv_range[2] = { 44, 958 }; module_param(type, int, 444);
static unsigned int radio_range[2] = { 65, 108 }; module_param(addr, int, 444);
/* insmod options used at runtime => read/write */
static unsigned int debug = 0;
static unsigned int tv_antenna = 1; static unsigned int tv_antenna = 1;
static unsigned int radio_antenna = 0; static unsigned int radio_antenna = 0;
MODULE_PARM(debug,"i"); static unsigned int optimize_vco = 1;
MODULE_PARM(type,"i"); module_param(debug, int, 644);
MODULE_PARM(addr,"i"); module_param(tv_antenna, int, 644);
MODULE_PARM(tv_range,"2i"); module_param(radio_antenna, int, 644);
MODULE_PARM(radio_range,"2i"); module_param(optimize_vco, int, 644);
MODULE_PARM(tv_antenna,"i");
MODULE_PARM(radio_antenna,"i"); static unsigned int tv_range[2] = { 44, 958 };
static unsigned int radio_range[2] = { 65, 108 };
#define optimize_vco 1 module_param_array(tv_range, int, NULL, 644);
module_param_array(radio_range, int, NULL, 644);
MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners"); MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners");
MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
...@@ -245,14 +254,14 @@ static struct tunertype tuners[] = { ...@@ -245,14 +254,14 @@ static struct tunertype tuners[] = {
{ "Panasonic VP27s/ENGE4324D", Panasonic, NTSC, { "Panasonic VP27s/ENGE4324D", Panasonic, NTSC,
16*160.00,16*454.00,0x01,0x02,0x08,0xce,940}, 16*160.00,16*454.00,0x01,0x02,0x08,0xce,940},
{ "LG NTSC (TAPE series)", LGINNOTEK, NTSC, { "LG NTSC (TAPE series)", LGINNOTEK, NTSC,
16*160.00,16*442.00,0x01,0x02,0x04,0xc8,732 }, 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 },
{ "Tenna TNF 8831 BGFF)", Philips, PAL, { "Tenna TNF 8831 BGFF)", Philips, PAL,
16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, 16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623},
{ "Microtune 4042 FI5 ATSC/NTSC dual in", Microtune, NTSC, { "Microtune 4042 FI5 ATSC/NTSC dual in", Microtune, NTSC,
16*162.00,16*457.00,0xa2,0x94,0x31,0x8e,732}, 16*162.00,16*457.00,0xa2,0x94,0x31,0x8e,732},
{ "TCL 2002N", TCL, NTSC, { "TCL 2002N", TCL, NTSC,
16*172.00,16*448.00,0x01,0x02,0x08,0x88,732}, 16*172.00,16*448.00,0x01,0x02,0x08,0x8e,732},
}; };
#define TUNERS ARRAY_SIZE(tuners) #define TUNERS ARRAY_SIZE(tuners)
...@@ -828,13 +837,17 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) ...@@ -828,13 +837,17 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
unsigned char buffer[4]; unsigned char buffer[4];
int rc; int rc;
tun=&tuners[t->type]; tun = &tuners[t->type];
if (freq < tun->thresh1) if (freq < tun->thresh1) {
config = tun->VHF_L; config = tun->VHF_L;
else if (freq < tun->thresh2) dprintk("tv: VHF lowrange\n");
} else if (freq < tun->thresh2) {
config = tun->VHF_H; config = tun->VHF_H;
else dprintk("tv: VHF high range\n");
} else {
config = tun->UHF; config = tun->UHF;
dprintk("tv: UHF range\n");
}
/* tv norm specific stuff for multi-norm tuners */ /* tv norm specific stuff for multi-norm tuners */
...@@ -887,7 +900,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) ...@@ -887,7 +900,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
/* 0x02 -> NTSC antenna input 1 */ /* 0x02 -> NTSC antenna input 1 */
/* 0x03 -> NTSC antenna input 2 */ /* 0x03 -> NTSC antenna input 2 */
config &= ~0x03; config &= ~0x03;
if (t->std & V4L2_STD_ATSC) if (!(t->std & V4L2_STD_ATSC))
config |= 2; config |= 2;
/* FIXME: input */ /* FIXME: input */
break; break;
...@@ -1332,6 +1345,24 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -1332,6 +1345,24 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
return 0; return 0;
} }
static int tuner_suspend(struct device * dev, u32 state, u32 level)
{
dprintk("tuner: suspend\n");
/* FIXME: power down ??? */
return 0;
}
static int tuner_resume(struct device * dev, u32 level)
{
struct i2c_client *c = container_of(dev, struct i2c_client, dev);
struct tuner *t = i2c_get_clientdata(c);
dprintk("tuner: resume\n");
if (t->freq)
set_freq(c,t->freq);
return 0;
}
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static struct i2c_driver driver = { static struct i2c_driver driver = {
...@@ -1342,6 +1373,10 @@ static struct i2c_driver driver = { ...@@ -1342,6 +1373,10 @@ static struct i2c_driver driver = {
.attach_adapter = tuner_probe, .attach_adapter = tuner_probe,
.detach_client = tuner_detach, .detach_client = tuner_detach,
.command = tuner_command, .command = tuner_command,
.driver = {
.suspend = tuner_suspend,
.resume = tuner_resume,
},
}; };
static struct i2c_client client_template = static struct i2c_client client_template =
{ {
......
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