firedtv.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. * FireDTV driver (formerly known as FireSAT)
  3. *
  4. * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
  5. * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
  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. #ifndef _FIREDTV_H
  13. #define _FIREDTV_H
  14. #include <linux/dvb/dmx.h>
  15. #include <linux/dvb/frontend.h>
  16. #include <linux/list.h>
  17. #include <linux/mod_devicetable.h>
  18. #include <linux/mutex.h>
  19. #include <linux/spinlock_types.h>
  20. #include <linux/types.h>
  21. #include <linux/wait.h>
  22. #include <linux/workqueue.h>
  23. #include <demux.h>
  24. #include <dmxdev.h>
  25. #include <dvb_demux.h>
  26. #include <dvb_frontend.h>
  27. #include <dvb_net.h>
  28. #include <dvbdev.h>
  29. struct firedtv_tuner_status {
  30. unsigned active_system:8;
  31. unsigned searching:1;
  32. unsigned moving:1;
  33. unsigned no_rf:1;
  34. unsigned input:1;
  35. unsigned selected_antenna:7;
  36. unsigned ber:32;
  37. unsigned signal_strength:8;
  38. unsigned raster_frequency:2;
  39. unsigned rf_frequency:22;
  40. unsigned man_dep_info_length:8;
  41. unsigned front_end_error:1;
  42. unsigned antenna_error:1;
  43. unsigned front_end_power_status:1;
  44. unsigned power_supply:1;
  45. unsigned carrier_noise_ratio:16;
  46. unsigned power_supply_voltage:8;
  47. unsigned antenna_voltage:8;
  48. unsigned firewire_bus_voltage:8;
  49. unsigned ca_mmi:1;
  50. unsigned ca_pmt_reply:1;
  51. unsigned ca_date_time_request:1;
  52. unsigned ca_application_info:1;
  53. unsigned ca_module_present_status:1;
  54. unsigned ca_dvb_flag:1;
  55. unsigned ca_error_flag:1;
  56. unsigned ca_initialization_status:1;
  57. };
  58. enum model_type {
  59. FIREDTV_UNKNOWN = 0,
  60. FIREDTV_DVB_S = 1,
  61. FIREDTV_DVB_C = 2,
  62. FIREDTV_DVB_T = 3,
  63. FIREDTV_DVB_S2 = 4,
  64. };
  65. struct device;
  66. struct input_dev;
  67. struct firedtv;
  68. struct firedtv_backend {
  69. int (*lock)(struct firedtv *fdtv, u64 addr, __be32 data[]);
  70. int (*read)(struct firedtv *fdtv, u64 addr, void *data);
  71. int (*write)(struct firedtv *fdtv, u64 addr, void *data, size_t len);
  72. int (*start_iso)(struct firedtv *fdtv);
  73. void (*stop_iso)(struct firedtv *fdtv);
  74. };
  75. struct firedtv {
  76. struct device *device;
  77. struct list_head list;
  78. struct dvb_adapter adapter;
  79. struct dmxdev dmxdev;
  80. struct dvb_demux demux;
  81. struct dmx_frontend frontend;
  82. struct dvb_net dvbnet;
  83. struct dvb_frontend fe;
  84. struct dvb_device *cadev;
  85. int ca_last_command;
  86. int ca_time_interval;
  87. struct mutex avc_mutex;
  88. wait_queue_head_t avc_wait;
  89. bool avc_reply_received;
  90. struct work_struct remote_ctrl_work;
  91. struct input_dev *remote_ctrl_dev;
  92. enum model_type type;
  93. char subunit;
  94. char isochannel;
  95. fe_sec_voltage_t voltage;
  96. fe_sec_tone_mode_t tone;
  97. const struct firedtv_backend *backend;
  98. void *backend_data;
  99. struct mutex demux_mutex;
  100. unsigned long channel_active;
  101. u16 channel_pid[16];
  102. size_t response_length;
  103. u8 response[512];
  104. };
  105. /* firedtv-1394.c */
  106. #ifdef CONFIG_DVB_FIREDTV_IEEE1394
  107. int fdtv_1394_init(void);
  108. void fdtv_1394_exit(void);
  109. #else
  110. static inline int fdtv_1394_init(void) { return 0; }
  111. static inline void fdtv_1394_exit(void) {}
  112. #endif
  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);
  116. struct dvb_frontend_parameters;
  117. int avc_tuner_dsd(struct firedtv *fdtv, struct dvb_frontend_parameters *params);
  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);
  136. /* firedtv-ci.c */
  137. int fdtv_ca_register(struct firedtv *fdtv);
  138. void fdtv_ca_release(struct firedtv *fdtv);
  139. /* firedtv-dvb.c */
  140. int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed);
  141. int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
  142. int fdtv_dvb_register(struct firedtv *fdtv);
  143. void fdtv_dvb_unregister(struct firedtv *fdtv);
  144. struct firedtv *fdtv_alloc(struct device *dev,
  145. const struct firedtv_backend *backend,
  146. const char *name, size_t name_len);
  147. extern const char *fdtv_model_names[];
  148. extern const struct ieee1394_device_id fdtv_id_table[];
  149. /* firedtv-fe.c */
  150. void fdtv_frontend_init(struct firedtv *fdtv);
  151. /* firedtv-fw.c */
  152. #ifdef CONFIG_DVB_FIREDTV_FIREWIRE
  153. int fdtv_fw_init(void);
  154. void fdtv_fw_exit(void);
  155. #else
  156. static inline int fdtv_fw_init(void) { return 0; }
  157. static inline void fdtv_fw_exit(void) {}
  158. #endif
  159. /* firedtv-rc.c */
  160. #ifdef CONFIG_DVB_FIREDTV_INPUT
  161. int fdtv_register_rc(struct firedtv *fdtv, struct device *dev);
  162. void fdtv_unregister_rc(struct firedtv *fdtv);
  163. void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code);
  164. #else
  165. static inline int fdtv_register_rc(struct firedtv *fdtv,
  166. struct device *dev) { return 0; }
  167. static inline void fdtv_unregister_rc(struct firedtv *fdtv) {}
  168. static inline void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) {}
  169. #endif
  170. #endif /* _FIREDTV_H */