[alsa-devel] [PATCH v2] ALSA: hda - suspend codecs in parallel

Takashi Iwai tiwai at suse.de
Wed Nov 27 10:49:25 CET 2013


At Wed, 27 Nov 2013 09:43:58 +0000,
Lin, Mengdong wrote:
> 
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai at suse.de]
> > Sent: Wednesday, November 27, 2013 2:17 PM
> 
> > > > > +	if (!bus->pm_wq) {
> > > > > +		snd_printk(KERN_ERR "cannot create PM workqueue\n");
> > > > > +		snd_hda_bus_free(bus);
> > > > > +		return -ENOMEM;
> > > > > +	}
> > > > > +	workqueue_set_max_active(bus->pm_wq,
> > HDA_MAX_NUM_CODECS);
> > > >
> > > > As mentioned in another post, this can be set dynamically, e.g. at
> > > > snd_hda_suspend() with bus->num_codecs.
> > >
> > > Can I move this to snd_hda_codec_new() like this?
> > > 	list_add_tail(&codec->list, &bus->codec_list);
> > >    +bus->num_codecs++;
> > >    +workqueue_set_max_active(bus->pm_wq, bus->num_codecs);
> > >
> > > The codec number does not change after initialization, and usually 1 or
> > 2 codecs are connected to the bus.
> > 
> > It's not perfect but it'd be good enough, yes.
> > (A codec might be dynamically removed via snd_hda_codec_free() in
> > theory, but this wouldn't happen actually.)
> 
> Well, I'll put this to snd_hda_suspend() as you suggested. Perfect is better than good enough.

OTOH, doing it only in the creation time is lighter.
So, doing it in the suspend callback isn't perfect either :)


Takashi


More information about the Alsa-devel mailing list