summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-12-16 00:56:08 -0500
committerMichael Krufky <mkrufky@linuxtv.org>2008-12-16 00:56:08 -0500
commitcc7185f96b8e9132c28118367f6c84569939c37d (patch)
tree749ea1959715a1f2f6ba92fbb0f9bb0ed17a2a6c /linux
parent40db5f952453121ccdf3ad610cb209984df4b1c0 (diff)
downloadmediapointer-dvb-s2-cc7185f96b8e9132c28118367f6c84569939c37d.tar.gz
mediapointer-dvb-s2-cc7185f96b8e9132c28118367f6c84569939c37d.tar.bz2
sms1xxx: enable rf switch on Hauppauge Tiger devices
From: Michael Krufky <mkrufky@linuxtv.org> Priority: normal Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/siano/sms-cards.c23
-rw-r--r--linux/drivers/media/dvb/siano/sms-cards.h3
-rw-r--r--linux/drivers/media/dvb/siano/smsdvb.c19
3 files changed, 42 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/siano/sms-cards.c b/linux/drivers/media/dvb/siano/sms-cards.c
index 79f5715c0..6c8faeb74 100644
--- a/linux/drivers/media/dvb/siano/sms-cards.c
+++ b/linux/drivers/media/dvb/siano/sms-cards.c
@@ -117,6 +117,7 @@ static struct sms_board sms_boards[] = {
.type = SMS_NOVA_B0,
.fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
.lna_ctrl = 29,
+ .rf_switch = 17,
},
[SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
.name = "Hauppauge WinTV MiniCard",
@@ -199,8 +200,8 @@ int sms_board_power(struct smscore_device_t *coredev, int onoff)
case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
/* LNA */
- sms_set_gpio(coredev,
- board->lna_ctrl, onoff ? 1 : 0);
+ if (!onoff)
+ sms_set_gpio(coredev, board->lna_ctrl, 0);
break;
}
return 0;
@@ -227,3 +228,21 @@ int sms_board_led_feedback(struct smscore_device_t *coredev, int led)
}
return 0;
}
+
+int sms_board_lna_control(struct smscore_device_t *coredev, int onoff)
+{
+ int board_id = smscore_get_board_id(coredev);
+ struct sms_board *board = sms_get_board(board_id);
+
+ sms_debug("%s: LNA %s", __func__, onoff ? "enabled" : "disabled");
+
+ switch (board_id) {
+ case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
+ case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
+ sms_set_gpio(coredev,
+ board->rf_switch, onoff ? 1 : 0);
+ return sms_set_gpio(coredev,
+ board->lna_ctrl, onoff ? 1 : 0);
+ }
+ return -EINVAL;
+}
diff --git a/linux/drivers/media/dvb/siano/sms-cards.h b/linux/drivers/media/dvb/siano/sms-cards.h
index 8e0fe9fd2..fe292aaea 100644
--- a/linux/drivers/media/dvb/siano/sms-cards.h
+++ b/linux/drivers/media/dvb/siano/sms-cards.h
@@ -40,7 +40,7 @@ struct sms_board {
char *name, *fw[DEVICE_MODE_MAX];
/* gpios */
- int led_power, led_hi, led_lo, lna_ctrl;
+ int led_power, led_hi, led_lo, lna_ctrl, rf_switch;
};
struct sms_board *sms_get_board(int id);
@@ -52,6 +52,7 @@ int sms_board_setup(struct smscore_device_t *coredev);
#define SMS_LED_HI 2
int sms_board_led_feedback(struct smscore_device_t *coredev, int led);
int sms_board_power(struct smscore_device_t *coredev, int onoff);
+int sms_board_lna_control(struct smscore_device_t *coredev, int onoff);
extern struct usb_device_id smsusb_id_table[];
diff --git a/linux/drivers/media/dvb/siano/smsdvb.c b/linux/drivers/media/dvb/siano/smsdvb.c
index bbc87fe2e..a2efb402e 100644
--- a/linux/drivers/media/dvb/siano/smsdvb.c
+++ b/linux/drivers/media/dvb/siano/smsdvb.c
@@ -262,6 +262,7 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
struct SmsMsgHdr_ST Msg;
u32 Data[3];
} Msg;
+ int ret;
Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
Msg.Msg.msgDstId = HIF_TASK;
@@ -285,6 +286,24 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
default: return -EINVAL;
}
+ /* Disable LNA, if any. An error is returned if no LNA is present */
+ ret = sms_board_lna_control(client->coredev, 0);
+ if (ret == 0) {
+ fe_status_t status;
+
+ /* tune with LNA off at first */
+ ret = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
+ &client->tune_done);
+
+ smsdvb_read_status(fe, &status);
+
+ if (status & FE_HAS_LOCK)
+ return ret;
+
+ /* previous tune didnt lock - enable LNA and tune again */
+ sms_board_lna_control(client->coredev, 1);
+ }
+
return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
&client->tune_done);
}