aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-04-22 13:46:12 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:53 -0400
commit65511611dd0a5219b431a8a08cff6f8f7ab83aa5 (patch)
tree5009847bc3e5de0f21ab32c6ab9cd738904d45fa /drivers/media
parent26f1b942156766c6ff1a70fb2ac463c6fce31309 (diff)
V4L/DVB (7407): tuner-simple: add module options to specify rf input
Add module options to tuner-simple, called "atv_input" and "dtv_input" to specify which rf input to use on devices with multiple rf inputs. If the module option is not specified, then the driver will autoselect the rf input, as per previous behavior. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/tuner-simple.c59
1 files changed, 47 insertions, 12 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 273030bda6d9..8d6d2c803f92 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -17,10 +17,22 @@ static int debug;
17module_param(debug, int, 0644); 17module_param(debug, int, 0644);
18MODULE_PARM_DESC(debug, "enable verbose debug messages"); 18MODULE_PARM_DESC(debug, "enable verbose debug messages");
19 19
20#define TUNER_SIMPLE_MAX 64
21static unsigned int simple_devcount;
22
20static int offset; 23static int offset;
21module_param(offset, int, 0664); 24module_param(offset, int, 0664);
22MODULE_PARM_DESC(offset, "Allows to specify an offset for tuner"); 25MODULE_PARM_DESC(offset, "Allows to specify an offset for tuner");
23 26
27static unsigned int atv_input[TUNER_SIMPLE_MAX] = \
28 { [0 ... (TUNER_SIMPLE_MAX-1)] = 0 };
29static unsigned int dtv_input[TUNER_SIMPLE_MAX] = \
30 { [0 ... (TUNER_SIMPLE_MAX-1)] = 0 };
31module_param_array(atv_input, int, NULL, 0644);
32module_param_array(dtv_input, int, NULL, 0644);
33MODULE_PARM_DESC(atv_input, "specify atv rf input, 0 for autoselect");
34MODULE_PARM_DESC(dtv_input, "specify dtv rf input, 0 for autoselect");
35
24/* ---------------------------------------------------------------------- */ 36/* ---------------------------------------------------------------------- */
25 37
26/* tv standard selection for Temic 4046 FM5 38/* tv standard selection for Temic 4046 FM5
@@ -92,6 +104,7 @@ static DEFINE_MUTEX(tuner_simple_list_mutex);
92static LIST_HEAD(hybrid_tuner_instance_list); 104static LIST_HEAD(hybrid_tuner_instance_list);
93 105
94struct tuner_simple_priv { 106struct tuner_simple_priv {
107 unsigned int nr;
95 u16 last_div; 108 u16 last_div;
96 109
97 struct tuner_i2c_props i2c_props; 110 struct tuner_i2c_props i2c_props;
@@ -364,7 +377,6 @@ static int simple_std_setup(struct dvb_frontend *fe,
364 *cb &= ~0x03; 377 *cb &= ~0x03;
365 if (!(params->std & V4L2_STD_ATSC)) 378 if (!(params->std & V4L2_STD_ATSC))
366 *cb |= 2; 379 *cb |= 2;
367 /* FIXME: input */
368 break; 380 break;
369 381
370 case TUNER_MICROTUNE_4042FI5: 382 case TUNER_MICROTUNE_4042FI5:
@@ -396,10 +408,11 @@ static int simple_std_setup(struct dvb_frontend *fe,
396 tuner_warn("i2c i/o error: rc == %d " 408 tuner_warn("i2c i/o error: rc == %d "
397 "(should be 2)\n", rc); 409 "(should be 2)\n", rc);
398 priv->i2c_props.addr = tuneraddr; 410 priv->i2c_props.addr = tuneraddr;
399 /* FIXME: input */
400 break; 411 break;
401 } 412 }
402 } 413 }
414 if (atv_input[priv->nr])
415 simple_set_rf_input(fe, config, cb, atv_input[priv->nr]);
403 416
404 return 0; 417 return 0;
405} 418}
@@ -770,16 +783,19 @@ static void simple_set_dvb(struct dvb_frontend *fe, u8 *buf,
770 { 783 {
771 unsigned int new_rf; 784 unsigned int new_rf;
772 785
773 switch (params->u.vsb.modulation) { 786 if (dtv_input[priv->nr])
774 case QAM_64: 787 new_rf = dtv_input[priv->nr];
775 case QAM_256: 788 else
776 new_rf = 1; 789 switch (params->u.vsb.modulation) {
777 break; 790 case QAM_64:
778 case VSB_8: 791 case QAM_256:
779 default: 792 new_rf = 1;
780 new_rf = 0; 793 break;
781 break; 794 case VSB_8:
782 } 795 default:
796 new_rf = 0;
797 break;
798 }
783 simple_set_rf_input(fe, &buf[2], &buf[3], new_rf); 799 simple_set_rf_input(fe, &buf[2], &buf[3], new_rf);
784 break; 800 break;
785 } 801 }
@@ -1025,6 +1041,7 @@ struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
1025 1041
1026 priv->type = type; 1042 priv->type = type;
1027 priv->tun = &tuners[type]; 1043 priv->tun = &tuners[type];
1044 priv->nr = simple_devcount++;
1028 break; 1045 break;
1029 default: 1046 default:
1030 fe->tuner_priv = priv; 1047 fe->tuner_priv = priv;
@@ -1038,6 +1055,24 @@ struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
1038 1055
1039 tuner_info("type set to %d (%s)\n", type, priv->tun->name); 1056 tuner_info("type set to %d (%s)\n", type, priv->tun->name);
1040 1057
1058 if ((debug) || ((atv_input[priv->nr] > 0) ||
1059 (dtv_input[priv->nr] > 0))) {
1060 if (0 == atv_input[priv->nr])
1061 tuner_info("tuner %d atv rf input will be "
1062 "autoselected\n", priv->nr);
1063 else
1064 tuner_info("tuner %d atv rf input will be "
1065 "set to input %d (insmod option)\n",
1066 priv->nr, atv_input[priv->nr]);
1067 if (0 == dtv_input[priv->nr])
1068 tuner_info("tuner %d dtv rf input will be "
1069 "autoselected\n", priv->nr);
1070 else
1071 tuner_info("tuner %d dtv rf input will be "
1072 "set to input %d (insmod option)\n",
1073 priv->nr, dtv_input[priv->nr]);
1074 }
1075
1041 strlcpy(fe->ops.tuner_ops.info.name, priv->tun->name, 1076 strlcpy(fe->ops.tuner_ops.info.name, priv->tun->name,
1042 sizeof(fe->ops.tuner_ops.info.name)); 1077 sizeof(fe->ops.tuner_ops.info.name));
1043 1078