SAMA5 WM8904: Add option to use MAINCK as WM8904 MCLK

This commit is contained in:
Gregory Nutt
2014-08-03 11:01:02 -06:00
parent 55e6fd5381
commit 1f213064e0
4 changed files with 46 additions and 0 deletions
+11
View File
@@ -260,5 +260,16 @@ config SAMA5D3xEK_WM8904_I2CFREQUENCY
the WM8904. If you have problems communicating with the WM8904, the WM8904. If you have problems communicating with the WM8904,
then you might want to try lowering this rate. 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 # AUDIO_WM8904
endif # ARCH_BOARD_SAMA5D3X_EK endif # ARCH_BOARD_SAMA5D3X_EK
+12
View File
@@ -120,7 +120,11 @@ static struct sama5d3ek_mwinfo_s g_mxtinfo =
{ {
.address = WM8904_I2C_ADDRESS, .address = WM8904_I2C_ADDRESS,
.frequency = CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY, .frequency = CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY,
#ifdef CONFIG_SAMA5D3xEK_WM8904_SRCSCK
.mclk = BOARD_SLOWCLK_FREQUENCY, .mclk = BOARD_SLOWCLK_FREQUENCY,
#else
.mclk = BOARD_MAINCK_FREQUENCY,
#endif
.attach = wm8904_attach, .attach = wm8904_attach,
.enable = wm8904_enable, .enable = wm8904_enable,
@@ -281,8 +285,16 @@ int sam_wm8904_initialize(int minor)
* that is connected to the WM8904 MCLK. * 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); sam_sckc_enable(true);
(void)sam_pck_configure(PCK0, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY); (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 */ /* Enable the DAC master clock */
+11
View File
@@ -280,5 +280,16 @@ config SAMA5D4EK_WM8904_I2CFREQUENCY
the WM8904. If you have problems communicating with the WM8904, the WM8904. If you have problems communicating with the WM8904,
then you might want to try lowering this rate. 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 # AUDIO_WM8904
endif # ARCH_BOARD_SAMA5D4_EK endif # ARCH_BOARD_SAMA5D4_EK
+12
View File
@@ -120,7 +120,11 @@ static struct sama5d4ek_mwinfo_s g_mxtinfo =
{ {
.address = WM8904_I2C_ADDRESS, .address = WM8904_I2C_ADDRESS,
.frequency = CONFIG_SAMA5D4EK_WM8904_I2CFREQUENCY, .frequency = CONFIG_SAMA5D4EK_WM8904_I2CFREQUENCY,
#ifdef CONFIG_SAMA5D4EK_WM8904_SRCSCK
.mclk = BOARD_SLOWCLK_FREQUENCY, .mclk = BOARD_SLOWCLK_FREQUENCY,
#else
.mclk = BOARD_MAINCK_FREQUENCY,
#endif
.attach = wm8904_attach, .attach = wm8904_attach,
.enable = wm8904_enable, .enable = wm8904_enable,
@@ -281,8 +285,16 @@ int sam_wm8904_initialize(int minor)
* that is connected to the WM8904 MCLK. * 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); sam_sckc_enable(true);
(void)sam_pck_configure(PCK2, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY); (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 */ /* Enable the DAC master clock */