Re: [PATCH] mfd: stmpe: Fix RESET regression on STMPE2401

2016-11-02 Thread Lee Jones
On Tue, 01 Nov 2016, Linus Walleij wrote:

> Since commit c4dd1ba355aae2bc3d1213da6c66c53e3c31e028
> ("mfd: stmpe: Add reset support for all STMPE variant")
> we're resetting the STMPE expanders before use.
> 
> This caused a regression on the STMP2401 on the Nomadik
> NHK8815:
> 
> stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
> nmk-i2c 101f8000.i2c0: write to slave 0x43 timed out
> nmk-i2c 101f8000.i2c0: no ack received after address transmission
> stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
> nmk-i2c 101f8000.i2c0: write to slave 0x44 timed out
> nmk-i2c 101f8000.i2c0: no ack received after address transmission
> 
> It turns out that we start to poll for the reset bit to
> go low again too quickly: the STMPE2401 is not yet online and
> ready to be asked for the status of the RESET bit.
> 
> By introducing a 10ms delay before starting to hammer
> the register for information, we get back to normal:
> 
> stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
> stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
> 
> Cc: sta...@vger.kernel.org
> Cc: Patrice Chotard 
> Cc: Amelie Delaunay 
> Cc: Lee Jones 
> Fixes: c4dd1ba355aa ("mfd: stmpe: Add reset support for all STMPE variant")
> Signed-off-by: Linus Walleij 
> ---
>  drivers/mfd/stmpe.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied to -fixes.

> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index cfdae8a3d779..b0c7bcdaf5df 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -851,6 +851,8 @@ static int stmpe_reset(struct stmpe *stmpe)
>   if (ret < 0)
>   return ret;
>  
> + msleep(10);
> +
>   timeout = jiffies + msecs_to_jiffies(100);
>   while (time_before(jiffies, timeout)) {
>   ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH] mfd: stmpe: Fix RESET regression on STMPE2401

2016-11-02 Thread Lee Jones
On Tue, 01 Nov 2016, Linus Walleij wrote:

> Since commit c4dd1ba355aae2bc3d1213da6c66c53e3c31e028
> ("mfd: stmpe: Add reset support for all STMPE variant")
> we're resetting the STMPE expanders before use.
> 
> This caused a regression on the STMP2401 on the Nomadik
> NHK8815:
> 
> stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
> nmk-i2c 101f8000.i2c0: write to slave 0x43 timed out
> nmk-i2c 101f8000.i2c0: no ack received after address transmission
> stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
> nmk-i2c 101f8000.i2c0: write to slave 0x44 timed out
> nmk-i2c 101f8000.i2c0: no ack received after address transmission
> 
> It turns out that we start to poll for the reset bit to
> go low again too quickly: the STMPE2401 is not yet online and
> ready to be asked for the status of the RESET bit.
> 
> By introducing a 10ms delay before starting to hammer
> the register for information, we get back to normal:
> 
> stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
> stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
> 
> Cc: sta...@vger.kernel.org
> Cc: Patrice Chotard 
> Cc: Amelie Delaunay 
> Cc: Lee Jones 
> Fixes: c4dd1ba355aa ("mfd: stmpe: Add reset support for all STMPE variant")
> Signed-off-by: Linus Walleij 
> ---
>  drivers/mfd/stmpe.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied to -fixes.

> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index cfdae8a3d779..b0c7bcdaf5df 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -851,6 +851,8 @@ static int stmpe_reset(struct stmpe *stmpe)
>   if (ret < 0)
>   return ret;
>  
> + msleep(10);
> +
>   timeout = jiffies + msecs_to_jiffies(100);
>   while (time_before(jiffies, timeout)) {
>   ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH] mfd: stmpe: Fix RESET regression on STMPE2401

2016-11-02 Thread Patrice Chotard


On 11/01/2016 10:22 AM, Linus Walleij wrote:
> Since commit c4dd1ba355aae2bc3d1213da6c66c53e3c31e028
> ("mfd: stmpe: Add reset support for all STMPE variant")
> we're resetting the STMPE expanders before use.
> 
> This caused a regression on the STMP2401 on the Nomadik
> NHK8815:
> 
> stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
> nmk-i2c 101f8000.i2c0: write to slave 0x43 timed out
> nmk-i2c 101f8000.i2c0: no ack received after address transmission
> stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
> nmk-i2c 101f8000.i2c0: write to slave 0x44 timed out
> nmk-i2c 101f8000.i2c0: no ack received after address transmission
> 
> It turns out that we start to poll for the reset bit to
> go low again too quickly: the STMPE2401 is not yet online and
> ready to be asked for the status of the RESET bit.
> 
> By introducing a 10ms delay before starting to hammer
> the register for information, we get back to normal:
> 
> stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
> stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
> 
> Cc: sta...@vger.kernel.org
> Cc: Patrice Chotard 
> Cc: Amelie Delaunay 
> Cc: Lee Jones 
> Fixes: c4dd1ba355aa ("mfd: stmpe: Add reset support for all STMPE variant")
> Signed-off-by: Linus Walleij 
> ---
>  drivers/mfd/stmpe.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index cfdae8a3d779..b0c7bcdaf5df 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -851,6 +851,8 @@ static int stmpe_reset(struct stmpe *stmpe)
>   if (ret < 0)
>   return ret;
>  
> + msleep(10);
> +
>   timeout = jiffies + msecs_to_jiffies(100);
>   while (time_before(jiffies, timeout)) {
>   ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);
> 


Hi Linus

Acked-by: Patrice Chotard 

Thanks


Re: [PATCH] mfd: stmpe: Fix RESET regression on STMPE2401

2016-11-02 Thread Patrice Chotard


On 11/01/2016 10:22 AM, Linus Walleij wrote:
> Since commit c4dd1ba355aae2bc3d1213da6c66c53e3c31e028
> ("mfd: stmpe: Add reset support for all STMPE variant")
> we're resetting the STMPE expanders before use.
> 
> This caused a regression on the STMP2401 on the Nomadik
> NHK8815:
> 
> stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
> nmk-i2c 101f8000.i2c0: write to slave 0x43 timed out
> nmk-i2c 101f8000.i2c0: no ack received after address transmission
> stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
> nmk-i2c 101f8000.i2c0: write to slave 0x44 timed out
> nmk-i2c 101f8000.i2c0: no ack received after address transmission
> 
> It turns out that we start to poll for the reset bit to
> go low again too quickly: the STMPE2401 is not yet online and
> ready to be asked for the status of the RESET bit.
> 
> By introducing a 10ms delay before starting to hammer
> the register for information, we get back to normal:
> 
> stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
> stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
> 
> Cc: sta...@vger.kernel.org
> Cc: Patrice Chotard 
> Cc: Amelie Delaunay 
> Cc: Lee Jones 
> Fixes: c4dd1ba355aa ("mfd: stmpe: Add reset support for all STMPE variant")
> Signed-off-by: Linus Walleij 
> ---
>  drivers/mfd/stmpe.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index cfdae8a3d779..b0c7bcdaf5df 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -851,6 +851,8 @@ static int stmpe_reset(struct stmpe *stmpe)
>   if (ret < 0)
>   return ret;
>  
> + msleep(10);
> +
>   timeout = jiffies + msecs_to_jiffies(100);
>   while (time_before(jiffies, timeout)) {
>   ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);
> 


Hi Linus

Acked-by: Patrice Chotard 

Thanks


[PATCH] mfd: stmpe: Fix RESET regression on STMPE2401

2016-11-01 Thread Linus Walleij
Since commit c4dd1ba355aae2bc3d1213da6c66c53e3c31e028
("mfd: stmpe: Add reset support for all STMPE variant")
we're resetting the STMPE expanders before use.

This caused a regression on the STMP2401 on the Nomadik
NHK8815:

stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
nmk-i2c 101f8000.i2c0: write to slave 0x43 timed out
nmk-i2c 101f8000.i2c0: no ack received after address transmission
stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
nmk-i2c 101f8000.i2c0: write to slave 0x44 timed out
nmk-i2c 101f8000.i2c0: no ack received after address transmission

It turns out that we start to poll for the reset bit to
go low again too quickly: the STMPE2401 is not yet online and
ready to be asked for the status of the RESET bit.

By introducing a 10ms delay before starting to hammer
the register for information, we get back to normal:

stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101

Cc: sta...@vger.kernel.org
Cc: Patrice Chotard 
Cc: Amelie Delaunay 
Cc: Lee Jones 
Fixes: c4dd1ba355aa ("mfd: stmpe: Add reset support for all STMPE variant")
Signed-off-by: Linus Walleij 
---
 drivers/mfd/stmpe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index cfdae8a3d779..b0c7bcdaf5df 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -851,6 +851,8 @@ static int stmpe_reset(struct stmpe *stmpe)
if (ret < 0)
return ret;
 
+   msleep(10);
+
timeout = jiffies + msecs_to_jiffies(100);
while (time_before(jiffies, timeout)) {
ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);
-- 
2.7.4



[PATCH] mfd: stmpe: Fix RESET regression on STMPE2401

2016-11-01 Thread Linus Walleij
Since commit c4dd1ba355aae2bc3d1213da6c66c53e3c31e028
("mfd: stmpe: Add reset support for all STMPE variant")
we're resetting the STMPE expanders before use.

This caused a regression on the STMP2401 on the Nomadik
NHK8815:

stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
nmk-i2c 101f8000.i2c0: write to slave 0x43 timed out
nmk-i2c 101f8000.i2c0: no ack received after address transmission
stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101
nmk-i2c 101f8000.i2c0: write to slave 0x44 timed out
nmk-i2c 101f8000.i2c0: no ack received after address transmission

It turns out that we start to poll for the reset bit to
go low again too quickly: the STMPE2401 is not yet online and
ready to be asked for the status of the RESET bit.

By introducing a 10ms delay before starting to hammer
the register for information, we get back to normal:

stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101
stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101

Cc: sta...@vger.kernel.org
Cc: Patrice Chotard 
Cc: Amelie Delaunay 
Cc: Lee Jones 
Fixes: c4dd1ba355aa ("mfd: stmpe: Add reset support for all STMPE variant")
Signed-off-by: Linus Walleij 
---
 drivers/mfd/stmpe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index cfdae8a3d779..b0c7bcdaf5df 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -851,6 +851,8 @@ static int stmpe_reset(struct stmpe *stmpe)
if (ret < 0)
return ret;
 
+   msleep(10);
+
timeout = jiffies + msecs_to_jiffies(100);
while (time_before(jiffies, timeout)) {
ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);
-- 
2.7.4