aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-12-16 00:56:08 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:00 -0400
commitd54093afb1eaa34ff0026cfcf72f471b9bf77e8a (patch)
tree1a2722b37e0448cac754c2c7c009f0ff48a6648e /drivers/media/dvb
parentb72857dd457b96de653b19b3c40394dac6285819 (diff)
V4L/DVB (10746): sms1xxx: enable rf switch on Hauppauge Tiger devices
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/siano/sms-cards.c23
-rw-r--r--drivers/media/dvb/siano/sms-cards.h3
-rw-r--r--drivers/media/dvb/siano/smsdvb.c19
3 files changed, 42 insertions, 3 deletions
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c
index 79f5715c01fd..6c8faeb74840 100644
--- a/drivers/media/dvb/siano/sms-cards.c
+++ b/drivers/media/dvb/siano/sms-cards.c
@@ -117,6 +117,7 @@ static struct sms_board sms_boards[] = {
117 .type = SMS_NOVA_B0, 117 .type = SMS_NOVA_B0,
118 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", 118 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
119 .lna_ctrl = 29, 119 .lna_ctrl = 29,
120 .rf_switch = 17,
120 }, 121 },
121 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = { 122 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
122 .name = "Hauppauge WinTV MiniCard", 123 .name = "Hauppauge WinTV MiniCard",
@@ -199,8 +200,8 @@ int sms_board_power(struct smscore_device_t *coredev, int onoff)
199 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: 200 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
200 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: 201 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
201 /* LNA */ 202 /* LNA */
202 sms_set_gpio(coredev, 203 if (!onoff)
203 board->lna_ctrl, onoff ? 1 : 0); 204 sms_set_gpio(coredev, board->lna_ctrl, 0);
204 break; 205 break;
205 } 206 }
206 return 0; 207 return 0;
@@ -227,3 +228,21 @@ int sms_board_led_feedback(struct smscore_device_t *coredev, int led)
227 } 228 }
228 return 0; 229 return 0;
229} 230}
231
232int sms_board_lna_control(struct smscore_device_t *coredev, int onoff)
233{
234 int board_id = smscore_get_board_id(coredev);
235 struct sms_board *board = sms_get_board(board_id);
236
237 sms_debug("%s: LNA %s", __func__, onoff ? "enabled" : "disabled");
238
239 switch (board_id) {
240 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
241 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
242 sms_set_gpio(coredev,
243 board->rf_switch, onoff ? 1 : 0);
244 return sms_set_gpio(coredev,
245 board->lna_ctrl, onoff ? 1 : 0);
246 }
247 return -EINVAL;
248}
diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h
index 8e0fe9fd2610..fe292aaea4cc 100644
--- a/drivers/media/dvb/siano/sms-cards.h
+++ b/drivers/media/dvb/siano/sms-cards.h
@@ -40,7 +40,7 @@ struct sms_board {
40 char *name, *fw[DEVICE_MODE_MAX]; 40 char *name, *fw[DEVICE_MODE_MAX];
41 41
42 /* gpios */ 42 /* gpios */
43 int led_power, led_hi, led_lo, lna_ctrl; 43 int led_power, led_hi, led_lo, lna_ctrl, rf_switch;
44}; 44};
45 45
46struct sms_board *sms_get_board(int id); 46struct sms_board *sms_get_board(int id);
@@ -52,6 +52,7 @@ int sms_board_setup(struct smscore_device_t *coredev);
52#define SMS_LED_HI 2 52#define SMS_LED_HI 2
53int sms_board_led_feedback(struct smscore_device_t *coredev, int led); 53int sms_board_led_feedback(struct smscore_device_t *coredev, int led);
54int sms_board_power(struct smscore_device_t *coredev, int onoff); 54int sms_board_power(struct smscore_device_t *coredev, int onoff);
55int sms_board_lna_control(struct smscore_device_t *coredev, int onoff);
55 56
56extern struct usb_device_id smsusb_id_table[]; 57extern struct usb_device_id smsusb_id_table[];
57 58
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c
index 2da953a4f4f5..0a7af92b66aa 100644
--- a/drivers/media/dvb/siano/smsdvb.c
+++ b/drivers/media/dvb/siano/smsdvb.c
@@ -262,6 +262,7 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
262 struct SmsMsgHdr_ST Msg; 262 struct SmsMsgHdr_ST Msg;
263 u32 Data[3]; 263 u32 Data[3];
264 } Msg; 264 } Msg;
265 int ret;
265 266
266 Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; 267 Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
267 Msg.Msg.msgDstId = HIF_TASK; 268 Msg.Msg.msgDstId = HIF_TASK;
@@ -282,6 +283,24 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
282 default: return -EINVAL; 283 default: return -EINVAL;
283 } 284 }
284 285
286 /* Disable LNA, if any. An error is returned if no LNA is present */
287 ret = sms_board_lna_control(client->coredev, 0);
288 if (ret == 0) {
289 fe_status_t status;
290
291 /* tune with LNA off at first */
292 ret = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
293 &client->tune_done);
294
295 smsdvb_read_status(fe, &status);
296
297 if (status & FE_HAS_LOCK)
298 return ret;
299
300 /* previous tune didnt lock - enable LNA and tune again */
301 sms_board_lna_control(client->coredev, 1);
302 }
303
285 return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), 304 return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
286 &client->tune_done); 305 &client->tune_done);
287} 306}