From: Takashi Iwai Subject: Re: How to get ac97_t pointer from snd_pcm_substream_t? Date: Tue, 11 Oct 2005 12:25:11 +0200 Message-ID: References: <434AA56A.2020704@billgatliff.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <434AA56A.2020704@billgatliff.com> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Bill Gatliff Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Mon, 10 Oct 2005 12:31:22 -0500, Bill Gatliff wrote: > > Guys: > > I want to call snd_ac97_set_rate() from my PCM prepare() handler. > > I can't seem to figure out how to get the codec pointer (ac97 in my > case) from a snd_pcm_substream_t. Is it possible? There are several ways. In most cases, retrieve the chip instance via snd_pcm_substream_chip() (assuming that pcm->private_data = chip), and get ac97 instance from it. You can assign substream->runtime->private_data for your own purpose, too. It's independent from pcm or substream->private_data. pcm->private_data and substream->private_data are usually identical. substream->private_data is copied from pcm->private_data at open time. But you can override this value if you want. For example, isa/cmipci.c uses this trick to support different codecs. Takashi ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl