V4L/DVB (9735): sms1xxx: turn off LEDs after initialization of Hauppauge WinTV MiniStick
authorMichael Krufky <mkrufky@linuxtv.org>
Mon, 17 Nov 2008 01:45:42 +0000 (22:45 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 29 Dec 2008 19:53:40 +0000 (17:53 -0200)
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 4344efb3e8580c3415ee7d201571b953c231b566..8eccd33eac30b007c9302615261a8ae6bb21f185 100644 (file)
@@ -106,11 +106,21 @@ static struct sms_board sms_boards[] = {
                .name   = "Hauppauge WinTV MiniStick",
                .type   = SMS_NOVA_B0,
                .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
+               .led_power = 26,
+               .led_lo    = 27,
+               .led_hi    = 28,
        },
        [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = {
                .name   = "Hauppauge WinTV MiniCard",
                .type   = SMS_NOVA_B0,
                .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
+               .lna_ctrl  = 29,
+       },
+       [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
+               .name   = "Hauppauge WinTV MiniCard",
+               .type   = SMS_NOVA_B0,
+               .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
+               .lna_ctrl  = 1,
        },
 };
 
@@ -121,3 +131,40 @@ struct sms_board *sms_get_board(int id)
        return &sms_boards[id];
 }
 
+static int sms_set_gpio(struct smscore_device_t *coredev, u32 pin, int enable)
+{
+       int ret;
+       struct smscore_gpio_config gpioconfig = {
+               .direction            = SMS_GPIO_DIRECTION_OUTPUT,
+               .pullupdown           = SMS_GPIO_PULLUPDOWN_NONE,
+               .inputcharacteristics = SMS_GPIO_INPUTCHARACTERISTICS_NORMAL,
+               .outputslewrate       = SMS_GPIO_OUTPUTSLEWRATE_FAST,
+               .outputdriving        = SMS_GPIO_OUTPUTDRIVING_4mA,
+       };
+
+       if (pin == 0)
+               return -EINVAL;
+
+       ret = smscore_configure_gpio(coredev, pin, &gpioconfig);
+
+       if (ret < 0)
+               return ret;
+
+       return smscore_set_gpio(coredev, pin, enable);
+}
+
+int sms_board_setup(struct smscore_device_t *coredev)
+{
+       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:
+               /* turn off all LEDs */
+               sms_set_gpio(coredev, board->led_power, 0);
+               sms_set_gpio(coredev, board->led_hi, 0);
+               sms_set_gpio(coredev, board->led_lo, 0);
+               break;
+       }
+       return 0;
+}
index 240d8b359d5ac482f77a2bcafe4927d46bd49303..25820909bf6dccc3d52d8b053696f3a892611767 100644 (file)
 struct sms_board {
        enum sms_device_type_st type;
        char *name, *fw[DEVICE_MODE_MAX];
+
+       /* gpios */
+       int led_power, led_hi, led_lo;
 };
 
 struct sms_board *sms_get_board(int id);
 
+int sms_board_setup(struct smscore_device_t *coredev);
+
 extern struct usb_device_id smsusb_id_table[];
 
 #endif /* __SMS_CARDS_H__ */
index 8d490e133f350aa3c41c346b8c1fb2b397488d99..592c28403c87010fbafe4413ac41066ff8cbc295 100644 (file)
@@ -402,6 +402,8 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
 
        sms_info("success");
 
+       sms_board_setup(coredev);
+
        return 0;
 
 client_error: