From patchwork Thu Sep 15 03:54:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 607029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32633ECAAA1 for ; Thu, 15 Sep 2022 03:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229565AbiIODzI (ORCPT ); Wed, 14 Sep 2022 23:55:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiIODzF (ORCPT ); Wed, 14 Sep 2022 23:55:05 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2139.outbound.protection.outlook.com [40.107.244.139]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B03561FCC3; Wed, 14 Sep 2022 20:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CWe1taXkaFWTZZOBUKIew+bncz1kQrKqL7tz4V4iDqz/IUOP0nNBlo2Hif15k6leBUKa65Ufcn2xxmH8M6/pn55nNWKSdfTX5QyW6oIIeSdS20JU3u5FzA40hgDkIckMpdHj2PP9yvSxdKXZQJZFZYAilc1tWpVvJFMIca4TX1TdhLimq73WJAMbsFrwPSIe5cw3ysXNpSdbZ8WIN4XzgZEJh9j3heSV+wZkiTA3sLbIZQ0vY0djqgDIWrqISHEwCi1JXxsZbBbgodgx7rW1BhmiE1uDdOUnSog1RiJ7wGcmwBgwHQlVkYFYJuEtzuTXifOuC6ahWkULkn0n+R60kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ta21anwT4ysG1gPKKJskzXOOFKKj5bTxyb99fh0IzNw=; b=bauoreQcUvOWVJLGq4RKlE+1vqNaks9+RphwTeYaqw+nA4fINNnJh9rFQOl3B1oGtWP41w5Wt6N+kqJA2Ngf93zACye7nedOoVsA5JfToAfQpDJXMkUaUc9ssZ0CM9MNC+J9ajU34mE3Zjrw1m6VjJvxcTzVEpK8Ojm7WLLgsW4EvoJH6ifSTC8W1/NdczDok4rDv+5fNif6aQbHcwygcpcFBoYj2YPV64L35ye0XBaf9UkKRUnixrUaPsFHAKH8ZJEBSxTYvxij4/yfWlUyGRlxSkzTag7bx1FlLBRLfqoXNQjIQGf+13aTVawvnDJuA5JiZhj52QlKkktOH9lD2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ta21anwT4ysG1gPKKJskzXOOFKKj5bTxyb99fh0IzNw=; b=bLt4MbUr7bxNSFqxqoPpEdHcYfA1qHFeL58+pNQ0pkRkjIg3RruCJcOioEQQS3vvvkZs4D2VhTIgEtbPRavWCjcHf+6VBG+GuztBX4bK0gKNtNkrmwPgukf1T2/2NvhmdFpmSjjOY2gZ4FTKXuX15p7od0RSrvovV1VRlH87ysM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) by MN0PR01MB7659.prod.exchangelabs.com (2603:10b6:208:37a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Thu, 15 Sep 2022 03:54:58 +0000 Received: from SJ0PR01MB7282.prod.exchangelabs.com ([fe80::48f7:ac49:a2f8:614e]) by SJ0PR01MB7282.prod.exchangelabs.com ([fe80::48f7:ac49:a2f8:614e%5]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 03:54:57 +0000 From: Quan Nguyen To: Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Open Source Submission Cc: quan@os.amperecomputing.com, Phong Vo , Thang Nguyen Subject: [PATCH] docs: i2c: slave-interface: return errno when handle I2C_SLAVE_WRITE_REQUESTED Date: Thu, 15 Sep 2022 10:54:40 +0700 Message-Id: <20220915035440.2862532-1-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI2PR02CA0029.apcprd02.prod.outlook.com (2603:1096:4:195::6) To SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR01MB7282:EE_|MN0PR01MB7659:EE_ X-MS-Office365-Filtering-Correlation-Id: ff7a5dee-d77c-48ef-4071-08da96ce0e65 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J+scuXP6P2VMB2Fhhu3n89YST0yLxG+FJlKJ1mYQyUn3n35ICA2eHKONVC8GaXiUqLlt/atkDRDVM10lTX93Yd0IZKFzYHKiP7BHQiGMENjRt/02EqQZRX3l1JcS2KsTF/EJdMhhlf9rb4Fga6fBsuu+sKlPutLBFL0GIE0azFuNHofTlT0cXOet0/CIt+k/UqzmQb7DiI6Tf5PbscXEVYXrMDljqkJ5a7SgZv09T4tEpmKWQ50LGfksRqyNUN3vCu3bdLiB1A+tAT9+iYaClgwQ6F6wkMtU7UjD8SU8nwemuX+tdEFzJfjkl6pbf7lXAxwQhrRJP0hl/3hPzZ3c1ZFQIzGR+aufMtz6cpK6OHg7u2A0yQnwKJ2UTRyAmlcB8FK1uszw1Z3jAWs4dhplw/N3Cl7OjArT01h6mX6FIUeh1XcqqRu/Mq5tfOZ84ZINyvh7GSxCTWyLFvMi3Jc5UFcFJW5AoeWFSIieXegYnjxpZsEPvnQ16ZQZDiFAx2h8J3XEJV/NZ+71HY+SWLxvcFoInmGtjHSiGtNvgQddefR6mGp0ls/0TxUGg7D1VEc+1mFaGQoOm3Bko6tov1bXuqwWyk5qozA4l4zDE4iTk9tcHK8ZX8DPmu0i7ukRDZnqB3TqfJNkw6pH9MykRJrKoY8KBaJj51K9wHShRqfRTcgvRavf80RBtLRiQ0gs/jRdw45Y3j4dShlLuLho2gf8aMG129iEOyvWPrTaGzdsIbzMjdQJ4Swzk5EL12IaBSy3g0taZ+eg3cuR2/wfRyKA5LMxW1Eu2tIi0TV1bJo1Fq4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR01MB7282.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(396003)(376002)(346002)(39850400004)(366004)(451199015)(41300700001)(4326008)(6506007)(6512007)(8676002)(6666004)(54906003)(52116002)(6486002)(83380400001)(478600001)(26005)(66476007)(110136005)(38350700002)(316002)(2906002)(66946007)(38100700002)(107886003)(2616005)(8936002)(5660300002)(66556008)(186003)(1076003)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LcEi+/JfA86hMnpaTf2H0AgvGlTTWny3THSKcIPZCd5j9o1bUcsIWpiEVVrasbpaNkQsOJ3cK++u+/jxqdh2yaedGqKRdvrdjIRKixTDjK2UEJbXyP9BZihF2rkixplDxQlgiTyJWvSG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ADiEcM5OAaIoZl4VJZLeZ/uM/myIQ1/+dTFjc78uekNr6ldDhn+nnNZh6vBglAD5mxKZr2+t8qtsDfm7oGC/bNq5+cHBgsIFZCV8H4yWivjbJ0/UZSbw8S4HZmQW6PVvgfZz5XOy75zj1iSu8zaSTUVbBO6LhQuAY9poYG3jL9GKlNlolYi03N1qPCS7KdBl3fWF4T/H8B4jWwZgUx0v+Dj8pVgn/kDAFLG1FjKKzSkmLA45ZXqATOzVoLmCqPs6tVhUWQNlYpVmZ2FNS8HNC4pizpY38XhlbujGDNx9jow1EmIJqSX0/koGaO26iSgRZtXwHDbSoWdCxNGNtQ9hi6Z0y+DMv/TlLO88iB9Lew3NA7l+qoF79sLFVgCiT254TNoTikkdzt5F3v+ebYu/q0XdLgscfG3VsbaqHoeKz+52QesBJxRt8= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff7a5dee-d77c-48ef-4071-08da96ce0e65 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR01MB7282.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 03:54:57.8885 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tXODtYV4G81oLXCiaftw3huX3lgDSHCERp3TDy22JCPBluR+SUz+5sCSJ96McEO+1O93ths7h7NWPN7Bn0et0tdVjM/Eq8fK5hR3J37C0Fk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR01MB7659 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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 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)