m88ds3103.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Montage M88DS3103 demodulator driver
  3. *
  4. * Copyright (C) 2013 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. #ifndef M88DS3103_H
  17. #define M88DS3103_H
  18. #include <linux/dvb/frontend.h>
  19. struct m88ds3103_config {
  20. /*
  21. * I2C address
  22. * Default: none, must set
  23. * 0x68, ...
  24. */
  25. u8 i2c_addr;
  26. /*
  27. * clock
  28. * Default: none, must set
  29. * 27000000
  30. */
  31. u32 clock;
  32. /*
  33. * max bytes I2C provider is asked to write at once
  34. * Default: none, must set
  35. * 33, 65, ...
  36. */
  37. u16 i2c_wr_max;
  38. /*
  39. * TS output mode
  40. * Default: M88DS3103_TS_SERIAL
  41. */
  42. #define M88DS3103_TS_SERIAL 0 /* TS output pin D0, normal */
  43. #define M88DS3103_TS_SERIAL_D7 1 /* TS output pin D7 */
  44. #define M88DS3103_TS_PARALLEL 2 /* TS Parallel mode */
  45. #define M88DS3103_TS_CI 3 /* TS CI Mode */
  46. u8 ts_mode;
  47. /*
  48. * TS clk in KHz
  49. * Default: 0.
  50. */
  51. u32 ts_clk;
  52. /*
  53. * TS clk polarity.
  54. * Default: 0. 1-active at falling edge; 0-active at rising edge.
  55. */
  56. u8 ts_clk_pol:1;
  57. /*
  58. * spectrum inversion
  59. * Default: 0
  60. */
  61. u8 spec_inv:1;
  62. /*
  63. * AGC polarity
  64. * Default: 0
  65. */
  66. u8 agc_inv:1;
  67. /*
  68. * clock output
  69. * Default: M88DS3103_CLOCK_OUT_DISABLED
  70. */
  71. #define M88DS3103_CLOCK_OUT_DISABLED 0
  72. #define M88DS3103_CLOCK_OUT_ENABLED 1
  73. #define M88DS3103_CLOCK_OUT_ENABLED_DIV2 2
  74. u8 clock_out;
  75. /*
  76. * DiSEqC envelope mode
  77. * Default: 0
  78. */
  79. u8 envelope_mode:1;
  80. /*
  81. * AGC configuration
  82. * Default: none, must set
  83. */
  84. u8 agc;
  85. /*
  86. * LNB H/V pin polarity
  87. * Default: 0.
  88. * 1: pin high set to VOLTAGE_13, pin low to set VOLTAGE_18.
  89. * 0: pin high set to VOLTAGE_18, pin low to set VOLTAGE_13.
  90. */
  91. u8 lnb_hv_pol:1;
  92. /*
  93. * LNB enable pin polarity
  94. * Default: 0.
  95. * 1: pin high to enable, pin low to disable.
  96. * 0: pin high to disable, pin low to enable.
  97. */
  98. u8 lnb_en_pol:1;
  99. };
  100. /*
  101. * Driver implements own I2C-adapter for tuner I2C access. That's since chip
  102. * has I2C-gate control which closes gate automatically after I2C transfer.
  103. * Using own I2C adapter we can workaround that.
  104. */
  105. #if defined(CONFIG_DVB_M88DS3103) || \
  106. (defined(CONFIG_DVB_M88DS3103_MODULE) && defined(MODULE))
  107. extern struct dvb_frontend *m88ds3103_attach(
  108. const struct m88ds3103_config *config,
  109. struct i2c_adapter *i2c,
  110. struct i2c_adapter **tuner_i2c);
  111. #else
  112. static inline struct dvb_frontend *m88ds3103_attach(
  113. const struct m88ds3103_config *config,
  114. struct i2c_adapter *i2c,
  115. struct i2c_adapter **tuner_i2c)
  116. {
  117. pr_warn("%s: driver disabled by Kconfig\n", __func__);
  118. return NULL;
  119. }
  120. #endif
  121. #endif