Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Vinod Koul <vinod.koul@intel.com>
Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com,
	alsa-devel@alsa-project.org, broonie@kernel.org,
	Jeeja KP <jeeja.kp@intel.com>
Subject: Re: [PATCH v6 1/3] ALSA: hdac_ext: add extended HDA bus
Date: Mon, 08 Jun 2015 17:37:03 +0200	[thread overview]
Message-ID: <s5hoakqqkio.wl-tiwai@suse.de> (raw)
In-Reply-To: <20150608152423.GM28601@localhost>

At Mon, 8 Jun 2015 20:54:23 +0530,
Vinod Koul wrote:
> 
> On Mon, Jun 08, 2015 at 03:40:08PM +0530, Vinod Koul wrote:
> > On Mon, Jun 08, 2015 at 11:03:12AM +0200, Takashi Iwai wrote:
> > > One thing forgot...
> > > 
> > > At Thu,  4 Jun 2015 15:23:20 +0530,
> > > Vinod Koul wrote:
> > > > 
> > > > +/**
> > > > + * snd_hdac_ext_device_init - initialize the HDA extended codec base device
> > > > + * @sbus: hdac extended bus to attach to
> > > > + * @addr: codec address
> > > > + *
> > > > + * Returns zero for success or a negative error code.
> > > > + */
> > > > +int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *sbus, int addr)
> > > > +{
> > > > +	struct hdac_device *hdev = NULL;
> > > > +	struct hdac_bus *bus = hdac_bus(sbus);
> > > > +	char name[15];
> > > > +	int ret;
> > > > +
> > > > +	hdev = kzalloc(sizeof(*hdev), GFP_KERNEL);
> > > > +	if (!hdev)
> > > > +		return -ENOMEM;
> > > > +
> > > > +	snprintf(name, sizeof(name), "hda-codec#%03x", addr);
> > > > +
> > > > +	ret  = snd_hdac_device_init(hdev, bus, name, addr);
> > > 
> > > The device name must be unique to the whole system.  Using only the
> > > codec address as an id would conflict if there are multiple cards.
> > > The legacy HDA device consists of "hdaudioC%dD%d" indicating both the
> > > card number and the codec address, for example.
> > Sorry my bad, you did comment on it before as well. I will fix it now, by
> > adding card name here.
> Okay and we have an issue here :(, We actually dont know the card number
> here and card number will be created after this enumeration is complete
> and we register the DAI with ASoC and then ASoC would create card later.
> 
> So how do we solve this?

Instead of the card number, assign some unique index (either a simple
static counter or use idr) to each bus object and use it instead of
the card number.  After all, we just need a unique mapping.

Alternatively, you may rename via dev_set_name() just before
registration.  But, of course, this is inconsistent in some areas,
e.g. dev_err() shows differently before and after registration.


Takashi

  reply	other threads:[~2015-06-08 15:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04  9:53 [PATCH v6 0/3] ALSA: HDA: add extended HDA Vinod Koul
2015-06-04  9:53 ` [PATCH v6 1/3] ALSA: hdac_ext: add extended HDA bus Vinod Koul
2015-06-08  9:00   ` Takashi Iwai
2015-06-08 10:08     ` Vinod Koul
2015-06-08 15:30       ` Vinod Koul
2015-06-08 15:40         ` Takashi Iwai
2015-06-09 10:06           ` Vinod Koul
2015-06-09 10:37             ` Takashi Iwai
2015-06-08  9:03   ` Takashi Iwai
2015-06-08 10:10     ` Vinod Koul
2015-06-08 15:24       ` Vinod Koul
2015-06-08 15:37         ` Takashi Iwai [this message]
2015-06-08 15:55           ` Vinod Koul
2015-06-04  9:53 ` [PATCH v6 2/3] ALSA: hdac_ext: add hdac extended controller Vinod Koul
2015-06-08  9:12   ` Takashi Iwai
2015-06-08 15:32     ` Vinod Koul
2015-06-08 15:42       ` Takashi Iwai
2015-06-08 16:00         ` Vinod Koul
2015-06-04  9:53 ` [PATCH v6 3/3] ALSA: hdac_ext: add extended stream capabilities Vinod Koul

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=s5hoakqqkio.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=vinod.koul@intel.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