firedtv.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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 fdtv_ir_context;
  68. struct firedtv {
  69. struct device *device;
  70. struct list_head list;
  71. struct dvb_adapter adapter;
  72. struct dmxdev dmxdev;
  73. struct dvb_demux demux;
  74. struct dmx_frontend frontend;
  75. struct dvb_net dvbnet;
  76. struct dvb_frontend fe;
  77. struct dvb_device *cadev;
  78. int ca_last_command;
  79. int ca_time_interval;
  80. struct mutex avc_mutex;
  81. wait_queue_head_t avc_wait;
  82. bool avc_reply_received;
  83. struct work_struct remote_ctrl_work;
  84. struct input_dev *remote_ctrl_dev;
  85. enum model_type type;
  86. char subunit;
  87. char isochannel;
  88. struct fdtv_ir_context *ir_context;
  89. fe_sec_voltage_t voltage;
  90. fe_sec_tone_mode_t tone;
  91. struct mutex demux_mutex;
  92. unsigned long channel_active;
  93. u16 channel_pid[16];
  94. int avc_data_length;
  95. u8 avc_data[512];
  96. };
  97. /* firedtv-avc.c */
  98. int avc_recv(struct firedtv *fdtv, void *data, size_t length);
  99. int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat);
  100. struct dvb_frontend_parameters;
  101. int avc_tuner_dsd(struct firedtv *fdtv, struct dvb_frontend_parameters *params);
  102. int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]);
  103. int avc_tuner_get_ts(struct firedtv *fdtv);
  104. int avc_identify_subunit(struct firedtv *fdtv);
  105. struct dvb_diseqc_master_cmd;
  106. int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
  107. char conttone, char nrdiseq,
  108. struct dvb_diseqc_master_cmd *diseqcmd);
  109. void avc_remote_ctrl_work(struct work_struct *work);
  110. int avc_register_remote_control(struct firedtv *fdtv);
  111. int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
  112. int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
  113. int avc_ca_reset(struct firedtv *fdtv);
  114. int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length);
  115. int avc_ca_get_time_date(struct firedtv *fdtv, int *interval);
  116. int avc_ca_enter_menu(struct firedtv *fdtv);
  117. int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len);
  118. int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel);
  119. void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel);
  120. /* firedtv-ci.c */
  121. int fdtv_ca_register(struct firedtv *fdtv);
  122. void fdtv_ca_release(struct firedtv *fdtv);
  123. /* firedtv-dvb.c */
  124. int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed);
  125. int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
  126. int fdtv_dvb_register(struct firedtv *fdtv, const char *name);
  127. void fdtv_dvb_unregister(struct firedtv *fdtv);
  128. /* firedtv-fe.c */
  129. void fdtv_frontend_init(struct firedtv *fdtv, const char *name);
  130. /* firedtv-fw.c */
  131. int fdtv_lock(struct firedtv *fdtv, u64 addr, void *data);
  132. int fdtv_read(struct firedtv *fdtv, u64 addr, void *data);
  133. int fdtv_write(struct firedtv *fdtv, u64 addr, void *data, size_t len);
  134. int fdtv_start_iso(struct firedtv *fdtv);
  135. void fdtv_stop_iso(struct firedtv *fdtv);
  136. /* firedtv-rc.c */
  137. #ifdef CONFIG_DVB_FIREDTV_INPUT
  138. int fdtv_register_rc(struct firedtv *fdtv, struct device *dev);
  139. void fdtv_unregister_rc(struct firedtv *fdtv);
  140. void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code);
  141. #else
  142. static inline int fdtv_register_rc(struct firedtv *fdtv,
  143. struct device *dev) { return 0; }
  144. static inline void fdtv_unregister_rc(struct firedtv *fdtv) {}
  145. static inline void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) {}
  146. #endif
  147. #endif /* _FIREDTV_H */