From: lars@metafoo.de (Lars-Peter Clausen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] regmap: i2c: fallback to SMBus if the adapter does not support standard I2C
Date: Fri, 18 Apr 2014 19:08:10 +0200 [thread overview]
Message-ID: <53515BFA.3060601@metafoo.de> (raw)
In-Reply-To: <1397727612-32103-3-git-send-email-boris.brezillon@free-electrons.com>
> +const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
> + const struct regmap_config *config)
> +{
> + if (i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C))
> + return ®map_i2c;
> + else if (config->val_bits == 16 &&
> + i2c_check_functionality(i2c->adapter,
> + I2C_FUNC_SMBUS_WORD_DATA))
> + return ®map_smbus_word;
> + else if (config->val_bits == 8 &&
> + i2c_check_functionality(i2c->adapter,
> + I2C_FUNC_SMBUS_BYTE_DATA))
> + return ®map_smbus_byte;
The fallback code should also check that reg_bits is 8.
> +
> + return ERR_PTR(-ENOTSUPP);
> +}
> +
next prev parent reply other threads:[~2014-04-18 17:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 9:40 [PATCH v2 0/2] regmap: support regmap over SMBus Boris BREZILLON
2014-04-17 9:40 ` [PATCH v2 1/2] regmap: add reg_read/reg_write callbacks to regmap_bus struct Boris BREZILLON
2014-04-18 15:08 ` Mark Brown
2014-04-17 9:40 ` [PATCH v2 2/2] regmap: i2c: fallback to SMBus if the adapter does not support standard I2C Boris BREZILLON
2014-04-18 15:10 ` Mark Brown
2014-04-18 17:08 ` Lars-Peter Clausen [this message]
2014-04-18 20:11 ` [PATCH v3] " Boris BREZILLON
2014-04-19 1:57 ` Guenter Roeck
2014-04-21 20:56 ` [PATCH v4] " Boris BREZILLON
2014-04-22 11:57 ` 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=53515BFA.3060601@metafoo.de \
--to=lars@metafoo.de \
--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 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).