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, 0x2011),
50 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
51 { USB_DEVICE(0x2040, 0x2019),
52 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD },
53 { USB_DEVICE(0x2040, 0x5500),
54 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
55 { USB_DEVICE(0x2040, 0x5510),
56 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
57 { USB_DEVICE(0x2040, 0x5520),
58 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
59 { USB_DEVICE(0x2040, 0x5530),
60 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
61 { USB_DEVICE(0x2040, 0x5580),
62 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
63 { USB_DEVICE(0x2040, 0x5590),
64 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
65 { } /* Terminating entry */
67 MODULE_DEVICE_TABLE(usb, smsusb_id_table);
69 static struct sms_board sms_boards[] = {
70 [SMS_BOARD_UNKNOWN] = {
71 .name = "Unknown board",
73 [SMS1XXX_BOARD_SIANO_STELLAR] = {
74 .name = "Siano Stellar Digital Receiver",
76 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw",
78 [SMS1XXX_BOARD_SIANO_NOVA_A] = {
79 .name = "Siano Nova A Digital Receiver",
81 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw",
83 [SMS1XXX_BOARD_SIANO_NOVA_B] = {
84 .name = "Siano Nova B Digital Receiver",
86 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
88 [SMS1XXX_BOARD_SIANO_VEGA] = {
89 .name = "Siano Vega Digital Receiver",
92 [SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT] = {
93 .name = "Hauppauge Catamount",
95 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw",
97 [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A] = {
98 .name = "Hauppauge Okemo-A",
100 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw",
102 [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B] = {
103 .name = "Hauppauge Okemo-B",
105 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
107 [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
108 .name = "Hauppauge WinTV MiniStick",
110 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
115 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = {
116 .name = "Hauppauge WinTV MiniCard",
118 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
121 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
122 .name = "Hauppauge WinTV MiniCard",
124 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
129 struct sms_board *sms_get_board(int id)
131 BUG_ON(id >= ARRAY_SIZE(sms_boards));
133 return &sms_boards[id];
136 static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable)
140 struct smscore_gpio_config gpioconfig = {
141 .direction = SMS_GPIO_DIRECTION_OUTPUT,
142 .pullupdown = SMS_GPIO_PULLUPDOWN_NONE,
143 .inputcharacteristics = SMS_GPIO_INPUTCHARACTERISTICS_NORMAL,
144 .outputslewrate = SMS_GPIO_OUTPUTSLEWRATE_FAST,
145 .outputdriving = SMS_GPIO_OUTPUTDRIVING_4mA,
154 lvl = enable ? 0 : 1;
157 lvl = enable ? 1 : 0;
160 ret = smscore_configure_gpio(coredev, gpio, &gpioconfig);
164 return smscore_set_gpio(coredev, gpio, lvl);
167 int sms_board_setup(struct smscore_device_t *coredev)
169 int board_id = smscore_get_board_id(coredev);
170 struct sms_board *board = sms_get_board(board_id);
173 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
174 /* turn off all LEDs */
175 sms_set_gpio(coredev, board->led_power, 0);
176 sms_set_gpio(coredev, board->led_hi, 0);
177 sms_set_gpio(coredev, board->led_lo, 0);
179 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
180 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
182 sms_set_gpio(coredev, board->lna_ctrl, 0);
188 int sms_board_power(struct smscore_device_t *coredev, int onoff)
190 int board_id = smscore_get_board_id(coredev);
191 struct sms_board *board = sms_get_board(board_id);
194 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
196 sms_set_gpio(coredev,
197 board->led_power, onoff ? 1 : 0);
199 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
200 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
202 sms_set_gpio(coredev,
203 board->lna_ctrl, onoff ? 1 : 0);
209 int sms_board_led_feedback(struct smscore_device_t *coredev, int led)
211 int board_id = smscore_get_board_id(coredev);
212 struct sms_board *board = sms_get_board(board_id);
214 /* dont touch GPIO if LEDs are already set */
215 if (smscore_led_state(coredev, -1) == led)
219 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
220 sms_set_gpio(coredev,
221 board->led_lo, (led & SMS_LED_LO) ? 1 : 0);
222 sms_set_gpio(coredev,
223 board->led_hi, (led & SMS_LED_HI) ? 1 : 0);
225 smscore_led_state(coredev, led);