From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
lgirdwood@gmail.com
Subject: Re: [PATCH 2/2] ASoC: wm8804: Merge CODEC probe and bus probe
Date: Sat, 28 Feb 2015 17:38:01 +0000 [thread overview]
Message-ID: <20150228173801.GA6626@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1424623402-473-2-git-send-email-ckeepax@opensource.wolfsonmicro.com>
On Sun, Feb 22, 2015 at 04:43:22PM +0000, Charles Keepax wrote:
> From: Charles Keepax <ckeepax@gmail.com>
>
> All of the things in the CODEC probe, such as getting the regulators and
> verifying the chip ID, are better done in bus probe. It is better to
> fail during bus probe if this is the wrong chip and all resource
> allocation should be done in the bus probe anyway. This patch merges
> the CODEC probe into bus probe.
>
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
> sound/soc/codecs/wm8804.c | 180 ++++++++++++++++++++------------------------
> 1 files changed, 82 insertions(+), 98 deletions(-)
>
> diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
> index b5a04fc..1bd4ace 100644
> --- a/sound/soc/codecs/wm8804.c
> +++ b/sound/soc/codecs/wm8804.c
> @@ -182,9 +182,9 @@ static bool wm8804_volatile(struct device *dev, unsigned int reg)
> }
> }
>
> -static int wm8804_reset(struct snd_soc_codec *codec)
> +static int wm8804_reset(struct wm8804_priv *wm8804)
> {
> - return snd_soc_write(codec, WM8804_RST_DEVID1, 0x0);
> + return regmap_write(wm8804->regmap, WM8804_RST_DEVID1, 0x0);
> }
>
<snip>
> + if (id2 != 0x8805) {
> + dev_err(dev, "Invalid device ID: %#x\n", id2);
> + ret = -EINVAL;
> + goto err_reg_enable;
> + }
> +
> + ret = regmap_read(regmap, WM8804_DEVREV, &id1);
> + if (ret < 0) {
> + dev_err(dev, "Failed to read device revision: %d\n",
> + ret);
> + goto err_reg_enable;
> + }
> + dev_info(dev, "revision %c\n", id1 + 'A');
> +
> + ret = wm8804_reset(wm8804);
> + if (ret < 0) {
> + dev_err(dev, "Failed to issue reset: %d\n", ret);
> + goto err_reg_enable;
> + }
> +
> return snd_soc_register_codec(dev, &soc_codec_dev_wm8804,
> &wm8804_dai, 1);
Oops... we should goto err_reg_enable if this fails. I will send
a new version on Monday.
> +
> +err_reg_enable:
> + regulator_bulk_disable(ARRAY_SIZE(wm8804->supplies), wm8804->supplies);
> + return ret;
> }
> EXPORT_SYMBOL_GPL(wm8804_probe);
>
Thanks,
Charles
prev parent reply other threads:[~2015-02-28 17:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-22 16:43 [PATCH 1/2] ASoC: wm8804: Split out bus drivers Charles Keepax
2015-02-22 16:43 ` [PATCH 2/2] ASoC: wm8804: Merge CODEC probe and bus probe Charles Keepax
2015-02-28 17:38 ` Charles Keepax [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=20150228173801.GA6626@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=patches@opensource.wolfsonmicro.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 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.