Framework for a WM8904 audio driver. The initial driver check-in is simply Ken Pettit's VS1053 driver forced to compile with only WM8904 definitions
This commit is contained in:
parent
1ff0536c7f
commit
3b8c4a399d
@ -82,3 +82,25 @@ config VS1053_BUFFER_SIZE
|
||||
endif # AUDIO_DRIVER_SPECIFIC_BUFFERS
|
||||
|
||||
endif # VS1053
|
||||
|
||||
config AUDIO_WM8904
|
||||
bool "WM8904 audio chip"
|
||||
default n
|
||||
depends on EXPERIMENTAL
|
||||
---help---
|
||||
Select to enable support for the WM8904 Audio codec by Wolfson
|
||||
Microelectonics. This chip is a lower level audio chip.. basically
|
||||
an exotic D-to-A. It includes no builtin support for audion CODECS
|
||||
The WM8904 provides:
|
||||
|
||||
- Low power consumption
|
||||
- High SNR
|
||||
- Stereo digital microphone input
|
||||
- Digital Dynamic Range Controller (compressor / limiter)
|
||||
- Digital sidetone mixing
|
||||
- Ground-referenced headphone driver
|
||||
- Ground-referenced line outputs
|
||||
|
||||
if AUDIO_WM8904
|
||||
endif # AUDIO_WM8904
|
||||
|
||||
|
@ -37,12 +37,16 @@
|
||||
|
||||
# Include Audio drivers
|
||||
|
||||
ifeq ($(CONFIG_AUDIO),y)
|
||||
ifeq ($(CONFIG_AUDIO_DEVICES),y)
|
||||
|
||||
ifeq ($(CONFIG_VS1053),y)
|
||||
CSRCS += vs1053.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AUDIO_WM8904),y)
|
||||
CSRCS += wm8904.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AUDIO_I2SCHAR),y)
|
||||
CSRCS += i2schar.c
|
||||
endif
|
||||
|
1546
drivers/audio/wm8904.c
Normal file
1546
drivers/audio/wm8904.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -60,8 +60,8 @@
|
||||
#define WM8904_SWRST_ID 0x00 /* SW Reset and ID */
|
||||
#define WM8904_BIAS_CTRL 0x04 /* Bias Control */
|
||||
#define WM8904_VMID_CTRL 0x05 /* VMID Control */
|
||||
#define WM8904_MIC_BIAS_CTRL 0x06 /* Mic Bias Control */
|
||||
#define WM8904_MIC_BIAS_CTRL 0x07 /* Mic Bias Control */
|
||||
#define WM8904_MIC_BIAS_CTRL0 0x06 /* Mic Bias Control 0 */
|
||||
#define WM8904_MIC_BIAS_CTRL1 0x07 /* Mic Bias Control 1 */
|
||||
#define WM8904_ANALOG_ADC 0x0a /* Analogue ADC */
|
||||
#define WM8904_PM0 0x0c /* Power Management 0 */
|
||||
#define WM8904_PM2 0x0e /* Power Management 2 */
|
||||
@ -181,7 +181,7 @@
|
||||
# define WM8904_VMID_RES_FASTSTART (3 << WM8904_VMID_RES_SHIFT) /* 2 x 5k divider */
|
||||
#define WM8904_VMID_ENA (1 << 0) /* Bit 0: VMID buffer enable */
|
||||
|
||||
/* 0x06 Mic Bias Control */
|
||||
/* 0x06 Mic Bias Control 0 */
|
||||
|
||||
#define WM8904_MICDET_THR_SHIFT (4) /* Bits 4-6: MICBIAS current detect threshold */
|
||||
#define WM8904_MICDET_THR_MASK (7 << WM8904_MICDET_THR_SHIFT)
|
||||
@ -192,7 +192,7 @@
|
||||
#define WM8904_MICDET_ENA (1 << 1) /* Bit 1: MICBIAS current/short circuit detect enable */
|
||||
#define WM8904_MICBIAS_ENA (1 << 0) /* Bit 0: MICBIAS enable */
|
||||
|
||||
/* 0x07 Mic Bias Control */
|
||||
/* 0x07 Mic Bias Control 1 */
|
||||
|
||||
#define WM8904_MICBIAS_SEL_MASK (0x0007) /* Bits 0-2: Selects MICBIAS voltage */
|
||||
|
||||
@ -264,7 +264,7 @@
|
||||
/* 0x18 Audio Interface 0 */
|
||||
|
||||
#define WM8904_DACL_DATINV (1 << 12) /* Bit 12: Left DAC invert */
|
||||
#define WM8904_DACR_DATINV (1 << 11) /* Bit 11: Right DAC invert* /
|
||||
#define WM8904_DACR_DATINV (1 << 11) /* Bit 11: Right DAC invert */
|
||||
#define WM8904_DAC_BOOST_SHIFT (9) /* Bits 9-10: DAC digital input volume boost */
|
||||
#define WM8904_DAC_BOOST_MASK (3 << WM8904_DAC_BOOST_SHIFT)
|
||||
# define WM8904_DAC_BOOST_0DB (0 << WM8904_DAC_BOOST_SHIFT)
|
||||
|
@ -177,7 +177,7 @@
|
||||
* performed in the context of the worker thread.
|
||||
* arg - An opaque argument that will be provided to the callback
|
||||
* when the transfer complete.
|
||||
* timeout - The timeout value to use. The transfer will be canceled
|
||||
* timeout - The timeout value to use. The transfer will be cancelled
|
||||
* and an ETIMEDOUT error will be reported if this timeout
|
||||
* elapsed without completion of the DMA transfer. Units
|
||||
* are system clock ticks. Zero means no timeout.
|
||||
|
@ -61,8 +61,24 @@
|
||||
|
||||
/* Pre-requisistes */
|
||||
|
||||
#ifndef CONFIG_AUDIO
|
||||
# error CONFIG_AUDIO is required for audio subsystem support
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_I2S
|
||||
# error CONFIG_I2S is required by the WM8904 driver
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_I2C
|
||||
# error CONFIG_I2C is required by the WM8904 driver
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_I2C_TRANSFER
|
||||
# error "CONFIG_I2C_TRANSFER is required in the I2C configuration"
|
||||
# error CONFIG_I2C_TRANSFER is required in the I2C configuration
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SCHED_WORKQUEUE
|
||||
# error CONFIG_SCHED_WORKQUEUE is required by the WM8904 driver
|
||||
#endif
|
||||
|
||||
/* Default configuration values */
|
||||
@ -73,7 +89,6 @@
|
||||
#define WM8904_DETACH(s) ((s)->attach(s,NULL,NULL))
|
||||
#define WM8904_ENABLE(s) ((s)->enable(s,true))
|
||||
#define WM8904_DISABLE(s) ((s)->enable(s,false))
|
||||
#define WM8904_CLEAR(s) ((s)->clear(s))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
@ -109,15 +124,14 @@ struct wm8904_lower_s
|
||||
* interrupts should be configured on both rising and falling edges
|
||||
* so that contact and loss-of-contact events can be detected.
|
||||
*
|
||||
* attach - Attach the WM8904 interrupt handler to the GPIO interrupt
|
||||
* attach - Attach or detacth the WM8904 interrupt handler to the GPIO
|
||||
* interrupt
|
||||
* enable - Enable or disable the GPIO interrupt
|
||||
* clear - Acknowledge/clear any pending GPIO interrupt
|
||||
*/
|
||||
|
||||
int (*attach)(FAR const struct wm8904_lower_s *lower, wm8904_handler_t isr,
|
||||
FAR void *arg);
|
||||
void (*enable)(FAR const struct wm8904_lower_s *lower, bool enable);
|
||||
void (*clear)(FAR const struct wm8904_lower_s *lower);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -137,7 +151,7 @@ extern "C"
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: wm8904_register
|
||||
* Name: wm8904_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the WM8904 device.
|
||||
|
Loading…
Reference in New Issue
Block a user