[alsa-devel] [PATCH 12/12] pcm037: Add sound support

Sascha Hauer s.hauer at pengutronix.de
Thu Nov 19 16:48:26 CET 2009


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-mx3/pcm037.c |   72 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 6cbaabe..15584b5 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -33,6 +33,7 @@
 #include <linux/irq.h>
 #include <linux/fsl_devices.h>
 #include <linux/can/platform/sja1000.h>
+#include <linux/mfd/mc13783.h>
 
 #include <media/soc_camera.h>
 
@@ -51,6 +52,9 @@
 #include <mach/mx3_camera.h>
 #include <mach/mx3fb.h>
 #include <mach/mxc_nand.h>
+#include <mach/spi.h>
+#include <mach/audmux.h>
+#include <mach/ssi.h>
 
 #include "devices.h"
 #include "pcm037.h"
@@ -124,6 +128,8 @@ static unsigned int pcm037_pins[] = {
 	MX31_PIN_CSPI3_SPI_RDY__CTS3,
 	/* LAN9217 irq pin */
 	IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO),
+	/* MC13783 IRQ pim */
+	IOMUX_MODE(MX31_PIN_GPIO3_0, IOMUX_CONFIG_GPIO),
 	/* Onewire */
 	MX31_PIN_BATT_LINE__OWIRE,
 	/* Framebuffer */
@@ -172,6 +178,15 @@ static unsigned int pcm037_pins[] = {
 	MX31_PIN_CSI_VSYNC__CSI_VSYNC,
 	/* GPIO */
 	IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO),
+	/* SSI */
+	MX31_PIN_STXD4__STXD4,
+	MX31_PIN_SRXD4__SRXD4,
+	MX31_PIN_SCK4__SCK4,
+	MX31_PIN_SFS4__SFS4,
+	MX31_PIN_STXD5__STXD5,
+	MX31_PIN_SRXD5__SRXD5,
+	MX31_PIN_SCK5__SCK5,
+	MX31_PIN_SFS5__SFS5,
 };
 
 static struct physmap_flash_data pcm037_flash_data = {
@@ -407,6 +422,31 @@ static void pcm970_sdhc1_exit(struct device *dev, void *data)
 	gpio_free(SDHC1_GPIO_WP);
 }
 
+#ifdef CONFIG_SPI
+static struct mc13783_platform_data pcm037_pmic = {
+	.flags = MC13783_USE_ADC | MC13783_USE_TOUCHSCREEN |
+		 MC13783_USE_CODEC,
+};
+
+static unsigned int pcm037_spi_cs[] = {MXC_SPI_CS(0), };
+
+static struct spi_imx_master pcm037_spi_0_data = {
+	.chipselect = pcm037_spi_cs,
+	.num_chipselect = ARRAY_SIZE(pcm037_spi_cs),
+};
+
+static struct spi_board_info pcm037_spi_board_info[] __initdata = {
+	{
+		.modalias	= "mc13783",
+		.irq		= IOMUX_TO_IRQ(MX31_PIN_GPIO3_0),
+		.max_speed_hz	= 3000000,
+		.bus_num	= 0,
+		.platform_data	= &pcm037_pmic,
+		.chip_select	= 0,
+	}
+};
+#endif /* CONFIG_SPI */
+
 static struct imxmmc_platform_data sdhc_pdata = {
 #ifdef PCM970_SDHC_RW_SWITCH
 	.get_ro = pcm970_sdhc1_get_ro,
@@ -543,6 +583,10 @@ static struct platform_device pcm970_sja1000 = {
 	.num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
 };
 
+struct imx_ssi_platform_data pcm037_ssi_pdata = {
+//	.flags = IMX_SSI_DMA,
+};
+
 /*
  * Board specific initialization.
  */
@@ -550,6 +594,26 @@ static void __init mxc_board_init(void)
 {
 	int ret;
 
+	mxc_audmux_v2_configure_port(MX31_AUDMUX_PORT1_SSI0,
+			MXC_AUDMUX_V2_PTCR_TFSDIR |
+			MXC_AUDMUX_V2_PTCR_TCLKDIR |
+			MXC_AUDMUX_V2_PTCR_TFSEL(MX31_AUDMUX_PORT4_SSI_PINS_4) |
+			MXC_AUDMUX_V2_PTCR_TCSEL(MX31_AUDMUX_PORT4_SSI_PINS_4) |
+			MXC_AUDMUX_V2_PTCR_RFSDIR |
+			MXC_AUDMUX_V2_PTCR_RCLKDIR |
+			MXC_AUDMUX_V2_PTCR_RFSEL(MX31_AUDMUX_PORT5_SSI_PINS_5) |
+			MXC_AUDMUX_V2_PTCR_RCSEL(MX31_AUDMUX_PORT5_SSI_PINS_5),
+			MXC_AUDMUX_V2_PDCR_RXDSEL(MX31_AUDMUX_PORT5_SSI_PINS_5));
+	mxc_audmux_v2_configure_port(MX31_AUDMUX_PORT5_SSI_PINS_5,
+			0,
+			MXC_AUDMUX_V2_PDCR_RXDSEL(MX31_AUDMUX_PORT1_SSI0));
+	mxc_audmux_v2_configure_port(MX31_AUDMUX_PORT4_SSI_PINS_4,
+			MXC_AUDMUX_V2_PTCR_TFSEL(MX31_AUDMUX_PORT1_SSI0) |
+			MXC_AUDMUX_V2_PTCR_TCSEL(MX31_AUDMUX_PORT1_SSI0) |
+			MXC_AUDMUX_V2_PTCR_RFSEL(MX31_AUDMUX_PORT1_SSI0) |
+			MXC_AUDMUX_V2_PTCR_RCSEL(MX31_AUDMUX_PORT1_SSI0),
+			0);
+
 	mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
 			"pcm037");
 
@@ -605,6 +669,14 @@ static void __init mxc_board_init(void)
 		mxc_register_device(&mx3_camera, &camera_pdata);
 
 	platform_device_register(&pcm970_sja1000);
+
+#ifdef CONFIG_SPI
+	mxc_register_device(&mxc_spi_device0, &pcm037_spi_0_data);
+
+	spi_register_board_info(pcm037_spi_board_info,
+			ARRAY_SIZE(pcm037_spi_board_info));
+#endif
+	mxc_register_device(&imx_ssi_device0, &pcm037_ssi_pdata);
 }
 
 static void __init pcm037_timer_init(void)
-- 
1.6.5.2



More information about the Alsa-devel mailing list