i2c-parport.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* ------------------------------------------------------------------------ *
  2. * i2c-parport.h I2C bus over parallel port *
  3. * ------------------------------------------------------------------------ *
  4. Copyright (C) 2003-2004 Jean Delvare <khali@linux-fr.org>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. * ------------------------------------------------------------------------ */
  17. #ifdef DATA
  18. #undef DATA
  19. #endif
  20. #define DATA 0
  21. #define STAT 1
  22. #define CTRL 2
  23. struct lineop {
  24. u8 val;
  25. u8 port;
  26. u8 inverted;
  27. };
  28. struct adapter_parm {
  29. struct lineop setsda;
  30. struct lineop setscl;
  31. struct lineop getsda;
  32. struct lineop getscl;
  33. struct lineop init;
  34. };
  35. static struct adapter_parm adapter_parm[] = {
  36. /* type 0: Philips adapter */
  37. {
  38. .setsda = { 0x80, DATA, 1 },
  39. .setscl = { 0x08, CTRL, 0 },
  40. .getsda = { 0x80, STAT, 0 },
  41. .getscl = { 0x08, STAT, 0 },
  42. },
  43. /* type 1: home brew teletext adapter */
  44. {
  45. .setsda = { 0x02, DATA, 0 },
  46. .setscl = { 0x01, DATA, 0 },
  47. .getsda = { 0x80, STAT, 1 },
  48. },
  49. /* type 2: Velleman K8000 adapter */
  50. {
  51. .setsda = { 0x02, CTRL, 1 },
  52. .setscl = { 0x08, CTRL, 1 },
  53. .getsda = { 0x10, STAT, 0 },
  54. },
  55. /* type 3: ELV adapter */
  56. {
  57. .setsda = { 0x02, DATA, 1 },
  58. .setscl = { 0x01, DATA, 1 },
  59. .getsda = { 0x40, STAT, 1 },
  60. .getscl = { 0x08, STAT, 1 },
  61. },
  62. /* type 4: ADM1032 evaluation board */
  63. {
  64. .setsda = { 0x02, DATA, 1 },
  65. .setscl = { 0x01, DATA, 1 },
  66. .getsda = { 0x10, STAT, 1 },
  67. .init = { 0xf0, DATA, 0 },
  68. },
  69. /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */
  70. {
  71. .setsda = { 0x02, DATA, 1 },
  72. .setscl = { 0x01, DATA, 1 },
  73. .getsda = { 0x10, STAT, 1 },
  74. },
  75. /* type 6: Barco LPT->DVI (K5800236) adapter */
  76. {
  77. .setsda = { 0x02, DATA, 1 },
  78. .setscl = { 0x01, DATA, 1 },
  79. .getsda = { 0x20, STAT, 0 },
  80. .getscl = { 0x40, STAT, 0 },
  81. .init = { 0xfc, DATA, 0 },
  82. },
  83. /* type 7: One For All JP1 parallel port adapter */
  84. {
  85. .setsda = { 0x01, DATA, 0 },
  86. .setscl = { 0x02, DATA, 0 },
  87. .getsda = { 0x80, STAT, 1 },
  88. .init = { 0x04, DATA, 1 },
  89. },
  90. };
  91. static int type = -1;
  92. module_param(type, int, 0);
  93. MODULE_PARM_DESC(type,
  94. "Type of adapter:\n"
  95. " 0 = Philips adapter\n"
  96. " 1 = home brew teletext adapter\n"
  97. " 2 = Velleman K8000 adapter\n"
  98. " 3 = ELV adapter\n"
  99. " 4 = ADM1032 evaluation board\n"
  100. " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"
  101. " 6 = Barco LPT->DVI (K5800236) adapter\n"
  102. " 7 = One For All JP1 parallel port adapter\n"
  103. );