summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-simple.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2006-02-07 06:25:34 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-02-07 06:25:34 -0200
commit476d63d061a082bcb833009e15a3632459a3caad (patch)
tree429773b4599fbca8d07554c4c2b27c5464f80033 /drivers/media/video/tuner-simple.c
parent5f5941872c0035cb4624efe8c5a1dfbb89d199e7 (diff)
V4L/DVB (3269): Allow multiple tuner params in each tuner definition
- allow multiple tuner params in each tuner definition. - the correct tuner_params element will be chosen based on current video standard. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-simple.c')
-rw-r--r--drivers/media/video/tuner-simple.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 907ea8c5d9b..58fa0d29962 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -79,14 +79,13 @@ MODULE_PARM_DESC(offset,"Allows to specify an offset for tuner");
#define TUNER_PLL_LOCKED 0x40
#define TUNER_STEREO_MK3 0x04
-#define TUNER_PARAM_ANALOG 0 /* to be removed */
/* FIXME:
* Right now, all tuners are using the first tuner_params[] array element
* for analog mode. In the future, we will be merging similar tuner
* definitions together, such that each tuner definition will have a
* tuner_params struct for each available video standard. At that point,
- * TUNER_PARAM_ANALOG will be removed, and the tuner_params[] array
- * element will be chosen based on the video standard in use.
+ * the tuner_params[] array element will be chosen based on the video
+ * standard in use.
*
*/
@@ -138,9 +137,9 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
struct tunertype *tun;
u8 buffer[4];
int rc, IFPCoff, i, j;
+ enum param_type desired_type;
tun = &tuners[t->type];
- j = TUNER_PARAM_ANALOG;
/* IFPCoff = Video Intermediate Frequency - Vif:
940 =16*58.75 NTSC/J (Japan)
@@ -155,16 +154,25 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
*/
if (t->std == V4L2_STD_NTSC_M_JP) {
- IFPCoff = 940;
+ IFPCoff = 940;
+ desired_type = TUNER_PARAM_TYPE_NTSC;
} else if ((t->std & V4L2_STD_MN) &&
!(t->std & ~V4L2_STD_MN)) {
- IFPCoff = 732;
+ IFPCoff = 732;
+ desired_type = TUNER_PARAM_TYPE_NTSC;
} else if (t->std == V4L2_STD_SECAM_LC) {
- IFPCoff = 543;
+ IFPCoff = 543;
+ desired_type = TUNER_PARAM_TYPE_SECAM;
} else {
- IFPCoff = 623;
+ IFPCoff = 623;
+ desired_type = TUNER_PARAM_TYPE_PAL;
}
+ for (j = 0; j < tun->count-1; j++) {
+ if (desired_type != tun->params[j].type)
+ continue;
+ break;
+ }
for (i = 0; i < tun->params[j].count; i++) {
if (freq > tun->params[j].ranges[i].limit)
continue;
@@ -333,9 +341,15 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
u8 buffer[4];
u16 div;
int rc, j;
+ enum param_type desired_type = TUNER_PARAM_TYPE_RADIO;
tun = &tuners[t->type];
- j = TUNER_PARAM_ANALOG;
+
+ for (j = 0; j < tun->count-1; j++) {
+ if (desired_type != tun->params[j].type)
+ continue;
+ break;
+ }
div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
buffer[2] = (tun->params[j].ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */