Sound: WM8994: Support I2S0 channel
Subsystems (2)
PATCH 1/4 Sound: WM8994: Support I2S0 channel
This patch modifies the WM8994 codec to support I2S0 channel in codec slave mode
--- drivers/sound/sound.c | 2 +- drivers/sound/wm8994.c | 95 +++++++++++++++----------------------- drivers/sound/wm8994_registers.h | 77 ++++++++++++++++-------------- 3 files changed, 81 insertions(+), 93 deletions(-)
drivers/sound/sound.c +1 -1
@@ -130,7 +130,7 @@ static int codec_init(const void *blob, struct i2stx_info *pi2s_tx)#endif if (!strcmp (codectype,"wm8994" )) {/* Check the codec type and initialise the same */ - ret =wm8994_init (blob,WM8994_AIF2 , + ret =wm8994_init (blob,WM8994_AIF1 , pi2s_tx->samplingrate, (pi2s_tx->samplingrate * (pi2s_tx->rfs)), pi2s_tx->bitspersample, pi2s_tx->channels);
drivers/sound/wm8994.c +38 -57
140 lines not on this page · raw message
drivers/sound/wm8994_registers.h +42 -35
145 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 3/4 ARM: Change from I2S1 to I2S0 for audio on SMDK5250
This patch makes the necessary changes for making use of I2S0 channel instead of I2S1 channel on smdk board. This changes are done to maintain the uniformity to use I2S0 channel.
--- arch/arm/cpu/armv7/exynos/clock.c | 13 +++++++++---- arch/arm/cpu/armv7/exynos/pinmux.c | 15 +++++++++++++-- arch/arm/include/asm/arch-exynos/clock.h | 8 +++++--- arch/arm/include/asm/arch-exynos/cpu.h | 2 ++ arch/arm/include/asm/arch-exynos/periph.h | 1 + 5 files changed, 30 insertions(+), 9 deletions(-)
arch/arm/cpu/armv7/exynos/clock.c +9 -4
@@ -282,6 +282,9 @@ static unsigned long exynos5_get_periph_rate(int peripheral) src =readl (&clk->src_peric0); div =readl (&clk->div_peric3);break ; +case PERIPH_ID_I2S0 : + src =readl (&clk->src_mau); + div =readl (&clk->div_mau);case PERIPH_ID_SPI0 :case PERIPH_ID_SPI1 : src =readl (&clk->src_peric1);
@@ -1151,8 +1154,10 @@ 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 , +setbits_le32 (&clk->src_top2,CLK_SRC_MOUT_EPLL ); +clrsetbits_le32 (&clk->src_mau,AUDIO_SEL_MASK , (CLK_SRC_SCLK_EPLL )); +setbits_le32 (EXYNOS_AUDSS ,CLKMUX_ASS ); } int exynos5_set_i2s_clk_prescaler(unsigned int src_frq,
@@ -1169,13 +1174,13 @@ int exynos5_set_i2s_clk_prescaler(unsigned int src_frq, } div = (src_frq / dst_frq); -if (div >AUDIO_1_RATIO_MASK ) { +if (div >AUDIO_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 )); +clrsetbits_le32 (&clk->div_mau,AUDIO_RATIO_MASK , + (div &AUDIO_RATIO_MASK ));return 0 ; }
arch/arm/cpu/armv7/exynos/pinmux.c +13 -2
@@ -221,9 +221,19 @@ static void exynos5_i2s_config(int peripheral)int i;struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)samsung_get_base_gpio_part1 (); +struct exynos5_gpio_part4 *gpio4 = + (struct exynos5_gpio_part4 *)samsung_get_base_gpio_part4 (); -for (i =0 ; i <5 ; i++) -s5p_gpio_cfg_pin (&gpio1->b0, i,GPIO_FUNC (0x02 )); +switch (peripheral) { +case PERIPH_ID_I2S0 : +for (i =0 ; i <5 ; i++) +s5p_gpio_cfg_pin (&gpio4->z, i,GPIO_FUNC (0x02 )); +break ; +case PERIPH_ID_I2S1 : +for (i =0 ; i <5 ; i++) +s5p_gpio_cfg_pin (&gpio1->b0, i,GPIO_FUNC (0x02 )); +break ; + } }void exynos5_spi_config (int peripheral)
@@ -296,6 +306,7 @@ static int exynos5_pinmux_config(int peripheral, int flags)case PERIPH_ID_I2C7 :exynos5_i2c_config (peripheral, flags);break ; +case PERIPH_ID_I2S0 :case PERIPH_ID_I2S1 :exynos5_i2s_config (peripheral);break ;
arch/arm/include/asm/arch-exynos/clock.h +5 -3
@@ -873,11 +873,13 @@ struct set_epll_con_val {#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 AUDIO_RATIO_MASK 0x0f + +#define AUDIO_SEL_MASK 0xf -#define AUDIO1_SEL_MASK 0xf#define CLK_SRC_SCLK_EPLL 0x7 +#define CLK_SRC_MOUT_EPLL (1<<12) +#define CLKMUX_ASS (1<<0)/* CON0 bit-fields */ #define EPLL_CON0_MDIV_MASK 0x1ff
arch/arm/include/asm/arch-exynos/cpu.h +2 -0
@@ -89,6 +89,8 @@/* EXYNOS5 Common*/ #define EXYNOS5_I2C_SPACING 0x10000 +#define EXYNOS_AUDSS 0x03810000 +#define EXYNOS5_GPIO_PART4_BASE 0x03860000#define EXYNOS5_PRO_ID 0x10000000#define EXYNOS5_CLOCK_BASE 0x10010000
arch/arm/include/asm/arch-exynos/periph.h +1 -0
@@ -34,6 +34,7 @@ enum periph_id {PERIPH_ID_SDMMC1 ,PERIPH_ID_SDMMC2 ,PERIPH_ID_SDMMC3 , +PERIPH_ID_I2S0 =98 , PERIPH_ID_I2S1 = 99,/* Since following peripherals do
Signature · 1 line
1.7.9.5
PATCH 2/4 DTS: Addition of I2S0 channel and replacing I2S1
In reply to Dani Krishna MohanThis patch enables default I2S0 channel and replaces I2S1. I2S platform parameter has been moved to a common file viz exynos5.dtsi.
--- arch/arm/dts/exynos5250.dtsi | 10 ++++++++-- board/samsung/dts/exynos5250-smdk5250.dts | 8 +------- board/samsung/dts/exynos5250-snow.dts | 6 ------ 3 files changed, 9 insertions(+), 15 deletions(-)
arch/arm/dts/exynos5250.dtsi +8 -2
@@ -93,9 +93,15 @@ interrupts = <0 63 0>; }; - sound at 12d60000 { + sound at 3830000 { compatible = "samsung,exynos-sound"; - reg = <0x12d60000 0x20>; + reg = <0x3830000 0x50>; + samsung,i2s-epll-clock-frequency = <192000000>; + samsung,i2s-sampling-rate = <48000>; + samsung,i2s-bits-per-sample = <16>; + samsung,i2s-channels = <2>; + samsung,i2s-lr-clk-framesize = <256>; + samsung,i2s-bit-clk-framesize = <32>; }; spi at 12d20000 {
board/samsung/dts/exynos5250-smdk5250.dts +1 -7
@@ -49,13 +49,7 @@ }; }; - sound at 12d60000 { - samsung,i2s-epll-clock-frequency = <192000000>; - samsung,i2s-sampling-rate = <48000>; - samsung,i2s-bits-per-sample = <16>; - samsung,i2s-channels = <2>; - samsung,i2s-lr-clk-framesize = <256>; - samsung,i2s-bit-clk-framesize = <32>; + sound at 3830000 { samsung,codec-type = "wm8994"; };
board/samsung/dts/exynos5250-snow.dts +0 -6
@@ -66,12 +66,6 @@ }; sound at 12d60000 { - samsung,i2s-epll-clock-frequency = <192000000>; - samsung,i2s-sampling-rate = <48000>; - samsung,i2s-bits-per-sample = <16>; - samsung,i2s-channels = <2>; - samsung,i2s-lr-clk-framesize = <256>; - samsung,i2s-bit-clk-framesize = <32>; samsung,codec-type = "max98095"; };
Signature · 1 line
1.7.9.5
PATCH 4/4 Sound: I2S: Replacing I2S1 with I2S0 channel.
In reply to Dani Krishna MohanThis patch makes required changes to make use of I2S0 channel instead of I2S1 channel on exynos5250.
--- arch/arm/include/asm/arch-exynos/i2s-regs.h | 6 ++++++ drivers/sound/samsung-i2s.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-)
arch/arm/include/asm/arch-exynos/i2s-regs.h +6 -0
@@ -8,10 +8,12 @@#ifndef __I2S_REGS_H__#define __I2S_REGS_H__ +#define CON_RESET (1 << 31)#define CON_TXFIFO_FULL (1 << 8)#define CON_TXCH_PAUSE (1 << 4)#define CON_ACTIVE (1 << 0) +#define MOD_OP_CLK (3 << 30)#define MOD_BLCP_SHIFT 24#define MOD_BLCP_16BIT (0 << MOD_BLCP_SHIFT)#define MOD_BLCP_8BIT (1 << MOD_BLCP_SHIFT)
@@ -24,6 +26,7 @@#define MOD_BLC_MASK (3 << 13)#define MOD_SLAVE (1 << 11) +#define MOD_RCLKSRC (0 << 10)#define MOD_MASK (3 << 8)#define MOD_LR_LLOW (0 << 7)#define MOD_LR_RLOW (1 << 7)
@@ -47,4 +50,7 @@#define FIC_TXFLUSH (1 << 15)#define FIC_RXFLUSH (1 << 7) +#define PSREN (1 << 15) +#define PSVAL (3 << 8) +#endif /* __I2S_REGS_H__ */
drivers/sound/samsung-i2s.c +10 -6
@@ -303,21 +303,25 @@ int i2s_tx_init(struct i2stx_info *pi2s_tx) (struct i2s_reg *)pi2s_tx->base_address;/* Initialize GPIO for I2s */ -exynos_pinmux_config (PERIPH_ID_I2S1 ,0 ); +exynos_pinmux_config (PERIPH_ID_I2S0 ,0 );/* Set EPLL Clock */ - ret =set_epll_clk (pi2s_tx->audio_pll_clk); + ret =set_epll_clk (pi2s_tx->samplingrate * pi2s_tx->rfs *4 );if (ret !=0 ) {debug ("%s: epll clock set rate falied\n" , __func__);return -1 ; } -/* Select Clk Source for Audio1 */ +/* Select Clk Source for Audio0 */ set_i2s_clk_source (); -/* Set Prescaler to get MCLK */ -set_i2s_clk_prescaler (pi2s_tx->audio_pll_clk, - (pi2s_tx->samplingrate * (pi2s_tx->rfs))); +/*Reset the i2s module */ +writel (CON_RESET , &i2s_reg->con); + +writel (MOD_OP_CLK |MOD_RCLKSRC , &i2s_reg->mod); + +/* set i2s prescaler */ +writel (PSREN |PSVAL , &i2s_reg->psr);/* Configure I2s format */ ret = i2s_set_fmt(i2s_reg, (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
Signature · 1 line
1.7.9.5