public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] docs: i2c: slave-interface: return errno when handle I2C_SLAVE_WRITE_REQUESTED
@ 2022-09-15  3:54 Quan Nguyen
  2022-09-28 19:41 ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Quan Nguyen @ 2022-09-15  3:54 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c, linux-kernel, Open Source Submission
  Cc: quan, Phong Vo, Thang 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.

Signed-off-by: Quan Nguyen <quan@os.amperecomputing.com>
Links:https://lore.kernel.org/linux-arm-kernel/556fa9e1-c54b-8370-4de7-c2d3ec7d6906@os.amperecomputing.com/
---
 Documentation/i2c/slave-interface.rst | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/i2c/slave-interface.rst b/Documentation/i2c/slave-interface.rst
index 82ea3e1d6fe4..03b15b21d392 100644
--- a/Documentation/i2c/slave-interface.rst
+++ b/Documentation/i2c/slave-interface.rst
@@ -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)
 
-- 
2.35.1


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

* Re: [PATCH] docs: i2c: slave-interface: return errno when handle I2C_SLAVE_WRITE_REQUESTED
  2022-09-15  3:54 [PATCH] docs: i2c: slave-interface: return errno when handle I2C_SLAVE_WRITE_REQUESTED Quan Nguyen
@ 2022-09-28 19:41 ` Wolfram Sang
  2022-09-29  8:07   ` Quan Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2022-09-28 19:41 UTC (permalink / raw)
  To: Quan Nguyen
  Cc: linux-i2c, linux-kernel, Open Source Submission, Phong Vo,
	Thang Nguyen

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

On Thu, Sep 15, 2022 at 10:54:40AM +0700, Quan Nguyen wrote:
> 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.
> 
> Signed-off-by: Quan Nguyen <quan@os.amperecomputing.com>
> Links:https://lore.kernel.org/linux-arm-kernel/556fa9e1-c54b-8370-4de7-c2d3ec7d6906@os.amperecomputing.com/

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!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] docs: i2c: slave-interface: return errno when handle I2C_SLAVE_WRITE_REQUESTED
  2022-09-28 19:41 ` Wolfram Sang
@ 2022-09-29  8:07   ` Quan Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Quan Nguyen @ 2022-09-29  8:07 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c, linux-kernel, Open Source Submission,
	Phong Vo, Thang Nguyen

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

On 29/09/2022 02:41, Wolfram Sang wrote:
> On Thu, Sep 15, 2022 at 10:54:40AM +0700, Quan Nguyen wrote:
>> 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.
>>
>> Signed-off-by: Quan Nguyen <quan@os.amperecomputing.com>
>> Links:https://lore.kernel.org/linux-arm-kernel/556fa9e1-c54b-8370-4de7-c2d3ec7d6906@os.amperecomputing.com/
> 
> 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!
> 

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

end of thread, other threads:[~2022-09-29  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-15  3:54 [PATCH] docs: i2c: slave-interface: return errno when handle I2C_SLAVE_WRITE_REQUESTED Quan Nguyen
2022-09-28 19:41 ` Wolfram Sang
2022-09-29  8:07   ` Quan Nguyen

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