dib0090.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Linux-DVB Driver for DiBcom's DiB0090 base-band RF Tuner.
  3. *
  4. * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation, version 2.
  9. */
  10. #ifndef DIB0090_H
  11. #define DIB0090_H
  12. struct dvb_frontend;
  13. struct i2c_adapter;
  14. #define DEFAULT_DIB0090_I2C_ADDRESS 0x60
  15. struct dib0090_io_config {
  16. u32 clock_khz;
  17. u8 pll_bypass:1;
  18. u8 pll_range:1;
  19. u8 pll_prediv:6;
  20. u8 pll_loopdiv:6;
  21. u8 adc_clock_ratio; /* valid is 8, 7 ,6 */
  22. u16 pll_int_loop_filt;
  23. };
  24. struct dib0090_wbd_slope {
  25. u16 max_freq; /* for every frequency less than or equal to that field: this information is correct */
  26. u16 slope_cold;
  27. u16 offset_cold;
  28. u16 slope_hot;
  29. u16 offset_hot;
  30. u8 wbd_gain;
  31. };
  32. struct dib0090_low_if_offset_table {
  33. int std;
  34. u32 RF_freq;
  35. s32 offset_khz;
  36. };
  37. struct dib0090_config {
  38. struct dib0090_io_config io;
  39. int (*reset) (struct dvb_frontend *, int);
  40. int (*sleep) (struct dvb_frontend *, int);
  41. /* offset in kHz */
  42. int freq_offset_khz_uhf;
  43. int freq_offset_khz_vhf;
  44. int (*get_adc_power) (struct dvb_frontend *);
  45. u8 clkouttobamse:1; /* activate or deactivate clock output */
  46. u8 analog_output;
  47. u8 i2c_address;
  48. /* add drives and other things if necessary */
  49. u16 wbd_vhf_offset;
  50. u16 wbd_cband_offset;
  51. u8 use_pwm_agc;
  52. u8 clkoutdrive;
  53. u8 ls_cfg_pad_drv;
  54. u8 data_tx_drv;
  55. u8 in_soc;
  56. const struct dib0090_low_if_offset_table *low_if;
  57. u8 fref_clock_ratio;
  58. u16 force_cband_input;
  59. struct dib0090_wbd_slope *wbd;
  60. u8 is_dib7090e;
  61. u8 force_crystal_mode;
  62. };
  63. #if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0090)
  64. extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
  65. extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
  66. extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);
  67. extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe);
  68. extern u16 dib0090_get_wbd_target(struct dvb_frontend *tuner);
  69. extern u16 dib0090_get_wbd_offset(struct dvb_frontend *fe);
  70. extern int dib0090_gain_control(struct dvb_frontend *fe);
  71. extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
  72. extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
  73. extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
  74. extern void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff);
  75. extern int dib0090_set_switch(struct dvb_frontend *fe, u8 sw1, u8 sw2, u8 sw3);
  76. extern int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff);
  77. extern int dib0090_update_rframp_7090(struct dvb_frontend *fe,
  78. u8 cfg_sensitivity);
  79. extern int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
  80. u8 cfg_sensitivity);
  81. #else
  82. static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config)
  83. {
  84. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  85. return NULL;
  86. }
  87. static inline struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
  88. {
  89. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  90. return NULL;
  91. }
  92. static inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
  93. {
  94. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  95. }
  96. static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
  97. {
  98. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  99. }
  100. static inline u16 dib0090_get_wbd_target(struct dvb_frontend *tuner)
  101. {
  102. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  103. return 0;
  104. }
  105. static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *fe)
  106. {
  107. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  108. return 0;
  109. }
  110. static inline int dib0090_gain_control(struct dvb_frontend *fe)
  111. {
  112. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  113. return -ENODEV;
  114. }
  115. static inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
  116. {
  117. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  118. return CT_DONE;
  119. }
  120. static inline int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
  121. {
  122. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  123. return -ENODEV;
  124. }
  125. static inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt)
  126. {
  127. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  128. }
  129. static inline void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff)
  130. {
  131. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  132. }
  133. static inline int dib0090_set_switch(struct dvb_frontend *fe,
  134. u8 sw1, u8 sw2, u8 sw3)
  135. {
  136. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  137. return -ENODEV;
  138. }
  139. static inline int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff)
  140. {
  141. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  142. return -ENODEV;
  143. }
  144. static inline int dib0090_update_rframp_7090(struct dvb_frontend *fe,
  145. u8 cfg_sensitivity)
  146. {
  147. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  148. return -ENODEV;
  149. }
  150. static inline int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
  151. u8 cfg_sensitivity)
  152. {
  153. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  154. return -ENODEV;
  155. }
  156. #endif
  157. #endif