diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2006-02-07 03:25:34 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-02-07 03:25:34 -0500 |
commit | 476d63d061a082bcb833009e15a3632459a3caad (patch) | |
tree | 429773b4599fbca8d07554c4c2b27c5464f80033 /drivers | |
parent | 5f5941872c0035cb4624efe8c5a1dfbb89d199e7 (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')
-rw-r--r-- | drivers/media/video/tuner-simple.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 907ea8c5d9b3..58fa0d29962b 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"); | |||
79 | #define TUNER_PLL_LOCKED 0x40 | 79 | #define TUNER_PLL_LOCKED 0x40 |
80 | #define TUNER_STEREO_MK3 0x04 | 80 | #define TUNER_STEREO_MK3 0x04 |
81 | 81 | ||
82 | #define TUNER_PARAM_ANALOG 0 /* to be removed */ | ||
83 | /* FIXME: | 82 | /* FIXME: |
84 | * Right now, all tuners are using the first tuner_params[] array element | 83 | * Right now, all tuners are using the first tuner_params[] array element |
85 | * for analog mode. In the future, we will be merging similar tuner | 84 | * for analog mode. In the future, we will be merging similar tuner |
86 | * definitions together, such that each tuner definition will have a | 85 | * definitions together, such that each tuner definition will have a |
87 | * tuner_params struct for each available video standard. At that point, | 86 | * tuner_params struct for each available video standard. At that point, |
88 | * TUNER_PARAM_ANALOG will be removed, and the tuner_params[] array | 87 | * the tuner_params[] array element will be chosen based on the video |
89 | * element will be chosen based on the video standard in use. | 88 | * standard in use. |
90 | * | 89 | * |
91 | */ | 90 | */ |
92 | 91 | ||
@@ -138,9 +137,9 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
138 | struct tunertype *tun; | 137 | struct tunertype *tun; |
139 | u8 buffer[4]; | 138 | u8 buffer[4]; |
140 | int rc, IFPCoff, i, j; | 139 | int rc, IFPCoff, i, j; |
140 | enum param_type desired_type; | ||
141 | 141 | ||
142 | tun = &tuners[t->type]; | 142 | tun = &tuners[t->type]; |
143 | j = TUNER_PARAM_ANALOG; | ||
144 | 143 | ||
145 | /* IFPCoff = Video Intermediate Frequency - Vif: | 144 | /* IFPCoff = Video Intermediate Frequency - Vif: |
146 | 940 =16*58.75 NTSC/J (Japan) | 145 | 940 =16*58.75 NTSC/J (Japan) |
@@ -155,16 +154,25 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
155 | */ | 154 | */ |
156 | 155 | ||
157 | if (t->std == V4L2_STD_NTSC_M_JP) { | 156 | if (t->std == V4L2_STD_NTSC_M_JP) { |
158 | IFPCoff = 940; | 157 | IFPCoff = 940; |
158 | desired_type = TUNER_PARAM_TYPE_NTSC; | ||
159 | } else if ((t->std & V4L2_STD_MN) && | 159 | } else if ((t->std & V4L2_STD_MN) && |
160 | !(t->std & ~V4L2_STD_MN)) { | 160 | !(t->std & ~V4L2_STD_MN)) { |
161 | IFPCoff = 732; | 161 | IFPCoff = 732; |
162 | desired_type = TUNER_PARAM_TYPE_NTSC; | ||
162 | } else if (t->std == V4L2_STD_SECAM_LC) { | 163 | } else if (t->std == V4L2_STD_SECAM_LC) { |
163 | IFPCoff = 543; | 164 | IFPCoff = 543; |
165 | desired_type = TUNER_PARAM_TYPE_SECAM; | ||
164 | } else { | 166 | } else { |
165 | IFPCoff = 623; | 167 | IFPCoff = 623; |
168 | desired_type = TUNER_PARAM_TYPE_PAL; | ||
166 | } | 169 | } |
167 | 170 | ||
171 | for (j = 0; j < tun->count-1; j++) { | ||
172 | if (desired_type != tun->params[j].type) | ||
173 | continue; | ||
174 | break; | ||
175 | } | ||
168 | for (i = 0; i < tun->params[j].count; i++) { | 176 | for (i = 0; i < tun->params[j].count; i++) { |
169 | if (freq > tun->params[j].ranges[i].limit) | 177 | if (freq > tun->params[j].ranges[i].limit) |
170 | continue; | 178 | continue; |
@@ -333,9 +341,15 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
333 | u8 buffer[4]; | 341 | u8 buffer[4]; |
334 | u16 div; | 342 | u16 div; |
335 | int rc, j; | 343 | int rc, j; |
344 | enum param_type desired_type = TUNER_PARAM_TYPE_RADIO; | ||
336 | 345 | ||
337 | tun = &tuners[t->type]; | 346 | tun = &tuners[t->type]; |
338 | j = TUNER_PARAM_ANALOG; | 347 | |
348 | for (j = 0; j < tun->count-1; j++) { | ||
349 | if (desired_type != tun->params[j].type) | ||
350 | continue; | ||
351 | break; | ||
352 | } | ||
339 | 353 | ||
340 | div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ | 354 | div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ |
341 | buffer[2] = (tun->params[j].ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ | 355 | buffer[2] = (tun->params[j].ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ |