public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] i2c: i801: Drop useless masking in i801_access
@ 2022-03-01 16:28 Jean Delvare
  2022-03-01 16:39 ` [PATCH 2/2] i2c: i801: Add support for the Process Call command Jean Delvare
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jean Delvare @ 2022-03-01 16:28 UTC (permalink / raw)
  To: Linux I2C; +Cc: Heiner Kallweit, Jarkko Nikula

I went all the way back to kernel 2.6.12 and that masking was never
needed. I suppose it was there in anticipation of software PEC
support, but that was never added to the driver (and never will be,
as this is made obsolete by hardware PEC).

I'm also removing initialization to 0, which is not needed either,
and would prevent the compiler from reporting an actual usage of
uninitialized variables.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 drivers/i2c/busses/i2c-i801.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-5.16.orig/drivers/i2c/busses/i2c-i801.c	2022-03-01 10:41:26.946201705 +0100
+++ linux-5.16/drivers/i2c/busses/i2c-i801.c	2022-03-01 10:52:45.376001496 +0100
@@ -792,7 +792,7 @@ static s32 i801_access(struct i2c_adapte
 {
 	int hwpec;
 	int block = 0;
-	int ret = 0, xact = 0;
+	int ret, xact;
 	struct i801_priv *priv = i2c_get_adapdata(adap);
 
 	mutex_lock(&priv->acpi_lock);
@@ -904,7 +904,7 @@ static s32 i801_access(struct i2c_adapte
 	if ((read_write == I2C_SMBUS_WRITE) || (xact == I801_QUICK))
 		goto out;
 
-	switch (xact & 0x7f) {
+	switch (xact) {
 	case I801_BYTE:	/* Result put in SMBHSTDAT0 */
 	case I801_BYTE_DATA:
 		data->byte = inb_p(SMBHSTDAT0(priv));


-- 
Jean Delvare
SUSE L3 Support

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

* [PATCH 2/2] i2c: i801: Add support for the Process Call command
  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
  2022-03-02 14:12   ` Jarkko Nikula
  2022-03-02 13:54 ` [PATCH 1/2] i2c: i801: Drop useless masking in i801_access Jarkko Nikula
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Jean Delvare @ 2022-03-01 16:39 UTC (permalink / raw)
  To: Linux I2C; +Cc: Heiner Kallweit, Jarkko Nikula

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

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

* Re: [PATCH 1/2] i2c: i801: Drop useless masking in i801_access
  2022-03-01 16:28 [PATCH 1/2] i2c: i801: Drop useless masking in i801_access Jean Delvare
  2022-03-01 16:39 ` [PATCH 2/2] i2c: i801: Add support for the Process Call command Jean Delvare
@ 2022-03-02 13:54 ` Jarkko Nikula
  2022-03-02 21:12 ` Wolfram Sang
  2022-03-02 21:13 ` Wolfram Sang
  3 siblings, 0 replies; 8+ messages in thread
From: Jarkko Nikula @ 2022-03-02 13:54 UTC (permalink / raw)
  To: Jean Delvare, Linux I2C; +Cc: Heiner Kallweit

On 3/1/22 18:28, Jean Delvare wrote:
> I went all the way back to kernel 2.6.12 and that masking was never
> needed. I suppose it was there in anticipation of software PEC
> support, but that was never added to the driver (and never will be,
> as this is made obsolete by hardware PEC).
> 
> I'm also removing initialization to 0, which is not needed either,
> and would prevent the compiler from reporting an actual usage of
> uninitialized variables.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> ---
>   drivers/i2c/busses/i2c-i801.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

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

* Re: [PATCH 2/2] i2c: i801: Add support for the Process Call command
  2022-03-01 16:39 ` [PATCH 2/2] i2c: i801: Add support for the Process Call command Jean Delvare
@ 2022-03-02 14:12   ` Jarkko Nikula
  0 siblings, 0 replies; 8+ messages in thread
From: Jarkko Nikula @ 2022-03-02 14:12 UTC (permalink / raw)
  To: Jean Delvare, Linux I2C; +Cc: Heiner Kallweit

On 3/1/22 18:39, Jean Delvare wrote:
> 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(-)
> 
As far as I can see this follows how it is depicted in the specification.

Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

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

* Re: [PATCH 1/2] i2c: i801: Drop useless masking in i801_access
  2022-03-01 16:28 [PATCH 1/2] i2c: i801: Drop useless masking in i801_access Jean Delvare
  2022-03-01 16:39 ` [PATCH 2/2] i2c: i801: Add support for the Process Call command Jean Delvare
  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
  3 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2022-03-02 21:12 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Linux I2C, Heiner Kallweit, Jarkko Nikula

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

On Tue, Mar 01, 2022 at 05:28:59PM +0100, Jean Delvare wrote:
> I went all the way back to kernel 2.6.12 and that masking was never
> needed. I suppose it was there in anticipation of software PEC
> support, but that was never added to the driver (and never will be,
> as this is made obsolete by hardware PEC).
> 
> I'm also removing initialization to 0, which is not needed either,
> and would prevent the compiler from reporting an actual usage of
> uninitialized variables.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>

Applied to for-next, thanks!


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

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

* Re: [PATCH 1/2] i2c: i801: Drop useless masking in i801_access
  2022-03-01 16:28 [PATCH 1/2] i2c: i801: Drop useless masking in i801_access Jean Delvare
                   ` (2 preceding siblings ...)
  2022-03-02 21:12 ` Wolfram Sang
@ 2022-03-02 21:13 ` Wolfram Sang
  2022-03-03 16:41   ` Jean Delvare
  3 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2022-03-02 21:13 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Linux I2C, Heiner Kallweit, Jarkko Nikula

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

On Tue, Mar 01, 2022 at 05:28:59PM +0100, Jean Delvare wrote:
> I went all the way back to kernel 2.6.12 and that masking was never
> needed. I suppose it was there in anticipation of software PEC
> support, but that was never added to the driver (and never will be,
> as this is made obsolete by hardware PEC).
> 
> I'm also removing initialization to 0, which is not needed either,
> and would prevent the compiler from reporting an actual usage of
> uninitialized variables.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>

Applied to for-next, thanks!

Jean, there are still some patches pending for i801, mainly from Heiner
and an interesting one from Hector. Do you have time for these?

http://patchwork.ozlabs.org/project/linux-i2c/list/?series=&submitter=&state=&q=i801&archive=&delegate=


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

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

* Re: [PATCH 1/2] i2c: i801: Drop useless masking in i801_access
  2022-03-02 21:13 ` Wolfram Sang
@ 2022-03-03 16:41   ` Jean Delvare
  2022-03-03 18:22     ` Wolfram Sang
  0 siblings, 1 reply; 8+ messages in thread
From: Jean Delvare @ 2022-03-03 16:41 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Heiner Kallweit, Jarkko Nikula

Hi Wolfram,

On Wed, 2 Mar 2022 22:13:27 +0100, Wolfram Sang wrote:
> On Tue, Mar 01, 2022 at 05:28:59PM +0100, Jean Delvare wrote:
> > I went all the way back to kernel 2.6.12 and that masking was never
> > needed. I suppose it was there in anticipation of software PEC
> > support, but that was never added to the driver (and never will be,
> > as this is made obsolete by hardware PEC).
> > 
> > I'm also removing initialization to 0, which is not needed either,
> > and would prevent the compiler from reporting an actual usage of
> > uninitialized variables.
> > 
> > Signed-off-by: Jean Delvare <jdelvare@suse.de>  
> 
> Applied to for-next, thanks!
> 
> Jean, there are still some patches pending for i801, mainly from Heiner
> and an interesting one from Hector. Do you have time for these?
> 
> http://patchwork.ozlabs.org/project/linux-i2c/list/?series=&submitter=&state=&q=i801&archive=&delegate=

Yes, they are on my to-do list and not forgotten. Just I had a fairly
busy January and February. Plus I am currently investigating 2 i2c-i801
issues that have been reported to me privately, and I'd rather get them
fixed first before we continue with driver cleanups.

Stay tuned,
-- 
Jean Delvare
SUSE L3 Support

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

* Re: [PATCH 1/2] i2c: i801: Drop useless masking in i801_access
  2022-03-03 16:41   ` Jean Delvare
@ 2022-03-03 18:22     ` Wolfram Sang
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2022-03-03 18:22 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Linux I2C, Heiner Kallweit, Jarkko Nikula

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


> Yes, they are on my to-do list and not forgotten. Just I had a fairly
> busy January and February. Plus I am currently investigating 2 i2c-i801
> issues that have been reported to me privately, and I'd rather get them
> fixed first before we continue with driver cleanups.

OK, thanks for the heads up!


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

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

end of thread, other threads:[~2022-03-03 18:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-01 16:28 [PATCH 1/2] i2c: i801: Drop useless masking in i801_access Jean Delvare
2022-03-01 16:39 ` [PATCH 2/2] i2c: i801: Add support for the Process Call command Jean Delvare
2022-03-02 14:12   ` 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

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