drivers/i2c/busses/i2c-parport.c

Source file repositories/reference/linux-study-clean/drivers/i2c/busses/i2c-parport.c

File Facts

System
Linux kernel
Corpus path
drivers/i2c/busses/i2c-parport.c
Extension
.c
Size
10731 bytes
Lines
409
Domain
Driver Families
Bucket
drivers/i2c
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

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;
	unsigned int smbus_alert:1;
};

static const struct adapter_parm adapter_parm[] = {
	/* type 0: Philips adapter */
	{
		.setsda	= { 0x80, PORT_DATA, 1 },
		.setscl	= { 0x08, PORT_CTRL, 0 },
		.getsda	= { 0x80, PORT_STAT, 0 },
		.getscl	= { 0x08, PORT_STAT, 0 },
	},
	/* type 1: home brew teletext adapter */
	{
		.setsda	= { 0x02, PORT_DATA, 0 },
		.setscl	= { 0x01, PORT_DATA, 0 },
		.getsda	= { 0x80, PORT_STAT, 1 },
	},
	/* type 2: Velleman K8000 adapter */
	{
		.setsda	= { 0x02, PORT_CTRL, 1 },
		.setscl	= { 0x08, PORT_CTRL, 1 },
		.getsda	= { 0x10, PORT_STAT, 0 },
	},
	/* type 3: ELV adapter */
	{
		.setsda	= { 0x02, PORT_DATA, 1 },
		.setscl	= { 0x01, PORT_DATA, 1 },
		.getsda	= { 0x40, PORT_STAT, 1 },
		.getscl	= { 0x08, PORT_STAT, 1 },
	},
	/* type 4: ADM1032 evaluation board */
	{
		.setsda	= { 0x02, PORT_DATA, 1 },
		.setscl	= { 0x01, PORT_DATA, 1 },
		.getsda	= { 0x10, PORT_STAT, 1 },
		.init	= { 0xf0, PORT_DATA, 0 },
		.smbus_alert = 1,
	},
	/* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */
	{
		.setsda	= { 0x02, PORT_DATA, 1 },
		.setscl	= { 0x01, PORT_DATA, 1 },
		.getsda	= { 0x10, PORT_STAT, 1 },
	},
	/* type 6: Barco LPT->DVI (K5800236) adapter */
	{
		.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 },
	},
	/* type 7: One For All JP1 parallel port adapter */
	{
		.setsda	= { 0x01, PORT_DATA, 0 },
		.setscl	= { 0x02, PORT_DATA, 0 },
		.getsda	= { 0x80, PORT_STAT, 1 },
		.init	= { 0x04, PORT_DATA, 1 },
	},
	/* type 8: VCT-jig */
	{
		.setsda	= { 0x04, PORT_DATA, 1 },
		.setscl	= { 0x01, PORT_DATA, 1 },
		.getsda	= { 0x40, PORT_STAT, 0 },
		.getscl	= { 0x80, PORT_STAT, 1 },
	},
};

/* ----- Device list ------------------------------------------------------ */

struct i2c_par {
	struct pardevice *pdev;
	struct i2c_adapter adapter;
	struct i2c_algo_bit_data algo_data;
	struct i2c_smbus_alert_setup alert_data;
	struct i2c_client *ara;
	struct list_head node;
};

Annotation

Implementation Notes