dib0090.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. };
  61. #if defined(CONFIG_DVB_TUNER_DIB0090) || (defined(CONFIG_DVB_TUNER_DIB0090_MODULE) && defined(MODULE))
  62. extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
  63. extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
  64. extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);
  65. extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe);
  66. extern u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner);
  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. #else
  72. static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
  73. {
  74. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  75. return NULL;
  76. }
  77. static inline struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
  78. {
  79. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  80. return NULL;
  81. }
  82. static inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
  83. {
  84. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  85. }
  86. static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
  87. {
  88. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  89. }
  90. static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner)
  91. {
  92. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  93. return 0;
  94. }
  95. static inline int dib0090_gain_control(struct dvb_frontend *fe)
  96. {
  97. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  98. return -ENODEV;
  99. }
  100. static inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
  101. {
  102. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  103. return CT_DONE;
  104. }
  105. static inline int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
  106. {
  107. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  108. return -ENODEV;
  109. }
  110. static inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt)
  111. {
  112. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  113. }
  114. #endif
  115. #endif