#include <asm/arch/pxa-regs.h>
 #include <asm/arch/pxa2xx-regs.h>
 #include <asm/arch/pxa2xx-gpio.h>
+#include <asm/arch/audio.h>
 #include <asm/arch/pxafb.h>
 #include <asm/arch/ohci.h>
 #include <asm/arch/mmc.h>
        }
 };
 
-/* audio device */
-static struct platform_device cmx270_audio_device = {
-       .name           = "pxa2xx-ac97",
-       .id             = -1,
-};
-
 /* touchscreen controller */
 static struct platform_device cmx270_ts_device = {
        .name           = "ucb1400_ts",
 /* platform devices */
 static struct platform_device *platform_devices[] __initdata = {
        &cmx270_device_dm9k,
-       &cmx270_audio_device,
        &cmx270_rtc_device,
        &cmx270_2700G,
        &cmx270_led_device,
 
        /* register CM-X270 platform devices */
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       pxa_set_ac97_info(NULL);
 
        /* set MCI and OHCI platform parameters */
        pxa_set_mci_info(&cmx270_mci_platform_data);
 
 #include <asm/arch/ohci.h>
 #include <asm/arch/pxa27x_keypad.h>
 #include <asm/arch/camera.h>
+#include <asm/arch/audio.h>
 
 #include "devices.h"
 #include "generic.h"
        .id             = -1,
 };
 
+static struct resource pxa_ac97_resources[] = {
+       [0] = {
+               .start  = 0x40500000,
+               .end    = 0x40500000 + 0xfff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = IRQ_AC97,
+               .end    = IRQ_AC97,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static u64 pxa_ac97_dmamask = 0xffffffffUL;
+
+struct platform_device pxa_device_ac97 = {
+       .name           = "pxa2xx-ac97",
+       .id             = -1,
+       .dev            = {
+               .dma_mask = &pxa_ac97_dmamask,
+               .coherent_dma_mask = 0xffffffff,
+       },
+       .num_resources  = ARRAY_SIZE(pxa_ac97_resources),
+       .resource       = pxa_ac97_resources,
+};
+
+void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
+{
+       pxa_register_device(&pxa_device_ac97, ops);
+}
+
 #ifdef CONFIG_PXA25x
 
 static struct resource pxa25x_resource_pwm0[] = {
 
 extern struct platform_device pxa_device_i2s;
 extern struct platform_device pxa_device_ficp;
 extern struct platform_device pxa_device_rtc;
+extern struct platform_device pxa_device_ac97;
 
 extern struct platform_device pxa27x_device_i2c_power;
 extern struct platform_device pxa27x_device_ohci;
 
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/pxa2xx-gpio.h>
 #include <asm/arch/pxa27x-udc.h>
+#include <asm/arch/audio.h>
 #include <asm/arch/pxafb.h>
 #include <asm/arch/ohci.h>
 #include <asm/arch/mmc.h>
        }
 };
 
-/* audio device */
-static struct platform_device em_x270_audio = {
-       .name           = "pxa2xx-ac97",
-       .id             = -1,
-};
-
 /* WM9712 touchscreen controller. Hopefully the driver will make it to
  * the mainstream sometime */
 static struct platform_device em_x270_ts = {
 /* platform devices */
 static struct platform_device *platform_devices[] __initdata = {
        &em_x270_dm9k,
-       &em_x270_audio,
        &em_x270_ts,
        &em_x270_rtc,
        &em_x270_nand,
 
        /* register EM-X270 platform devices */
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       pxa_set_ac97_info(NULL);
 
        /* set MCI and OHCI platform parameters */
        pxa_set_mci_info(&em_x270_mci_platform_data);
 
        .resource       = smc91x_resources,
 };
 
-static struct platform_device lpd270_audio_device = {
-       .name           = "pxa2xx-ac97",
-       .id             = -1,
-};
-
 static struct resource lpd270_flash_resources[] = {
        [0] = {
                .start  = PXA_CS0_PHYS,
 static struct platform_device *platform_devices[] __initdata = {
        &smc91x_device,
        &lpd270_backlight_device,
-       &lpd270_audio_device,
        &lpd270_flash_device[0],
        &lpd270_flash_device[1],
 };
 
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 
+       pxa_set_ac97_info(NULL);
+
        if (lpd270_lcd_to_use != NULL)
                set_pxa_fb_info(lpd270_lcd_to_use);
 
 
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/pxa2xx-regs.h>
 #include <asm/arch/mfp-pxa25x.h>
+#include <asm/arch/audio.h>
 #include <asm/arch/lubbock.h>
 #include <asm/arch/udc.h>
 #include <asm/arch/irda.h>
        // no D+ pullup; lubbock can't connect/disconnect in software
 };
 
-static struct platform_device lub_audio_device = {
-       .name           = "pxa2xx-ac97",
-       .id             = -1,
-};
-
 static struct resource sa1111_resources[] = {
        [0] = {
                .start  = 0x10000000,
 
 static struct platform_device *devices[] __initdata = {
        &sa1111_device,
-       &lub_audio_device,
        &smc91x_device,
        &lubbock_flash_device[0],
        &lubbock_flash_device[1],
        set_pxa_fb_info(&sharp_lm8v31);
        pxa_set_mci_info(&lubbock_mci_platform_data);
        pxa_set_ficp_info(&lubbock_ficp_platform_data);
+       pxa_set_ac97_info(NULL);
 
        lubbock_flash_data[0].width = lubbock_flash_data[1].width =
                (BOOT_DEF & 1) ? 2 : 4;
 
        .resume         = mst_audio_resume,
 };
 
-static struct platform_device mst_audio_device = {
-       .name           = "pxa2xx-ac97",
-       .id             = -1,
-       .dev            = { .platform_data = &mst_audio_ops },
-};
-
 static struct resource flash_resources[] = {
        [0] = {
                .start  = PXA_CS0_PHYS,
 
 static struct platform_device *platform_devices[] __initdata = {
        &smc91x_device,
-       &mst_audio_device,
        &mst_flash_device[0],
        &mst_flash_device[1],
        &mst_gpio_keys_device,
        pxa_set_ficp_info(&mainstone_ficp_platform_data);
        pxa_set_ohci_info(&mainstone_ohci_platform_data);
        pxa_set_i2c_info(NULL);
+       pxa_set_ac97_info(&mst_audio_ops);
 
        mainstone_init_keypad();
 }
 
 #include <asm/mach/map.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/pxa2xx-gpio.h>
+#include <asm/arch/audio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/ohci.h>
 #include <asm/arch/pcm990_baseboard.h>
 };
 #endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */
 
-/*
- * AC97 support
- * Note: The connected AC97 mixer also reports interrupts at PCM990_AC97_IRQ
- */
-static struct resource pxa27x_ac97_resources[] = {
-       [0] = {
-               .start  = 0x40500000,
-               .end    = 0x40500000 + 0xfff,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = IRQ_AC97,
-               .end    = IRQ_AC97,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static u64 pxa_ac97_dmamask = 0xffffffffUL;
-
-static struct platform_device pxa27x_device_ac97 = {
-       .name           = "pxa2xx-ac97",
-       .id             = -1,
-       .dev            = {
-               .dma_mask = &pxa_ac97_dmamask,
-               .coherent_dma_mask = 0xffffffff,
-       },
-       .num_resources  = ARRAY_SIZE(pxa27x_ac97_resources),
-       .resource       = pxa27x_ac97_resources,
-};
-
 /*
  * enable generic access to the base board control CPLDs U6 and U7
  */
        pxa_gpio_mode(GPIO16_PWM0_MD);
        platform_device_register(&pcm990_backlight_device);
 
-       platform_device_register(&pxa27x_device_ac97);
-
        /* MMC */
        pxa_set_mci_info(&pcm990_mci_platform_data);
 
        pxa_set_ohci_info(&pcm990_ohci_platform_data);
 
        pxa_set_i2c_info(NULL);
+       pxa_set_ac97_info(NULL);
 
 #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
        pxa_set_camera_info(&pcm990_pxacamera_platform_data);
 
        .resource       = NULL,
 };
 
-/********************************************************************************************
- * PXA270 ac97 sound codec
- ********************************************************************************************/
-static struct platform_device ac97_audio_device = {
-       .name           = "pxa2xx-ac97",
-       .id             = -1,
-};
-
 static struct platform_device * trizeps4_devices[] __initdata = {
        &flash_device,
        &uart_devices,
        &dm9000_device,
-       &ac97_audio_device,
 };
 
 #ifdef CONFIG_MACH_TRIZEPS4_CONXS
        pxa_set_mci_info(&trizeps4_mci_platform_data);
        pxa_set_ficp_info(&trizeps4_ficp_platform_data);
        pxa_set_ohci_info(&trizeps4_ohci_platform_data);
+       pxa_set_ac97_info(NULL);
 }
 
 static void __init trizeps4_map_io(void)
 
        void *priv;
 } pxa2xx_audio_ops_t;
 
+extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops);
+
 #endif