aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/firewire/firedtv.h
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2009-02-23 08:21:10 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-02-24 08:51:29 -0500
commit154907957f9391b1af997b57507b16c018cc4995 (patch)
treef9033e7dc29d5406e871b8102ba0b588d34b50ec /drivers/media/dvb/firewire/firedtv.h
parenta70f81c1c0dac113ac4705e7701e2676e67905cd (diff)
firedtv: massive refactoring
Combination of the following changes: Mon, 23 Feb 2009 14:21:10 +0100 (CET) firedtv: reinstate debug logging option Henrik Kurelid tells me that FCP debug logging (which I removed during cleanups) is still useful when working on driver issues together with end users. So bring it back in an updated form with only 60% of the original code footprint. Logging can be enabled with # echo -1 > /sys/module/firedtv/parameters/debug 1 instead of -1 enables only FCP header logging, 2 instead of -1 enables only hexdumps of the entire FCP frames. 0 switches logging off again. Fri, 20 Feb 2009 20:54:27 +0100 (CET) firedtv: build fix for INPUT=m and DVB_FIREDTV=y Thu, 19 Feb 2009 20:40:39 +0100 firedtv: use msecs_to_jiffies Pointed out by Mauro Carvalho Chehab. Sun Feb 15 20:50:46 CET 2009 firedtv: some more housekeeping Fix an old checkpatch warning and a new compiler warning. Sun Feb 15 15:33:17 CET 2009 firedtv: rename a file once more At the moment, about a third of avc.c is specific to FireDTVs rather than generic AV/C code. Rename it to firedtv-avc.c. Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: more compact channels backing store Replace struct firedtv_channel { bool active; int pid; } channel[16]; by unsigned long channel_active; u16 channel_pid[16];. Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: some simplifications c->active was unnecessarily cleared twice. Also, by marking the channel inactive before the for loop, the loop becomes identical with fdtv_channel_collect(). Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: remove a bogus loop This loop is unnecessary because - only active channel[].pid's will be sent to the device, - when a channel is activated, its pid is set to dvbdmxfeed->pid. Perhaps the original code was there because it was initially not fully covered by the fdtv->demux_mutex. Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: fix mutex protection fdtv_start_feed() accessed the channel list unsafely. Fully serialize it with itself and fdtv_stop_feed(). Sun Feb 15 15:33:17 CET 2009 firedtv: dvb demux: fix missing braces Original code was: ... case DMX_TS_PES_OTHER: //Dirty fix to keep firesat->channel pid-list up to date for(k=0;k<16;k++){ if(firesat->channel[k].active == 0) firesat->channel[k].pid = dvbdmxfeed->pid; break; } channel = firesat_channel_allocate(firesat); break; default: ... Looks bogus in several respects. For now let's just add braces to the if because that seems to be what the author meant. Sun Feb 15 15:33:17 CET 2009 firedtv: allow build without input subsystem !CONFIG_INPUT is very unlikely on systems on which firedtv is of interest. But we can easily support it. Sun Feb 15 15:33:17 CET 2009 firedtv: replace EXTRA_CFLAGS by ccflags The former are deprecated. The latter can depend on Kconfig variables. Sun Feb 15 15:33:17 CET 2009 firedtv: concentrate ieee1394 dependencies Move the entire interface with drivers/ieee1394 to firedtv-1394.c. Move 1394-independent module initialization code to firedtv-dvb.c. This prepares interfacing with drivers/firewire. Sun Feb 15 15:33:17 CET 2009 firedtv: amend Kconfig menu prompt Sun Feb 15 15:33:17 CET 2009 firedtv: remove kernel version compatibility macro Sun Feb 15 15:33:17 CET 2009 firedtv: combine header files avc.h and firedtv-*.h are small and currently not shared with other drivers, hence concatenate them all into firedtv.h. Sun Feb 15 15:33:17 CET 2009 firedtv: misc style touch-ups Standardize on lower-case hexadecimal constants. Adjust whitespace. Omit unnecessary pointer type casts and an unnecessary list head initialization. Use dev_printk. Wed Feb 11 21:21:04 CET 2009 firedtv: avc, ci: remove unused constants Wed Feb 11 21:21:04 CET 2009 firedtv: avc: remove bitfields from read descriptor response operands Don't use bitfields in struct types of on-the-wire data. Wed Feb 11 21:21:04 CET 2009 firedtv: avc: remove bitfields from DSD command operands Don't use bitfields in struct types of on-the-wire data. Wed Feb 11 21:21:04 CET 2009 firedtv: avc: header file cleanup Remove unused constants and declarations. Move privately used constants into .c files. Wed Feb 11 21:21:04 CET 2009 firedtv: avc: remove bitfields from FCP frame types Don't use bitfields in struct types of on-the-wire data. Also move many privately used constants from avc.h to avc.c and remove some unused constants. Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: avc: fix offset in avc_tuner_get_ts The parentheses were wrong. It didn't matter though because this code only writes a 0 into an area which is already initialized to 0. Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: avc: reduce stack usage, remove two typedefs It is safe to share a memory buffer for command frame and response frame because the response data come in after the command frame was last used. Even less stack would be required if only the actual required frame size instead of the entire FCP register size was allocated. Also, rename the defined types AVCCmdFrm and AVCRspFrm to struct avc_command_frame and struct avc_response_frame. TODO: Remove the bitfields in these types. Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: cmp: move code to avc Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: iso: move code to firedtv-1394 Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: iso: remove unnecessary struct type definitions Sun, 18 Jan 2009 16:30:00 +0100 (CET) firedtv: iso: style changes and fixlets Add cleanup after failure in setup_iso_channel. Replace printk() by dv_err(). Decrease indentation level in rawiso_activity_cb(). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/media/dvb/firewire/firedtv.h')
-rw-r--r--drivers/media/dvb/firewire/firedtv.h257
1 files changed, 106 insertions, 151 deletions
diff --git a/drivers/media/dvb/firewire/firedtv.h b/drivers/media/dvb/firewire/firedtv.h
index 2a34028ccbcd..d48530b81e61 100644
--- a/drivers/media/dvb/firewire/firedtv.h
+++ b/drivers/media/dvb/firewire/firedtv.h
@@ -29,95 +29,35 @@
29#include <dvb_net.h> 29#include <dvb_net.h>
30#include <dvbdev.h> 30#include <dvbdev.h>
31 31
32#include <linux/version.h> 32struct firedtv_tuner_status {
33#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25) 33 unsigned active_system:8;
34#define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w, v) 34 unsigned searching:1;
35#else 35 unsigned moving:1;
36#define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w) 36 unsigned no_rf:1;
37#define DVB_DEFINE_MOD_OPT_ADAPTER_NR(x) 37 unsigned input:1;
38#endif 38 unsigned selected_antenna:7;
39 39 unsigned ber:32;
40/***************************************************************** 40 unsigned signal_strength:8;
41 * CA message command constants from en50221_app_tags.h of libdvb 41 unsigned raster_frequency:2;
42 *****************************************************************/ 42 unsigned rf_frequency:22;
43/* Resource Manager */ 43 unsigned man_dep_info_length:8;
44#define TAG_PROFILE_ENQUIRY 0x9f8010 44 unsigned front_end_error:1;
45#define TAG_PROFILE 0x9f8011 45 unsigned antenna_error:1;
46#define TAG_PROFILE_CHANGE 0x9f8012 46 unsigned front_end_power_status:1;
47 47 unsigned power_supply:1;
48/* Application Info */ 48 unsigned carrier_noise_ratio:16;
49#define TAG_APP_INFO_ENQUIRY 0x9f8020 49 unsigned power_supply_voltage:8;
50#define TAG_APP_INFO 0x9f8021 50 unsigned antenna_voltage:8;
51#define TAG_ENTER_MENU 0x9f8022 51 unsigned firewire_bus_voltage:8;
52 52 unsigned ca_mmi:1;
53/* CA Support */ 53 unsigned ca_pmt_reply:1;
54#define TAG_CA_INFO_ENQUIRY 0x9f8030 54 unsigned ca_date_time_request:1;
55#define TAG_CA_INFO 0x9f8031 55 unsigned ca_application_info:1;
56#define TAG_CA_PMT 0x9f8032 56 unsigned ca_module_present_status:1;
57#define TAG_CA_PMT_REPLY 0x9f8033 57 unsigned ca_dvb_flag:1;
58 58 unsigned ca_error_flag:1;
59/* Host Control */ 59 unsigned ca_initialization_status:1;
60#define TAG_TUNE 0x9f8400 60};
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
121 61
122enum model_type { 62enum model_type {
123 FIREDTV_UNKNOWN = 0, 63 FIREDTV_UNKNOWN = 0,
@@ -127,11 +67,22 @@ enum model_type {
127 FIREDTV_DVB_S2 = 4, 67 FIREDTV_DVB_S2 = 4,
128}; 68};
129 69
70struct device;
130struct input_dev; 71struct input_dev;
131struct hpsb_iso; 72struct firedtv;
132struct unit_directory; 73
74struct firedtv_backend {
75 int (*lock)(struct firedtv *fdtv, u64 addr, void *data, __be32 arg);
76 int (*read)(struct firedtv *fdtv, u64 addr, void *data, size_t len);
77 int (*write)(struct firedtv *fdtv, u64 addr, void *data, size_t len);
78 int (*start_iso)(struct firedtv *fdtv);
79 void (*stop_iso)(struct firedtv *fdtv);
80};
133 81
134struct firedtv { 82struct firedtv {
83 struct device *device;
84 struct list_head list;
85
135 struct dvb_adapter adapter; 86 struct dvb_adapter adapter;
136 struct dmxdev dmxdev; 87 struct dmxdev dmxdev;
137 struct dvb_demux demux; 88 struct dvb_demux demux;
@@ -149,79 +100,83 @@ struct firedtv {
149 struct work_struct remote_ctrl_work; 100 struct work_struct remote_ctrl_work;
150 struct input_dev *remote_ctrl_dev; 101 struct input_dev *remote_ctrl_dev;
151 102
152 struct firedtv_channel { 103 enum model_type type;
153 bool active; 104 char subunit;
154 int pid; 105 char isochannel;
155 } channel[16]; 106 fe_sec_voltage_t voltage;
156 struct mutex demux_mutex; 107 fe_sec_tone_mode_t tone;
157 108
158 struct unit_directory *ud; 109 const struct firedtv_backend *backend;
110 void *backend_data;
159 111
160 enum model_type type; 112 struct mutex demux_mutex;
161 char subunit; 113 unsigned long channel_active;
162 fe_sec_voltage_t voltage; 114 u16 channel_pid[16];
163 fe_sec_tone_mode_t tone;
164
165 int isochannel;
166 struct hpsb_iso *iso_handle;
167
168 struct list_head list;
169 115
170 /* needed by avc_api */ 116 size_t response_length;
171 int resp_length; 117 u8 response[512];
172 u8 respfrm[512];
173}; 118};
174 119
175struct firewireheader { 120/* firedtv-1394.c */
176 union { 121#ifdef CONFIG_DVB_FIREDTV_IEEE1394
177 struct { 122int fdtv_1394_init(struct ieee1394_device_id id_table[]);
178 __u8 tcode:4; 123void fdtv_1394_exit(void);
179 __u8 sy:4; 124#else
180 __u8 tag:2; 125static inline int fdtv_1394_init(struct ieee1394_device_id it[]) { return 0; }
181 __u8 channel:6; 126static inline void fdtv_1394_exit(void) {}
182 127#endif
183 __u8 length_l;
184 __u8 length_h;
185 } hdr;
186 __u32 val;
187 };
188};
189
190struct 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 };
207};
208
209extern const char *fdtv_model_names[];
210extern struct list_head fdtv_list;
211extern spinlock_t fdtv_list_lock;
212 128
213struct device; 129/* firedtv-avc.c */
130int avc_recv(struct firedtv *fdtv, void *data, size_t length);
131int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat);
132struct dvb_frontend_parameters;
133int avc_tuner_dsd(struct firedtv *fdtv, struct dvb_frontend_parameters *params);
134int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]);
135int avc_tuner_get_ts(struct firedtv *fdtv);
136int avc_identify_subunit(struct firedtv *fdtv);
137struct dvb_diseqc_master_cmd;
138int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
139 char conttone, char nrdiseq,
140 struct dvb_diseqc_master_cmd *diseqcmd);
141void avc_remote_ctrl_work(struct work_struct *work);
142int avc_register_remote_control(struct firedtv *fdtv);
143int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
144int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
145int avc_ca_reset(struct firedtv *fdtv);
146int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length);
147int avc_ca_get_time_date(struct firedtv *fdtv, int *interval);
148int avc_ca_enter_menu(struct firedtv *fdtv);
149int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len);
150int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel);
151void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel);
152
153/* firedtv-ci.c */
154int fdtv_ca_register(struct firedtv *fdtv);
155void fdtv_ca_release(struct firedtv *fdtv);
214 156
215/* firedtv-dvb.c */ 157/* firedtv-dvb.c */
216int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed); 158int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed);
217int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed); 159int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
218int fdtv_dvbdev_init(struct firedtv *fdtv, struct device *dev); 160int fdtv_dvb_register(struct firedtv *fdtv);
161void fdtv_dvb_unregister(struct firedtv *fdtv);
162struct firedtv *fdtv_alloc(struct device *dev,
163 const struct firedtv_backend *backend,
164 const char *name, size_t name_len);
165extern const char *fdtv_model_names[];
219 166
220/* firedtv-fe.c */ 167/* firedtv-fe.c */
221void fdtv_frontend_init(struct firedtv *fdtv); 168void fdtv_frontend_init(struct firedtv *fdtv);
222 169
223/* firedtv-iso.c */ 170/* firedtv-rc.c */
224int setup_iso_channel(struct firedtv *fdtv); 171#ifdef CONFIG_DVB_FIREDTV_INPUT
225void tear_down_iso_channel(struct firedtv *fdtv); 172int fdtv_register_rc(struct firedtv *fdtv, struct device *dev);
173void fdtv_unregister_rc(struct firedtv *fdtv);
174void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code);
175#else
176static inline int fdtv_register_rc(struct firedtv *fdtv,
177 struct device *dev) { return 0; }
178static inline void fdtv_unregister_rc(struct firedtv *fdtv) {}
179static inline void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) {}
180#endif
226 181
227#endif /* _FIREDTV_H */ 182#endif /* _FIREDTV_H */