dib8000.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. #ifndef DIB8000_H
  2. #define DIB8000_H
  3. #include "dibx000_common.h"
  4. struct dib8000_config {
  5. u8 output_mpeg2_in_188_bytes;
  6. u8 hostbus_diversity;
  7. u8 tuner_is_baseband;
  8. int (*update_lna) (struct dvb_frontend *, u16 agc_global);
  9. u8 agc_config_count;
  10. struct dibx000_agc_config *agc;
  11. struct dibx000_bandwidth_config *pll;
  12. #define DIB8000_GPIO_DEFAULT_DIRECTIONS 0xffff
  13. u16 gpio_dir;
  14. #define DIB8000_GPIO_DEFAULT_VALUES 0x0000
  15. u16 gpio_val;
  16. #define DIB8000_GPIO_PWM_POS0(v) ((v & 0xf) << 12)
  17. #define DIB8000_GPIO_PWM_POS1(v) ((v & 0xf) << 8 )
  18. #define DIB8000_GPIO_PWM_POS2(v) ((v & 0xf) << 4 )
  19. #define DIB8000_GPIO_PWM_POS3(v) (v & 0xf)
  20. #define DIB8000_GPIO_DEFAULT_PWM_POS 0xffff
  21. u16 gpio_pwm_pos;
  22. u16 pwm_freq_div;
  23. void (*agc_control) (struct dvb_frontend *, u8 before);
  24. u16 drives;
  25. u16 diversity_delay;
  26. u8 div_cfg;
  27. u8 output_mode;
  28. u8 refclksel;
  29. u8 enMpegOutput:1;
  30. struct dibx000_bandwidth_config *plltable;
  31. };
  32. #define DEFAULT_DIB8000_I2C_ADDRESS 18
  33. #if IS_ENABLED(CONFIG_DVB_DIB8000)
  34. extern struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg);
  35. extern struct i2c_adapter *dib8000_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int);
  36. extern int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods,
  37. u8 default_addr, u8 first_addr, u8 is_dib8096p);
  38. extern int dib8000_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val);
  39. extern int dib8000_set_wbd_ref(struct dvb_frontend *, u16 value);
  40. extern int dib8000_pid_filter_ctrl(struct dvb_frontend *, u8 onoff);
  41. extern int dib8000_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff);
  42. extern int dib8000_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
  43. extern enum frontend_tune_state dib8000_get_tune_state(struct dvb_frontend *fe);
  44. extern void dib8000_pwm_agc_reset(struct dvb_frontend *fe);
  45. extern s32 dib8000_get_adc_power(struct dvb_frontend *fe, u8 mode);
  46. extern struct i2c_adapter *dib8096p_get_i2c_tuner(struct dvb_frontend *fe);
  47. extern int dib8096p_tuner_sleep(struct dvb_frontend *fe, int onoff);
  48. extern int dib8090p_get_dc_power(struct dvb_frontend *fe, u8 IQ);
  49. extern u32 dib8000_ctrl_timf(struct dvb_frontend *fe,
  50. uint8_t op, uint32_t timf);
  51. extern int dib8000_update_pll(struct dvb_frontend *fe,
  52. struct dibx000_bandwidth_config *pll, u32 bw, u8 ratio);
  53. extern int dib8000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave);
  54. extern int dib8000_remove_slave_frontend(struct dvb_frontend *fe);
  55. extern struct dvb_frontend *dib8000_get_slave_frontend(struct dvb_frontend *fe, int slave_index);
  56. #else
  57. static inline struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg)
  58. {
  59. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  60. return NULL;
  61. }
  62. static inline struct i2c_adapter *dib8000_get_i2c_master(struct dvb_frontend *fe, enum dibx000_i2c_interface i, int x)
  63. {
  64. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  65. return NULL;
  66. }
  67. static inline int dib8000_i2c_enumeration(struct i2c_adapter *host,
  68. int no_of_demods, u8 default_addr, u8 first_addr,
  69. u8 is_dib8096p)
  70. {
  71. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  72. return -ENODEV;
  73. }
  74. static inline int dib8000_set_gpio(struct dvb_frontend *fe, u8 num, u8 dir, u8 val)
  75. {
  76. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  77. return -ENODEV;
  78. }
  79. static inline int dib8000_set_wbd_ref(struct dvb_frontend *fe, u16 value)
  80. {
  81. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  82. return -ENODEV;
  83. }
  84. static inline int dib8000_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
  85. {
  86. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  87. return -ENODEV;
  88. }
  89. static inline int dib8000_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
  90. {
  91. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  92. return -ENODEV;
  93. }
  94. static inline int dib8000_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
  95. {
  96. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  97. return -ENODEV;
  98. }
  99. static inline enum frontend_tune_state dib8000_get_tune_state(struct dvb_frontend *fe)
  100. {
  101. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  102. return CT_SHUTDOWN;
  103. }
  104. static inline void dib8000_pwm_agc_reset(struct dvb_frontend *fe)
  105. {
  106. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  107. }
  108. static inline struct i2c_adapter *dib8096p_get_i2c_tuner(struct dvb_frontend *fe)
  109. {
  110. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  111. return NULL;
  112. }
  113. static inline int dib8096p_tuner_sleep(struct dvb_frontend *fe, int onoff)
  114. {
  115. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  116. return 0;
  117. }
  118. static inline s32 dib8000_get_adc_power(struct dvb_frontend *fe, u8 mode)
  119. {
  120. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  121. return 0;
  122. }
  123. static inline int dib8090p_get_dc_power(struct dvb_frontend *fe, u8 IQ)
  124. {
  125. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  126. return 0;
  127. }
  128. static inline u32 dib8000_ctrl_timf(struct dvb_frontend *fe,
  129. uint8_t op, uint32_t timf)
  130. {
  131. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  132. return 0;
  133. }
  134. static inline int dib8000_update_pll(struct dvb_frontend *fe,
  135. struct dibx000_bandwidth_config *pll, u32 bw, u8 ratio)
  136. {
  137. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  138. return -ENODEV;
  139. }
  140. static inline int dib8000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave)
  141. {
  142. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  143. return -ENODEV;
  144. }
  145. int dib8000_remove_slave_frontend(struct dvb_frontend *fe)
  146. {
  147. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  148. return -ENODEV;
  149. }
  150. static inline struct dvb_frontend *dib8000_get_slave_frontend(struct dvb_frontend *fe, int slave_index)
  151. {
  152. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  153. return NULL;
  154. }
  155. #endif
  156. #endif