Skip to contentSkip to conversation

docs: i2c: slave-interface: return errno when handle I2C_SLAVE_WRITE_REQUESTED

PATCH In review Quan Nguyen 2 participants 3 messages Sep 15, 2022 – Sep 29, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: i2c: slave-interface: return errno when handle I2C_SLAVE_WRITE_REQUESTED

In case backend is not ready, ie: fail to wakeup or initialization, on the returning of the I2C_SLAVE_WRITE_REQUESTED event, bus driver should aware the backend status and might auto sending NACK on the next incoming bytes for I2C master to retry.

Links:https://lore.kernel.org/linux-arm-kernel/[email protected]/

---
 Documentation/i2c/slave-interface.rst | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Documentation/i2c/slave-interface.rst +6 -3
index 82ea3e1d6fe4..03b15b21d392 100644
@@ -72,12 +72,15 @@ Event types:
 
   'val': unused
 
-  'ret': always 0
+  'ret': 0 if backend ready, otherwise, returns some errno
 
 Another I2C master wants to write data to us. This event should be sent once
 our own address and the write bit was detected. The data did not arrive yet, so
-there is nothing to process or return. Wakeup or initialization probably needs
-to be done, though.
+there is nothing to process or return. After returning, the bus driver should
+always ack on this address phase. If 'ret' is zero, backend initialization or
+wakeup is done and ready. If 'ret' is an errno, bus driver should aware the
+backend status and might need to nack all next incoming bytes for I2C master to
+retry.
 
 * I2C_SLAVE_READ_REQUESTED (mandatory)
 
Signature · 1 line
2.35.1
#1 lore raw
Quoted 7 lines · Quan Nguyen

In case backend is not ready, ie: fail to wakeup or initialization, on the returning of the I2C_SLAVE_WRITE_REQUESTED event, bus driver should aware the backend status and might auto sending NACK on the next incoming bytes for I2C master to retry.

Links:https://lore.kernel.org/linux-arm-kernel/[email protected]/

Sorry for the delay. I made some wording more precise and applied it to for-next. So, we can use it right for next merge window, if needed.

Thank you for suggesting this and for your patience!

#2 lore raw

Thank you, Wolfram, for the review and the wording fixes :-)
- Quan

Quoted 14 lines · Wolfram Sang
Quoted 7 lines · Quan Nguyen

In case backend is not ready, ie: fail to wakeup or initialization, on the returning of the I2C_SLAVE_WRITE_REQUESTED event, bus driver should aware the backend status and might auto sending NACK on the next incoming bytes for I2C master to retry.

Links:https://lore.kernel.org/linux-arm-kernel/[email protected]/

Sorry for the delay. I made some wording more precise and applied it to for-next. So, we can use it right for next merge window, if needed.

Thank you for suggesting this and for your patience!