From f811f2e80ea47185937a07ff422e6a5b6f571542 Mon Sep 17 00:00:00 2001 From: Mukesh Kumar Savaliya Date: Tue, 1 Mar 2022 13:33:19 +0530 Subject: [PATCH] i2c: i2c-msm-geni: Report NACK as an error to client if there is a NACK from i2c slave side on the bus while doing i2c transfer, report it as an error. So far NACK reproted at i2c master just as an error and if master is done with the command to GENI, it considered as a success. Ideally the NACK or ACK is part of protocol, here we are returning NACK as an error for the client to take some respective action. Change-Id: I084f8f733310f7a10f2d53f34d9c99f6c5234406 Signed-off-by: Mukesh Kumar Savaliya --- drivers/i2c/busses/i2c-msm-geni.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-msm-geni.c b/drivers/i2c/busses/i2c-msm-geni.c index 0fb48f90b612..9c508aa56efe 100644 --- a/drivers/i2c/busses/i2c-msm-geni.c +++ b/drivers/i2c/busses/i2c-msm-geni.c @@ -1235,11 +1235,15 @@ geni_i2c_txn_ret: pm_runtime_mark_last_busy(gi2c->dev); pm_runtime_put_autosuspend(gi2c->dev); } + gi2c->cur = NULL; - gi2c->err = 0; - GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev, - "i2c txn ret:%d\n", ret); - return ret; + GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev, + "i2c txn ret:%d, num:%d, err%:%d\n", ret, num, gi2c->err); + + if (gi2c->err) + return gi2c->err; + else + return ret; } static u32 geni_i2c_func(struct i2c_adapter *adap)