All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] i2c: for next API conversion, remove parport-light driver
@ 2020-01-13 21:06 Wolfram Sang
  2020-01-13 21:06 ` [PATCH 1/3] i2c: parport-light: remove driver Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-01-13 21:06 UTC (permalink / raw)
  To: linux-i2c; +Cc: Jean Delvare, Wolfram Sang

When checking how to convert i2c_setup_smbus_alert() to return ERRPTRs,
I decided it makes more sense to remove the parport-light driver than to
convert it. The justifications for its existance do not hold anymore
IMO. People can/should switch to the parport driver if needed.

And this led to some other minor updates to the parport driver. Only
build tested.

Opinions?

Wolfram Sang (3):
  i2c: parport-light: remove driver
  i2c: parport: simplify Kconfig description
  i2c: parport: move include file into main source

 .../i2c/busses/i2c-parport-light.rst          |  24 --
 Documentation/i2c/busses/index.rst            |   1 -
 MAINTAINERS                                   |   2 -
 drivers/i2c/busses/Kconfig                    |  38 +--
 drivers/i2c/busses/Makefile                   |   1 -
 drivers/i2c/busses/i2c-parport-light.c        | 267 ------------------
 drivers/i2c/busses/i2c-parport.c              | 100 ++++++-
 drivers/i2c/busses/i2c-parport.h              | 106 -------
 8 files changed, 101 insertions(+), 438 deletions(-)
 delete mode 100644 Documentation/i2c/busses/i2c-parport-light.rst
 delete mode 100644 drivers/i2c/busses/i2c-parport-light.c
 delete mode 100644 drivers/i2c/busses/i2c-parport.h

-- 
2.20.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] i2c: parport-light: remove driver
  2020-01-13 21:06 [PATCH 0/3] i2c: for next API conversion, remove parport-light driver Wolfram Sang
@ 2020-01-13 21:06 ` Wolfram Sang
  2020-01-15 11:04   ` Jean Delvare
  2020-01-15 17:26   ` Wolfram Sang
  2020-01-13 21:06 ` [PATCH 2/3] i2c: parport: simplify Kconfig description Wolfram Sang
  2020-01-13 21:06 ` [PATCH 3/3] i2c: parport: move include file into main source Wolfram Sang
  2 siblings, 2 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-01-13 21:06 UTC (permalink / raw)
  To: linux-i2c; +Cc: Jean Delvare, Wolfram Sang

The justification of a light version of the parport driver was less
overhead for embedded systems. Well, today, even if an embedded system
still has a parport, it surely can handle the fully-fledged parport
driver. Remove it to reduce the maintenance burden.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 .../i2c/busses/i2c-parport-light.rst          |  24 --
 Documentation/i2c/busses/index.rst            |   1 -
 MAINTAINERS                                   |   2 -
 drivers/i2c/busses/Kconfig                    |  28 --
 drivers/i2c/busses/Makefile                   |   1 -
 drivers/i2c/busses/i2c-parport-light.c        | 267 ------------------
 6 files changed, 323 deletions(-)
 delete mode 100644 Documentation/i2c/busses/i2c-parport-light.rst
 delete mode 100644 drivers/i2c/busses/i2c-parport-light.c

diff --git a/Documentation/i2c/busses/i2c-parport-light.rst b/Documentation/i2c/busses/i2c-parport-light.rst
deleted file mode 100644
index e73af975d2c8..000000000000
--- a/Documentation/i2c/busses/i2c-parport-light.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-===============================
-Kernel driver i2c-parport-light
-===============================
-
-Author: Jean Delvare <jdelvare@suse.de>
-
-This driver is a light version of i2c-parport. It doesn't depend
-on the parport driver, and uses direct I/O access instead. This might be
-preferred on embedded systems where wasting memory for the clean but heavy
-parport handling is not an option. The drawback is a reduced portability
-and the impossibility to daisy-chain other parallel port devices.
-
-Please see i2c-parport for documentation.
-
-Module parameters:
-
-* type: type of adapter (see i2c-parport or modinfo)
-
-* base: base I/O address
-  Default is 0x378 which is fairly common for parallel ports, at least on PC.
-
-* irq: optional IRQ
-  This must be passed if you want SMBus alert support, assuming your adapter
-  actually supports this.
diff --git a/Documentation/i2c/busses/index.rst b/Documentation/i2c/busses/index.rst
index 2a26e251a335..5e4077b08d86 100644
--- a/Documentation/i2c/busses/index.rst
+++ b/Documentation/i2c/busses/index.rst
@@ -20,7 +20,6 @@ I2C Bus Drivers
    i2c-nforce2
    i2c-nvidia-gpu
    i2c-ocores
-   i2c-parport-light
    i2c-parport
    i2c-pca-isa
    i2c-piix4
diff --git a/MAINTAINERS b/MAINTAINERS
index 8982c6e013b3..f665739bf57c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7725,9 +7725,7 @@ M:	Jean Delvare <jdelvare@suse.com>
 L:	linux-i2c@vger.kernel.org
 S:	Maintained
 F:	Documentation/i2c/busses/i2c-parport.rst
-F:	Documentation/i2c/busses/i2c-parport-light.rst
 F:	drivers/i2c/busses/i2c-parport.c
-F:	drivers/i2c/busses/i2c-parport-light.c
 
 I2C SUBSYSTEM
 M:	Wolfram Sang <wsa@the-dreams.de>
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 6a0aa76859f3..933f15f0ad67 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -1211,37 +1211,9 @@ config I2C_PARPORT
 	  An adapter type parameter is now mandatory.  Please read the file
 	  Documentation/i2c/busses/i2c-parport.rst for details.
 
-	  Another driver exists, named i2c-parport-light, which doesn't depend
-	  on the parport driver.  This is meant for embedded systems. Don't say
-	  Y here if you intend to say Y or M there.
-
 	  This support is also available as a module.  If so, the module
 	  will be called i2c-parport.
 
-config I2C_PARPORT_LIGHT
-	tristate "Parallel port adapter (light)"
-	select I2C_ALGOBIT
-	select I2C_SMBUS
-	help
-	  This supports parallel port I2C adapters such as the ones made by
-	  Philips or Velleman, Analog Devices evaluation boards, and more.
-	  Basically any adapter using the parallel port as an I2C bus with
-	  no extra chipset is supported by this driver, or could be.
-
-	  This driver is a light version of i2c-parport.  It doesn't depend
-	  on the parport driver, and uses direct I/O access instead.  This
-	  might be preferred on embedded systems where wasting memory for
-	  the clean but heavy parport handling is not an option.  The
-	  drawback is a reduced portability and the impossibility to
-	  daisy-chain other parallel port devices.
-
-	  Don't say Y here if you said Y or M to i2c-parport.  Saying M to
-	  both is possible but both modules should not be loaded at the same
-	  time.
-
-	  This support is also available as a module.  If so, the module
-	  will be called i2c-parport-light.
-
 config I2C_ROBOTFUZZ_OSIF
 	tristate "RobotFuzz Open Source InterFace USB adapter"
 	depends on USB
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 3ab8aebc39c9..25d60889713c 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -128,7 +128,6 @@ obj-$(CONFIG_I2C_ZX2967)	+= i2c-zx2967.o
 obj-$(CONFIG_I2C_DIOLAN_U2C)	+= i2c-diolan-u2c.o
 obj-$(CONFIG_I2C_DLN2)		+= i2c-dln2.o
 obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
-obj-$(CONFIG_I2C_PARPORT_LIGHT)	+= i2c-parport-light.o
 obj-$(CONFIG_I2C_ROBOTFUZZ_OSIF)	+= i2c-robotfuzz-osif.o
 obj-$(CONFIG_I2C_TAOS_EVM)	+= i2c-taos-evm.o
 obj-$(CONFIG_I2C_TINY_USB)	+= i2c-tiny-usb.o
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
deleted file mode 100644
index 00f6aaf22cfc..000000000000
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ /dev/null
@@ -1,267 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* ------------------------------------------------------------------------ *
- * i2c-parport-light.c I2C bus over parallel port                           *
- * ------------------------------------------------------------------------ *
-   Copyright (C) 2003-2010 Jean Delvare <jdelvare@suse.de>
-
-   Based on older i2c-velleman.c driver
-   Copyright (C) 1995-2000 Simon G. Vogl
-   With some changes from:
-   Frodo Looijaard <frodol@dds.nl>
-   Kyösti Mälkki <kmalkki@cc.hut.fi>
-
- * ------------------------------------------------------------------------ */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/platform_device.h>
-#include <linux/ioport.h>
-#include <linux/i2c.h>
-#include <linux/i2c-algo-bit.h>
-#include <linux/i2c-smbus.h>
-#include <linux/io.h>
-#include "i2c-parport.h"
-
-#define DEFAULT_BASE 0x378
-#define DRVNAME "i2c-parport-light"
-
-static struct platform_device *pdev;
-
-static u16 base;
-module_param_hw(base, ushort, ioport, 0);
-MODULE_PARM_DESC(base, "Base I/O address");
-
-static int irq;
-module_param_hw(irq, int, irq, 0);
-MODULE_PARM_DESC(irq, "IRQ (optional)");
-
-/* ----- Low-level parallel port access ----------------------------------- */
-
-static inline void port_write(unsigned char p, unsigned char d)
-{
-	outb(d, base+p);
-}
-
-static inline unsigned char port_read(unsigned char p)
-{
-	return inb(base+p);
-}
-
-/* ----- Unified line operation functions --------------------------------- */
-
-static inline void line_set(int state, const struct lineop *op)
-{
-	u8 oldval = port_read(op->port);
-
-	/* Touch only the bit(s) needed */
-	if ((op->inverted && !state) || (!op->inverted && state))
-		port_write(op->port, oldval | op->val);
-	else
-		port_write(op->port, oldval & ~op->val);
-}
-
-static inline int line_get(const struct lineop *op)
-{
-	u8 oldval = port_read(op->port);
-
-	return ((op->inverted && (oldval & op->val) != op->val)
-	    || (!op->inverted && (oldval & op->val) == op->val));
-}
-
-/* ----- I2C algorithm call-back functions and structures ----------------- */
-
-static void parport_setscl(void *data, int state)
-{
-	line_set(state, &adapter_parm[type].setscl);
-}
-
-static void parport_setsda(void *data, int state)
-{
-	line_set(state, &adapter_parm[type].setsda);
-}
-
-static int parport_getscl(void *data)
-{
-	return line_get(&adapter_parm[type].getscl);
-}
-
-static int parport_getsda(void *data)
-{
-	return line_get(&adapter_parm[type].getsda);
-}
-
-/* Encapsulate the functions above in the correct structure
-   Note that getscl will be set to NULL by the attaching code for adapters
-   that cannot read SCL back */
-static struct i2c_algo_bit_data parport_algo_data = {
-	.setsda		= parport_setsda,
-	.setscl		= parport_setscl,
-	.getsda		= parport_getsda,
-	.getscl		= parport_getscl,
-	.udelay		= 50,
-	.timeout	= HZ,
-};
-
-/* ----- Driver registration ---------------------------------------------- */
-
-static struct i2c_adapter parport_adapter = {
-	.owner		= THIS_MODULE,
-	.class		= I2C_CLASS_HWMON,
-	.algo_data	= &parport_algo_data,
-	.name		= "Parallel port adapter (light)",
-};
-
-/* SMBus alert support */
-static struct i2c_smbus_alert_setup alert_data = {
-};
-static struct i2c_client *ara;
-static struct lineop parport_ctrl_irq = {
-	.val		= (1 << 4),
-	.port		= PORT_CTRL,
-};
-
-static int i2c_parport_probe(struct platform_device *pdev)
-{
-	int err;
-
-	/* Reset hardware to a sane state (SCL and SDA high) */
-	parport_setsda(NULL, 1);
-	parport_setscl(NULL, 1);
-	/* Other init if needed (power on...) */
-	if (adapter_parm[type].init.val) {
-		line_set(1, &adapter_parm[type].init);
-		/* Give powered devices some time to settle */
-		msleep(100);
-	}
-
-	parport_adapter.dev.parent = &pdev->dev;
-	err = i2c_bit_add_bus(&parport_adapter);
-	if (err) {
-		dev_err(&pdev->dev, "Unable to register with I2C\n");
-		return err;
-	}
-
-	/* Setup SMBus alert if supported */
-	if (adapter_parm[type].smbus_alert && irq) {
-		alert_data.irq = irq;
-		ara = i2c_setup_smbus_alert(&parport_adapter, &alert_data);
-		if (ara)
-			line_set(1, &parport_ctrl_irq);
-		else
-			dev_warn(&pdev->dev, "Failed to register ARA client\n");
-	}
-
-	return 0;
-}
-
-static int i2c_parport_remove(struct platform_device *pdev)
-{
-	if (ara) {
-		line_set(0, &parport_ctrl_irq);
-		i2c_unregister_device(ara);
-		ara = NULL;
-	}
-	i2c_del_adapter(&parport_adapter);
-
-	/* Un-init if needed (power off...) */
-	if (adapter_parm[type].init.val)
-		line_set(0, &adapter_parm[type].init);
-
-	return 0;
-}
-
-static struct platform_driver i2c_parport_driver = {
-	.driver = {
-		.name	= DRVNAME,
-	},
-	.probe		= i2c_parport_probe,
-	.remove		= i2c_parport_remove,
-};
-
-static int __init i2c_parport_device_add(u16 address)
-{
-	int err;
-
-	pdev = platform_device_alloc(DRVNAME, -1);
-	if (!pdev) {
-		err = -ENOMEM;
-		printk(KERN_ERR DRVNAME ": Device allocation failed\n");
-		goto exit;
-	}
-
-	err = platform_device_add(pdev);
-	if (err) {
-		printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
-		       err);
-		goto exit_device_put;
-	}
-
-	return 0;
-
-exit_device_put:
-	platform_device_put(pdev);
-exit:
-	return err;
-}
-
-static int __init i2c_parport_init(void)
-{
-	int err;
-
-	if (type < 0) {
-		printk(KERN_ERR DRVNAME ": adapter type unspecified\n");
-		return -ENODEV;
-	}
-
-	if (type >= ARRAY_SIZE(adapter_parm)) {
-		printk(KERN_ERR DRVNAME ": invalid type (%d)\n", type);
-		return -ENODEV;
-	}
-
-	if (base == 0) {
-		pr_info(DRVNAME ": using default base 0x%x\n", DEFAULT_BASE);
-		base = DEFAULT_BASE;
-	}
-
-	if (!request_region(base, 3, DRVNAME))
-		return -EBUSY;
-
-	if (irq != 0)
-		pr_info(DRVNAME ": using irq %d\n", irq);
-
-	if (!adapter_parm[type].getscl.val)
-		parport_algo_data.getscl = NULL;
-
-	/* Sets global pdev as a side effect */
-	err = i2c_parport_device_add(base);
-	if (err)
-		goto exit_release;
-
-	err = platform_driver_register(&i2c_parport_driver);
-	if (err)
-		goto exit_device;
-
-	return 0;
-
-exit_device:
-	platform_device_unregister(pdev);
-exit_release:
-	release_region(base, 3);
-	return err;
-}
-
-static void __exit i2c_parport_exit(void)
-{
-	platform_driver_unregister(&i2c_parport_driver);
-	platform_device_unregister(pdev);
-	release_region(base, 3);
-}
-
-MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>");
-MODULE_DESCRIPTION("I2C bus over parallel port (light)");
-MODULE_LICENSE("GPL");
-
-module_init(i2c_parport_init);
-module_exit(i2c_parport_exit);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] i2c: parport: simplify Kconfig description
  2020-01-13 21:06 [PATCH 0/3] i2c: for next API conversion, remove parport-light driver Wolfram Sang
  2020-01-13 21:06 ` [PATCH 1/3] i2c: parport-light: remove driver Wolfram Sang
@ 2020-01-13 21:06 ` Wolfram Sang
  2020-01-15 11:07   ` Jean Delvare
  2020-01-15 17:26   ` Wolfram Sang
  2020-01-13 21:06 ` [PATCH 3/3] i2c: parport: move include file into main source Wolfram Sang
  2 siblings, 2 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-01-13 21:06 UTC (permalink / raw)
  To: linux-i2c; +Cc: Jean Delvare, Wolfram Sang

The driver is not 'new' anymore, so remove details from the driver it
surpassed.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/Kconfig | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 933f15f0ad67..b2840c5ebf24 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -1202,14 +1202,8 @@ config I2C_PARPORT
 	  This supports parallel port I2C adapters such as the ones made by
 	  Philips or Velleman, Analog Devices evaluation boards, and more.
 	  Basically any adapter using the parallel port as an I2C bus with
-	  no extra chipset is supported by this driver, or could be.
-
-	  This driver is a replacement for (and was inspired by) an older
-	  driver named i2c-philips-par.  The new driver supports more devices,
-	  and makes it easier to add support for new devices.
-
-	  An adapter type parameter is now mandatory.  Please read the file
-	  Documentation/i2c/busses/i2c-parport.rst for details.
+	  no extra chipset is supported by this driver, or could be. Please
+	  read the file Documentation/i2c/busses/i2c-parport.rst for details.
 
 	  This support is also available as a module.  If so, the module
 	  will be called i2c-parport.
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] i2c: parport: move include file into main source
  2020-01-13 21:06 [PATCH 0/3] i2c: for next API conversion, remove parport-light driver Wolfram Sang
  2020-01-13 21:06 ` [PATCH 1/3] i2c: parport-light: remove driver Wolfram Sang
  2020-01-13 21:06 ` [PATCH 2/3] i2c: parport: simplify Kconfig description Wolfram Sang
@ 2020-01-13 21:06 ` Wolfram Sang
  2020-01-15 14:17   ` Jean Delvare
  2 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2020-01-13 21:06 UTC (permalink / raw)
  To: linux-i2c; +Cc: Jean Delvare, Wolfram Sang

After removal of the parport-light driver, this include is used by the
parport driver exclusively and can be included in the main source.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-parport.c | 100 ++++++++++++++++++++++++++++-
 drivers/i2c/busses/i2c-parport.h | 106 -------------------------------
 2 files changed, 99 insertions(+), 107 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..d03d22812eef 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -25,7 +25,90 @@
 #include <linux/slab.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
-#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 ------------------------------------------------------ */
 
@@ -42,6 +125,7 @@ static LIST_HEAD(adapter_list);
 static DEFINE_MUTEX(adapter_list_lock);
 #define MAX_DEVICE 4
 static int parport[MAX_DEVICE] = {0, -1, -1, -1};
+static int type = -1;
 
 
 /* ----- Low-level parallel port access ----------------------------------- */
@@ -318,5 +402,19 @@ MODULE_PARM_DESC(parport,
 		 " Default is one device connected to parport0.\n"
 );
 
+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"
+);
+
 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 <jdelvare@suse.de>
-
- * ------------------------------------------------------------------------ */
-
-#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"
-);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] i2c: parport-light: remove driver
  2020-01-13 21:06 ` [PATCH 1/3] i2c: parport-light: remove driver Wolfram Sang
@ 2020-01-15 11:04   ` Jean Delvare
  2020-01-15 17:26   ` Wolfram Sang
  1 sibling, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2020-01-15 11:04 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c

On Mon, 13 Jan 2020 22:06:41 +0100, Wolfram Sang wrote:
> The justification of a light version of the parport driver was less
> overhead for embedded systems. Well, today, even if an embedded system
> still has a parport, it surely can handle the fully-fledged parport
> driver. Remove it to reduce the maintenance burden.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  .../i2c/busses/i2c-parport-light.rst          |  24 --
>  Documentation/i2c/busses/index.rst            |   1 -
>  MAINTAINERS                                   |   2 -
>  drivers/i2c/busses/Kconfig                    |  28 --
>  drivers/i2c/busses/Makefile                   |   1 -
>  drivers/i2c/busses/i2c-parport-light.c        | 267 ------------------
>  6 files changed, 323 deletions(-)
>  delete mode 100644 Documentation/i2c/busses/i2c-parport-light.rst
>  delete mode 100644 drivers/i2c/busses/i2c-parport-light.c
> (...)

Reviewed-by: Jean Delvare <jdelvare@suse.de>


-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] i2c: parport: simplify Kconfig description
  2020-01-13 21:06 ` [PATCH 2/3] i2c: parport: simplify Kconfig description Wolfram Sang
@ 2020-01-15 11:07   ` Jean Delvare
  2020-01-15 17:26   ` Wolfram Sang
  1 sibling, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2020-01-15 11:07 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c

On Mon, 13 Jan 2020 22:06:42 +0100, Wolfram Sang wrote:
> The driver is not 'new' anymore, so remove details from the driver it
> surpassed.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/i2c/busses/Kconfig | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index 933f15f0ad67..b2840c5ebf24 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -1202,14 +1202,8 @@ config I2C_PARPORT
>  	  This supports parallel port I2C adapters such as the ones made by
>  	  Philips or Velleman, Analog Devices evaluation boards, and more.
>  	  Basically any adapter using the parallel port as an I2C bus with
> -	  no extra chipset is supported by this driver, or could be.
> -
> -	  This driver is a replacement for (and was inspired by) an older
> -	  driver named i2c-philips-par.  The new driver supports more devices,
> -	  and makes it easier to add support for new devices.
> -
> -	  An adapter type parameter is now mandatory.  Please read the file
> -	  Documentation/i2c/busses/i2c-parport.rst for details.
> +	  no extra chipset is supported by this driver, or could be. Please
> +	  read the file Documentation/i2c/busses/i2c-parport.rst for details.
>  
>  	  This support is also available as a module.  If so, the module
>  	  will be called i2c-parport.

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] i2c: parport: move include file into main source
  2020-01-13 21:06 ` [PATCH 3/3] i2c: parport: move include file into main source Wolfram Sang
@ 2020-01-15 14:17   ` Jean Delvare
  2020-01-15 17:26     ` Wolfram Sang
  0 siblings, 1 reply; 10+ messages in thread
From: Jean Delvare @ 2020-01-15 14:17 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c

On Mon, 13 Jan 2020 22:06:43 +0100, Wolfram Sang wrote:
> After removal of the parport-light driver, this include is used by the
> parport driver exclusively and can be included in the main source.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/i2c/busses/i2c-parport.c | 100 ++++++++++++++++++++++++++++-
>  drivers/i2c/busses/i2c-parport.h | 106 -------------------------------
>  2 files changed, 99 insertions(+), 107 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..d03d22812eef 100644
> --- a/drivers/i2c/busses/i2c-parport.c
> +++ b/drivers/i2c/busses/i2c-parport.c
> (...)
> @@ -42,6 +125,7 @@ static LIST_HEAD(adapter_list);
>  static DEFINE_MUTEX(adapter_list_lock);
>  #define MAX_DEVICE 4
>  static int parport[MAX_DEVICE] = {0, -1, -1, -1};
> +static int type = -1;
>  
>  
>  /* ----- Low-level parallel port access ----------------------------------- */
> @@ -318,5 +402,19 @@ MODULE_PARM_DESC(parport,
>  		 " Default is one device connected to parport0.\n"
>  );
>  
> +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"
> +);

Isn't it considered a better practice to keep the module_param (and
MODULE_PARM_DESC) close to the declaration of the variable itself so
that correctness can be easily verified and changing the type later
would be easier?

Other than that, I'm fine with the change, thanks for doing this.

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] i2c: parport: move include file into main source
  2020-01-15 14:17   ` Jean Delvare
@ 2020-01-15 17:26     ` Wolfram Sang
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-01-15 17:26 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Wolfram Sang, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]


> > +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"
> > +);
> 
> Isn't it considered a better practice to keep the module_param (and
> MODULE_PARM_DESC) close to the declaration of the variable itself so
> that correctness can be easily verified and changing the type later
> would be easier?

I tried it for both module parameters and it looks much better, in deed.
So, fixed it while applying, thanks for the suggestions!

Applied to for-next!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] i2c: parport-light: remove driver
  2020-01-13 21:06 ` [PATCH 1/3] i2c: parport-light: remove driver Wolfram Sang
  2020-01-15 11:04   ` Jean Delvare
@ 2020-01-15 17:26   ` Wolfram Sang
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-01-15 17:26 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, Jean Delvare

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

On Mon, Jan 13, 2020 at 10:06:41PM +0100, Wolfram Sang wrote:
> The justification of a light version of the parport driver was less
> overhead for embedded systems. Well, today, even if an embedded system
> still has a parport, it surely can handle the fully-fledged parport
> driver. Remove it to reduce the maintenance burden.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] i2c: parport: simplify Kconfig description
  2020-01-13 21:06 ` [PATCH 2/3] i2c: parport: simplify Kconfig description Wolfram Sang
  2020-01-15 11:07   ` Jean Delvare
@ 2020-01-15 17:26   ` Wolfram Sang
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-01-15 17:26 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, Jean Delvare

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

On Mon, Jan 13, 2020 at 10:06:42PM +0100, Wolfram Sang wrote:
> The driver is not 'new' anymore, so remove details from the driver it
> surpassed.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-01-15 17:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13 21:06 [PATCH 0/3] i2c: for next API conversion, remove parport-light driver Wolfram Sang
2020-01-13 21:06 ` [PATCH 1/3] i2c: parport-light: remove driver Wolfram Sang
2020-01-15 11:04   ` Jean Delvare
2020-01-15 17:26   ` Wolfram Sang
2020-01-13 21:06 ` [PATCH 2/3] i2c: parport: simplify Kconfig description Wolfram Sang
2020-01-15 11:07   ` Jean Delvare
2020-01-15 17:26   ` Wolfram Sang
2020-01-13 21:06 ` [PATCH 3/3] i2c: parport: move include file into main source Wolfram Sang
2020-01-15 14:17   ` Jean Delvare
2020-01-15 17:26     ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.