All of lore.kernel.org
 help / color / mirror / Atom feed
From: boris.brezillon@free-electrons.com (Boris BREZILLON)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] regmap: i2c: fallback to SMBus if the adapter does not support standard I2C
Date: Wed, 16 Apr 2014 19:16:14 +0200	[thread overview]
Message-ID: <534EBADE.1000608@free-electrons.com> (raw)
In-Reply-To: <20140416170638.GT12304@sirena.org.uk>

Hello Mark,

On 16/04/2014 19:06, Mark Brown wrote:
> On Wed, Apr 16, 2014 at 10:16:10AM +0200, Boris BREZILLON wrote:
>
>> +	if (i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) {
>> +		return &regmap_i2c;
>> +	} else if (config->val_bits == 16 &&
>> +		   i2c_check_functionality(i2c->adapter,
>> +					   I2C_FUNC_SMBUS_WORD_DATA)) {
>> +                config->reg_read = regmap_smbus_word_reg_read;
>> +                config->reg_write = regmap_smbus_word_reg_write;
>> +		return NULL;
> This all looks good to me except we shouldn't be modifying the config
> struct (it's supposed to be const).  We should instead add the ability
> for the bus to set these ops - that'll also be useful for things like
> AC'97.

Actually I do not modify the passed config struct, I copy the config
values into a local instance and then modify this local instance
appropriately.
But I agree that having a proper way to overload config parameters would
be better.
Any suggestion on how this should be done ?

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Boris BREZILLON <boris.brezillon@free-electrons.com>
To: Mark Brown <broonie@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Shuge <shuge@allwinnertech.com>,
	kevin@allwinnertech.com, Chen-Yu Tsai <wens@csie.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Carlo Caione <carlo@caione.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, dev@linux-sunxi.org
Subject: Re: [PATCH] regmap: i2c: fallback to SMBus if the adapter does not support standard I2C
Date: Wed, 16 Apr 2014 19:16:14 +0200	[thread overview]
Message-ID: <534EBADE.1000608@free-electrons.com> (raw)
In-Reply-To: <20140416170638.GT12304@sirena.org.uk>

Hello Mark,

On 16/04/2014 19:06, Mark Brown wrote:
> On Wed, Apr 16, 2014 at 10:16:10AM +0200, Boris BREZILLON wrote:
>
>> +	if (i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) {
>> +		return &regmap_i2c;
>> +	} else if (config->val_bits == 16 &&
>> +		   i2c_check_functionality(i2c->adapter,
>> +					   I2C_FUNC_SMBUS_WORD_DATA)) {
>> +                config->reg_read = regmap_smbus_word_reg_read;
>> +                config->reg_write = regmap_smbus_word_reg_write;
>> +		return NULL;
> This all looks good to me except we shouldn't be modifying the config
> struct (it's supposed to be const).  We should instead add the ability
> for the bus to set these ops - that'll also be useful for things like
> AC'97.

Actually I do not modify the passed config struct, I copy the config
values into a local instance and then modify this local instance
appropriately.
But I agree that having a proper way to overload config parameters would
be better.
Any suggestion on how this should be done ?

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


  reply	other threads:[~2014-04-16 17:16 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-12  8:45 [RFC PATCH] regmap: smbus: add support for regmap over SMBus Boris BREZILLON
2014-04-12  8:45 ` Boris BREZILLON
2014-04-12  9:02 ` Boris BREZILLON
2014-04-12  9:02   ` Boris BREZILLON
2014-04-14 13:08 ` [RFC PATCH v2] " Boris BREZILLON
2014-04-14 13:08   ` Boris BREZILLON
2014-04-14 21:04   ` Mark Brown
2014-04-14 21:04     ` Mark Brown
2014-04-15  7:36     ` Boris BREZILLON
2014-04-15  7:36       ` Boris BREZILLON
2014-04-15 10:09       ` Mark Brown
2014-04-15 10:09         ` Mark Brown
2014-04-15 11:54         ` Boris BREZILLON
2014-04-15 11:54           ` Boris BREZILLON
2014-04-15 12:10           ` Mark Brown
2014-04-15 12:10             ` Mark Brown
2014-04-15 12:25           ` Lars-Peter Clausen
2014-04-15 12:25             ` Lars-Peter Clausen
2014-04-15 12:40             ` Boris BREZILLON
2014-04-15 12:40               ` Boris BREZILLON
2014-04-15 13:08               ` Lars-Peter Clausen
2014-04-15 13:08                 ` Lars-Peter Clausen
2014-04-15 12:56             ` [RFC PATCH v2] regmap: smbus: add support for regmap over smbus Mark Brown
2014-04-15 12:56               ` Mark Brown
2014-04-15 13:34               ` Lars-Peter Clausen
2014-04-15 13:34                 ` Lars-Peter Clausen
2014-04-15 16:46                 ` Mark Brown
2014-04-15 16:46                   ` Mark Brown
2014-04-15 19:18                   ` Lars-Peter Clausen
2014-04-15 19:18                     ` Lars-Peter Clausen
2014-04-15 22:38                     ` Mark Brown
2014-04-15 22:38                       ` Mark Brown
2014-04-16  8:16                       ` [PATCH] regmap: i2c: fallback to SMBus if the adapter does not support standard I2C Boris BREZILLON
2014-04-16  8:16                         ` Boris BREZILLON
2014-04-16 17:06                         ` Mark Brown
2014-04-16 17:06                           ` Mark Brown
2014-04-16 17:16                           ` Boris BREZILLON [this message]
2014-04-16 17:16                             ` Boris BREZILLON
2014-04-16 21:00                             ` Mark Brown
2014-04-16 21:00                               ` Mark Brown

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=534EBADE.1000608@free-electrons.com \
    --to=boris.brezillon@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.