i2c-parport.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* ------------------------------------------------------------------------ *
  2. * i2c-parport.h I2C bus over parallel port *
  3. * ------------------------------------------------------------------------ *
  4. Copyright (C) 2003-2010 Jean Delvare <jdelvare@suse.de>
  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. * ------------------------------------------------------------------------ */
  14. #define PORT_DATA 0
  15. #define PORT_STAT 1
  16. #define PORT_CTRL 2
  17. struct lineop {
  18. u8 val;
  19. u8 port;
  20. u8 inverted;
  21. };
  22. struct adapter_parm {
  23. struct lineop setsda;
  24. struct lineop setscl;
  25. struct lineop getsda;
  26. struct lineop getscl;
  27. struct lineop init;
  28. unsigned int smbus_alert:1;
  29. };
  30. static const struct adapter_parm adapter_parm[] = {
  31. /* type 0: Philips adapter */
  32. {
  33. .setsda = { 0x80, PORT_DATA, 1 },
  34. .setscl = { 0x08, PORT_CTRL, 0 },
  35. .getsda = { 0x80, PORT_STAT, 0 },
  36. .getscl = { 0x08, PORT_STAT, 0 },
  37. },
  38. /* type 1: home brew teletext adapter */
  39. {
  40. .setsda = { 0x02, PORT_DATA, 0 },
  41. .setscl = { 0x01, PORT_DATA, 0 },
  42. .getsda = { 0x80, PORT_STAT, 1 },
  43. },
  44. /* type 2: Velleman K8000 adapter */
  45. {
  46. .setsda = { 0x02, PORT_CTRL, 1 },
  47. .setscl = { 0x08, PORT_CTRL, 1 },
  48. .getsda = { 0x10, PORT_STAT, 0 },
  49. },
  50. /* type 3: ELV adapter */
  51. {
  52. .setsda = { 0x02, PORT_DATA, 1 },
  53. .setscl = { 0x01, PORT_DATA, 1 },
  54. .getsda = { 0x40, PORT_STAT, 1 },
  55. .getscl = { 0x08, PORT_STAT, 1 },
  56. },
  57. /* type 4: ADM1032 evaluation board */
  58. {
  59. .setsda = { 0x02, PORT_DATA, 1 },
  60. .setscl = { 0x01, PORT_DATA, 1 },
  61. .getsda = { 0x10, PORT_STAT, 1 },
  62. .init = { 0xf0, PORT_DATA, 0 },
  63. .smbus_alert = 1,
  64. },
  65. /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */
  66. {
  67. .setsda = { 0x02, PORT_DATA, 1 },
  68. .setscl = { 0x01, PORT_DATA, 1 },
  69. .getsda = { 0x10, PORT_STAT, 1 },
  70. },
  71. /* type 6: Barco LPT->DVI (K5800236) adapter */
  72. {
  73. .setsda = { 0x02, PORT_DATA, 1 },
  74. .setscl = { 0x01, PORT_DATA, 1 },
  75. .getsda = { 0x20, PORT_STAT, 0 },
  76. .getscl = { 0x40, PORT_STAT, 0 },
  77. .init = { 0xfc, PORT_DATA, 0 },
  78. },
  79. /* type 7: One For All JP1 parallel port adapter */
  80. {
  81. .setsda = { 0x01, PORT_DATA, 0 },
  82. .setscl = { 0x02, PORT_DATA, 0 },
  83. .getsda = { 0x80, PORT_STAT, 1 },
  84. .init = { 0x04, PORT_DATA, 1 },
  85. },
  86. /* type 8: VCT-jig */
  87. {
  88. .setsda = { 0x04, PORT_DATA, 1 },
  89. .setscl = { 0x01, PORT_DATA, 1 },
  90. .getsda = { 0x40, PORT_STAT, 0 },
  91. .getscl = { 0x80, PORT_STAT, 1 },
  92. },
  93. };
  94. static int type = -1;
  95. module_param(type, int, 0);
  96. MODULE_PARM_DESC(type,
  97. "Type of adapter:\n"
  98. " 0 = Philips adapter\n"
  99. " 1 = home brew teletext adapter\n"
  100. " 2 = Velleman K8000 adapter\n"
  101. " 3 = ELV adapter\n"
  102. " 4 = ADM1032 evaluation board\n"
  103. " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"
  104. " 6 = Barco LPT->DVI (K5800236) adapter\n"
  105. " 7 = One For All JP1 parallel port adapter\n"
  106. " 8 = VCT-jig\n"
  107. );