15a5ef568SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
20013ca8cSMauro Carvalho Chehab /*
30013ca8cSMauro Carvalho Chehab * Card-specific functions for the Siano SMS1xxx USB dongle
40013ca8cSMauro Carvalho Chehab *
50013ca8cSMauro Carvalho Chehab * Copyright (c) 2008 Michael Krufky <mkrufky@linuxtv.org>
60013ca8cSMauro Carvalho Chehab */
70013ca8cSMauro Carvalho Chehab
80013ca8cSMauro Carvalho Chehab #include "sms-cards.h"
90013ca8cSMauro Carvalho Chehab #include "smsir.h"
100013ca8cSMauro Carvalho Chehab #include <linux/module.h>
110013ca8cSMauro Carvalho Chehab
120013ca8cSMauro Carvalho Chehab static struct sms_board sms_boards[] = {
130013ca8cSMauro Carvalho Chehab [SMS_BOARD_UNKNOWN] = {
140013ca8cSMauro Carvalho Chehab .name = "Unknown board",
15347d8f1fSMauro Carvalho Chehab .type = SMS_UNKNOWN_TYPE,
16347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_NONE,
170013ca8cSMauro Carvalho Chehab },
180013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_STELLAR] = {
190013ca8cSMauro Carvalho Chehab .name = "Siano Stellar Digital Receiver",
200013ca8cSMauro Carvalho Chehab .type = SMS_STELLAR,
21347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
220013ca8cSMauro Carvalho Chehab },
230013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_NOVA_A] = {
240013ca8cSMauro Carvalho Chehab .name = "Siano Nova A Digital Receiver",
250013ca8cSMauro Carvalho Chehab .type = SMS_NOVA_A0,
26347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
270013ca8cSMauro Carvalho Chehab },
280013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_NOVA_B] = {
290013ca8cSMauro Carvalho Chehab .name = "Siano Nova B Digital Receiver",
300013ca8cSMauro Carvalho Chehab .type = SMS_NOVA_B0,
31347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
320013ca8cSMauro Carvalho Chehab },
330013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_VEGA] = {
340013ca8cSMauro Carvalho Chehab .name = "Siano Vega Digital Receiver",
350013ca8cSMauro Carvalho Chehab .type = SMS_VEGA,
36347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_CMMB,
370013ca8cSMauro Carvalho Chehab },
380013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT] = {
390013ca8cSMauro Carvalho Chehab .name = "Hauppauge Catamount",
400013ca8cSMauro Carvalho Chehab .type = SMS_STELLAR,
4111ad03a5SMauro Carvalho Chehab .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_STELLAR,
42347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
430013ca8cSMauro Carvalho Chehab },
440013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A] = {
450013ca8cSMauro Carvalho Chehab .name = "Hauppauge Okemo-A",
460013ca8cSMauro Carvalho Chehab .type = SMS_NOVA_A0,
4711ad03a5SMauro Carvalho Chehab .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_NOVA_A,
48347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
490013ca8cSMauro Carvalho Chehab },
500013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B] = {
510013ca8cSMauro Carvalho Chehab .name = "Hauppauge Okemo-B",
520013ca8cSMauro Carvalho Chehab .type = SMS_NOVA_B0,
5311ad03a5SMauro Carvalho Chehab .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_NOVA_B,
54347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
550013ca8cSMauro Carvalho Chehab },
560013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
570013ca8cSMauro Carvalho Chehab .name = "Hauppauge WinTV MiniStick",
580013ca8cSMauro Carvalho Chehab .type = SMS_NOVA_B0,
5911ad03a5SMauro Carvalho Chehab .fw[DEVICE_MODE_ISDBT_BDA] = SMS_FW_ISDBT_HCW_55XXX,
6011ad03a5SMauro Carvalho Chehab .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_HCW_55XXX,
61347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
620013ca8cSMauro Carvalho Chehab .rc_codes = RC_MAP_HAUPPAUGE,
630013ca8cSMauro Carvalho Chehab .board_cfg.leds_power = 26,
640013ca8cSMauro Carvalho Chehab .board_cfg.led0 = 27,
650013ca8cSMauro Carvalho Chehab .board_cfg.led1 = 28,
660013ca8cSMauro Carvalho Chehab .board_cfg.ir = 9,
670013ca8cSMauro Carvalho Chehab .led_power = 26,
680013ca8cSMauro Carvalho Chehab .led_lo = 27,
690013ca8cSMauro Carvalho Chehab .led_hi = 28,
700013ca8cSMauro Carvalho Chehab },
710013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = {
720013ca8cSMauro Carvalho Chehab .name = "Hauppauge WinTV MiniCard",
730013ca8cSMauro Carvalho Chehab .type = SMS_NOVA_B0,
7411ad03a5SMauro Carvalho Chehab .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_HCW_55XXX,
75347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
760013ca8cSMauro Carvalho Chehab .lna_ctrl = 29,
770013ca8cSMauro Carvalho Chehab .board_cfg.foreign_lna0_ctrl = 29,
780013ca8cSMauro Carvalho Chehab .rf_switch = 17,
790013ca8cSMauro Carvalho Chehab .board_cfg.rf_switch_uhf = 17,
800013ca8cSMauro Carvalho Chehab },
810013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
82*210191ddSMauro Carvalho Chehab .name = "Hauppauge WinTV MiniCard Rev 2",
830013ca8cSMauro Carvalho Chehab .type = SMS_NOVA_B0,
8411ad03a5SMauro Carvalho Chehab .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_HCW_55XXX,
85347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
860013ca8cSMauro Carvalho Chehab .lna_ctrl = -1,
870013ca8cSMauro Carvalho Chehab },
880013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_NICE] = {
890013ca8cSMauro Carvalho Chehab .name = "Siano Nice Digital Receiver",
900013ca8cSMauro Carvalho Chehab .type = SMS_NOVA_B0,
91347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
920013ca8cSMauro Carvalho Chehab },
930013ca8cSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_VENICE] = {
940013ca8cSMauro Carvalho Chehab .name = "Siano Venice Digital Receiver",
950013ca8cSMauro Carvalho Chehab .type = SMS_VEGA,
96347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_CMMB,
97347d8f1fSMauro Carvalho Chehab },
98347d8f1fSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_STELLAR_ROM] = {
99347d8f1fSMauro Carvalho Chehab .name = "Siano Stellar Digital Receiver ROM",
100347d8f1fSMauro Carvalho Chehab .type = SMS_STELLAR,
101347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
102347d8f1fSMauro Carvalho Chehab .intf_num = 1,
103347d8f1fSMauro Carvalho Chehab },
104347d8f1fSMauro Carvalho Chehab [SMS1XXX_BOARD_ZTE_DVB_DATA_CARD] = {
105347d8f1fSMauro Carvalho Chehab .name = "ZTE Data Card Digital Receiver",
106347d8f1fSMauro Carvalho Chehab .type = SMS_NOVA_B0,
107347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
108347d8f1fSMauro Carvalho Chehab .intf_num = 5,
109347d8f1fSMauro Carvalho Chehab .mtu = 15792,
110347d8f1fSMauro Carvalho Chehab },
111347d8f1fSMauro Carvalho Chehab [SMS1XXX_BOARD_ONDA_MDTV_DATA_CARD] = {
112347d8f1fSMauro Carvalho Chehab .name = "ONDA Data Card Digital Receiver",
113347d8f1fSMauro Carvalho Chehab .type = SMS_NOVA_B0,
114347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
115347d8f1fSMauro Carvalho Chehab .intf_num = 6,
116347d8f1fSMauro Carvalho Chehab .mtu = 15792,
117347d8f1fSMauro Carvalho Chehab },
118347d8f1fSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_MING] = {
119347d8f1fSMauro Carvalho Chehab .name = "Siano Ming Digital Receiver",
120347d8f1fSMauro Carvalho Chehab .type = SMS_MING,
121347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_CMMB,
122347d8f1fSMauro Carvalho Chehab },
123347d8f1fSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_PELE] = {
124347d8f1fSMauro Carvalho Chehab .name = "Siano Pele Digital Receiver",
125347d8f1fSMauro Carvalho Chehab .type = SMS_PELE,
126347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_ISDBT_BDA,
127347d8f1fSMauro Carvalho Chehab },
128347d8f1fSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_RIO] = {
129347d8f1fSMauro Carvalho Chehab .name = "Siano Rio Digital Receiver",
130347d8f1fSMauro Carvalho Chehab .type = SMS_RIO,
131347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_ISDBT_BDA,
132347d8f1fSMauro Carvalho Chehab },
133347d8f1fSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_DENVER_1530] = {
134347d8f1fSMauro Carvalho Chehab .name = "Siano Denver (ATSC-M/H) Digital Receiver",
135347d8f1fSMauro Carvalho Chehab .type = SMS_DENVER_1530,
136347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_ATSC,
137347d8f1fSMauro Carvalho Chehab .crystal = 2400,
138347d8f1fSMauro Carvalho Chehab },
139347d8f1fSMauro Carvalho Chehab [SMS1XXX_BOARD_SIANO_DENVER_2160] = {
140347d8f1fSMauro Carvalho Chehab .name = "Siano Denver (TDMB) Digital Receiver",
141347d8f1fSMauro Carvalho Chehab .type = SMS_DENVER_2160,
142347d8f1fSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DAB_TDMB,
1430013ca8cSMauro Carvalho Chehab },
14429bbb7bdSMauro Carvalho Chehab [SMS1XXX_BOARD_PCTV_77E] = {
14529bbb7bdSMauro Carvalho Chehab .name = "Hauppauge microStick 77e",
14629bbb7bdSMauro Carvalho Chehab .type = SMS_NOVA_B0,
14729bbb7bdSMauro Carvalho Chehab .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVB_NOVA_12MHZ_B0,
14829bbb7bdSMauro Carvalho Chehab .default_mode = DEVICE_MODE_DVBT_BDA,
14929bbb7bdSMauro Carvalho Chehab },
1500013ca8cSMauro Carvalho Chehab };
1510013ca8cSMauro Carvalho Chehab
sms_get_board(unsigned id)1520013ca8cSMauro Carvalho Chehab struct sms_board *sms_get_board(unsigned id)
1530013ca8cSMauro Carvalho Chehab {
1540013ca8cSMauro Carvalho Chehab BUG_ON(id >= ARRAY_SIZE(sms_boards));
1550013ca8cSMauro Carvalho Chehab
1560013ca8cSMauro Carvalho Chehab return &sms_boards[id];
1570013ca8cSMauro Carvalho Chehab }
1580013ca8cSMauro Carvalho Chehab EXPORT_SYMBOL_GPL(sms_get_board);
sms_gpio_assign_11xx_default_led_config(struct smscore_config_gpio * p_gpio_config)1590013ca8cSMauro Carvalho Chehab static inline void sms_gpio_assign_11xx_default_led_config(
160dfef84fcSMauro Carvalho Chehab struct smscore_config_gpio *p_gpio_config) {
161dfef84fcSMauro Carvalho Chehab p_gpio_config->direction = SMS_GPIO_DIRECTION_OUTPUT;
162dfef84fcSMauro Carvalho Chehab p_gpio_config->inputcharacteristics =
163c31b9fb2SMauro Carvalho Chehab SMS_GPIO_INPUTCHARACTERISTICS_NORMAL;
164dfef84fcSMauro Carvalho Chehab p_gpio_config->outputdriving = SMS_GPIO_OUTPUTDRIVING_4mA;
165dfef84fcSMauro Carvalho Chehab p_gpio_config->outputslewrate = SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS;
166dfef84fcSMauro Carvalho Chehab p_gpio_config->pullupdown = SMS_GPIO_PULLUPDOWN_NONE;
1670013ca8cSMauro Carvalho Chehab }
1680013ca8cSMauro Carvalho Chehab
sms_board_event(struct smscore_device_t * coredev,enum SMS_BOARD_EVENTS gevent)1690013ca8cSMauro Carvalho Chehab int sms_board_event(struct smscore_device_t *coredev,
170347d8f1fSMauro Carvalho Chehab enum SMS_BOARD_EVENTS gevent)
171347d8f1fSMauro Carvalho Chehab {
17228a59df4SMauro Carvalho Chehab struct smscore_config_gpio my_gpio_config;
1730013ca8cSMauro Carvalho Chehab
17428a59df4SMauro Carvalho Chehab sms_gpio_assign_11xx_default_led_config(&my_gpio_config);
1750013ca8cSMauro Carvalho Chehab
1760013ca8cSMauro Carvalho Chehab switch (gevent) {
1770013ca8cSMauro Carvalho Chehab case BOARD_EVENT_POWER_INIT: /* including hotplug */
1780013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_BIND */
1790013ca8cSMauro Carvalho Chehab
1800013ca8cSMauro Carvalho Chehab case BOARD_EVENT_POWER_SUSPEND:
1810013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_POWER_SUSPEND */
1820013ca8cSMauro Carvalho Chehab
1830013ca8cSMauro Carvalho Chehab case BOARD_EVENT_POWER_RESUME:
1840013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_POWER_RESUME */
1850013ca8cSMauro Carvalho Chehab
1860013ca8cSMauro Carvalho Chehab case BOARD_EVENT_BIND:
1870013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_BIND */
1880013ca8cSMauro Carvalho Chehab
1890013ca8cSMauro Carvalho Chehab case BOARD_EVENT_SCAN_PROG:
1900013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_SCAN_PROG */
1910013ca8cSMauro Carvalho Chehab case BOARD_EVENT_SCAN_COMP:
1920013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_SCAN_COMP */
1930013ca8cSMauro Carvalho Chehab case BOARD_EVENT_EMERGENCY_WARNING_SIGNAL:
1940013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_EMERGENCY_WARNING_SIGNAL */
1950013ca8cSMauro Carvalho Chehab case BOARD_EVENT_FE_LOCK:
1960013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_FE_LOCK */
1970013ca8cSMauro Carvalho Chehab case BOARD_EVENT_FE_UNLOCK:
1980013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_FE_UNLOCK */
1990013ca8cSMauro Carvalho Chehab case BOARD_EVENT_DEMOD_LOCK:
2000013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_DEMOD_LOCK */
2010013ca8cSMauro Carvalho Chehab case BOARD_EVENT_DEMOD_UNLOCK:
2020013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_DEMOD_UNLOCK */
2030013ca8cSMauro Carvalho Chehab case BOARD_EVENT_RECEPTION_MAX_4:
2040013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_RECEPTION_MAX_4 */
2050013ca8cSMauro Carvalho Chehab case BOARD_EVENT_RECEPTION_3:
2060013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_RECEPTION_3 */
2070013ca8cSMauro Carvalho Chehab case BOARD_EVENT_RECEPTION_2:
2080013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_RECEPTION_2 */
2090013ca8cSMauro Carvalho Chehab case BOARD_EVENT_RECEPTION_1:
2100013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_RECEPTION_1 */
2110013ca8cSMauro Carvalho Chehab case BOARD_EVENT_RECEPTION_LOST_0:
2120013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_RECEPTION_LOST_0 */
2130013ca8cSMauro Carvalho Chehab case BOARD_EVENT_MULTIPLEX_OK:
2140013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_MULTIPLEX_OK */
2150013ca8cSMauro Carvalho Chehab case BOARD_EVENT_MULTIPLEX_ERRORS:
2160013ca8cSMauro Carvalho Chehab break; /* BOARD_EVENT_MULTIPLEX_ERRORS */
2170013ca8cSMauro Carvalho Chehab
2180013ca8cSMauro Carvalho Chehab default:
2195ed0a2c7SMauro Carvalho Chehab pr_err("Unknown SMS board event\n");
2200013ca8cSMauro Carvalho Chehab break;
2210013ca8cSMauro Carvalho Chehab }
2220013ca8cSMauro Carvalho Chehab return 0;
2230013ca8cSMauro Carvalho Chehab }
2240013ca8cSMauro Carvalho Chehab EXPORT_SYMBOL_GPL(sms_board_event);
2250013ca8cSMauro Carvalho Chehab
sms_set_gpio(struct smscore_device_t * coredev,int pin,int enable)2260013ca8cSMauro Carvalho Chehab static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable)
2270013ca8cSMauro Carvalho Chehab {
2280013ca8cSMauro Carvalho Chehab int lvl, ret;
2290013ca8cSMauro Carvalho Chehab u32 gpio;
2300013ca8cSMauro Carvalho Chehab struct smscore_config_gpio gpioconfig = {
2310013ca8cSMauro Carvalho Chehab .direction = SMS_GPIO_DIRECTION_OUTPUT,
2320013ca8cSMauro Carvalho Chehab .pullupdown = SMS_GPIO_PULLUPDOWN_NONE,
2330013ca8cSMauro Carvalho Chehab .inputcharacteristics = SMS_GPIO_INPUTCHARACTERISTICS_NORMAL,
234c31b9fb2SMauro Carvalho Chehab .outputslewrate = SMS_GPIO_OUTPUT_SLEW_RATE_FAST,
235f82757d9SMauro Carvalho Chehab .outputdriving = SMS_GPIO_OUTPUTDRIVING_S_4mA,
2360013ca8cSMauro Carvalho Chehab };
2370013ca8cSMauro Carvalho Chehab
2380013ca8cSMauro Carvalho Chehab if (pin == 0)
2390013ca8cSMauro Carvalho Chehab return -EINVAL;
2400013ca8cSMauro Carvalho Chehab
2410013ca8cSMauro Carvalho Chehab if (pin < 0) {
2420013ca8cSMauro Carvalho Chehab /* inverted gpio */
2430013ca8cSMauro Carvalho Chehab gpio = pin * -1;
2440013ca8cSMauro Carvalho Chehab lvl = enable ? 0 : 1;
2450013ca8cSMauro Carvalho Chehab } else {
2460013ca8cSMauro Carvalho Chehab gpio = pin;
2470013ca8cSMauro Carvalho Chehab lvl = enable ? 1 : 0;
2480013ca8cSMauro Carvalho Chehab }
2490013ca8cSMauro Carvalho Chehab
2500013ca8cSMauro Carvalho Chehab ret = smscore_configure_gpio(coredev, gpio, &gpioconfig);
2510013ca8cSMauro Carvalho Chehab if (ret < 0)
2520013ca8cSMauro Carvalho Chehab return ret;
2530013ca8cSMauro Carvalho Chehab
2540013ca8cSMauro Carvalho Chehab return smscore_set_gpio(coredev, gpio, lvl);
2550013ca8cSMauro Carvalho Chehab }
2560013ca8cSMauro Carvalho Chehab
sms_board_setup(struct smscore_device_t * coredev)2570013ca8cSMauro Carvalho Chehab int sms_board_setup(struct smscore_device_t *coredev)
2580013ca8cSMauro Carvalho Chehab {
2590013ca8cSMauro Carvalho Chehab int board_id = smscore_get_board_id(coredev);
2600013ca8cSMauro Carvalho Chehab struct sms_board *board = sms_get_board(board_id);
2610013ca8cSMauro Carvalho Chehab
2620013ca8cSMauro Carvalho Chehab switch (board_id) {
2630013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
2640013ca8cSMauro Carvalho Chehab /* turn off all LEDs */
2650013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev, board->led_power, 0);
2660013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev, board->led_hi, 0);
2670013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev, board->led_lo, 0);
2680013ca8cSMauro Carvalho Chehab break;
2690013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
2700013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
2710013ca8cSMauro Carvalho Chehab /* turn off LNA */
2720013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev, board->lna_ctrl, 0);
2730013ca8cSMauro Carvalho Chehab break;
2740013ca8cSMauro Carvalho Chehab }
2750013ca8cSMauro Carvalho Chehab return 0;
2760013ca8cSMauro Carvalho Chehab }
2770013ca8cSMauro Carvalho Chehab EXPORT_SYMBOL_GPL(sms_board_setup);
2780013ca8cSMauro Carvalho Chehab
sms_board_power(struct smscore_device_t * coredev,int onoff)2790013ca8cSMauro Carvalho Chehab int sms_board_power(struct smscore_device_t *coredev, int onoff)
2800013ca8cSMauro Carvalho Chehab {
2810013ca8cSMauro Carvalho Chehab int board_id = smscore_get_board_id(coredev);
2820013ca8cSMauro Carvalho Chehab struct sms_board *board = sms_get_board(board_id);
2830013ca8cSMauro Carvalho Chehab
2840013ca8cSMauro Carvalho Chehab switch (board_id) {
2850013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
2860013ca8cSMauro Carvalho Chehab /* power LED */
2870013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev,
2880013ca8cSMauro Carvalho Chehab board->led_power, onoff ? 1 : 0);
2890013ca8cSMauro Carvalho Chehab break;
2900013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
2910013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
2920013ca8cSMauro Carvalho Chehab /* LNA */
2930013ca8cSMauro Carvalho Chehab if (!onoff)
2940013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev, board->lna_ctrl, 0);
2950013ca8cSMauro Carvalho Chehab break;
2960013ca8cSMauro Carvalho Chehab }
2970013ca8cSMauro Carvalho Chehab return 0;
2980013ca8cSMauro Carvalho Chehab }
2990013ca8cSMauro Carvalho Chehab EXPORT_SYMBOL_GPL(sms_board_power);
3000013ca8cSMauro Carvalho Chehab
sms_board_led_feedback(struct smscore_device_t * coredev,int led)3010013ca8cSMauro Carvalho Chehab int sms_board_led_feedback(struct smscore_device_t *coredev, int led)
3020013ca8cSMauro Carvalho Chehab {
3030013ca8cSMauro Carvalho Chehab int board_id = smscore_get_board_id(coredev);
3040013ca8cSMauro Carvalho Chehab struct sms_board *board = sms_get_board(board_id);
3050013ca8cSMauro Carvalho Chehab
3064b129dc9SMauro Carvalho Chehab /* don't touch GPIO if LEDs are already set */
3070013ca8cSMauro Carvalho Chehab if (smscore_led_state(coredev, -1) == led)
3080013ca8cSMauro Carvalho Chehab return 0;
3090013ca8cSMauro Carvalho Chehab
3100013ca8cSMauro Carvalho Chehab switch (board_id) {
3110013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM:
3120013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev,
3130013ca8cSMauro Carvalho Chehab board->led_lo, (led & SMS_LED_LO) ? 1 : 0);
3140013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev,
3150013ca8cSMauro Carvalho Chehab board->led_hi, (led & SMS_LED_HI) ? 1 : 0);
3160013ca8cSMauro Carvalho Chehab
3170013ca8cSMauro Carvalho Chehab smscore_led_state(coredev, led);
3180013ca8cSMauro Carvalho Chehab break;
3190013ca8cSMauro Carvalho Chehab }
3200013ca8cSMauro Carvalho Chehab return 0;
3210013ca8cSMauro Carvalho Chehab }
3220013ca8cSMauro Carvalho Chehab EXPORT_SYMBOL_GPL(sms_board_led_feedback);
3230013ca8cSMauro Carvalho Chehab
sms_board_lna_control(struct smscore_device_t * coredev,int onoff)3240013ca8cSMauro Carvalho Chehab int sms_board_lna_control(struct smscore_device_t *coredev, int onoff)
3250013ca8cSMauro Carvalho Chehab {
3260013ca8cSMauro Carvalho Chehab int board_id = smscore_get_board_id(coredev);
3270013ca8cSMauro Carvalho Chehab struct sms_board *board = sms_get_board(board_id);
3280013ca8cSMauro Carvalho Chehab
32969083688SMauro Carvalho Chehab pr_debug("%s: LNA %s\n", __func__, onoff ? "enabled" : "disabled");
3300013ca8cSMauro Carvalho Chehab
3310013ca8cSMauro Carvalho Chehab switch (board_id) {
3320013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
3330013ca8cSMauro Carvalho Chehab case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD:
3340013ca8cSMauro Carvalho Chehab sms_set_gpio(coredev,
3350013ca8cSMauro Carvalho Chehab board->rf_switch, onoff ? 1 : 0);
3360013ca8cSMauro Carvalho Chehab return sms_set_gpio(coredev,
3370013ca8cSMauro Carvalho Chehab board->lna_ctrl, onoff ? 1 : 0);
3380013ca8cSMauro Carvalho Chehab }
3390013ca8cSMauro Carvalho Chehab return -EINVAL;
3400013ca8cSMauro Carvalho Chehab }
3410013ca8cSMauro Carvalho Chehab EXPORT_SYMBOL_GPL(sms_board_lna_control);
3420013ca8cSMauro Carvalho Chehab
sms_board_load_modules(int id)3430013ca8cSMauro Carvalho Chehab int sms_board_load_modules(int id)
3440013ca8cSMauro Carvalho Chehab {
3450013ca8cSMauro Carvalho Chehab request_module("smsdvb");
3460013ca8cSMauro Carvalho Chehab return 0;
3470013ca8cSMauro Carvalho Chehab }
3480013ca8cSMauro Carvalho Chehab EXPORT_SYMBOL_GPL(sms_board_load_modules);
349