Skip to contentSkip to conversation

Winbond IR driver

PATCH In review David Härdeman 4 participants 18 messages Jun 27, 2009 – Jul 10, 2009

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Winbond IR driver

The following two patches reintroduce the acpi .shutdown method which was removed prior to the release of 2.6.30 and then adds a driver for the IR functionality of the Winbond WPCD376I SuperI/O chip found on some Intel motherboards.

acpi shutdown was removed in commit
c0ce093f5b8bc3262c51bd0b5900424a67909831

David Härdeman (2):
ACPI: reintroduce acpi_device_ops .shutdown method Add a driver for the Winbond WPCD376I IR functionality.

 MAINTAINERS                      |    6 +
 drivers/acpi/scan.c              |   12 +
 drivers/input/misc/Kconfig       |   15 +
 drivers/input/misc/Makefile      |    1 +
 drivers/input/misc/winbond-cir.c | 1693 ++++++++++++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h          |    2 +
 6 files changed, 1729 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/winbond-cir.c

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

PATCH 1/2 ACPI: reintroduce acpi_device_ops .shutdown method

This reintroduces the .shutdown method which is used by the winbond-cir driver. A normal revert wasn't possible since there had been other changes to include/acpi/acpi_bus.h since.

---
 drivers/acpi/scan.c     |   12 ++++++++++++
 include/acpi/acpi_bus.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/acpi/scan.c +12 -0
index 781435d..c94ab13 100644
@@ -464,10 +464,22 @@ static int acpi_device_remove(struct device * dev)
 	return 0;
 }
 
+static void acpi_device_shutdown(struct device *dev)
+{
+	struct acpi_device *acpi_dev = to_acpi_device(dev);
+	struct acpi_driver *acpi_drv = acpi_dev->driver;
+
+	if (acpi_drv && acpi_drv->ops.shutdown)
+		acpi_drv->ops.shutdown(acpi_dev);
+
+	return ;
+}
+
 struct bus_type acpi_bus_type = {
 	.name		= "acpi",
 	.suspend	= acpi_device_suspend,
 	.resume		= acpi_device_resume,
+	.shutdown	= acpi_device_shutdown,
 	.match		= acpi_bus_match,
 	.probe		= acpi_device_probe,
 	.remove		= acpi_device_remove,
include/acpi/acpi_bus.h +2 -0
index c65e4ce..52da89a 100644
@@ -96,6 +96,7 @@ typedef int (*acpi_op_resume) (struct acpi_device * device);
 typedef int (*acpi_op_bind) (struct acpi_device * device);
 typedef int (*acpi_op_unbind) (struct acpi_device * device);
 typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
+typedef int (*acpi_op_shutdown) (struct acpi_device * device);
 
 struct acpi_bus_ops {
 	u32 acpi_op_add:1;
@@ -112,6 +113,7 @@ struct acpi_device_ops {
 	acpi_op_bind bind;
 	acpi_op_unbind unbind;
 	acpi_op_notify notify;
+	acpi_op_shutdown shutdown;
 };
 
 #define ACPI_DRIVER_ALL_NOTIFY_EVENTS	0x1	/* system AND device events */
Signature · 6 lines
1.6.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Re: [PATCH 1/2] ACPI: reintroduce acpi_device_ops .shutdown method

Quoted 50 lines · On Sat, 27 Jun 2009 07:18:31 +0200 David H__rdeman <[email protected]> wrote:

This reintroduces the .shutdown method which is used by the winbond-cir driver. A normal revert wasn't possible since there had been other changes to include/acpi/acpi_bus.h since.

---
 drivers/acpi/scan.c     |   12 ++++++++++++
 include/acpi/acpi_bus.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/acpi/scan.c +12 -0
index 781435d..c94ab13 100644
@@ -464,10 +464,22 @@ static int acpi_device_remove(struct device * dev)
 	return 0;
 }
 
+static void acpi_device_shutdown(struct device *dev)
+{
+	struct acpi_device *acpi_dev = to_acpi_device(dev);
+	struct acpi_driver *acpi_drv = acpi_dev->driver;
+
+	if (acpi_drv && acpi_drv->ops.shutdown)
+		acpi_drv->ops.shutdown(acpi_dev);
+
+	return ;
+}
+
 struct bus_type acpi_bus_type = {
 	.name		= "acpi",
 	.suspend	= acpi_device_suspend,
 	.resume		= acpi_device_resume,
+	.shutdown	= acpi_device_shutdown,
 	.match		= acpi_bus_match,
 	.probe		= acpi_device_probe,
 	.remove		= acpi_device_remove,
include/acpi/acpi_bus.h +1 -0
index c65e4ce..52da89a 100644
@@ -96,6 +96,7 @@ typedef int (*acpi_op_resume) (struct acpi_device * device);
 typedef int (*acpi_op_bind) (struct acpi_device * device);
 typedef int (*acpi_op_unbind) (struct acpi_device * device);
 typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
+typedef int (*acpi_op_shutdown) (struct acpi_device * device);
 
 struct acpi_bus_ops {
 	u32 acpi_op_add:1;

include/acpi/acpi_bus.h struct acpi_device_ops { · line 119

Quoted 7 lines
include/acpi/acpi_bus.h +1 -0
@@ -112,6 +113,7 @@ struct acpi_device_ops {
 	acpi_op_bind bind;
 	acpi_op_unbind unbind;
 	acpi_op_notify notify;
+	acpi_op_shutdown shutdown;
 };
 
 #define ACPI_DRIVER_ALL_NOTIFY_EVENTS	0x1	/* system AND device events */

Len, Bjorn: is this OK? Or is there some other mechanism which the driver should have used?

Thanks.

#3 lore raw

Re: [PATCH 1/2] ACPI: reintroduce acpi_device_ops .shutdown method

Quoted 59 lines · Andrew Morton
Quoted 56 lines · On Sat, 27 Jun 2009 07:18:31 +0200 David H__rdeman <[email protected]> wrote:

This reintroduces the .shutdown method which is used by the winbond-cir driver. A normal revert wasn't possible since there had been other changes to include/acpi/acpi_bus.h since.

---
 drivers/acpi/scan.c     |   12 ++++++++++++
 include/acpi/acpi_bus.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/acpi/scan.c +12 -0
index 781435d..c94ab13 100644
@@ -464,10 +464,22 @@ static int acpi_device_remove(struct device * dev)
 	return 0;
 }
 
+static void acpi_device_shutdown(struct device *dev)
+{
+	struct acpi_device *acpi_dev = to_acpi_device(dev);
+	struct acpi_driver *acpi_drv = acpi_dev->driver;
+
+	if (acpi_drv && acpi_drv->ops.shutdown)
+		acpi_drv->ops.shutdown(acpi_dev);
+
+	return ;
+}
+
 struct bus_type acpi_bus_type = {
 	.name		= "acpi",
 	.suspend	= acpi_device_suspend,
 	.resume		= acpi_device_resume,
+	.shutdown	= acpi_device_shutdown,
 	.match		= acpi_bus_match,
 	.probe		= acpi_device_probe,
 	.remove		= acpi_device_remove,
include/acpi/acpi_bus.h +2 -0
index c65e4ce..52da89a 100644
@@ -96,6 +96,7 @@ typedef int (*acpi_op_resume) (struct acpi_device * device);
 typedef int (*acpi_op_bind) (struct acpi_device * device);
 typedef int (*acpi_op_unbind) (struct acpi_device * device);
 typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
+typedef int (*acpi_op_shutdown) (struct acpi_device * device);
 
 struct acpi_bus_ops {
 	u32 acpi_op_add:1;
@@ -112,6 +113,7 @@ struct acpi_device_ops {
 	acpi_op_bind bind;
 	acpi_op_unbind unbind;
 	acpi_op_notify notify;
+	acpi_op_shutdown shutdown;
 };
 
Quoted 4 lines

include/acpi/acpi_bus.h struct acpi_device_ops { · line 119

Quoted 1 line
include/acpi/acpi_bus.h +0 -0
 #define ACPI_DRIVER_ALL_NOTIFY_EVENTS	0x1	/* system AND device events */

Len, Bjorn: is this OK? Or is there some other mechanism which the driver should have used?

I'm on vacation and don't have time to read the new winbond driver right now, but maybe it could be changed so that wbcir_shutdown() is an internal function called by wbcir_suspend() (as it is already) and wbcir_remove().

I hate to re-introduce .shutdown when it's only used by a single driver. That makes me think either we have a bunch of drivers that are buggy because they *should* have .shutdown methods but don't, or the single user of .shutdown doesn't have a real dependency on it.

The winbond driver does not use any ACPI-specific functionality, so it might be simpler to write it as a PNP driver (which would depend on PNPACPI, of course).

Nice looking driver, by the way. Even from a cursory glance it's obvious that you've taken a lot of care with it.

Bjorn

#4 lore raw

Re: [PATCH 1/2] ACPI: reintroduce acpi_device_ops .shutdown method

Quoted 8 lines · Bjorn Helgaas
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Sat, 27 Jun 2009 07:18:31 +0200 David Härdeman <[email protected]> wrote:

This reintroduces the .shutdown method which is used by the winbond-cir driver. A normal revert wasn't possible since there had been other changes to include/acpi/acpi_bus.h since.

Quoted 7 lines
Quoted 2 lines

Len, Bjorn: is this OK? Or is there some other mechanism which the driver should have used?

I'm on vacation and don't have time to read the new winbond driver right now, but maybe it could be changed so that wbcir_shutdown() is an internal function called by wbcir_suspend() (as it is already) and wbcir_remove().

I didn't want to call wbcir_shutdown from wbcir_remove since wbcir_remove is called on rmmod and the wbcir_shutdown method programs the chip so that wake-on-a-specific-ir-command is enabled (and I imagine that people would expect rmmod to disable the hardware completely). I will clarify the function names a bit in the next version of the patch...

As far as I could understand from my testing, the acpi .suspend method is not called during shutdown which is why I needed to hook into both .suspend and .shutdown separately.

Quoted 4 lines

I hate to re-introduce .shutdown when it's only used by a single driver. That makes me think either we have a bunch of drivers that are buggy because they *should* have .shutdown methods but don't, or the single user of .shutdown doesn't have a real dependency on it.

I think this single user does have a real dependency because of its wake-from-poweroff and wake-from-suspend capability. But I could be mistaken...

Quoted 3 lines

The winbond driver does not use any ACPI-specific functionality, so it might be simpler to write it as a PNP driver (which would depend on PNPACPI, of course).

As far as I could tell from a quick look at include/linux/pnp.h, a pnp_driver doesn't seem to have any .shutdown methods either, so I'm not sure how it would help?

(On a related note, it seems inconsistent to me that platform_driver has a .shutdown method while pnp_driver and acpi_driver doesn't.)

If you disagree with acpi_driver regaining the .shutdown method I guess the only options are to use register_reboot_notifier or to rewrite the driver as a platform_driver (Alan Cox seemed to suggest earlier that the driver was not a good fit for a platform driver).

Quoted 2 lines

Nice looking driver, by the way. Even from a cursory glance it's obvious that you've taken a lot of care with it.

Thank you, and have a nice vacation.

Regards,
David

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Re: [PATCH 1/2] ACPI: reintroduce acpi_device_ops .shutdown method

Quoted 8 lines · David Härdeman
Quoted 3 lines · Bjorn Helgaas

The winbond driver does not use any ACPI-specific functionality, so it might be simpler to write it as a PNP driver (which would depend on PNPACPI, of course).

As far as I could tell from a quick look at include/linux/pnp.h, a pnp_driver doesn't seem to have any .shutdown methods either, so I'm not sure how it would help?

PNPACPI parses the device resources for you, so you could get rid of the _CRS stuff in your driver.

The only reason PNP and ACPI don't have .shutdown is because nobody has needed it yet. If you need it (and it sounds like you do), I think the cleanest thing would be to add it to PNP and turn your driver into a PNP driver.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

cover Winbond driver as PNP

Quoted 10 lines · Bjorn Helgaas
Quoted 8 lines · David Härdeman
Quoted 3 lines · Bjorn Helgaas

The winbond driver does not use any ACPI-specific functionality, so it might be simpler to write it as a PNP driver (which would depend on PNPACPI, of course).

As far as I could tell from a quick look at include/linux/pnp.h, a pnp_driver doesn't seem to have any .shutdown methods either, so I'm not sure how it would help?

Quoted 7 lines

PNPACPI parses the device resources for you, so you could get rid of the _CRS stuff in your driver.

The only reason PNP and ACPI don't have .shutdown is because nobody has needed it yet. If you need it (and it sounds like you do), I think the cleanest thing would be to add it to PNP and turn your driver into a PNP driver.

Here are two sample patches to show you what I was suggesting. These apply on top of the two Winbond patches currently in -mm.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

PATCH 1/2 PNP: add .shutdown method

drivers/pnp/driver.c +10 -0
index 527ee76..cd11b11 100644
@@ -135,6 +135,15 @@ static int pnp_device_remove(struct device *dev)
 	return 0;
 }
 
+static void pnp_device_shutdown(struct device *dev)
+{
+	struct pnp_dev *pnp_dev = to_pnp_dev(dev);
+	struct pnp_driver *drv = pnp_dev->driver;
+
+	if (drv && drv->shutdown)
+		drv->shutdown(pnp_dev);
+}
+
 static int pnp_bus_match(struct device *dev, struct device_driver *drv)
 {
 	struct pnp_dev *pnp_dev = to_pnp_dev(dev);
@@ -203,6 +212,7 @@ struct bus_type pnp_bus_type = {
 	.match   = pnp_bus_match,
 	.probe   = pnp_device_probe,
 	.remove  = pnp_device_remove,
+	.shutdown = pnp_device_shutdown,
 	.suspend = pnp_bus_suspend,
 	.resume  = pnp_bus_resume,
 	.dev_attrs = pnp_interface_attrs,
include/linux/pnp.h +1 -0
index b063c73..fddfafa 100644
@@ -360,6 +360,7 @@ struct pnp_driver {
 	unsigned int flags;
 	int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
 	void (*remove) (struct pnp_dev *dev);
+	void (*shutdown) (struct pnp_dev *dev);
 	int (*suspend) (struct pnp_dev *dev, pm_message_t state);
 	int (*resume) (struct pnp_dev *dev);
 	struct device_driver driver;
#8 lore raw

PATCH 2/2 Winbond: convert from ACPI to PNP driver

In reply to Bjorn Helgaas
drivers/input/misc/winbond-cir.c +46 -96
index f97271b..9b5c985 100644
@@ -45,7 +45,7 @@
  */
 
 #include <linux/module.h>
-#include <linux/acpi.h>
+#include <linux/pnp.h>
 #include <linux/interrupt.h>
 #include <linux/timer.h>
 #include <linux/input.h>
@@ -161,7 +161,6 @@ enum wbcir_protocol {
 
 /* Misc */
 #define WBCIR_ACPI_NAME	"Winbond CIR"
-#define WBCIR_ACPI_CLASS	"CIR"
 #define WBCIR_ID_FAMILY          0xF1 /* Family ID for the WPCD376I	*/
 #define	WBCIR_ID_CHIP            0x04 /* Chip ID for the WPCD376I	*/
 #define IR_KEYPRESS_TIMEOUT       250 /* FIXME: should be per-protocol? */
@@ -937,8 +936,8 @@ wbcir_parse_nec(struct device *dev, struct wbcir_data *data)
 static irqreturn_t
 wbcir_irq_handler(int irqno, void *cookie)
 {
-	struct acpi_device *device = cookie;
-	struct wbcir_data *data = acpi_driver_data(device);
+	struct pnp_dev *device = cookie;
+	struct wbcir_data *data = pnp_get_drvdata(device);
 	struct device *dev = &device->dev;
 	u8 status;
 	unsigned long flags;
@@ -1021,11 +1020,11 @@ out:
  *
  *****************************************************************************/
 
-static int
-wbcir_shutdown(struct acpi_device *device)
+static void
+wbcir_shutdown(struct pnp_dev *device)
 {
 	struct device *dev = &device->dev;
-	struct wbcir_data *data = acpi_driver_data(device);
+	struct wbcir_data *data = pnp_get_drvdata(device);
 	int do_wake = 1;
 	u8 match[11];
 	u8 mask[11];
@@ -1197,20 +1196,19 @@ finish:
 
 	/* Disable interrupts */
 	outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
-
-	return 0;
 }
 
 static int
-wbcir_suspend(struct acpi_device *device, pm_message_t state)
+wbcir_suspend(struct pnp_dev *device, pm_message_t state)
 {
-	return wbcir_shutdown(device);
+	wbcir_shutdown(device);
+	return 0;
 }
 
 static int
-wbcir_resume(struct acpi_device *device)
+wbcir_resume(struct pnp_dev *device)
 {
-	struct wbcir_data *data = acpi_driver_data(device);
+	struct wbcir_data *data = pnp_get_drvdata(device);
 
 	/* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */
 	wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
@@ -1237,8 +1235,8 @@ static ssize_t
 wbcir_show_last_scancode(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	struct acpi_device *device = container_of(dev, struct acpi_device, dev);
-	struct wbcir_data *data = acpi_driver_data(device);
+	struct pnp_dev *device = container_of(dev, struct pnp_dev, dev);
+	struct wbcir_data *data = pnp_get_drvdata(device);
 	return sprintf(buf, "0x%08X\n", data->last_scancode);
 }
 
@@ -1261,56 +1259,6 @@ static struct attribute_group wbcir_attribute_group = {
 	.attrs = wbcir_attributes,
 };
 
-static acpi_status
-wbcir_walk_resources(struct acpi_resource *resource, void *context)
-{
-	struct wbcir_data *data = context;
-
-	switch (resource->type) {
-
-	case ACPI_RESOURCE_TYPE_IO:
-		if (!data->ebase) {
-			if (resource->data.io.address_length !=
-			    EHFUNC_IOMEM_LEN)
-				goto error;
-			data->ebase = resource->data.io.minimum;
-		} else if (!data->wbase) {
-			if (resource->data.io.address_length !=
-			    WAKEUP_IOMEM_LEN)
-				goto error;
-			data->wbase = resource->data.io.minimum;
-		} else if (!data->sbase) {
-			if (resource->data.io.address_length !=
-			    SP_IOMEM_LEN)
-				goto error;
-			data->sbase = resource->data.io.minimum;
-		} else {
-			goto error;
-		}
-		break;
-
-	case ACPI_RESOURCE_TYPE_IRQ:
-		if (resource->data.irq.interrupt_count != 1)
-			goto error;
-		else if (!data->irq)
-			data->irq = resource->data.irq.interrupts[0];
-		else
-			goto error;
-		break;
-
-	case ACPI_RESOURCE_TYPE_END_TAG:
-		break;
-
-	default:
-		goto error;
-	}
-
-	return AE_OK;
-
-error:
-	return AE_ERROR;
-}
-
 static void
 wbcir_cfg_ceir(struct wbcir_data *data)
 {
@@ -1345,28 +1293,36 @@ wbcir_cfg_ceir(struct wbcir_data *data)
 }
 
 static int
-wbcir_add(struct acpi_device *device)
+wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
 {
 	struct device *dev = &device->dev;
 	struct wbcir_data *data;
-	acpi_status status;
 	int err;
 
+	if (!(pnp_port_len(device, 0) == EHFUNC_IOMEM_LEN &&
+	      pnp_port_len(device, 1) == WAKEUP_IOMEM_LEN &&
+	      pnp_port_len(device, 2) == SP_IOMEM_LEN)) {
+		dev_err(dev, "Invalid resources\n");
+		return -ENODEV;
+	}
+
 	data = kzalloc(sizeof(*data), GFP_KERNEL);
 	if (!data) {
 		err = -ENOMEM;
 		goto exit;
 	}
 
-	device->driver_data = data;
+	pnp_set_drvdata(device, data);
 
-	status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
-				     wbcir_walk_resources, data);
+	data->ebase = pnp_port_start(device, 0);
+	data->wbase = pnp_port_start(device, 1);
+	data->sbase = pnp_port_start(device, 2);
+	data->irq = pnp_irq(device, 0);
 
-	if (ACPI_FAILURE(status) || data->wbase == 0 || data->ebase == 0 ||
+	if (data->wbase == 0 || data->ebase == 0 ||
 	    data->sbase == 0 || data->irq == 0) {
 		err = -ENODEV;
-		dev_err(dev, "Invalid ACPI resources\n");
+		dev_err(dev, "Invalid resources\n");
 		goto exit_free_data;
 	}
 
@@ -1579,15 +1535,15 @@ exit_release_wbase:
 	release_region(data->wbase, WAKEUP_IOMEM_LEN);
 exit_free_data:
 	kfree(data);
-	device->driver_data = NULL;
+	pnp_set_drvdata(device, NULL);
 exit:
 	return err;
 }
 
-static int
-wbcir_remove(struct acpi_device *device, int type)
+static void
+wbcir_remove(struct pnp_dev *device)
 {
-	struct wbcir_data *data = acpi_driver_data(device);
+	struct wbcir_data *data = pnp_get_drvdata(device);
 	struct wbcir_keyentry *key;
 	struct wbcir_keyentry *keytmp;
 
@@ -1631,29 +1587,23 @@ wbcir_remove(struct acpi_device *device, int type)
 
 	kfree(data);
 
-	device->driver_data = NULL;
-
-	return 0;
+	pnp_set_drvdata(device, NULL);
 }
 
-static const struct acpi_device_id wbcir_ids[] = {
+static const struct pnp_device_id wbcir_ids[] = {
 	{ "WEC1022", 0 },
 	{ "", 0 }
 };
-MODULE_DEVICE_TABLE(acpi, wbcir_ids);
-
-static struct acpi_driver wbcir_driver = {
-	.name  = WBCIR_ACPI_NAME,
-	.class = WBCIR_ACPI_CLASS,
-	.ids   = wbcir_ids,
-	.ops = {
-		.add      = wbcir_add,
-		.remove   = wbcir_remove,
-		.suspend  = wbcir_suspend,
-		.resume   = wbcir_resume,
-		.shutdown = wbcir_shutdown
-	},
-	.owner = THIS_MODULE
+MODULE_DEVICE_TABLE(pnp, wbcir_ids);
+
+static struct pnp_driver wbcir_driver = {
+	.name     = WBCIR_ACPI_NAME,
+	.id_table = wbcir_ids,
+	.probe    = wbcir_probe,
+	.remove   = wbcir_remove,
+	.suspend  = wbcir_suspend,
+	.resume   = wbcir_resume,
+	.shutdown = wbcir_shutdown
 };
 
 static int __init
@@ -1671,7 +1621,7 @@ wbcir_init(void)
 		return -EINVAL;
 	}
 
-	ret = acpi_bus_register_driver(&wbcir_driver);
+	ret = pnp_register_driver(&wbcir_driver);
 	if (ret)
 		printk(KERN_ERR DRVNAME ": Unable to register driver\n");
 
@@ -1681,7 +1631,7 @@ wbcir_init(void)
 static void __exit
 wbcir_exit(void)
 {
-	acpi_bus_unregister_driver(&wbcir_driver);
+	pnp_unregister_driver(&wbcir_driver);
 }
 
 MODULE_AUTHOR("David H�rdeman <[email protected]>");

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Re: [PATCH 0/2] Winbond driver as PNP

In reply to Bjorn Helgaas
Quoted 2 lines · Bjorn Helgaas

Here are two sample patches to show you what I was suggesting. These apply on top of the two Winbond patches currently in -mm.

Thanks, great service :)

I'll test the patches as soon as I have time and access to the hardware.

One question though, the resulting patch series (if AKPM merges these patches in addition to the existing ones and drops the patch adding .shutdown to acpi_driver) will be git bisect unfriendly.

Should I roll two new patches instead to replace the three patches currently in -mm?

Signature · 6 lines
David Härdeman

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

Re: [PATCH 0/2] Winbond driver as PNP

Quoted 6 lines · David Härdeman
Quoted 2 lines · Bjorn Helgaas

Here are two sample patches to show you what I was suggesting. These apply on top of the two Winbond patches currently in -mm.

Thanks, great service :)

Quoted 8 lines

I'll test the patches as soon as I have time and access to the hardware.

One question though, the resulting patch series (if AKPM merges these patches in addition to the existing ones and drops the patch adding .shutdown to acpi_driver) will be git bisect unfriendly.

Should I roll two new patches instead to replace the three patches currently in -mm?

If you like the approach and it works, I would take the latter approach (replace the three patches with two new ones -- e.g., add-pnp-shutdown-method and add-winbond-pnp-driver). I don't think we have to worry about bisectability until they show up in a git tree.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

PATCH 2/2 Add a driver for the Winbond WPCD376I IR functionality.

In reply to David Härdeman

This patch adds a driver for the the Consumer IR (CIR) functionality of the Winbond WPCD376I chipset (found on e.g. Intel DG45FC motherboards).

Changes since the driver was last posted to the list:
o Homebrew dprintk -> dev_dbg
o Some magic values changed to defines
o Fixed a bug where the wake-ir-command mask/value would not be written properly
o Fixed the use of the invert parameter both for wake and normal IR reception.

---
 MAINTAINERS                      |    6 +
 drivers/input/misc/Kconfig       |   15 +
 drivers/input/misc/Makefile      |    1 +
 drivers/input/misc/winbond-cir.c | 1693 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 1715 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/winbond-cir.c
MAINTAINERS +6 -0
index fa2a16d..a8736fd 100644
@@ -6386,6 +6386,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/scsi/wd7000.c
 
+WINBOND CIR DRIVER
+P:	David Härdeman
+M:	[email protected]
+S:	Maintained
+F:	drivers/input/misc/winbond-cir.c
+
 WIMAX STACK
 P:	Inaky Perez-Gonzalez
 M:	[email protected]
drivers/input/misc/Kconfig +15 -0
index 1acfa3a..0fdf249 100644
@@ -269,4 +269,19 @@ config INPUT_DM355EVM
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called dm355evm_keys.
+
+config INPUT_WINBOND_CIR
+	tristate "Winbond IR remote control"
+	depends on X86 && ACPI
+	select LEDS_CLASS
+	help
+	  Say Y here if you want to use the IR remote functionality found
+	  in some Winbond SuperI/O chips. Currently only the WPCD376I
+	  chip is supported (included in some Intel Media series motherboards).
+
+	  IR Receive and wake-on-IR from suspend and power-off is currently
+	  supported.
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called winbond_cir.
 endif
drivers/input/misc/Makefile +1 -0
index 0d979fd..19d420e 100644
@@ -26,3 +26,4 @@ obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
 obj-$(CONFIG_INPUT_UINPUT)		+= uinput.o
 obj-$(CONFIG_INPUT_WISTRON_BTNS)	+= wistron_btns.o
 obj-$(CONFIG_INPUT_YEALINK)		+= yealink.o
+obj-$(CONFIG_INPUT_WINBOND_CIR)		+= winbond-cir.o
drivers/input/misc/winbond-cir.c new file +1693 -0

1,693 lines not on this page · raw message

Signature · 6 lines
1.6.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#12 lore raw

Re: [PATCH 2/2] Add a driver for the Winbond WPCD376I IR functionality.

Quoted 15 lines · On Sat, 27 Jun 2009 07:18:32 +0200 David H__rdeman <[email protected]> wrote:

This patch adds a driver for the the Consumer IR (CIR) functionality of the Winbond WPCD376I chipset (found on e.g. Intel DG45FC motherboards).

Changes since the driver was last posted to the list:
o Homebrew dprintk -> dev_dbg
o Some magic values changed to defines
o Fixed a bug where the wake-ir-command mask/value would not be written properly
o Fixed the use of the invert parameter both for wake and normal IR reception.

...

drivers/input/misc/winbond-cir.c line 303

Quoted 9 lines
drivers/input/misc/winbond-cir.c new file +9 -0
+static void
+wbcir_set_bits(unsigned long addr, u8 bits, u8 mask)
+{
+	u8 val;
+
+	val = inb(addr);
+	val = ((val & ~mask) | (bits & mask));
+	outb(val, addr);
+}

What locking prevents the races which could occur here?

Whatever it is, it would be good to document that here in a code comment.

drivers/input/misc/winbond-cir.c line 343

Quoted 10 lines

...

drivers/input/misc/winbond-cir.c new file +7 -0
+static u8
+wbcir_revbyte(u8 byte)
+{
+	byte = ((byte >> 1) & 0x55) | ((byte << 1) & 0xAA);
+	byte = ((byte >> 2) & 0x33) | ((byte << 2) & 0xCC);
+	return (byte >> 4) | (byte<<4);
+}

Can this use the facilities in include/linux/bitrev.h?

Quoted 7 lines
drivers/input/misc/winbond-cir.c new file +7 -0
+static u8
+wbcir_to_rc6cells(u8 val)
+{
+	u8 coded = 0x00;
+	int i;
+
+	val &= 0x0F;

drivers/input/misc/winbond-cir.c line 361

Quoted 10 lines
drivers/input/misc/winbond-cir.c new file +10 -0
+	for (i = 0; i < 4; i++) {
+		if (val & 0x01)
+			coded |= 0x02 << (i * 2);
+		else
+			coded |= 0x01 << (i * 2);
+		val >>= 1;
+	}
+
+	return coded;
+}

geeze, what does that do?

Code needs comments..

drivers/input/misc/winbond-cir.c line 394

Quoted 7 lines

...

drivers/input/misc/winbond-cir.c new file +4 -0
+static int
+wbcir_getkeycode(struct input_dev *dev, int sscancode, int *keycode)
+{
+	unsigned int scancode = (unsigned int)sscancode;

unneeded cast.

drivers/input/misc/winbond-cir.c line 397

Quoted 3 lines
drivers/input/misc/winbond-cir.c new file +3 -0
+	struct wbcir_data *data = input_get_drvdata(dev);
+
+	if (scancode < 0 || scancode > 0xFFFFFFFF)

Neither of the comparisons in this expression can ever be true.

drivers/input/misc/winbond-cir.c line 400

Quoted 3 lines
drivers/input/misc/winbond-cir.c new file +3 -0
+		return -EINVAL;
+
+	*keycode = (int)wbcir_do_getkeycode(data, (u32)scancode);

uneeded casts.

Something has gone wrong with the types here. Where does the fault lie
- this driver, or input core?

Quoted 4 lines
drivers/input/misc/winbond-cir.c new file +4 -0
+	return 0;
+}
+
+static int

drivers/input/misc/winbond-cir.c line 415

Quoted 10 lines
drivers/input/misc/winbond-cir.c new file +10 -0
+wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode)
+{
+	struct wbcir_data *data = input_get_drvdata(dev);
+	struct wbcir_keyentry *keyentry;
+	struct wbcir_keyentry *new_keyentry;
+	unsigned long flags;
+	unsigned int old_keycode = KEY_RESERVED;
+	unsigned int scancode = (unsigned int)sscancode;
+
+	if (scancode < 0 || scancode > 0xFFFFFFFF)

various dittoes.

Quoted 39 lines
drivers/input/misc/winbond-cir.c new file +39 -0
+		return -EINVAL;
+
+	if (keycode < 0 || keycode > KEY_MAX)
+		return -EINVAL;
+
+	new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL);
+	if (!new_keyentry)
+		return -ENOMEM;
+
+	write_lock_irqsave(&keytable_lock, flags);
+
+	list_for_each_entry(keyentry, &data->keytable, list) {
+		if (keyentry->key.scancode != scancode)
+			continue;
+
+		old_keycode = keyentry->key.keycode;
+		keyentry->key.keycode = keycode;
+
+		if (keyentry->key.keycode == KEY_RESERVED) {
+			list_del(&keyentry->list);
+			kfree(keyentry);
+		}
+
+		break;
+	}
+
+	set_bit(keycode, dev->keybit);
+
+	if (old_keycode == KEY_RESERVED) {
+		new_keyentry->key.scancode = (u32)scancode;
+		new_keyentry->key.keycode = (unsigned int)keycode;
+		list_add(&new_keyentry->list, &data->keytable);
+	} else {
+		kfree(new_keyentry);
+		clear_bit(old_keycode, dev->keybit);
+		list_for_each_entry(keyentry, &data->keytable, list) {
+			if (keyentry->key.keycode == old_keycode) {
+				set_bit(old_keycode, dev->keybit);
+				break;

drivers/input/misc/winbond-cir.c line 464

Quoted 10 lines
drivers/input/misc/winbond-cir.c new file +10 -0
+			}
+		}
+	}
+
+	write_unlock_irqrestore(&keytable_lock, flags);
+	return 0;
+}
+
+static void
+wbcir_keyup(unsigned long cookie)

It would be useful to add a comment telling the reader that this is a timer-handler function.

drivers/input/misc/winbond-cir.c line 473

Quoted 9 lines
drivers/input/misc/winbond-cir.c new file +9 -0
+{
+	struct wbcir_data *data = (struct wbcir_data *)cookie;
+	unsigned long flags;
+
+	/*
+	 * data->keyup_jiffies is used to prevent a race condition if a
+	 * hardware interrupt occurs at this point and the keyup timer
+	 * event is moved further into the future as a result.
+	 */

hm. I don't see what the race is, nor how the comparison fixes it. If I _did_ understand this, perhaps I could suggest alternative fixes. But I don't so I can't. Oh well.

Quoted 11 lines
drivers/input/misc/winbond-cir.c new file +11 -0
+	spin_lock_irqsave(&wbcir_lock, flags);
+
+	if (time_is_after_eq_jiffies(data->keyup_jiffies) && data->keypressed) {
+		data->keypressed = 0;
+		led_trigger_event(data->rxtrigger, LED_OFF);
+		input_report_key(data->input_dev, data->last_keycode, 0);
+		input_sync(data->input_dev);
+	}
+
+	spin_unlock_irqrestore(&wbcir_lock, flags);
+}

drivers/input/misc/winbond-cir.c line 549

Quoted 10 lines
drivers/input/misc/winbond-cir.c new file +7 -0
+
 
...
 
+static void
+add_irdata_bit(struct wbcir_data *data, int set)
+{
+	if (set)
+		data->irdata[data->irdata_count / 8] |=
+			0x01 << (data->irdata_count % 8);

Can/should this use generic___set_le_bit() or similar, rather than open-coding it?

Quoted 9 lines
drivers/input/misc/winbond-cir.c new file +9 -0
+	data->irdata_count++;
+}
+
+/* Gets count bits of irdata */
+static u16
+get_bits(struct wbcir_data *data, int count)
+{
+	u16 val = 0x0;
+

drivers/input/misc/winbond-cir.c line 568

Quoted 10 lines
drivers/input/misc/winbond-cir.c new file +10 -0
+	if (data->irdata_count - data->irdata_off < count) {
+		data->irdata_error = 1;
+		return 0x0;
+	}
+
+	while (count > 0) {
+		val <<= 1;
+		if (data->irdata[data->irdata_off / 8] &
+		    (0x01 << (data->irdata_off % 8)))
+			val |= 0x1;

ditto

Quoted 10 lines
drivers/input/misc/winbond-cir.c new file +7 -0
+		count--;
+		data->irdata_off++;
+	}
+
+	return val;
+}
+
 
...
#13 lore raw

Re: [PATCH 2/2] Add a driver for the Winbond WPCD376I IR functionality.

Quoted 14 lines · Andrew Morton

drivers/input/misc/winbond-cir.c line 303

Quoted 9 lines · On Sat, 27 Jun 2009 07:18:32 +0200 David Härdeman <[email protected]> wrote:
drivers/input/misc/winbond-cir.c new file +9 -0
+static void
+wbcir_set_bits(unsigned long addr, u8 bits, u8 mask)
+{
+	u8 val;
+
+	val = inb(addr);
+	val = ((val & ~mask) | (bits & mask));
+	outb(val, addr);
+}

What locking prevents the races which could occur here?

Quoted 2 lines

Whatever it is, it would be good to document that here in a code comment.

I should probably clarify the comment in "struct wbcir_data" to mention that wbcir_lock is supposed to protect registers against race conditions.

Quoted 12 lines

drivers/input/misc/winbond-cir.c line 343

Quoted 10 lines

...

drivers/input/misc/winbond-cir.c new file +7 -0
+static u8
+wbcir_revbyte(u8 byte)
+{
+	byte = ((byte >> 1) & 0x55) | ((byte << 1) & 0xAA);
+	byte = ((byte >> 2) & 0x33) | ((byte << 2) & 0xCC);
+	return (byte >> 4) | (byte<<4);
+}

Can this use the facilities in include/linux/bitrev.h?

Yes, I grep:ed for a suitable function but must have missed it, thanks for pointing it out.

Quoted 5 lines

drivers/input/misc/winbond-cir.c line 397

Quoted 3 lines
drivers/input/misc/winbond-cir.c new file +3 -0
+	struct wbcir_data *data = input_get_drvdata(dev);
+
+	if (scancode < 0 || scancode > 0xFFFFFFFF)

Neither of the comparisons in this expression can ever be true.

Didn't know if I could be certain that int is always 32 bit on all platforms which use/might use the chip...can I?

Quoted 8 lines

drivers/input/misc/winbond-cir.c line 400

Quoted 3 lines
drivers/input/misc/winbond-cir.c new file +3 -0
+		return -EINVAL;
+
+	*keycode = (int)wbcir_do_getkeycode(data, (u32)scancode);

uneeded casts.

Something has gone wrong with the types here. Where does the fault lie
- this driver, or input core?

Two issues:

a) the input layer API confused me

include/linux/input.h provides:

struct input_event {
         struct timeval time;
         __u16 type;
         __u16 code;
         __s32 value;
};

(keycode is an unsigned 16 bit integer)

int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); int input_set_keycode(struct input_dev *dev, int scancode, int keycode);

(keycode is an int)

static inline void input_report_key(struct input_dev *dev,
unsigned int code, int value)

{
        input_event(dev, EV_KEY, code, !!value);
}

(keycode is an uint)

b) 32 bit scancodes

I wanted to use 32 bit scancodes in my driver since the largest IR message supported by the driver is RC6 mode 6A which can potentially have a 1 + 15 bits "customer" field + 8 bits address + 8 bits command = 32 bits.

Casting the int scancode passed to input_[get¦set]_keycode to an uint and assuming it would be at least 32 bits on all platforms using the chip was the best solution I could come up with without changing the input API.

Quoted 5 lines
Quoted 5 lines
drivers/input/misc/winbond-cir.c new file +5 -0
+{
+        struct wbcir_data *data = (struct wbcir_data *)cookie;
+        unsigned long flags;
+
+        /*
Quoted 8 lines

drivers/input/misc/winbond-cir.c line 473

Quoted 4 lines
drivers/input/misc/winbond-cir.c new file +4 -0
+         * data->keyup_jiffies is used to prevent a race condition if a
+         * hardware interrupt occurs at this point and the keyup timer
+         * event is moved further into the future as a result.
+         */

hm. I don't see what the race is, nor how the comparison fixes it. If I _did_ understand this, perhaps I could suggest alternative fixes. But I don't so I can't. Oh well.

When the interrupt service routine detects an IR command it reports a keydown event and sets a timer to report a keyup event in the future if no repeated ir messages are detected (in which case the timer-driven keyup should be pushed further into the future to allow the input core to do its auto-repeat-handling magic).

What I wanted to protect against was something like this:

Thread 1 Thread 2
-------- --------
ISR called, grabs
wbcir_lock, reports
keydown for key X,
sets up keyup timer,
releases lock, exits

(many ms later)

keyup timer function called and preempted before grabbing wbcir_lock

ISR called, grabs wbcir_lock,
notices a repeat event for
key X, pushes the keyup timer
further into the future using
mod_timer (thus reenabling the
timer), releases lock, exits
keyup timer function grabs wbcir_lock, reports keyup, exits.
(many ms later)

keyup timer function called *again*, reports keyup, exits.

The result would be (if I understood the timer implementation correctly) that a keyup event is reported immediately after the second ISR even though the "first" timer function call should have been cancelled/pushed further into the future at that point.

Does this make any sense? :)

Quoted 9 lines

drivers/input/misc/winbond-cir.c line 549

Quoted 6 lines
drivers/input/misc/winbond-cir.c new file +6 -0
+static void
+add_irdata_bit(struct wbcir_data *data, int set)
+{
+	if (set)
+		data->irdata[data->irdata_count / 8] |=
+			0x01 << (data->irdata_count % 8);

Can/should this use generic___set_le_bit() or similar, rather than open-coding it?

Will look into it...

You also had various code-comment objections which I'll take care of.

Thanks for the prompt review.

Regards,
David

#14 lore raw

Re: [PATCH 2/2] Add a driver for the Winbond WPCD376I IR functionality.

Quoted 8 lines · On Wed, 1 Jul 2009 09:47:46 +0200 (CEST) David H__rdeman <[email protected]>…
Quoted 5 lines

drivers/input/misc/winbond-cir.c line 397

Quoted 3 lines
drivers/input/misc/winbond-cir.c new file +3 -0
+	struct wbcir_data *data = input_get_drvdata(dev);
+
+	if (scancode < 0 || scancode > 0xFFFFFFFF)

Neither of the comparisons in this expression can ever be true.

Didn't know if I could be certain that int is always 32 bit on all platforms which use/might use the chip...can I?

Yep, int and unsigned int are always 32-bit.

It's not a big deal at all - the compiler will optimise the tests away completely. The tests may have some value as code commentary, and they provide robustness should someone change the type of `scancode'.

Quoted 41 lines
Quoted 8 lines

drivers/input/misc/winbond-cir.c line 400

Quoted 3 lines
drivers/input/misc/winbond-cir.c new file +3 -0
+		return -EINVAL;
+
+	*keycode = (int)wbcir_do_getkeycode(data, (u32)scancode);

uneeded casts.

Something has gone wrong with the types here. Where does the fault lie
- this driver, or input core?

Two issues:

a) the input layer API confused me

include/linux/input.h provides:

struct input_event {
         struct timeval time;
         __u16 type;
         __u16 code;
         __s32 value;
};

(keycode is an unsigned 16 bit integer)

int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); int input_set_keycode(struct input_dev *dev, int scancode, int keycode);

(keycode is an int)

static inline void input_report_key(struct input_dev *dev,
unsigned int code, int value)

{
        input_event(dev, EV_KEY, code, !!value);
}

(keycode is an uint)

b) 32 bit scancodes

Quoted 7 lines

I wanted to use 32 bit scancodes in my driver since the largest IR message supported by the driver is RC6 mode 6A which can potentially have a 1 + 15 bits "customer" field + 8 bits address + 8 bits command = 32 bits.

Casting the int scancode passed to input_[get__set]_keycode to an uint and assuming it would be at least 32 bits on all platforms using the chip was the best solution I could come up with without changing the input API.

erp. Hopefully this is all something which Dmitry can help us with.

Quoted 50 lines
Quoted 5 lines
Quoted 5 lines
drivers/input/misc/winbond-cir.c new file +5 -0
+{
+        struct wbcir_data *data = (struct wbcir_data *)cookie;
+        unsigned long flags;
+
+        /*
Quoted 8 lines

drivers/input/misc/winbond-cir.c line 473

Quoted 4 lines
drivers/input/misc/winbond-cir.c new file +4 -0
+         * data->keyup_jiffies is used to prevent a race condition if a
+         * hardware interrupt occurs at this point and the keyup timer
+         * event is moved further into the future as a result.
+         */

hm. I don't see what the race is, nor how the comparison fixes it. If I _did_ understand this, perhaps I could suggest alternative fixes. But I don't so I can't. Oh well.

When the interrupt service routine detects an IR command it reports a keydown event and sets a timer to report a keyup event in the future if no repeated ir messages are detected (in which case the timer-driven keyup should be pushed further into the future to allow the input core to do its auto-repeat-handling magic).

What I wanted to protect against was something like this:

Thread 1 Thread 2
-------- --------
ISR called, grabs
wbcir_lock, reports
keydown for key X,
sets up keyup timer,
releases lock, exits

(many ms later)

keyup timer function called and preempted before grabbing wbcir_lock

ISR called, grabs wbcir_lock,
notices a repeat event for
key X, pushes the keyup timer
further into the future using
mod_timer (thus reenabling the
timer), releases lock, exits
keyup timer function grabs wbcir_lock, reports keyup, exits.
(many ms later)

keyup timer function called *again*, reports keyup, exits.

Quoted 6 lines

The result would be (if I understood the timer implementation correctly) that a keyup event is reported immediately after the second ISR even though the "first" timer function call should have been cancelled/pushed further into the future at that point.

Does this make any sense? :)

yes. The timer will be rescheduledin the scenario which you describe.

Here's my problem: often when I ask a question about some code, what I _really_ mean is "if I didn't understand this code today, others probably won't understand it when reading it a year from now. Hence it perhaps needs additional commentary to prevent this". But I tire of complaining about code comments ;)

#15 lore raw

Re: [PATCH 2/2] Add a driver for the Winbond WPCD376I IR functionality.

Quoted 5 lines · Andrew Morton
Quoted 3 lines · On Wed, 1 Jul 2009 09:47:46 +0200 (CEST) David Härdeman <[email protected]>…
Quoted 2 lines

Something has gone wrong with the types here. Where does the fault lie
- this driver, or input core?

Quoted 8 lines
Quoted 6 lines

Two issues:

a) the input layer API confused me
...
b) 32 bit scancodes
...

erp. Hopefully this is all something which Dmitry can help us with.

I'll wait for feedback from Bjorn Helgaas and Dmitry, meanwhile I've updated the patch to (hopefully) fix all the other issues you've raised, I'll send it in a separate mail.

Signature · 5 lines
David Härdeman
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#16 lore raw

PATCH 2/2 Add a driver for the Winbond WPCD376I IR functionality.

In reply to Andrew Morton

This patch adds a driver for the the Consumer IR (CIR) functionality of the Winbond WPCD376I chipset (found on e.g. Intel DG45FC motherboards).

Changes since the driver was first posted to the list:
o Homebrew dprintk -> dev_dbg
o Some magic values changed to defines
o Fixed a bug where the wake-ir-command mask/value would not be written properly
o Fixed the use of the invert parameter both for wake and normal IR reception.

Changes since the second post to the list (AKPM's remarks):
o Various comments added
o Removed some casts
o use bitrev8
o convert data->irdata to unsigned longs, use __set_bit and test_bit

Andrew, please replace the patch you currently have in the -mm tree with this one.

---
 MAINTAINERS                      |    6 +
 drivers/input/misc/Kconfig       |   15 +
 drivers/input/misc/Makefile      |    1 +
 drivers/input/misc/winbond-cir.c | 1694 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 1716 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/winbond-cir.c
MAINTAINERS +6 -0
index 381190c..9840cd4 100644
@@ -6438,6 +6438,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/scsi/wd7000.c
 
+WINBOND CIR DRIVER
+P:	David Härdeman
+M:	[email protected]
+S:	Maintained
+F:	drivers/input/misc/winbond-cir.c
+
 WIMAX STACK
 P:	Inaky Perez-Gonzalez
 M:	[email protected]
drivers/input/misc/Kconfig +15 -0
index 1acfa3a..0fdf249 100644
@@ -269,4 +269,19 @@ config INPUT_DM355EVM
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called dm355evm_keys.
+
+config INPUT_WINBOND_CIR
+	tristate "Winbond IR remote control"
+	depends on X86 && ACPI
+	select LEDS_CLASS
+	help
+	  Say Y here if you want to use the IR remote functionality found
+	  in some Winbond SuperI/O chips. Currently only the WPCD376I
+	  chip is supported (included in some Intel Media series motherboards).
+
+	  IR Receive and wake-on-IR from suspend and power-off is currently
+	  supported.
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called winbond_cir.
 endif
drivers/input/misc/Makefile +1 -0
index 0d979fd..19d420e 100644
@@ -26,3 +26,4 @@ obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
 obj-$(CONFIG_INPUT_UINPUT)		+= uinput.o
 obj-$(CONFIG_INPUT_WISTRON_BTNS)	+= wistron_btns.o
 obj-$(CONFIG_INPUT_YEALINK)		+= yealink.o
+obj-$(CONFIG_INPUT_WINBOND_CIR)		+= winbond-cir.o
drivers/input/misc/winbond-cir.c new file +1694 -0

1,694 lines not on this page · raw message

Signature · 5 lines
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v1 2/2
#17 lore raw

Re: [PATCH 2/2] Add a driver for the Winbond WPCD376I IR functionality.

Quoted 18 lines · On Wed, 1 Jul 2009 23:47:53 +0200 David Härdeman <[email protected]> wrote:

This patch adds a driver for the the Consumer IR (CIR) functionality of the Winbond WPCD376I chipset (found on e.g. Intel DG45FC motherboards).

Changes since the driver was first posted to the list:
o Homebrew dprintk -> dev_dbg
o Some magic values changed to defines
o Fixed a bug where the wake-ir-command mask/value would not be written properly
o Fixed the use of the invert parameter both for wake and normal IR reception.

Changes since the second post to the list (AKPM's remarks):
o Various comments added
o Removed some casts
o use bitrev8
o convert data->irdata to unsigned longs, use __set_bit and test_bit

Quoted 4 lines

Andrew, please replace the patch you currently have in the -mm tree with this one.

Looking nice to me... Thanks for writing this, David.

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html