2 * Card-specific functions for the Siano SMS1xxx USB dongle
4 * Copyright (c) 2008 Michael Krufky <mkrufky@linuxtv.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
10 * Software distributed under the License is distributed on an "AS IS"
11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "sms-cards.h"
22 struct usb_device_id smsusb_id_table[] = {
23 #ifdef CONFIG_DVB_SIANO_SMS1XXX_SMS_IDS
24 { USB_DEVICE(0x187f, 0x0010),
25 .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
26 { USB_DEVICE(0x187f, 0x0100),
27 .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
28 { USB_DEVICE(0x187f, 0x0200),
29 .driver_info = SMS1XXX_BOARD_SIANO_NOVA_A },
30 { USB_DEVICE(0x187f, 0x0201),
31 .driver_info = SMS1XXX_BOARD_SIANO_NOVA_B },
32 { USB_DEVICE(0x187f, 0x0300),
33 .driver_info = SMS1XXX_BOARD_SIANO_VEGA },
35 { USB_DEVICE(0x2040, 0x1700),
36 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT },
37 { USB_DEVICE(0x2040, 0x1800),
38 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A },
39 { USB_DEVICE(0x2040, 0x1801),
40 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B },
41 { USB_DEVICE(0x2040, 0x2000),
42 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
43 { USB_DEVICE(0x2040, 0x2009),
44 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 },
45 { USB_DEVICE(0x2040, 0x200a),
46 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
47 { USB_DEVICE(0x2040, 0x2010),
48 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
49 { USB_DEVICE(0x2040, 0x2019),
50 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
51 { USB_DEVICE(0x2040, 0x5500),
52 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
53 { USB_DEVICE(0x2040, 0x5510),
54 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
55 { USB_DEVICE(0x2040, 0x5520),
56 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
57 { USB_DEVICE(0x2040, 0x5530),
58 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
59 { USB_DEVICE(0x2040, 0x5580),
60 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
61 { USB_DEVICE(0x2040, 0x5590),
62 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
63 { } /* Terminating entry */
65 MODULE_DEVICE_TABLE(usb, smsusb_id_table);
67 static struct sms_board sms_boards[] = {
68 [SMS_BOARD_UNKNOWN] = {
69 .name = "Unknown board",
71 [SMS1XXX_BOARD_SIANO_STELLAR] = {
72 .name = "Siano Stellar Digital Receiver",
74 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw",
76 [SMS1XXX_BOARD_SIANO_NOVA_A] = {
77 .name = "Siano Nova A Digital Receiver",
79 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw",
81 [SMS1XXX_BOARD_SIANO_NOVA_B] = {
82 .name = "Siano Nova B Digital Receiver",
84 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
86 [SMS1XXX_BOARD_SIANO_VEGA] = {
87 .name = "Siano Vega Digital Receiver",
90 [SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT] = {
91 .name = "Hauppauge Catamount",
93 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw",
95 [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A] = {
96 .name = "Hauppauge Okemo-A",
98 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw",
100 [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B] = {
101 .name = "Hauppauge Okemo-B",
103 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
105 [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
106 .name = "Hauppauge WinTV MiniStick",
108 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
113 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = {
114 .name = "Hauppauge WinTV MiniCard",
116 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
119 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
120 .name = "Hauppauge WinTV MiniCard",
122 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
127 struct sms_board *sms_get_board(int id)
129 BUG_ON(id >= ARRAY_SIZE(sms_boards));
131 return &sms_boards[id];
134 static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable)
138 struct smscore_gpio_config gpioconfig = {
139 .direction = SMS_GPIO_DIRECTION_OUTPUT,
140 .pullupdown = SMS_GPIO_PULLUPDOWN_NONE,
141 .inputcharacteristics = SMS_GPIO_INPUTCHARACTERISTICS_NORMAL,
142 .outputslewrate = SMS_GPIO_OUTPUTSLEWRATE_FAST,
143 .outputdriving = SMS_GPIO_OUTPUTDRIVING_4mA,
152 lvl = enable ? 0 : 1;
155 lvl = enable ? 1 : 0;
158 ret = smscore_configure_gpio(coredev, gpio, &gpioconfig);
162 return smscore_set_gpio(coredev, gpio, lvl);
165 int sms_board_setup(struct smscore_device_t *coredev)
167 int board_id = smscore_get_board_id(coredev);
168 struct sms_board *board = sms_get_board(board_id);
171 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
172 /* turn off all LEDs */
173 sms_set_gpio(coredev, board->led_power, 0);
174 sms_set_gpio(coredev, board->led_hi, 0);
175 sms_set_gpio(coredev, board->led_lo, 0);
177 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
178 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
180 sms_set_gpio(coredev, board->lna_ctrl, 0);
186 int sms_board_power(struct smscore_device_t *coredev, int onoff)
188 int board_id = smscore_get_board_id(coredev);
189 struct sms_board *board = sms_get_board(board_id);
192 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
194 sms_set_gpio(coredev,
195 board->led_power, onoff ? 1 : 0);
197 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
198 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
200 sms_set_gpio(coredev,
201 board->lna_ctrl, onoff ? 1 : 0);
207 int sms_board_led_feedback(struct smscore_device_t *coredev, int led)
209 int board_id = smscore_get_board_id(coredev);
210 struct sms_board *board = sms_get_board(board_id);
212 /* dont touch GPIO if LEDs are already set */
213 if (smscore_led_state(coredev, -1) == led)
217 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
218 sms_set_gpio(coredev,
219 board->led_lo, (led & SMS_LED_LO) ? 1 : 0);
220 sms_set_gpio(coredev,
221 board->led_hi, (led & SMS_LED_HI) ? 1 : 0);
223 smscore_led_state(coredev, led);