From 1f2428c08719c875b911cebc495addd883933ba1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Aug 2014 18:37:56 -0600 Subject: [PATCH] WM8904: Ad the MCLK frequency to the interface definition. The WM8904 driver needs to know this frequency in order to configure the FLL to generate the correct bitrate --- configs/sama5d3x-ek/src/sam_wm8904.c | 1 + configs/sama5d4-ek/src/sam_wm8904.c | 1 + include/nuttx/audio/wm8904.h | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configs/sama5d3x-ek/src/sam_wm8904.c b/configs/sama5d3x-ek/src/sam_wm8904.c index 1274443aa0..f1f955afbf 100644 --- a/configs/sama5d3x-ek/src/sam_wm8904.c +++ b/configs/sama5d3x-ek/src/sam_wm8904.c @@ -120,6 +120,7 @@ static struct sama5d3ek_mwinfo_s g_mxtinfo = { .address = WM8904_I2C_ADDRESS, .frequency = CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY, + .mclk = BOARD_SLOWCLK_FREQUENCY, .attach = wm8904_attach, .enable = wm8904_enable, diff --git a/configs/sama5d4-ek/src/sam_wm8904.c b/configs/sama5d4-ek/src/sam_wm8904.c index a963692c00..7207c6ecd1 100644 --- a/configs/sama5d4-ek/src/sam_wm8904.c +++ b/configs/sama5d4-ek/src/sam_wm8904.c @@ -120,6 +120,7 @@ static struct sama5d4ek_mwinfo_s g_mxtinfo = { .address = WM8904_I2C_ADDRESS, .frequency = CONFIG_SAMA5D4EK_WM8904_I2CFREQUENCY, + .mclk = BOARD_SLOWCLK_FREQUENCY, .attach = wm8904_attach, .enable = wm8904_enable, diff --git a/include/nuttx/audio/wm8904.h b/include/nuttx/audio/wm8904.h index ea8c386af6..887f822aca 100644 --- a/include/nuttx/audio/wm8904.h +++ b/include/nuttx/audio/wm8904.h @@ -150,10 +150,16 @@ typedef CODE int (*wm8904_handler_t)(FAR const struct wm8904_lower_s *lower, struct wm8904_lower_s { - /* Device characterization */ + /* I2C characterization */ uint32_t frequency; /* Initial I2C frequency */ - uint8_t address; /* 7-bit I2C address (only bits 0-6 used) */ + uint8_t address; /* 7-bit I2C address (only bits 0-6 used) */ + + /* Clocking is provided via MCLK. The WM8904 driver will need to know + * the frequency of MCLK in order to generate the correct bitrates. + */ + + uint32_t mcclk; /* W8904 Master clock frequency */ /* IRQ/GPIO access callbacks. These operations all hidden behind * callbacks to isolate the WM8904 driver from differences in GPIO