From: Mark Brown <broonie@kernel.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>, alsa-devel@alsa-project.org
Subject: Re: [PATCH] ASoC: sgtl5000: Convert to use regmap directly
Date: Sun, 5 May 2013 11:21:48 +0100 [thread overview]
Message-ID: <20130505102148.GU4945@sirena.org.uk> (raw)
In-Reply-To: <1367692780-23550-1-git-send-email-festevam@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1514 bytes --]
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...
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
prev parent reply other threads:[~2013-05-05 10:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-04 18:39 [PATCH] ASoC: sgtl5000: Convert to use regmap directly Fabio Estevam
2013-05-05 10:21 ` Mark Brown [this message]
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=20130505102148.GU4945@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=fabio.estevam@freescale.com \
--cc=festevam@gmail.com \
/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