alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Joachim Förster" <mls.JOFT@gmx.de>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	alsa-devel <alsa-devel@alsa-project.org>,
	Lorenz Kolb <lorenz.kolb@lkmail.de>,
	"linuxppc-embedded@ozlabs.org" <linuxppc-embedded@ozlabs.org>
Subject: Re: [PATCH 1/2] Xlinx ML403 AC97 Controller	Reference	device driver
Date: Fri, 10 Aug 2007 00:27:22 +0200	[thread overview]
Message-ID: <s5hejice439.wl%tiwai@suse.de> (raw)
In-Reply-To: <1186688686.28843.61.camel@localhost>

At Thu, 09 Aug 2007 21:44:46 +0200,
Joachim Förster wrote:
> 
> Hi Takashi,
> 
> before posting a corrected version, I would like to ask some unclear
> things (I think I understood the rest):
> 
> On Thu, 2007-08-09 at 19:13 +0200, Takashi Iwai wrote:
> > (snip)
> > > +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
> > > +static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
> > > +static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
> > 
> > Can the driver really support multiple instances?
> > If not, better to avoid these arrays.
> 
> Well, while I wrote the driver I considered that there might be more
> than one instance - though I didn't test it and I won't be able to test
> it (no such hardware available - with more than one LM4550 chip).
> So, shall I remove it?

It's up to you.  If it makes the code easier and more maintenable,
it's worth to try.

> > > +struct lm4550_reg lm4550_regfile[64] = {
> > > +	{.reg = 0x00,
> > > +	 .flag = LM4550_REG_NOSAVE | LM4550_REG_FAKEREAD,
> > > +	 .def = 0x0D50},
> > 
> > Better to use C99 style initialization here, e.g.
> > 
> > 	[0x00] = { .... },
> > 	[0x02] = { .... },
> > 	[0x7e] = { .... },
> > 
> > so you can avoid writing empty items.
> > The index value could be also AC97_XXX, such as [AC97_MASTER] =
> > {...}.
> > 
> > What is the purpose of reg field at all, BTW?  I guess it's
> > superfluous.
> 
> No, it's there to provide a shadow copy of the codec's (LM4550)
> registers.

That I understood too.  My question was the reg _field_.  It looks
like an index but it can be even easily calculated from the pointer
address...

> It contains default values and (while driver is running)
> current values, which were written to the hardware. I had to introduce
> this, because Xilinx's AC97 Controller Reference has a very ugly bug: It
> provides a "register access finish" bit, so the driver is able to tell
> when a register read or write access is finished. Unfortunately this
> particular bit only works in the range of 0 to 100 times since board
> reset. After that many register access it just remains saying: I'm _not_
> ready. But in fact, in most cases (98%) the correct value already is the
> read register (assume we have just said to the control that we want to
> read a register).
> I thought, ok we have such RegAccessFinished bit, so use it, if we have
> to, until it doesn't work anymore.
> So, through a shadow copy of most registers (some cannot be shadow or it
> makes no sence) I can provide the values without having to actually read
> from the controller/codec. The regfile also contains info which register
> might be shadowed, if values get saved at all (if written) ...
> Furthermore ALSA's AC97 layer does heavy initialization access series on
> the codec, which I tried to "mask out" completely
> (LM4550_REG_FAKEPROBE).
> 
> > > +#define LM4550_RF_FLAG(reg)  lm4550_regfile[reg / 2].flag
> <snip>
> > > +static void lm4550_regfile_init(void)
> > > +{
> > > +	int i;
> > > +	for (i = 0; i < 128; i = i + 2)
> > > +		if (LM4550_RF_FLAG(i) & LM4550_REG_FAKEPROBE)
> > > +			LM4550_RF_VAL(i) = LM4550_RF_DEF(i);
> > 
> > "MACRO(x) = XXX" looks a bit strange to me.
> 
> Hmmm, ok. I thought about that, too. I think, I'll spell them out?
> 
> > RATE_CONTINUOUS and RATE_KNOW are usually exclusive.
> 
> Ok, so what I want is RATE_CONTINUOUS, right? (because the LM4550
> supports 4000 to 48000kHz in 1Hz steps)
> BTW: What is RATE_KNOT good for?

It indicates unusual non-continuous sample rates that don't match with
SNDRV_PCM_RATE_XXX bits are supported.  The rates in 1Hz step is
continuous enough :)


Takashi

  reply	other threads:[~2007-08-09 22:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-09 10:36 [PATCH 1/2] Xlinx ML403 AC97 Controller Reference device driver Joachim Förster
2007-08-09 17:13 ` Takashi Iwai
2007-08-09 19:44   ` Joachim Förster
2007-08-09 22:27     ` Takashi Iwai [this message]
2007-08-10 11:50   ` Joachim Förster
2007-08-10 12:07     ` Takashi Iwai
2007-08-11 16:23   ` [PATCHv2 1/2] Xilinx " Joachim Förster
2007-08-15 18:45     ` [PATCH] [ML403-AC97CR] Fix (device/driver) name registered with platform bus Joachim Foerster
2007-08-11 16:24   ` [PATCHv2 2/2] [VIRTEX] Register AC97 Controller Reference with the " Joachim Förster
2007-08-09 17:49 ` [PATCH 1/2] Xlinx ML403 AC97 Controller Reference device driver Grant Likely
2007-08-09 20:01   ` Joachim Förster
2007-08-09 20:07     ` Grant Likely
2007-08-09 22:30     ` Takashi Iwai
2007-08-09 18:17 ` Stephen Neuendorffer

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=s5hejice439.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=lorenz.kolb@lkmail.de \
    --cc=mls.JOFT@gmx.de \
    /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;
as well as URLs for NNTP newsgroup(s).