public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Pascal Huerst <pascal.huerst@gmail.com>
To: brian.austin@cirrus.com
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
	Paul.Handrigan@cirrus.com
Subject: ASoC: cs4271: init/timing problem
Date: Tue, 31 Mar 2015 10:50:17 +0200	[thread overview]
Message-ID: <551A5FC9.4010109@gmail.com> (raw)

Hey all,

We have a custom built hw, based on am335x and from time to time we need
to rmmod/modprobe the ASoC machine driver. Depending on the hw, the
first call to regmap_update_bits(..) in cs4271_codec_probe(..) fails
with -EREMOTEIO.

The error is originated in:

drivers/i2c/busses/i2c-omap.c

and happens if no i2c package acknowledge is received by the host.

I think this is a timing issue and on some devices, the codec is just
not ready yet, for communication.

What is the right way to fix that? My attempt would be something like this:

const int retries = 5;

while (retries) {
	ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
                                 CS4271_MODE2_PDN | CS4271_MODE2_CPEN,
                                 CS4271_MODE2_PDN | CS4271_MODE2_CPEN);

        if (ret == -EREMOTEIO) {
                retries--;
                udelay(1);
                continue;

        } else if (ret)
                return ret;

        break;
}

But I might also just add a proper delay before the first call to
regmap_update_bits(..)

So what is the proper way to handle this?

Thanks
Pascal

             reply	other threads:[~2015-03-31  8:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31  8:50 Pascal Huerst [this message]
2015-03-31 21:01 ` ASoC: cs4271: init/timing problem Brian Austin
2015-04-01  9:57   ` Pascal Huerst
2015-04-01 10:52     ` Pascal Huerst
2015-04-01 14:47       ` Austin, Brian
2015-04-01 15:37         ` Pascal Huerst
2015-04-01 17:08           ` Brian Austin
2015-04-02  7:56             ` Pascal Huerst

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=551A5FC9.4010109@gmail.com \
    --to=pascal.huerst@gmail.com \
    --cc=Paul.Handrigan@cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=brian.austin@cirrus.com \
    --cc=broonie@kernel.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