firedtv.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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/mutex.h>
  18. #include <linux/spinlock_types.h>
  19. #include <linux/types.h>
  20. #include <linux/wait.h>
  21. #include <linux/workqueue.h>
  22. #include <demux.h>
  23. #include <dmxdev.h>
  24. #include <dvb_demux.h>
  25. #include <dvb_frontend.h>
  26. #include <dvb_net.h>
  27. #include <dvbdev.h>
  28. struct firedtv_tuner_status {
  29. unsigned active_system:8;
  30. unsigned searching:1;
  31. unsigned moving:1;
  32. unsigned no_rf:1;
  33. unsigned input:1;
  34. unsigned selected_antenna:7;
  35. unsigned ber:32;
  36. unsigned signal_strength:8;
  37. unsigned raster_frequency:2;
  38. unsigned rf_frequency:22;
  39. unsigned man_dep_info_length:8;
  40. unsigned front_end_error:1;
  41. unsigned antenna_error:1;
  42. unsigned front_end_power_status:1;
  43. unsigned power_supply:1;
  44. unsigned carrier_noise_ratio:16;
  45. unsigned power_supply_voltage:8;
  46. unsigned antenna_voltage:8;
  47. unsigned firewire_bus_voltage:8;
  48. unsigned ca_mmi:1;
  49. unsigned ca_pmt_reply:1;
  50. unsigned ca_date_time_request:1;
  51. unsigned ca_application_info:1;
  52. unsigned ca_module_present_status:1;
  53. unsigned ca_dvb_flag:1;
  54. unsigned ca_error_flag:1;
  55. unsigned ca_initialization_status:1;
  56. };
  57. enum model_type {
  58. FIREDTV_UNKNOWN = 0,
  59. FIREDTV_DVB_S = 1,
  60. FIREDTV_DVB_C = 2,
  61. FIREDTV_DVB_T = 3,
  62. FIREDTV_DVB_S2 = 4,
  63. };
  64. struct device;
  65. struct input_dev;
  66. struct firedtv;
  67. struct firedtv_backend {
  68. int (*lock)(struct firedtv *fdtv, u64 addr, void *data, __be32 arg);
  69. int (*read)(struct firedtv *fdtv, u64 addr, void *data, size_t len);
  70. int (*write)(struct firedtv *fdtv, u64 addr, void *data, size_t len);
  71. int (*start_iso)(struct firedtv *fdtv);
  72. void (*stop_iso)(struct firedtv *fdtv);
  73. };
  74. struct firedtv {
  75. struct device *device;
  76. struct list_head list;
  77. struct dvb_adapter adapter;
  78. struct dmxdev dmxdev;
  79. struct dvb_demux demux;
  80. struct dmx_frontend frontend;
  81. struct dvb_net dvbnet;
  82. struct dvb_frontend fe;
  83. struct dvb_device *cadev;
  84. int ca_last_command;
  85. int ca_time_interval;
  86. struct mutex avc_mutex;
  87. wait_queue_head_t avc_wait;
  88. bool avc_reply_received;
  89. struct work_struct remote_ctrl_work;
  90. struct input_dev *remote_ctrl_dev;
  91. enum model_type type;
  92. char subunit;
  93. char isochannel;
  94. fe_sec_voltage_t voltage;
  95. fe_sec_tone_mode_t tone;
  96. const struct firedtv_backend *backend;
  97. void *backend_data;
  98. struct mutex demux_mutex;
  99. unsigned long channel_active;
  100. u16 channel_pid[16];
  101. size_t response_length;
  102. u8 response[512];
  103. };
  104. /* firedtv-1394.c */
  105. #ifdef CONFIG_DVB_FIREDTV_IEEE1394
  106. int fdtv_1394_init(struct ieee1394_device_id id_table[]);
  107. void fdtv_1394_exit(void);
  108. #else
  109. static inline int fdtv_1394_init(struct ieee1394_device_id it[]) { return 0; }
  110. static inline void fdtv_1394_exit(void) {}
  111. #endif
  112. /* firedtv-avc.c */
  113. int avc_recv(struct firedtv *fdtv, void *data, size_t length);
  114. int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat);
  115. struct dvb_frontend_parameters;
  116. int avc_tuner_dsd(struct firedtv *fdtv, struct dvb_frontend_parameters *params);
  117. int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]);
  118. int avc_tuner_get_ts(struct firedtv *fdtv);
  119. int avc_identify_subunit(struct firedtv *fdtv);
  120. struct dvb_diseqc_master_cmd;
  121. int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
  122. char conttone, char nrdiseq,
  123. struct dvb_diseqc_master_cmd *diseqcmd);
  124. void avc_remote_ctrl_work(struct work_struct *work);
  125. int avc_register_remote_control(struct firedtv *fdtv);
  126. int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
  127. int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
  128. int avc_ca_reset(struct firedtv *fdtv);
  129. int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length);
  130. int avc_ca_get_time_date(struct firedtv *fdtv, int *interval);
  131. int avc_ca_enter_menu(struct firedtv *fdtv);
  132. int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len);
  133. int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel);
  134. void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel);
  135. /* firedtv-ci.c */
  136. int fdtv_ca_register(struct firedtv *fdtv);
  137. void fdtv_ca_release(struct firedtv *fdtv);
  138. /* firedtv-dvb.c */
  139. int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed);
  140. int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
  141. int fdtv_dvb_register(struct firedtv *fdtv);
  142. void fdtv_dvb_unregister(struct firedtv *fdtv);
  143. struct firedtv *fdtv_alloc(struct device *dev,
  144. const struct firedtv_backend *backend,
  145. const char *name, size_t name_len);
  146. extern const char *fdtv_model_names[];
  147. /* firedtv-fe.c */
  148. void fdtv_frontend_init(struct firedtv *fdtv);
  149. /* firedtv-rc.c */
  150. #ifdef CONFIG_DVB_FIREDTV_INPUT
  151. int fdtv_register_rc(struct firedtv *fdtv, struct device *dev);
  152. void fdtv_unregister_rc(struct firedtv *fdtv);
  153. void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code);
  154. #else
  155. static inline int fdtv_register_rc(struct firedtv *fdtv,
  156. struct device *dev) { return 0; }
  157. static inline void fdtv_unregister_rc(struct firedtv *fdtv) {}
  158. static inline void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) {}
  159. #endif
  160. #endif /* _FIREDTV_H */