stv0299.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. Driver for ST STV0299 demodulator
  3. Copyright (C) 2001-2002 Convergence Integrated Media GmbH
  4. <ralph@convergence.de>,
  5. <holger@convergence.de>,
  6. <js@convergence.de>
  7. Philips SU1278/SH
  8. Copyright (C) 2002 by Peter Schildmann <peter.schildmann@web.de>
  9. LG TDQF-S001F
  10. Copyright (C) 2002 Felix Domke <tmbinc@elitedvb.net>
  11. & Andreas Oberritter <obi@linuxtv.org>
  12. Support for Samsung TBMU24112IMB used on Technisat SkyStar2 rev. 2.6B
  13. Copyright (C) 2003 Vadim Catana <skystar@moldova.cc>:
  14. Support for Philips SU1278 on Technotrend hardware
  15. Copyright (C) 2004 Andrew de Quincey <adq_dvb@lidskialf.net>
  16. This program is free software; you can redistribute it and/or modify
  17. it under the terms of the GNU General Public License as published by
  18. the Free Software Foundation; either version 2 of the License, or
  19. (at your option) any later version.
  20. This program is distributed in the hope that it will be useful,
  21. but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. GNU General Public License for more details.
  24. You should have received a copy of the GNU General Public License
  25. along with this program; if not, write to the Free Software
  26. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27. */
  28. #ifndef STV0299_H
  29. #define STV0299_H
  30. #include <linux/dvb/frontend.h>
  31. #include "dvb_frontend.h"
  32. #define STV0299_LOCKOUTPUT_0 0
  33. #define STV0299_LOCKOUTPUT_1 1
  34. #define STV0299_LOCKOUTPUT_CF 2
  35. #define STV0299_LOCKOUTPUT_LK 3
  36. #define STV0299_VOLT13_OP0 0
  37. #define STV0299_VOLT13_OP1 1
  38. struct stv0299_config
  39. {
  40. /* the demodulator's i2c address */
  41. u8 demod_address;
  42. /* inittab - array of pairs of values.
  43. * First of each pair is the register, second is the value.
  44. * List should be terminated with an 0xff, 0xff pair.
  45. */
  46. const u8* inittab;
  47. /* master clock to use */
  48. u32 mclk;
  49. /* does the inversion require inversion? */
  50. u8 invert:1;
  51. /* Skip reinitialisation? */
  52. u8 skip_reinit:1;
  53. /* LOCK OUTPUT setting */
  54. u8 lock_output:2;
  55. /* Is 13v controlled by OP0 or OP1? */
  56. u8 volt13_op0_op1:1;
  57. /* Turn-off OP0? */
  58. u8 op0_off:1;
  59. /* minimum delay before retuning */
  60. int min_delay_ms;
  61. /* Set the symbol rate */
  62. int (*set_symbol_rate)(struct dvb_frontend *fe, u32 srate, u32 ratio);
  63. /* Set device param to start dma */
  64. int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
  65. };
  66. #if IS_REACHABLE(CONFIG_DVB_STV0299)
  67. extern struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
  68. struct i2c_adapter *i2c);
  69. #else
  70. static inline struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
  71. struct i2c_adapter *i2c)
  72. {
  73. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  74. return NULL;
  75. }
  76. #endif // CONFIG_DVB_STV0299
  77. static inline int stv0299_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
  78. int r = 0;
  79. u8 buf[] = {reg, val};
  80. if (fe->ops.write)
  81. r = fe->ops.write(fe, buf, 2);
  82. return r;
  83. }
  84. #endif // STV0299_H