xref: /linux/drivers/media/common/siano/sms-cards.h (revision 9e56ff53b4115875667760445b028357848b4748)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Card-specific functions for the Siano SMS1xxx USB dongle
4  *
5  *  Copyright (c) 2008 Michael Krufky <mkrufky@linuxtv.org>
6  */
7 
8 #ifndef __SMS_CARDS_H__
9 #define __SMS_CARDS_H__
10 
11 #include "smscoreapi.h"
12 
13 #include <linux/usb.h>
14 #include "smsir.h"
15 
16 #define SMS_BOARD_UNKNOWN 0
17 #define SMS1XXX_BOARD_SIANO_STELLAR 1
18 #define SMS1XXX_BOARD_SIANO_NOVA_A  2
19 #define SMS1XXX_BOARD_SIANO_NOVA_B  3
20 #define SMS1XXX_BOARD_SIANO_VEGA    4
21 #define SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT 5
22 #define SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A 6
23 #define SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B 7
24 #define SMS1XXX_BOARD_HAUPPAUGE_WINDHAM 8
25 #define SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD 9
26 #define SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 10
27 #define SMS1XXX_BOARD_SIANO_NICE	11
28 #define SMS1XXX_BOARD_SIANO_VENICE	12
29 #define SMS1XXX_BOARD_SIANO_STELLAR_ROM 13
30 #define SMS1XXX_BOARD_ZTE_DVB_DATA_CARD	14
31 #define SMS1XXX_BOARD_ONDA_MDTV_DATA_CARD 15
32 #define SMS1XXX_BOARD_SIANO_MING	16
33 #define SMS1XXX_BOARD_SIANO_PELE	17
34 #define SMS1XXX_BOARD_SIANO_RIO		18
35 #define SMS1XXX_BOARD_SIANO_DENVER_1530	19
36 #define SMS1XXX_BOARD_SIANO_DENVER_2160 20
37 #define SMS1XXX_BOARD_PCTV_77E		21
38 
39 struct sms_board_gpio_cfg {
40 	int lna_vhf_exist;
41 	int lna_vhf_ctrl;
42 	int lna_uhf_exist;
43 	int lna_uhf_ctrl;
44 	int lna_uhf_d_ctrl;
45 	int lna_sband_exist;
46 	int lna_sband_ctrl;
47 	int lna_sband_d_ctrl;
48 	int foreign_lna0_ctrl;
49 	int foreign_lna1_ctrl;
50 	int foreign_lna2_ctrl;
51 	int rf_switch_vhf;
52 	int rf_switch_uhf;
53 	int rf_switch_sband;
54 	int leds_power;
55 	int led0;
56 	int led1;
57 	int led2;
58 	int led3;
59 	int led4;
60 	int ir;
61 	int eeprom_wp;
62 	int mrc_sense;
63 	int mrc_pdn_resetn;
64 	int mrc_gp0; /* mrcs spi int */
65 	int mrc_gp1;
66 	int mrc_gp2;
67 	int mrc_gp3;
68 	int mrc_gp4;
69 	int host_spi_gsp_ts_int;
70 };
71 
72 struct sms_board {
73 	enum sms_device_type_st type;
74 	char *name, *fw[DEVICE_MODE_MAX];
75 	struct sms_board_gpio_cfg board_cfg;
76 	char *rc_codes;				/* Name of IR codes table */
77 
78 	/* gpios */
79 	int led_power, led_hi, led_lo, lna_ctrl, rf_switch;
80 
81 	char intf_num;
82 	int default_mode;
83 	unsigned int mtu;
84 	unsigned int crystal;
85 	struct sms_antenna_config_ST *antenna_config;
86 };
87 
88 struct sms_board *sms_get_board(unsigned id);
89 
90 extern struct smscore_device_t *coredev;
91 
92 enum SMS_BOARD_EVENTS {
93 	BOARD_EVENT_POWER_INIT,
94 	BOARD_EVENT_POWER_SUSPEND,
95 	BOARD_EVENT_POWER_RESUME,
96 	BOARD_EVENT_BIND,
97 	BOARD_EVENT_SCAN_PROG,
98 	BOARD_EVENT_SCAN_COMP,
99 	BOARD_EVENT_EMERGENCY_WARNING_SIGNAL,
100 	BOARD_EVENT_FE_LOCK,
101 	BOARD_EVENT_FE_UNLOCK,
102 	BOARD_EVENT_DEMOD_LOCK,
103 	BOARD_EVENT_DEMOD_UNLOCK,
104 	BOARD_EVENT_RECEPTION_MAX_4,
105 	BOARD_EVENT_RECEPTION_3,
106 	BOARD_EVENT_RECEPTION_2,
107 	BOARD_EVENT_RECEPTION_1,
108 	BOARD_EVENT_RECEPTION_LOST_0,
109 	BOARD_EVENT_MULTIPLEX_OK,
110 	BOARD_EVENT_MULTIPLEX_ERRORS
111 };
112 
113 int sms_board_event(struct smscore_device_t *coredev,
114 		enum SMS_BOARD_EVENTS gevent);
115 
116 int sms_board_setup(struct smscore_device_t *coredev);
117 
118 #define SMS_LED_OFF 0
119 #define SMS_LED_LO  1
120 #define SMS_LED_HI  2
121 int sms_board_led_feedback(struct smscore_device_t *coredev, int led);
122 int sms_board_power(struct smscore_device_t *coredev, int onoff);
123 int sms_board_lna_control(struct smscore_device_t *coredev, int onoff);
124 
125 extern int sms_board_load_modules(int id);
126 
127 #endif /* __SMS_CARDS_H__ */
128