Skip to contentSkip to conversation

EXYNOS5: Add Audio support

PATCH New Rajeshwari Shinde 3 participants 12 messages Oct 26, 2012 – Nov 2, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover EXYNOS5: Add Audio support

This patchset adds the audio support for EXYNOS5.
This patchset plays a predefined beep sound.

Rajeshwari Shinde (9):
SOUND: SAMSUNG: Add I2S driver
SOUND: Add WM8994 codec
Sound: Add command for audio playback
EXYNOS: Add I2S registers
EXYNOS: Add parameters required by I2S
EXYNOS: Add pinmux for I2S
EXYNOS: Add I2S base address
EXYNOS: Add clock for I2S
SMDK5250: Enable Sound

Changes in V2:
- renamed i2s.c to samsung-i2s.c.
- made exynos_i2s_config pinmux function static.
- corrected the commit message for "Enable sound" patch. Changes in V3:
- Incorporated comments from Simon Glass and Minkyu Kang. Changes in V4:
- Corrected the coding style issues suggested by Simon Glass.

 Makefile                                    |    1 +
 arch/arm/cpu/armv7/exynos/clock.c           |  120 ++++
 arch/arm/cpu/armv7/exynos/pinmux.c          |   13 +
 arch/arm/include/asm/arch-exynos/clk.h      |    3 +
 arch/arm/include/asm/arch-exynos/clock.h    |   29 +
 arch/arm/include/asm/arch-exynos/cpu.h      |    3 +
 arch/arm/include/asm/arch-exynos/i2s-regs.h |   66 +++
 arch/arm/include/asm/arch-exynos/periph.h   |    1 +
 arch/arm/include/asm/arch-exynos/sound.h    |   44 ++
 common/Makefile                             |    1 +
 common/cmd_sound.c                          |   96 ++++
 drivers/sound/Makefile                      |   48 ++
 drivers/sound/samsung-i2s.c                 |  358 ++++++++++++
 drivers/sound/sound.c                       |  228 ++++++++
 drivers/sound/wm8994.c                      |  792 +++++++++++++++++++++++++++
 drivers/sound/wm8994.h                      |   87 +++
 drivers/sound/wm8994_registers.h            |  299 ++++++++++
 include/configs/smdk5250.h                  |    8 +
 include/i2s.h                               |  127 +++++
 include/sound.h                             |   62 +++
 20 files changed, 2386 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/i2s-regs.h
 create mode 100644 arch/arm/include/asm/arch-exynos/sound.h
 create mode 100644 common/cmd_sound.c
 create mode 100644 drivers/sound/Makefile
 create mode 100644 drivers/sound/samsung-i2s.c
 create mode 100644 drivers/sound/sound.c
 create mode 100644 drivers/sound/wm8994.c
 create mode 100644 drivers/sound/wm8994.h
 create mode 100644 drivers/sound/wm8994_registers.h
 create mode 100644 include/i2s.h
 create mode 100644 include/sound.h
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH v4 1/9 SOUND: SAMSUNG: Add I2S driver

This patch adds driver for I2S interface specific to samsung.

---
Changes in V2:
- renamed i2s.c to samsung-i2s.c.
Changes in V3:
- wave sine table removed and the same in calculated in a function. Changes in V4:
- Corrected the coding style issues suggested by Simon Glass.
- Global variables in sound.c were made static.

 Makefile                    |    1 +
 drivers/sound/Makefile      |   47 ++++++
 drivers/sound/samsung-i2s.c |  358 +++++++++++++++++++++++++++++++++++++++++++
 drivers/sound/sound.c       |  228 +++++++++++++++++++++++++++
 include/i2s.h               |  127 +++++++++++++++
 include/sound.h             |   62 ++++++++
 6 files changed, 823 insertions(+), 0 deletions(-)
 create mode 100644 drivers/sound/Makefile
 create mode 100644 drivers/sound/samsung-i2s.c
 create mode 100644 drivers/sound/sound.c
 create mode 100644 include/i2s.h
 create mode 100644 include/sound.h
Makefile +1 -0
index 08eecbb..ee4fb7f 100644
@@ -311,6 +311,7 @@ LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
 endif
 LIBS-y += drivers/rtc/librtc.o
 LIBS-y += drivers/serial/libserial.o
+LIBS-y += drivers/sound/libsound.o
 LIBS-$(CONFIG_GENERIC_LPC_TPM) += drivers/tpm/libtpm.o
 LIBS-y += drivers/twserial/libtws.o
 LIBS-y += drivers/usb/eth/libusb_eth.o
drivers/sound/Makefile new file +47 -0

47 lines not on this page · raw message

drivers/sound/samsung-i2s.c new file +358 -0

358 lines not on this page · raw message

drivers/sound/sound.c new file +228 -0

228 lines not on this page · raw message

include/i2s.h new file +127 -0

127 lines not on this page · raw message

include/sound.h new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#2 lore raw

PATCH v4 2/9 SOUND: Add WM8994 codec

In reply to Rajeshwari Shinde

This patch adds driver for audio codec WM8994

---
Changes in V2:
- None
Changes in V3:
- Incorporated comments from Simon Glass.
Changes in V4:
- None

 drivers/sound/Makefile           |    1 +
 drivers/sound/wm8994.c           |  792 ++++++++++++++++++++++++++++++++++++++
 drivers/sound/wm8994.h           |   87 +++++
 drivers/sound/wm8994_registers.h |  299 ++++++++++++++
 4 files changed, 1179 insertions(+), 0 deletions(-)
 create mode 100644 drivers/sound/wm8994.c
 create mode 100644 drivers/sound/wm8994.h
 create mode 100644 drivers/sound/wm8994_registers.h
drivers/sound/Makefile +1 -0
index 18ad2c9..8fdffb1 100644
@@ -27,6 +27,7 @@ LIB	:= $(obj)libsound.o
 
 COBJS-$(CONFIG_SOUND)	+= sound.o
 COBJS-$(CONFIG_I2S)	+= samsung-i2s.o
+COBJS-$(CONFIG_SOUND_WM8994)	+= wm8994.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/sound/wm8994.c new file +792 -0

792 lines not on this page · raw message

drivers/sound/wm8994.h new file +87 -0

87 lines not on this page · raw message

drivers/sound/wm8994_registers.h new file +299 -0

299 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#3 lore raw

PATCH v4 3/9 Sound: Add command for audio playback

In reply to Rajeshwari Shinde

This patch adds command to test audio playback.
sound init - Initialises the audio subsystem (i2s and wm8994 codec) sound play - Plays predefined the audio data when specified length and frequency.

---
Changes in V2:
- None
Changes in V3:
- Incorporated comments from Simon Glass.
Changes in V4:
- None

 common/Makefile    |    1 +
 common/cmd_sound.c |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_sound.c
common/Makefile +1 -0
index fdfead7..3f9f001 100644
@@ -74,6 +74,7 @@ COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
 COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
 COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o
 COBJS-$(CONFIG_CMD_DATE) += cmd_date.o
+COBJS-$(CONFIG_CMD_SOUND) += cmd_sound.o
 ifdef CONFIG_4xx
 COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o
 endif
common/cmd_sound.c new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#4 lore raw

PATCH v4 4/9 EXYNOS: Add I2S registers

In reply to Rajeshwari Shinde

This patch add I2S registers

---
Changes in V2:
- None
Changes in V3:
- None
Changes in V4:
- None

 arch/arm/include/asm/arch-exynos/i2s-regs.h |   66 +++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/i2s-regs.h
arch/arm/include/asm/arch-exynos/i2s-regs.h new file +66 -0
new file mode 100644
index 0000000..2326ca0
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * R. Chandrasekar <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __I2S_REGS_H__
+#define __I2S_REGS_H__
+
+#define CON_TXFIFO_FULL		(1 << 8)
+#define CON_TXCH_PAUSE		(1 << 4)
+#define CON_ACTIVE		(1 << 0)
+
+#define MOD_BLCP_SHIFT		24
+#define MOD_BLCP_16BIT		(0 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_8BIT		(1 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_24BIT		(2 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_MASK		(3 << MOD_BLCP_SHIFT)
+
+#define MOD_BLC_16BIT		(0 << 13)
+#define MOD_BLC_8BIT		(1 << 13)
+#define MOD_BLC_24BIT		(2 << 13)
+#define MOD_BLC_MASK		(3 << 13)
+
+#define MOD_SLAVE		(1 << 11)
+#define MOD_MASK		(3 << 8)
+#define MOD_LR_LLOW		(0 << 7)
+#define MOD_LR_RLOW		(1 << 7)
+#define MOD_SDF_IIS		(0 << 5)
+#define MOD_SDF_MSB		(1 << 5)
+#define MOD_SDF_LSB		(2 << 5)
+#define MOD_SDF_MASK		(3 << 5)
+#define MOD_RCLK_256FS		(0 << 3)
+#define MOD_RCLK_512FS		(1 << 3)
+#define MOD_RCLK_384FS		(2 << 3)
+#define MOD_RCLK_768FS		(3 << 3)
+#define MOD_RCLK_MASK		(3 << 3)
+#define MOD_BCLK_32FS		(0 << 1)
+#define MOD_BCLK_48FS		(1 << 1)
+#define MOD_BCLK_16FS		(2 << 1)
+#define MOD_BCLK_24FS		(3 << 1)
+#define MOD_BCLK_MASK		(3 << 1)
+
+#define MOD_CDCLKCON		(1 << 12)
+
+#define FIC_TXFLUSH		(1 << 15)
+#define FIC_RXFLUSH		(1 << 7)
+
+#endif /* __I2S_REGS_H__ */
Signature · 1 line
1.7.4.4
#5 lore raw

PATCH v4 5/9 EXYNOS: Add parameters required by I2S

In reply to Rajeshwari Shinde

This patch adds the audio parameters required by the I2S to play the predefined audio data.

---
Changes in V2:
- None
Changes in V3:
- Changed codec I2C address to 0x1a.
Changes in V4:
- None

 arch/arm/include/asm/arch-exynos/sound.h |   44 ++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/sound.h
arch/arm/include/asm/arch-exynos/sound.h new file +44 -0
new file mode 100644
index 0000000..d1bd2f6
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * Rajeshwari Shinde <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+
+#ifndef __SOUND_ARCH_H__
+#define __SOUND_ARCH_H__
+
+/* I2S values */
+#define I2S_PLL_CLK		192000000
+#define I2S_SAMPLING_RATE	48000
+#define I2S_BITS_PER_SAMPLE	16
+#define I2S_CHANNELS		2
+#define I2S_RFS			256
+#define I2S_BFS			32
+
+/* I2C values */
+#define AUDIO_I2C_BUS		1
+#define AUDIO_I2C_REG		0x1a
+
+/* Audio Codec */
+#define AUDIO_CODEC		"wm8994"
+
+#define AUDIO_COMPAT		1
+#endif
Signature · 1 line
1.7.4.4
#6 lore raw

PATCH v4 6/9 EXYNOS: Add pinmux for I2S

In reply to Rajeshwari Shinde

This patch adds pinmux support for I2S1

---
Changes in V2:
- made exynos_i2s_config pinmux function static.
Changes in V3:
- Incorporated comments from Simon Glass
Changes in V4:
- None

 arch/arm/cpu/armv7/exynos/pinmux.c        |   13 +++++++++++++
 arch/arm/include/asm/arch-exynos/periph.h |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/exynos/pinmux.c +13 -0
index 5796d56..d99daa0 100644
@@ -230,6 +230,16 @@ static void exynos5_i2c_config(int peripheral, int flags)
 	}
 }
 
+static void exynos5_i2s_config(int peripheral)
+{
+	int i;
+	struct exynos5_gpio_part1 *gpio1 =
+		(struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
+
+	for (i = 0; i < 5; i++)
+		s5p_gpio_cfg_pin(&gpio1->b0, i, GPIO_FUNC(0x02));
+}
+
 static int exynos5_pinmux_config(int peripheral, int flags)
 {
 	switch (peripheral) {
@@ -257,6 +267,9 @@ static int exynos5_pinmux_config(int peripheral, int flags)
 	case PERIPH_ID_I2C7:
 		exynos5_i2c_config(peripheral, flags);
 		break;
+	case PERIPH_ID_I2S1:
+		exynos5_i2s_config(peripheral);
+		break;
 	default:
 		debug("%s: invalid peripheral %d", __func__, peripheral);
 		return -1;
arch/arm/include/asm/arch-exynos/periph.h +1 -0
index 082611c..673f4c7 100644
@@ -38,6 +38,7 @@ enum periph_id {
 	PERIPH_ID_I2C5,
 	PERIPH_ID_I2C6,
 	PERIPH_ID_I2C7,
+	PERIPH_ID_I2S1,
 	PERIPH_ID_SDMMC0,
 	PERIPH_ID_SDMMC1,
 	PERIPH_ID_SDMMC2,
Signature · 1 line
1.7.4.4
#7 lore raw

PATCH v4 7/9 EXYNOS: Add I2S base address

In reply to Rajeshwari Shinde

This patch adds base address for I2S

---
Changes in V2:
- None
Changes in V3:
- None
Changes in V4:
- None

 arch/arm/include/asm/arch-exynos/cpu.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-exynos/cpu.h +3 -0
index 2cd4ae1..ace40e5 100644
@@ -54,6 +54,7 @@
 #define EXYNOS4_PWMTIMER_BASE		0x139D0000
 #define EXYNOS4_MODEM_BASE		0x13A00000
 #define EXYNOS4_USBPHY_CONTROL		0x10020704
+#define EXYNOS4_I2S_BASE		0xE2100000
 
 #define EXYNOS4_GPIO_PART4_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DP_BASE			DEVICE_NOT_AVAILABLE
@@ -81,6 +82,7 @@
 #define EXYNOS5_SROMC_BASE		0x12250000
 #define EXYNOS5_UART_BASE		0x12C00000
 #define EXYNOS5_I2C_BASE		0x12C60000
+#define EXYNOS5_I2S_BASE		0x12D60000
 #define EXYNOS5_PWMTIMER_BASE		0x12DD0000
 #define EXYNOS5_GPIO_PART2_BASE		0x13400000
 #define EXYNOS5_FIMD_BASE		0x14400000
@@ -156,6 +158,7 @@ SAMSUNG_BASE(dp, DP_BASE)
 SAMSUNG_BASE(sysreg, SYSREG_BASE)
 SAMSUNG_BASE(fimd, FIMD_BASE)
 SAMSUNG_BASE(i2c, I2C_BASE)
+SAMSUNG_BASE(i2s, I2S_BASE)
 SAMSUNG_BASE(mipi_dsim, MIPI_DSIM_BASE)
 SAMSUNG_BASE(gpio_part1, GPIO_PART1_BASE)
 SAMSUNG_BASE(gpio_part2, GPIO_PART2_BASE)
Signature · 1 line
1.7.4.4
#8 lore raw

PATCH v4 8/9 EXYNOS: Add clock for I2S

In reply to Rajeshwari Shinde

This patch adds clock support for I2S

---
Changes in V2:
- None
Changes in V3:
- Changes clock function names as suggested by Minkyu Kang. Changes in V4:
- None

 arch/arm/cpu/armv7/exynos/clock.c        |  120 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/clk.h   |    3 +
 arch/arm/include/asm/arch-exynos/clock.h |   29 +++++++
 3 files changed, 152 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/exynos/clock.c +120 -0
index 4f3b451..5f7d884 100644
@@ -26,6 +26,16 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/clk.h>
 
+/* Epll Clock division values to achive different frequency output */
+static struct set_epll_con_val exynos5_epll_div[] = {
+	{ 192000000, 0, 48, 3, 1, 0 },
+	{ 180000000, 0, 45, 3, 1, 0 },
+	{  73728000, 1, 73, 3, 3, 47710 },
+	{  67737600, 1, 90, 4, 3, 20762 },
+	{  49152000, 0, 49, 3, 3, 9961 },
+	{  45158400, 0, 45, 3, 3, 10381 },
+	{ 180633600, 0, 45, 3, 1, 10381 }
+};
 /* exynos4: return pll clock frequency */
 static unsigned long exynos4_get_pll_clk(int pllreg)
 {
@@ -732,6 +742,93 @@ static unsigned long exynos5_get_i2c_clk(void)
 	return aclk_66;
 }
 
+int exynos5_set_epll_clk(unsigned long rate)
+{
+	unsigned int epll_con, epll_con_k;
+	unsigned int i;
+	unsigned int lockcnt;
+	unsigned int start;
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
+
+	epll_con = readl(&clk->epll_con0);
+	epll_con &= ~((EPLL_CON0_LOCK_DET_EN_MASK <<
+			EPLL_CON0_LOCK_DET_EN_SHIFT) |
+		EPLL_CON0_MDIV_MASK << EPLL_CON0_MDIV_SHIFT |
+		EPLL_CON0_PDIV_MASK << EPLL_CON0_PDIV_SHIFT |
+		EPLL_CON0_SDIV_MASK << EPLL_CON0_SDIV_SHIFT);
+
+	for (i = 0; i < ARRAY_SIZE(exynos5_epll_div); i++) {
+		if (exynos5_epll_div[i].freq_out == rate)
+			break;
+	}
+
+	if (i == ARRAY_SIZE(exynos5_epll_div))
+		return -1;
+
+	epll_con_k = exynos5_epll_div[i].k_dsm << 0;
+	epll_con |= exynos5_epll_div[i].en_lock_det <<
+				EPLL_CON0_LOCK_DET_EN_SHIFT;
+	epll_con |= exynos5_epll_div[i].m_div << EPLL_CON0_MDIV_SHIFT;
+	epll_con |= exynos5_epll_div[i].p_div << EPLL_CON0_PDIV_SHIFT;
+	epll_con |= exynos5_epll_div[i].s_div << EPLL_CON0_SDIV_SHIFT;
+
+	/*
+	 * Required period ( in cycles) to genarate a stable clock output.
+	 * The maximum clock time can be up to 3000 * PDIV cycles of PLLs
+	 * frequency input (as per spec)
+	 */
+	lockcnt = 3000 * exynos5_epll_div[i].p_div;
+
+	writel(lockcnt, &clk->epll_lock);
+	writel(epll_con, &clk->epll_con0);
+	writel(epll_con_k, &clk->epll_con1);
+
+	start = get_timer(0);
+
+	 while (!(readl(&clk->epll_con0) &
+			(0x1 << EXYNOS5_EPLLCON0_LOCKED_SHIFT))) {
+		if (get_timer(start) > TIMEOUT_EPLL_LOCK) {
+			debug("%s: Timeout waiting for EPLL lock\n", __func__);
+			return -1;
+		}
+	}
+	return 0;
+}
+
+void exynos5_set_i2s_clk_source(void)
+{
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
+
+	clrsetbits_le32(&clk->src_peric1, AUDIO1_SEL_MASK,
+			(CLK_SRC_SCLK_EPLL));
+}
+
+int exynos5_set_i2s_clk_prescaler(unsigned int src_frq,
+					unsigned int dst_frq)
+{
+	struct exynos5_clock *clk =
+		(struct exynos5_clock *)samsung_get_base_clock();
+	unsigned int div;
+
+	if ((dst_frq == 0) || (src_frq == 0)) {
+		debug("%s: Invalid requency input for prescaler\n", __func__);
+		debug("src frq = %d des frq = %d ", src_frq, dst_frq);
+		return -1;
+	}
+
+	div = (src_frq / dst_frq);
+	if (div > AUDIO_1_RATIO_MASK) {
+		debug("%s: Frequency ratio is out of range\n", __func__);
+		debug("src frq = %d des frq = %d ", src_frq, dst_frq);
+		return -1;
+	}
+	clrsetbits_le32(&clk->div_peric4, AUDIO_1_RATIO_MASK,
+				(div & AUDIO_1_RATIO_MASK));
+	return 0;
+}
+
 unsigned long get_pll_clk(int pllreg)
 {
 	if (cpu_is_exynos5())
@@ -803,3 +900,26 @@ void set_mipi_clk(void)
 	if (cpu_is_exynos4())
 		exynos4_set_mipi_clk();
 }
+
+int set_i2s_clk_prescaler(unsigned int src_frq, unsigned int dst_frq)
+{
+
+	if (cpu_is_exynos5())
+		return exynos5_set_i2s_clk_prescaler(src_frq, dst_frq);
+	else
+		return 0;
+}
+
+void set_i2s_clk_source(void)
+{
+	if (cpu_is_exynos5())
+		exynos5_set_i2s_clk_source();
+}
+
+int set_epll_clk(unsigned long rate)
+{
+	if (cpu_is_exynos5())
+		return exynos5_set_epll_clk(rate);
+	else
+		return 0;
+}
arch/arm/include/asm/arch-exynos/clk.h +3 -0
index 5529025..2bf2c10 100644
@@ -38,5 +38,8 @@ void set_mmc_clk(int dev_index, unsigned int div);
 unsigned long get_lcd_clk(void);
 void set_lcd_clk(void);
 void set_mipi_clk(void);
+void set_i2s_clk_source(void);
+int set_i2s_clk_prescaler(unsigned int src_frq, unsigned int dst_frq);
+int set_epll_clk(unsigned long rate);
 
 #endif
arch/arm/include/asm/arch-exynos/clock.h +29 -0
index fce38ef..ff6781a 100644
@@ -595,9 +595,38 @@ struct exynos5_clock {
 	unsigned int	pll_div2_sel;
 	unsigned char	res123[0xf5d8];
 };
+
+/* structure for epll configuration used in audio clock configuration */
+struct set_epll_con_val {
+	unsigned int freq_out;		/* frequency out */
+	unsigned int en_lock_det;	/* enable lock detect */
+	unsigned int m_div;		/* m divider value */
+	unsigned int p_div;		/* p divider value */
+	unsigned int s_div;		/* s divider value */
+	unsigned int k_dsm;		/* k value of delta signal modulator */
+};
 #endif
 
 #define MPLL_FOUT_SEL_SHIFT	4
+#define EXYNOS5_EPLLCON0_LOCKED_SHIFT	29  /* EPLL Locked bit position*/
+#define TIMEOUT_EPLL_LOCK		1000
+
+#define AUDIO_0_RATIO_MASK		0x0f
+#define AUDIO_1_RATIO_MASK		0x0f
+
+#define AUDIO1_SEL_MASK			0xf
+#define CLK_SRC_SCLK_EPLL		0x7
+
+/* CON0 bit-fields */
+#define EPLL_CON0_MDIV_MASK		0x1ff
+#define EPLL_CON0_PDIV_MASK		0x3f
+#define EPLL_CON0_SDIV_MASK		0x7
+#define EPLL_CON0_MDIV_SHIFT		16
+#define EPLL_CON0_PDIV_SHIFT		8
+#define EPLL_CON0_SDIV_SHIFT		0
+#define EPLL_CON0_LOCK_DET_EN_SHIFT	28
+#define EPLL_CON0_LOCK_DET_EN_MASK	1
+
 #define MPLL_FOUT_SEL_MASK	0x1
 #define BPLL_FOUT_SEL_SHIFT	0
 #define BPLL_FOUT_SEL_MASK	0x1
Signature · 1 line
1.7.4.4
#9 lore raw

PATCH v4 9/9 SMDK5250: Enable Sound

In reply to Rajeshwari Shinde

This patch enables sound support for EXYNOS5

---
Changes in V2:
- corrected the commit message.
Changes in V3:
- None.
Changes in V4:
- None.

 include/configs/smdk5250.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/configs/smdk5250.h +8 -0
index 91da167..4cb43b5 100644
@@ -218,6 +218,14 @@
 #define CONFIG_MENU
 #endif
 
+/* Sound */
+#define CONFIG_CMD_SOUND
+#ifdef CONFIG_CMD_SOUND
+#define CONFIG_SOUND
+#define CONFIG_I2S
+#define CONFIG_SOUND_WM8994
+#endif
+
 /* Enable devicetree support */
 #define CONFIG_OF_LIBFDT
 
Signature · 1 line
1.7.4.4
#10 lore raw

v4 cover EXYNOS5: Add Audio support

In reply to Rajeshwari Shinde

Hi Rajeshwari,

Quoted 3 lines · Rajeshwari Shinde

This patchset adds the audio support for EXYNOS5.
This patchset plays a predefined beep sound.

This all looks good to me. You already have my ACKs for each patch.

Regards,
Simon

Quoted 55 lines

Rajeshwari Shinde (9):
SOUND: SAMSUNG: Add I2S driver
SOUND: Add WM8994 codec
Sound: Add command for audio playback
EXYNOS: Add I2S registers
EXYNOS: Add parameters required by I2S
EXYNOS: Add pinmux for I2S
EXYNOS: Add I2S base address
EXYNOS: Add clock for I2S
SMDK5250: Enable Sound

Changes in V2:
- renamed i2s.c to samsung-i2s.c.
- made exynos_i2s_config pinmux function static.
- corrected the commit message for "Enable sound" patch. Changes in V3:
- Incorporated comments from Simon Glass and Minkyu Kang. Changes in V4:
- Corrected the coding style issues suggested by Simon Glass.

 Makefile                                    |    1 +
 arch/arm/cpu/armv7/exynos/clock.c           |  120 ++++
 arch/arm/cpu/armv7/exynos/pinmux.c          |   13 +
 arch/arm/include/asm/arch-exynos/clk.h      |    3 +
 arch/arm/include/asm/arch-exynos/clock.h    |   29 +
 arch/arm/include/asm/arch-exynos/cpu.h      |    3 +
 arch/arm/include/asm/arch-exynos/i2s-regs.h |   66 +++
 arch/arm/include/asm/arch-exynos/periph.h   |    1 +
 arch/arm/include/asm/arch-exynos/sound.h    |   44 ++
 common/Makefile                             |    1 +
 common/cmd_sound.c                          |   96 ++++
 drivers/sound/Makefile                      |   48 ++
 drivers/sound/samsung-i2s.c                 |  358 ++++++++++++
 drivers/sound/sound.c                       |  228 ++++++++
 drivers/sound/wm8994.c                      |  792 +++++++++++++++++++++++++++
 drivers/sound/wm8994.h                      |   87 +++
 drivers/sound/wm8994_registers.h            |  299 ++++++++++
 include/configs/smdk5250.h                  |    8 +
 include/i2s.h                               |  127 +++++
 include/sound.h                             |   62 +++
 20 files changed, 2386 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/i2s-regs.h
 create mode 100644 arch/arm/include/asm/arch-exynos/sound.h
 create mode 100644 common/cmd_sound.c
 create mode 100644 drivers/sound/Makefile
 create mode 100644 drivers/sound/samsung-i2s.c
 create mode 100644 drivers/sound/sound.c
 create mode 100644 drivers/sound/wm8994.c
 create mode 100644 drivers/sound/wm8994.h
 create mode 100644 drivers/sound/wm8994_registers.h
 create mode 100644 include/i2s.h
 create mode 100644 include/sound.h

--
1.7.4.4

#11 lore raw

v4 cover EXYNOS5: Add Audio support

In reply to Rajeshwari Shinde
Quoted 46 lines · Rajeshwari Shinde

This patchset adds the audio support for EXYNOS5.
This patchset plays a predefined beep sound.

Rajeshwari Shinde (9):
SOUND: SAMSUNG: Add I2S driver
SOUND: Add WM8994 codec
Sound: Add command for audio playback
EXYNOS: Add I2S registers
EXYNOS: Add parameters required by I2S
EXYNOS: Add pinmux for I2S
EXYNOS: Add I2S base address
EXYNOS: Add clock for I2S
SMDK5250: Enable Sound

Changes in V2:
- renamed i2s.c to samsung-i2s.c.
- made exynos_i2s_config pinmux function static.
- corrected the commit message for "Enable sound" patch. Changes in V3:
- Incorporated comments from Simon Glass and Minkyu Kang. Changes in V4:
- Corrected the coding style issues suggested by Simon Glass.

 Makefile                                    |    1 +
 arch/arm/cpu/armv7/exynos/clock.c           |  120 ++++
 arch/arm/cpu/armv7/exynos/pinmux.c          |   13 +
 arch/arm/include/asm/arch-exynos/clk.h      |    3 +
 arch/arm/include/asm/arch-exynos/clock.h    |   29 +
 arch/arm/include/asm/arch-exynos/cpu.h      |    3 +
 arch/arm/include/asm/arch-exynos/i2s-regs.h |   66 +++
 arch/arm/include/asm/arch-exynos/periph.h   |    1 +
 arch/arm/include/asm/arch-exynos/sound.h    |   44 ++
 common/Makefile                             |    1 +
 common/cmd_sound.c                          |   96 ++++
 drivers/sound/Makefile                      |   48 ++
 drivers/sound/samsung-i2s.c                 |  358 ++++++++++++
 drivers/sound/sound.c                       |  228 ++++++++
 drivers/sound/wm8994.c                      |  792 +++++++++++++++++++++++++++
 drivers/sound/wm8994.h                      |   87 +++
 drivers/sound/wm8994_registers.h            |  299 ++++++++++
 include/configs/smdk5250.h                  |    8 +
 include/i2s.h                               |  127 +++++
 include/sound.h                             |   62 +++
 20 files changed, 2386 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/i2s-regs.h
 create mode 100644 arch/arm/include/asm/arch-exynos/sound.h
 create mode 100644 common/cmd_sound.c
Quoted 9 lines
 create mode 100644 drivers/sound/Makefile
 create mode 100644 drivers/sound/samsung-i2s.c
 create mode 100644 drivers/sound/sound.c
 create mode 100644 drivers/sound/wm8994.c
 create mode 100644 drivers/sound/wm8994.h
 create mode 100644 drivers/sound/wm8994_registers.h
 create mode 100644 include/i2s.h
 create mode 100644 include/sound.h

applied to u-boot-samsung.

Thanks.
Minkyu Kang.