tinyalsa: add pcm_get_subdevice()

The users of tinyalsa had no way of knowing on which subdevice a stream had
been created.  A new API, "unsigned int pcm_get_subdevice(struct *pcm)" returns
it.  This information is filled during the pcm_open()

Change-Id: Ie866e10e06ce6691ede09e2ca46a24441723ea8b
Signed-off-by: David Wagner <david.wagner@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
David Wagner
2014-04-02 15:12:54 +02:00
committed by Vinod Koul
parent 9ecb93fb6b
commit 4cddf19dfc
2 changed files with 10 additions and 0 deletions
+3
View File
@@ -179,6 +179,9 @@ unsigned int pcm_bytes_to_frames(struct pcm *pcm, unsigned int bytes);
int pcm_get_htimestamp(struct pcm *pcm, unsigned int *avail,
struct timespec *tstamp);
/* Returns the subdevice on which the pcm has been opened */
unsigned int pcm_get_subdevice(struct pcm *pcm);
/* Write data to the fifo.
* Will start playback on the first write or on a write that
* occurs after a fifo underrun.
+7
View File
@@ -171,6 +171,7 @@ struct pcm {
void *mmap_buffer;
unsigned int noirq_frames_per_msec;
long pcm_delay;
unsigned int subdevice;
};
unsigned int pcm_get_buffer_size(struct pcm *pcm)
@@ -183,6 +184,11 @@ const char* pcm_get_error(struct pcm *pcm)
return pcm->error;
}
unsigned int pcm_get_subdevice(struct pcm *pcm)
{
return pcm->subdevice;
}
static int oops(struct pcm *pcm, int e, const char *fmt, ...)
{
va_list ap;
@@ -654,6 +660,7 @@ struct pcm *pcm_open(unsigned int card, unsigned int device,
oops(pcm, errno, "cannot get info");
goto fail_close;
}
pcm->subdevice = info.subdevice;
param_init(&params);
param_set_mask(&params, SNDRV_PCM_HW_PARAM_FORMAT,