drx397xD.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * Driver for Micronas DVB-T drx397xD demodulator
  3. *
  4. * Copyright (C) 2007 Henk vergonet <Henk.Vergonet@gmail.com>
  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. *
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
  20. */
  21. #ifndef _DRX397XD_H_INCLUDED
  22. #define _DRX397XD_H_INCLUDED
  23. #include <linux/dvb/frontend.h>
  24. #define DRX_F_STEPSIZE 166667
  25. #define DRX_F_OFFSET 36000000
  26. #define I2C_ADR_C0(x) \
  27. ( cpu_to_le32( \
  28. (u32)( \
  29. (((u32)(x) & (u32)0x000000ffUL) ) | \
  30. (((u32)(x) & (u32)0x0000ff00UL) << 16) | \
  31. (((u32)(x) & (u32)0x0fff0000UL) >> 8) | \
  32. ( (u32)0x00c00000UL) \
  33. )) \
  34. )
  35. #define I2C_ADR_E0(x) \
  36. ( cpu_to_le32( \
  37. (u32)( \
  38. (((u32)(x) & (u32)0x000000ffUL) ) | \
  39. (((u32)(x) & (u32)0x0000ff00UL) << 16) | \
  40. (((u32)(x) & (u32)0x0fff0000UL) >> 8) | \
  41. ( (u32)0x00e00000UL) \
  42. )) \
  43. )
  44. struct drx397xD_CfgRfAgc /* 0x7c */
  45. {
  46. int d00; /* 2 */
  47. u16 w04;
  48. u16 w06;
  49. };
  50. struct drx397xD_CfgIfAgc /* 0x68 */
  51. {
  52. int d00; /* 0 */
  53. u16 w04; /* 0 */
  54. u16 w06;
  55. u16 w08;
  56. u16 w0A;
  57. u16 w0C;
  58. };
  59. struct drx397xD_s20 {
  60. int d04;
  61. u32 d18;
  62. u32 d1C;
  63. u32 d20;
  64. u32 d14;
  65. u32 d24;
  66. u32 d0C;
  67. u32 d08;
  68. };
  69. struct drx397xD_config
  70. {
  71. /* demodulator's I2C address */
  72. u8 demod_address; /* 0x0f */
  73. struct drx397xD_CfgIfAgc ifagc; /* 0x68 */
  74. struct drx397xD_CfgRfAgc rfagc; /* 0x7c */
  75. u32 s20d24;
  76. /* HI_CfgCommand parameters */
  77. u16 w50, w52, /* w54, */ w56;
  78. int d5C;
  79. int d60;
  80. int d48;
  81. int d28;
  82. u32 f_if; /* d14: intermediate frequency [Hz] */
  83. /* 36000000 on Cinergy 2400i DT */
  84. /* 42800000 on Pinnacle Hybrid PRO 330e */
  85. u16 f_osc; /* s66: 48000 oscillator frequency [kHz] */
  86. u16 w92; /* 20000 */
  87. u16 wA0;
  88. u16 w98;
  89. u16 w9A;
  90. u16 w9C; /* 0xe0 */
  91. u16 w9E; /* 0x00 */
  92. /* used for signal strength calculations in
  93. drx397x_read_signal_strength
  94. */
  95. u16 ss78; // 2200
  96. u16 ss7A; // 150
  97. u16 ss76; // 820
  98. };
  99. #if defined(CONFIG_DVB_DRX397XD) || (defined(CONFIG_DVB_DRX397XD_MODULE) && defined(MODULE))
  100. extern struct dvb_frontend* drx397xD_attach(const struct drx397xD_config *config,
  101. struct i2c_adapter *i2c);
  102. #else
  103. static inline struct dvb_frontend* drx397xD_attach(const struct drx397xD_config *config,
  104. struct i2c_adapter *i2c)
  105. {
  106. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  107. return NULL;
  108. }
  109. #endif /* CONFIG_DVB_DRX397XD */
  110. #endif /* _DRX397XD_H_INCLUDED */