Skip to contentSkip to conversation

input: Add support for ECI (multimedia) accessories

PATCH Superseded [email protected] 2 participants 5 messages Jan 4, 2011 – Jan 5, 2011

Subsystems (2)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover input: Add support for ECI (multimedia) accessories

From: Tapio Vihuri <[email protected]>

Thank you for comments.

ECI input driver changes:

- Makefile and Kconfig sorted alphabetically
- using sparse keymap library, much cleaner solution
- correct string aligment with 80 column
- debugfs initialization fix
- sysfs cable entry using just 0/1
- using cheaper __set_bit
- insane comments fixed
- remove unneeded misc device

Created against linux-2.6.37-rc8 at:
989d873 Merge master.kernel.org:/home/rmk/linux-2.6-arm

--- v2 message ---

Thank you for comments.

In series two there Kconfig dependency problem fixed, preventing compilation if X86_MRST (Intel Moorestown) or INPUT_MISC is not selected.

Also created against linux-2.6.37-rc8

--- v1 message ---

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        |   35 ++
 drivers/ecibus/Makefile       |   10 +
 drivers/ecibus/ecibus.c       |  583 +++++++++++++++++++++++++
 drivers/input/misc/Kconfig    |   19 +
 drivers/input/misc/Makefile   |    2 +-
 drivers/input/misc/eci.c      |  945 +++++++++++++++++++++++++++++++++++++++++
 include/linux/input/eci.h     |  165 +++++++
 10 files changed, 1820 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 v3 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  |   19 +
 drivers/input/misc/Makefile |    2 +-
 drivers/input/misc/eci.c    |  945 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/input/eci.h   |  157 +++++++
 4 files changed, 1122 insertions(+), 1 deletions(-)
 create mode 100644 drivers/input/misc/eci.c
 create mode 100644 include/linux/input/eci.h
drivers/input/misc/Kconfig +19 -0
index b99b8cb..f106c5d 100644
@@ -114,6 +114,25 @@ config INPUT_APANEL
 	 To compile this driver as a module, choose M here: the module will
 	 be called apanel.
 
+config INPUT_ECI
+	tristate "AV ECI (Enhancement Control Interface) input driver"
+	select INPUT_SPARSEKMAP
+	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
+
 config INPUT_IXP4XX_BEEPER
 	tristate "IXP4XX Beeper support"
 	depends on ARCH_IXP4XX
drivers/input/misc/Makefile +1 -1
index 1fe1f6c..8f51a4c 100644
@@ -21,6 +21,7 @@ obj-$(CONFIG_INPUT_CM109)		+= cm109.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)		+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
 obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
+obj-$(CONFIG_INPUT_ECI)			+= eci.o
 obj-$(CONFIG_INPUT_IXP4XX_BEEPER)	+= ixp4xx-beeper.o
 obj-$(CONFIG_INPUT_KEYSPAN_REMOTE)	+= keyspan_remote.o
 obj-$(CONFIG_INPUT_M68K_BEEP)		+= m68kspkr.o
@@ -42,4 +43,3 @@ 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
-
drivers/input/misc/eci.c new file +945 -0

945 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 v3 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    |   35 +++
 drivers/ecibus/Makefile   |   10 +
 drivers/ecibus/ecibus.c   |  583 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/input/eci.h |    8 +
 6 files changed, 639 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 +35 -0
new file mode 100644
index 0000000..f2fc8a4
@@ -0,0 +1,35 @@
+#
+# 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_BUS
+	tristate "ECI bus controller driver"
+	select INPUT_ECI
+	depends on X86_MRST && INPUT_MISC
+	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
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 0e22404..a0b5d20 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 v3 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: [alsa-devel] [PATCH v3 2/3] ECI: introducing ECI bus driver

In reply to [email protected]

Hi,

Quoted 4 lines · On 01/04/11 16:02, ext [email protected] wrote:

From: Tapio Vihuri <[email protected]>

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

There seams to be no change between v2 and v3 in regards to this micro controller driver, so my comments on the v2 applies here as well.

Would you rename the driver (to something other than ecibus)? If the intention is to make this driver only work on Intel's Moorestown platform, then be it, but you should mention it explicitly in the Kconfig, and the driver name shall reflect the same as well.

My comments on the intel specific intel_scu_ipc_iowrite8, and the i2c part still holds.

Thanks,
Péter