input: Add support for ECI (multimedia) accessories
Subsystems (2)
v6 cover input: Add support for ECI (multimedia) accessories
From: Tapio Vihuri <[email protected]>
Thank you for comments.
ECI input driver changes:
- Add debuging config option with adequate "help" in Kconfig
- Clean out debug messages
- Clean out error messages
- Force all buttons up event when unplugging accessory
ECI controller driver changes:
- Remove unused debuging config option
Created against linux-2.6.38-rc2 at:
70d1f36 Merge branch 'for-linus' of git://git.infradead.org/ubi-2.6
Please review.
--- v5 message ---
Thank you for comments.
ECI input driver changes:
- Use sparse_keymap_setup() properly, remove unneeded input set_bits
ECI controller driver changes:
- Added "button" debugfs entry for input driver buttons handling testing
--- v4 message ---
Thank you for comments.
ECI input driver changes:
- Use driver name in debugfs
- reject accessory stating more than maximum 31 buttons
- clean out couple comments
ECI controller driver changes:
- name change, from ecibus to eci_xxx_ctrl
- location change, from drivers/ecibus to drivers/input/misc
- major rework from platform driver to i2c-driver
- removed mrst platform dependency
Checkpatch warn about Kconfig, but I think it is false positive, and I will report it to the maintainer.
Platform code changes:
- medfield_ prefix changed to mrst_
- added ECI controller needed power control
- remover ECI controller platform driver stuff
- added i2c stuff for ECI controller driver
Created against linux-2.6.37-rc8 at:
a25cecc Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze
--- v3 message ---
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 controller driver
ECI: adding platform data for ECI driver
arch/x86/platform/mrst/mrst.c | 48 ++ drivers/input/misc/Kconfig | 65 +++ drivers/input/misc/Makefile | 3 +- drivers/input/misc/eci.c | 949 ++++++++++++++++++++++++++++++++++++ drivers/input/misc/eci_at20_ctrl.c | 566 +++++++++++++++++++++ include/linux/input/eci.h | 179 +++++++ 6 files changed, 1809 insertions(+), 1 deletions(-) create mode 100644 drivers/input/misc/eci.c create mode 100644 drivers/input/misc/eci_at20_ctrl.c create mode 100644 include/linux/input/eci.h
PATCH v6 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 | 48 +++ drivers/input/misc/Makefile | 2 +- drivers/input/misc/eci.c | 949 +++++++++++++++++++++++++++++++++++++++++++ include/linux/input/eci.h | 157 +++++++ 4 files changed, 1155 insertions(+), 1 deletions(-) create mode 100644 drivers/input/misc/eci.c create mode 100644 include/linux/input/eci.h
drivers/input/misc/Kconfig +48 -0
@@ -114,6 +114,54 @@ config INPUT_APANEL To compile this driver as a module, choose M here: the module will be called apanel. +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 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 ECI_DEBUG + bool "ECI driver debug" + depends on INPUT_ECI + help + Say Y here to enable debugging messages for ECI input driver. + + Ease understanding ECI accessory configuration embedded in + accessory's memory. + Add memory and buttons parsing info to module eci.ko + +endif # ECI + config INPUT_IXP4XX_BEEPER tristate "IXP4XX Beeper support" depends on ARCH_IXP4XX
drivers/input/misc/Makefile +1 -1
@@ -23,6 +23,7 @@ obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.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
@@ -43,4 +44,3 @@ obj-$(CONFIG_INPUT_UINPUT) += uinput.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 +949 -0
949 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
PATCH v6 2/3 ECI: introducing ECI controller driver
From: Tapio Vihuri <[email protected]>
ECI controller is kind of bridge between host CPU I2C and ECI accessory ECI communication.
--- drivers/input/misc/Kconfig | 17 + drivers/input/misc/Makefile | 1 + drivers/input/misc/eci_at20_ctrl.c | 566 ++++++++++++++++++++++++++++++++++++ include/linux/input/eci.h | 24 ++- 4 files changed, 607 insertions(+), 1 deletions(-) create mode 100644 drivers/input/misc/eci_at20_ctrl.c
drivers/input/misc/Kconfig +17 -0
@@ -146,6 +146,9 @@ config INPUT_ECI - reading ECI configuration memory - ECI buttons as input events + ECI input driver needs some ECI controller driver, select + suitable controlelr driver(s) below. + 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
@@ -160,6 +163,20 @@ config ECI_DEBUG accessory's memory. Add memory and buttons parsing info to module eci.ko +config INPUT_ECI_AT20 + tristate "ECI controller driver" + select INPUT_ECI + depends on X86_MRST && INPUT_MISC + help + This selects a driver for the ECI controller + + ECI 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 eci_at20_ctrl.ko + endif # ECI config INPUT_IXP4XX_BEEPER
drivers/input/misc/Makefile +1 -0
@@ -24,6 +24,7 @@ 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_ECI_AT20) += eci_at20_ctrl.o obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
drivers/input/misc/eci_at20_ctrl.c new file +566 -0
566 lines not on this page · raw message
include/linux/input/eci.h +23 -1
@@ -1,7 +1,7 @@/* * This file is part of ECI (Enhancement Control Interface) driver * -* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). * * Contact: Tapio Vihuri <[email protected]> *
@@ -35,6 +35,21 @@#define ECI_REAL_BUTTONS 0#define ECI_FORCE_BUTTONS_UP 1 +/* +* VPROG2CNT - VPROG2 Control Register +* 2.5V | normal | normal +* 10 | 111 | 111 +* 2.5V | off | off +* 10 | 100 | 100 +*/ +#define AvP_MSIC_VPROG2 0xd7 +#define AvP_MSIC_VPROG2_2V5_ON 0xbf +#define AvP_MSIC_VPROG2_2V5_OFF 0xa4 + +#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 */ +/* fixed in ECI HW, do not change */ enum {ECICMD_HWID ,
@@ -154,4 +169,11 @@ struct eci_data { };struct eci_cb *eci_register (struct eci_hw_ops *eci_ops); + +/* eci controller data */ +struct eci_ctrl_platform_data { +int eci_ctrl_rst_gpio; +int eci_ctrl_sw_ctrl_gpio; +int eci_ctrl_int_gpio; +};#endif
Signature · 1 line
1.6.5
PATCH v6 3/3 ECI: adding platform data for ECI driver
From: Tapio Vihuri <[email protected]>
Gives platform data for ECI accessory input driver and ECI controller driver.
--- arch/x86/platform/mrst/mrst.c | 48 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-)
arch/x86/platform/mrst/mrst.c +48 -0
@@ -24,6 +24,7 @@#include <linux/platform_device.h> #include <linux/irq.h> #include <linux/module.h> +#include <linux/input/eci.h> #include <asm/setup.h> #include <asm/mpspec_def.h>
@@ -478,6 +479,16 @@ static void __init *no_platform_data(void *info)return NULL ; } +static void *eci_ctrl_platform_data_init (void *info) +{ +static struct eci_ctrl_platform_data mrst_eci_ctrl_data = { + .eci_ctrl_rst_gpio = GPIO_ECI_RSTn, + .eci_ctrl_sw_ctrl_gpio =GPIO_ECI_SW_CTRL , + .eci_ctrl_int_gpio =GPIO_ECI_INT , + }; +return &mrst_eci_ctrl_data; +} +static const struct devs_id __initconst device_ids[] = { {"pmic_gpio" ,SFI_DEV_TYPE_SPI ,1 , &pmic_gpio_platform_data}, {"spi_max3111" ,SFI_DEV_TYPE_SPI ,0 , &max3111_platform_data},
@@ -487,6 +498,7 @@ static const struct devs_id __initconst device_ids[] = { {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, {"msic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, + {"eci_ctrl", SFI_DEV_TYPE_I2C, 0, &eci_ctrl_platform_data_init}, {}, };
@@ -659,6 +671,42 @@ static void __init sfi_handle_i2c_dev(int bus, struct i2c_board_info *i2c_info)i2c_register_board_info (bus, i2c_info,1 ); } +/* +* This is just example, should be used in platform audio driver +* hsmic_event->event(hsmic_event->private, true) +*/ +static void mrst_register_hsmic_event_cb (struct audio_hsmic_event *event) +{ +struct audio_hsmic_event *hsmic_event; + + hsmic_event = event; +} + +static struct eci_platform_data mrst_eci_data = { + .register_hsmic_event_cb = mrst_register_hsmic_event_cb, +}; + +static struct platform_device mrst_eci_device = { + .name ="ECI_accessory" , + .dev = { + .platform_data = &mrst_eci_data, + }, +}; + +static int __init mrst_eci_init (void ) +{ +int retval; + + retval =platform_device_register (&mrst_eci_device); +if (retval <0 ) +return retval; + +/* Turn on vprog2 */ +intel_scu_ipc_iowrite8 (AvP_MSIC_VPROG2, AvP_MSIC_VPROG2_2V5_ON); + +return retval; +} +device_initcall (mrst_eci_init);static int __init sfi_parse_devs (struct sfi_table_header *table) {
Signature · 1 line
1.6.5
Dmitry Torokhov
maintainerHi Tapio,
Quoted 10 lines · On Mon, Jan 31, 2011 at 04:03:51PM +0200, [email protected] wrote:
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.
Quoted 8 lines
This ECI input driver provides the following features:
- reading ECI configuration memory
- ECI buttons as input eventsDrive 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
I finally had a chance to look though the patches more closely and I do not understand why you decided to introduce the platform device in addition to I2C device. You end up with 2 artificially separated bodies of code that are not viable on their own. The ECI module with it's platform device is not usable without the controller; the controller can not be registered without the ECI device initialized; there are ordering issues, both initialization and PM-wise and you are forced to support only one device.
Is there going to be an SPI interface as well? If not then fold it all together and have I2C device as the only device involved. If SPI is a possibility then look in drivers such as adxl34x, ad714x and others that are split into core module and bus interface implementations.
Thanks.
Signature · 1 line
Dmitry
Quoted 31 lines · ext Dmitry Torokhov
Hi Tapio,
Quoted 10 lines · On Mon, Jan 31, 2011 at 04:03:51PM +0200, [email protected] wrote:
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.
Quoted 8 lines
This ECI input driver provides the following features:
- reading ECI configuration memory
- ECI buttons as input eventsDrive 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 HWI finally had a chance to look though the patches more closely and I do not understand why you decided to introduce the platform device in addition to I2C device. You end up with 2 artificially separated bodies of code that are not viable on their own. The ECI module with it's platform device is not usable without the controller; the controller can not be registered without the ECI device initialized; there are ordering issues, both initialization and PM-wise and you are forced to support only one device.
Quoted 7 lines
Is there going to be an SPI interface as well? If not then fold it all together and have I2C device as the only device involved. If SPI is a possibility then look in drivers such as adxl34x, ad714x and others that are split into core module and bus interface implementations.
Thanks.
Hi Dmitry
Thank you for reviewing.
The reasoning for separating driver to the two parts is having both common and different hardware.
The ECI input, as platform device is common part and only dealing with the accessory HW (meaning the headset accessory).
This is standardiced part of system, where specification guarantee HW behaving same way accross several headset accessories.
The accessory is plugged to the terminal using four pin AV-cable, much same way as USB mouse.
I just didn't see need to introduce new bus type for one wire ECI data link, hence platform device.
The ECI controller, as I2C device is the variable part of the system. In this case it's microcontroller in I2C bus, but there are other versions too.
There is no specification about these controller's internals, and those are quite different.
It is also possible to use other buses too for connecting controller to terminal, like SPI.
The idea was that if ECI is used in device, just take ECI input driver and select the ECI controller which is used in the platform.
And as long as the ECI controller driver use the same interface to ECI input driver, evetrything works OK.
This allows also dynamic selection of used control device. I mean we can compile several ECI controllers as modules and detect the HW at initialization.
I use the ad714x as example, but I can take second look on that too.
Please let me know if this is making sense.
Thanks,
Tapio
Dmitry Torokhov
maintainerQuoted 73 lines · Tapio Vihuri
Quoted 31 lines · ext Dmitry Torokhov
Hi Tapio,
Quoted 10 lines · On Mon, Jan 31, 2011 at 04:03:51PM +0200, [email protected] wrote:
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.
Quoted 8 lines
This ECI input driver provides the following features:
- reading ECI configuration memory
- ECI buttons as input eventsDrive 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 HWI finally had a chance to look though the patches more closely and I do not understand why you decided to introduce the platform device in addition to I2C device. You end up with 2 artificially separated bodies of code that are not viable on their own. The ECI module with it's platform device is not usable without the controller; the controller can not be registered without the ECI device initialized; there are ordering issues, both initialization and PM-wise and you are forced to support only one device.
Quoted 7 lines
Is there going to be an SPI interface as well? If not then fold it all together and have I2C device as the only device involved. If SPI is a possibility then look in drivers such as adxl34x, ad714x and others that are split into core module and bus interface implementations.
Thanks.
Hi Dmitry
Thank you for reviewing.
The reasoning for separating driver to the two parts is having both common and different hardware.
The ECI input, as platform device is common part and only dealing with the accessory HW (meaning the headset accessory).
This is standardiced part of system, where specification guarantee HW behaving same way accross several headset accessories.
The accessory is plugged to the terminal using four pin AV-cable, much same way as USB mouse.
I just didn't see need to introduce new bus type for one wire ECI data link, hence platform device.The ECI controller, as I2C device is the variable part of the system. In this case it's microcontroller in I2C bus, but there are other versions too.
There is no specification about these controller's internals, and those are quite different.
It is also possible to use other buses too for connecting controller to terminal, like SPI.The idea was that if ECI is used in device, just take ECI input driver and select the ECI controller which is used in the platform.
And as long as the ECI controller driver use the same interface to ECI input driver, evetrything works OK.
This allows also dynamic selection of used control device. I mean we can compile several ECI controllers as modules and detect the HW at initialization.
Quoted 3 lines
I use the ad714x as example, but I can take second look on that too.
Please let me know if this is making sense.
Tapio,
I understand that ECI accessory is the standard part that can be attached to several controllers, it still does not explain the need for the platform device.
If ECI accessory is the only device that uses the interface you specified then write a module containing that core functionality, with a function to instantiate an instance of the accessory and have controller drivers call this function as part of their bind procedure (i.e. do what adxl34x and company are doing).
If there could be other accessories utilizing the same interface then creating a new bus is the only viable option.
Thank you.
Signature · 1 line
Dmitry
Quoted 84 lines · ext Dmitry Torokhov
Quoted 73 lines · Tapio Vihuri
Quoted 31 lines · ext Dmitry Torokhov
Hi Tapio,
Quoted 10 lines · On Mon, Jan 31, 2011 at 04:03:51PM +0200, [email protected] wrote:
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.
Quoted 8 lines
This ECI input driver provides the following features:
- reading ECI configuration memory
- ECI buttons as input eventsDrive 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 HWI finally had a chance to look though the patches more closely and I do not understand why you decided to introduce the platform device in addition to I2C device. You end up with 2 artificially separated bodies of code that are not viable on their own. The ECI module with it's platform device is not usable without the controller; the controller can not be registered without the ECI device initialized; there are ordering issues, both initialization and PM-wise and you are forced to support only one device.
Quoted 7 lines
Is there going to be an SPI interface as well? If not then fold it all together and have I2C device as the only device involved. If SPI is a possibility then look in drivers such as adxl34x, ad714x and others that are split into core module and bus interface implementations.
Thanks.
Hi Dmitry
Thank you for reviewing.
The reasoning for separating driver to the two parts is having both common and different hardware.
The ECI input, as platform device is common part and only dealing with the accessory HW (meaning the headset accessory).
This is standardiced part of system, where specification guarantee HW behaving same way accross several headset accessories.
The accessory is plugged to the terminal using four pin AV-cable, much same way as USB mouse.
I just didn't see need to introduce new bus type for one wire ECI data link, hence platform device.The ECI controller, as I2C device is the variable part of the system. In this case it's microcontroller in I2C bus, but there are other versions too.
There is no specification about these controller's internals, and those are quite different.
It is also possible to use other buses too for connecting controller to terminal, like SPI.The idea was that if ECI is used in device, just take ECI input driver and select the ECI controller which is used in the platform.
And as long as the ECI controller driver use the same interface to ECI input driver, evetrything works OK.
This allows also dynamic selection of used control device. I mean we can compile several ECI controllers as modules and detect the HW at initialization.Quoted 3 lines
I use the ad714x as example, but I can take second look on that too.
Please let me know if this is making sense.
Tapio,
I understand that ECI accessory is the standard part that can be attached to several controllers, it still does not explain the need for the platform device.
Quoted 5 lines
If ECI accessory is the only device that uses the interface you specified then write a module containing that core functionality, with a function to instantiate an instance of the accessory and have controller drivers call this function as part of their bind procedure (i.e. do what adxl34x and company are doing).
Hi.
You are right. I took closer look of adxl34x, and I just wonder why I didn't make so at first place ;)
I submit new patches soon.
Thank you,
Tapio
Quoted 12 lines
If there could be other accessories utilizing the same interface then creating a new bus is the only viable option.
Thank you.
Signature · 5 lines
Dmitry _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel