From 4e3f83079b93df8576d03d9160f5b562d69d23bd Mon Sep 17 00:00:00 2001
From: Ramu Gottipati <ramug@codeaurora.org>
Date: Fri, 7 Sep 2018 11:06:10 +0530
Subject: [PATCH] tinyalsa: Add pcm_ioctl support for pcm driver

---
 git/include/tinyalsa/pcm.h |  2 ++
 git/src/pcm.c              | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/tinyalsa-git/include/tinyalsa/pcm.h b/tinyalsa-git/include/tinyalsa/pcm.h
index 33ea55a..04c13a5 100644
--- a/tinyalsa-git/include/tinyalsa/pcm.h
+++ b/tinyalsa-git/include/tinyalsa/pcm.h
@@ -299,6 +299,8 @@ int pcm_wait(struct pcm *pcm, int timeout);

 long pcm_get_delay(struct pcm *pcm);

+int pcm_ioctl(struct pcm *pcm, int request, ...);
+
 #if defined(__cplusplus)
 }  /* extern "C" */
 #endif
diff --git a/tinyalsa-git/src/pcm.c b/tinyalsa-git/src/pcm.c
index 840e36e..289ac3e 100644
--- a/tinyalsa-git/src/pcm.c
+++ b/tinyalsa-git/src/pcm.c
@@ -194,6 +194,20 @@ struct pcm {
     unsigned int subdevice;
 };

+/* ioctl function for PCM driver */
+int pcm_ioctl(struct pcm *pcm, int request, ...)
+{
+    va_list ap;
+    void * arg;
+    int pcm_fd = *(int*)pcm;
+
+    va_start(ap, request);
+    arg = va_arg(ap, void *);
+    va_end(ap);
+
+    return ioctl(pcm_fd, request, arg);
+}
+
 /** Gets the buffer size of the PCM.
  * @param pcm A PCM handle.
  * @return The buffer size of the PCM.
--
1.9.1

