i2c-parport.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* ------------------------------------------------------------------------ *
  2. * i2c-parport.h I2C bus over parallel port *
  3. * ------------------------------------------------------------------------ *
  4. Copyright (C) 2003-2010 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. unsigned int smbus_alert:1;
  35. };
  36. static struct adapter_parm adapter_parm[] = {
  37. /* type 0: Philips adapter */
  38. {
  39. .setsda = { 0x80, DATA, 1 },
  40. .setscl = { 0x08, CTRL, 0 },
  41. .getsda = { 0x80, STAT, 0 },
  42. .getscl = { 0x08, STAT, 0 },
  43. },
  44. /* type 1: home brew teletext adapter */
  45. {
  46. .setsda = { 0x02, DATA, 0 },
  47. .setscl = { 0x01, DATA, 0 },
  48. .getsda = { 0x80, STAT, 1 },
  49. },
  50. /* type 2: Velleman K8000 adapter */
  51. {
  52. .setsda = { 0x02, CTRL, 1 },
  53. .setscl = { 0x08, CTRL, 1 },
  54. .getsda = { 0x10, STAT, 0 },
  55. },
  56. /* type 3: ELV adapter */
  57. {
  58. .setsda = { 0x02, DATA, 1 },
  59. .setscl = { 0x01, DATA, 1 },
  60. .getsda = { 0x40, STAT, 1 },
  61. .getscl = { 0x08, STAT, 1 },
  62. },
  63. /* type 4: ADM1032 evaluation board */
  64. {
  65. .setsda = { 0x02, DATA, 1 },
  66. .setscl = { 0x01, DATA, 1 },
  67. .getsda = { 0x10, STAT, 1 },
  68. .init = { 0xf0, DATA, 0 },
  69. .smbus_alert = 1,
  70. },
  71. /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */
  72. {
  73. .setsda = { 0x02, DATA, 1 },
  74. .setscl = { 0x01, DATA, 1 },
  75. .getsda = { 0x10, STAT, 1 },
  76. },
  77. /* type 6: Barco LPT->DVI (K5800236) adapter */
  78. {
  79. .setsda = { 0x02, DATA, 1 },
  80. .setscl = { 0x01, DATA, 1 },
  81. .getsda = { 0x20, STAT, 0 },
  82. .getscl = { 0x40, STAT, 0 },
  83. .init = { 0xfc, DATA, 0 },
  84. },
  85. /* type 7: One For All JP1 parallel port adapter */
  86. {
  87. .setsda = { 0x01, DATA, 0 },
  88. .setscl = { 0x02, DATA, 0 },
  89. .getsda = { 0x80, STAT, 1 },
  90. .init = { 0x04, DATA, 1 },
  91. },
  92. };
  93. static int type = -1;
  94. module_param(type, int, 0);
  95. MODULE_PARM_DESC(type,
  96. "Type of adapter:\n"
  97. " 0 = Philips adapter\n"
  98. " 1 = home brew teletext adapter\n"
  99. " 2 = Velleman K8000 adapter\n"
  100. " 3 = ELV adapter\n"
  101. " 4 = ADM1032 evaluation board\n"
  102. " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"
  103. " 6 = Barco LPT->DVI (K5800236) adapter\n"
  104. " 7 = One For All JP1 parallel port adapter\n"
  105. );