Re: [PATCH] Input: mpr121 - propagate suspend and resume write errors

From: Dmitry Torokhov

Date: Mon Nov 23 2026 - 01:34:52 EST


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@xxxxxxxxxxxxxxxxxxxx>
> ---
> 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