Skip to contentSkip to conversation

input: Add support for ECI (multimedia) accessories

PATCH Superseded [email protected] 2 participants 6 messages Dec 22, 2010

Subsystems (2)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover input: Add support for ECI (multimedia) accessories

From: Tapio Vihuri <[email protected]>

Hi all

This patch set introduce Multimedia Headset Accessory support for Nokia phones. Technically those are known as ECI (Enhancement Control Interface)

If headset has many buttons, like play, vol+, vol- etc. then it is propably ECI accessory.

Among several buttons ECI accessories contains memory for storing several parameters.

This ECI input driver provides the following features:
- reading ECI configuration memory
- ECI buttons as input events

Drive is constructed as follows:
- ECI accessory input driver deals with headset accessory
- ECI bus control driver deals the HW transfering data to/from headset
- platform data match used HW

In the future accessory detection logic will be added using ALSA jack reporting.

Created against linux-2.6.37-rc6

Please review.

Tapio Vihuri (3):
ECI: input: introduce ECI accessory input driver
ECI: introducing ECI bus driver
ECI: adding platform data for ECI driver

 arch/x86/platform/mrst/mrst.c |   59 +++
 drivers/Kconfig               |    2 +
 drivers/Makefile              |    1 +
 drivers/ecibus/Kconfig        |   46 ++
 drivers/ecibus/Makefile       |   10 +
 drivers/ecibus/ecibus.c       |  583 ++++++++++++++++++++++++
 drivers/input/misc/Kconfig    |   18 +
 drivers/input/misc/Makefile   |    2 +-
 drivers/input/misc/eci.c      | 1002 +++++++++++++++++++++++++++++++++++++++++
 include/linux/input/eci.h     |  165 +++++++
 10 files changed, 1887 insertions(+), 1 deletions(-)
 create mode 100644 drivers/ecibus/Kconfig
 create mode 100644 drivers/ecibus/Makefile
 create mode 100644 drivers/ecibus/ecibus.c
 create mode 100644 drivers/input/misc/eci.c
 create mode 100644 include/linux/input/eci.h
#1 lore raw

PATCH 1/3 ECI: input: introduce ECI accessory input driver

From: Tapio Vihuri <[email protected]>

ECI stands for (Enhancement Control Interface).

ECI is better known as Multimedia Headset for Nokia phones.
If headset has many buttons, like play, vol+, vol- etc. then it is propably ECI accessory.
Among several buttons ECI accessory contains memory for storing several parameters.

ECI input driver provides the following features:
- reading ECI configuration memory
- ECI buttons as input events

---
 drivers/input/misc/Kconfig  |   18 +
 drivers/input/misc/Makefile |    2 +-
 drivers/input/misc/eci.c    | 1002 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/input/eci.h   |  157 +++++++
 4 files changed, 1178 insertions(+), 1 deletions(-)
 create mode 100644 drivers/input/misc/eci.c
 create mode 100644 include/linux/input/eci.h
drivers/input/misc/Kconfig +18 -0
index b99b8cb..7a15bc6 100644
@@ -448,4 +448,22 @@ config INPUT_ADXL34X_SPI
 	  To compile this driver as a module, choose M here: the
 	  module will be called adxl34x-spi.
 
+config INPUT_ECI
+	tristate "AV ECI (Enhancement Control Interface) input driver"
+	help
+	The Enhancement Control Interface functionality
+	  ECI is better known as Multimedia Headset for Nokia phones.
+	  If headset has many buttons, like play, vol+, vol- etc. then
+	  it is propably ECI accessory.
+	  Among several buttons ECI accessory contains memory for storing
+	  several parameters.
+
+	  ECI input driver provides the following features:
+	  - reading ECI configuration memory
+	  - ECI buttons as input events
+
+	  Say 'y' here to statically link this module into the kernel or 'm'
+	  to build it as a dynamically loadable module. The module will be
+	  called eci.ko
+
 endif
drivers/input/misc/Makefile +1 -1
index 1fe1f6c..99d2289 100644
@@ -42,4 +42,4 @@ obj-$(CONFIG_INPUT_WINBOND_CIR)		+= winbond-cir.o
 obj-$(CONFIG_INPUT_WISTRON_BTNS)	+= wistron_btns.o
 obj-$(CONFIG_INPUT_WM831X_ON)		+= wm831x-on.o
 obj-$(CONFIG_INPUT_YEALINK)		+= yealink.o
-
+obj-$(CONFIG_INPUT_ECI)			+= eci.o
drivers/input/misc/eci.c new file +1002 -0

1,002 lines not on this page · raw message

include/linux/input/eci.h new file +157 -0

157 lines not on this page · raw message

Signature · 1 line
1.6.5
#2 lore raw

PATCH 2/3 ECI: introducing ECI bus driver

From: Tapio Vihuri <[email protected]>

ECI bus controller is kind of bridge between host CPU I2C and ECI accessory ECI communication.

---
 drivers/Kconfig           |    2 +
 drivers/Makefile          |    1 +
 drivers/ecibus/Kconfig    |   46 ++++
 drivers/ecibus/Makefile   |   10 +
 drivers/ecibus/ecibus.c   |  583 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/input/eci.h |    8 +
 6 files changed, 650 insertions(+), 0 deletions(-)
 create mode 100644 drivers/ecibus/Kconfig
 create mode 100644 drivers/ecibus/Makefile
 create mode 100644 drivers/ecibus/ecibus.c
drivers/Kconfig +2 -0
index a2b902f..f450f98 100644
@@ -111,4 +111,6 @@ source "drivers/xen/Kconfig"
 source "drivers/staging/Kconfig"
 
 source "drivers/platform/Kconfig"
+
+source "drivers/ecibus/Kconfig"
 endmenu
drivers/Makefile +1 -0
index f3ebb30..11f5d57 100644
@@ -113,5 +113,6 @@ obj-$(CONFIG_SSB)		+= ssb/
 obj-$(CONFIG_VHOST_NET)		+= vhost/
 obj-$(CONFIG_VLYNQ)		+= vlynq/
 obj-$(CONFIG_STAGING)		+= staging/
+obj-$(CONFIG_ECI)		+= ecibus/
 obj-y				+= platform/
 obj-y				+= ieee802154/
drivers/ecibus/Kconfig new file +46 -0

46 lines not on this page · raw message

drivers/ecibus/Makefile new file +10 -0
new file mode 100644
index 0000000..ce4206b
@@ -0,0 +1,10 @@
+#
+# Makefile for kernel ECI drivers.
+#
+
+ifeq ($(CONFIG_ECI_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
+
+# ECI master controller drivers (bus)
+obj-$(CONFIG_ECI_BUS)			+= ecibus.o
drivers/ecibus/ecibus.c new file +583 -0

583 lines not on this page · raw message

include/linux/input/eci.h +8 -0
index b8be99c..a9d1008 100644
@@ -154,4 +154,12 @@ struct eci_data {
 };
 
 struct eci_cb *eci_register(struct eci_hw_ops *eci_ops);
+
+/* ecibus controller data */
+struct ecibus_platform_data {
+	int			ecibus_rst_gpio;
+	int			ecibus_sw_ctrl_gpio;
+	int			ecibus_int_gpio;
+};
+
 #endif
Signature · 1 line
1.6.5
#3 lore raw

PATCH 3/3 ECI: adding platform data for ECI driver

From: Tapio Vihuri <[email protected]>

Gives platform data for ECI accessory input driver and ECI bus controller driver.

---
 arch/x86/platform/mrst/mrst.c |   59 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)
arch/x86/platform/mrst/mrst.c +59 -0
index 79ae681..60dca78 100644
@@ -14,6 +14,7 @@
 #include <linux/sfi.h>
 #include <linux/irq.h>
 #include <linux/module.h>
+#include <linux/platform_device.h>
 
 #include <asm/setup.h>
 #include <asm/mpspec_def.h>
@@ -309,3 +310,61 @@ static inline int __init setup_x86_mrst_timer(char *arg)
 	return 0;
 }
 __setup("x86_mrst_timer=", setup_x86_mrst_timer);
+
+#if defined(CONFIG_ECI) || defined(CONFIG_ECI_MODULE)
+#include <linux/input/eci.h>
+
+#define GPIO_ECI_RSTn		126	/* GP_CORE_030 + 96 */
+#define GPIO_ECI_SW_CTRL	178	/* GP_CORE_082 + 96 */
+#define GPIO_ECI_INT		16	/* GP_AON_016 */
+
+static struct ecibus_platform_data medfield_ecibus_control = {
+	.ecibus_rst_gpio = GPIO_ECI_RSTn,
+	.ecibus_sw_ctrl_gpio = GPIO_ECI_SW_CTRL,
+	.ecibus_int_gpio = GPIO_ECI_INT,
+};
+
+/*
+ * This is just example, should be used in platform audio driver
+ * hsmic_event->event(hsmic_event->private, true)
+ */
+static void medfield_register_hsmic_event_cb(struct audio_hsmic_event *event)
+{
+	struct audio_hsmic_event *hsmic_event;
+
+	hsmic_event = event;
+}
+
+static struct eci_platform_data medfield_eci_platform_data = {
+	.register_hsmic_event_cb	= medfield_register_hsmic_event_cb,
+};
+
+static struct platform_device medfield_ecibus_device = {
+	.name	= "ecibus",
+	.id	= 1,
+	.dev	= {
+		.platform_data = &medfield_ecibus_control,
+	},
+};
+
+static struct platform_device medfield_eci_device = {
+	.name	= "ECI_accessory",
+	.dev	= {
+		.platform_data = &medfield_eci_platform_data,
+	},
+};
+
+static int __init medfield_ecibus_init(void)
+{
+	int retval;
+
+	retval = platform_device_register(&medfield_ecibus_device);
+	if (retval < 0)
+		return retval;
+
+	retval = platform_device_register(&medfield_eci_device);
+
+	return retval;
+}
+device_initcall(medfield_ecibus_init);
+#endif
Signature · 1 line
1.6.5
#4 lore raw

Re: [PATCH 2/3] ECI: introducing ECI bus driver

In reply to [email protected]
Quoted 6 lines · On Wed, 22 Dec 2010 14:20:34 +0200 [email protected] wrote:

From: Tapio Vihuri <[email protected]>

ECI bus controller is kind of bridge between host CPU I2C and ECI accessory ECI communication.

Quoted 11 lines
---
 drivers/Kconfig           |    2 +
 drivers/Makefile          |    1 +
 drivers/ecibus/Kconfig    |   46 ++++
 drivers/ecibus/Makefile   |   10 +
 drivers/ecibus/ecibus.c   |  583 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/input/eci.h |    8 +
 6 files changed, 650 insertions(+), 0 deletions(-)
 create mode 100644 drivers/ecibus/Kconfig
 create mode 100644 drivers/ecibus/Makefile
 create mode 100644 drivers/ecibus/ecibus.c

ERROR: "intel_scu_ipc_iowrite8" [drivers/ecibus/ecibus.ko] undefined!

You must have had some kernel config enabled that I don't have enabled when you built this. Please fix Kconfig files so that this won't happen.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts: http://www.xenotime.net/linux/recipes/

#5 lore raw

Re: [PATCH 2/3] ECI: introducing ECI bus driver

In reply to [email protected]
Quoted 49 lines · On Wed, 22 Dec 2010 14:20:34 +0200 [email protected] wrote:

From: Tapio Vihuri <[email protected]>

ECI bus controller is kind of bridge between host CPU I2C and ECI accessory ECI communication.

---
 drivers/Kconfig           |    2 +
 drivers/Makefile          |    1 +
 drivers/ecibus/Kconfig    |   46 ++++
 drivers/ecibus/Makefile   |   10 +
 drivers/ecibus/ecibus.c   |  583 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/input/eci.h |    8 +
 6 files changed, 650 insertions(+), 0 deletions(-)
 create mode 100644 drivers/ecibus/Kconfig
 create mode 100644 drivers/ecibus/Makefile
 create mode 100644 drivers/ecibus/ecibus.c
drivers/ecibus/Kconfig new file +24 -0
new file mode 100644
index 0000000..27e5e36
@@ -0,0 +1,46 @@
+#
+# ECI driver configuration
+#
+menuconfig ECI
+	bool "ECI support"
+	help
+	  ECI (Enhancement Control Interface) accessory support
+
+	  The Enhancement Control Interface functionality
+	  ECI is better known as Multimedia Headset for Nokia phones.
+	  If headset has many buttons, like play, vol+, vol- etc. then
+	  it is propably ECI accessory.
+	  Among several buttons ECI accessory contains memory for storing
+	  several parameters.
+
+	  Enable ECI support in terminal so that ECI input driver is able
+	  to communicate with ECI accessory
+
+if ECI
+
+config ECI_DEBUG
+	boolean "Debug support for ECI drivers"
+	depends on DEBUG_KERNEL
+	help

drivers/ecibus/Kconfig line 34

Quoted 10 lines
drivers/ecibus/Kconfig new file +10 -0
+	  Selects ECI driver debug messaging.
+
+	  Say "yes" to enable debug messaging (like dev_dbg and pr_debug),
+	  sysfs, and debugfs support in ECI controller.
+
+comment "ECI Master Controller Drivers"
+
+config ECI_BUS
+	tristate "ECI bus controller driver"
+	select INPUT_ECI

'select' INPUT_ECI when INPUT and/or INPUT_MISC are not enabled causes this kconfig warning:

warning: (ECI_BUS && ECI) selects INPUT_ECI which has unmet direct dependencies (!S390 && INPUT && INPUT_MISC)

drivers/ecibus/Kconfig line 46

Quoted 12 lines
drivers/ecibus/Kconfig new file +12 -0
+	help
+	  This selects a driver for the ECI bus controller
+
+	  ECI bus controller is kind of bridge between host CPU I2C and
+	  ECI accessory ECI communication.
+
+	  Say 'y' here to statically link this module into the kernel or 'm'
+	  to build it as a dynamically loadable module. The module will be
+	  called ecibus.ko
+
+
+endif # ECI

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts: http://www.xenotime.net/linux/recipes/