From 9f7a03642e0e25dc0561be124bddae2b8ed787ab Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Mon, 13 Jan 2020 22:06:43 +0100 Subject: [PATCH] i2c: parport: move include file into main source After removal of the parport-light driver, this include is used by the parport driver exclusively and can be included in the main source. Move module parameter declarations to its variable declaration while here. Signed-off-by: Wolfram Sang Reviewed-by: Jean Delvare Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-parport.c | 113 ++++++++++++++++++++++++++++--- drivers/i2c/busses/i2c-parport.h | 106 ----------------------------- 2 files changed, 105 insertions(+), 114 deletions(-) delete mode 100644 drivers/i2c/busses/i2c-parport.h diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index e8ed882de402..f8f94a25af26 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c @@ -25,7 +25,90 @@ #include #include #include -#include "i2c-parport.h" + +#define PORT_DATA 0 +#define PORT_STAT 1 +#define PORT_CTRL 2 + +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 ------------------------------------------------------ */ @@ -40,9 +123,30 @@ struct i2c_par { static LIST_HEAD(adapter_list); static DEFINE_MUTEX(adapter_list_lock); + #define MAX_DEVICE 4 static int parport[MAX_DEVICE] = {0, -1, -1, -1}; +module_param_array(parport, int, NULL, 0); +MODULE_PARM_DESC(parport, + "List of parallel ports to bind to, by index.\n" + " Atmost " __stringify(MAX_DEVICE) " devices are supported.\n" + " Default is one device connected to parport0.\n" +); +static int type = -1; +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" + " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" + " 6 = Barco LPT->DVI (K5800236) adapter\n" + " 7 = One For All JP1 parallel port adapter\n" + " 8 = VCT-jig\n" +); /* ----- Low-level parallel port access ----------------------------------- */ @@ -311,12 +415,5 @@ MODULE_AUTHOR("Jean Delvare "); MODULE_DESCRIPTION("I2C bus over parallel port"); MODULE_LICENSE("GPL"); -module_param_array(parport, int, NULL, 0); -MODULE_PARM_DESC(parport, - "List of parallel ports to bind to, by index.\n" - " Atmost " __stringify(MAX_DEVICE) " devices are supported.\n" - " Default is one device connected to parport0.\n" -); - module_init(i2c_parport_init); module_exit(i2c_parport_exit); diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h deleted file mode 100644 index 3b32d92b1264..000000000000 --- a/drivers/i2c/busses/i2c-parport.h +++ /dev/null @@ -1,106 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* ------------------------------------------------------------------------ * - * i2c-parport.h I2C bus over parallel port * - * ------------------------------------------------------------------------ * - Copyright (C) 2003-2010 Jean Delvare - - * ------------------------------------------------------------------------ */ - -#define PORT_DATA 0 -#define PORT_STAT 1 -#define PORT_CTRL 2 - -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 }, - }, -}; - -static int type = -1; -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" - " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" - " 6 = Barco LPT->DVI (K5800236) adapter\n" - " 7 = One For All JP1 parallel port adapter\n" - " 8 = VCT-jig\n" -);