summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoy Cho <joy.cho@hardkernel.com>2020-12-03 08:25:36 +0300
committerJoy Cho <joy.cho@hardkernel.com>2020-12-04 04:41:33 +0300
commit2e487eea926108a3dde9f2f3942aff1ecedd395c (patch)
treea48eea88787c45cdbbfb7c26eb47a86ad9211930
parentadfcfdddb8edb5437043ab771d94338684ec446d (diff)
downloadu-boot-2e487eea926108a3dde9f2f3942aff1ecedd395c.tar.xz
cmd: odroidtest: Set sound wave frequency and adjust play time
FIXME: Default playing time and audio data size should be calculated using sample rate, channel number and bits per sample. Change-Id: I7b468e96e119d1a091c9248e902632880ea75bbb
-rw-r--r--cmd/odroidtest.c3
-rw-r--r--drivers/sound/rk817_codec.c11
-rw-r--r--drivers/sound/rockchip-sound.c12
3 files changed, 13 insertions, 13 deletions
diff --git a/cmd/odroidtest.c b/cmd/odroidtest.c
index 3da501a026..038f2e172a 100644
--- a/cmd/odroidtest.c
+++ b/cmd/odroidtest.c
@@ -1032,7 +1032,8 @@ static int do_odroidtest_audio(cmd_tbl_t * cmdtp, int flag,
/* 3. play test file */
if (check_audio_keys(key)) {
lcd_printf(0, 10 + yoffs, 1, " Audio Playing : Running ");
- sound_play(0, 0);
+ /* if boot.wav not found, 400Hz square wave will be used */
+ sound_play(1000, 400);
}
lcd_printf(0, 10 + yoffs, 1, " Audio Playing : Stopped ");
diff --git a/drivers/sound/rk817_codec.c b/drivers/sound/rk817_codec.c
index a86ec8752c..420253e91d 100644
--- a/drivers/sound/rk817_codec.c
+++ b/drivers/sound/rk817_codec.c
@@ -33,7 +33,8 @@
#define CODEC_SET_SPK 1
#define CODEC_SET_HP 2
#ifdef CONFIG_PLATFORM_ODROID_GOADV
-#define INITIAL_VOLUME 0x50 /* -30db */
+#define INITIAL_VOLUME_HP 0x85 /* -50db */
+#define INITIAL_VOLUME_SPK 0x6A /* -40db */
#else
#define INITIAL_VOLUME 3 /* -1.125db */
#endif
@@ -314,11 +315,7 @@ static int rk817_startup(struct udevice *dev)
{
struct rk817_codec_priv *rk817 = dev_get_priv(dev);
- /* For OGA, playback path is set
- * from headphone detect status. */
-#ifndef CONFIG_PLATFORM_ODROID_GOADV
rk817_playback_path_put(rk817, SPK_HP);
-#endif
rk817_digital_mute(rk817, 0);
return 0;
@@ -359,8 +356,8 @@ static int rk817_codec_probe(struct udevice *dev)
}
rk817_codec->dev = dev;
- rk817_codec->hp_volume = INITIAL_VOLUME;
- rk817_codec->spk_volume = INITIAL_VOLUME;
+ rk817_codec->hp_volume = INITIAL_VOLUME_HP;
+ rk817_codec->spk_volume = INITIAL_VOLUME_SPK;
rk817_codec->playback_path = OFF;
rk817_reset(rk817_codec);
diff --git a/drivers/sound/rockchip-sound.c b/drivers/sound/rockchip-sound.c
index 394c058ad1..9be126e59a 100644
--- a/drivers/sound/rockchip-sound.c
+++ b/drivers/sound/rockchip-sound.c
@@ -13,12 +13,7 @@
#include <sound.h>
#include <asm/arch-rockchip/resource_img.h>
-#ifdef CONFIG_PLATFORM_ODROID_GOADV
-/* about 3 seconds */
-#define WAV_SIZE (512 * 1024) /* BYTE */
-#else
#define WAV_SIZE (5 * 1024 * 1024) /* BYTE */
-#endif
#define SAMPLERATE 44100
static struct udevice *i2s_dev, *codec_dev;
@@ -133,7 +128,14 @@ int sound_play(u32 msec, u32 frequency)
buf_size / sizeof(unsigned short),
frequency);
+#ifdef CONFIG_PLATFORM_ODROID_GOADV
+ /* FIXME : about 1 seconds,
+ * data_size and play time should be calculated
+ * using sampling reate, channel number and bits per sample. */
+ ret = _sound_play(i2s_dev, buf, ((100 * 1024) / sizeof(int)));
+#else
ret = _sound_play(i2s_dev, buf, (buf_size / sizeof(int)));
+#endif
free(buf);
return ret;