summaryrefslogtreecommitdiff
authorXindong Xu <xindong.xu@amlogic.com>2018-04-18 06:28:36 (GMT)
committer Gerrit Code Review <gituser@droid04>2018-04-18 06:28:36 (GMT)
commit5bfa295528b0b529a06e316f6faf93828bf76cb6 (patch)
tree43313c65425cf7c0533b91b2081302d3e929fbe6
parent9d73d1b9e6d6bec500ae56dfecb598b9c3a2261e (diff)
parent481abaf701126eb8ffc3aabb0add3cc15024fc26 (diff)
downloadcommon-5bfa295528b0b529a06e316f6faf93828bf76cb6.zip
common-5bfa295528b0b529a06e316f6faf93828bf76cb6.tar.gz
common-5bfa295528b0b529a06e316f6faf93828bf76cb6.tar.bz2
Merge "audio: meson: fix i2s/spdif buffer for split mode when bootup to play" into ampere-20180311
Diffstat
-rw-r--r--sound/soc/amlogic/meson/audio_hw.c21
-rw-r--r--sound/soc/amlogic/meson/audio_hw.h6
-rw-r--r--sound/soc/amlogic/meson/meson.c11
-rw-r--r--sound/soc/amlogic/meson/spdif_dai.c9
4 files changed, 30 insertions, 17 deletions
diff --git a/sound/soc/amlogic/meson/audio_hw.c b/sound/soc/amlogic/meson/audio_hw.c
index 4a442e6..3c855ba 100644
--- a/sound/soc/amlogic/meson/audio_hw.c
+++ b/sound/soc/amlogic/meson/audio_hw.c
@@ -168,20 +168,19 @@ void audio_set_aiubuf(u32 addr, u32 size, unsigned int channel)
void audio_set_958outbuf(u32 addr, u32 size, int flag)
{
+#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
+ aml_write_cbus(AIU_MEM_IEC958_START_PTR, addr & 0xffffff00);
+ aml_write_cbus(AIU_MEM_IEC958_RD_PTR, addr & 0xffffff00);
+#else
aml_write_cbus(AIU_MEM_IEC958_START_PTR, addr & 0xffffffc0);
- if (aml_read_cbus(AIU_MEM_IEC958_START_PTR) ==
- aml_read_cbus(AIU_MEM_I2S_START_PTR)) {
- aml_write_cbus(AIU_MEM_IEC958_RD_PTR,
- aml_read_cbus(AIU_MEM_I2S_RD_PTR));
- } else
- aml_write_cbus(AIU_MEM_IEC958_RD_PTR,
- addr & 0xffffffc0);
+ aml_write_cbus(AIU_MEM_IEC958_RD_PTR, addr & 0xffffffc0);
+#endif
if (flag == 0) {
/* this is for 16bit 2 channel */
#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
aml_write_cbus(AIU_MEM_IEC958_END_PTR,
- (addr & 0xffffffc0) +
- (size & 0xffffffc0) - 8);
+ (addr & 0xffffff00) +
+ (size & 0xffffff00) - 256);
#else
aml_write_cbus(AIU_MEM_IEC958_END_PTR,
(addr & 0xffffffc0) +
@@ -191,8 +190,8 @@ void audio_set_958outbuf(u32 addr, u32 size, int flag)
/* this is for RAW mode */
#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
aml_write_cbus(AIU_MEM_IEC958_END_PTR,
- (addr & 0xffffffc0) +
- (size & 0xffffffc0) - 8);
+ (addr & 0xffffff00) +
+ (size & 0xffffff00) - 256);
#else
aml_write_cbus(AIU_MEM_IEC958_END_PTR,
(addr & 0xffffffc0) +
diff --git a/sound/soc/amlogic/meson/audio_hw.h b/sound/soc/amlogic/meson/audio_hw.h
index dc0397c..a95826b 100644
--- a/sound/soc/amlogic/meson/audio_hw.h
+++ b/sound/soc/amlogic/meson/audio_hw.h
@@ -111,6 +111,12 @@ enum {
#define AUDIO_ALGOUT_DAC_FORMAT_DSP 0
#define AUDIO_ALGOUT_DAC_FORMAT_LEFT_JUSTIFY 1
+#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
+#define DEFAULT_PLAYBACK_SIZE 256
+#else
+#define DEFAULT_PLAYBACK_SIZE 64
+#endif
+
extern unsigned int IEC958_MODE;
extern unsigned int I2S_MODE;
extern unsigned int audio_in_source;
diff --git a/sound/soc/amlogic/meson/meson.c b/sound/soc/amlogic/meson/meson.c
index f011369..80faed7 100644
--- a/sound/soc/amlogic/meson/meson.c
+++ b/sound/soc/amlogic/meson/meson.c
@@ -54,17 +54,22 @@
#define DRV_NAME "aml_meson_snd_card"
-static int i2sbuf[32 + 16];
+static int i2sbuf[DEFAULT_PLAYBACK_SIZE];
static void aml_i2s_play(void)
{
- audio_util_set_dac_i2s_format(AUDIO_ALGOUT_DAC_FORMAT_DSP);
+ int size = DEFAULT_PLAYBACK_SIZE;
+
+ audio_util_set_dac_i2s_format(AUDIO_ALGOUT_DAC_FORMAT_DSP);
#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
audio_set_i2s_mode(AIU_I2S_MODE_PCM16, 2);
#else
audio_set_i2s_mode(AIU_I2S_MODE_PCM16);
#endif
memset(i2sbuf, 0, sizeof(i2sbuf));
- audio_set_aiubuf((virt_to_phys(i2sbuf) + 63) & (~63), 128, 2);
+ audio_set_aiubuf((virt_to_phys(i2sbuf)
+ + (DEFAULT_PLAYBACK_SIZE - 1))
+ & (~(DEFAULT_PLAYBACK_SIZE - 1)),
+ size, 2);
audio_out_i2s_enable(1);
}
diff --git a/sound/soc/amlogic/meson/spdif_dai.c b/sound/soc/amlogic/meson/spdif_dai.c
index 080eea3..84302ae 100644
--- a/sound/soc/amlogic/meson/spdif_dai.c
+++ b/sound/soc/amlogic/meson/spdif_dai.c
@@ -99,11 +99,12 @@ void aml_spdif_play(int samesrc)
{
if (!is_meson_tv_chipset()) {
uint div = 0;
- static int iec958buf[32 + 16];
+ static int iec958buf[DEFAULT_PLAYBACK_SIZE];
struct _aiu_958_raw_setting_t set;
struct _aiu_958_channel_status_t chstat;
struct snd_pcm_substream substream;
struct snd_pcm_runtime runtime;
+ int size = DEFAULT_PLAYBACK_SIZE;
substream.runtime = &runtime;
runtime.rate = 48000;
@@ -143,8 +144,10 @@ void aml_spdif_play(int samesrc)
/*clear the same source function as new raw data output */
audio_i2s_958_same_source(samesrc);
memset(iec958buf, 0, sizeof(iec958buf));
- audio_set_958outbuf((virt_to_phys(iec958buf) + 63) & (~63),
- 128, 0);
+ audio_set_958outbuf((virt_to_phys(iec958buf)
+ + (DEFAULT_PLAYBACK_SIZE - 1))
+ & (~(DEFAULT_PLAYBACK_SIZE - 1)),
+ size, 0);
audio_set_958_mode(AIU_958_MODE_PCM16, &set);
aout_notifier_call_chain(AOUT_EVENT_IEC_60958_PCM, &substream);
audio_hw_958_enable(1);