All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: jassi brar <jassisinghbrar@gmail.com>
Cc: alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org, ben-linux@fluff.org,
	lrg@slimlogic.co.uk, linux-samsung-soc@vger.kernel.org,
	Jassi Brar <jassi.brar@samsung.com>
Subject: Re: [PATCH 2/3] ASoC: AC97: S3C: Add controller driver
Date: Tue, 26 Jan 2010 13:00:57 +0000	[thread overview]
Message-ID: <20100126130057.GS15759@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1b68c6791001260411u2b39d8actf35a0f3541fda92d@mail.gmail.com>

On Tue, Jan 26, 2010 at 09:11:55PM +0900, jassi brar wrote:
> On Tue, Jan 26, 2010 at 8:52 PM, Mark Brown

> > That's not addressing the problem, though - the big issue is not
> > bringing up the AC97 link, it's the fact that you're doing an
> > uncontrolled cold reset.  If we hit this code path it'll revert the
> > device registers to default which will upset the drivers for the CODEC
> > rather badly.  There should be no possibility of that happening, if it
> > is happening it's something that callers really should know about.

> It should never be reached after the link is up and running. Only if something
> goes wrong at runtime, would the controller state be changed. And
> this is an attempt to recover from that failure. If the upper layer should
> know of such failure, then maybe we should not do it.
> I have never seen such runtime error though.

Sounds like the code should be changed to log and return an error if
that case is hit?

> 
> >> >> +     ac_glbctrl = S3C_AC97_GLBCTRL_ACLINKON;
> >> >> +     writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL);
> >> >> +     msleep(1);

...

> I assume the ALSA definition of cold/warm reset is same as that of
> the AC97 controller. Anything remaining should be done only when necessary.
> For ex, the ALSA might want to leave controller after just cold/warm
> reset ... as
> the SoC manual says it's in low-power mode without the AC-link on.

A warm reset pretty much means "start the AC-link" - it's what you do to
exit low power mode and start clocking the link (which is mastered by
the CODEC), it doesn't have any other effect.  That's a big part of why
this is confusing, I'd expect a warm reset would also do any setup on
the controller side that was needed to cope with the clock restarting.

Due to the way AC97 is structured this stuff is all shared between the
controller and the CODECs on the bus.  It's not particularly pretty from
a software point of view at the minute.

WARNING: multiple messages have this Message-ID (diff)
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] ASoC: AC97: S3C: Add controller driver
Date: Tue, 26 Jan 2010 13:00:57 +0000	[thread overview]
Message-ID: <20100126130057.GS15759@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1b68c6791001260411u2b39d8actf35a0f3541fda92d@mail.gmail.com>

On Tue, Jan 26, 2010 at 09:11:55PM +0900, jassi brar wrote:
> On Tue, Jan 26, 2010 at 8:52 PM, Mark Brown

> > That's not addressing the problem, though - the big issue is not
> > bringing up the AC97 link, it's the fact that you're doing an
> > uncontrolled cold reset. ?If we hit this code path it'll revert the
> > device registers to default which will upset the drivers for the CODEC
> > rather badly. ?There should be no possibility of that happening, if it
> > is happening it's something that callers really should know about.

> It should never be reached after the link is up and running. Only if something
> goes wrong at runtime, would the controller state be changed. And
> this is an attempt to recover from that failure. If the upper layer should
> know of such failure, then maybe we should not do it.
> I have never seen such runtime error though.

Sounds like the code should be changed to log and return an error if
that case is hit?

> 
> >> >> + ? ? ac_glbctrl = S3C_AC97_GLBCTRL_ACLINKON;
> >> >> + ? ? writel(ac_glbctrl, s3c_ac97.regs + S3C_AC97_GLBCTRL);
> >> >> + ? ? msleep(1);

...

> I assume the ALSA definition of cold/warm reset is same as that of
> the AC97 controller. Anything remaining should be done only when necessary.
> For ex, the ALSA might want to leave controller after just cold/warm
> reset ... as
> the SoC manual says it's in low-power mode without the AC-link on.

A warm reset pretty much means "start the AC-link" - it's what you do to
exit low power mode and start clocking the link (which is mastered by
the CODEC), it doesn't have any other effect.  That's a big part of why
this is confusing, I'd expect a warm reset would also do any setup on
the controller side that was needed to cope with the clock restarting.

Due to the way AC97 is structured this stuff is all shared between the
controller and the CODECs on the bus.  It's not particularly pretty from
a software point of view at the minute.

  reply	other threads:[~2010-01-26 13:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26  5:51 [PATCH 1/3] ARM: S3C64XX: Add AC97 platform resources jassisinghbrar
2010-01-26  5:51 ` jassisinghbrar at gmail.com
2010-01-26  5:51 ` [PATCH 2/3] ASoC: AC97: S3C: Add controller driver jassisinghbrar
2010-01-26  5:51   ` jassisinghbrar at gmail.com
2010-01-26  5:51   ` [PATCH 3/3] ARM: SMDK64XX: Enable AC97 device jassisinghbrar
2010-01-26  5:51     ` jassisinghbrar at gmail.com
2010-01-26 10:19     ` Mark Brown
2010-01-26 10:19       ` Mark Brown
2010-01-26 10:52       ` jassi brar
2010-01-26 10:52         ` jassi brar
2010-01-26 10:59         ` Mark Brown
2010-01-26 10:59           ` Mark Brown
2010-01-26  7:32   ` [PATCH 2/3] ASoC: AC97: S3C: Add controller driver jassi brar
2010-01-26  7:32     ` jassi brar
2010-01-26 10:53     ` Mark Brown
2010-01-26 10:53       ` Mark Brown
2010-01-26 11:49       ` jassi brar
2010-01-26 11:49         ` jassi brar
2010-01-26 10:23   ` Ben Dooks
2010-01-26 10:23     ` Ben Dooks
2010-01-26 11:03     ` jassi brar
2010-01-26 11:03       ` jassi brar
2010-01-26 11:09       ` Mark Brown
2010-01-26 11:09         ` Mark Brown
2010-01-26 11:57         ` jassi brar
2010-01-26 11:57           ` jassi brar
2010-01-26 12:04           ` Mark Brown
2010-01-26 12:04             ` Mark Brown
2010-01-27  2:45       ` jassi brar
2010-01-27  2:45         ` jassi brar
2010-01-27 10:25         ` Mark Brown
2010-01-27 10:25           ` Mark Brown
2010-01-26 10:47   ` Mark Brown
2010-01-26 10:47     ` Mark Brown
2010-01-26 11:17     ` jassi brar
2010-01-26 11:17       ` jassi brar
2010-01-26 11:52       ` Mark Brown
2010-01-26 11:52         ` Mark Brown
2010-01-26 12:11         ` jassi brar
2010-01-26 12:11           ` jassi brar
2010-01-26 13:00           ` Mark Brown [this message]
2010-01-26 13:00             ` Mark Brown
2010-01-26 10:12 ` [PATCH 1/3] ARM: S3C64XX: Add AC97 platform resources Mark Brown
2010-01-26 10:12   ` Mark Brown

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=20100126130057.GS15759@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=ben-linux@fluff.org \
    --cc=jassi.brar@samsung.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    /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.