aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:25:27 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:25:27 -0500
commit7e57819169d4f9a1d7af55fb645ece3fb981e2e3 (patch)
tree305775cb673de02f70aa6d169e2c0fa94b40d8e3
parent70f00044a2107a2c7d654bf1d3e0494f77777f47 (diff)
V4L/DVB (3167): added ntsc parameter to tuner and more standardized debugs
- Debug message changed to be coherent with other modules - added ntsc parameter - parameters moved to the beginning at the file - tuner_status moved to a better position. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
-rw-r--r--drivers/media/video/bttv-input.c2
-rw-r--r--drivers/media/video/tuner-core.c124
-rw-r--r--include/media/tuner.h10
3 files changed, 85 insertions, 51 deletions
diff --git a/drivers/media/video/bttv-input.c b/drivers/media/video/bttv-input.c
index 5027e10537cf..fa6ccbc6f26d 100644
--- a/drivers/media/video/bttv-input.c
+++ b/drivers/media/video/bttv-input.c
@@ -645,7 +645,7 @@ int bttv_input_init(struct bttv *btv)
645 645
646 /* all done */ 646 /* all done */
647 input_register_device(btv->remote->dev); 647 input_register_device(btv->remote->dev);
648 printk(DEVNAME ": %s detected at %s\n",ir->dev->name,ir->dev->phys); 648 printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys);
649 649
650 /* the remote isn't as bouncy as a keyboard */ 650 /* the remote isn't as bouncy as a keyboard */
651 ir->dev->rep[REP_DELAY] = repeat_delay; 651 ir->dev->rep[REP_DELAY] = repeat_delay;
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index c8ff849e8903..df994311251e 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -38,21 +38,27 @@ I2C_CLIENT_INSMOD;
38 38
39/* insmod options used at init time => read/only */ 39/* insmod options used at init time => read/only */
40static unsigned int addr = 0; 40static unsigned int addr = 0;
41module_param(addr, int, 0444);
42
43static unsigned int no_autodetect = 0; 41static unsigned int no_autodetect = 0;
44module_param(no_autodetect, int, 0444);
45
46static unsigned int show_i2c = 0; 42static unsigned int show_i2c = 0;
47module_param(show_i2c, int, 0444);
48 43
49/* insmod options used at runtime => read/write */ 44/* insmod options used at runtime => read/write */
50unsigned int tuner_debug = 0; 45unsigned int tuner_debug = 0;
51module_param(tuner_debug, int, 0644);
52 46
53static unsigned int tv_range[2] = { 44, 958 }; 47static unsigned int tv_range[2] = { 44, 958 };
54static unsigned int radio_range[2] = { 65, 108 }; 48static unsigned int radio_range[2] = { 65, 108 };
55 49
50static char pal[] = "--";
51static char secam[] = "--";
52static char ntsc[] = "-";
53
54module_param(addr, int, 0444);
55module_param(no_autodetect, int, 0444);
56module_param(show_i2c, int, 0444);
57module_param(tuner_debug, int, 0644);
58
59module_param_string(pal, pal, sizeof(pal), 0644);
60module_param_string(secam, secam, sizeof(secam), 0644);
61module_param_string(ntsc, ntsc, sizeof(ntsc), 0644);
56module_param_array(tv_range, int, NULL, 0644); 62module_param_array(tv_range, int, NULL, 0644);
57module_param_array(radio_range, int, NULL, 0644); 63module_param_array(radio_range, int, NULL, 0644);
58 64
@@ -249,11 +255,6 @@ static inline int check_mode(struct tuner *t, char *cmd)
249 return 0; 255 return 0;
250} 256}
251 257
252static char pal[] = "-";
253module_param_string(pal, pal, sizeof(pal), 0644);
254static char secam[] = "--";
255module_param_string(secam, secam, sizeof(secam), 0644);
256
257/* get more precise norm info from insmod option */ 258/* get more precise norm info from insmod option */
258static int tuner_fixup_std(struct tuner *t) 259static int tuner_fixup_std(struct tuner *t)
259{ 260{
@@ -285,8 +286,13 @@ static int tuner_fixup_std(struct tuner *t)
285 break; 286 break;
286 case 'N': 287 case 'N':
287 case 'n': 288 case 'n':
288 tuner_dbg ("insmod fixup: PAL => PAL-N\n"); 289 if (pal[1] == 'c' || pal[1] == 'C') {
289 t->std = V4L2_STD_PAL_N; 290 tuner_dbg("insmod fixup: PAL => PAL-Nc\n");
291 t->std = V4L2_STD_PAL_Nc;
292 } else {
293 tuner_dbg ("insmod fixup: PAL => PAL-N\n");
294 t->std = V4L2_STD_PAL_N;
295 }
290 break; 296 break;
291 case '-': 297 case '-':
292 /* default parameter, do nothing */ 298 /* default parameter, do nothing */
@@ -298,6 +304,15 @@ static int tuner_fixup_std(struct tuner *t)
298 } 304 }
299 if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { 305 if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
300 switch (secam[0]) { 306 switch (secam[0]) {
307 case 'b':
308 case 'B':
309 case 'g':
310 case 'G':
311 case 'h':
312 case 'H':
313 tuner_dbg("insmod fixup: SECAM => SECAM-BGH\n");
314 t->std = V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H;
315 break;
301 case 'd': 316 case 'd':
302 case 'D': 317 case 'D':
303 case 'k': 318 case 'k':
@@ -324,9 +339,60 @@ static int tuner_fixup_std(struct tuner *t)
324 } 339 }
325 } 340 }
326 341
342 if ((t->std & V4L2_STD_NTSC) == V4L2_STD_NTSC) {
343 switch (ntsc[0]) {
344 case 'm':
345 case 'M':
346 tuner_dbg("insmod fixup: NTSC => NTSC-M\n");
347 t->std = V4L2_STD_NTSC_M;
348 break;
349 case 'j':
350 case 'J':
351 tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n");
352 t->std = V4L2_STD_NTSC_M_JP;
353 break;
354 case '-':
355 /* default parameter, do nothing */
356 break;
357 default:
358 tuner_info("ntsc= argument not recognised\n");
359 break;
360 }
361 }
327 return 0; 362 return 0;
328} 363}
329 364
365static void tuner_status(struct i2c_client *client)
366{
367 struct tuner *t = i2c_get_clientdata(client);
368 unsigned long freq, freq_fraction;
369 const char *p;
370
371 switch (t->mode) {
372 case V4L2_TUNER_RADIO: p = "radio"; break;
373 case V4L2_TUNER_ANALOG_TV: p = "analog TV"; break;
374 case V4L2_TUNER_DIGITAL_TV: p = "digital TV"; break;
375 default: p = "undefined"; break;
376 }
377 if (t->mode == V4L2_TUNER_RADIO) {
378 freq = t->freq / 16000;
379 freq_fraction = (t->freq % 16000) * 100 / 16000;
380 } else {
381 freq = t->freq / 16;
382 freq_fraction = (t->freq % 16) * 100 / 16;
383 }
384 tuner_info("Tuner mode: %s\n", p);
385 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
386 tuner_info("Standard: 0x%08llx\n", t->std);
387 if (t->mode == V4L2_TUNER_RADIO) {
388 if (t->has_signal) {
389 tuner_info("Signal strength: %d\n", t->has_signal(client));
390 }
391 if (t->is_stereo) {
392 tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no");
393 }
394 }
395}
330/* ---------------------------------------------------------------------- */ 396/* ---------------------------------------------------------------------- */
331 397
332/* static var Used only in tuner_attach and tuner_probe */ 398/* static var Used only in tuner_attach and tuner_probe */
@@ -475,38 +541,6 @@ static inline int check_v4l2(struct tuner *t)
475 return 0; 541 return 0;
476} 542}
477 543
478static void tuner_status(struct i2c_client *client)
479{
480 struct tuner *t = i2c_get_clientdata(client);
481 unsigned long freq, freq_fraction;
482 const char *p;
483
484 switch (t->mode) {
485 case V4L2_TUNER_RADIO: p = "radio"; break;
486 case V4L2_TUNER_ANALOG_TV: p = "analog TV"; break;
487 case V4L2_TUNER_DIGITAL_TV: p = "digital TV"; break;
488 default: p = "undefined"; break;
489 }
490 if (t->mode == V4L2_TUNER_RADIO) {
491 freq = t->freq / 16000;
492 freq_fraction = (t->freq % 16000) * 100 / 16000;
493 } else {
494 freq = t->freq / 16;
495 freq_fraction = (t->freq % 16) * 100 / 16;
496 }
497 tuner_info("Tuner mode: %s\n", p);
498 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
499 tuner_info("Standard: 0x%08llx\n", t->std);
500 if (t->mode == V4L2_TUNER_RADIO) {
501 if (t->has_signal) {
502 tuner_info("Signal strength: %d\n", t->has_signal(client));
503 }
504 if (t->is_stereo) {
505 tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no");
506 }
507 }
508}
509
510static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) 544static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
511{ 545{
512 struct tuner *t = i2c_get_clientdata(client); 546 struct tuner *t = i2c_get_clientdata(client);
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 567f05549e3a..b39e908cd068 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -202,15 +202,15 @@ extern int tea5767_autodetection(struct i2c_client *c);
202 202
203#define tuner_warn(fmt, arg...) do {\ 203#define tuner_warn(fmt, arg...) do {\
204 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 204 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
205 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 205 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
206
206#define tuner_info(fmt, arg...) do {\ 207#define tuner_info(fmt, arg...) do {\
207 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 208 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
208 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 209 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
209#define tuner_dbg(fmt, arg...) do {\ 210#define tuner_dbg(fmt, arg...) do {\
210 if (tuner_debug) \ 211 if (tuner_debug) \
211 printk(KERN_DEBUG "%s %d-%04x: " fmt, \ 212 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
212 t->i2c.driver->driver.name, \ 213 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
213 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
214 214
215#endif /* __KERNEL__ */ 215#endif /* __KERNEL__ */
216 216