Index: linux-2.6.24/sound/soc/s3c24xx/s3c2443-ac97.c
===================================================================
--- linux-2.6.24.orig/sound/soc/s3c24xx/s3c2443-ac97.c	2008-02-15 18:24:08.000000000 +0100
+++ linux-2.6.24/sound/soc/s3c24xx/s3c2443-ac97.c	2008-02-15 18:26:02.000000000 +0100
@@ -52,7 +52,7 @@
 static u32 codec_ready;
 static DECLARE_MUTEX(ac97_mutex);
 
-static unsigned short s3c2443_ac97_read(struct snd_ac97 *ac97,
+static unsigned short s3c244x_ac97_read(struct snd_ac97 *ac97,
 	unsigned short reg)
 {
 	u32 ac_glbctrl;
@@ -87,7 +87,7 @@
 	return (unsigned short)data;
 }
 
-static void s3c2443_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
+static void s3c244x_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
 	unsigned short val)
 {
 	u32 ac_glbctrl;
@@ -116,7 +116,7 @@
 
 }
 
-static void s3c2443_ac97_warm_reset(struct snd_ac97 *ac97)
+static void s3c244x_ac97_warm_reset(struct snd_ac97 *ac97)
 {
 	u32 ac_glbctrl;
 
@@ -130,7 +130,7 @@
 	msleep(1);
 }
 
-static void s3c2443_ac97_cold_reset(struct snd_ac97 *ac97)
+static void s3c244x_ac97_cold_reset(struct snd_ac97 *ac97)
 {
 	u32 ac_glbctrl;
 
@@ -157,7 +157,7 @@
 	writel(ac_glbctrl, s3c24xx_ac97.regs + S3C_AC97_GLBCTRL);
 }
 
-static irqreturn_t s3c2443_ac97_irq(int irq, void *dev_id)
+static irqreturn_t s3c244x_ac97_irq(int irq, void *dev_id)
 {
 	int status;
 	u32 ac_glbctrl;
@@ -174,46 +174,46 @@
 }
 
 struct snd_ac97_bus_ops soc_ac97_ops = {
-	.read	= s3c2443_ac97_read,
-	.write	= s3c2443_ac97_write,
-	.warm_reset	= s3c2443_ac97_warm_reset,
-	.reset	= s3c2443_ac97_cold_reset,
+	.read	= s3c244x_ac97_read,
+	.write	= s3c244x_ac97_write,
+	.warm_reset	= s3c244x_ac97_warm_reset,
+	.reset	= s3c244x_ac97_cold_reset,
 };
 
-static struct s3c2410_dma_client s3c2443_dma_client_out = {
+static struct s3c2410_dma_client s3c244x_dma_client_out = {
 	.name = "AC97 PCM Stereo out"
 };
 
-static struct s3c2410_dma_client s3c2443_dma_client_in = {
+static struct s3c2410_dma_client s3c244x_dma_client_in = {
 	.name = "AC97 PCM Stereo in"
 };
 
-static struct s3c2410_dma_client s3c2443_dma_client_micin = {
+static struct s3c2410_dma_client s3c244x_dma_client_micin = {
 	.name = "AC97 Mic Mono in"
 };
 
-static struct s3c24xx_pcm_dma_params s3c2443_ac97_pcm_stereo_out = {
-	.client		= &s3c2443_dma_client_out,
+static struct s3c24xx_pcm_dma_params s3c244x_ac97_pcm_stereo_out = {
+	.client		= &s3c244x_dma_client_out,
 	.channel	= DMACH_PCM_OUT,
 	.dma_addr	= S3C2440_PA_AC97 + S3C_AC97_PCM_DATA,
 	.dma_size	= 4,
 };
 
-static struct s3c24xx_pcm_dma_params s3c2443_ac97_pcm_stereo_in = {
-	.client		= &s3c2443_dma_client_in,
+static struct s3c24xx_pcm_dma_params s3c244x_ac97_pcm_stereo_in = {
+	.client		= &s3c244x_dma_client_in,
 	.channel	= DMACH_PCM_IN,
 	.dma_addr	= S3C2440_PA_AC97 + S3C_AC97_PCM_DATA,
 	.dma_size	= 4,
 };
 
-static struct s3c24xx_pcm_dma_params s3c2443_ac97_mic_mono_in = {
-	.client		= &s3c2443_dma_client_micin,
+static struct s3c24xx_pcm_dma_params s3c244x_ac97_mic_mono_in = {
+	.client		= &s3c244x_dma_client_micin,
 	.channel	= DMACH_MIC_IN,
 	.dma_addr	= S3C2440_PA_AC97 + S3C_AC97_MIC_DATA,
 	.dma_size	= 4,
 };
 
-static int s3c2443_ac97_probe(struct platform_device *pdev)
+static int s3c244x_ac97_probe(struct platform_device *pdev, int is_2443)
 {
 	int ret;
 	u32 ac_glbctrl;
@@ -224,17 +224,25 @@
 
 	s3c24xx_ac97.ac97_clk = clk_get(&pdev->dev, "ac97");
 	if (s3c24xx_ac97.ac97_clk == NULL) {
-		printk(KERN_ERR "s3c2443-ac97 failed to get ac97_clock\n");
+		printk(KERN_ERR "s3c24xx-ac97 failed to get ac97_clock\n");
 		iounmap(s3c24xx_ac97.regs);
 		return -ENODEV;
 	}
 	clk_enable(s3c24xx_ac97.ac97_clk);
 
-	s3c2410_gpio_cfgpin(S3C2410_GPE0, S3C2443_GPE0_AC_nRESET);
-	s3c2410_gpio_cfgpin(S3C2410_GPE1, S3C2443_GPE1_AC_SYNC);
-	s3c2410_gpio_cfgpin(S3C2410_GPE2, S3C2443_GPE2_AC_BITCLK);
-	s3c2410_gpio_cfgpin(S3C2410_GPE3, S3C2443_GPE3_AC_SDI);
-	s3c2410_gpio_cfgpin(S3C2410_GPE4, S3C2443_GPE4_AC_SDO);
+	if (is_2443) {
+		s3c2410_gpio_cfgpin(S3C2410_GPE0, S3C2443_GPE0_AC_nRESET);
+		s3c2410_gpio_cfgpin(S3C2410_GPE1, S3C2443_GPE1_AC_SYNC);
+		s3c2410_gpio_cfgpin(S3C2410_GPE2, S3C2443_GPE2_AC_BITCLK);
+		s3c2410_gpio_cfgpin(S3C2410_GPE3, S3C2443_GPE3_AC_SDI);
+		s3c2410_gpio_cfgpin(S3C2410_GPE4, S3C2443_GPE4_AC_SDO);
+	} else {
+		s3c2410_gpio_cfgpin(S3C2410_GPE2, S3C2440_GPE2_ACRESET);
+		s3c2410_gpio_cfgpin(S3C2410_GPE0, S3C2440_GPE0_ACSYNC);
+		s3c2410_gpio_cfgpin(S3C2410_GPE1, S3C2440_GPE1_ACBITCLK);
+		s3c2410_gpio_cfgpin(S3C2410_GPE3, S3C2440_GPE3_ACIN);
+		s3c2410_gpio_cfgpin(S3C2410_GPE4, S3C2440_GPE4_ACOUT);
+	}
 
 	ac_glbctrl = readl(s3c24xx_ac97.regs + S3C_AC97_GLBCTRL);
 	ac_glbctrl = S3C_AC97_GLBCTRL_COLDRESET;
@@ -253,8 +261,13 @@
 	ac_glbctrl |= S3C_AC97_GLBCTRL_TRANSFERDATAENABLE;
 	writel(ac_glbctrl, s3c24xx_ac97.regs + S3C_AC97_GLBCTRL);
 
-	ret = request_irq(IRQ_S3C2443_AC97, s3c2443_ac97_irq,
-		IRQF_DISABLED, "AC97", NULL);
+	if (is_2443) {
+		ret = request_irq(IRQ_S3C2443_AC97, s3c244x_ac97_irq,
+			IRQF_DISABLED, "AC97", NULL);
+	} else {
+		ret = request_irq(IRQ_S3C2440_AC97, s3c244x_ac97_irq,
+			IRQF_DISABLED, "AC97", NULL);
+	}
 	if (ret < 0) {
 		printk(KERN_ERR "s3c24xx-ac97: interrupt request failed.\n");
 		clk_disable(s3c24xx_ac97.ac97_clk);
@@ -264,29 +277,39 @@
 	return ret;
 }
 
-static void s3c2443_ac97_remove(struct platform_device *pdev)
+static int s3c2440_ac97_probe(struct platform_device *pdev)
+{
+	return s3c244x_ac97_probe(pdev, 0);
+}
+
+static int s3c2443_ac97_probe(struct platform_device *pdev)
+{
+	return s3c244x_ac97_probe(pdev, 1);
+}
+
+static void s3c244x_ac97_remove(struct platform_device *pdev)
 {
-	free_irq(IRQ_S3C2443_AC97, NULL);
+	free_irq(IRQ_S3C2440_AC97, NULL);
 	clk_disable(s3c24xx_ac97.ac97_clk);
 	clk_put(s3c24xx_ac97.ac97_clk);
 	iounmap(s3c24xx_ac97.regs);
 }
 
-static int s3c2443_ac97_hw_params(struct snd_pcm_substream *substream,
+static int s3c244x_ac97_hw_params(struct snd_pcm_substream *substream,
 				struct snd_pcm_hw_params *params)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		cpu_dai->dma_data = &s3c2443_ac97_pcm_stereo_out;
+		cpu_dai->dma_data = &s3c244x_ac97_pcm_stereo_out;
 	else
-		cpu_dai->dma_data = &s3c2443_ac97_pcm_stereo_in;
+		cpu_dai->dma_data = &s3c244x_ac97_pcm_stereo_in;
 
 	return 0;
 }
 
-static int s3c2443_ac97_trigger(struct snd_pcm_substream *substream, int cmd)
+static int s3c244x_ac97_trigger(struct snd_pcm_substream *substream, int cmd)
 {
 	u32 ac_glbctrl;
 
@@ -314,7 +337,7 @@
 	return 0;
 }
 
-static int s3c2443_ac97_hw_mic_params(struct snd_pcm_substream *substream,
+static int s3c244x_ac97_hw_mic_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -323,12 +346,12 @@
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
 		return -ENODEV;
 	else
-		cpu_dai->dma_data = &s3c2443_ac97_mic_mono_in;
+		cpu_dai->dma_data = &s3c244x_ac97_mic_mono_in;
 
 	return 0;
 }
 
-static int s3c2443_ac97_mic_trigger(struct snd_pcm_substream *substream,
+static int s3c244x_ac97_mic_trigger(struct snd_pcm_substream *substream,
 	int cmd)
 {
 	u32 ac_glbctrl;
@@ -350,32 +373,57 @@
 	return 0;
 }
 
-#define s3c2443_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
+#define s3c244X_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
 		SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | \
 		SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
 
+struct snd_soc_cpu_dai s3c2440_ac97_dai[] = {
+{
+	.name = "s3c2440-ac97",
+	.id = 0,
+	.type = SND_SOC_DAI_AC97,
+	.probe = s3c2440_ac97_probe,
+	.remove = s3c244x_ac97_remove,
+	.playback = {
+		.stream_name = "AC97 Playback",
+		.channels_min = 2,
+		.channels_max = 2,
+		.rates = s3c244X_AC97_RATES,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,},
+	.capture = {
+		.stream_name = "AC97 Capture",
+		.channels_min = 2,
+		.channels_max = 2,
+		.rates = s3c244X_AC97_RATES,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,},
+	.ops = {
+		.hw_params = s3c244x_ac97_hw_params,
+		.trigger = s3c244x_ac97_trigger},
+},
+};
+
 struct snd_soc_cpu_dai s3c2443_ac97_dai[] = {
 {
 	.name = "s3c2443-ac97",
 	.id = 0,
 	.type = SND_SOC_DAI_AC97,
 	.probe = s3c2443_ac97_probe,
-	.remove = s3c2443_ac97_remove,
+	.remove = s3c244x_ac97_remove,
 	.playback = {
 		.stream_name = "AC97 Playback",
 		.channels_min = 2,
 		.channels_max = 2,
-		.rates = s3c2443_AC97_RATES,
+		.rates = s3c244X_AC97_RATES,
 		.formats = SNDRV_PCM_FMTBIT_S16_LE,},
 	.capture = {
 		.stream_name = "AC97 Capture",
 		.channels_min = 2,
 		.channels_max = 2,
-		.rates = s3c2443_AC97_RATES,
+		.rates = s3c244X_AC97_RATES,
 		.formats = SNDRV_PCM_FMTBIT_S16_LE,},
 	.ops = {
-		.hw_params = s3c2443_ac97_hw_params,
-		.trigger = s3c2443_ac97_trigger},
+		.hw_params = s3c244x_ac97_hw_params,
+		.trigger = s3c244x_ac97_trigger},
 },
 {
 	.name = "pxa2xx-ac97-mic",
@@ -385,17 +433,18 @@
 		.stream_name = "AC97 Mic Capture",
 		.channels_min = 1,
 		.channels_max = 1,
-		.rates = s3c2443_AC97_RATES,
+		.rates = s3c244X_AC97_RATES,
 		.formats = SNDRV_PCM_FMTBIT_S16_LE,},
 	.ops = {
-		.hw_params = s3c2443_ac97_hw_mic_params,
-		.trigger = s3c2443_ac97_mic_trigger,},
+		.hw_params = s3c244x_ac97_hw_mic_params,
+		.trigger = s3c244x_ac97_mic_trigger,},
 },
 };
 
+EXPORT_SYMBOL_GPL(s3c2440_ac97_dai);
 EXPORT_SYMBOL_GPL(s3c2443_ac97_dai);
 EXPORT_SYMBOL_GPL(soc_ac97_ops);
 
 MODULE_AUTHOR("Graeme Gregory");
-MODULE_DESCRIPTION("AC97 driver for the Samsung s3c2443 chip");
+MODULE_DESCRIPTION("AC97 driver for the Samsung s3c244x chip");
 MODULE_LICENSE("GPL");
Index: linux-2.6.24/sound/soc/s3c24xx/s3c24xx-ac97.h
===================================================================
--- linux-2.6.24.orig/sound/soc/s3c24xx/s3c24xx-ac97.h	2008-02-15 18:24:08.000000000 +0100
+++ linux-2.6.24/sound/soc/s3c24xx/s3c24xx-ac97.h	2008-02-15 18:26:02.000000000 +0100
@@ -20,6 +20,7 @@
 #define AC_CMD_ADDR(x) (x << 16)
 #define AC_CMD_DATA(x) (x & 0xffff)
 
+extern struct snd_soc_cpu_dai s3c2440_ac97_dai[];
 extern struct snd_soc_cpu_dai s3c2443_ac97_dai[];
 
 #endif /*S3C24XXAC97_H_*/

