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 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 32 | struct firedtv_tuner_status { |
| 33 | unsigned active_system:8; |
| 34 | unsigned searching:1; |
| 35 | unsigned moving:1; |
| 36 | unsigned no_rf:1; |
| 37 | unsigned input:1; |
| 38 | unsigned selected_antenna:7; |
| 39 | unsigned ber:32; |
| 40 | unsigned signal_strength:8; |
| 41 | unsigned raster_frequency:2; |
| 42 | unsigned rf_frequency:22; |
| 43 | unsigned man_dep_info_length:8; |
| 44 | unsigned front_end_error:1; |
| 45 | unsigned antenna_error:1; |
| 46 | unsigned front_end_power_status:1; |
| 47 | unsigned power_supply:1; |
| 48 | unsigned carrier_noise_ratio:16; |
| 49 | unsigned power_supply_voltage:8; |
| 50 | unsigned antenna_voltage:8; |
| 51 | unsigned firewire_bus_voltage:8; |
| 52 | unsigned ca_mmi:1; |
| 53 | unsigned ca_pmt_reply:1; |
| 54 | unsigned ca_date_time_request:1; |
| 55 | unsigned ca_application_info:1; |
| 56 | unsigned ca_module_present_status:1; |
| 57 | unsigned ca_dvb_flag:1; |
| 58 | unsigned ca_error_flag:1; |
| 59 | unsigned ca_initialization_status:1; |
| 60 | }; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 61 | |
| 62 | enum model_type { |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame] | 63 | FIREDTV_UNKNOWN = 0, |
| 64 | FIREDTV_DVB_S = 1, |
| 65 | FIREDTV_DVB_C = 2, |
| 66 | FIREDTV_DVB_T = 3, |
| 67 | FIREDTV_DVB_S2 = 4, |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 68 | }; |
| 69 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 70 | struct device; |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 71 | struct input_dev; |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 72 | struct firedtv; |
| 73 | |
| 74 | struct 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 | }; |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 81 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame] | 82 | struct firedtv { |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 83 | struct device *device; |
| 84 | struct list_head list; |
| 85 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 86 | struct dvb_adapter adapter; |
| 87 | struct dmxdev dmxdev; |
| 88 | struct dvb_demux demux; |
| 89 | struct dmx_frontend frontend; |
| 90 | struct dvb_net dvbnet; |
| 91 | struct dvb_frontend fe; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 92 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 93 | struct dvb_device *cadev; |
| 94 | int ca_last_command; |
| 95 | int ca_time_interval; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 96 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 97 | struct mutex avc_mutex; |
| 98 | wait_queue_head_t avc_wait; |
| 99 | bool avc_reply_received; |
| 100 | struct work_struct remote_ctrl_work; |
| 101 | struct input_dev *remote_ctrl_dev; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 102 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 103 | enum model_type type; |
| 104 | char subunit; |
| 105 | char isochannel; |
| 106 | fe_sec_voltage_t voltage; |
| 107 | fe_sec_tone_mode_t tone; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 108 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 109 | const struct firedtv_backend *backend; |
| 110 | void *backend_data; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 111 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 112 | struct mutex demux_mutex; |
| 113 | unsigned long channel_active; |
| 114 | u16 channel_pid[16]; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 115 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 116 | size_t response_length; |
| 117 | u8 response[512]; |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 118 | }; |
| 119 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 120 | /* firedtv-1394.c */ |
| 121 | #ifdef CONFIG_DVB_FIREDTV_IEEE1394 |
| 122 | int fdtv_1394_init(struct ieee1394_device_id id_table[]); |
| 123 | void fdtv_1394_exit(void); |
| 124 | #else |
| 125 | static inline int fdtv_1394_init(struct ieee1394_device_id it[]) { return 0; } |
| 126 | static inline void fdtv_1394_exit(void) {} |
| 127 | #endif |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 128 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 129 | /* firedtv-avc.c */ |
| 130 | int avc_recv(struct firedtv *fdtv, void *data, size_t length); |
| 131 | int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat); |
| 132 | struct dvb_frontend_parameters; |
| 133 | int avc_tuner_dsd(struct firedtv *fdtv, struct dvb_frontend_parameters *params); |
| 134 | int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]); |
| 135 | int avc_tuner_get_ts(struct firedtv *fdtv); |
| 136 | int avc_identify_subunit(struct firedtv *fdtv); |
| 137 | struct dvb_diseqc_master_cmd; |
| 138 | int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst, |
| 139 | char conttone, char nrdiseq, |
| 140 | struct dvb_diseqc_master_cmd *diseqcmd); |
| 141 | void avc_remote_ctrl_work(struct work_struct *work); |
| 142 | int avc_register_remote_control(struct firedtv *fdtv); |
| 143 | int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len); |
| 144 | int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len); |
| 145 | int avc_ca_reset(struct firedtv *fdtv); |
| 146 | int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length); |
| 147 | int avc_ca_get_time_date(struct firedtv *fdtv, int *interval); |
| 148 | int avc_ca_enter_menu(struct firedtv *fdtv); |
| 149 | int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len); |
| 150 | int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel); |
| 151 | void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel); |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 152 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 153 | /* firedtv-ci.c */ |
| 154 | int fdtv_ca_register(struct firedtv *fdtv); |
| 155 | void fdtv_ca_release(struct firedtv *fdtv); |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 156 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame] | 157 | /* firedtv-dvb.c */ |
| 158 | int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed); |
| 159 | int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed); |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 160 | int fdtv_dvb_register(struct firedtv *fdtv); |
| 161 | void fdtv_dvb_unregister(struct firedtv *fdtv); |
| 162 | struct firedtv *fdtv_alloc(struct device *dev, |
| 163 | const struct firedtv_backend *backend, |
| 164 | const char *name, size_t name_len); |
| 165 | extern const char *fdtv_model_names[]; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 166 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame] | 167 | /* firedtv-fe.c */ |
| 168 | void fdtv_frontend_init(struct firedtv *fdtv); |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 169 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame^] | 170 | /* firedtv-rc.c */ |
| 171 | #ifdef CONFIG_DVB_FIREDTV_INPUT |
| 172 | int fdtv_register_rc(struct firedtv *fdtv, struct device *dev); |
| 173 | void fdtv_unregister_rc(struct firedtv *fdtv); |
| 174 | void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code); |
| 175 | #else |
| 176 | static inline int fdtv_register_rc(struct firedtv *fdtv, |
| 177 | struct device *dev) { return 0; } |
| 178 | static inline void fdtv_unregister_rc(struct firedtv *fdtv) {} |
| 179 | static inline void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) {} |
| 180 | #endif |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 181 | |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 182 | #endif /* _FIREDTV_H */ |