Skip to content

Commit

Permalink
[ARM] 5085/2: PXA: Move AC97 over to the new central device declarati…
Browse files Browse the repository at this point in the history
…on model

As well as moving all the device declarations to a single one in devices.c
this causes all platforms to register the I/O and interrupt resources for
the AC97 controller.

Cc: eric miao <eric.miao@marvell.com>
Cc: Mike Rapoport <mike@compulab.co.il>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: Jürgen Schindele <linux@schindele.name>
Cc: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Mark Brown authored and Russell King committed Jul 9, 2008
1 parent 7a85762 commit 9f19d63
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 74 deletions.
9 changes: 2 additions & 7 deletions arch/arm/mach-pxa/cm-x270.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#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>
Expand Down Expand Up @@ -81,12 +82,6 @@ static struct platform_device cmx270_device_dm9k = {
}
};

/* 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",
Expand Down Expand Up @@ -219,7 +214,6 @@ static struct platform_device cmx270_ata = {
/* platform devices */
static struct platform_device *platform_devices[] __initdata = {
&cmx270_device_dm9k,
&cmx270_audio_device,
&cmx270_rtc_device,
&cmx270_2700G,
&cmx270_led_device,
Expand Down Expand Up @@ -594,6 +588,7 @@ static void __init cmx270_init(void)

/* 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);
Expand Down
32 changes: 32 additions & 0 deletions arch/arm/mach-pxa/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#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"
Expand Down Expand Up @@ -298,6 +299,37 @@ struct platform_device pxa_device_rtc = {
.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[] = {
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-pxa/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern struct platform_device pxa_device_i2c;
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;
Expand Down
9 changes: 2 additions & 7 deletions arch/arm/mach-pxa/em-x270.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#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>
Expand Down Expand Up @@ -73,12 +74,6 @@ static struct platform_device em_x270_dm9k = {
}
};

/* 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 = {
Expand Down Expand Up @@ -218,7 +213,6 @@ static struct platform_device em_x270_nand = {
/* platform devices */
static struct platform_device *platform_devices[] __initdata = {
&em_x270_dm9k,
&em_x270_audio,
&em_x270_ts,
&em_x270_rtc,
&em_x270_nand,
Expand Down Expand Up @@ -326,6 +320,7 @@ static void __init em_x270_init(void)

/* 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);
Expand Down
8 changes: 2 additions & 6 deletions arch/arm/mach-pxa/lpd270.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ static struct platform_device smc91x_device = {
.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,
Expand Down Expand Up @@ -412,7 +407,6 @@ __setup("lcd=", lpd270_set_lcd);
static struct platform_device *platform_devices[] __initdata = {
&smc91x_device,
&lpd270_backlight_device,
&lpd270_audio_device,
&lpd270_flash_device[0],
&lpd270_flash_device[1],
};
Expand Down Expand Up @@ -456,6 +450,8 @@ static void __init lpd270_init(void)

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);

Expand Down
8 changes: 2 additions & 6 deletions arch/arm/mach-pxa/lubbock.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#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>
Expand Down Expand Up @@ -196,11 +197,6 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
// 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,
Expand Down Expand Up @@ -368,7 +364,6 @@ static struct platform_device lubbock_flash_device[2] = {

static struct platform_device *devices[] __initdata = {
&sa1111_device,
&lub_audio_device,
&smc91x_device,
&lubbock_flash_device[0],
&lubbock_flash_device[1],
Expand Down Expand Up @@ -494,6 +489,7 @@ static void __init lubbock_init(void)
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;
Expand Down
8 changes: 1 addition & 7 deletions arch/arm/mach-pxa/mainstone.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,6 @@ static pxa2xx_audio_ops_t mst_audio_ops = {
.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,
Expand Down Expand Up @@ -499,7 +493,6 @@ static struct platform_device mst_gpio_keys_device = {

static struct platform_device *platform_devices[] __initdata = {
&smc91x_device,
&mst_audio_device,
&mst_flash_device[0],
&mst_flash_device[1],
&mst_gpio_keys_device,
Expand Down Expand Up @@ -609,6 +602,7 @@ static void __init mainstone_init(void)
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();
}
Expand Down
34 changes: 2 additions & 32 deletions arch/arm/mach-pxa/pcm990-baseboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#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>
Expand Down Expand Up @@ -423,36 +424,6 @@ static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
};
#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
*/
Expand Down Expand Up @@ -490,15 +461,14 @@ void __init pcm990_baseboard_init(void)
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);

/* USB host */
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);
Expand Down
10 changes: 1 addition & 9 deletions arch/arm/mach-pxa/trizeps4.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,10 @@ static struct platform_device uart_devices = {
.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
Expand Down Expand Up @@ -439,6 +430,7 @@ static void __init trizeps4_init(void)
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)
Expand Down
2 changes: 2 additions & 0 deletions include/asm-arm/arch-pxa/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ typedef struct {
void *priv;
} pxa2xx_audio_ops_t;

extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops);

#endif

0 comments on commit 9f19d63

Please sign in to comment.