diff --git a/projects/Odroid_C2/patches/linux/linux-001-Revert-all-Odroid-custom-audio-mods-for-HiFi-Shield1-and-usb-DAC.patch b/projects/Odroid_C2/patches/linux/linux-001-Revert-all-Odroid-custom-audio-mods-for-HiFi-Shield1-and-usb-DAC.patch index 8fdb7ddc60..2e2b24dc69 100644 --- a/projects/Odroid_C2/patches/linux/linux-001-Revert-all-Odroid-custom-audio-mods-for-HiFi-Shield1-and-usb-DAC.patch +++ b/projects/Odroid_C2/patches/linux/linux-001-Revert-all-Odroid-custom-audio-mods-for-HiFi-Shield1-and-usb-DAC.patch @@ -1,8 +1,8 @@ -From cc3842d7b5f45dc5c240fd734918242e25aadc9e Mon Sep 17 00:00:00 2001 +From b0bc68d9bfb8d33badd3c0f2f583934219bff120 Mon Sep 17 00:00:00 2001 From: Jamie Coldhill -Date: Fri, 16 Sep 2016 18:46:04 +0800 -Subject: [PATCH] Revert all Odroid custom audio mods for HiFi Shield1 - and usb DAC +Date: Mon, 19 Sep 2016 19:15:16 +0800 +Subject: [PATCH] + Revert.all.Odroid.Specific.Sound.Mods.for.HiFi.Shield.and.usb_dac --- arch/arm64/boot/dts/meson64_odroidc2.dts | 143 ++++++------ @@ -14,21 +14,29 @@ Subject: [PATCH] Revert all Odroid custom audio mods for HiFi Shield1 sound/soc/aml/m8/Makefile | 6 - sound/soc/aml/m8/aml_audio_hw.c | 13 +- sound/soc/aml/m8/aml_audio_hw.h | 2 +- + sound/soc/aml/m8/aml_i2s.c | 83 +++---- + sound/soc/aml/m8/aml_i2s_dai.c | 55 ++--- + sound/soc/aml/m8/aml_m8.c | 2 + sound/soc/aml/m8/aml_spdif_codec.c | 2 +- + sound/soc/aml/m8/aml_spdif_dai.c | 110 +++++++--- + sound/soc/aml/m8/aml_spdif_dai.h | 4 +- sound/soc/aml/m8/odroid_dac.c | 292 ------------------------- sound/soc/aml/m8/odroid_hdmi.c | 262 ---------------------- sound/soc/aml/m8/odroid_hdmi.h | 31 --- sound/soc/codecs/Kconfig | 4 - sound/soc/codecs/Makefile | 2 - sound/soc/codecs/pcm5102.c | 161 -------------- - 16 files changed, 82 insertions(+), 867 deletions(-) + 21 files changed, 222 insertions(+), 981 deletions(-) + mode change 100755 => 100644 arch/arm64/boot/dts/meson64_odroidc2.dts delete mode 100644 sound/soc/aml/m8/odroid_dac.c delete mode 100644 sound/soc/aml/m8/odroid_hdmi.c delete mode 100644 sound/soc/aml/m8/odroid_hdmi.h delete mode 100644 sound/soc/codecs/pcm5102.c diff --git a/arch/arm64/boot/dts/meson64_odroidc2.dts b/arch/arm64/boot/dts/meson64_odroidc2.dts -index 3534b4f..175afd1 100644 +old mode 100755 +new mode 100644 +index 5f64ee3..e95be6a --- a/arch/arm64/boot/dts/meson64_odroidc2.dts +++ b/arch/arm64/boot/dts/meson64_odroidc2.dts @@ -529,21 +529,24 @@ @@ -219,10 +227,10 @@ index 3534b4f..175afd1 100644 }; /* END OF AUDIO board specific */ diff --git a/arch/arm64/configs/odroidc2_defconfig b/arch/arm64/configs/odroidc2_defconfig -index 3dd9aba..380e988 100644 +index 079f956..08de48b 100644 --- a/arch/arm64/configs/odroidc2_defconfig +++ b/arch/arm64/configs/odroidc2_defconfig -@@ -3208,8 +3208,8 @@ CONFIG_SOUND_OSS_CORE_PRECLAIM=y +@@ -3237,8 +3237,8 @@ CONFIG_SOUND_OSS_CORE_PRECLAIM=y CONFIG_SND=y CONFIG_SND_TIMER=y CONFIG_SND_PCM=y @@ -233,7 +241,7 @@ index 3dd9aba..380e988 100644 CONFIG_SND_COMPRESS_OFFLOAD=y CONFIG_SND_JACK=y CONFIG_SND_SEQUENCER=m -@@ -3243,7 +3243,7 @@ CONFIG_SND_DRIVERS=y +@@ -3272,7 +3272,7 @@ CONFIG_SND_DRIVERS=y # CONFIG_SND_AC97_POWER_SAVE is not set CONFIG_SND_SPI=y CONFIG_SND_USB=y @@ -242,7 +250,7 @@ index 3dd9aba..380e988 100644 CONFIG_SND_USB_UA101=m CONFIG_SND_USB_CAIAQ=m CONFIG_SND_USB_CAIAQ_INPUT=y -@@ -3253,12 +3253,10 @@ CONFIG_SND_SOC=y +@@ -3282,12 +3282,10 @@ CONFIG_SND_SOC=y # CONFIG_SND_ATMEL_SOC is not set # CONFIG_SND_DESIGNWARE_I2S is not set CONFIG_SND_AML_M8_SOC=y @@ -258,10 +266,10 @@ index 3dd9aba..380e988 100644 # CONFIG_SOUND_PRIME is not set CONFIG_AC97_BUS=m diff --git a/drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c -index 78c87f9..fe0e201 100644 +index f53f0e4..e6d04dd 100644 --- a/drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c -@@ -1655,7 +1655,7 @@ static int hdmi_task_handle(void *data) +@@ -1664,7 +1664,7 @@ static int hdmi_task_handle(void *data) INIT_WORK(&hdmitx_device->work_internal_intr, hdmitx_internal_intr_handler); @@ -387,6 +395,289 @@ index d394150..90aee90 100644 void audio_set_spdif_clk_div(void); void audio_enable_ouput(int flag); unsigned int read_i2s_rd_ptr(void); +diff --git a/sound/soc/aml/m8/aml_i2s.c b/sound/soc/aml/m8/aml_i2s.c +index 95ca2e5..64bed25 100644 +--- a/sound/soc/aml/m8/aml_i2s.c ++++ b/sound/soc/aml/m8/aml_i2s.c +@@ -93,17 +93,17 @@ static const struct snd_pcm_hardware aml_i2s_hardware = { + SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, + +- .period_bytes_min = 32, ++ .period_bytes_min = 64, + .period_bytes_max = 32 * 1024 * 2, + .periods_min = 2, +- .periods_max = 256, +- .buffer_bytes_max = 32 * 1024 * 2, ++ .periods_max = 1024, ++ .buffer_bytes_max = 128 * 1024 * 2 * 2, + + .rate_min = 8000, +- .rate_max = 384000, +- .channels_min = 1, ++ .rate_max = 48000, ++ .channels_min = 2, + .channels_max = 8, +- .fifo_size = 32, ++ .fifo_size = 0, + }; + + static const struct snd_pcm_hardware aml_i2s_capture = { +@@ -116,7 +116,7 @@ static const struct snd_pcm_hardware aml_i2s_capture = { + .period_bytes_min = 64, + .period_bytes_max = 32 * 1024, + .periods_min = 2, +- .periods_max = 256, ++ .periods_max = 1024, + .buffer_bytes_max = 64 * 1024, + + .rate_min = 8000, +@@ -582,23 +582,6 @@ static int aml_i2s_close(struct snd_pcm_substream *substream) + /* extern void audio_hw_958_enable(unsigned flag); */ + /* extern int kernel_android_50; */ + +-static char *get_hw_buf_ptr(struct snd_pcm_runtime *runtime, +- snd_pcm_uframes_t cur_pos, int align) +-{ +- unsigned int tot_bytes_per_channel = +- frames_to_bytes(runtime, cur_pos) / runtime->channels; +- unsigned int bytes_aligned_per_channel = +- frames_to_bytes(runtime, align / runtime->channels); +- unsigned int hw_base_off = +- tot_bytes_per_channel / bytes_aligned_per_channel; +- unsigned int block_off = +- tot_bytes_per_channel % bytes_aligned_per_channel; +- +- return runtime->dma_area + +- (frames_to_bytes(runtime, align) * hw_base_off) + +- block_off; +-} +- + static int aml_i2s_copy_playback(struct snd_pcm_runtime *runtime, int channel, + snd_pcm_uframes_t pos, + void __user *buf, snd_pcm_uframes_t count, +@@ -629,32 +612,48 @@ static int aml_i2s_copy_playback(struct snd_pcm_runtime *runtime, int channel, + return -EFAULT; + if (access_ok(VERIFY_READ, buf, frames_to_bytes(runtime, count))) { + if (runtime->format == SNDRV_PCM_FORMAT_S16_LE) { ++ + int16_t *tfrom, *to, *left, *right; + tfrom = (int16_t *) ubuf; ++ to = (int16_t *) hwbuf; ++ ++ left = to; ++ right = to + 16; ++ if (pos % align) { ++ pr_info("audio data unligned: pos=%d, n=%d, align=%d\n", ++ (int)pos, n, align); ++ } + +- for (j = 0; j < count; j++) { +- to = (int16_t *) get_hw_buf_ptr(runtime, +- pos + j, +- align); +- left = to; +- right = to + align; +- *left = (*tfrom++); +- *right = (*tfrom++); ++ for (j = 0; j < n; j += 64) { ++ for (i = 0; i < 16; i++) { ++ *left++ = (*tfrom++); ++ *right++ = (*tfrom++); ++ } ++ left += 16; ++ right += 16; + } +- } else if (runtime->format == SNDRV_PCM_FORMAT_S24_LE) { ++ } else if (runtime->format == SNDRV_PCM_FORMAT_S24_LE ++ && I2S_MODE == AIU_I2S_MODE_PCM24) { + int32_t *tfrom, *to, *left, *right; + tfrom = (int32_t *) ubuf; ++ to = (int32_t *) hwbuf; + +- for (j = 0; j < count; j++) { +- to = (int32_t *) get_hw_buf_ptr(runtime, +- pos + j, +- align); +- left = to; +- right = to + align; ++ left = to; ++ right = to + 8; + +- *left = (*tfrom++); +- *right = (*tfrom++); ++ if (pos % align) { ++ pr_info("audio data unaligned: pos=%d, n=%d, align=%d\n", ++ (int)pos, n, align); + } ++ for (j = 0; j < n; j += 64) { ++ for (i = 0; i < 8; i++) { ++ *left++ = (*tfrom++); ++ *right++ = (*tfrom++); ++ } ++ left += 8; ++ right += 8; ++ } ++ + } else if (runtime->format == SNDRV_PCM_FORMAT_S32_LE) { + int32_t *tfrom, *to, *left, *right; + tfrom = (int32_t *) ubuf; +@@ -779,6 +778,8 @@ static int aml_i2s_copy_capture(struct snd_pcm_runtime *runtime, int channel, + left += 8; + right += 8; + } ++ /* clean hw buffer */ ++ memset(hwbuf, 0, n * 2); + } + } + res = copy_to_user(buf, ubuf, n); +diff --git a/sound/soc/aml/m8/aml_i2s_dai.c b/sound/soc/aml/m8/aml_i2s_dai.c +index 7f86c32..5dfbaf1 100644 +--- a/sound/soc/aml/m8/aml_i2s_dai.c ++++ b/sound/soc/aml/m8/aml_i2s_dai.c +@@ -43,7 +43,6 @@ + #include "aml_i2s.h" + #include "aml_audio_hw.h" + #include +-#include + #include "aml_spdif_dai.h" + + struct aml_dai_info dai_info[3] = { {0} }; +@@ -64,7 +63,6 @@ static int i2s_pos_sync; + /* extern int set_i2s_iec958_samesource(int enable); */ + #define DEFAULT_SAMPLERATE 48000 + #define DEFAULT_MCLK_RATIO_SR 256 +-#define MCLK_RATIO_128FS_SR 128 + static int i2sbuf[32 + 16]; + static void aml_i2s_play(void) + { +@@ -138,6 +136,8 @@ static int aml_dai_i2s_startup(struct snd_pcm_substream *substream, + static void aml_dai_i2s_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) + { ++ if (IEC958_mode_codec == 0) ++ aml_spdif_play(); + return; + } + +@@ -164,7 +164,7 @@ static int aml_i2s_set_amclk(struct aml_i2s *i2s, unsigned long rate) + return ret; + } + +- audio_set_i2s_clk_div(i2s->old_samplerate); ++ audio_set_i2s_clk_div(); + + return 0; + } +@@ -219,19 +219,8 @@ static int aml_dai_i2s_trigger(struct snd_pcm_substream *substream, int cmd, + struct snd_soc_dai *dai) + { + struct snd_pcm_runtime *rtd = substream->runtime; +- struct snd_soc_pcm_runtime *prtd = substream->private_data; +- struct snd_soc_dai *codec_dai = prtd->codec_dai; + int *ppp = NULL; +- bool hdmi_out = false; +- + ALSA_TRACE(); +- +- if (!strncmp(codec_dai->name, "dit-hifi", strlen("dit-hifi"))) { +- hdmi_out = true; +- } else { +- hdmi_out = false; +- } +- + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: +@@ -240,16 +229,9 @@ static int aml_dai_i2s_trigger(struct snd_pcm_substream *substream, int cmd, + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + pr_info("aiu i2s playback enable\n"); + audio_out_i2s_enable(1); +- if (hdmi_out) { +- aml_audio_i2s_mute(); +- hdmitx_audio_mute_op(1); +- if (IEC958_mode_codec == 0) { +- pr_info("audio_hw_958_enable 1\n"); +- audio_hw_958_enable(1); +- } +- } else { +- aml_audio_i2s_unmute(); +- hdmitx_audio_mute_op(0); ++ if (IEC958_mode_codec == 0) { ++ pr_info("audio_hw_958_enable 1\n"); ++ audio_hw_958_enable(1); + } + } else { + audio_in_i2s_enable(1); +@@ -289,10 +271,7 @@ static int aml_dai_i2s_hw_params(struct snd_pcm_substream *substream, + srate = params_rate(params); + if (i2s->old_samplerate != srate) { + i2s->old_samplerate = srate; +- if (srate > 192000) +- mclk_rate = srate * MCLK_RATIO_128FS_SR; +- else +- mclk_rate = srate * DEFAULT_MCLK_RATIO_SR; ++ mclk_rate = srate * DEFAULT_MCLK_RATIO_SR; + aml_i2s_set_amclk(i2s, mclk_rate); + } + +@@ -325,25 +304,27 @@ static int aml_dai_set_i2s_sysclk(struct snd_soc_dai *dai, + return 0; + } + +-#ifdef CONFIG_PM + static int aml_dai_i2s_suspend(struct snd_soc_dai *dai) + { +- ALSA_TRACE(); ++ struct aml_i2s *i2s = dev_get_drvdata(dai->dev); ++ ++ if (i2s && i2s->clk_mclk) ++ clk_disable_unprepare(i2s->clk_mclk); ++ + return 0; + } + + static int aml_dai_i2s_resume(struct snd_soc_dai *dai) + { +- ALSA_TRACE(); ++ struct aml_i2s *i2s = dev_get_drvdata(dai->dev); ++ ++ if (i2s && i2s->clk_mclk) ++ clk_prepare_enable(i2s->clk_mclk); ++ + return 0; + } + +-#else /* CONFIG_PM */ +-#define aml_dai_i2s_suspend NULL +-#define aml_dai_i2s_resume NULL +-#endif /* CONFIG_PM */ +- +-#define AML_DAI_I2S_RATES (SNDRV_PCM_RATE_8000_384000) ++#define AML_DAI_I2S_RATES (SNDRV_PCM_RATE_8000_192000) + #define AML_DAI_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) + +diff --git a/sound/soc/aml/m8/aml_m8.c b/sound/soc/aml/m8/aml_m8.c +index 7744375..2012bba 100644 +--- a/sound/soc/aml/m8/aml_m8.c ++++ b/sound/soc/aml/m8/aml_m8.c +@@ -626,6 +626,7 @@ static int aml_m8_audio_probe(struct platform_device *pdev) + + snd_soc_card_set_drvdata(card, p_aml_audio); + card->dev = dev; ++ platform_set_drvdata(pdev, card); + ret = snd_soc_of_parse_card_name(card, "aml_sound_card,name"); + if (ret < 0) { + dev_err(dev, "no specific snd_soc_card name\n"); +@@ -678,6 +679,7 @@ static struct platform_driver aml_m8_audio_driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + .of_match_table = amlogic_audio_of_match, ++ .pm = &snd_soc_pm_ops, + }, + .probe = aml_m8_audio_probe, + }; diff --git a/sound/soc/aml/m8/aml_spdif_codec.c b/sound/soc/aml/m8/aml_spdif_codec.c index 73223b1..5ef287b 100644 --- a/sound/soc/aml/m8/aml_spdif_codec.c @@ -400,6 +691,203 @@ index 73223b1..5ef287b 100644 #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) +diff --git a/sound/soc/aml/m8/aml_spdif_dai.c b/sound/soc/aml/m8/aml_spdif_dai.c +index f80c5e9..7b42d2d 100644 +--- a/sound/soc/aml/m8/aml_spdif_dai.c ++++ b/sound/soc/aml/m8/aml_spdif_dai.c +@@ -73,12 +73,15 @@ struct aml_spdif { + int old_samplerate; + }; + struct aml_spdif *spdif_p; +-/* ++unsigned int clk81 = 0; ++EXPORT_SYMBOL(clk81); ++ + static int iec958buf[32 + 16]; +-*/ ++static int old_samplerate = -1; ++ + void aml_spdif_play(void) + { +-#if 0 ++#if 1 + struct _aiu_958_raw_setting_t set; + struct _aiu_958_channel_status_t chstat; + struct snd_pcm_substream substream; +@@ -96,12 +99,28 @@ void aml_spdif_play(void) + set.chan_stat->chstat1_l = 0X200; + set.chan_stat->chstat1_r = 0X200; + audio_hw_958_enable(0); +- if (last_iec_clock != AUDIO_CLK_FREQ_48) { +- ALSA_PRINT("enterd %s,set_clock:%d,sample_rate=%d\n", __func__, +- last_iec_clock, AUDIO_CLK_FREQ_48); +- last_iec_clock = AUDIO_CLK_FREQ_48; +- audio_set_958_clk(AUDIO_CLK_FREQ_48, AUDIO_CLK_256FS); ++ if (old_samplerate != AUDIO_CLK_FREQ_48) { ++ pr_info("enterd %s,set_clock:%d,sample_rate=%d\n", ++ __func__, old_samplerate, AUDIO_CLK_FREQ_48); ++ old_samplerate = AUDIO_CLK_FREQ_48; ++ aml_set_spdif_clk(48000 * 512, 0); ++ } ++ /* Todo, div can be changed, for most case, div = 2 */ ++ /* audio_set_spdif_clk_div(); */ ++ /* 958 divisor: 0=no div; 1=div by 2; 2=div by 3; 3=div by 4. */ ++ if (IEC958_mode_codec == 4 || IEC958_mode_codec == 5 || ++ IEC958_mode_codec == 7 || IEC958_mode_codec == 8) { ++ pr_info("set 4x audio clk for 958\n"); ++ aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 0 << 4); ++ } else if (0) { ++ pr_info("share the same clock\n"); ++ aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 1 << 4); ++ } else { ++ pr_info("set normal 512 fs /4 fs\n"); ++ aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 3 << 4); + } ++ /* enable 958 divider */ ++ aml_cbus_update_bits(AIU_CLK_CTRL, 1 << 1, 1 << 1); + audio_util_set_dac_958_format(AUDIO_ALGOUT_DAC_FORMAT_DSP); + memset(iec958buf, 0, sizeof(iec958buf)); + audio_set_958outbuf((virt_to_phys(iec958buf) + 63) & (~63), 128, 0); +@@ -237,7 +256,26 @@ void aml_hw_iec958_init(struct snd_pcm_substream *substream) + runtime->rate, sample_rate); + /* int srate; */ + /* srate = params_rate(params); */ +- aml_set_spdif_clk(runtime->rate * 512, 0); ++ if (old_samplerate != sample_rate) { ++ old_samplerate = sample_rate; ++ aml_set_spdif_clk(runtime->rate * 512, 0); ++ } ++ /* Todo, div can be changed, for most case, div = 2 */ ++ /* audio_set_spdif_clk_div(); */ ++ /* 958 divisor: 0=no div; 1=div by 2; 2=div by 3; 3=div by 4. */ ++ if (IEC958_mode_codec == 4 || IEC958_mode_codec == 5 || ++ IEC958_mode_codec == 7 || IEC958_mode_codec == 8) { ++ pr_info("set 4x audio clk for 958\n"); ++ aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 0 << 4); ++ } else if (0) { ++ pr_info("share the same clock\n"); ++ aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 1 << 4); ++ } else { ++ pr_info("set normal 512 fs /4 fs\n"); ++ aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 3 << 4); ++ } ++ /* enable 958 divider */ ++ aml_cbus_update_bits(AIU_CLK_CTRL, 1 << 1, 1 << 1); + audio_util_set_dac_958_format(AUDIO_ALGOUT_DAC_FORMAT_DSP); + /*clear the same source function as new raw data output */ + audio_i2s_958_same_source(0); +@@ -357,7 +395,12 @@ void aml_hw_iec958_init(struct snd_pcm_substream *substream) + aml_write_cbus(AIU_958_CHSTAT_L1, 0x900); + aml_write_cbus(AIU_958_CHSTAT_R0, 0x1902); + aml_write_cbus(AIU_958_CHSTAT_R1, 0x900); +- aout_notifier_call_chain(AOUT_EVENT_RAWDATA_MAT_MLP, substream); ++ if (IEC958_mode_codec == 8) ++ aout_notifier_call_chain(AOUT_EVENT_RAWDATA_DTS_HD_MA, ++ substream); ++ else ++ aout_notifier_call_chain(AOUT_EVENT_RAWDATA_MAT_MLP, ++ substream); + } else { + aout_notifier_call_chain(AOUT_EVENT_IEC_60958_PCM, substream); + } +@@ -508,22 +551,6 @@ int aml_set_spdif_clk(unsigned long rate, bool src_i2s) + } + } + +- /* Todo, div can be changed, for most case, div = 2 */ +- /* audio_set_spdif_clk_div(); */ +- /* 958 divisor: 0=no div; 1=div by 2; 2=div by 3; 3=div by 4. */ +- if (IEC958_mode_codec == 4 || IEC958_mode_codec == 5 || +- IEC958_mode_codec == 7 || IEC958_mode_codec == 8) { +- pr_info("set 4x audio clk for 958\n"); +- aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 0 << 4); +- } else if (src_i2s) { +- pr_info("share the same clock\n"); +- aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 1 << 4); +- } else { +- pr_info("set normal 512 fs /4 fs\n"); +- aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 3 << 4); +- } +- /* enable 958 divider */ +- aml_cbus_update_bits(AIU_CLK_CTRL, 1 << 1, 1 << 1); + return 0; + } + +@@ -540,24 +567,27 @@ static int aml_dai_spdif_hw_params(struct snd_pcm_substream *substream, + return 0; + } + +-#ifdef CONFIG_PM + static int aml_dai_spdif_suspend(struct snd_soc_dai *cpu_dai) + { +- ALSA_TRACE(); ++ struct aml_spdif *spdif_priv = dev_get_drvdata(cpu_dai->dev); ++ + aml_spdif_play_stop(); ++ if (spdif_priv && spdif_priv->clk_spdif) ++ clk_disable_unprepare(spdif_priv->clk_spdif); ++ + return 0; + } + + static int aml_dai_spdif_resume(struct snd_soc_dai *cpu_dai) + { +- ALSA_TRACE(); +- aml_spdif_play(); ++ struct aml_spdif *spdif_priv = dev_get_drvdata(cpu_dai->dev); ++ ++ /*aml_spdif_play();*/ ++ if (spdif_priv && spdif_priv->clk_spdif) ++ clk_prepare_enable(spdif_priv->clk_spdif); ++ + return 0; + } +-#else +-#define aml_spdif_suspend NULL +-#define aml_spdif_resume NULL +-#endif + + static struct snd_soc_dai_ops spdif_dai_ops = { + .set_sysclk = aml_dai_spdif_set_sysclk, +@@ -660,6 +690,18 @@ static int aml_dai_spdif_probe(struct platform_device *pdev) + goto err; + } + ++ ret = clk_set_parent(spdif_priv->clk_i958, spdif_priv->clk_mpl1); ++ if (ret) { ++ pr_err("Can't set i958 clk parent: %d\n", ret); ++ return ret; ++ } ++ ++ ret = clk_set_parent(spdif_priv->clk_spdif, spdif_priv->clk_i958); ++ if (ret) { ++ pr_err("Can't set spdif clk parent: %d\n", ret); ++ return ret; ++ } ++ + ret = clk_prepare_enable(spdif_priv->clk_spdif); + if (ret) { + pr_err("Can't enable spdif clock: %d\n", ret); +diff --git a/sound/soc/aml/m8/aml_spdif_dai.h b/sound/soc/aml/m8/aml_spdif_dai.h +index 8fe56ca..fd11637 100644 +--- a/sound/soc/aml/m8/aml_spdif_dai.h ++++ b/sound/soc/aml/m8/aml_spdif_dai.h +@@ -33,7 +33,7 @@ + #define AOUT_EVENT_RAWDATA_MAT_MLP 0xC + #define AOUT_EVENT_RAWDATA_DST 0xD + #define AOUT_EVENT_RAWDATA_WMA_PRO 0xE +- ++#define AOUT_EVENT_RAWDATA_DTS_HD_MA (AOUT_EVENT_RAWDATA_DTS_HD|(1<<8)) + extern unsigned int IEC958_mode_codec; + + /* +@@ -47,5 +47,5 @@ extern unsigned int IEC958_mode_codec; + */ + void aml_hw_iec958_init(struct snd_pcm_substream *substream); + int aml_set_spdif_clk(unsigned long rate, bool src_i2s); +- ++void aml_spdif_play(void); + #endif /* _AML_SPDIF_DAI_H */ diff --git a/sound/soc/aml/m8/odroid_dac.c b/sound/soc/aml/m8/odroid_dac.c deleted file mode 100644 index aaf8fbd..0000000 diff --git a/projects/Odroid_C2/patches/linux/linux-005-set-default-refresh-rate-switching-policy.patch b/projects/Odroid_C2/patches/linux/linux-005-set-default-refresh-rate-switching-policy.patch deleted file mode 100644 index ed4aa2d631..0000000000 --- a/projects/Odroid_C2/patches/linux/linux-005-set-default-refresh-rate-switching-policy.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -Naur a/drivers/amlogic/display/vout/tv_vout.c b/drivers/amlogic/display/vout/tv_vout.c ---- a/drivers/amlogic/display/vout/tv_vout.c 2016-04-06 23:18:37.000000000 -0700 -+++ b/drivers/amlogic/display/vout/tv_vout.c 2016-04-14 02:05:33.041542772 -0700 -@@ -70,8 +70,8 @@ - #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION - #define DEFAULT_POLICY_FR_AUTO 1 - static enum vmode_e mode_by_user = VMODE_INIT_NULL; --static int fr_auto_policy = DEFAULT_POLICY_FR_AUTO; --static int fr_auto_policy_hold = DEFAULT_POLICY_FR_AUTO; -+static int fr_auto_policy = 0; -+static int fr_auto_policy_hold = 2; - static int fps_playing_flag; - static enum vmode_e fps_target_mode = VMODE_INIT_NULL; - static void policy_framerate_automation_switch_store(char *para); -@@ -1532,8 +1532,8 @@ - } - - #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION -- sprintf(policy_fr_auto, "%d", DEFAULT_POLICY_FR_AUTO); -- sprintf(policy_fr_auto_switch, "%d", DEFAULT_POLICY_FR_AUTO); -+ sprintf(policy_fr_auto, "%d", 0); -+ sprintf(policy_fr_auto_switch, "%d", 2); - #endif - return 0; - } diff --git a/projects/Odroid_C2/patches/linux/linux-007-Audio-Report-only-working-frequecies-and-bit-depths.patch b/projects/Odroid_C2/patches/linux/linux-007-Audio-Report-only-working-frequecies-and-bit-depths.patch deleted file mode 100644 index 6b50e4e02b..0000000000 --- a/projects/Odroid_C2/patches/linux/linux-007-Audio-Report-only-working-frequecies-and-bit-depths.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 852df2b075af5c13bea74baaf85bbde6c7f351e4 Mon Sep 17 00:00:00 2001 -From: Jamie Coldhill -Date: Fri, 16 Sep 2016 19:15:19 +0800 -Subject: [PATCH] Report only working frequecies and bit depths - ---- - sound/soc/aml/m8/aml_i2s_dai.c | 5 ++--- - sound/soc/aml/m8/aml_spdif_codec.c | 5 ++--- - 2 files changed, 4 insertions(+), 6 deletions(-) - -diff --git a/sound/soc/aml/m8/aml_i2s_dai.c b/sound/soc/aml/m8/aml_i2s_dai.c -index 7f86c32..690faf6 100644 ---- a/sound/soc/aml/m8/aml_i2s_dai.c -+++ b/sound/soc/aml/m8/aml_i2s_dai.c -@@ -343,9 +343,8 @@ static int aml_dai_i2s_resume(struct snd_soc_dai *dai) - #define aml_dai_i2s_resume NULL - #endif /* CONFIG_PM */ - --#define AML_DAI_I2S_RATES (SNDRV_PCM_RATE_8000_384000) --#define AML_DAI_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ -- SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -+#define AML_DAI_I2S_RATES SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000 -+#define AML_DAI_I2S_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE - - static struct snd_soc_dai_ops aml_dai_i2s_ops = { - .startup = aml_dai_i2s_startup, -diff --git a/sound/soc/aml/m8/aml_spdif_codec.c b/sound/soc/aml/m8/aml_spdif_codec.c -index 5ef287b..85f2833 100644 ---- a/sound/soc/aml/m8/aml_spdif_codec.c -+++ b/sound/soc/aml/m8/aml_spdif_codec.c -@@ -26,9 +26,8 @@ - - #define DRV_NAME "spdif-dit" - --#define STUB_RATES SNDRV_PCM_RATE_8000_192000 --#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ -- SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -+#define STUB_RATES SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000 -+#define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE - - static struct snd_soc_codec_driver soc_codec_spdif_dit; - --- -1.9.1 -