[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53515BFA.3060601@metafoo.de>
Date: Fri, 18 Apr 2014 19:08:10 +0200
From: Lars-Peter Clausen <lars@...afoo.de>
To: Boris BREZILLON <boris.brezillon@...e-electrons.com>
CC: Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Maxime Ripard <maxime.ripard@...e-electrons.com>,
Shuge <shuge@...winnertech.com>, kevin@...winnertech.com,
Chen-Yu Tsai <wens@...e.org>,
Hans de Goede <hdegoede@...hat.com>,
Carlo Caione <carlo@...one.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
dev@...ux-sunxi.org
Subject: Re: [PATCH v2 2/2] regmap: i2c: fallback to SMBus if the adapter
does not support standard I2C
> +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);
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists