public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Linux I2C <linux-i2c@vger.kernel.org>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>
Subject: [PATCH 2/2] i2c: i801: Add support for the Process Call command
Date: Tue, 1 Mar 2022 17:39:37 +0100	[thread overview]
Message-ID: <20220301173937.636a21ce@endymion.delvare> (raw)
In-Reply-To: <20220301172859.5593309a@endymion.delvare>

The Process Call command is implemented by the hardware since the very
first Intel 82801 chipset, and trivial to support. Oscar Romero
Matamala from the Georgia Institute of Technology told me it is needed
for an experiment his team is working on at the moment, so let's just
add support for it.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
Disclaimer: untested code. I don't have any device at hand which
supports the Process Call command so I just can't test it. If anyone
has a chance, please test. If not, I hope Oscar will be able to test it
soon.

 drivers/i2c/busses/i2c-i801.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- linux-5.16.orig/drivers/i2c/busses/i2c-i801.c	2022-03-01 17:06:42.685102412 +0100
+++ linux-5.16/drivers/i2c/busses/i2c-i801.c	2022-03-01 17:35:49.586064557 +0100
@@ -166,7 +166,7 @@
 #define I801_BYTE		0x04
 #define I801_BYTE_DATA		0x08
 #define I801_WORD_DATA		0x0C
-#define I801_PROC_CALL		0x10	/* unimplemented */
+#define I801_PROC_CALL		0x10
 #define I801_BLOCK_DATA		0x14
 #define I801_I2C_BLOCK_DATA	0x18	/* ICH5 and later */
 #define I801_BLOCK_PROC_CALL	0x1C
@@ -838,6 +838,14 @@ static s32 i801_access(struct i2c_adapte
 		}
 		xact = I801_WORD_DATA;
 		break;
+	case I2C_SMBUS_PROC_CALL:
+		outb_p((addr & 0x7f) << 1, SMBHSTADD(priv));
+		outb_p(command, SMBHSTCMD(priv));
+		outb_p(data->word & 0xff, SMBHSTDAT0(priv));
+		outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1(priv));
+		xact = I801_PROC_CALL;
+		read_write = I2C_SMBUS_READ;
+		break;
 	case I2C_SMBUS_BLOCK_DATA:
 		outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
 		       SMBHSTADD(priv));
@@ -910,6 +918,7 @@ static s32 i801_access(struct i2c_adapte
 		data->byte = inb_p(SMBHSTDAT0(priv));
 		break;
 	case I801_WORD_DATA:
+	case I801_PROC_CALL:
 		data->word = inb_p(SMBHSTDAT0(priv)) +
 			     (inb_p(SMBHSTDAT1(priv)) << 8);
 		break;
@@ -935,6 +944,7 @@ static u32 i801_func(struct i2c_adapter
 
 	return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
 	       I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
+	       I2C_FUNC_SMBUS_PROC_CALL |
 	       I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK |
 	       ((priv->features & FEATURE_SMBUS_PEC) ? I2C_FUNC_SMBUS_PEC : 0) |
 	       ((priv->features & FEATURE_BLOCK_PROC) ?

-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2022-03-01 16:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 16:28 [PATCH 1/2] i2c: i801: Drop useless masking in i801_access Jean Delvare
2022-03-01 16:39 ` Jean Delvare [this message]
2022-03-02 14:12   ` [PATCH 2/2] i2c: i801: Add support for the Process Call command Jarkko Nikula
2022-03-02 13:54 ` [PATCH 1/2] i2c: i801: Drop useless masking in i801_access Jarkko Nikula
2022-03-02 21:12 ` Wolfram Sang
2022-03-02 21:13 ` Wolfram Sang
2022-03-03 16:41   ` Jean Delvare
2022-03-03 18:22     ` Wolfram Sang

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=20220301173937.636a21ce@endymion.delvare \
    --to=jdelvare@suse.de \
    --cc=hkallweit1@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-i2c@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