dib8000.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. };
  30. #define DEFAULT_DIB8000_I2C_ADDRESS 18
  31. #if defined(CONFIG_DVB_DIB8000) || (defined(CONFIG_DVB_DIB8000_MODULE) && defined(MODULE))
  32. extern struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg);
  33. extern struct i2c_adapter *dib8000_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int);
  34. extern int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr);
  35. extern int dib8000_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val);
  36. extern int dib8000_set_wbd_ref(struct dvb_frontend *, u16 value);
  37. extern int dib8000_pid_filter_ctrl(struct dvb_frontend *, u8 onoff);
  38. extern int dib8000_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff);
  39. extern int dib8000_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
  40. extern enum frontend_tune_state dib8000_get_tune_state(struct dvb_frontend *fe);
  41. extern void dib8000_pwm_agc_reset(struct dvb_frontend *fe);
  42. extern s32 dib8000_get_adc_power(struct dvb_frontend *fe, u8 mode);
  43. #else
  44. static inline struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg)
  45. {
  46. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  47. return NULL;
  48. }
  49. static inline struct i2c_adapter *dib8000_get_i2c_master(struct dvb_frontend *fe, enum dibx000_i2c_interface i, int x)
  50. {
  51. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  52. return NULL;
  53. }
  54. static inline int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr)
  55. {
  56. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  57. return -ENODEV;
  58. }
  59. static inline int dib8000_set_gpio(struct dvb_frontend *fe, u8 num, u8 dir, u8 val)
  60. {
  61. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  62. return -ENODEV;
  63. }
  64. static inline int dib8000_set_wbd_ref(struct dvb_frontend *fe, u16 value)
  65. {
  66. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  67. return -ENODEV;
  68. }
  69. static inline int dib8000_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
  70. {
  71. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  72. return -ENODEV;
  73. }
  74. static inline int dib8000_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
  75. {
  76. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  77. return -ENODEV;
  78. }
  79. static inline int dib8000_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
  80. {
  81. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  82. return -ENODEV;
  83. }
  84. static inline enum frontend_tune_state dib8000_get_tune_state(struct dvb_frontend *fe)
  85. {
  86. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  87. return CT_SHUTDOWN,
  88. }
  89. static inline void dib8000_pwm_agc_reset(struct dvb_frontend *fe)
  90. {
  91. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  92. }
  93. static inline s32 dib8000_get_adc_power(struct dvb_frontend *fe, u8 mode)
  94. {
  95. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  96. }
  97. #endif
  98. #endif