From patchwork Tue Aug 6 14:20:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13754941 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 248BB18D642 for ; Tue, 6 Aug 2024 14:20:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954044; cv=none; b=gqiV2dGndbuuuZ3xeeFgpN4/+8Q+URNsLDNVixG1kjs5esyXe0cIl5iTp2B2uphEvS9oZ3U4kExkoaNbih1yXd6qp32NqndZIGo9lIw0AjAo9RN+9dudxy+iZkqtgXwXsNoUBduqugXa+KOGHOjpdAtJ17YMM+2PZBP+VN7myqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954044; c=relaxed/simple; bh=jIOuqhgEBh6VGxaQQdjTBnedyoXCh3aKOlKNnhGoZr4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b9XpdkH28l+dROgFlyIoZ1rT2ST1nUaXjAmd00nweU7efbqvFkLGK2AEMNfAV5VQv2wcGs+MsAEzj6rm71P2eMHMdS/v3PWCJ73SBtY+hEOoxKtmqGDWisA6+UCRSVNA3ahPWJNYInSBgm9eSBVanGPykC01pyRWfEIuogp7nCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=YcQf7Tol; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="YcQf7Tol" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=pgj087NucnHKxua0poSb91px8mDb2gODWDuPOmjAJHI=; b=YcQf7T olB1HU2zUkNS4lit9bw0nqhHXV+gIy6Glyw+ZWpIuSqg6Ak8/ND7KTS5Up6O1b2i DRWEMAOQFr3xMQL5MuJzsHqhGMLlOtLtZbIj2dlS4sAfWDyZpZbGAEH1TgFxKY9U BbbCjvmx9DbLY8QqQdbaHboTCklM9vbVMDEfGp7g2EgZrpBgTRARTN+kxD/r3nYM 2Bl8ewoc/JVsbyNgWp9PNOiHbJDagVi+pNwskFyOzEMu3g+pOTF+dweGgZBMTJbI bVVtx1CI1lcJypcqb23aLvCkydq1pya5pvmCOWgL5yBE0k9IbQRAVhqRGiJniLPg xFZYhDTXf0tEj4xg== Received: (qmail 249166 invoked from network); 6 Aug 2024 16:20:37 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 Aug 2024 16:20:37 +0200 X-UD-Smtp-Session: l3s3148p1@3r5gfwQfGIYgAwDPXxLGAIH3oZkcU6AS From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , linux-i2c@vger.kernel.org Subject: [PATCH 1/3] i2c: testunit: sort case blocks Date: Tue, 6 Aug 2024 16:20:30 +0200 Message-ID: <20240806142033.2697-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806142033.2697-1-wsa+renesas@sang-engineering.com> References: <20240806142033.2697-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Because a 'fallthrough' was refactored away, the order of 'case' statements can be sorted better now to ease understanding the flow of events. Signed-off-by: Wolfram Sang --- drivers/i2c/i2c-slave-testunit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c index 4c550306f3ec..be1d2e900aef 100644 --- a/drivers/i2c/i2c-slave-testunit.c +++ b/drivers/i2c/i2c-slave-testunit.c @@ -94,6 +94,14 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, int ret = 0; switch (event) { + case I2C_SLAVE_WRITE_REQUESTED: + if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags)) + return -EBUSY; + + memset(tu->regs, 0, TU_NUM_REGS); + tu->reg_idx = 0; + break; + case I2C_SLAVE_WRITE_RECEIVED: if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags)) return -EBUSY; @@ -127,14 +135,6 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, tu->reg_idx = 0; break; - case I2C_SLAVE_WRITE_REQUESTED: - if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags)) - return -EBUSY; - - memset(tu->regs, 0, TU_NUM_REGS); - tu->reg_idx = 0; - break; - case I2C_SLAVE_READ_PROCESSED: if (is_proc_call && tu->regs[TU_REG_DATAH]) tu->regs[TU_REG_DATAH]--; From patchwork Tue Aug 6 14:20:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13754942 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C08EF18D644 for ; Tue, 6 Aug 2024 14:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954044; cv=none; b=gAgQkbrrhFhEzL9Q5N3hp1hkQ6GU59aVd8TTl0BuS+h57qgyx9EphS9+qJynkFpLpnXXS72K5toYRu5T9lqUx46UJDoVTvlHR4F9jrzRWTA7WS1BuXdli9Kn1oUgMgQS+JvDi2aTW3mPoUabdMxa/pqV0ETVWmYDJeKnbvtQi7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954044; c=relaxed/simple; bh=T2TDmKcsy0NZqbKXkp8K4XvKFmQzpb5Gg9vM/KhYUzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O6jAidivD2+e+YSsBvOZ/1PCx77SkMVJg4UwNccnCJR/iCtcO6gTwECnGuvSDUk7ik79g46gOtxoqigLh13jq3zdVLbDKJcuGEmZgpZEKZ2Sj3/jkFO1p/awcIrUrzyumxdR59ovKNQt98/aPm/pt1t/gJ0Jk4SeOkba46ReKk4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=F72KxuI6; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="F72KxuI6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=A24nU/0tYo75ass/vBmrHPYsBXF3wJuThSVuV3BE8Ms=; b=F72Kxu I6IaEmBmlxn1vH031dEv/1OsMkfgwU+FV+AqLD+yrPwhS49MnsCj+NECoReb1zVN XUUZ1kkH/dTPElhEk6X4HdfY8P6yfxFP/KubX/9IKjNnS3iSxrsDAdeYUIiKrwYU vAoHWEXLq1wmZQUvaHC0S7fThMK5zYSYTC9UitZXA56P142aukvvcR9CeJ+mv+SW VCQHO2EEbKbQrrgCnevTpxCF1bSNRgfbJ2bkJoQibYJDFL6i7mUxa+aUiPxyZQjN B2fQsrAxUhdGZDRVpExoeO3oI55RiPbvdlz/8hliq5ZHQBESIZz6NEl0VW4N8Ap7 rMWi19JHaNdWPVHg== Received: (qmail 249188 invoked from network); 6 Aug 2024 16:20:38 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 Aug 2024 16:20:38 +0200 X-UD-Smtp-Session: l3s3148p1@FdltfwQfHIYgAwDPXxLGAIH3oZkcU6AS From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , linux-i2c@vger.kernel.org Subject: [PATCH 2/3] i2c: testunit: add command to support versioning and test rep_start Date: Tue, 6 Aug 2024 16:20:31 +0200 Message-ID: <20240806142033.2697-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806142033.2697-1-wsa+renesas@sang-engineering.com> References: <20240806142033.2697-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For some devices, it is essential that controllers handle repeated start correctly and do not replace it with a stop/start combination. This addition helps to test that because it will only return a version string if repeated start is done properly. Signed-off-by: Wolfram Sang --- Documentation/i2c/slave-testunit-backend.rst | 38 ++++++++++++++++++++ drivers/i2c/i2c-slave-testunit.c | 25 +++++++++++-- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/Documentation/i2c/slave-testunit-backend.rst b/Documentation/i2c/slave-testunit-backend.rst index 37142a48ab35..a0335782d109 100644 --- a/Documentation/i2c/slave-testunit-backend.rst +++ b/Documentation/i2c/slave-testunit-backend.rst @@ -133,3 +133,41 @@ later):: # i2ctransfer -y 0 w3@0x30 0x03 0x01 0x10 r? 0x10 0x0f 0x0e 0x0d 0x0c 0x0b 0x0a 0x09 0x08 0x07 0x06 0x05 0x04 0x03 0x02 0x01 0x00 + +0x04 GET_VERSION_WITH_REP_START +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - CMD + - DATAL + - DATAH + - DELAY + + * - 0x04 + - currently unused + - currently unused + - leave out, partial command! + +Partial command. After sending this command, the testunit will reply to a read +message with a NUL terminated version string based on UTS_RELEASE. The first +character is always a 'v' and the length of the version string is at maximum +128 bytes. However, it will only respond if the read message is connected to +the write message via repeated start. If your controller driver handles +repeated start correctly, this will work:: + + # i2ctransfer -y 0 w3@0x30 4 0 0 r128 + 0x76 0x36 0x2e 0x31 0x31 0x2e 0x30 0x2d 0x72 0x63 0x31 0x2d 0x30 0x30 0x30 0x30 ... + +If you want to decode to ASCII right away:: + + # echo -e "$(i2ctransfer -y 0 w3@0x30 4 0 0 r128 | sed 's/0x\(..\) \?/\\x\1/g')" + v6.11.0-rc1-00009-gd37a1b4d3fd0 + +STOP/START combinations between the two messages will *not* work because they +are not equivalent to a REPEATED START. As an example, this returns just the +default response:: + + # i2cset -y 0 0x30 4 0 0 i; i2cget -y 0 0x30 + 0x01 diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c index be1d2e900aef..19296ff09930 100644 --- a/drivers/i2c/i2c-slave-testunit.c +++ b/drivers/i2c/i2c-slave-testunit.c @@ -6,6 +6,7 @@ * Copyright (C) 2020 by Renesas Electronics Corporation */ +#include #include #include #include @@ -15,11 +16,13 @@ #include /* FIXME: is system_long_wq the best choice? */ #define TU_CUR_VERSION 0x01 +#define TU_VERSION_MAX_LENGTH 128 enum testunit_cmds { TU_CMD_READ_BYTES = 1, /* save 0 for ABORT, RESET or similar */ TU_CMD_SMBUS_HOST_NOTIFY, TU_CMD_SMBUS_BLOCK_PROC_CALL, + TU_CMD_GET_VERSION_WITH_REP_START, TU_NUM_CMDS }; @@ -39,10 +42,13 @@ struct testunit_data { unsigned long flags; u8 regs[TU_NUM_REGS]; u8 reg_idx; + u8 read_idx; struct i2c_client *client; struct delayed_work worker; }; +static char tu_version_info[] = "v" UTS_RELEASE "\0"; + static void i2c_slave_testunit_work(struct work_struct *work) { struct testunit_data *tu = container_of(work, struct testunit_data, worker.work); @@ -91,6 +97,8 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, struct testunit_data *tu = i2c_get_clientdata(client); bool is_proc_call = tu->reg_idx == 3 && tu->regs[TU_REG_DATAL] == 1 && tu->regs[TU_REG_CMD] == TU_CMD_SMBUS_BLOCK_PROC_CALL; + bool is_get_version = tu->reg_idx == 3 && + tu->regs[TU_REG_CMD] == TU_CMD_GET_VERSION_WITH_REP_START; int ret = 0; switch (event) { @@ -100,6 +108,7 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, memset(tu->regs, 0, TU_NUM_REGS); tu->reg_idx = 0; + tu->read_idx = 0; break; case I2C_SLAVE_WRITE_RECEIVED: @@ -136,12 +145,21 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, break; case I2C_SLAVE_READ_PROCESSED: - if (is_proc_call && tu->regs[TU_REG_DATAH]) + /* Advance until we reach the NUL character */ + if (is_get_version && tu_version_info[tu->read_idx] != 0) + tu->read_idx++; + else if (is_proc_call && tu->regs[TU_REG_DATAH]) tu->regs[TU_REG_DATAH]--; + fallthrough; case I2C_SLAVE_READ_REQUESTED: - *val = is_proc_call ? tu->regs[TU_REG_DATAH] : TU_CUR_VERSION; + if (is_get_version) + *val = tu_version_info[tu->read_idx]; + else if (is_proc_call) + *val = tu->regs[TU_REG_DATAH]; + else + *val = TU_CUR_VERSION; break; } @@ -160,6 +178,9 @@ static int i2c_slave_testunit_probe(struct i2c_client *client) i2c_set_clientdata(client, tu); INIT_DELAYED_WORK(&tu->worker, i2c_slave_testunit_work); + if (sizeof(tu_version_info) > TU_VERSION_MAX_LENGTH) + tu_version_info[TU_VERSION_MAX_LENGTH - 1] = 0; + return i2c_slave_register(client, i2c_slave_testunit_slave_cb); }; From patchwork Tue Aug 6 14:20:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13754943 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85A0E18D64B for ; Tue, 6 Aug 2024 14:20:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954044; cv=none; b=OpAQ6E15AGQC/jR86LWXe+oRNGKHodxeUY1YQhmgrTNl/QKz/HAcBT5CJuGk6A7oLEtfsZzcstUZCCVeX1Bd/sTxnZU1OS8VDfT+iBFm4Y8OfHe/sJE7WGVwxm16i8bfs6L+dMKmeUz/+Pp57bX97p1IlOngMqxe8NQrXKG+ZVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722954044; c=relaxed/simple; bh=GcbsOglTmhNNwZpS47DIxBLpCSQcEHlfmE9HWgnOAXU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fFCvH2jhLqYJn++r0yon2XmNF9HFRTCITXO12BqmF/Vak+0BsaFov523uj3jt5n5ejryr3qYNZgi8M/vrmLpQyqeRx7uukybJiL1/9RDRO8/3rulrdiBcaz2FlBYNca5WJpL8SUdw3yCQ2+2k7ia7GiP9lgA3GPp9P1xcR58/e0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=Xc9U1iDh; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="Xc9U1iDh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=OWcMsHYr3RRRiGrn/KyEpFLqpH5pnaD2wsuOUNsaofg=; b=Xc9U1i DhLf9ZxwegNhwsBTr2yNg/6TuxZ+kQrQ2bOzJtLWwFfnb4ASxanE9dlY8WZThwwu 9U95wUEXJGqeAq1ABNnCb/iqc4VT59CYfxutg4JzMzUiX8LdlEZYDFrDct/ysgUS R/4gqr3c7HGczcVORjl33f6almX4uTgTKQ65GCmQhS4sCmrL9kfuiBQlo8MxMrGT gnyzytQxlf5RMFco9XJknwIZvyZRDkIOdbGygrEX5/LcxCqrWdVMZFROYHaylMeX n7RHKLUa+wtNfSZHRzzAFZrecKhdu2P/luWqY/P6pSyE3ke7LphdWtqkdOYW6plk vZylCLEggYb2qZ1A== Received: (qmail 249214 invoked from network); 6 Aug 2024 16:20:39 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 Aug 2024 16:20:39 +0200 X-UD-Smtp-Session: l3s3148p1@/I96fwQfIIYgAwDPXxLGAIH3oZkcU6AS From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , linux-i2c@vger.kernel.org Subject: [PATCH 3/3] i2c: testunit: return current command on read messages Date: Tue, 6 Aug 2024 16:20:32 +0200 Message-ID: <20240806142033.2697-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806142033.2697-1-wsa+renesas@sang-engineering.com> References: <20240806142033.2697-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Because the testunit can start tests in the future via the DELAY register, it may happen that a command is still pending. Support detecting that by returning the number of a command in progress (if there is one). Signed-off-by: Wolfram Sang --- Documentation/i2c/slave-testunit-backend.rst | 14 ++++++++------ drivers/i2c/i2c-slave-testunit.c | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Documentation/i2c/slave-testunit-backend.rst b/Documentation/i2c/slave-testunit-backend.rst index a0335782d109..b558adc59af2 100644 --- a/Documentation/i2c/slave-testunit-backend.rst +++ b/Documentation/i2c/slave-testunit-backend.rst @@ -20,11 +20,13 @@ Instantiating the device is regular. Example for bus 0, address 0x30:: # echo "slave-testunit 0x1030" > /sys/bus/i2c/devices/i2c-0/new_device -After that, you will have a write-only device listening. Reads will just return -an 8-bit version number of the testunit. When writing, the device consists of 4 -8-bit registers and, except for some "partial" commands, all registers must be -written to start a testcase, i.e. you usually write 4 bytes to the device. The -registers are: +After that, you will have the device listening. Reading will return a single +byte. Its value is 0 if the testunit is idle, otherwise the command number of +the currently running command. + +When writing, the device consists of 4 8-bit registers and, except for some +"partial" commands, all registers must be written to start a testcase, i.e. you +usually write 4 bytes to the device. The registers are: .. csv-table:: :header: "Offset", "Name", "Description" @@ -170,4 +172,4 @@ are not equivalent to a REPEATED START. As an example, this returns just the default response:: # i2cset -y 0 0x30 4 0 0 i; i2cget -y 0 0x30 - 0x01 + 0x00 diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c index 19296ff09930..a3e1b5e8b659 100644 --- a/drivers/i2c/i2c-slave-testunit.c +++ b/drivers/i2c/i2c-slave-testunit.c @@ -15,7 +15,6 @@ #include #include /* FIXME: is system_long_wq the best choice? */ -#define TU_CUR_VERSION 0x01 #define TU_VERSION_MAX_LENGTH 128 enum testunit_cmds { @@ -159,7 +158,8 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, else if (is_proc_call) *val = tu->regs[TU_REG_DATAH]; else - *val = TU_CUR_VERSION; + *val = test_bit(TU_FLAG_IN_PROCESS, &tu->flags) ? + tu->regs[TU_REG_CMD] : 0; break; }