summaryrefslogtreecommitdiff
path: root/nuttx/drivers/audio
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-07-24 09:56:39 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-07-24 09:56:39 -0600
commit9ee5cdfd37157507a9b40d4554b407037b6e2c77 (patch)
treeecf2093f5c73804007f02e3848c9de64b7aaeb8a /nuttx/drivers/audio
parent6ef0ea9652d085373feeb971f7b40f65b2be04b4 (diff)
downloadnuttx-9ee5cdfd37157507a9b40d4554b407037b6e2c77.tar.gz
nuttx-9ee5cdfd37157507a9b40d4554b407037b6e2c77.tar.bz2
nuttx-9ee5cdfd37157507a9b40d4554b407037b6e2c77.zip
Audio: Get rid of the decoder->driver IOCTLs that I added a couple of commits back; Use existing configure method
Diffstat (limited to 'nuttx/drivers/audio')
-rw-r--r--nuttx/drivers/audio/audio_null.c67
-rw-r--r--nuttx/drivers/audio/vs1053.c3
-rw-r--r--nuttx/drivers/audio/wm8904.c48
3 files changed, 68 insertions, 50 deletions
diff --git a/nuttx/drivers/audio/audio_null.c b/nuttx/drivers/audio/audio_null.c
index b9495d4f1..401cf1d75 100644
--- a/nuttx/drivers/audio/audio_null.c
+++ b/nuttx/drivers/audio/audio_null.c
@@ -349,6 +349,53 @@ static int null_configure(FAR struct audio_lowerhalf_s *dev,
FAR const struct audio_caps_s *caps)
#endif
{
+ audvdbg("ac_type: %d\n", caps->ac_type);
+
+ /* Process the configure operation */
+
+ switch (caps->ac_type)
+ {
+ case AUDIO_TYPE_FEATURE:
+ audvdbg(" AUDIO_TYPE_FEATURE\:n");
+
+ /* Process based on Feature Unit */
+
+ switch (*((uint16_t *)caps->ac_format))
+ {
+#ifndef CONFIG_AUDIO_EXCLUDE_VOLUME
+ case AUDIO_FU_VOLUME:
+ audvdbg(" Volume: %d\n", *(uint16_t *)caps->ac_controls);
+ break;
+#endif /* CONFIG_AUDIO_EXCLUDE_VOLUME */
+
+#ifndef CONFIG_AUDIO_EXCLUDE_TONE
+ case AUDIO_FU_BASS:
+ audvdbg(" Bass: %d\n", caps->ac_controls[0]);
+ break;
+
+ case AUDIO_FU_TREBLE:
+ audvdbg(" Treble: %d\n", caps->ac_controls[0]);
+ break;
+#endif /* CONFIG_AUDIO_EXCLUDE_TONE */
+
+ default:
+ auddbg(" Unrecognized feature unit\n");
+ break;
+ }
+ break;
+
+ case AUDIO_TYPE_OUTPUT:
+ audvdbg(" AUDIO_TYPE_OUTPUT:\n");
+ audvdbg(" Number of channels: %u\n", caps->ac_channels);
+ audvdbg(" Sample rate: %u\n", *(uint16_t*)&ac_controls[0]);
+ audvdbg(" Sample width: %u\n", ac_controls[2]);
+ break;
+
+ case AUDIO_TYPE_PROCESSING:
+ audvdbg(" AUDIO_TYPE_PROCESSING:\n");
+ break;
+ }
+
audvdbg("Return OK\n");
return OK;
}
@@ -679,26 +726,6 @@ static int null_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd,
break;
#endif
- /* Data stream configuration */
-
- case AUDIOIOC_BITRATE:
- {
- audvdbg("AUDIOIOC_BITRATE: Set bit rate: %lu\n", arg);
- }
- break;
-
- case AUDIOIOC_NCHANNELS:
- {
- audvdbg("AUDIOIOC_NCHANNELS: Set number of channels: %lu\n", arg);
- }
- break;
-
- case AUDIOIOC_SAMPWIDTH:
- {
- audvdbg("AUDIOIOC_SAMPWIDTH: Set sample width: %lu\n", arg);
- }
- break;
-
default:
break;
}
diff --git a/nuttx/drivers/audio/vs1053.c b/nuttx/drivers/audio/vs1053.c
index e7b7cc059..32d04df15 100644
--- a/nuttx/drivers/audio/vs1053.c
+++ b/nuttx/drivers/audio/vs1053.c
@@ -833,6 +833,9 @@ static int vs1053_configure(FAR struct audio_lowerhalf_s *lower,
break;
+ case AUDIO_TYPE_OUTPUT:
+ break;
+
case AUDIO_TYPE_PROCESSING:
/* We only support STEREO_EXTENDER */
diff --git a/nuttx/drivers/audio/wm8904.c b/nuttx/drivers/audio/wm8904.c
index 6b496844c..a7bec06be 100644
--- a/nuttx/drivers/audio/wm8904.c
+++ b/nuttx/drivers/audio/wm8904.c
@@ -730,13 +730,14 @@ static int wm8904_configure(FAR struct audio_lowerhalf_s *dev,
#endif
int ret = OK;
- audvdbg("Entry\n");
+ audvdbg("ac_type: %d\n", caps->ac_type);
/* Process the configure operation */
switch (caps->ac_type)
{
case AUDIO_TYPE_FEATURE:
+ audvdbg(" AUDIO_TYPE_FEATURE\:n");
/* Process based on Feature Unit */
@@ -748,6 +749,8 @@ static int wm8904_configure(FAR struct audio_lowerhalf_s *dev,
/* Set the volume */
uint16_t volume = *(uint16_t *)caps->ac_controls;
+ audvdbg(" Volume: %d\n", volume);
+
if (volume >= 0 && volume <= 1000)
{
/* Scale the volume setting to the range {0.. 63} */
@@ -770,6 +773,8 @@ static int wm8904_configure(FAR struct audio_lowerhalf_s *dev,
*/
uint8_t bass = caps->ac_controls[0];
+ audvdbg(" Bass: %d\n", bass);
+
if (bass <= 100)
{
wm8904_setbass(priv, bass);
@@ -788,6 +793,8 @@ static int wm8904_configure(FAR struct audio_lowerhalf_s *dev,
*/
uint8_t treble = caps->ac_controls[0];
+ audvdbg(" Treble: %d\n", treble);
+
if (treble <= 100)
{
wm8904_settreble(priv, treble);
@@ -801,19 +808,21 @@ static int wm8904_configure(FAR struct audio_lowerhalf_s *dev,
#endif /* CONFIG_AUDIO_EXCLUDE_TONE */
default:
+ auddbg(" Unrecognized feature unit\n");
ret = -ENOTTY;
break;
}
break;
- case AUDIO_TYPE_PROCESSING:
- {
- /* We only support STEREO_EXTENDER */
+ case AUDIO_TYPE_OUTPUT:
+ audvdbg(" AUDIO_TYPE_OUTPUT:\n");
+ audvdbg(" Number of channels: %u\n", caps->ac_channels);
+ audvdbg(" Sample rate: %u\n", *(uint16_t*)&ac_controls[0]);
+ audvdbg(" Sample width: %u\n", ac_controls[2]);
+#warning Missing logic
+ break;
- if (*((uint16_t *) caps->ac_format) == AUDIO_PU_STEREO_EXTENDER)
- {
- }
- }
+ case AUDIO_TYPE_PROCESSING:
break;
}
@@ -1467,29 +1476,8 @@ static int wm8904_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd,
break;
#endif
- /* Data stream configuration */
-
- case AUDIOIOC_BITRATE:
- {
- audvdbg("AUDIOIOC_BITRATE: Set bit rate: %lu\n", arg);
-#warning Missing logic
- }
- break;
-
- case AUDIOIOC_NCHANNELS:
- {
- audvdbg("AUDIOIOC_NCHANNELS: Set number of channels: %lu\n", arg);
-#warning Missing logic
- }
- break;
-
- case AUDIOIOC_SAMPWIDTH:
- {
- audvdbg("AUDIOIOC_SAMPWIDTH: Set sample width: %lu\n", arg);
-#warning Missing logic
- }
- break;
default:
+ audvdbg("Ignored\n");
break;
}