cxd2820r.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Sony CXD2820R demodulator driver
  3. *
  4. * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. */
  20. #ifndef CXD2820R_H
  21. #define CXD2820R_H
  22. #include <linux/dvb/frontend.h>
  23. #define CXD2820R_GPIO_D (0 << 0) /* disable */
  24. #define CXD2820R_GPIO_E (1 << 0) /* enable */
  25. #define CXD2820R_GPIO_O (0 << 1) /* output */
  26. #define CXD2820R_GPIO_I (1 << 1) /* input */
  27. #define CXD2820R_GPIO_L (0 << 2) /* output low */
  28. #define CXD2820R_GPIO_H (1 << 2) /* output high */
  29. #define CXD2820R_TS_SERIAL 0x08
  30. #define CXD2820R_TS_SERIAL_MSB 0x28
  31. #define CXD2820R_TS_PARALLEL 0x30
  32. #define CXD2820R_TS_PARALLEL_MSB 0x70
  33. struct cxd2820r_config {
  34. /* Demodulator I2C address.
  35. * Driver determines DVB-C slave I2C address automatically from master
  36. * address.
  37. * Default: none, must set
  38. * Values: 0x6c, 0x6d
  39. */
  40. u8 i2c_address;
  41. /* TS output mode.
  42. * Default: none, must set.
  43. * Values:
  44. */
  45. u8 ts_mode;
  46. /* IF AGC polarity.
  47. * Default: 0
  48. * Values: 0, 1
  49. */
  50. int if_agc_polarity:1;
  51. /* Spectrum inversion.
  52. * Default: 0
  53. * Values: 0, 1
  54. */
  55. int spec_inv:1;
  56. /* IFs for all used modes.
  57. * Default: none, must set
  58. * Values: <kHz>
  59. */
  60. u16 if_dvbt_6;
  61. u16 if_dvbt_7;
  62. u16 if_dvbt_8;
  63. u16 if_dvbt2_5;
  64. u16 if_dvbt2_6;
  65. u16 if_dvbt2_7;
  66. u16 if_dvbt2_8;
  67. u16 if_dvbc;
  68. /* GPIOs for all used modes.
  69. * Default: none, disabled
  70. * Values: <see above>
  71. */
  72. u8 gpio_dvbt[3];
  73. u8 gpio_dvbt2[3];
  74. u8 gpio_dvbc[3];
  75. };
  76. #if defined(CONFIG_DVB_CXD2820R) || \
  77. (defined(CONFIG_DVB_CXD2820R_MODULE) && defined(MODULE))
  78. extern struct dvb_frontend *cxd2820r_attach(
  79. const struct cxd2820r_config *config,
  80. struct i2c_adapter *i2c,
  81. struct dvb_frontend *fe
  82. );
  83. extern struct i2c_adapter *cxd2820r_get_tuner_i2c_adapter(
  84. struct dvb_frontend *fe
  85. );
  86. #else
  87. static inline struct dvb_frontend *cxd2820r_attach(
  88. const struct cxd2820r_config *config,
  89. struct i2c_adapter *i2c,
  90. struct dvb_frontend *fe
  91. )
  92. {
  93. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  94. return NULL;
  95. }
  96. static inline struct i2c_adapter *cxd2820r_get_tuner_i2c_adapter(
  97. struct dvb_frontend *fe
  98. )
  99. {
  100. return NULL;
  101. }
  102. #endif
  103. #endif /* CXD2820R_H */