Skip to contentSkip to conversation

Add WM8580 PCM Machine driver for Samsung SoCs

PATCH Applied Sangbeom Kim 6 participants 9 messages Apr 9, 2011 – Apr 12, 2011

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

v2 cover Add WM8580 PCM Machine driver for Samsung SoCs

Hi,

This is 2nd patchset for WM8580 pcm machine driver that supports PCM audio on SMDKC110, SMDKV210, SMDK6450, SMDK6440. and It is tested on SMDKC110, SMDKV210, SMDKV6450.

Changeds since v1:
- Used snd_soc_register_card() for new machines
- Modified Kconfig for useless config

Based on these patches WM8580 pcm machine driver supports followings:
o Playback supports 8kHz sampling rates.
o Capture supports 8kHz sampling rates.

This patchset contains followings

o To Kukjin Kim and Ben Dooks,
[PATCH 1/3] ARM: S5PV210: Add PCM audio support for WM8580 [PATCH 2/3] ARM: S5P64X0: Add PCM audio support for WM8580

o To Jassi Brar, Mark Brown and Liam Girdwood,
[PATCH 3/3] ASoC: SAMSUNG: Add WM8580 PCM Machine driver

Best Regards,
SB Kim (Sangbeom Kim)

#1 lore raw

PATCH v2 1/3 ARM: S5PV210: Add PCM audio support for WM8580

This patch add pcm audio configuration for SMDKV210 and SMDKC110. Platform device and pcm clock initialization code is added.

---
 arch/arm/mach-s5pv210/clock.c                   |   90 ++++++++++++++++++++++-
 arch/arm/mach-s5pv210/cpu.c                     |    7 ++-
 arch/arm/mach-s5pv210/include/mach/map.h        |    2 +
 arch/arm/mach-s5pv210/include/mach/regs-audss.h |   45 +++++++++++
 arch/arm/mach-s5pv210/mach-smdkc110.c           |    7 ++
 arch/arm/mach-s5pv210/mach-smdkv210.c           |    7 ++
 arch/arm/plat-s5p/include/plat/map-s5p.h        |    1 +
 7 files changed, 155 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-s5pv210/include/mach/regs-audss.h
arch/arm/mach-s5pv210/clock.c +87 -3
index 2d59949..a964e1c 100644
@@ -21,6 +21,7 @@
 #include <linux/io.h>
 
 #include <mach/map.h>
+#include <mach/regs-audss.h>
 
 #include <plat/cpu-freq.h>
 #include <mach/regs-clock.h>
@@ -185,6 +186,11 @@ static int s5pv210_clk_mask1_ctrl(struct clk *clk, int enable)
 	return s5p_gatectrl(S5P_CLK_SRC_MASK1, clk, enable);
 }
 
+static int s5pv210_clk_audss_ctrl(struct clk *clk, int enable)
+{
+	return s5p_gatectrl(S5P_CLKGATE_AUDSS, clk, enable);
+}
+
 static struct clk clk_sclk_hdmi27m = {
 	.name		= "sclk_hdmi27m",
 	.id		= -1,
@@ -208,17 +214,28 @@ static struct clk clk_sclk_usbphy1 = {
 
 static struct clk clk_pcmcdclk0 = {
 	.name		= "pcmcdclk",
-	.id		= -1,
+	.id		= 0,
+	.rate		= 2048000,
 };
 
 static struct clk clk_pcmcdclk1 = {
 	.name		= "pcmcdclk",
-	.id		= -1,
+	.id		= 1,
 };
 
 static struct clk clk_pcmcdclk2 = {
 	.name		= "pcmcdclk",
-	.id		= -1,
+	.id		= 2,
+};
+
+static struct clk clk_i2scdclk0 = {
+	.name		= "i2scdclk",
+	.id		= 0,
+};
+
+static struct clk clk_i2scdclk1 = {
+	.name		= "i2scdclk",
+	.id		= 1,
 };
 
 static struct clk *clkset_vpllsrc_list[] = {
@@ -490,6 +507,24 @@ static struct clk init_clocks_off[] = {
 		.parent		= &clk_p,
 		.enable		= s5pv210_clk_ip3_ctrl,
 		.ctrlbit	= (1 << 0),
+	}, {
+		.name		= "pcm",
+		.id		= 0,
+		.parent		= &clk_pclk_psys.clk,
+		.enable		= s5pv210_clk_ip3_ctrl,
+		.ctrlbit	= (1 << 28),
+	}, {
+		.name		= "pcm",
+		.id		= 1,
+		.parent		= &clk_pclk_psys.clk,
+		.enable		= s5pv210_clk_ip3_ctrl,
+		.ctrlbit	= (1 << 29),
+	}, {
+		.name		= "pcm",
+		.id		= 2,
+		.parent		= &clk_pclk_psys.clk,
+		.enable		= s5pv210_clk_ip3_ctrl,
+		.ctrlbit	= (1 << 30),
 	},
 };
 
@@ -714,6 +749,48 @@ static struct clksrc_clk clk_sclk_audio2 = {
 	.reg_div = { .reg = S5P_CLK_DIV6, .shift = 8, .size = 4 },
 };
 
+static struct clk *clkset_mout_audss_list[] = {
+	NULL,
+	&clk_fout_epll,
+};
+
+static struct clksrc_sources clkset_mout_audss = {
+	.sources	= clkset_mout_audss_list,
+	.nr_sources	= ARRAY_SIZE(clkset_mout_audss_list),
+};
+
+static struct clksrc_clk clk_mout_audss = {
+	.clk	= {
+		.name		= "mout_audss",
+		.id		= -1,
+	},
+	.sources	= &clkset_mout_audss,
+	.reg_src	= { .reg = S5P_CLKSRC_AUDSS, .shift = 0, .size = 1 },
+};
+
+static struct clk *clkset_sclk_audss_list[] = {
+	&clk_mout_audss.clk,
+	&clk_i2scdclk0,
+	&clk_sclk_audio0.clk,
+};
+
+static struct clksrc_sources clkset_sclk_audss = {
+	.sources	= clkset_sclk_audss_list,
+	.nr_sources	= ARRAY_SIZE(clkset_sclk_audss_list),
+};
+
+static struct clksrc_clk clk_sclk_audss = {
+	.clk	= {
+		.name		= "audio-bus",
+		.id		= -1,
+		.enable		= s5pv210_clk_audss_ctrl,
+		.ctrlbit	= (1 << 6),
+	},
+	.sources	= &clkset_sclk_audss,
+	.reg_src	= { .reg = S5P_CLKSRC_AUDSS, .shift = 2, .size = 2 },
+	.reg_div	= { .reg = S5P_CLKDIV_AUDSS, .shift = 4, .size = 4 },
+};
+
 static struct clk *clkset_sclk_spdif_list[] = {
 	[0] = &clk_sclk_audio0.clk,
 	[1] = &clk_sclk_audio1.clk,
@@ -1058,6 +1135,8 @@ static struct clksrc_clk *sysclks[] = {
 	&clk_sclk_hdmi,
 	&clk_mout_dmc0,
 	&clk_sclk_dmc0,
+	&clk_mout_audss,
+	&clk_sclk_audss,
 	&clk_sclk_audio0,
 	&clk_sclk_audio1,
 	&clk_sclk_audio2,
@@ -1212,6 +1291,9 @@ void __init_or_cpufreq s5pv210_setup_clocks(void)
 
 	for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
 		s3c_set_clksrc(&clksrcs[ptr], true);
+
+	clk_set_parent(&clk_sclk_audio0.clk, &clk_pcmcdclk0);
+	clk_set_parent(&clk_sclk_audss.clk, &clk_sclk_audio0.clk);
 }
 
 static struct clk *clks[] __initdata = {
@@ -1219,6 +1301,8 @@ static struct clk *clks[] __initdata = {
 	&clk_sclk_hdmiphy,
 	&clk_sclk_usbphy0,
 	&clk_sclk_usbphy1,
+	&clk_i2scdclk0,
+	&clk_i2scdclk1,
 	&clk_pcmcdclk0,
 	&clk_pcmcdclk1,
 	&clk_pcmcdclk2,
arch/arm/mach-s5pv210/cpu.c +6 -1
index 61e6c24..4aa98ad 100644
@@ -95,7 +95,12 @@ static struct map_desc s5pv210_iodesc[] __initdata = {
 		.pfn		=__phys_to_pfn(S5PV210_PA_HSPHY),
 		.length		= SZ_4K,
 		.type		= MT_DEVICE,
-	}
+	}, {
+		.virtual	= (unsigned long)S5P_VA_AUDSS,
+		.pfn		= __phys_to_pfn(S5PV210_PA_AUDSS),
+		.length		= SZ_1K,
+		.type		= MT_DEVICE,
+	},
 };
 
 static void s5pv210_idle(void)
arch/arm/mach-s5pv210/include/mach/map.h +2 -0
index 1dd5883..195874e 100644
@@ -64,6 +64,8 @@
 #define S5PV210_PA_HSOTG		0xEC000000
 #define S5PV210_PA_HSPHY		0xEC100000
 
+#define S5PV210_PA_AUDSS		0xEEE10000
+
 #define S5PV210_PA_IIS0			0xEEE30000
 #define S5PV210_PA_IIS1			0xE2100000
 #define S5PV210_PA_IIS2			0xE2A00000
arch/arm/mach-s5pv210/include/mach/regs-audss.h new file +45 -0

45 lines not on this page · raw message

arch/arm/mach-s5pv210/mach-smdkc110.c +7 -0
index 6c412c8..05562ca 100644
@@ -81,17 +81,24 @@ static struct s3c_ide_platdata smdkc110_ide_pdata __initdata = {
 	.setup_gpio	= s5pv210_ide_setup_gpio,
 };
 
+static struct platform_device smdkc110_pcm_device = {
+	.name		= "samsung-smdk-pcm",
+	.id		= -1,
+};
+
 static struct platform_device *smdkc110_devices[] __initdata = {
 	&samsung_asoc_dma,
 	&s5pv210_device_iis0,
 	&s5pv210_device_ac97,
 	&s5pv210_device_spdif,
+	&s5pv210_device_pcm0,
 	&s3c_device_cfcon,
 	&s3c_device_i2c0,
 	&s3c_device_i2c1,
 	&s3c_device_i2c2,
 	&s3c_device_rtc,
 	&s3c_device_wdt,
+	&smdkc110_pcm_device,
 };
 
 static struct i2c_board_info smdkc110_i2c_devs0[] __initdata = {
arch/arm/mach-s5pv210/mach-smdkv210.c +7 -0
index c6a9e86..8824b6d 100644
@@ -249,6 +249,11 @@ static struct platform_device smdkv210_backlight_device = {
 	},
 };
 
+static struct platform_device smdkv210_pcm_device = {
+	.name		= "samsung-smdk-pcm",
+	.id		= -1,
+};
+
 static struct platform_device *smdkv210_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_cfcon,
@@ -266,12 +271,14 @@ static struct platform_device *smdkv210_devices[] __initdata = {
 	&s5pv210_device_ac97,
 	&s5pv210_device_iis0,
 	&s5pv210_device_spdif,
+	&s5pv210_device_pcm0,
 	&samsung_asoc_dma,
 	&samsung_device_keypad,
 	&smdkv210_dm9000,
 	&smdkv210_lcd_lte480wv,
 	&s3c_device_timer[3],
 	&smdkv210_backlight_device,
+	&smdkv210_pcm_device,
 };
 
 static void __init smdkv210_dm9000_init(void)
arch/arm/plat-s5p/include/plat/map-s5p.h +1 -0
index d973d39..daa4a44 100644
@@ -40,6 +40,7 @@
 #define S5P_VA_GIC_DIST		S5P_VA_COREPERI(0x1000)
 
 #define S3C_VA_USB_HSPHY	S3C_ADDR(0x02900000)
+#define S5P_VA_AUDSS		S3C_ADDR(0x02A00000)
 
 #define VA_VIC(x)		(S3C_VA_IRQ + ((x) * 0x10000))
 #define VA_VIC0			VA_VIC(0)
Signature · 1 line
1.7.1
#2 lore raw

RE: [PATCH 1/3] ARM: S5PV210: Add PCM audio support for WM8580

Quoted 6 lines · Sangbeom Kim

This patch add pcm audio configuration for SMDKV210 and SMDKC110. Platform device and pcm clock initialization code is added.

---

(snip)

arch/arm/mach-s5pv210/include/mach/regs-audss.h line 1

Quoted 2 lines
arch/arm/mach-s5pv210/include/mach/regs-audss.h new file +1 -0
@@ -0,0 +1,45 @@
+/* arch/arm/mach-s5pv210/include/mach/regs-clock.h

arch/arm/mach-s5pv210/include/mach/regs-audss.h ?

(snip)

arch/arm/mach-s5pv210/include/mach/regs-audss.h line 24

Quoted 3 lines
arch/arm/mach-s5pv210/include/mach/regs-audss.h new file +3 -0
+/* CLKSRC0 */
+#define S5P_AUDSS_CLKSRC_MAIN_MASK	(0x1<<0)
+#define S5P_AUDSS_CLKSRC_MAIN_SHIFT	(0)

Firstly, the blank should be added around "<<" like following.
+#define S5P_AUDSS_CLKSRC_MAIN_MASK (0x1 << 0)

Secondly, if you want to use XXX_SHIFT, please use like following.
+#define S5P_AUDSS_CLKSRC_MAIN_SHIFT (0)
+#define S5P_AUDSS_CLKSRC_MAIN_MASK (0x1 << S5P_AUDSS_CLKSRC_MAIN_SHIFT)

Finally, if the definition is not used anywhere, please don't add it.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#3 lore raw

Re: [PATCH 1/3] ARM: S5PV210: Add PCM audio support for WM8580

In reply to Sangbeom Kim

Hi,

Quoted 40 lines · Sangbeom Kim

This patch add pcm audio configuration for SMDKV210 and SMDKC110. Platform device and pcm clock initialization code is added.

---
 arch/arm/mach-s5pv210/clock.c                   |   90 ++++++++++++++++++++++- arch/arm/mach-s5pv210/cpu.c                     |    7 ++- arch/arm/mach-s5pv210/include/mach/map.h        |    2 + arch/arm/mach-s5pv210/include/mach/regs-audss.h |   45 +++++++++++ arch/arm/mach-s5pv210/mach-smdkc110.c           |    7 ++ arch/arm/mach-s5pv210/mach-smdkv210.c           |    7 ++ arch/arm/plat-s5p/include/plat/map-s5p.h        |    1 +

 7 files changed, 155 insertions(+), 4 deletions(-)

 create mode 100644 arch/arm/mach-s5pv210/include/mach/regs-audss.h

arch/arm/mach-s5pv210/clock.c +6 -0
index 2d59949..a964e1c 100644
@@ -21,6 +21,7 @@
  #include <linux/io.h>
 
  #include <mach/map.h>
+#include <mach/regs-audss.h>
 
  #include <plat/cpu-freq.h>
  #include <mach/regs-clock.h>
@@ -185,6 +186,11 @@ static int s5pv210_clk_mask1_ctrl(struct clk *clk, int enable)
        return s5p_gatectrl(S5P_CLK_SRC_MASK1, clk, enable);
  }
 
+static int s5pv210_clk_audss_ctrl(struct clk *clk, int enable)
+{
+       return s5p_gatectrl(S5P_CLKGATE_AUDSS, clk, enable);
+}
+
  static struct clk clk_sclk_hdmi27m = {
        .name           = "sclk_hdmi27m",
        .id             = -1,

arch/arm/mach-s5pv210/clock.c static struct clk clk_sclk_usbphy1 = { · line 218

Quoted 6 lines
arch/arm/mach-s5pv210/clock.c +2 -1
@@ -208,17 +214,28 @@ static struct clk clk_sclk_usbphy1 = {
 
  static struct clk clk_pcmcdclk0 = {
        .name           = "pcmcdclk",
-       .id             = -1,
+       .id             = 0,
+       .rate           = 2048000,

I think that this fixed rate setting is not good, because this clock.c is not only for SMDK board, but for all S5PV210 based machines.

Quoted 86 lines
arch/arm/mach-s5pv210/clock.c +62 -2
  };
 
  static struct clk clk_pcmcdclk1 = {
        .name           = "pcmcdclk",
-       .id             = -1,
+       .id             = 1,
  };
 
  static struct clk clk_pcmcdclk2 = {
        .name           = "pcmcdclk",
-       .id             = -1,
+       .id             = 2,
+};
+
+static struct clk clk_i2scdclk0 = {
+       .name           = "i2scdclk",
+       .id             = 0,
+};
+
+static struct clk clk_i2scdclk1 = {
+       .name           = "i2scdclk",
+       .id             = 1,
  };
 
  static struct clk *clkset_vpllsrc_list[] = {
@@ -490,6 +507,24 @@ static struct clk init_clocks_off[] = {
                .parent         = &clk_p,
                .enable         = s5pv210_clk_ip3_ctrl,
                .ctrlbit        = (1 << 0),
+       }, {
+               .name           = "pcm",
+               .id             = 0,
+               .parent         = &clk_pclk_psys.clk,
+               .enable         = s5pv210_clk_ip3_ctrl,
+               .ctrlbit        = (1 << 28),
+       }, {
+               .name           = "pcm",
+               .id             = 1,
+               .parent         = &clk_pclk_psys.clk,
+               .enable         = s5pv210_clk_ip3_ctrl,
+               .ctrlbit        = (1 << 29),
+       }, {
+               .name           = "pcm",
+               .id             = 2,
+               .parent         = &clk_pclk_psys.clk,
+               .enable         = s5pv210_clk_ip3_ctrl,
+               .ctrlbit        = (1 << 30),
        },
  };
 
@@ -714,6 +749,48 @@ static struct clksrc_clk clk_sclk_audio2 = {
        .reg_div = { .reg = S5P_CLK_DIV6, .shift = 8, .size = 4 },
  };
 
+static struct clk *clkset_mout_audss_list[] = {
+       NULL,
+       &clk_fout_epll,
+};
+
+static struct clksrc_sources clkset_mout_audss = {
+       .sources        = clkset_mout_audss_list,
+       .nr_sources     = ARRAY_SIZE(clkset_mout_audss_list),
+};
+
+static struct clksrc_clk clk_mout_audss = {
+       .clk    = {
+               .name           = "mout_audss",
+               .id             = -1,
+       },
+       .sources        = &clkset_mout_audss,
+       .reg_src        = { .reg = S5P_CLKSRC_AUDSS, .shift = 0, .size = 1 },
+};
+
+static struct clk *clkset_sclk_audss_list[] = {
+       &clk_mout_audss.clk,
+       &clk_i2scdclk0,
+       &clk_sclk_audio0.clk,
+};
+
+static struct clksrc_sources clkset_sclk_audss = {
+       .sources        = clkset_sclk_audss_list,
+       .nr_sources     = ARRAY_SIZE(clkset_sclk_audss_list),
+};
+
+static struct clksrc_clk clk_sclk_audss = {
+       .clk    = {

arch/arm/mach-s5pv210/clock.c static struct clksrc_clk clk_sclk_audio2 = { · line 793

Quoted 10 lines
arch/arm/mach-s5pv210/clock.c +10 -0
+               .name           = "audio-bus",
+               .id             = -1,
+               .enable         = s5pv210_clk_audss_ctrl,
+               .ctrlbit        = (1 << 6),
+       },
+       .sources        = &clkset_sclk_audss,
+       .reg_src        = { .reg = S5P_CLKSRC_AUDSS, .shift = 2, .size = 2 },
+       .reg_div        = { .reg = S5P_CLKDIV_AUDSS, .shift = 4, .size = 4 },
+};
+

These clock sources are not just for pcm clock, these are for audio subsystem. So I think that should be separated to another patch for add audio subsystem on s5pv210.

arch/arm/mach-s5pv210/clock.c static struct clksrc_clk *sysclks[] = { · line 1139

Quoted 9 lines
arch/arm/mach-s5pv210/clock.c +2 -0
  static struct clk *clkset_sclk_spdif_list[] = {
        [0] = &clk_sclk_audio0.clk,
        [1] = &clk_sclk_audio1.clk,
@@ -1058,6 +1135,8 @@ static struct clksrc_clk *sysclks[] = {
        &clk_sclk_hdmi,
        &clk_mout_dmc0,
        &clk_sclk_dmc0,
+       &clk_mout_audss,
+       &clk_sclk_audss,

ditto

arch/arm/mach-s5pv210/clock.c void __init_or_cpufreq s5pv210_setup_clocks(void) · line 1296

Quoted 10 lines
arch/arm/mach-s5pv210/clock.c +3 -0
        &clk_sclk_audio0,
        &clk_sclk_audio1,
        &clk_sclk_audio2,
@@ -1212,6 +1291,9 @@ void __init_or_cpufreq s5pv210_setup_clocks(void)
 
        for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
                s3c_set_clksrc(&clksrcs[ptr], true);
+
+       clk_set_parent(&clk_sclk_audio0.clk, &clk_pcmcdclk0);
+       clk_set_parent(&clk_sclk_audss.clk, &clk_sclk_audio0.clk);

ditto

arch/arm/mach-s5pv210/clock.c static struct clk *clks[] __initdata = { · line 1305

Quoted 9 lines
arch/arm/mach-s5pv210/clock.c +2 -0
  }
 
  static struct clk *clks[] __initdata = {
@@ -1219,6 +1301,8 @@ static struct clk *clks[] __initdata = {
        &clk_sclk_hdmiphy,
        &clk_sclk_usbphy0,
        &clk_sclk_usbphy1,
+       &clk_i2scdclk0,
+       &clk_i2scdclk1,

ditto

Quoted 8 lines
arch/arm/mach-s5pv210/clock.c +0 -0
        &clk_pcmcdclk0,
        &clk_pcmcdclk1,
        &clk_pcmcdclk2,
arch/arm/mach-s5pv210/cpu.c +0 -0
index 61e6c24..4aa98ad 100644

arch/arm/mach-s5pv210/cpu.c static struct map_desc s5pv210_iodesc[] __initdata = { · line 103

Quoted 10 lines
arch/arm/mach-s5pv210/cpu.c +6 -1
@@ -95,7 +95,12 @@ static struct map_desc s5pv210_iodesc[] __initdata = {
                .pfn            =__phys_to_pfn(S5PV210_PA_HSPHY),
                .length         = SZ_4K,
                .type           = MT_DEVICE,
-       }
+       }, {
+               .virtual        = (unsigned long)S5P_VA_AUDSS,
+               .pfn            = __phys_to_pfn(S5PV210_PA_AUDSS),
+               .length         = SZ_1K,
+               .type           = MT_DEVICE,
+       },

ditto

arch/arm/mach-s5pv210/include/mach/map.h line 68

Quoted 13 lines
arch/arm/mach-s5pv210/cpu.c +0 -0
  };
 
  static void s5pv210_idle(void)
arch/arm/mach-s5pv210/include/mach/map.h +2 -0
index 1dd5883..195874e 100644
@@ -64,6 +64,8 @@
  #define S5PV210_PA_HSOTG               0xEC000000
  #define S5PV210_PA_HSPHY               0xEC100000
 
+#define S5PV210_PA_AUDSS               0xEEE10000
+

ditto

arch/arm/mach-s5pv210/include/mach/regs-audss.h

Quoted 8 lines
arch/arm/mach-s5pv210/include/mach/map.h +0 -0
  #define S5PV210_PA_IIS0                        0xEEE30000
  #define S5PV210_PA_IIS1                        0xE2100000
  #define S5PV210_PA_IIS2                        0xE2A00000
arch/arm/mach-s5pv210/include/mach/regs-audss.h new file +0 -0
new file mode 100644
index 0000000..2fa3c23

ditto

Quoted 36 lines
arch/arm/mach-s5pv210/include/mach/regs-audss.h new file +35 -0
@@ -0,0 +1,45 @@
+/* arch/arm/mach-s5pv210/include/mach/regs-clock.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com/
+ *
+ * S5PV210 - Audio SubSystem clock register definitions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_ARCH_REGS_AUDSS_H
+#define __ASM_ARCH_REGS_AUDSS_H __FILE__
+
+#define S5P_AUDSSREG(x)                        (S5P_VA_AUDSS + (x))
+
+#define S5P_CLKSRC_AUDSS               S5P_AUDSSREG(0x0)
+#define S5P_CLKDIV_AUDSS               S5P_AUDSSREG(0x4)
+#define S5P_CLKGATE_AUDSS              S5P_AUDSSREG(0x8)
+
+/* CLKSRC0 */
+#define S5P_AUDSS_CLKSRC_MAIN_MASK     (0x1<<0)
+#define S5P_AUDSS_CLKSRC_MAIN_SHIFT    (0)
+#define S5P_AUDSS_CLKSRC_BUSCLK_MASK   (0x1<<1)
+#define S5P_AUDSS_CLKSRC_BUSCLK_SHIFT  (1)
+#define S5P_AUDSS_CLKSRC_I2SCLK_MASK   (0x3<<2)
+#define S5P_AUDSS_CLKSRC_I2SCLK_SHIFT  (2)
+
+/* CLKDIV0 */
+#define S5P_AUDSS_CLKDIV_BUSCLK_MASK   (0xf<<0)
+#define S5P_AUDSS_CLKDIV_BUSCLK_SHIFT  (0)
+#define S5P_AUDSS_CLKDIV_I2SCLK_MASK   (0xf<<4)
+#define S5P_AUDSS_CLKDIV_I2SCLK_SHIFT  (4)
+

arch/arm/mach-s5pv210/include/mach/regs-audss.h line 45

Quoted 10 lines
arch/arm/mach-s5pv210/include/mach/regs-audss.h new file +10 -0
+/* IP Clock Gate 0 Registers */
+#define S5P_AUDSS_CLKGATE_HCLKRP       (1<<0)
+#define S5P_AUDSS_CLKGATE_HCLKBUF      (1<<1)
+#define S5P_AUDSS_CLKGATE_HCLKDMA      (1<<2)
+#define S5P_AUDSS_CLKGATE_HCLKHWA      (1<<3)
+#define S5P_AUDSS_CLKGATE_HCLKUART     (1<<4)
+#define S5P_AUDSS_CLKGATE_HCLKI2S      (1<<5)
+#define S5P_AUDSS_CLKGATE_CLKI2S       (1<<6)
+
+#endif /* __ASM_ARCH_REGS_AUDSS_H */

...(snip)...

arch/arm/plat-s5p/include/plat/map-s5p.h line 43

Quoted 9 lines
arch/arm/plat-s5p/include/plat/map-s5p.h +1 -0
index d973d39..daa4a44 100644
@@ -40,6 +40,7 @@
  #define S5P_VA_GIC_DIST                S5P_VA_COREPERI(0x1000)
 
  #define S3C_VA_USB_HSPHY       S3C_ADDR(0x02900000)
+#define S5P_VA_AUDSS           S3C_ADDR(0x02A00000)

ditto

claude
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw

PATCH v2 3/3 ASoC: SAMSUNG: Add WM8580 PCM Machine driver

In reply to Sangbeom Kim

This patch add WM8580 PCM machine driver to support PCM audio on SMDKC110, SMDKV210, SMDK6450, SMDK6440 boards. Playback and Capture supports 8kHz sampling rates. and It is tested on SMDKC110, SMDKV210, SMDK6450

---
 sound/soc/samsung/Kconfig          |    8 ++
 sound/soc/samsung/Makefile         |    2 +
 sound/soc/samsung/smdk_wm8580pcm.c |  206 ++++++++++++++++++++++++++++++++++++
 3 files changed, 216 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/samsung/smdk_wm8580pcm.c
sound/soc/samsung/Kconfig +8 -0
index a3fdfb6..b8c7a2e 100644
@@ -162,3 +162,11 @@ config SND_SOC_SAMSUNG_SMDK_SPDIF
 	select SND_SAMSUNG_SPDIF
 	help
 	  Say Y if you want to add support for SoC S/PDIF audio on the SMDK.
+
+config SND_SOC_SMDK_WM8580_PCM
+	tristate "SoC PCM Audio support for WM8580 on SMDK"
+	depends on SND_SOC_SAMSUNG && (MACH_SMDK6450 || MACH_SMDKV210 || MACH_SMDKC110)
+	select SND_SOC_WM8580
+	select SND_SAMSUNG_PCM
+	help
+	  Say Y if you want to add support for SoC audio on the SMDK.
sound/soc/samsung/Makefile +2 -0
index 294dec0..6c598fc 100644
@@ -34,6 +34,7 @@ snd-soc-smdk-wm9713-objs := smdk_wm9713.o
 snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o
 snd-soc-goni-wm8994-objs := goni_wm8994.o
 snd-soc-smdk-spdif-objs := smdk_spdif.o
+snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o
 
 obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o
 obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
@@ -51,3 +52,4 @@ obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM9713) += snd-soc-smdk-wm9713.o
 obj-$(CONFIG_SND_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o
 obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o
 obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o
+obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o
sound/soc/samsung/smdk_wm8580pcm.c new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
1.7.1
Acked-by on v2 3/3
#5 lore raw

Re: [PATCH 3/3] ASoC: SAMSUNG: Add WM8580 PCM Machine driver

Quoted 6 lines · Sangbeom Kim

This patch add WM8580 PCM machine driver to support PCM audio on SMDKC110, SMDKV210, SMDK6450, SMDK6440 boards. Playback and Capture supports 8kHz sampling rates. and It is tested on SMDKC110, SMDKV210, SMDK6450

Acked-by
#6 lore raw

Re: [alsa-devel] [PATCH 3/3] ASoC: SAMSUNG: Add WM8580 PCM Machine driver

Quoted 9 lines · Jassi Brar
Quoted 6 lines · Sangbeom Kim

This patch add WM8580 PCM machine driver to support PCM audio on SMDKC110, SMDKV210, SMDK6450, SMDK6440 boards. Playback and Capture supports 8kHz sampling rates. and It is tested on SMDKC110, SMDKV210, SMDK6450

Applied
#7 lore raw

Re: [PATCH 3/3] ASoC: SAMSUNG: Add WM8580 PCM Machine driver

In reply to Sangbeom Kim
Quoted 6 lines · Sangbeom Kim

This patch add WM8580 PCM machine driver to support PCM audio on SMDKC110, SMDKV210, SMDK6450, SMDK6440 boards. Playback and Capture supports 8kHz sampling rates. and It is tested on SMDKC110, SMDKV210, SMDK6450

Applied, thanks.

#8 lore raw

PATCH v2 3/3 ARM: S5P64X0: Add PCM audio support for WM8580

In reply to Sangbeom Kim

This patch add pcm audio configuration for SMDK6450 and SMDK6440. Platform device and pcm clock initialization code is added.

---
 arch/arm/mach-s5p64x0/clock-s5p6440.c              |   63 +++++++++++---------
 arch/arm/mach-s5p64x0/clock-s5p6450.c              |   27 +++++++--
 arch/arm/mach-s5p64x0/clock.c                      |   11 ++++
 arch/arm/mach-s5p64x0/dev-audio.c                  |   56 ++++++++++++++++-
 arch/arm/mach-s5p64x0/include/mach/regs-clock.h    |    3 +
 arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h |    4 +
 arch/arm/mach-s5p64x0/mach-smdk6440.c              |    7 ++
 arch/arm/mach-s5p64x0/mach-smdk6450.c              |    7 ++
 8 files changed, 141 insertions(+), 37 deletions(-)
arch/arm/mach-s5p64x0/clock-s5p6440.c +34 -29
index 9f12c2e..99405f4 100644
@@ -372,14 +372,12 @@ static struct clk init_clocks[] = {
 	},
 };
 
-static struct clk clk_iis_cd_v40 = {
-	.name		= "iis_cdclk_v40",
-	.id		= -1,
-};
-
-static struct clk clk_pcm_cd = {
-	.name		= "pcm_cdclk",
-	.id		= -1,
+static struct clksrc_clk clk_dout_epll = {
+	.clk	= {
+		.name	= "dout_epll",
+		.id	= -1,
+		.parent = &clk_mout_epll.clk,
+	},
 };
 
 static struct clk *clkset_group1_list[] = {
@@ -403,17 +401,30 @@ static struct clksrc_sources clkset_uart = {
 	.nr_sources	= ARRAY_SIZE(clkset_uart_list),
 };
 
-static struct clk *clkset_audio_list[] = {
-	&clk_mout_epll.clk,
-	&clk_dout_mpll.clk,
-	&clk_fin_epll,
-	&clk_iis_cd_v40,
-	&clk_pcm_cd,
+static struct clk *clkset_sclk_audio_list[] = {
+	[0] = &clk_dout_epll.clk,
+	[1] = &clk_dout_mpll.clk,
+	[2] = &clk_ext,
+	[3] = &clk_i2s_v40_cdclk,
+	[4] = &clk_pcmcdclk0,
+};
+
+static struct clksrc_sources clkset_sclk_audio = {
+	.sources	= clkset_sclk_audio_list,
+	.nr_sources	= ARRAY_SIZE(clkset_sclk_audio_list),
 };
 
-static struct clksrc_sources clkset_audio = {
-	.sources	= clkset_audio_list,
-	.nr_sources	= ARRAY_SIZE(clkset_audio_list),
+struct clksrc_clk clk_sclk_audio = {
+	.clk		= {
+		.name		= "audio-bus",
+		.id		= -1,
+		.enable		= s5p64x0_sclk_ctrl,
+		.ctrlbit	= (1 << 11),
+		.parent		= &clk_ext_xtal_mux,
+	},
+	.sources	= &clkset_sclk_audio,
+	.reg_src	= { .reg = S5P64X0_CLK_SRC1, .shift = 0, .size = 3 },
+	.reg_div	= { .reg = S5P64X0_CLK_DIV2, .shift = 24, .size = 4 },
 };
 
 static struct clksrc_clk clksrcs[] = {
@@ -507,16 +518,6 @@ static struct clksrc_clk clksrcs[] = {
 		.sources = &clkset_group1,
 		.reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 8, .size = 2 },
 		.reg_div = { .reg = S5P64X0_CLK_DIV3, .shift = 4, .size = 4 },
-	}, {
-		.clk	= {
-			.name		= "sclk_audio2",
-			.id		= -1,
-			.ctrlbit	= (1 << 11),
-			.enable		= s5p64x0_sclk_ctrl,
-		},
-		.sources = &clkset_audio,
-		.reg_src = { .reg = S5P64X0_CLK_SRC1, .shift = 0, .size = 3 },
-		.reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 24, .size = 4 },
 	},
 };
 
@@ -526,11 +527,13 @@ static struct clksrc_clk *sysclks[] = {
 	&clk_mout_epll,
 	&clk_mout_mpll,
 	&clk_dout_mpll,
+	&clk_dout_epll,
 	&clk_armclk,
 	&clk_hclk,
 	&clk_pclk,
 	&clk_hclk_low,
 	&clk_pclk_low,
+	&clk_sclk_audio,
 };
 
 void __init_or_cpufreq s5p6440_setup_clocks(void)
@@ -590,14 +593,16 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
 	clk_h.rate = hclk;
 	clk_p.rate = pclk;
 
+	clk_set_parent(&clk_sclk_audio.clk, &clk_pcmcdclk0);
+
 	for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
 		s3c_set_clksrc(&clksrcs[ptr], true);
 }
 
 static struct clk *clks[] __initdata = {
 	&clk_ext,
-	&clk_iis_cd_v40,
-	&clk_pcm_cd,
+	&clk_i2s_v40_cdclk,
+	&clk_pcmcdclk0,
 };
 
 void __init s5p6440_register_clocks(void)
arch/arm/mach-s5p64x0/clock-s5p6450.c +22 -5
index 4eec457..e4db264 100644
@@ -290,7 +290,14 @@ static struct clk init_clocks_off[] = {
 		.parent		= &clk_pclk.clk,
 		.enable		= s5p64x0_pclk_ctrl,
 		.ctrlbit	= (1 << 30),
-	}
+	}, {
+		.name		= "pcm",
+		.id		= 0,
+		.parent		= &clk_pclk_low.clk,
+		.enable		= s5p64x0_pclk_ctrl,
+		.ctrlbit	= S5P_CLKCON_PCLK_PCM0,
+	},
+
 };
 
 /*
@@ -408,9 +415,9 @@ static struct clksrc_sources clkset_hsmmc44 = {
 static struct clk *clkset_sclk_audio0_list[] = {
 	[0] = &clk_dout_epll.clk,
 	[1] = &clk_dout_mpll.clk,
-	[2] = &clk_ext_xtal_mux,
-	[3] = NULL,
-	[4] = NULL,
+	[2] = &clk_ext,
+	[3] = &clk_i2s_v40_cdclk,
+	[4] = &clk_pcmcdclk0,
 };
 
 static struct clksrc_sources clkset_sclk_audio0 = {
@@ -418,7 +425,7 @@ static struct clksrc_sources clkset_sclk_audio0 = {
 	.nr_sources	= ARRAY_SIZE(clkset_sclk_audio0_list),
 };
 
-static struct clksrc_clk clk_sclk_audio0 = {
+struct clksrc_clk clk_sclk_audio0 = {
 	.clk		= {
 		.name		= "audio-bus",
 		.id		= -1,
@@ -647,12 +654,22 @@ void __init_or_cpufreq s5p6450_setup_clocks(void)
 
 	for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
 		s3c_set_clksrc(&clksrcs[ptr], true);
+
+	clk_set_parent(&clk_sclk_audio0.clk, &clk_pcmcdclk0);
 }
 
+static struct clk *clks[] __initdata = {
+	&clk_ext,
+	&clk_i2s_v40_cdclk,
+	&clk_pcmcdclk0,
+};
+
 void __init s5p6450_register_clocks(void)
 {
 	int ptr;
 
+	s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
+
 	for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
 		s3c_register_clksrc(sysclks[ptr], 1);
 
arch/arm/mach-s5p64x0/clock.c +11 -0
index b52c6e2..432bb06 100644
@@ -233,3 +233,14 @@ int s5p64x0_clk48m_ctrl(struct clk *clk, int enable)
 
 	return 0;
 }
+
+struct clk clk_pcmcdclk0 = {
+	.name		= "pcmcdclk",
+	.id		= 0,
+	.rate		= 4096000,
+};
+
+struct clk clk_i2s_v40_cdclk = {
+	.name		= "i2s_v40_cdclk",
+	.id		= 0,
+};
arch/arm/mach-s5p64x0/dev-audio.c +53 -3

69 lines not on this page · raw message

arch/arm/mach-s5p64x0/include/mach/regs-clock.h +3 -0
index a133f22..323c97c 100644
@@ -62,4 +62,7 @@
 
 #define S5P_EPLL_CON			S5P64X0_EPLL_CON
 
+#define S5P_CLKCON_SCLK0_AUDIO0	(1<<8)
+#define S5P_CLKCON_PCLK_PCM0		(1<<8)
+
 #endif /* __ASM_ARCH_REGS_CLOCK_H */
arch/arm/mach-s5p64x0/include/mach/s5p64x0-clock.h +4 -0
index ff85b4b..88a8065 100644
@@ -34,6 +34,10 @@ extern struct clksrc_clk clk_dout_mpll;
 extern struct clk *clkset_hclk_low_list[];
 extern struct clksrc_sources clkset_hclk_low;
 
+extern struct clksrc_clk clk_sclk_audio0;
+extern struct clk clk_pcmcdclk0;
+extern struct clk clk_i2s_v40_cdclk;
+
 extern int s5p64x0_pclk_ctrl(struct clk *clk, int enable);
 extern int s5p64x0_hclk0_ctrl(struct clk *clk, int enable);
 extern int s5p64x0_hclk1_ctrl(struct clk *clk, int enable);
arch/arm/mach-s5p64x0/mach-smdk6440.c +7 -0
index 2d559f1..0fa500e 100644
@@ -130,6 +130,11 @@ static struct platform_device smdk6440_backlight_device = {
 	},
 };
 
+static struct platform_device smdk6440_pcm_device = {
+	.name		= "samsung-smdk-pcm",
+	.id		= -1,
+};
+
 static struct platform_device *smdk6440_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_rtc,
@@ -139,8 +144,10 @@ static struct platform_device *smdk6440_devices[] __initdata = {
 	&s3c_device_wdt,
 	&samsung_asoc_dma,
 	&s5p6440_device_iis,
+	&s5p6440_device_pcm,
 	&s3c_device_timer[1],
 	&smdk6440_backlight_device,
+	&smdk6440_pcm_device,
 };
 
 static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
arch/arm/mach-s5p64x0/mach-smdk6450.c +7 -0
index d19c469..69de257 100644
@@ -148,6 +148,11 @@ static struct platform_device smdk6450_backlight_device = {
 	},
 };
 
+static struct platform_device smdk6450_pcm_device = {
+	.name		= "samsung-smdk-pcm",
+	.id		= -1,
+};
+
 static struct platform_device *smdk6450_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_rtc,
@@ -157,8 +162,10 @@ static struct platform_device *smdk6450_devices[] __initdata = {
 	&s3c_device_wdt,
 	&samsung_asoc_dma,
 	&s5p6450_device_iis0,
+	&s5p6450_device_pcm0,
 	&s3c_device_timer[1],
 	&smdk6450_backlight_device,
+	&smdk6450_pcm_device,
 	/* s5p6450_device_spi0 will be added */
 };
 
Signature · 1 line
1.7.1