firedtv.h 5.1 KB

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