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"
23 module_param_named(cards_dbg, sms_dbg, int, 0644);
24 MODULE_PARM_DESC(cards_dbg, "set debug level (info=1, adv=2 (or-able))");
26 static struct sms_board sms_boards[] = {
27 [SMS_BOARD_UNKNOWN] = {
28 .name = "Unknown board",
30 [SMS1XXX_BOARD_SIANO_STELLAR] = {
31 .name = "Siano Stellar Digital Receiver",
33 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw",
35 [SMS1XXX_BOARD_SIANO_NOVA_A] = {
36 .name = "Siano Nova A Digital Receiver",
38 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw",
40 [SMS1XXX_BOARD_SIANO_NOVA_B] = {
41 .name = "Siano Nova B Digital Receiver",
43 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
45 [SMS1XXX_BOARD_SIANO_VEGA] = {
46 .name = "Siano Vega Digital Receiver",
49 [SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT] = {
50 .name = "Hauppauge Catamount",
52 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw",
54 [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A] = {
55 .name = "Hauppauge Okemo-A",
57 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw",
59 [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B] = {
60 .name = "Hauppauge Okemo-B",
62 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
64 [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
65 .name = "Hauppauge WinTV MiniStick",
67 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
72 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = {
73 .name = "Hauppauge WinTV MiniCard",
75 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
79 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
80 .name = "Hauppauge WinTV MiniCard",
82 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
87 struct sms_board *sms_get_board(int id)
89 BUG_ON(id >= ARRAY_SIZE(sms_boards));
91 return &sms_boards[id];
93 EXPORT_SYMBOL_GPL(sms_get_board);
95 static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable)
99 struct smscore_gpio_config gpioconfig = {
100 .direction = SMS_GPIO_DIRECTION_OUTPUT,
101 .pullupdown = SMS_GPIO_PULLUPDOWN_NONE,
102 .inputcharacteristics = SMS_GPIO_INPUTCHARACTERISTICS_NORMAL,
103 .outputslewrate = SMS_GPIO_OUTPUTSLEWRATE_FAST,
104 .outputdriving = SMS_GPIO_OUTPUTDRIVING_4mA,
113 lvl = enable ? 0 : 1;
116 lvl = enable ? 1 : 0;
119 ret = smscore_configure_gpio(coredev, gpio, &gpioconfig);
123 return smscore_set_gpio(coredev, gpio, lvl);
126 int sms_board_setup(struct smscore_device_t *coredev)
128 int board_id = smscore_get_board_id(coredev);
129 struct sms_board *board = sms_get_board(board_id);
132 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
133 /* turn off all LEDs */
134 sms_set_gpio(coredev, board->led_power, 0);
135 sms_set_gpio(coredev, board->led_hi, 0);
136 sms_set_gpio(coredev, board->led_lo, 0);
138 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
139 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
141 sms_set_gpio(coredev, board->lna_ctrl, 0);
146 EXPORT_SYMBOL_GPL(sms_board_setup);
148 int sms_board_power(struct smscore_device_t *coredev, int onoff)
150 int board_id = smscore_get_board_id(coredev);
151 struct sms_board *board = sms_get_board(board_id);
154 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
156 sms_set_gpio(coredev,
157 board->led_power, onoff ? 1 : 0);
159 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
160 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
163 sms_set_gpio(coredev, board->lna_ctrl, 0);
168 EXPORT_SYMBOL_GPL(sms_board_power);
170 int sms_board_led_feedback(struct smscore_device_t *coredev, int led)
172 int board_id = smscore_get_board_id(coredev);
173 struct sms_board *board = sms_get_board(board_id);
175 /* dont touch GPIO if LEDs are already set */
176 if (smscore_led_state(coredev, -1) == led)
180 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
181 sms_set_gpio(coredev,
182 board->led_lo, (led & SMS_LED_LO) ? 1 : 0);
183 sms_set_gpio(coredev,
184 board->led_hi, (led & SMS_LED_HI) ? 1 : 0);
186 smscore_led_state(coredev, led);
191 EXPORT_SYMBOL_GPL(sms_board_led_feedback);
193 int sms_board_lna_control(struct smscore_device_t *coredev, int onoff)
195 int board_id = smscore_get_board_id(coredev);
196 struct sms_board *board = sms_get_board(board_id);
198 sms_debug("%s: LNA %s", __func__, onoff ? "enabled" : "disabled");
201 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
202 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
203 sms_set_gpio(coredev,
204 board->rf_switch, onoff ? 1 : 0);
205 return sms_set_gpio(coredev,
206 board->lna_ctrl, onoff ? 1 : 0);
210 EXPORT_SYMBOL_GPL(sms_board_lna_control);
212 int sms_board_load_modules(int id)
215 case SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT:
216 case SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A:
217 case SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B:
218 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
219 request_module("smsdvb");
227 EXPORT_SYMBOL_GPL(sms_board_load_modules);