dib0090.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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_config {
  25. struct dib0090_io_config io;
  26. int (*reset) (struct dvb_frontend *, int);
  27. int (*sleep) (struct dvb_frontend *, int);
  28. /* offset in kHz */
  29. int freq_offset_khz_uhf;
  30. int freq_offset_khz_vhf;
  31. int (*get_adc_power) (struct dvb_frontend *);
  32. u8 clkouttobamse:1; /* activate or deactivate clock output */
  33. u8 analog_output;
  34. u8 i2c_address;
  35. /* add drives and other things if necessary */
  36. u16 wbd_vhf_offset;
  37. u16 wbd_cband_offset;
  38. u8 use_pwm_agc;
  39. u8 clkoutdrive;
  40. };
  41. #if defined(CONFIG_DVB_TUNER_DIB0090) || (defined(CONFIG_DVB_TUNER_DIB0090_MODULE) && defined(MODULE))
  42. extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
  43. extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);
  44. extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe);
  45. extern u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner);
  46. extern int dib0090_gain_control(struct dvb_frontend *fe);
  47. extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
  48. extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
  49. extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
  50. #else
  51. static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
  52. {
  53. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  54. return NULL;
  55. }
  56. static inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
  57. {
  58. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  59. }
  60. static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
  61. {
  62. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  63. }
  64. static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner)
  65. {
  66. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  67. return 0;
  68. }
  69. static inline int dib0090_gain_control(struct dvb_frontend *fe)
  70. {
  71. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  72. return -ENODEV;
  73. }
  74. static inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
  75. {
  76. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  77. return CT_DONE;
  78. }
  79. static inline int dib0090_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 void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt)
  85. {
  86. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  87. }
  88. #endif
  89. #endif