Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-25 Thread Poddar, Sourav
Hi,

On Tue, Sep 25, 2012 at 11:22 PM, Mark Brown
 wrote:
> On Wed, Sep 05, 2012 at 05:06:04PM +0530, Sourav Poddar wrote:
>
>> +static struct regmap_config smsc_regmap_config = {
>> + .reg_bits = 8,
>> + .val_bits = 8,
>> + .max_register = SMSC_MAX_REGISTER - 1;
>> + .cache_type = REGCACHE_COMPRESSED,
>> +};
>
> That definition of max_register looks wrong - why are we subtracting 1
> from a macro called MAX_REGISTER to get it?
>
Yes, my bad.
Actually, I have define in .h file something like this..
#define SMSC_MAX_REG(SMSC_VEN_ID_H
+ 1) where
SMSC_VEN_ID_H is the last register address which this chip supports.

I think I should directly assign max_address to SMSC_VEN_ID_H.   ?
+
+
> Indentation here is a bit odd too.
>
Will rectify.
>> +static int smsc_i2c_remove(struct i2c_client *i2c)
>> +{
>> + return 0;
>> +}
>
> Remove empty functions.
Ok.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-25 Thread Mark Brown
On Wed, Sep 05, 2012 at 05:06:04PM +0530, Sourav Poddar wrote:

> +static struct regmap_config smsc_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> + .max_register = SMSC_MAX_REGISTER - 1;
> + .cache_type = REGCACHE_COMPRESSED,
> +};

That definition of max_register looks wrong - why are we subtracting 1
from a macro called MAX_REGISTER to get it?

Indentation here is a bit odd too.

> +static int smsc_i2c_remove(struct i2c_client *i2c)
> +{
> + return 0;
> +}

Remove empty functions.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-25 Thread Mark Brown
On Wed, Sep 05, 2012 at 05:06:04PM +0530, Sourav Poddar wrote:

 +static struct regmap_config smsc_regmap_config = {
 + .reg_bits = 8,
 + .val_bits = 8,
 + .max_register = SMSC_MAX_REGISTER - 1;
 + .cache_type = REGCACHE_COMPRESSED,
 +};

That definition of max_register looks wrong - why are we subtracting 1
from a macro called MAX_REGISTER to get it?

Indentation here is a bit odd too.

 +static int smsc_i2c_remove(struct i2c_client *i2c)
 +{
 + return 0;
 +}

Remove empty functions.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-25 Thread Poddar, Sourav
Hi,

On Tue, Sep 25, 2012 at 11:22 PM, Mark Brown
broo...@opensource.wolfsonmicro.com wrote:
 On Wed, Sep 05, 2012 at 05:06:04PM +0530, Sourav Poddar wrote:

 +static struct regmap_config smsc_regmap_config = {
 + .reg_bits = 8,
 + .val_bits = 8,
 + .max_register = SMSC_MAX_REGISTER - 1;
 + .cache_type = REGCACHE_COMPRESSED,
 +};

 That definition of max_register looks wrong - why are we subtracting 1
 from a macro called MAX_REGISTER to get it?

Yes, my bad.
Actually, I have define in .h file something like this..
#define SMSC_MAX_REG(SMSC_VEN_ID_H
+ 1) where
SMSC_VEN_ID_H is the last register address which this chip supports.

I think I should directly assign max_address to SMSC_VEN_ID_H.   ?
+
+
 Indentation here is a bit odd too.

Will rectify.
 +static int smsc_i2c_remove(struct i2c_client *i2c)
 +{
 + return 0;
 +}

 Remove empty functions.
Ok.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-07 Thread Mark Brown
On Wed, Sep 05, 2012 at 05:06:04PM +0530, Sourav Poddar wrote:

> +static struct regmap_config smsc_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> + .max_register = SMSC_MAX_REGISTER - 1;

That max_register setup looks very odd...

> + .cache_type = REGCACHE_COMPRESSED,
> +};

Are you sure the compressed type is sensible?  It would normally only
make sense with a large number of closely packed registers but this
device has 8 bit register values.

> +#ifdef CONFIG_OF
> + of_property_read_u32(node, "clock", >clk);
> +#endif

> + ret = regmap_write(smsc->regmap, SMSC_CLK_CTRL, smsc->clk);
> + if (ret)
> + goto err;

What happens on non-DT systems?

> +static int smsc_i2c_remove(struct i2c_client *i2c)
> +{
> + return 0;
> +}

Remove empty functions, though it's rather surprising that there's
nothing at all to do here..  Normally an MFD would at least remove its
children.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-07 Thread Mark Brown
On Wed, Sep 05, 2012 at 05:06:04PM +0530, Sourav Poddar wrote:

 +static struct regmap_config smsc_regmap_config = {
 + .reg_bits = 8,
 + .val_bits = 8,
 + .max_register = SMSC_MAX_REGISTER - 1;

That max_register setup looks very odd...

 + .cache_type = REGCACHE_COMPRESSED,
 +};

Are you sure the compressed type is sensible?  It would normally only
make sense with a large number of closely packed registers but this
device has 8 bit register values.

 +#ifdef CONFIG_OF
 + of_property_read_u32(node, clock, smsc-clk);
 +#endif

 + ret = regmap_write(smsc-regmap, SMSC_CLK_CTRL, smsc-clk);
 + if (ret)
 + goto err;

What happens on non-DT systems?

 +static int smsc_i2c_remove(struct i2c_client *i2c)
 +{
 + return 0;
 +}

Remove empty functions, though it's rather surprising that there's
nothing at all to do here..  Normally an MFD would at least remove its
children.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-05 Thread Poddar, Sourav
Hi,

On Wed, Sep 5, 2012 at 11:23 PM, Vaibhav Hiremath  wrote:
>
>
> On 9/5/2012 5:06 PM, Sourav Poddar wrote:
>> smsc ece1099 is a keyboard scan or gpio expansion device.
>> The patch create keypad and gpio expander child for this
>> multi function smsc driver.
>>
>> Cc: Samuel Ortiz 
>> Cc: Benoit Cousson 
>> Cc: Felipe Balbi 
>> Cc: Santosh Shilimkar 
>> Signed-off-by: Sourav Poddar 
>> ---
>> Changes since v1:
>>  - Use Kconfig option correctly
>>  - Add regmap_config paramters
>>  - Modify formatting of logs for devid
>>  - Move read/write function to headed file as an inline
>>function.
>>  Documentation/smsc_ece1099.txt |   56 
>>  drivers/mfd/Kconfig|   12 
>>  drivers/mfd/Makefile   |1 +
>>  drivers/mfd/smsc-ece1099.c |  110 
>> +++
>>  include/linux/mfd/smsc.h   |  111 
>> 
>>  5 files changed, 290 insertions(+), 0 deletions(-)
>>  create mode 100644 Documentation/smsc_ece1099.txt
>>  create mode 100644 drivers/mfd/smsc-ece1099.c
>>  create mode 100644 include/linux/mfd/smsc.h
>>
>> diff --git a/Documentation/smsc_ece1099.txt b/Documentation/smsc_ece1099.txt
>> new file mode 100644
>> index 000..6b492e8
>> --- /dev/null
>> +++ b/Documentation/smsc_ece1099.txt
>> @@ -0,0 +1,56 @@
>> +What is smsc-ece1099?
>> +--
>> +
>> +The ECE1099 is a 40-Pin 3.3V Keyboard Scan Expansion
>> +or GPIO Expansion device. The device supports a keyboard
>> +scan matrix of 23x8. The device is connected to a Master
>> +via the SMSC BC-Link interface or via the SMBus.
>> +Keypad scan Input(KSI) and Keypad Scan Output(KSO) signals
>> +are multiplexed with GPIOs.
>> +
>> +Interrupt generation
>> +
>> +
>> +Interrupts can be generated by an edge detection on a GPIO
>> +pin or an edge detection on one of the bus interface pins.
>> +Interrupts can also be detected on the keyboard scan interface.
>> +The bus interrupt pin (BC_INT# or SMBUS_INT#) is asserted if
>> +any bit in one of the Interrupt Status registers is 1 and
>> +the corresponding Interrupt Mask bit is also 1.
>> +
>> +In order for software to determine which device is the source
>> +of an interrupt, it should first read the Group Interrupt Status Register
>> +to determine which Status register group is a source for the interrupt.
>> +Software should read both the Status register and the associated Mask 
>> register,
>> +then AND the two values together. Bits that are 1 in the result of the AND
>> +are active interrupts. Software clears an interrupt by writing a 1 to the
>> +corresponding bit in the Status register.
>> +
>> +Communication Protocol
>> +--
>> +
>> +- SMbus slave Interface
>> + The host processor communicates with the ECE1099 device
>> + through a series of read/write registers via the SMBus
>> + interface. SMBus is a serial communication protocol between
>> + a computer host and its peripheral devices. The SMBus data
>> + rate is 10KHz minimum to 400 KHz maximum
>> +
>> +- Slave Bus Interface
>> + The ECE1099 device SMBus implementation is a subset of the
>> + SMBus interface to the host. The device is a slave-only SMBus device.
>> + The implementation in the device is a subset of SMBus since it
>> + only supports four protocols.
>> +
>> + The Write Byte, Read Byte, Send Byte, and Receive Byte protocols are 
>> the
>> + only valid SMBus protocols for the device.
>> +
>> +- BC-LinkTM Interface
>> + The BC-Link is a proprietary bus that allows communication
>> + between a Master device and a Companion device. The Master
>> + device uses this serial bus to read and write registers
>> + located on the Companion device. The bus comprises three signals,
>> + BC_CLK, BC_DAT and BC_INT#. The Master device always provides the
>> + clock, BC_CLK, and the Companion device is the source for an
>> + independent asynchronous interrupt signal, BC_INT#. The ECE1099
>> + supports BC-Link speeds up to 24MHz.
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index d1facef..991ef15 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -385,6 +385,18 @@ config MFD_T7L66XB
>>   help
>> Support for Toshiba Mobile IO Controller T7L66XB
>>
>> +config MFD_SMSC
>> +   bool "Support for the SMSC ECE1099 series chips"
>> +   depends on I2C=y
>> +   select MFD_CORE
>> +   select REGMAP_I2C
>> +   help
>> +If you say yes here you get support for the
>> +ece1099 chips from SMSC.
>> +
>> +To compile this driver as a module, choose M here: the
>> +module will be called smsc.
>> +
>>  config MFD_TC6387XB
>>   bool "Support Toshiba TC6387XB"
>>   depends on ARM && HAVE_CLK
>> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
>> index 79dd22d..f587d91 100644
>> --- a/drivers/mfd/Makefile
>> +++ 

Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-05 Thread Vaibhav Hiremath


On 9/5/2012 5:06 PM, Sourav Poddar wrote:
> smsc ece1099 is a keyboard scan or gpio expansion device.
> The patch create keypad and gpio expander child for this
> multi function smsc driver.
> 
> Cc: Samuel Ortiz 
> Cc: Benoit Cousson 
> Cc: Felipe Balbi 
> Cc: Santosh Shilimkar 
> Signed-off-by: Sourav Poddar 
> ---
> Changes since v1:
>  - Use Kconfig option correctly
>  - Add regmap_config paramters
>  - Modify formatting of logs for devid
>  - Move read/write function to headed file as an inline
>function.
>  Documentation/smsc_ece1099.txt |   56 
>  drivers/mfd/Kconfig|   12 
>  drivers/mfd/Makefile   |1 +
>  drivers/mfd/smsc-ece1099.c |  110 +++
>  include/linux/mfd/smsc.h   |  111 
> 
>  5 files changed, 290 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/smsc_ece1099.txt
>  create mode 100644 drivers/mfd/smsc-ece1099.c
>  create mode 100644 include/linux/mfd/smsc.h
> 
> diff --git a/Documentation/smsc_ece1099.txt b/Documentation/smsc_ece1099.txt
> new file mode 100644
> index 000..6b492e8
> --- /dev/null
> +++ b/Documentation/smsc_ece1099.txt
> @@ -0,0 +1,56 @@
> +What is smsc-ece1099?
> +--
> +
> +The ECE1099 is a 40-Pin 3.3V Keyboard Scan Expansion
> +or GPIO Expansion device. The device supports a keyboard
> +scan matrix of 23x8. The device is connected to a Master
> +via the SMSC BC-Link interface or via the SMBus.
> +Keypad scan Input(KSI) and Keypad Scan Output(KSO) signals
> +are multiplexed with GPIOs.
> +
> +Interrupt generation
> +
> +
> +Interrupts can be generated by an edge detection on a GPIO
> +pin or an edge detection on one of the bus interface pins.
> +Interrupts can also be detected on the keyboard scan interface.
> +The bus interrupt pin (BC_INT# or SMBUS_INT#) is asserted if
> +any bit in one of the Interrupt Status registers is 1 and
> +the corresponding Interrupt Mask bit is also 1.
> +
> +In order for software to determine which device is the source
> +of an interrupt, it should first read the Group Interrupt Status Register
> +to determine which Status register group is a source for the interrupt.
> +Software should read both the Status register and the associated Mask 
> register,
> +then AND the two values together. Bits that are 1 in the result of the AND
> +are active interrupts. Software clears an interrupt by writing a 1 to the
> +corresponding bit in the Status register.
> +
> +Communication Protocol
> +--
> +
> +- SMbus slave Interface
> + The host processor communicates with the ECE1099 device
> + through a series of read/write registers via the SMBus
> + interface. SMBus is a serial communication protocol between
> + a computer host and its peripheral devices. The SMBus data
> + rate is 10KHz minimum to 400 KHz maximum
> +
> +- Slave Bus Interface
> + The ECE1099 device SMBus implementation is a subset of the
> + SMBus interface to the host. The device is a slave-only SMBus device.
> + The implementation in the device is a subset of SMBus since it
> + only supports four protocols.
> +
> + The Write Byte, Read Byte, Send Byte, and Receive Byte protocols are the
> + only valid SMBus protocols for the device.
> +
> +- BC-LinkTM Interface
> + The BC-Link is a proprietary bus that allows communication
> + between a Master device and a Companion device. The Master
> + device uses this serial bus to read and write registers
> + located on the Companion device. The bus comprises three signals,
> + BC_CLK, BC_DAT and BC_INT#. The Master device always provides the
> + clock, BC_CLK, and the Companion device is the source for an
> + independent asynchronous interrupt signal, BC_INT#. The ECE1099
> + supports BC-Link speeds up to 24MHz.
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index d1facef..991ef15 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -385,6 +385,18 @@ config MFD_T7L66XB
>   help
> Support for Toshiba Mobile IO Controller T7L66XB
>  
> +config MFD_SMSC
> +   bool "Support for the SMSC ECE1099 series chips"
> +   depends on I2C=y
> +   select MFD_CORE
> +   select REGMAP_I2C
> +   help
> +If you say yes here you get support for the
> +ece1099 chips from SMSC.
> +
> +To compile this driver as a module, choose M here: the
> +module will be called smsc.
> +
>  config MFD_TC6387XB
>   bool "Support Toshiba TC6387XB"
>   depends on ARM && HAVE_CLK
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 79dd22d..f587d91 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -77,6 +77,7 @@ obj-$(CONFIG_EZX_PCAP)  += ezx-pcap.o
>  obj-$(CONFIG_MCP)+= mcp-core.o
>  obj-$(CONFIG_MCP_SA11X0) += mcp-sa11x0.o
>  

[PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-05 Thread Sourav Poddar
smsc ece1099 is a keyboard scan or gpio expansion device.
The patch create keypad and gpio expander child for this
multi function smsc driver.

Cc: Samuel Ortiz 
Cc: Benoit Cousson 
Cc: Felipe Balbi 
Cc: Santosh Shilimkar 
Signed-off-by: Sourav Poddar 
---
Changes since v1:
 - Use Kconfig option correctly
 - Add regmap_config paramters
 - Modify formatting of logs for devid
 - Move read/write function to headed file as an inline
   function.
 Documentation/smsc_ece1099.txt |   56 
 drivers/mfd/Kconfig|   12 
 drivers/mfd/Makefile   |1 +
 drivers/mfd/smsc-ece1099.c |  110 +++
 include/linux/mfd/smsc.h   |  111 
 5 files changed, 290 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/smsc_ece1099.txt
 create mode 100644 drivers/mfd/smsc-ece1099.c
 create mode 100644 include/linux/mfd/smsc.h

diff --git a/Documentation/smsc_ece1099.txt b/Documentation/smsc_ece1099.txt
new file mode 100644
index 000..6b492e8
--- /dev/null
+++ b/Documentation/smsc_ece1099.txt
@@ -0,0 +1,56 @@
+What is smsc-ece1099?
+--
+
+The ECE1099 is a 40-Pin 3.3V Keyboard Scan Expansion
+or GPIO Expansion device. The device supports a keyboard
+scan matrix of 23x8. The device is connected to a Master
+via the SMSC BC-Link interface or via the SMBus.
+Keypad scan Input(KSI) and Keypad Scan Output(KSO) signals
+are multiplexed with GPIOs.
+
+Interrupt generation
+
+
+Interrupts can be generated by an edge detection on a GPIO
+pin or an edge detection on one of the bus interface pins.
+Interrupts can also be detected on the keyboard scan interface.
+The bus interrupt pin (BC_INT# or SMBUS_INT#) is asserted if
+any bit in one of the Interrupt Status registers is 1 and
+the corresponding Interrupt Mask bit is also 1.
+
+In order for software to determine which device is the source
+of an interrupt, it should first read the Group Interrupt Status Register
+to determine which Status register group is a source for the interrupt.
+Software should read both the Status register and the associated Mask register,
+then AND the two values together. Bits that are 1 in the result of the AND
+are active interrupts. Software clears an interrupt by writing a 1 to the
+corresponding bit in the Status register.
+
+Communication Protocol
+--
+
+- SMbus slave Interface
+   The host processor communicates with the ECE1099 device
+   through a series of read/write registers via the SMBus
+   interface. SMBus is a serial communication protocol between
+   a computer host and its peripheral devices. The SMBus data
+   rate is 10KHz minimum to 400 KHz maximum
+
+- Slave Bus Interface
+   The ECE1099 device SMBus implementation is a subset of the
+   SMBus interface to the host. The device is a slave-only SMBus device.
+   The implementation in the device is a subset of SMBus since it
+   only supports four protocols.
+
+   The Write Byte, Read Byte, Send Byte, and Receive Byte protocols are the
+   only valid SMBus protocols for the device.
+
+- BC-LinkTM Interface
+   The BC-Link is a proprietary bus that allows communication
+   between a Master device and a Companion device. The Master
+   device uses this serial bus to read and write registers
+   located on the Companion device. The bus comprises three signals,
+   BC_CLK, BC_DAT and BC_INT#. The Master device always provides the
+   clock, BC_CLK, and the Companion device is the source for an
+   independent asynchronous interrupt signal, BC_INT#. The ECE1099
+   supports BC-Link speeds up to 24MHz.
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index d1facef..991ef15 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -385,6 +385,18 @@ config MFD_T7L66XB
help
  Support for Toshiba Mobile IO Controller T7L66XB
 
+config MFD_SMSC
+   bool "Support for the SMSC ECE1099 series chips"
+   depends on I2C=y
+   select MFD_CORE
+   select REGMAP_I2C
+   help
+If you say yes here you get support for the
+ece1099 chips from SMSC.
+
+To compile this driver as a module, choose M here: the
+module will be called smsc.
+
 config MFD_TC6387XB
bool "Support Toshiba TC6387XB"
depends on ARM && HAVE_CLK
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 79dd22d..f587d91 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -77,6 +77,7 @@ obj-$(CONFIG_EZX_PCAP)+= ezx-pcap.o
 obj-$(CONFIG_MCP)  += mcp-core.o
 obj-$(CONFIG_MCP_SA11X0)   += mcp-sa11x0.o
 obj-$(CONFIG_MCP_UCB1200)  += ucb1x00-core.o
+obj-$(CONFIG_MFD_SMSC)+= smsc.o
 obj-$(CONFIG_MCP_UCB1200_TS)   += ucb1x00-ts.o
 
 ifeq ($(CONFIG_SA1100_ASSABET),y)
diff --git a/drivers/mfd/smsc-ece1099.c b/drivers/mfd/smsc-ece1099.c
new 

Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-05 Thread Poddar, Sourav
Hi,

On Wed, Sep 5, 2012 at 11:23 PM, Vaibhav Hiremath hvaib...@ti.com wrote:


 On 9/5/2012 5:06 PM, Sourav Poddar wrote:
 smsc ece1099 is a keyboard scan or gpio expansion device.
 The patch create keypad and gpio expander child for this
 multi function smsc driver.

 Cc: Samuel Ortiz sa...@linux.intel.com
 Cc: Benoit Cousson b-cous...@ti.com
 Cc: Felipe Balbi ba...@ti.com
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Signed-off-by: Sourav Poddar sourav.pod...@ti.com
 ---
 Changes since v1:
  - Use Kconfig option correctly
  - Add regmap_config paramters
  - Modify formatting of logs for devid
  - Move read/write function to headed file as an inline
function.
  Documentation/smsc_ece1099.txt |   56 
  drivers/mfd/Kconfig|   12 
  drivers/mfd/Makefile   |1 +
  drivers/mfd/smsc-ece1099.c |  110 
 +++
  include/linux/mfd/smsc.h   |  111 
 
  5 files changed, 290 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/smsc_ece1099.txt
  create mode 100644 drivers/mfd/smsc-ece1099.c
  create mode 100644 include/linux/mfd/smsc.h

 diff --git a/Documentation/smsc_ece1099.txt b/Documentation/smsc_ece1099.txt
 new file mode 100644
 index 000..6b492e8
 --- /dev/null
 +++ b/Documentation/smsc_ece1099.txt
 @@ -0,0 +1,56 @@
 +What is smsc-ece1099?
 +--
 +
 +The ECE1099 is a 40-Pin 3.3V Keyboard Scan Expansion
 +or GPIO Expansion device. The device supports a keyboard
 +scan matrix of 23x8. The device is connected to a Master
 +via the SMSC BC-Link interface or via the SMBus.
 +Keypad scan Input(KSI) and Keypad Scan Output(KSO) signals
 +are multiplexed with GPIOs.
 +
 +Interrupt generation
 +
 +
 +Interrupts can be generated by an edge detection on a GPIO
 +pin or an edge detection on one of the bus interface pins.
 +Interrupts can also be detected on the keyboard scan interface.
 +The bus interrupt pin (BC_INT# or SMBUS_INT#) is asserted if
 +any bit in one of the Interrupt Status registers is 1 and
 +the corresponding Interrupt Mask bit is also 1.
 +
 +In order for software to determine which device is the source
 +of an interrupt, it should first read the Group Interrupt Status Register
 +to determine which Status register group is a source for the interrupt.
 +Software should read both the Status register and the associated Mask 
 register,
 +then AND the two values together. Bits that are 1 in the result of the AND
 +are active interrupts. Software clears an interrupt by writing a 1 to the
 +corresponding bit in the Status register.
 +
 +Communication Protocol
 +--
 +
 +- SMbus slave Interface
 + The host processor communicates with the ECE1099 device
 + through a series of read/write registers via the SMBus
 + interface. SMBus is a serial communication protocol between
 + a computer host and its peripheral devices. The SMBus data
 + rate is 10KHz minimum to 400 KHz maximum
 +
 +- Slave Bus Interface
 + The ECE1099 device SMBus implementation is a subset of the
 + SMBus interface to the host. The device is a slave-only SMBus device.
 + The implementation in the device is a subset of SMBus since it
 + only supports four protocols.
 +
 + The Write Byte, Read Byte, Send Byte, and Receive Byte protocols are 
 the
 + only valid SMBus protocols for the device.
 +
 +- BC-LinkTM Interface
 + The BC-Link is a proprietary bus that allows communication
 + between a Master device and a Companion device. The Master
 + device uses this serial bus to read and write registers
 + located on the Companion device. The bus comprises three signals,
 + BC_CLK, BC_DAT and BC_INT#. The Master device always provides the
 + clock, BC_CLK, and the Companion device is the source for an
 + independent asynchronous interrupt signal, BC_INT#. The ECE1099
 + supports BC-Link speeds up to 24MHz.
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index d1facef..991ef15 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -385,6 +385,18 @@ config MFD_T7L66XB
   help
 Support for Toshiba Mobile IO Controller T7L66XB

 +config MFD_SMSC
 +   bool Support for the SMSC ECE1099 series chips
 +   depends on I2C=y
 +   select MFD_CORE
 +   select REGMAP_I2C
 +   help
 +If you say yes here you get support for the
 +ece1099 chips from SMSC.
 +
 +To compile this driver as a module, choose M here: the
 +module will be called smsc.
 +
  config MFD_TC6387XB
   bool Support Toshiba TC6387XB
   depends on ARM  HAVE_CLK
 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
 index 79dd22d..f587d91 100644
 --- a/drivers/mfd/Makefile
 +++ b/drivers/mfd/Makefile
 @@ -77,6 +77,7 @@ obj-$(CONFIG_EZX_PCAP)  += ezx-pcap.o
  obj-$(CONFIG_MCP)+= mcp-core.o
  

[PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-05 Thread Sourav Poddar
smsc ece1099 is a keyboard scan or gpio expansion device.
The patch create keypad and gpio expander child for this
multi function smsc driver.

Cc: Samuel Ortiz sa...@linux.intel.com
Cc: Benoit Cousson b-cous...@ti.com
Cc: Felipe Balbi ba...@ti.com
Cc: Santosh Shilimkar santosh.shilim...@ti.com
Signed-off-by: Sourav Poddar sourav.pod...@ti.com
---
Changes since v1:
 - Use Kconfig option correctly
 - Add regmap_config paramters
 - Modify formatting of logs for devid
 - Move read/write function to headed file as an inline
   function.
 Documentation/smsc_ece1099.txt |   56 
 drivers/mfd/Kconfig|   12 
 drivers/mfd/Makefile   |1 +
 drivers/mfd/smsc-ece1099.c |  110 +++
 include/linux/mfd/smsc.h   |  111 
 5 files changed, 290 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/smsc_ece1099.txt
 create mode 100644 drivers/mfd/smsc-ece1099.c
 create mode 100644 include/linux/mfd/smsc.h

diff --git a/Documentation/smsc_ece1099.txt b/Documentation/smsc_ece1099.txt
new file mode 100644
index 000..6b492e8
--- /dev/null
+++ b/Documentation/smsc_ece1099.txt
@@ -0,0 +1,56 @@
+What is smsc-ece1099?
+--
+
+The ECE1099 is a 40-Pin 3.3V Keyboard Scan Expansion
+or GPIO Expansion device. The device supports a keyboard
+scan matrix of 23x8. The device is connected to a Master
+via the SMSC BC-Link interface or via the SMBus.
+Keypad scan Input(KSI) and Keypad Scan Output(KSO) signals
+are multiplexed with GPIOs.
+
+Interrupt generation
+
+
+Interrupts can be generated by an edge detection on a GPIO
+pin or an edge detection on one of the bus interface pins.
+Interrupts can also be detected on the keyboard scan interface.
+The bus interrupt pin (BC_INT# or SMBUS_INT#) is asserted if
+any bit in one of the Interrupt Status registers is 1 and
+the corresponding Interrupt Mask bit is also 1.
+
+In order for software to determine which device is the source
+of an interrupt, it should first read the Group Interrupt Status Register
+to determine which Status register group is a source for the interrupt.
+Software should read both the Status register and the associated Mask register,
+then AND the two values together. Bits that are 1 in the result of the AND
+are active interrupts. Software clears an interrupt by writing a 1 to the
+corresponding bit in the Status register.
+
+Communication Protocol
+--
+
+- SMbus slave Interface
+   The host processor communicates with the ECE1099 device
+   through a series of read/write registers via the SMBus
+   interface. SMBus is a serial communication protocol between
+   a computer host and its peripheral devices. The SMBus data
+   rate is 10KHz minimum to 400 KHz maximum
+
+- Slave Bus Interface
+   The ECE1099 device SMBus implementation is a subset of the
+   SMBus interface to the host. The device is a slave-only SMBus device.
+   The implementation in the device is a subset of SMBus since it
+   only supports four protocols.
+
+   The Write Byte, Read Byte, Send Byte, and Receive Byte protocols are the
+   only valid SMBus protocols for the device.
+
+- BC-LinkTM Interface
+   The BC-Link is a proprietary bus that allows communication
+   between a Master device and a Companion device. The Master
+   device uses this serial bus to read and write registers
+   located on the Companion device. The bus comprises three signals,
+   BC_CLK, BC_DAT and BC_INT#. The Master device always provides the
+   clock, BC_CLK, and the Companion device is the source for an
+   independent asynchronous interrupt signal, BC_INT#. The ECE1099
+   supports BC-Link speeds up to 24MHz.
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index d1facef..991ef15 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -385,6 +385,18 @@ config MFD_T7L66XB
help
  Support for Toshiba Mobile IO Controller T7L66XB
 
+config MFD_SMSC
+   bool Support for the SMSC ECE1099 series chips
+   depends on I2C=y
+   select MFD_CORE
+   select REGMAP_I2C
+   help
+If you say yes here you get support for the
+ece1099 chips from SMSC.
+
+To compile this driver as a module, choose M here: the
+module will be called smsc.
+
 config MFD_TC6387XB
bool Support Toshiba TC6387XB
depends on ARM  HAVE_CLK
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 79dd22d..f587d91 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -77,6 +77,7 @@ obj-$(CONFIG_EZX_PCAP)+= ezx-pcap.o
 obj-$(CONFIG_MCP)  += mcp-core.o
 obj-$(CONFIG_MCP_SA11X0)   += mcp-sa11x0.o
 obj-$(CONFIG_MCP_UCB1200)  += ucb1x00-core.o
+obj-$(CONFIG_MFD_SMSC)+= smsc.o
 obj-$(CONFIG_MCP_UCB1200_TS)   += ucb1x00-ts.o
 
 ifeq 

Re: [PATCHv2 1/4] mfd: smsc: Add support for smsc gpio io/keypad driver

2012-09-05 Thread Vaibhav Hiremath


On 9/5/2012 5:06 PM, Sourav Poddar wrote:
 smsc ece1099 is a keyboard scan or gpio expansion device.
 The patch create keypad and gpio expander child for this
 multi function smsc driver.
 
 Cc: Samuel Ortiz sa...@linux.intel.com
 Cc: Benoit Cousson b-cous...@ti.com
 Cc: Felipe Balbi ba...@ti.com
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Signed-off-by: Sourav Poddar sourav.pod...@ti.com
 ---
 Changes since v1:
  - Use Kconfig option correctly
  - Add regmap_config paramters
  - Modify formatting of logs for devid
  - Move read/write function to headed file as an inline
function.
  Documentation/smsc_ece1099.txt |   56 
  drivers/mfd/Kconfig|   12 
  drivers/mfd/Makefile   |1 +
  drivers/mfd/smsc-ece1099.c |  110 +++
  include/linux/mfd/smsc.h   |  111 
 
  5 files changed, 290 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/smsc_ece1099.txt
  create mode 100644 drivers/mfd/smsc-ece1099.c
  create mode 100644 include/linux/mfd/smsc.h
 
 diff --git a/Documentation/smsc_ece1099.txt b/Documentation/smsc_ece1099.txt
 new file mode 100644
 index 000..6b492e8
 --- /dev/null
 +++ b/Documentation/smsc_ece1099.txt
 @@ -0,0 +1,56 @@
 +What is smsc-ece1099?
 +--
 +
 +The ECE1099 is a 40-Pin 3.3V Keyboard Scan Expansion
 +or GPIO Expansion device. The device supports a keyboard
 +scan matrix of 23x8. The device is connected to a Master
 +via the SMSC BC-Link interface or via the SMBus.
 +Keypad scan Input(KSI) and Keypad Scan Output(KSO) signals
 +are multiplexed with GPIOs.
 +
 +Interrupt generation
 +
 +
 +Interrupts can be generated by an edge detection on a GPIO
 +pin or an edge detection on one of the bus interface pins.
 +Interrupts can also be detected on the keyboard scan interface.
 +The bus interrupt pin (BC_INT# or SMBUS_INT#) is asserted if
 +any bit in one of the Interrupt Status registers is 1 and
 +the corresponding Interrupt Mask bit is also 1.
 +
 +In order for software to determine which device is the source
 +of an interrupt, it should first read the Group Interrupt Status Register
 +to determine which Status register group is a source for the interrupt.
 +Software should read both the Status register and the associated Mask 
 register,
 +then AND the two values together. Bits that are 1 in the result of the AND
 +are active interrupts. Software clears an interrupt by writing a 1 to the
 +corresponding bit in the Status register.
 +
 +Communication Protocol
 +--
 +
 +- SMbus slave Interface
 + The host processor communicates with the ECE1099 device
 + through a series of read/write registers via the SMBus
 + interface. SMBus is a serial communication protocol between
 + a computer host and its peripheral devices. The SMBus data
 + rate is 10KHz minimum to 400 KHz maximum
 +
 +- Slave Bus Interface
 + The ECE1099 device SMBus implementation is a subset of the
 + SMBus interface to the host. The device is a slave-only SMBus device.
 + The implementation in the device is a subset of SMBus since it
 + only supports four protocols.
 +
 + The Write Byte, Read Byte, Send Byte, and Receive Byte protocols are the
 + only valid SMBus protocols for the device.
 +
 +- BC-LinkTM Interface
 + The BC-Link is a proprietary bus that allows communication
 + between a Master device and a Companion device. The Master
 + device uses this serial bus to read and write registers
 + located on the Companion device. The bus comprises three signals,
 + BC_CLK, BC_DAT and BC_INT#. The Master device always provides the
 + clock, BC_CLK, and the Companion device is the source for an
 + independent asynchronous interrupt signal, BC_INT#. The ECE1099
 + supports BC-Link speeds up to 24MHz.
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index d1facef..991ef15 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -385,6 +385,18 @@ config MFD_T7L66XB
   help
 Support for Toshiba Mobile IO Controller T7L66XB
  
 +config MFD_SMSC
 +   bool Support for the SMSC ECE1099 series chips
 +   depends on I2C=y
 +   select MFD_CORE
 +   select REGMAP_I2C
 +   help
 +If you say yes here you get support for the
 +ece1099 chips from SMSC.
 +
 +To compile this driver as a module, choose M here: the
 +module will be called smsc.
 +
  config MFD_TC6387XB
   bool Support Toshiba TC6387XB
   depends on ARM  HAVE_CLK
 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
 index 79dd22d..f587d91 100644
 --- a/drivers/mfd/Makefile
 +++ b/drivers/mfd/Makefile
 @@ -77,6 +77,7 @@ obj-$(CONFIG_EZX_PCAP)  += ezx-pcap.o
  obj-$(CONFIG_MCP)+= mcp-core.o
  obj-$(CONFIG_MCP_SA11X0) += mcp-sa11x0.o
  obj-$(CONFIG_MCP_UCB1200)+= ucb1x00-core.o