m88ds3103.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 /* 24 MHz, normal */
  45. #define M88DS3103_TS_PARALLEL_12 3 /* 12 MHz */
  46. #define M88DS3103_TS_PARALLEL_16 4 /* 16 MHz */
  47. #define M88DS3103_TS_PARALLEL_19_2 5 /* 19.2 MHz */
  48. #define M88DS3103_TS_CI 6 /* 6 MHz */
  49. u8 ts_mode;
  50. /*
  51. * spectrum inversion
  52. * Default: 0
  53. */
  54. u8 spec_inv:1;
  55. /*
  56. * AGC polarity
  57. * Default: 0
  58. */
  59. u8 agc_inv:1;
  60. /*
  61. * clock output
  62. * Default: M88DS3103_CLOCK_OUT_DISABLED
  63. */
  64. #define M88DS3103_CLOCK_OUT_DISABLED 0
  65. #define M88DS3103_CLOCK_OUT_ENABLED 1
  66. #define M88DS3103_CLOCK_OUT_ENABLED_DIV2 2
  67. u8 clock_out;
  68. /*
  69. * DiSEqC envelope mode
  70. * Default: 0
  71. */
  72. u8 envelope_mode:1;
  73. /*
  74. * AGC configuration
  75. * Default: none, must set
  76. */
  77. u8 agc;
  78. };
  79. /*
  80. * Driver implements own I2C-adapter for tuner I2C access. That's since chip
  81. * has I2C-gate control which closes gate automatically after I2C transfer.
  82. * Using own I2C adapter we can workaround that.
  83. */
  84. #if defined(CONFIG_DVB_M88DS3103) || \
  85. (defined(CONFIG_DVB_M88DS3103_MODULE) && defined(MODULE))
  86. extern struct dvb_frontend *m88ds3103_attach(
  87. const struct m88ds3103_config *config,
  88. struct i2c_adapter *i2c,
  89. struct i2c_adapter **tuner_i2c);
  90. #else
  91. static inline struct dvb_frontend *m88ds3103_attach(
  92. const struct m88ds3103_config *config,
  93. struct i2c_adapter *i2c,
  94. struct i2c_adapter **tuner_i2c)
  95. {
  96. pr_warn("%s: driver disabled by Kconfig\n", __func__);
  97. return NULL;
  98. }
  99. #endif
  100. #endif