[alsa-devel] [PATCH V1 12/13] Fabric bindings for STAC9766 on the Efika

Jon Smirl jonsmirl at gmail.com
Thu May 14 03:59:24 CEST 2009


Fabric bindings for STAC9766 on the Efika. This includes an example of a custom fabric driver.

Signed-off-by: Jon Smirl <jonsmirl at gmail.com>
---
 arch/powerpc/platforms/52xx/efika.c |    8 +++
 sound/soc/fsl/Kconfig               |    8 +++
 sound/soc/fsl/Makefile              |    3 +
 sound/soc/fsl/efika-audio-fabric.c  |   95 +++++++++++++++++++++++++++++++++++
 4 files changed, 113 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/fsl/efika-audio-fabric.c

diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index a2068fa..c7a6a48 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -211,12 +211,18 @@ static int __init efika_probe(void)
 	return 1;
 }
 
+static void __init efika_declare_platform_devices(void)
+{
+	mpc52xx_declare_of_platform_devices();
+	platform_device_register_simple("efika-audio-fabric", 0, NULL, 0);
+}
+
 define_machine(efika)
 {
 	.name			= EFIKA_PLATFORM_NAME,
 	.probe			= efika_probe,
 	.setup_arch		= efika_setup_arch,
-	.init			= mpc52xx_declare_of_platform_devices,
+	.init			= efika_declare_platform_devices,
 	.show_cpuinfo		= efika_show_cpuinfo,
 	.init_IRQ		= mpc52xx_init_irq,
 	.get_irq		= mpc52xx_get_irq,
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index d8f63f5..266c6b7 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -40,4 +40,12 @@ config SND_SOC_MPC5200_AC97
 	help
 	  Say Y here to support the MPC5200 PSCs in AC97 mode.
 
+config SND_MPC52xx_SOC_EFIKA
+	tristate "SoC AC97 Audio support for bbplan Efika and STAC9766"
+	depends on PPC_EFIKA
+	select SND_SOC_MPC5200_AC97
+	select SND_SOC_STAC9766
+	help
+	  Say Y if you want to add support for sound on the Efika.
+
 
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index 14631a1..f406470 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -15,3 +15,6 @@ obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o
 obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o
 obj-$(CONFIG_SND_SOC_MPC5200_AC97) += mpc5200_psc_ac97.o
 
+# MPC5200 Machine Support
+obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o
+
diff --git a/sound/soc/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c
new file mode 100644
index 0000000..56ae471
--- /dev/null
+++ b/sound/soc/fsl/efika-audio-fabric.c
@@ -0,0 +1,95 @@
+/*
+ * Efika driver for the PSC of the Freescale MPC52xx configured as AC97 interface
+ *
+ * Copyright 2008 Jon Smirl, Digispeaker
+ * Author: Jon Smirl <jonsmirl at gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
+#include <linux/dma-mapping.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/initval.h>
+#include <sound/soc.h>
+#include <sound/soc-of-simple.h>
+
+#include "mpc5200_dma.h"
+#include "mpc5200_psc_ac97.h"
+#include "../codecs/stac9766.h"
+
+static int efika_init(struct snd_soc_codec *codec)
+{
+	/* Skeleton driver showing framework for setting
+	 * up board specific fabric drivers.
+	 *
+	 * set up Efika specific controls here
+	 *
+	 * Loading of this driver is trigger by
+	 * platform_device_register_simple("efika-audio-fabric", 0, NULL, 0);
+	 * in arch/powerpc/platforms/52xx/efika.c
+	 */
+	return 0;
+}
+
+static int efika_stac9766_probe(struct platform_device *pdev)
+{
+	of_snd_soc_register_fabric("Efika", NULL, efika_init);
+	return 0;
+}
+
+#ifdef CONFIG_PM
+
+static int efika_stac9766_suspend(struct platform_device *pdev,
+	pm_message_t state)
+{
+	return 0;
+}
+
+static int efika_stac9766_resume(struct platform_device *pdev)
+{
+	return 0;
+}
+
+#else
+#define efika_stac9766_suspend NULL
+#define efika_stac9766_resume  NULL
+#endif
+
+static struct platform_driver efika_fabric = {
+	.probe	= efika_stac9766_probe,
+	.suspend = efika_stac9766_suspend,
+ 	.resume = efika_stac9766_resume,
+	.driver	= {
+		.name	= "efika-audio-fabric",
+	},
+};
+
+static __init int efika_fabric_init(void)
+{
+	return platform_driver_register(&efika_fabric);
+}
+
+static __exit void efika_fabric_exit(void)
+{
+}
+
+module_init(efika_fabric_init);
+module_exit(efika_fabric_exit);
+
+
+MODULE_AUTHOR("Jon Smirl <jonsmirl at gmail.com>");
+MODULE_DESCRIPTION(DRV_NAME ": mpc5200 Efika fabric driver");
+MODULE_LICENSE("GPL");
+



More information about the Alsa-devel mailing list