mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
audio: meson: fix i2s/spdif buffer for split mode when bootup to play
PD#162285: audio: meson: fix i2s/spdif buffer for split mode when bootup to play Change-Id: I730993dd183cee40c92d232414d6752f75cb2b06 Signed-off-by: Xing Wang <xing.wang@amlogic.com>
This commit is contained in:
@@ -236,15 +236,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_aiu_write(AIU_MEM_IEC958_START_PTR, addr & 0xffffff00);
|
||||
aml_aiu_write(AIU_MEM_IEC958_RD_PTR, addr & 0xffffff00);
|
||||
#else
|
||||
aml_aiu_write(AIU_MEM_IEC958_START_PTR, addr & 0xffffffc0);
|
||||
aml_aiu_write(AIU_MEM_IEC958_RD_PTR,
|
||||
addr & 0xffffffc0);
|
||||
aml_aiu_write(AIU_MEM_IEC958_RD_PTR, addr & 0xffffffc0);
|
||||
#endif
|
||||
if (flag == 0) {
|
||||
/* this is for 16bit 2 channel */
|
||||
#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
|
||||
aml_aiu_write(AIU_MEM_IEC958_END_PTR,
|
||||
(addr & 0xffffffc0) +
|
||||
(size & 0xffffffc0) - 8);
|
||||
(addr & 0xffffff00) +
|
||||
(size & 0xffffff00) - 256);
|
||||
#else
|
||||
aml_aiu_write(AIU_MEM_IEC958_END_PTR,
|
||||
(addr & 0xffffffc0) +
|
||||
@@ -254,8 +258,8 @@ void audio_set_958outbuf(u32 addr, u32 size, int flag)
|
||||
/* this is for RAW mode */
|
||||
#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
|
||||
aml_aiu_write(AIU_MEM_IEC958_END_PTR,
|
||||
(addr & 0xffffffc0) +
|
||||
(size & 0xffffffc0) - 8);
|
||||
(addr & 0xffffff00) +
|
||||
(size & 0xffffff00) - 256);
|
||||
#else
|
||||
aml_aiu_write(AIU_MEM_IEC958_END_PTR,
|
||||
(addr & 0xffffffc0) +
|
||||
|
||||
@@ -135,6 +135,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;
|
||||
|
||||
@@ -55,9 +55,11 @@
|
||||
|
||||
#define DRV_NAME "aml_meson_snd_card"
|
||||
|
||||
static int i2sbuf[32 + 16];
|
||||
static int i2sbuf[DEFAULT_PLAYBACK_SIZE];
|
||||
static void aml_i2s_play(void)
|
||||
{
|
||||
int size = DEFAULT_PLAYBACK_SIZE;
|
||||
|
||||
audio_util_set_i2s_format(AUDIO_ALGOUT_DAC_FORMAT_DSP);
|
||||
#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
|
||||
audio_set_i2s_mode(AIU_I2S_MODE_PCM16, 2);
|
||||
@@ -65,8 +67,10 @@ static void aml_i2s_play(void)
|
||||
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,
|
||||
SNDRV_PCM_FORMAT_S16_LE);
|
||||
audio_set_aiubuf((virt_to_phys(i2sbuf)
|
||||
+ (DEFAULT_PLAYBACK_SIZE - 1))
|
||||
& (~(DEFAULT_PLAYBACK_SIZE - 1)),
|
||||
size, 2, SNDRV_PCM_FORMAT_S16_LE);
|
||||
audio_out_i2s_enable(1);
|
||||
|
||||
}
|
||||
|
||||
@@ -97,11 +97,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;
|
||||
@@ -141,8 +142,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);
|
||||
|
||||
Reference in New Issue
Block a user