| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /* ------------------------------------------------------------------------ *
 | 
					
						
							|  |  |  |  * i2c-parport.h I2C bus over parallel port                                 * | 
					
						
							|  |  |  |  * ------------------------------------------------------------------------ * | 
					
						
							| 
									
										
										
										
											2010-03-02 12:23:44 +01:00
										 |  |  |    Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org> | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |    This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |    it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |    the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |    (at your option) any later version. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |    GNU General Public License for more details. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |    along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
					
						
							|  |  |  |  * ------------------------------------------------------------------------ */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | #define PORT_DATA	0
 | 
					
						
							|  |  |  | #define PORT_STAT	1
 | 
					
						
							|  |  |  | #define PORT_CTRL	2
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct lineop { | 
					
						
							|  |  |  | 	u8 val; | 
					
						
							|  |  |  | 	u8 port; | 
					
						
							|  |  |  | 	u8 inverted; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct adapter_parm { | 
					
						
							|  |  |  | 	struct lineop setsda; | 
					
						
							|  |  |  | 	struct lineop setscl; | 
					
						
							|  |  |  | 	struct lineop getsda; | 
					
						
							|  |  |  | 	struct lineop getscl; | 
					
						
							|  |  |  | 	struct lineop init; | 
					
						
							| 
									
										
										
										
											2010-03-02 12:23:44 +01:00
										 |  |  | 	unsigned int smbus_alert:1; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | static const struct adapter_parm adapter_parm[] = { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/* type 0: Philips adapter */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 		.setsda	= { 0x80, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.setscl	= { 0x08, PORT_CTRL, 0 }, | 
					
						
							|  |  |  | 		.getsda	= { 0x80, PORT_STAT, 0 }, | 
					
						
							|  |  |  | 		.getscl	= { 0x08, PORT_STAT, 0 }, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	/* type 1: home brew teletext adapter */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 		.setsda	= { 0x02, PORT_DATA, 0 }, | 
					
						
							|  |  |  | 		.setscl	= { 0x01, PORT_DATA, 0 }, | 
					
						
							|  |  |  | 		.getsda	= { 0x80, PORT_STAT, 1 }, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	/* type 2: Velleman K8000 adapter */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 		.setsda	= { 0x02, PORT_CTRL, 1 }, | 
					
						
							|  |  |  | 		.setscl	= { 0x08, PORT_CTRL, 1 }, | 
					
						
							|  |  |  | 		.getsda	= { 0x10, PORT_STAT, 0 }, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	/* type 3: ELV adapter */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 		.setsda	= { 0x02, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.setscl	= { 0x01, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.getsda	= { 0x40, PORT_STAT, 1 }, | 
					
						
							|  |  |  | 		.getscl	= { 0x08, PORT_STAT, 1 }, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	/* type 4: ADM1032 evaluation board */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 		.setsda	= { 0x02, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.setscl	= { 0x01, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.getsda	= { 0x10, PORT_STAT, 1 }, | 
					
						
							|  |  |  | 		.init	= { 0xf0, PORT_DATA, 0 }, | 
					
						
							| 
									
										
										
										
											2010-03-02 12:23:44 +01:00
										 |  |  | 		.smbus_alert = 1, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	/* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 		.setsda	= { 0x02, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.setscl	= { 0x01, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.getsda	= { 0x10, PORT_STAT, 1 }, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2005-11-26 20:18:43 +01:00
										 |  |  | 	/* type 6: Barco LPT->DVI (K5800236) adapter */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 		.setsda	= { 0x02, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.setscl	= { 0x01, PORT_DATA, 1 }, | 
					
						
							|  |  |  | 		.getsda	= { 0x20, PORT_STAT, 0 }, | 
					
						
							|  |  |  | 		.getscl	= { 0x40, PORT_STAT, 0 }, | 
					
						
							|  |  |  | 		.init	= { 0xfc, PORT_DATA, 0 }, | 
					
						
							| 
									
										
										
										
											2005-11-26 20:18:43 +01:00
										 |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2007-02-13 22:09:02 +01:00
										 |  |  | 	/* type 7: One For All JP1 parallel port adapter */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2011-05-24 20:58:49 +02:00
										 |  |  | 		.setsda	= { 0x01, PORT_DATA, 0 }, | 
					
						
							|  |  |  | 		.setscl	= { 0x02, PORT_DATA, 0 }, | 
					
						
							|  |  |  | 		.getsda	= { 0x80, PORT_STAT, 1 }, | 
					
						
							|  |  |  | 		.init	= { 0x04, PORT_DATA, 1 }, | 
					
						
							| 
									
										
										
										
											2007-02-13 22:09:02 +01:00
										 |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-03-23 16:50:25 +01:00
										 |  |  | static int type = -1; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | module_param(type, int, 0); | 
					
						
							|  |  |  | MODULE_PARM_DESC(type, | 
					
						
							|  |  |  | 	"Type of adapter:\n" | 
					
						
							|  |  |  | 	" 0 = Philips adapter\n" | 
					
						
							|  |  |  | 	" 1 = home brew teletext adapter\n" | 
					
						
							|  |  |  | 	" 2 = Velleman K8000 adapter\n" | 
					
						
							|  |  |  | 	" 3 = ELV adapter\n" | 
					
						
							|  |  |  | 	" 4 = ADM1032 evaluation board\n" | 
					
						
							| 
									
										
										
										
											2005-11-26 20:18:43 +01:00
										 |  |  | 	" 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" | 
					
						
							|  |  |  | 	" 6 = Barco LPT->DVI (K5800236) adapter\n" | 
					
						
							| 
									
										
										
										
											2007-02-13 22:09:02 +01:00
										 |  |  | 	" 7 = One For All JP1 parallel port adapter\n" | 
					
						
							| 
									
										
										
										
											2005-11-26 20:18:43 +01:00
										 |  |  | ); |