V4L/DVB (9736): sms1xxx: enable power LED on Hauppauge WinTV MiniStick
authorMichael Krufky <mkrufky@linuxtv.org>
Sat, 22 Nov 2008 17:26:37 +0000 (14:26 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 29 Dec 2008 19:53:40 +0000 (17:53 -0200)
Enable power LED while the frontend is in use.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/siano/sms-cards.c
drivers/media/dvb/siano/sms-cards.h
drivers/media/dvb/siano/smsdvb.c

index 8eccd33eac30b007c9302615261a8ae6bb21f185..e17eb35877fc4da6e00d336b313b32cf24b059ac 100644 (file)
@@ -168,3 +168,18 @@ int sms_board_setup(struct smscore_device_t *coredev)
        }
        return 0;
 }
+
+int sms_board_power(struct smscore_device_t *coredev, int onoff)
+{
+       int board_id = smscore_get_board_id(coredev);
+       struct sms_board *board = sms_get_board(board_id);
+
+       switch (board_id) {
+       case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
+               /* power LED */
+               sms_set_gpio(coredev,
+                            board->led_power, onoff ? 1 : 0);
+               break;
+       }
+       return 0;
+}
index 25820909bf6dccc3d52d8b053696f3a892611767..f68da5d77998b588404da9fa88a084c2337a3f74 100644 (file)
@@ -46,6 +46,8 @@ struct sms_board *sms_get_board(int id);
 
 int sms_board_setup(struct smscore_device_t *coredev);
 
+int sms_board_power(struct smscore_device_t *coredev, int onoff);
+
 extern struct usb_device_id smsusb_id_table[];
 
 #endif /* __SMS_CARDS_H__ */
index 592c28403c87010fbafe4413ac41066ff8cbc295..54144a3749468ac47c782fc0f6c98492d29b76fc 100644 (file)
@@ -273,6 +273,27 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe,
        /* todo: */
        memcpy(fep, &client->fe_params,
               sizeof(struct dvb_frontend_parameters));
+
+       return 0;
+}
+
+static int smsdvb_init(struct dvb_frontend *fe)
+{
+       struct smsdvb_client_t *client =
+               container_of(fe, struct smsdvb_client_t, frontend);
+
+       sms_board_power(client->coredev, 1);
+
+       return 0;
+}
+
+static int smsdvb_sleep(struct dvb_frontend *fe)
+{
+       struct smsdvb_client_t *client =
+               container_of(fe, struct smsdvb_client_t, frontend);
+
+       sms_board_power(client->coredev, 0);
+
        return 0;
 }
 
@@ -308,6 +329,9 @@ static struct dvb_frontend_ops smsdvb_fe_ops = {
        .read_ber = smsdvb_read_ber,
        .read_signal_strength = smsdvb_read_signal_strength,
        .read_snr = smsdvb_read_snr,
+
+       .init = smsdvb_init,
+       .sleep = smsdvb_sleep,
 };
 
 static int smsdvb_hotplug(struct smscore_device_t *coredev,