diff --git a/arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts b/arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts index 55f80117e55f..b87fc5638ff5 100644 --- a/arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts +++ b/arch/arm/boot/dts/amlogic/axg_s400_v03sbr.dts @@ -547,7 +547,7 @@ aml-audio-card,dai-link@2 { format = "i2s"; mclk-fs = <256>; - //continuous-clock; + continuous-clock; //bitclock-inversion; //frame-inversion; //bitclock-master = <&aml_tdmc>; diff --git a/arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts b/arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts index 2ed30851891d..64448060e351 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s400_v03sbr.dts @@ -547,7 +547,7 @@ aml-audio-card,dai-link@2 { format = "i2s"; mclk-fs = <256>; - //continuous-clock; + continuous-clock; //bitclock-inversion; //frame-inversion; //bitclock-master = <&aml_tdmc>; diff --git a/sound/soc/amlogic/auge/spdif_hw.c b/sound/soc/amlogic/auge/spdif_hw.c index 86c9e50e3c25..69009946d047 100644 --- a/sound/soc/amlogic/auge/spdif_hw.c +++ b/sound/soc/amlogic/auge/spdif_hw.c @@ -516,16 +516,28 @@ void spdifout_samesource_set(int spdif_index, int fifo_id, int spdifin_get_sample_rate(void) { unsigned int val; + /*EE_AUDIO_SPDIFIN_STAT0*/ + /*r_width_max bit17:8 (the max width of two edge;)*/ + unsigned int max_width = 0; val = audiobus_read(EE_AUDIO_SPDIFIN_STAT0); /* NA when check min width of two edges */ if (((val >> 18) & 0x3ff) == 0x3ff) - return 0x7; + return 7; + + /*check the max width of two edge when spdifin sr=32kHz*/ + /*if max_width is more than 0x2f0(magic number),*/ + /*sr(32kHz) is unavailable*/ + max_width = ((val >> 8) & 0x3ff); + + if ((((val >> 28) & 0x7) == 0) && (max_width == 0x3ff)) + return 7; return (val >> 28) & 0x7; } + static int spdifin_get_channel_status(int sel) { unsigned int val; diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c index 2b21e3bf03bf..4349e5664428 100644 --- a/sound/soc/amlogic/auge/tdm.c +++ b/sound/soc/amlogic/auge/tdm.c @@ -156,35 +156,6 @@ static const struct snd_pcm_hardware aml_tdm_hardware = { .channels_max = 32, }; -static int tdm_clk_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol); - struct aml_tdm *p_tdm = snd_soc_dai_get_drvdata(cpu_dai); - - ucontrol->value.enumerated.item[0] = clk_get_rate(p_tdm->mclk); - return 0; -} - -static int tdm_clk_set(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol); - struct aml_tdm *p_tdm = snd_soc_dai_get_drvdata(cpu_dai); - - int mclk_rate = p_tdm->last_mclk_freq; - int value = ucontrol->value.enumerated.item[0]; - - if (value > 2000000 || value < 0) { - pr_err("Fine tdm clk setting range (0~2000000), %d\n", value); - return 0; - } - mclk_rate += (value - 1000000); - - aml_dai_set_tdm_sysclk(cpu_dai, 0, mclk_rate, 0); - - return 0; -} static int tdmin_clk_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -226,14 +197,10 @@ static const struct soc_enum i2sin_clk_enum[] = { static const struct snd_kcontrol_new snd_tdm_controls[] = { SOC_ENUM_EXT("I2SIn CLK", i2sin_clk_enum, tdmin_clk_get, - NULL), - - SOC_SINGLE_EXT("TDM MCLK Fine Setting", - 0, 0, 2000000, 0, - tdm_clk_get, - tdm_clk_set), + NULL) }; + static irqreturn_t aml_tdm_ddr_isr(int irq, void *devid) { struct snd_pcm_substream *substream = (struct snd_pcm_substream *)devid; @@ -1194,8 +1161,14 @@ static int aml_dai_set_tdm_slot(struct snd_soc_dai *cpu_dai, static int aml_dai_tdm_probe(struct snd_soc_dai *cpu_dai) { + int ret = 0; struct aml_tdm *p_tdm = snd_soc_dai_get_drvdata(cpu_dai); + ret = snd_soc_add_dai_controls(cpu_dai, snd_tdm_controls, + ARRAY_SIZE(snd_tdm_controls)); + if (ret < 0) + pr_err("%s, failed add snd spdif controls\n", __func__); + /* config ddr arb */ aml_tdm_arb_config(p_tdm->actrl);