dib0090.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
  50. extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
  51. #else
  52. static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
  53. {
  54. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  55. return NULL;
  56. }
  57. static inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
  58. {
  59. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  60. }
  61. static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
  62. {
  63. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  64. }
  65. static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner)
  66. {
  67. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  68. return 0;
  69. }
  70. static inline int dib0090_gain_control(struct dvb_frontend *fe)
  71. {
  72. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  73. return -ENODEV;
  74. }
  75. static inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
  76. {
  77. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  78. return CT_DONE;
  79. }
  80. static inline int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
  81. {
  82. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  83. return -ENODEV;
  84. }
  85. static inline num frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
  86. {
  87. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  88. return CT_SHUTDOWN,}
  89. static inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt)
  90. {
  91. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  92. }
  93. #endif
  94. #endif