aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/siano/sms-cards.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/siano/sms-cards.c')
-rw-r--r--drivers/media/dvb/siano/sms-cards.c110
1 files changed, 110 insertions, 0 deletions
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c
index e98d6caf2c23..fd62e0b85621 100644
--- a/drivers/media/dvb/siano/sms-cards.c
+++ b/drivers/media/dvb/siano/sms-cards.c
@@ -38,6 +38,16 @@ struct usb_device_id smsusb_id_table[] = {
38 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A }, 38 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A },
39 { USB_DEVICE(0x2040, 0x1801), 39 { USB_DEVICE(0x2040, 0x1801),
40 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B }, 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 },
41 { USB_DEVICE(0x2040, 0x5500), 51 { USB_DEVICE(0x2040, 0x5500),
42 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, 52 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
43 { USB_DEVICE(0x2040, 0x5510), 53 { USB_DEVICE(0x2040, 0x5510),
@@ -96,6 +106,21 @@ static struct sms_board sms_boards[] = {
96 .name = "Hauppauge WinTV MiniStick", 106 .name = "Hauppauge WinTV MiniStick",
97 .type = SMS_NOVA_B0, 107 .type = SMS_NOVA_B0,
98 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", 108 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
109 .led_power = 26,
110 .led_lo = 27,
111 .led_hi = 28,
112 },
113 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = {
114 .name = "Hauppauge WinTV MiniCard",
115 .type = SMS_NOVA_B0,
116 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
117 .lna_ctrl = 29,
118 },
119 [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
120 .name = "Hauppauge WinTV MiniCard",
121 .type = SMS_NOVA_B0,
122 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
123 .lna_ctrl = 1,
99 }, 124 },
100}; 125};
101 126
@@ -106,3 +131,88 @@ struct sms_board *sms_get_board(int id)
106 return &sms_boards[id]; 131 return &sms_boards[id];
107} 132}
108 133
134static int sms_set_gpio(struct smscore_device_t *coredev, u32 pin, int enable)
135{
136 int ret;
137 struct smscore_gpio_config gpioconfig = {
138 .direction = SMS_GPIO_DIRECTION_OUTPUT,
139 .pullupdown = SMS_GPIO_PULLUPDOWN_NONE,
140 .inputcharacteristics = SMS_GPIO_INPUTCHARACTERISTICS_NORMAL,
141 .outputslewrate = SMS_GPIO_OUTPUTSLEWRATE_FAST,
142 .outputdriving = SMS_GPIO_OUTPUTDRIVING_4mA,
143 };
144
145 if (pin == 0)
146 return -EINVAL;
147
148 ret = smscore_configure_gpio(coredev, pin, &gpioconfig);
149
150 if (ret < 0)
151 return ret;
152
153 return smscore_set_gpio(coredev, pin, enable);
154}
155
156int sms_board_setup(struct smscore_device_t *coredev)
157{
158 int board_id = smscore_get_board_id(coredev);
159 struct sms_board *board = sms_get_board(board_id);
160
161 switch (board_id) {
162 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
163 /* turn off all LEDs */
164 sms_set_gpio(coredev, board->led_power, 0);
165 sms_set_gpio(coredev, board->led_hi, 0);
166 sms_set_gpio(coredev, board->led_lo, 0);
167 break;
168 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
169 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
170 /* turn off LNA */
171 sms_set_gpio(coredev, board->lna_ctrl, 0);
172 break;
173 }
174 return 0;
175}
176
177int sms_board_power(struct smscore_device_t *coredev, int onoff)
178{
179 int board_id = smscore_get_board_id(coredev);
180 struct sms_board *board = sms_get_board(board_id);
181
182 switch (board_id) {
183 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
184 /* power LED */
185 sms_set_gpio(coredev,
186 board->led_power, onoff ? 1 : 0);
187 break;
188 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
189 case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
190 /* LNA */
191 sms_set_gpio(coredev,
192 board->lna_ctrl, onoff ? 1 : 0);
193 break;
194 }
195 return 0;
196}
197
198int sms_board_led_feedback(struct smscore_device_t *coredev, int led)
199{
200 int board_id = smscore_get_board_id(coredev);
201 struct sms_board *board = sms_get_board(board_id);
202
203 /* dont touch GPIO if LEDs are already set */
204 if (smscore_led_state(coredev, -1) == led)
205 return 0;
206
207 switch (board_id) {
208 case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
209 sms_set_gpio(coredev,
210 board->led_lo, (led & SMS_LED_LO) ? 1 : 0);
211 sms_set_gpio(coredev,
212 board->led_hi, (led & SMS_LED_HI) ? 1 : 0);
213
214 smscore_led_state(coredev, led);
215 break;
216 }
217 return 0;
218}