Remove WM8904 driver unused paramters, clean-up comments, remove some kruft in capability reporting

This commit is contained in:
Gregory Nutt
2014-07-22 11:47:27 -06:00
parent 0fcc0adaa2
commit 8548c64915
2 changed files with 15 additions and 52 deletions
+12 -47
View File
@@ -235,8 +235,8 @@ static const struct audio_ops_s g_audioops =
wm8904_pause, /* pause */ wm8904_pause, /* pause */
wm8904_resume, /* resume */ wm8904_resume, /* resume */
#endif #endif
NULL, /* alloc_buffer */ NULL, /* allocbuffer */
NULL, /* free_buffer */ NULL, /* freebuffer */
wm8904_enqueuebuffer, /* enqueue_buffer */ wm8904_enqueuebuffer, /* enqueue_buffer */
wm8904_cancelbuffer, /* cancel_buffer */ wm8904_cancelbuffer, /* cancel_buffer */
wm8904_ioctl, /* ioctl */ wm8904_ioctl, /* ioctl */
@@ -589,28 +589,9 @@ static int wm8904_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
switch (caps->ac_subtype) switch (caps->ac_subtype)
{ {
case AUDIO_TYPE_QUERY: case AUDIO_TYPE_QUERY:
/* The input formats we can decode / accept */ /* We don't decode any formats! Only something above us in
* the audio stream can perform decoding on our behalf.
*((uint16_t *) &caps->ac_format[0]) = 0 */
#ifdef CONFIG_AUDIO_FORMAT_AC3
| (1 << (AUDIO_FMT_AC3 - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_MP3
| (1 << (AUDIO_FMT_MP3 - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_WMA
| (1 << (AUDIO_FMT_WMA - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_MIDI
| (1 << (AUDIO_FMT_MIDI - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_PCM
| (1 << (AUDIO_FMT_PCM - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_OGG_VORBIS
| (1 << (AUDIO_FMT_OGG_VORBIS - 1))
#endif
;
/* The types of audio units we implement */ /* The types of audio units we implement */
@@ -619,16 +600,11 @@ static int wm8904_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
break; break;
/* Report sub-formats for MIDI if requested */
#ifdef CONFIG_AUDIO_FORMAT_MIDI
case AUDIO_FMT_MIDI: case AUDIO_FMT_MIDI:
/* We only support Format 0 */ /* We only support Format 0 */
caps->ac_controls[0] = AUDIO_SUBFMT_MIDI_0; caps->ac_controls[0] = AUDIO_SUBFMT_END;
caps->ac_controls[1] = AUDIO_SUBFMT_END;
break; break;
#endif
default: default:
caps->ac_controls[0] = AUDIO_SUBFMT_END; caps->ac_controls[0] = AUDIO_SUBFMT_END;
@@ -650,23 +626,14 @@ static int wm8904_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
/* Report the Sample rates we support */ /* Report the Sample rates we support */
caps->ac_controls[0] = AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K | caps->ac_controls[0] = AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K |
AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K |
AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K | AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K |
AUDIO_SAMP_RATE_48K; AUDIO_SAMP_RATE_48K;
break; break;
case AUDIO_FMT_MP3: case AUDIO_FMT_MP3:
case AUDIO_FMT_WMA: case AUDIO_FMT_WMA:
case AUDIO_FMT_PCM: case AUDIO_FMT_PCM:
/* Report the Bit rates we support. The bit rate support is actually a
* complex function of the format and selected sample rate, and the datasheet
* has multiple tables to indicate the supported bit rate vs sample rate vs
* format. The selected sample rate should be provided in the ac_format
* field of the query, and only a single sample rate should be given.
*/
/* TODO: Create a table or set of tables to report this! */
break; break;
default: default:
@@ -1785,18 +1752,16 @@ static void wm8904_audio_input(FAR struct wm8904_dev_s *priv)
* i2c - An I2C driver instance * i2c - An I2C driver instance
* i2s - An I2S driver instance * i2s - An I2S driver instance
* lower - Persistent board configuration data * lower - Persistent board configuration data
* minor - The input device minor number
* session - Returned if multi-sessions are supported
* *
* Returned Value: * Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is * A new lower half audio interface is returned for the WM8904 device is
* returned to indicate the nature of the failure. * returned on success; NULL is returned on failure.
* *
****************************************************************************/ ****************************************************************************/
FAR struct audio_lowerhalf_s * FAR struct audio_lowerhalf_s *
wm8904_initialize(FAR struct i2c_dev_s *i2c, FAR struct i2s_dev_s *i2s, wm8904_initialize(FAR struct i2c_dev_s *i2c, FAR struct i2s_dev_s *i2s,
FAR const struct wm8904_lower_s *lower, unsigned int devno) FAR const struct wm8904_lower_s *lower)
{ {
FAR struct wm8904_dev_s *priv; FAR struct wm8904_dev_s *priv;
uint16_t regval; uint16_t regval;
+3 -5
View File
@@ -197,12 +197,10 @@ extern "C"
* i2c - An I2C driver instance * i2c - An I2C driver instance
* i2s - An I2S driver instance * i2s - An I2S driver instance
* lower - Persistent board configuration data * lower - Persistent board configuration data
* minor - The input device minor number
* session - Returned if multi-sessions are supported
* *
* Returned Value: * Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is * A new lower half audio interface is returned for the WM8904 device is
* returned to indicate the nature of the failure. * returned on success; NULL is returned on failure.
* *
****************************************************************************/ ****************************************************************************/
@@ -212,7 +210,7 @@ struct audio_lowerhalf_s; /* Forward reference. Defined in nuttx/audio/audio.h *
FAR struct audio_lowerhalf_s * FAR struct audio_lowerhalf_s *
wm8904_initialize(FAR struct i2c_dev_s *i2c, FAR struct i2s_dev_s *i2s, wm8904_initialize(FAR struct i2c_dev_s *i2c, FAR struct i2s_dev_s *i2s,
FAR const struct wm8904_lower_s *lower, unsigned int devno); FAR const struct wm8904_lower_s *lower);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus