Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 1 | /* |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 2 | * FireDTV driver (formerly known as FireSAT) |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 3 | * |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> |
| 5 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; either version 2 of |
| 10 | * the License, or (at your option) any later version. |
| 11 | */ |
| 12 | |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 13 | #ifndef _FIREDTV_H |
| 14 | #define _FIREDTV_H |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 15 | |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 16 | #include <linux/dvb/dmx.h> |
| 17 | #include <linux/dvb/frontend.h> |
| 18 | #include <linux/list.h> |
| 19 | #include <linux/mutex.h> |
| 20 | #include <linux/spinlock_types.h> |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/wait.h> |
| 23 | #include <linux/workqueue.h> |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 24 | |
| 25 | #include <demux.h> |
| 26 | #include <dmxdev.h> |
| 27 | #include <dvb_demux.h> |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 28 | #include <dvb_frontend.h> |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 29 | #include <dvb_net.h> |
| 30 | #include <dvbdev.h> |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 31 | |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 32 | #include <linux/version.h> |
| 33 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25) |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 34 | #define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w, v) |
| 35 | #else |
| 36 | #define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w) |
| 37 | #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(x) |
| 38 | #endif |
| 39 | |
| 40 | /***************************************************************** |
| 41 | * CA message command constants from en50221_app_tags.h of libdvb |
| 42 | *****************************************************************/ |
| 43 | /* Resource Manager */ |
| 44 | #define TAG_PROFILE_ENQUIRY 0x9f8010 |
| 45 | #define TAG_PROFILE 0x9f8011 |
| 46 | #define TAG_PROFILE_CHANGE 0x9f8012 |
| 47 | |
| 48 | /* Application Info */ |
| 49 | #define TAG_APP_INFO_ENQUIRY 0x9f8020 |
| 50 | #define TAG_APP_INFO 0x9f8021 |
| 51 | #define TAG_ENTER_MENU 0x9f8022 |
| 52 | |
| 53 | /* CA Support */ |
| 54 | #define TAG_CA_INFO_ENQUIRY 0x9f8030 |
| 55 | #define TAG_CA_INFO 0x9f8031 |
| 56 | #define TAG_CA_PMT 0x9f8032 |
| 57 | #define TAG_CA_PMT_REPLY 0x9f8033 |
| 58 | |
| 59 | /* Host Control */ |
| 60 | #define TAG_TUNE 0x9f8400 |
| 61 | #define TAG_REPLACE 0x9f8401 |
| 62 | #define TAG_CLEAR_REPLACE 0x9f8402 |
| 63 | #define TAG_ASK_RELEASE 0x9f8403 |
| 64 | |
| 65 | /* Date and Time */ |
| 66 | #define TAG_DATE_TIME_ENQUIRY 0x9f8440 |
| 67 | #define TAG_DATE_TIME 0x9f8441 |
| 68 | |
| 69 | /* Man Machine Interface (MMI) */ |
| 70 | #define TAG_CLOSE_MMI 0x9f8800 |
| 71 | #define TAG_DISPLAY_CONTROL 0x9f8801 |
| 72 | #define TAG_DISPLAY_REPLY 0x9f8802 |
| 73 | #define TAG_TEXT_LAST 0x9f8803 |
| 74 | #define TAG_TEXT_MORE 0x9f8804 |
| 75 | #define TAG_KEYPAD_CONTROL 0x9f8805 |
| 76 | #define TAG_KEYPRESS 0x9f8806 |
| 77 | #define TAG_ENQUIRY 0x9f8807 |
| 78 | #define TAG_ANSWER 0x9f8808 |
| 79 | #define TAG_MENU_LAST 0x9f8809 |
| 80 | #define TAG_MENU_MORE 0x9f880a |
| 81 | #define TAG_MENU_ANSWER 0x9f880b |
| 82 | #define TAG_LIST_LAST 0x9f880c |
| 83 | #define TAG_LIST_MORE 0x9f880d |
| 84 | #define TAG_SUBTITLE_SEGMENT_LAST 0x9f880e |
| 85 | #define TAG_SUBTITLE_SEGMENT_MORE 0x9f880f |
| 86 | #define TAG_DISPLAY_MESSAGE 0x9f8810 |
| 87 | #define TAG_SCENE_END_MARK 0x9f8811 |
| 88 | #define TAG_SCENE_DONE 0x9f8812 |
| 89 | #define TAG_SCENE_CONTROL 0x9f8813 |
| 90 | #define TAG_SUBTITLE_DOWNLOAD_LAST 0x9f8814 |
| 91 | #define TAG_SUBTITLE_DOWNLOAD_MORE 0x9f8815 |
| 92 | #define TAG_FLUSH_DOWNLOAD 0x9f8816 |
| 93 | #define TAG_DOWNLOAD_REPLY 0x9f8817 |
| 94 | |
| 95 | /* Low Speed Communications */ |
| 96 | #define TAG_COMMS_COMMAND 0x9f8c00 |
| 97 | #define TAG_CONNECTION_DESCRIPTOR 0x9f8c01 |
| 98 | #define TAG_COMMS_REPLY 0x9f8c02 |
| 99 | #define TAG_COMMS_SEND_LAST 0x9f8c03 |
| 100 | #define TAG_COMMS_SEND_MORE 0x9f8c04 |
| 101 | #define TAG_COMMS_RECV_LAST 0x9f8c05 |
| 102 | #define TAG_COMMS_RECV_MORE 0x9f8c06 |
| 103 | |
| 104 | /* Authentication */ |
| 105 | #define TAG_AUTH_REQ 0x9f8200 |
| 106 | #define TAG_AUTH_RESP 0x9f8201 |
| 107 | |
| 108 | /* Teletext */ |
| 109 | #define TAG_TELETEXT_EBU 0x9f9000 |
| 110 | |
| 111 | /* Smartcard */ |
| 112 | #define TAG_SMARTCARD_COMMAND 0x9f8e00 |
| 113 | #define TAG_SMARTCARD_REPLY 0x9f8e01 |
| 114 | #define TAG_SMARTCARD_SEND 0x9f8e02 |
| 115 | #define TAG_SMARTCARD_RCV 0x9f8e03 |
| 116 | |
| 117 | /* EPG */ |
| 118 | #define TAG_EPG_ENQUIRY 0x9f8f00 |
| 119 | #define TAG_EPG_REPLY 0x9f8f01 |
| 120 | |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 121 | |
| 122 | enum model_type { |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame^] | 123 | FIREDTV_UNKNOWN = 0, |
| 124 | FIREDTV_DVB_S = 1, |
| 125 | FIREDTV_DVB_C = 2, |
| 126 | FIREDTV_DVB_T = 3, |
| 127 | FIREDTV_DVB_S2 = 4, |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 128 | }; |
| 129 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 130 | struct input_dev; |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 131 | struct hpsb_iso; |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 132 | struct unit_directory; |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 133 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame^] | 134 | struct firedtv { |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 135 | struct dvb_adapter adapter; |
| 136 | struct dmxdev dmxdev; |
| 137 | struct dvb_demux demux; |
| 138 | struct dmx_frontend frontend; |
| 139 | struct dvb_net dvbnet; |
| 140 | struct dvb_frontend fe; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 141 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 142 | struct dvb_device *cadev; |
| 143 | int ca_last_command; |
| 144 | int ca_time_interval; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 145 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 146 | struct mutex avc_mutex; |
| 147 | wait_queue_head_t avc_wait; |
| 148 | bool avc_reply_received; |
| 149 | struct work_struct remote_ctrl_work; |
| 150 | struct input_dev *remote_ctrl_dev; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 151 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame^] | 152 | struct firedtv_channel { |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 153 | bool active; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 154 | int pid; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 155 | } channel[16]; |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 156 | struct mutex demux_mutex; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 157 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 158 | struct unit_directory *ud; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 159 | |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 160 | enum model_type type; |
| 161 | char subunit; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 162 | fe_sec_voltage_t voltage; |
| 163 | fe_sec_tone_mode_t tone; |
| 164 | |
| 165 | int isochannel; |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 166 | struct hpsb_iso *iso_handle; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 167 | |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 168 | struct list_head list; |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 169 | |
| 170 | /* needed by avc_api */ |
| 171 | int resp_length; |
| 172 | u8 respfrm[512]; |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | struct firewireheader { |
| 176 | union { |
| 177 | struct { |
| 178 | __u8 tcode:4; |
| 179 | __u8 sy:4; |
| 180 | __u8 tag:2; |
| 181 | __u8 channel:6; |
| 182 | |
| 183 | __u8 length_l; |
| 184 | __u8 length_h; |
| 185 | } hdr; |
| 186 | __u32 val; |
| 187 | }; |
| 188 | }; |
| 189 | |
| 190 | struct CIPHeader { |
| 191 | union { |
| 192 | struct { |
| 193 | __u8 syncbits:2; |
| 194 | __u8 sid:6; |
| 195 | __u8 dbs; |
| 196 | __u8 fn:2; |
| 197 | __u8 qpc:3; |
| 198 | __u8 sph:1; |
| 199 | __u8 rsv:2; |
| 200 | __u8 dbc; |
| 201 | __u8 syncbits2:2; |
| 202 | __u8 fmt:6; |
| 203 | __u32 fdf:24; |
| 204 | } cip; |
| 205 | __u64 val; |
| 206 | }; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 207 | }; |
| 208 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame^] | 209 | extern const char *fdtv_model_names[]; |
| 210 | extern struct list_head fdtv_list; |
| 211 | extern spinlock_t fdtv_list_lock; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 212 | |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 213 | struct device; |
| 214 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame^] | 215 | /* firedtv-dvb.c */ |
| 216 | int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed); |
| 217 | int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed); |
| 218 | int fdtv_dvbdev_init(struct firedtv *fdtv, struct device *dev); |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 219 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame^] | 220 | /* firedtv-fe.c */ |
| 221 | void fdtv_frontend_init(struct firedtv *fdtv); |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 222 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame^] | 223 | /* firedtv-iso.c */ |
| 224 | int setup_iso_channel(struct firedtv *fdtv); |
| 225 | void tear_down_iso_channel(struct firedtv *fdtv); |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 226 | |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 227 | #endif /* _FIREDTV_H */ |