sandbox: Add a simple sound driver
authorSimon Glass <sjg@chromium.org>
Thu, 27 Feb 2014 20:26:18 +0000 (13:26 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 18 Mar 2014 02:05:48 +0000 (20:05 -0600)
Add a sound driver for sandbox, which uses SDL.

Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
arch/sandbox/include/asm/arch-sandbox/sound.h [new file with mode: 0644]
drivers/sound/Makefile
drivers/sound/sandbox.c [new file with mode: 0644]

diff --git a/arch/sandbox/include/asm/arch-sandbox/sound.h b/arch/sandbox/include/asm/arch-sandbox/sound.h
new file mode 100644 (file)
index 0000000..a32e8c8
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2013 Google, Inc
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __SANDBOX_SOUND_H
+#define __SANDBOX_SOUND_H
+
+int sound_play(unsigned int msec, unsigned int frequency);
+
+int sound_init(const void *blob);
+
+#endif
index 6d252926c608621e6babdf0b840950e99663f174..3793f8af9bf70e36b350b696b73e8cfafbc0468c 100644 (file)
@@ -7,5 +7,7 @@
 
 obj-$(CONFIG_SOUND)    += sound.o
 obj-$(CONFIG_I2S)      += samsung-i2s.o
+obj-$(CONFIG_I2S_SAMSUNG)      += samsung-i2s.o
+obj-$(CONFIG_SOUND_SANDBOX)    += sandbox.o
 obj-$(CONFIG_SOUND_WM8994)     += wm8994.o
 obj-$(CONFIG_SOUND_MAX98095)   += max98095.o
diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c
new file mode 100644 (file)
index 0000000..fe5c9e9
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2013 Google, Inc
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/sound.h>
+#include <asm/sdl.h>
+
+int sound_play(uint32_t msec, uint32_t frequency)
+{
+       sandbox_sdl_sound_start(frequency);
+       mdelay(msec);
+       sandbox_sdl_sound_stop();
+
+       return 0;
+}
+
+int sound_init(const void *blob)
+{
+       return sandbox_sdl_sound_init();
+}