dib0090.h 5.3 KB

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