af9013.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Afatech AF9013 demodulator driver
  3. *
  4. * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
  5. * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
  6. *
  7. * Thanks to Afatech who kindly provided information.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. *
  23. */
  24. #ifndef AF9013_H
  25. #define AF9013_H
  26. #include <linux/dvb/frontend.h>
  27. /* AF9013/5 GPIOs (mostly guessed)
  28. demod#1-gpio#0 - set demod#2 i2c-addr for dual devices
  29. demod#1-gpio#1 - xtal setting (?)
  30. demod#1-gpio#3 - tuner#1
  31. demod#2-gpio#0 - tuner#2
  32. demod#2-gpio#1 - xtal setting (?)
  33. */
  34. struct af9013_config {
  35. /*
  36. * I2C address
  37. */
  38. u8 i2c_addr;
  39. /*
  40. * clock
  41. * 20480000, 25000000, 28000000, 28800000
  42. */
  43. u32 clock;
  44. /*
  45. * tuner
  46. */
  47. #define AF9013_TUNER_MXL5003D 3 /* MaxLinear */
  48. #define AF9013_TUNER_MXL5005D 13 /* MaxLinear */
  49. #define AF9013_TUNER_MXL5005R 30 /* MaxLinear */
  50. #define AF9013_TUNER_ENV77H11D5 129 /* Panasonic */
  51. #define AF9013_TUNER_MT2060 130 /* Microtune */
  52. #define AF9013_TUNER_MC44S803 133 /* Freescale */
  53. #define AF9013_TUNER_QT1010 134 /* Quantek */
  54. #define AF9013_TUNER_UNKNOWN 140 /* for can tuners ? */
  55. #define AF9013_TUNER_MT2060_2 147 /* Microtune */
  56. #define AF9013_TUNER_TDA18271 156 /* NXP */
  57. #define AF9013_TUNER_QT1010A 162 /* Quantek */
  58. #define AF9013_TUNER_MXL5007T 177 /* MaxLinear */
  59. #define AF9013_TUNER_TDA18218 179 /* NXP */
  60. u8 tuner;
  61. /*
  62. * IF frequency
  63. */
  64. u32 if_frequency;
  65. /*
  66. * TS settings
  67. */
  68. #define AF9013_TS_USB 0
  69. #define AF9013_TS_PARALLEL 1
  70. #define AF9013_TS_SERIAL 2
  71. u8 ts_mode:2;
  72. /*
  73. * input spectrum inversion
  74. */
  75. bool spec_inv;
  76. /*
  77. * firmware API version
  78. */
  79. u8 api_version[4];
  80. /*
  81. * GPIOs
  82. */
  83. #define AF9013_GPIO_ON (1 << 0)
  84. #define AF9013_GPIO_EN (1 << 1)
  85. #define AF9013_GPIO_O (1 << 2)
  86. #define AF9013_GPIO_I (1 << 3)
  87. #define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
  88. #define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
  89. #define AF9013_GPIO_TUNER_ON (AF9013_GPIO_ON|AF9013_GPIO_EN)
  90. #define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
  91. u8 gpio[4];
  92. };
  93. #if defined(CONFIG_DVB_AF9013) || \
  94. (defined(CONFIG_DVB_AF9013_MODULE) && defined(MODULE))
  95. extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
  96. struct i2c_adapter *i2c);
  97. #else
  98. static inline struct dvb_frontend *af9013_attach(
  99. const struct af9013_config *config, struct i2c_adapter *i2c)
  100. {
  101. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  102. return NULL;
  103. }
  104. #endif /* CONFIG_DVB_AF9013 */
  105. #endif /* AF9013_H */