i2c-parport.h 3.2 KB

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