stb0899_drv.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. STB0899 Multistandard Frontend driver
  3. Copyright (C) Manu Abraham (abraham.manu@gmail.com)
  4. Copyright (C) ST Microelectronics
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. #ifndef __STB0899_DRV_H
  18. #define __STB0899_DRV_H
  19. #include <linux/kernel.h>
  20. #include <linux/module.h>
  21. #include "dvb_frontend.h"
  22. #define STB0899_TSMODE_SERIAL 1
  23. #define STB0899_CLKPOL_FALLING 2
  24. #define STB0899_CLKNULL_PARITY 3
  25. #define STB0899_SYNC_FORCED 4
  26. #define STB0899_FECMODE_DSS 5
  27. struct stb0899_s1_reg {
  28. u16 address;
  29. u8 data;
  30. };
  31. struct stb0899_s2_reg {
  32. u16 offset;
  33. u32 base_address;
  34. u32 data;
  35. };
  36. enum stb0899_inversion {
  37. IQ_SWAP_OFF = 0,
  38. IQ_SWAP_ON,
  39. IQ_SWAP_AUTO
  40. };
  41. struct stb0899_config {
  42. const struct stb0899_s1_reg *init_dev;
  43. const struct stb0899_s2_reg *init_s2_demod;
  44. const struct stb0899_s1_reg *init_s1_demod;
  45. const struct stb0899_s2_reg *init_s2_fec;
  46. const struct stb0899_s1_reg *init_tst;
  47. enum stb0899_inversion inversion;
  48. u32 xtal_freq;
  49. u8 demod_address;
  50. u8 ts_output_mode;
  51. u8 block_sync_mode;
  52. u8 ts_pfbit_toggle;
  53. u8 clock_polarity;
  54. u8 data_clk_parity;
  55. u8 fec_mode;
  56. u8 data_output_ctl;
  57. u8 data_fifo_mode;
  58. u8 out_rate_comp;
  59. u8 i2c_repeater;
  60. // int inversion;
  61. u32 esno_ave;
  62. u32 esno_quant;
  63. u32 avframes_coarse;
  64. u32 avframes_fine;
  65. u32 miss_threshold;
  66. u32 uwp_threshold_acq;
  67. u32 uwp_threshold_track;
  68. u32 uwp_threshold_sof;
  69. u32 sof_search_timeout;
  70. u32 btr_nco_bits;
  71. u32 btr_gain_shift_offset;
  72. u32 crl_nco_bits;
  73. u32 ldpc_max_iter;
  74. int (*tuner_set_frequency)(struct dvb_frontend *fe, u32 frequency);
  75. int (*tuner_get_frequency)(struct dvb_frontend *fe, u32 *frequency);
  76. int (*tuner_set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth);
  77. int (*tuner_get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
  78. int (*tuner_set_rfsiggain)(struct dvb_frontend *fe, u32 rf_gain);
  79. };
  80. #if defined(CONFIG_DVB_STB0899) || (defined(CONFIG_DVB_STB0899_MODULE) && defined(MODULE))
  81. extern struct dvb_frontend *stb0899_attach(struct stb0899_config *config,
  82. struct i2c_adapter *i2c);
  83. #else
  84. static inline struct dvb_frontend *stb0899_attach(struct stb0899_config *config,
  85. struct i2c_adapter *i2c)
  86. {
  87. printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
  88. return NULL;
  89. }
  90. #endif //CONFIG_DVB_STB0899
  91. #endif