linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: michaelsh@mellanox.com
To: wsa@the-dreams.de
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michael Shych <michaelsh@mellanox.com>
Subject: [PATCH v1 - resent 3/5] i2c: busses: Fix adapter functionality support callback
Date: Tue, 27 Mar 2018 14:01:24 +0000	[thread overview]
Message-ID: <1522159286-41779-4-git-send-email-michaelsh@mellanox.com> (raw)
In-Reply-To: <1522159286-41779-1-git-send-email-michaelsh@mellanox.com>

From: Michael Shych <michaelsh@mellanox.com>

It fixes report about supported functionality.
Functionality can be different up to CPLD capability.

Fixes: 6bec23bff9149 (i2c: mlxcpld: add master driver for mellanox systems)
Signed-off-by: Michael Shych <michaelsh@mellanox.com>
---
 drivers/i2c/busses/i2c-mlxcpld.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c
index 4d8efe0..7341cee9 100644
--- a/drivers/i2c/busses/i2c-mlxcpld.c
+++ b/drivers/i2c/busses/i2c-mlxcpld.c
@@ -450,7 +450,14 @@ static int mlxcpld_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
 
 static u32 mlxcpld_i2c_func(struct i2c_adapter *adap)
 {
-	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_BLOCK_DATA;
+	struct mlxcpld_i2c_priv *priv = i2c_get_adapdata(adap);
+
+	if (priv->smbus_block)
+		return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
+			I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_BLOCK_DATA;
+	else
+		return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
+			I2C_FUNC_SMBUS_I2C_BLOCK;
 }
 
 static const struct i2c_algorithm mlxcpld_i2c_algo = {
-- 
2.1.4

  parent reply	other threads:[~2018-03-27 14:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 14:01 [PATCH v1 - resent 0/5] Add capabilities to i2c-mlxcpld michaelsh
2018-03-27 14:01 ` [PATCH v1 - resent 1/5] i2c: busses: Add support for extended transaction length for i2c-mlxcpld michaelsh
2018-03-27 14:01 ` [PATCH v1 - resent 2/5] i2c: busses: Add support for smbus block read transaction michaelsh
2018-03-27 14:01 ` michaelsh [this message]
2018-03-27 14:01 ` [PATCH v1 - resent 4/5] i2c: busses: Allow configurable adapter id for mlxcpld michaelsh
2018-03-27 14:01 ` [PATCH v1 - resent 5/5] i2c: busses: Add capability register description to documentation michaelsh
2018-04-28 13:22 ` [PATCH v1 - resent 0/5] Add capabilities to i2c-mlxcpld 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=1522159286-41779-4-git-send-email-michaelsh@mellanox.com \
    --to=michaelsh@mellanox.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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).