diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-03 11:01:02 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-03 11:01:02 -0600 |
commit | 35b34c62b2540d2360bdfce132493fcdb97858af (patch) | |
tree | fc31fd617af4d1bfcd32f08c94610e4115c7768b | |
parent | 7a2b927bea5c999810c12d5bcca76ee91ab3d925 (diff) | |
download | nuttx-35b34c62b2540d2360bdfce132493fcdb97858af.tar.gz nuttx-35b34c62b2540d2360bdfce132493fcdb97858af.tar.bz2 nuttx-35b34c62b2540d2360bdfce132493fcdb97858af.zip |
SAMA5 WM8904: Add option to use MAINCK as WM8904 MCLK
-rw-r--r-- | nuttx/configs/sama5d3x-ek/Kconfig | 11 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/src/sam_wm8904.c | 12 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/Kconfig | 11 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/src/sam_wm8904.c | 12 |
4 files changed, 46 insertions, 0 deletions
diff --git a/nuttx/configs/sama5d3x-ek/Kconfig b/nuttx/configs/sama5d3x-ek/Kconfig index 6ae3777ea..8c7bcb84e 100644 --- a/nuttx/configs/sama5d3x-ek/Kconfig +++ b/nuttx/configs/sama5d3x-ek/Kconfig @@ -260,5 +260,16 @@ config SAMA5D3xEK_WM8904_I2CFREQUENCY the WM8904. If you have problems communicating with the WM8904, then you might want to try lowering this rate. +choice + prompt "WM8904 MCLK source" + default SAMA5D3xEK_WM8904_SRCMAIN + +config SAMA5D3xEK_WM8904_SRCMAIN + bool "Main Clock (12MHz)" + +config SAMA5D3xEK_WM8904_SRCSCK + bool "Slow XTAL (32.768KHz)" + +endchoice # WM8904 MCLK source endif # AUDIO_WM8904 endif # ARCH_BOARD_SAMA5D3X_EK diff --git a/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c b/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c index f1f955afb..d44f9523c 100644 --- a/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c +++ b/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c @@ -120,7 +120,11 @@ static struct sama5d3ek_mwinfo_s g_mxtinfo = { .address = WM8904_I2C_ADDRESS, .frequency = CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY, +#ifdef CONFIG_SAMA5D3xEK_WM8904_SRCSCK .mclk = BOARD_SLOWCLK_FREQUENCY, +#else + .mclk = BOARD_MAINCK_FREQUENCY, +#endif .attach = wm8904_attach, .enable = wm8904_enable, @@ -281,8 +285,16 @@ int sam_wm8904_initialize(int minor) * that is connected to the WM8904 MCLK. */ +#ifdef CONFIG_SAMA5D3xEK_WM8904_SRCSCK + /* Drive the DAC with the slow clock (32.768 KHz) */ + sam_sckc_enable(true); (void)sam_pck_configure(PCK0, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY); +#else + /* Drive the DAC with the main clock (12 MHz) */ + + (void)sam_pck_configure(PCK0, PCKSRC_MAINCK, BOARD_MAINCK_FREQUENCY); +#endif /* Enable the DAC master clock */ diff --git a/nuttx/configs/sama5d4-ek/Kconfig b/nuttx/configs/sama5d4-ek/Kconfig index 6cbb49512..99d63a79f 100644 --- a/nuttx/configs/sama5d4-ek/Kconfig +++ b/nuttx/configs/sama5d4-ek/Kconfig @@ -280,5 +280,16 @@ config SAMA5D4EK_WM8904_I2CFREQUENCY the WM8904. If you have problems communicating with the WM8904, then you might want to try lowering this rate. +choice + prompt "WM8904 MCLK source" + default SAMA5D4EK_WM8904_SRCMAIN + +config SAMA5D4EK_WM8904_SRCMAIN + bool "Main Clock (12MHz)" + +config SAMA5D4EK_WM8904_SRCSCK + bool "Slow XTAL (32.768KHz)" + +endchoice # WM8904 MCLK source endif # AUDIO_WM8904 endif # ARCH_BOARD_SAMA5D4_EK diff --git a/nuttx/configs/sama5d4-ek/src/sam_wm8904.c b/nuttx/configs/sama5d4-ek/src/sam_wm8904.c index 7207c6ecd..69f4cd557 100644 --- a/nuttx/configs/sama5d4-ek/src/sam_wm8904.c +++ b/nuttx/configs/sama5d4-ek/src/sam_wm8904.c @@ -120,7 +120,11 @@ static struct sama5d4ek_mwinfo_s g_mxtinfo = { .address = WM8904_I2C_ADDRESS, .frequency = CONFIG_SAMA5D4EK_WM8904_I2CFREQUENCY, +#ifdef CONFIG_SAMA5D4EK_WM8904_SRCSCK .mclk = BOARD_SLOWCLK_FREQUENCY, +#else + .mclk = BOARD_MAINCK_FREQUENCY, +#endif .attach = wm8904_attach, .enable = wm8904_enable, @@ -281,8 +285,16 @@ int sam_wm8904_initialize(int minor) * that is connected to the WM8904 MCLK. */ +#ifdef CONFIG_SAMA5D4EK_WM8904_SRCSCK + /* Drive the DAC with the slow clock (32.768 KHz) */ + sam_sckc_enable(true); (void)sam_pck_configure(PCK2, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY); +#else + /* Drive the DAC with the main clock (12 MHz) */ + + (void)sam_pck_configure(PCK0, PCKSRC_MAINCK, BOARD_MAINCK_FREQUENCY); +#endif /* Enable the DAC master clock */ |