Commit 4e26c415 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: bttv tuner update

This patch is a update for the tuner module which controls the tuner
chip on TV cards.  No major changes, lots of small cleanups: make
functions static, switch to name-based initialization for structs, ...
parent 62c22274
...@@ -154,7 +154,7 @@ static struct tunertype tuners[] = { ...@@ -154,7 +154,7 @@ static struct tunertype tuners[] = {
16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732}, 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732},
{ "Alps TSBE1",TEMIC,PAL, { "Alps TSBE1",TEMIC,PAL,
16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732}, 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732},
{ "Alps TSBB5", Alps, PAL_I, /* tested (UK UHF) with Modtec MM205 */ { "Alps TSBB5", Alps, PAL_I, /* tested (UK UHF) with Modulartech MM205 */
16*133.25,16*351.25,0x01,0x02,0x08,0x8e,632}, 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,632},
{ "Alps TSBE5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ { "Alps TSBE5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */
...@@ -175,7 +175,7 @@ static struct tunertype tuners[] = { ...@@ -175,7 +175,7 @@ static struct tunertype tuners[] = {
{ "Temic PAL* auto (4006 FN5)", TEMIC, PAL, { "Temic PAL* auto (4006 FN5)", TEMIC, PAL,
16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623},
{ "Temic PAL (4009 FR5)", TEMIC, PAL, { "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)", TEMIC, PAL,
16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623},
{ "Temic NTSC (4039 FR5)", TEMIC, NTSC, { "Temic NTSC (4039 FR5)", TEMIC, NTSC,
16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732},
...@@ -271,7 +271,7 @@ static int tuner_mode (struct i2c_client *c) ...@@ -271,7 +271,7 @@ static int tuner_mode (struct i2c_client *c)
} }
#endif #endif
// Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001
int mt2032_init(struct i2c_client *c) static int mt2032_init(struct i2c_client *c)
{ {
unsigned char buf[21]; unsigned char buf[21];
int ret,xogc,xok=0; int ret,xogc,xok=0;
...@@ -345,7 +345,7 @@ int mt2032_init(struct i2c_client *c) ...@@ -345,7 +345,7 @@ int mt2032_init(struct i2c_client *c)
// IsSpurInBand()? // IsSpurInBand()?
int mt2032_spurcheck(int f1, int f2, int spectrum_from,int spectrum_to) static int mt2032_spurcheck(int f1, int f2, int spectrum_from,int spectrum_to)
{ {
int n1=1,n2,f; int n1=1,n2,f;
...@@ -373,7 +373,7 @@ int mt2032_spurcheck(int f1, int f2, int spectrum_from,int spectrum_to) ...@@ -373,7 +373,7 @@ int mt2032_spurcheck(int f1, int f2, int spectrum_from,int spectrum_to)
return 1; return 1;
} }
int mt2032_compute_freq(int rfin, int if1, int if2, int spectrum_from, static int mt2032_compute_freq(int rfin, int if1, int if2, int spectrum_from,
int spectrum_to, unsigned char *buf, int *ret_sel, int xogc) //all in Hz int spectrum_to, unsigned char *buf, int *ret_sel, int xogc) //all in Hz
{ {
int fref,lo1,lo1n,lo1a,s,sel,lo1freq, desired_lo1, int fref,lo1,lo1n,lo1a,s,sel,lo1freq, desired_lo1,
...@@ -449,7 +449,7 @@ int mt2032_compute_freq(int rfin, int if1, int if2, int spectrum_from, ...@@ -449,7 +449,7 @@ int mt2032_compute_freq(int rfin, int if1, int if2, int spectrum_from,
return 0; return 0;
} }
int mt2032_check_lo_lock(struct i2c_client *c) static int mt2032_check_lo_lock(struct i2c_client *c)
{ {
int try,lock=0; int try,lock=0;
unsigned char buf[2]; unsigned char buf[2];
...@@ -469,7 +469,7 @@ int mt2032_check_lo_lock(struct i2c_client *c) ...@@ -469,7 +469,7 @@ int mt2032_check_lo_lock(struct i2c_client *c)
return lock; return lock;
} }
int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) static int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock)
{ {
unsigned char buf[2]; unsigned char buf[2];
int tad1; int tad1;
...@@ -505,7 +505,7 @@ int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) ...@@ -505,7 +505,7 @@ int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock)
} }
void mt2032_set_if_freq(struct i2c_client *c,int rfin, int if1, int if2, int from, int to) static void mt2032_set_if_freq(struct i2c_client *c,int rfin, int if1, int if2, int from, int to)
{ {
unsigned char buf[21]; unsigned char buf[21];
int lint_try,ret,sel,lock=0; int lint_try,ret,sel,lock=0;
...@@ -560,7 +560,7 @@ void mt2032_set_if_freq(struct i2c_client *c,int rfin, int if1, int if2, int fro ...@@ -560,7 +560,7 @@ void mt2032_set_if_freq(struct i2c_client *c,int rfin, int if1, int if2, int fro
} }
void mt2032_set_tv_freq(struct i2c_client *c, int freq, int norm) static void mt2032_set_tv_freq(struct i2c_client *c, int freq, int norm)
{ {
int if2,from,to; int if2,from,to;
...@@ -815,14 +815,27 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, ...@@ -815,14 +815,27 @@ static int tuner_attach(struct i2c_adapter *adap, int addr,
static int tuner_probe(struct i2c_adapter *adap) static int tuner_probe(struct i2c_adapter *adap)
{ {
int rc;
if (0 != addr) { if (0 != addr) {
normal_i2c_range[0] = addr; normal_i2c_range[0] = addr;
normal_i2c_range[1] = addr; normal_i2c_range[1] = addr;
} }
this_adap = 0; this_adap = 0;
if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) switch (adap->id) {
return i2c_probe(adap, &addr_data, tuner_attach); case I2C_ALGO_BIT | I2C_HW_B_BT848:
return 0; case I2C_ALGO_SAA7134:
printk("tuner: probing %s i2c adapter [id=0x%x]\n",
adap->name,adap->id);
rc = i2c_probe(adap, &addr_data, tuner_attach);
break;
default:
printk("tuner: ignoring %s i2c adapter [id=0x%x]\n",
adap->name,adap->id);
rc = 0;
/* nothing */
}
return rc;
} }
static int tuner_detach(struct i2c_client *client) static int tuner_detach(struct i2c_client *client)
...@@ -948,39 +961,34 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -948,39 +961,34 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static struct i2c_driver driver = { static struct i2c_driver driver = {
"i2c TV tuner driver", name: "i2c TV tuner driver",
I2C_DRIVERID_TUNER, id: I2C_DRIVERID_TUNER,
I2C_DF_NOTIFY, flags: I2C_DF_NOTIFY,
tuner_probe, attach_adapter: tuner_probe,
tuner_detach, detach_client: tuner_detach,
tuner_command, command: tuner_command,
}; };
static struct i2c_client client_template = static struct i2c_client client_template =
{ {
"(unset)", /* name */ name: "(unset)",
-1, flags: I2C_CLIENT_ALLOW_USE,
0, driver: &driver,
0,
NULL,
&driver
}; };
EXPORT_NO_SYMBOLS; static int tuner_init_module(void)
int tuner_init_module(void)
{ {
i2c_add_driver(&driver); i2c_add_driver(&driver);
return 0; return 0;
} }
void tuner_cleanup_module(void) static void tuner_cleanup_module(void)
{ {
i2c_del_driver(&driver); i2c_del_driver(&driver);
} }
module_init(tuner_init_module); module_init(tuner_init_module);
module_exit(tuner_cleanup_module); module_exit(tuner_cleanup_module);
EXPORT_NO_SYMBOLS;
/* /*
* Overrides for Emacs so that we follow Linus's tabbing style. * Overrides for Emacs so that we follow Linus's tabbing style.
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#ifndef _TUNER_H #ifndef _TUNER_H
#define _TUNER_H #define _TUNER_H
#include "id.h"
#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */
#define TUNER_PHILIPS_PAL_I 1 #define TUNER_PHILIPS_PAL_I 1
#define TUNER_PHILIPS_NTSC 2 #define TUNER_PHILIPS_NTSC 2
......
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