From: Michael Zaidman <michael.zaidman@gmail.com>
To: jikos@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
linux-i2c@vger.kernel.org, germain.hebert@ca.abb.com,
Enrik.Berkhan@inka.de,
Michael Zaidman <michael.zaidman@gmail.com>,
Vince Asbridge <VAsbridge@sanblaze.com>,
Stephen Shirron <SShirron@sanblaze.com>
Subject: [PATCH v3 08/12] HID: ft260: remove SMBus Quick command support
Date: Sun, 30 Oct 2022 22:33:59 +0200 [thread overview]
Message-ID: <20221030203403.4637-9-michael.zaidman@gmail.com> (raw)
In-Reply-To: <20221030203403.4637-1-michael.zaidman@gmail.com>
The i2cdetect uses the SMBus Quick command by default to scan devices
on the I2C bus. The FT260 implements an I2C bus controller. The SMBus
is derived from I2C, but there are several differences between the
specifications of the two buses in the areas of timing, protocols,
operation modes, and electrical characteristics.
One of the differences is that the I2C devices allow the slave not
to ACK its slave address, but SMBus requires it to always ACK it as
a mechanism to detect a detachable device’s presence on the bus.
Since FT260 is the I2C bus controller, it does not acknowledge the
SMBus Quick write command, which sends a single bit to the device at
the place of the RD/WR bit.
The ft260 driver attempted to mimic the SMBus Quick Write functionality
by writing a single byte as the SMBus Byte Write command does.
Usually, one byte in the SMBus Quick Write will be fine. However, it may
cause problems with devices with a control register at offset 0, like
i2c muxes, for example, when scanned with the i2cdetect utility.
The i2cdetect with the "-r" option uses the SMBus Read Byte command,
which is a reasonable workaround. To prevent the I2C bus from locking
at write-only devices (most notably clock chips at address 0x69), use
the "-r" option in conjunction with scanning range parameters.
This patch removes the SMBus Quick command support.
$ sudo i2cdetect -y 13
Warning: Can't use SMBus Quick Write command, will skip some addresses
0 1 2 3 4 5 6 7 8 9 a b c d e f
00:
10:
20:
30: -- -- -- -- -- -- -- --
40:
50: 50 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60:
70:
$ sudo i2cdetect -y -r 13
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Reported-by: Vince Asbridge <VAsbridge@sanblaze.com>
Reported-by: Stephen Shirron <SShirron@sanblaze.com>
Reported-by: Enrik Berkhan <Enrik.Berkhan@inka.de>
Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
---
drivers/hid/hid-ft260.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c
index 8b6ebc5228eb..d186aa5a8e73 100644
--- a/drivers/hid/hid-ft260.c
+++ b/drivers/hid/hid-ft260.c
@@ -630,14 +630,6 @@ static int ft260_smbus_xfer(struct i2c_adapter *adapter, u16 addr, u16 flags,
}
switch (size) {
- case I2C_SMBUS_QUICK:
- if (read_write == I2C_SMBUS_READ)
- ret = ft260_i2c_read(dev, addr, &data->byte, 0,
- FT260_FLAG_START_STOP);
- else
- ret = ft260_smbus_write(dev, addr, cmd, NULL, 0,
- FT260_FLAG_START_STOP);
- break;
case I2C_SMBUS_BYTE:
if (read_write == I2C_SMBUS_READ)
ret = ft260_i2c_read(dev, addr, &data->byte, 1,
@@ -720,7 +712,7 @@ static int ft260_smbus_xfer(struct i2c_adapter *adapter, u16 addr, u16 flags,
static u32 ft260_functionality(struct i2c_adapter *adap)
{
- return I2C_FUNC_I2C | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_QUICK |
+ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_I2C_BLOCK;
}
--
2.34.1
next prev parent reply other threads:[~2022-10-30 20:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-30 20:33 [PATCH v3 00/12] HID: ft260: fixes and performance improvements Michael Zaidman
2022-10-30 20:33 ` [PATCH v3 01/12] HID: ft260: ft260_xfer_status routine cleanup Michael Zaidman
2022-10-30 20:33 ` [PATCH v3 02/12] HID: ft260: improve i2c write performance Michael Zaidman
2022-10-30 20:33 ` [PATCH v3 03/12] HID: ft260: support i2c writes larger than HID report size Michael Zaidman
2022-10-30 20:33 ` [PATCH v3 04/12] HID: ft260: support i2c reads greater " Michael Zaidman
2022-10-30 20:33 ` [PATCH v3 05/12] HID: ft260: improve i2c large reads performance Michael Zaidman
2022-10-30 20:33 ` [PATCH v3 06/12] HID: ft260: do not populate /dev/hidraw device Michael Zaidman
2022-10-30 20:33 ` [PATCH v3 07/12] HID: ft260: skip unexpected HID input reports Michael Zaidman
2022-10-30 20:33 ` Michael Zaidman [this message]
2022-10-30 20:34 ` [PATCH v3 09/12] HID: ft260: missed NACK from big i2c read Michael Zaidman
2022-10-30 20:34 ` [PATCH v3 10/12] HID: ft260: wake up device from power saving mode Michael Zaidman
2022-10-31 17:12 ` Enrik Berkhan
2022-10-30 20:34 ` [PATCH v3 11/12] HID: ft260: fix a NULL pointer dereference in ft260_i2c_write Michael Zaidman
2022-10-30 20:34 ` [PATCH v3 12/12] HID: ft260: missed NACK from busy device Michael Zaidman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221030203403.4637-9-michael.zaidman@gmail.com \
--to=michael.zaidman@gmail.com \
--cc=Enrik.Berkhan@inka.de \
--cc=SShirron@sanblaze.com \
--cc=VAsbridge@sanblaze.com \
--cc=germain.hebert@ca.abb.com \
--cc=jikos@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).