aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-core.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-01-09 12:25:15 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:25:15 -0500
commitcd43c3f60b73512744bb22fe27a266f611466827 (patch)
tree92b935fd4d11b0f7309ab4841e178925efb6826b /drivers/media/video/tuner-core.c
parent7865c44d8ae832d6fb6522862268c7bd7814fd44 (diff)
V4L/DVB (3103): Add VIDIOC_LOG_STATUS to tuner-core.c
- Mark tda9887.c status log values as hexadecimal (add 0x prefix). Add VIDIOC_LOG_STATUS support to tuner-core.c. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video/tuner-core.c')
-rw-r--r--drivers/media/video/tuner-core.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index c13c7b95ef3..ae76113886f 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -475,6 +475,38 @@ static inline int check_v4l2(struct tuner *t)
475 return 0; 475 return 0;
476} 476}
477 477
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
478static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) 510static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
479{ 511{
480 struct tuner *t = i2c_get_clientdata(client); 512 struct tuner *t = i2c_get_clientdata(client);
@@ -708,6 +740,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
708 } 740 }
709 break; 741 break;
710 } 742 }
743 case VIDIOC_LOG_STATUS:
744 tuner_status(client);
745 break;
711 default: 746 default:
712 tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp='%c',nr=%d,sz=%d)\n", 747 tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp='%c',nr=%d,sz=%d)\n",
713 cmd, _IOC_DIR(cmd), _IOC_TYPE(cmd), 748 cmd, _IOC_DIR(cmd), _IOC_TYPE(cmd),