stv0299.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. Driver for ST STV0299 demodulator
  4. Copyright (C) 2001-2002 Convergence Integrated Media GmbH
  5. <ralph@convergence.de>,
  6. <holger@convergence.de>,
  7. <js@convergence.de>
  8. Philips SU1278/SH
  9. Copyright (C) 2002 by Peter Schildmann <peter.schildmann@web.de>
  10. LG TDQF-S001F
  11. Copyright (C) 2002 Felix Domke <tmbinc@elitedvb.net>
  12. & Andreas Oberritter <obi@linuxtv.org>
  13. Support for Samsung TBMU24112IMB used on Technisat SkyStar2 rev. 2.6B
  14. Copyright (C) 2003 Vadim Catana <skystar@moldova.cc>:
  15. Support for Philips SU1278 on Technotrend hardware
  16. Copyright (C) 2004 Andrew de Quincey <adq_dvb@lidskialf.net>
  17. */
  18. #ifndef STV0299_H
  19. #define STV0299_H
  20. #include <linux/dvb/frontend.h>
  21. #include <media/dvb_frontend.h>
  22. #define STV0299_LOCKOUTPUT_0 0
  23. #define STV0299_LOCKOUTPUT_1 1
  24. #define STV0299_LOCKOUTPUT_CF 2
  25. #define STV0299_LOCKOUTPUT_LK 3
  26. #define STV0299_VOLT13_OP0 0
  27. #define STV0299_VOLT13_OP1 1
  28. struct stv0299_config
  29. {
  30. /* the demodulator's i2c address */
  31. u8 demod_address;
  32. /* inittab - array of pairs of values.
  33. * First of each pair is the register, second is the value.
  34. * List should be terminated with an 0xff, 0xff pair.
  35. */
  36. const u8* inittab;
  37. /* master clock to use */
  38. u32 mclk;
  39. /* does the inversion require inversion? */
  40. u8 invert:1;
  41. /* Skip reinitialisation? */
  42. u8 skip_reinit:1;
  43. /* LOCK OUTPUT setting */
  44. u8 lock_output:2;
  45. /* Is 13v controlled by OP0 or OP1? */
  46. u8 volt13_op0_op1:1;
  47. /* Turn-off OP0? */
  48. u8 op0_off:1;
  49. /* minimum delay before retuning */
  50. int min_delay_ms;
  51. /* Set the symbol rate */
  52. int (*set_symbol_rate)(struct dvb_frontend *fe, u32 srate, u32 ratio);
  53. /* Set device param to start dma */
  54. int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
  55. };
  56. #if IS_REACHABLE(CONFIG_DVB_STV0299)
  57. extern struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
  58. struct i2c_adapter *i2c);
  59. #else
  60. static inline struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
  61. struct i2c_adapter *i2c)
  62. {
  63. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  64. return NULL;
  65. }
  66. #endif // CONFIG_DVB_STV0299
  67. static inline int stv0299_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
  68. int r = 0;
  69. u8 buf[] = {reg, val};
  70. if (fe->ops.write)
  71. r = fe->ops.write(fe, buf, 2);
  72. return r;
  73. }
  74. #endif // STV0299_H