The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] Input: mpr121 - propagate suspend and resume write errors
@ 2026-11-12  7:17 Zhu Jun
  2026-11-23  6:34 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Jun @ 2026-11-12  7:17 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Zhu Jun

The power management callbacks ignore failures when disabling and
re-enabling the touch electrodes. A failed resume write can leave
the keyboard disabled while the PM core is told that resume succeeded.

Return the SMBus write result from both callbacks.

Fixes: 36682b81de32 ("Input: add driver FSL MPR121 capacitive touch sensor")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 drivers/input/keyboard/mpr121_touchkey.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
index 06329cf5c749..973fbc5521a8 100644
--- a/drivers/input/keyboard/mpr121_touchkey.c
+++ b/drivers/input/keyboard/mpr121_touchkey.c
@@ -302,9 +302,7 @@ static int mpr_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 
-	i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, 0x00);
-
-	return 0;
+	return i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, 0x00);
 }
 
 static int mpr_resume(struct device *dev)
@@ -312,10 +310,8 @@ static int mpr_resume(struct device *dev)
 	struct i2c_client *client = to_i2c_client(dev);
 	struct mpr121_touchkey *mpr121 = i2c_get_clientdata(client);
 
-	i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR,
+	return i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR,
 				  mpr121->keycount);
-
-	return 0;
 }
 
 static DEFINE_SIMPLE_DEV_PM_OPS(mpr121_touchkey_pm_ops, mpr_suspend, mpr_resume);
-- 
2.51.0




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: mpr121 - propagate suspend and resume write errors
  2026-11-12  7:17 [PATCH] Input: mpr121 - propagate suspend and resume write errors Zhu Jun
@ 2026-11-23  6:34 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2026-11-23  6:34 UTC (permalink / raw)
  To: Zhu Jun; +Cc: linux-input, linux-kernel

Hi Zhu,

On Thu, Nov 12, 2026 at 03:17:27PM +0800, Zhu Jun wrote:
> The power management callbacks ignore failures when disabling and
> re-enabling the touch electrodes. A failed resume write can leave
> the keyboard disabled while the PM core is told that resume succeeded.
> 
> Return the SMBus write result from both callbacks.

How does it improve system behavior in practical terms?

> 
> Fixes: 36682b81de32 ("Input: add driver FSL MPR121 capacitive touch sensor")
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
> ---
>  drivers/input/keyboard/mpr121_touchkey.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
> index 06329cf5c749..973fbc5521a8 100644
> --- a/drivers/input/keyboard/mpr121_touchkey.c
> +++ b/drivers/input/keyboard/mpr121_touchkey.c
> @@ -302,9 +302,7 @@ static int mpr_suspend(struct device *dev)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
>  
> -	i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, 0x00);
> -
> -	return 0;
> +	return i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, 0x00);
>  }
>  
>  static int mpr_resume(struct device *dev)
> @@ -312,10 +310,8 @@ static int mpr_resume(struct device *dev)
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct mpr121_touchkey *mpr121 = i2c_get_clientdata(client);
>  
> -	i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR,
> +	return i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR,
>  				  mpr121->keycount);
> -
> -	return 0;
>  }
>  
>  static DEFINE_SIMPLE_DEV_PM_OPS(mpr121_touchkey_pm_ops, mpr_suspend, mpr_resume);

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23  6:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  7:17 [PATCH] Input: mpr121 - propagate suspend and resume write errors Zhu Jun
2026-11-23  6:34 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox