On Sat, May 04, 2013 at 03:39:34PM -0300, Fabio Estevam wrote:
From: Fabio Estevam fabio.estevam@freescale.com
Signed-off-by: Fabio Estevam fabio.estevam@freescale.com
Applied, thanks - this can be taken a step further and
+static const struct regmap_config sgtl5000_regmap = {
- .reg_bits = 16,
- .val_bits = 16,
- .max_register = SGTL5000_MAX_REG_OFFSET,
- .volatile_reg = sgtl5000_volatile,
- .readable_reg = sgtl5000_readable,
- .cache_type = REGCACHE_RBTREE,
- .reg_defaults = sgtl5000_reg_defaults,
- .num_reg_defaults = ARRAY_SIZE(sgtl5000_reg_defaults),
+};
Based on the comments in the commit you mentioned before do we need to have some sort of register striding in there?
static int sgtl5000_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1415,6 +1485,13 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, if (!sgtl5000) return -ENOMEM;
- sgtl5000->regmap = devm_regmap_init_i2c(client, &sgtl5000_regmap);
- if (IS_ERR(sgtl5000->regmap)) {
ret = PTR_ERR(sgtl5000->regmap);
dev_err(&client->dev, "Failed to allocate regmap: %d\n", ret);
return ret;
- }
Now we have register I/O in the probe the regulator setup, device identification and so on can be pulled out here. This is more idiomatic for the device model if nothing else.
There's definitely still a bug in this driver with regard to not syncing the cache too...