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 | |
Mauro Carvalho Chehab | b2409b6 | 2012-10-19 07:29:17 -0300 | [diff] [blame] | 16 | #include <linux/time.h> |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 17 | #include <linux/dvb/dmx.h> |
| 18 | #include <linux/dvb/frontend.h> |
| 19 | #include <linux/list.h> |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 20 | #include <linux/mod_devicetable.h> |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 21 | #include <linux/mutex.h> |
| 22 | #include <linux/spinlock_types.h> |
| 23 | #include <linux/types.h> |
| 24 | #include <linux/wait.h> |
| 25 | #include <linux/workqueue.h> |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 26 | |
| 27 | #include <demux.h> |
| 28 | #include <dmxdev.h> |
| 29 | #include <dvb_demux.h> |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 30 | #include <dvb_frontend.h> |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 31 | #include <dvb_net.h> |
| 32 | #include <dvbdev.h> |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 33 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 34 | struct firedtv_tuner_status { |
| 35 | unsigned active_system:8; |
| 36 | unsigned searching:1; |
| 37 | unsigned moving:1; |
| 38 | unsigned no_rf:1; |
| 39 | unsigned input:1; |
| 40 | unsigned selected_antenna:7; |
| 41 | unsigned ber:32; |
| 42 | unsigned signal_strength:8; |
| 43 | unsigned raster_frequency:2; |
| 44 | unsigned rf_frequency:22; |
| 45 | unsigned man_dep_info_length:8; |
| 46 | unsigned front_end_error:1; |
| 47 | unsigned antenna_error:1; |
| 48 | unsigned front_end_power_status:1; |
| 49 | unsigned power_supply:1; |
| 50 | unsigned carrier_noise_ratio:16; |
| 51 | unsigned power_supply_voltage:8; |
| 52 | unsigned antenna_voltage:8; |
| 53 | unsigned firewire_bus_voltage:8; |
| 54 | unsigned ca_mmi:1; |
| 55 | unsigned ca_pmt_reply:1; |
| 56 | unsigned ca_date_time_request:1; |
| 57 | unsigned ca_application_info:1; |
| 58 | unsigned ca_module_present_status:1; |
| 59 | unsigned ca_dvb_flag:1; |
| 60 | unsigned ca_error_flag:1; |
| 61 | unsigned ca_initialization_status:1; |
| 62 | }; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 63 | |
| 64 | enum model_type { |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame] | 65 | FIREDTV_UNKNOWN = 0, |
| 66 | FIREDTV_DVB_S = 1, |
| 67 | FIREDTV_DVB_C = 2, |
| 68 | FIREDTV_DVB_T = 3, |
| 69 | FIREDTV_DVB_S2 = 4, |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 70 | }; |
| 71 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 72 | struct device; |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 73 | struct input_dev; |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 74 | struct fdtv_ir_context; |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 75 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame] | 76 | struct firedtv { |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 77 | struct device *device; |
| 78 | struct list_head list; |
| 79 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 80 | struct dvb_adapter adapter; |
| 81 | struct dmxdev dmxdev; |
| 82 | struct dvb_demux demux; |
| 83 | struct dmx_frontend frontend; |
| 84 | struct dvb_net dvbnet; |
| 85 | struct dvb_frontend fe; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 86 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 87 | struct dvb_device *cadev; |
| 88 | int ca_last_command; |
| 89 | int ca_time_interval; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 90 | |
Stefan Richter | 8ae83cd | 2008-11-02 13:45:00 +0100 | [diff] [blame] | 91 | struct mutex avc_mutex; |
| 92 | wait_queue_head_t avc_wait; |
| 93 | bool avc_reply_received; |
| 94 | struct work_struct remote_ctrl_work; |
| 95 | struct input_dev *remote_ctrl_dev; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 96 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 97 | enum model_type type; |
| 98 | char subunit; |
Mauro Carvalho Chehab | f2dd851 | 2014-10-30 07:16:57 -0300 | [diff] [blame] | 99 | s8 isochannel; |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 100 | struct fdtv_ir_context *ir_context; |
| 101 | |
Mauro Carvalho Chehab | 0df289a | 2015-06-07 14:53:52 -0300 | [diff] [blame^] | 102 | enum fe_sec_voltage voltage; |
| 103 | enum fe_sec_tone_mode tone; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 104 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 105 | struct mutex demux_mutex; |
| 106 | unsigned long channel_active; |
| 107 | u16 channel_pid[16]; |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 108 | |
Stefan Richter | 3fb80ef | 2009-11-18 16:02:01 -0300 | [diff] [blame] | 109 | int avc_data_length; |
| 110 | u8 avc_data[512]; |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 111 | }; |
| 112 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 113 | /* firedtv-avc.c */ |
| 114 | int avc_recv(struct firedtv *fdtv, void *data, size_t length); |
| 115 | int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat); |
Mauro Carvalho Chehab | e11eb28 | 2011-12-26 16:12:40 -0300 | [diff] [blame] | 116 | struct dtv_frontend_properties; |
| 117 | int avc_tuner_dsd(struct firedtv *fdtv, struct dtv_frontend_properties *params); |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 118 | int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]); |
| 119 | int avc_tuner_get_ts(struct firedtv *fdtv); |
| 120 | int avc_identify_subunit(struct firedtv *fdtv); |
| 121 | struct dvb_diseqc_master_cmd; |
| 122 | int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst, |
| 123 | char conttone, char nrdiseq, |
| 124 | struct dvb_diseqc_master_cmd *diseqcmd); |
| 125 | void avc_remote_ctrl_work(struct work_struct *work); |
| 126 | int avc_register_remote_control(struct firedtv *fdtv); |
| 127 | int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len); |
| 128 | int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len); |
| 129 | int avc_ca_reset(struct firedtv *fdtv); |
| 130 | int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length); |
| 131 | int avc_ca_get_time_date(struct firedtv *fdtv, int *interval); |
| 132 | int avc_ca_enter_menu(struct firedtv *fdtv); |
| 133 | int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len); |
| 134 | int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel); |
| 135 | void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel); |
Henrik Kurelid | df4846c | 2008-08-01 10:00:45 +0200 | [diff] [blame] | 136 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 137 | /* firedtv-ci.c */ |
| 138 | int fdtv_ca_register(struct firedtv *fdtv); |
| 139 | void fdtv_ca_release(struct firedtv *fdtv); |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 140 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame] | 141 | /* firedtv-dvb.c */ |
| 142 | int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed); |
| 143 | int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed); |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 144 | int fdtv_dvb_register(struct firedtv *fdtv, const char *name); |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 145 | void fdtv_dvb_unregister(struct firedtv *fdtv); |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 146 | |
Rambaldi | a70f81c | 2009-01-17 14:47:34 +0100 | [diff] [blame] | 147 | /* firedtv-fe.c */ |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 148 | void fdtv_frontend_init(struct firedtv *fdtv, const char *name); |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 149 | |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 150 | /* firedtv-fw.c */ |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 151 | int fdtv_lock(struct firedtv *fdtv, u64 addr, void *data); |
| 152 | int fdtv_read(struct firedtv *fdtv, u64 addr, void *data); |
| 153 | int fdtv_write(struct firedtv *fdtv, u64 addr, void *data, size_t len); |
| 154 | int fdtv_start_iso(struct firedtv *fdtv); |
| 155 | void fdtv_stop_iso(struct firedtv *fdtv); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 156 | |
Stefan Richter | 1549079 | 2009-02-23 14:21:10 +0100 | [diff] [blame] | 157 | /* firedtv-rc.c */ |
| 158 | #ifdef CONFIG_DVB_FIREDTV_INPUT |
| 159 | int fdtv_register_rc(struct firedtv *fdtv, struct device *dev); |
| 160 | void fdtv_unregister_rc(struct firedtv *fdtv); |
| 161 | void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code); |
| 162 | #else |
| 163 | static inline int fdtv_register_rc(struct firedtv *fdtv, |
| 164 | struct device *dev) { return 0; } |
| 165 | static inline void fdtv_unregister_rc(struct firedtv *fdtv) {} |
| 166 | static inline void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) {} |
| 167 | #endif |
Greg Kroah-Hartman | c81c8b6 | 2008-03-06 21:30:23 -0800 | [diff] [blame] | 168 | |
Stefan Richter | 612262a | 2008-08-26 00:17:30 +0200 | [diff] [blame] | 169 | #endif /* _FIREDTV_H */ |