diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-11-22 13:32:19 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-29 14:53:41 -0500 |
commit | 7b29e10d609035b5f93546ac6bcd1c5d810476a7 (patch) | |
tree | d5081671260df6195f37952e29515f1c7bdb0356 /drivers/media/dvb | |
parent | 851a90914346b9a3b1afc0ae9c1ed2eb3dae9b5a (diff) |
V4L/DVB (9739): sms1xxx: enable signal quality indicator LEDs on Hauppauge WinTV MiniStick
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.c | 22 | ||||
-rw-r--r-- | drivers/media/dvb/siano/sms-cards.h | 4 | ||||
-rw-r--r-- | drivers/media/dvb/siano/smscoreapi.c | 8 | ||||
-rw-r--r-- | drivers/media/dvb/siano/smscoreapi.h | 2 | ||||
-rw-r--r-- | drivers/media/dvb/siano/smsdvb.c | 15 |
5 files changed, 49 insertions, 2 deletions
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index e17eb35877fc..f4eb46a7c905 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c | |||
@@ -183,3 +183,25 @@ int sms_board_power(struct smscore_device_t *coredev, int onoff) | |||
183 | } | 183 | } |
184 | return 0; | 184 | return 0; |
185 | } | 185 | } |
186 | |||
187 | int sms_board_led_feedback(struct smscore_device_t *coredev, int led) | ||
188 | { | ||
189 | int board_id = smscore_get_board_id(coredev); | ||
190 | struct sms_board *board = sms_get_board(board_id); | ||
191 | |||
192 | /* dont touch GPIO if LEDs are already set */ | ||
193 | if (smscore_led_state(coredev, -1) == led) | ||
194 | return 0; | ||
195 | |||
196 | switch (board_id) { | ||
197 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
198 | sms_set_gpio(coredev, | ||
199 | board->led_lo, (led & SMS_LED_LO) ? 1 : 0); | ||
200 | sms_set_gpio(coredev, | ||
201 | board->led_hi, (led & SMS_LED_HI) ? 1 : 0); | ||
202 | |||
203 | smscore_led_state(coredev, led); | ||
204 | break; | ||
205 | } | ||
206 | return 0; | ||
207 | } | ||
diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h index f68da5d77998..5c013c4390d7 100644 --- a/drivers/media/dvb/siano/sms-cards.h +++ b/drivers/media/dvb/siano/sms-cards.h | |||
@@ -46,6 +46,10 @@ struct sms_board *sms_get_board(int id); | |||
46 | 46 | ||
47 | int sms_board_setup(struct smscore_device_t *coredev); | 47 | int sms_board_setup(struct smscore_device_t *coredev); |
48 | 48 | ||
49 | #define SMS_LED_OFF 0 | ||
50 | #define SMS_LED_LO 1 | ||
51 | #define SMS_LED_HI 2 | ||
52 | int sms_board_led_feedback(struct smscore_device_t *coredev, int led); | ||
49 | int sms_board_power(struct smscore_device_t *coredev, int onoff); | 53 | int sms_board_power(struct smscore_device_t *coredev, int onoff); |
50 | 54 | ||
51 | extern struct usb_device_id smsusb_id_table[]; | 55 | extern struct usb_device_id smsusb_id_table[]; |
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index b0e8bcb1238d..cf613f22fb8d 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c | |||
@@ -91,6 +91,7 @@ struct smscore_device_t { | |||
91 | struct completion init_device_done, reload_start_done, resume_done; | 91 | struct completion init_device_done, reload_start_done, resume_done; |
92 | 92 | ||
93 | int board_id; | 93 | int board_id; |
94 | int led_state; | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | void smscore_set_board_id(struct smscore_device_t *core, int id) | 97 | void smscore_set_board_id(struct smscore_device_t *core, int id) |
@@ -98,6 +99,13 @@ void smscore_set_board_id(struct smscore_device_t *core, int id) | |||
98 | core->board_id = id; | 99 | core->board_id = id; |
99 | } | 100 | } |
100 | 101 | ||
102 | int smscore_led_state(struct smscore_device_t *core, int led) | ||
103 | { | ||
104 | if (led >= 0) | ||
105 | core->led_state = led; | ||
106 | return core->led_state; | ||
107 | } | ||
108 | |||
101 | int smscore_get_board_id(struct smscore_device_t *core) | 109 | int smscore_get_board_id(struct smscore_device_t *core) |
102 | { | 110 | { |
103 | return core->board_id; | 111 | return core->board_id; |
diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index 6b3fb86c814b..760e233fcbc5 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h | |||
@@ -431,6 +431,8 @@ int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level); | |||
431 | void smscore_set_board_id(struct smscore_device_t *core, int id); | 431 | void smscore_set_board_id(struct smscore_device_t *core, int id); |
432 | int smscore_get_board_id(struct smscore_device_t *core); | 432 | int smscore_get_board_id(struct smscore_device_t *core); |
433 | 433 | ||
434 | int smscore_led_state(struct smscore_device_t *core, int led); | ||
435 | |||
434 | /* smsdvb.c */ | 436 | /* smsdvb.c */ |
435 | int smsdvb_register(void); | 437 | int smsdvb_register(void); |
436 | void smsdvb_unregister(void); | 438 | void smsdvb_unregister(void); |
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index adf00b989c12..2da953a4f4f5 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c | |||
@@ -167,8 +167,18 @@ static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) | |||
167 | struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, | 167 | struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, |
168 | DVBT_BDA_CONTROL_MSG_ID, | 168 | DVBT_BDA_CONTROL_MSG_ID, |
169 | HIF_TASK, sizeof(struct SmsMsgHdr_ST), 0 }; | 169 | HIF_TASK, sizeof(struct SmsMsgHdr_ST), 0 }; |
170 | return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | 170 | int ret = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), |
171 | &client->stat_done); | 171 | &client->stat_done); |
172 | if (ret < 0) | ||
173 | return ret; | ||
174 | |||
175 | if (client->fe_status & FE_HAS_LOCK) | ||
176 | sms_board_led_feedback(client->coredev, | ||
177 | (client->fe_unc == 0) ? | ||
178 | SMS_LED_HI : SMS_LED_LO); | ||
179 | else | ||
180 | sms_board_led_feedback(client->coredev, SMS_LED_OFF); | ||
181 | return ret; | ||
172 | } | 182 | } |
173 | 183 | ||
174 | static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) | 184 | static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) |
@@ -306,6 +316,7 @@ static int smsdvb_sleep(struct dvb_frontend *fe) | |||
306 | struct smsdvb_client_t *client = | 316 | struct smsdvb_client_t *client = |
307 | container_of(fe, struct smsdvb_client_t, frontend); | 317 | container_of(fe, struct smsdvb_client_t, frontend); |
308 | 318 | ||
319 | sms_board_led_feedback(client->coredev, SMS_LED_OFF); | ||
309 | sms_board_power(client->coredev, 0); | 320 | sms_board_power(client->coredev, 0); |
310 | 321 | ||
311 | return 0; | 322 | return 0; |