audio: auge: fix hdmi pop noise when bootup

PD#165171: audio: auge: fix hdmi pop noise when bootup

Change-Id: Ic8186b230c5c27966467e35d23b8c041309e6922
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
This commit is contained in:
Xing Wang
2018-05-24 23:30:01 +08:00
committed by Yixun Lan
parent 7736bcd558
commit d4ef94cef8
14 changed files with 218 additions and 320 deletions

View File

@@ -593,33 +593,6 @@
sound-dai = <&dummy_codec>;
};
};
/*
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -839,20 +812,6 @@
pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
};
/* copy a useless tdm to output for hdmi, no pinmux */
aml_i2s2hdmi: i2s2hdmi {
compatible = "amlogic, g12a-snd-tdmc";
#sound-dai-cells = <0>;
dai-tdm-lane-slot-mask-out = <1 1 1 1>;
dai-tdm-clk-sel = <2>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_C
&clkc CLKID_MPLL2>;
clock-names = "mclk", "clk_srcpll";
i2s2hdmi = <1>;
status = "okay";
};
aml_spdif: spdif {
compatible = "amlogic, g12a-snd-spdif-a";

View File

@@ -610,11 +610,11 @@
aml-audio-card,dai-link@4 {
mclk-fs = <128>;
//continuous-clock;
continuous-clock;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdif";
suffix-name = "alsaPORT-spdifb2hdmi";
cpu {
sound-dai = <&aml_spdif>;
system-clock-frequency = <6144000>;
@@ -630,7 +630,7 @@
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdifb2hdmi";
suffix-name = "alsaPORT-spdif";
cpu {
sound-dai = <&aml_spdif_b>;
system-clock-frequency = <6144000>;
@@ -643,29 +643,28 @@
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
/*
* aml-audio-card,dai-link@6 {
* format = "i2s";
* mclk-fs = <256>;
* //continuous-clock;
* //bitclock-inversion;
* //frame-inversion;
* bitclock-master = <&aml_i2s2hdmi>;
* frame-master = <&aml_i2s2hdmi>;
* suffix-name = "alsaPORT-i2s2hdmi";
* cpu {
* sound-dai = <&aml_i2s2hdmi>;
* dai-tdm-slot-tx-mask = <1 1>;
* dai-tdm-slot-num = <2>;
* dai-tdm-slot-width = <32>;
* system-clock-frequency = <12288000>;
* };
* codec {
* sound-dai = <&dummy_codec>;
* };
* };
*/
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -892,7 +891,7 @@
i2s2hdmi = <1>;
status = "okay";
status = "disabled";
};
aml_spdif: spdif {

View File

@@ -699,33 +699,6 @@
sound-dai = <&dummy_codec>;
};
};
/*
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -940,20 +913,6 @@
pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
};
/* copy a useless tdm to output for hdmi, no pinmux */
aml_i2s2hdmi: i2s2hdmi {
compatible = "amlogic, g12a-snd-tdmc";
#sound-dai-cells = <0>;
dai-tdm-lane-slot-mask-out = <1 1 1 1>;
dai-tdm-clk-sel = <2>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_C
&clkc CLKID_MPLL2>;
clock-names = "mclk", "clk_srcpll";
i2s2hdmi = <1>;
status = "okay";
};
aml_spdif: spdif {
compatible = "amlogic, g12a-snd-spdif-a";

View File

@@ -700,33 +700,6 @@
sound-dai = <&dummy_codec>;
};
};
/*
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -949,20 +922,6 @@
pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
};
/* copy a useless tdm to output for hdmi, no pinmux */
aml_i2s2hdmi: i2s2hdmi {
compatible = "amlogic, g12a-snd-tdmc";
#sound-dai-cells = <0>;
dai-tdm-lane-slot-mask-out = <1 1 1 1>;
dai-tdm-clk-sel = <2>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_C
&clkc CLKID_MPLL2>;
clock-names = "mclk", "clk_srcpll";
i2s2hdmi = <1>;
status = "okay";
};
aml_spdif: spdif {
compatible = "amlogic, g12a-snd-spdif-a";

View File

@@ -586,10 +586,11 @@
aml-audio-card,dai-link@4 {
mclk-fs = <128>;
continuous-clock;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdif";
suffix-name = "alsaPORT-spdifb2hdmi";
cpu {
sound-dai = <&aml_spdif>;
system-clock-frequency = <6144000>;
@@ -605,7 +606,7 @@
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdifb2hdmi";
suffix-name = "alsaPORT-spdif";
cpu {
sound-dai = <&aml_spdif_b>;
system-clock-frequency = <6144000>;
@@ -618,29 +619,28 @@
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
/*
* aml-audio-card,dai-link@6 {
* format = "i2s";
* mclk-fs = <256>;
* //continuous-clock;
* //bitclock-inversion;
* //frame-inversion;
* bitclock-master = <&aml_i2s2hdmi>;
* frame-master = <&aml_i2s2hdmi>;
* suffix-name = "alsaPORT-i2s2hdmi";
* cpu {
* sound-dai = <&aml_i2s2hdmi>;
* dai-tdm-slot-tx-mask = <1 1>;
* dai-tdm-slot-num = <2>;
* dai-tdm-slot-width = <32>;
* system-clock-frequency = <12288000>;
* };
* codec {
* sound-dai = <&dummy_codec>;
* };
* };
*/
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -861,7 +861,7 @@
i2s2hdmi = <1>;
status = "okay";
status = "disabled";
};
aml_spdif: spdif {

View File

@@ -601,10 +601,11 @@
aml-audio-card,dai-link@4 {
mclk-fs = <128>;
continuous-clock;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdif";
suffix-name = "alsaPORT-spdifb2hdmi";
cpu {
sound-dai = <&aml_spdif>;
system-clock-frequency = <6144000>;
@@ -620,7 +621,7 @@
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdifb2hdmi";
suffix-name = "alsaPORT-spdif";
cpu {
sound-dai = <&aml_spdif_b>;
system-clock-frequency = <6144000>;
@@ -633,29 +634,28 @@
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
/*
* aml-audio-card,dai-link@6 {
* format = "i2s";
* mclk-fs = <256>;
* //continuous-clock;
* //bitclock-inversion;
* //frame-inversion;
* bitclock-master = <&aml_i2s2hdmi>;
* frame-master = <&aml_i2s2hdmi>;
* suffix-name = "alsaPORT-i2s2hdmi";
* cpu {
* sound-dai = <&aml_i2s2hdmi>;
* dai-tdm-slot-tx-mask = <1 1>;
* dai-tdm-slot-num = <2>;
* dai-tdm-slot-width = <32>;
* system-clock-frequency = <12288000>;
* };
* codec {
* sound-dai = <&dummy_codec>;
* };
* };
*/
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -868,7 +868,7 @@
i2s2hdmi = <1>;
status = "okay";
status = "disabled";
};
aml_spdif: spdif {

View File

@@ -593,10 +593,11 @@
aml-audio-card,dai-link@4 {
mclk-fs = <128>;
continuous-clock;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdif";
suffix-name = "alsaPORT-spdifb2hdmi";
cpu {
sound-dai = <&aml_spdif>;
system-clock-frequency = <6144000>;
@@ -608,10 +609,11 @@
/* spdif_b to hdmi, only playback */
aml-audio-card,dai-link@5 {
mclk-fs = <128>;
continuous-clock;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdifb2hdmi";
suffix-name = "alsaPORT-spdif";
cpu {
sound-dai = <&aml_spdif_b>;
system-clock-frequency = <6144000>;
@@ -624,29 +626,28 @@
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
/*
* aml-audio-card,dai-link@6 {
* format = "i2s";
* mclk-fs = <256>;
* //continuous-clock;
* //bitclock-inversion;
* //frame-inversion;
* bitclock-master = <&aml_i2s2hdmi>;
* frame-master = <&aml_i2s2hdmi>;
* suffix-name = "alsaPORT-i2s2hdmi";
* cpu {
* sound-dai = <&aml_i2s2hdmi>;
* dai-tdm-slot-tx-mask = <1 1>;
* dai-tdm-slot-num = <2>;
* dai-tdm-slot-width = <32>;
* system-clock-frequency = <12288000>;
* };
* codec {
* sound-dai = <&dummy_codec>;
* };
* };
*/
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -828,7 +829,7 @@
* 3: spdifout;
* 4: spdifout_b;
*/
samesource_sel = <4>;
samesource_sel = <3>;
};
aml_tdmc: tdmc {
@@ -858,7 +859,7 @@
i2s2hdmi = <1>;
status = "okay";
status = "disabled";
};
aml_spdif: spdif {

View File

@@ -598,10 +598,11 @@
aml-audio-card,dai-link@4 {
mclk-fs = <128>;
continuous-clock;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdif";
suffix-name = "alsaPORT-spdifb2hdmi";
cpu {
sound-dai = <&aml_spdif>;
system-clock-frequency = <6144000>;
@@ -617,7 +618,7 @@
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-spdifb2hdmi";
suffix-name = "alsaPORT-spdif";
cpu {
sound-dai = <&aml_spdif_b>;
system-clock-frequency = <6144000>;
@@ -630,29 +631,28 @@
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
/*
* aml-audio-card,dai-link@6 {
* format = "i2s";
* mclk-fs = <256>;
* //continuous-clock;
* //bitclock-inversion;
* //frame-inversion;
* bitclock-master = <&aml_i2s2hdmi>;
* frame-master = <&aml_i2s2hdmi>;
* suffix-name = "alsaPORT-i2s2hdmi";
* cpu {
* sound-dai = <&aml_i2s2hdmi>;
* dai-tdm-slot-tx-mask = <1 1>;
* dai-tdm-slot-num = <2>;
* dai-tdm-slot-width = <32>;
* system-clock-frequency = <12288000>;
* };
* codec {
* sound-dai = <&dummy_codec>;
* };
* };
*/
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -865,7 +865,7 @@
i2s2hdmi = <1>;
status = "okay";
status = "disabled";
};
aml_spdif: spdif {

View File

@@ -716,33 +716,6 @@
sound-dai = <&dummy_codec>;
};
};
/*
* dai link for i2s to hdmix,
* Notice to select a tdm lane not used by hw
*/
aml-audio-card,dai-link@6 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_i2s2hdmi>;
frame-master = <&aml_i2s2hdmi>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-i2s2hdmi";
cpu {
sound-dai = <&aml_i2s2hdmi>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
};
codec {
sound-dai = <&dummy_codec>;
};
};
};
audiolocker: locker {
compatible = "amlogic, audiolocker";
@@ -934,20 +907,6 @@
pinctrl-0 = <&tdmc_mclk &tdmout_c &tdmin_c>;
};
/* copy a useless tdm to output for hdmi, no pinmux */
aml_i2s2hdmi: i2s2hdmi {
compatible = "amlogic, g12a-snd-tdmc";
#sound-dai-cells = <0>;
dai-tdm-lane-slot-mask-out = <1 1 1 1>;
dai-tdm-clk-sel = <2>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_C
&clkc CLKID_MPLL2>;
clock-names = "mclk", "clk_srcpll";
i2s2hdmi = <1>;
status = "okay";
};
aml_spdif: spdif {
compatible = "amlogic, g12a-snd-spdif-a";

View File

@@ -739,6 +739,7 @@ void aml_frddr_enable(struct frddr *fr, bool enable)
unsigned int reg;
reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL0, reg_base);
/* ensure disable before enable frddr */
aml_audiobus_update_bits(actrl, reg, 1<<31, enable<<31);
if (!enable)
@@ -886,7 +887,7 @@ static void aml_check_aed(bool enable, int dst)
}
}
void frddr_init_default(unsigned int frddr_index, unsigned int src0_sel)
void frddr_init_without_mngr(unsigned int frddr_index, unsigned int src0_sel)
{
unsigned int offset, reg;
unsigned int start_addr, end_addr, int_addr;
@@ -929,6 +930,15 @@ void frddr_init_default(unsigned int frddr_index, unsigned int src0_sel)
);
}
void frddr_deinit_without_mngr(unsigned int frddr_index)
{
unsigned int offset, reg;
offset = EE_AUDIO_FRDDR_B_CTRL0 - EE_AUDIO_FRDDR_A_CTRL0;
reg = EE_AUDIO_FRDDR_A_CTRL0 + offset * frddr_index;
audiobus_write(reg, 0x0);
}
static struct ddr_chipinfo g12a_ddr_chipinfo = {
.addr_separated = true,
.same_src_fn = true,

View File

@@ -103,6 +103,7 @@ unsigned int aml_frddr_get_fifo_id(struct frddr *fr);
/* audio eq drc */
void aml_aed_enable(bool enable, int aed_module);
void frddr_init_default(unsigned int frddr_index, unsigned int src0_sel);
void frddr_init_without_mngr(unsigned int frddr_index, unsigned int src0_sel);
void frddr_deinit_without_mngr(unsigned int frddr_index);
#endif

View File

@@ -463,6 +463,19 @@ static struct snd_pcm_ops aml_spdif_ops = {
#define PREALLOC_BUFFER_MAX (256 * 1024)
static int aml_spdif_new(struct snd_soc_pcm_runtime *rtd)
{
struct device *dev = rtd->platform->dev;
struct aml_spdif *p_spdif;
p_spdif = (struct aml_spdif *)dev_get_drvdata(dev);
pr_info("%s spdif_%s, clk continuous:%d\n",
__func__,
(p_spdif->id == 0) ? "a":"b",
p_spdif->clk_cont);
/* keep frddr, when spdif init done, frddr can be released. */
if (p_spdif->clk_cont)
spdifout_play_with_zerodata_free(p_spdif->id);
return snd_pcm_lib_preallocate_pages_for_all(
rtd->pcm, SNDRV_DMA_TYPE_DEV,
rtd->card->snd_card->dev,
@@ -732,7 +745,12 @@ static int aml_dai_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
dev_info(substream->pcm->card->dev, "spdif capture disable\n");
aml_toddr_enable(p_spdif->tddr, 0);
}
if (!p_spdif->clk_cont)
/* continuous, spdif out is only mute, not disable */
if (p_spdif->clk_cont
&& (substream->stream == SNDRV_PCM_STREAM_PLAYBACK))
aml_spdif_mute(p_spdif->actrl,
substream->stream, p_spdif->id, true);
else
aml_spdif_enable(p_spdif->actrl,
substream->stream, p_spdif->id, false);
break;
@@ -1034,12 +1052,9 @@ static int aml_spdif_platform_probe(struct platform_device *pdev)
/* for spdif_b, clk be continuous,
* and keep silence when no valid data
*/
if (aml_spdif->id == 1)
/*if (aml_spdif->id == 1)*/
aml_spdif->clk_cont = 1;
if (aml_spdif->clk_cont)
spdifout_play_with_zerodata(aml_spdif->id);
aml_spdif->chipinfo = p_spdif_chipinfo;
} else
dev_warn_once(dev,
@@ -1062,6 +1077,9 @@ static int aml_spdif_platform_probe(struct platform_device *pdev)
if (ret)
return -EINVAL;
if (aml_spdif->clk_cont)
spdifout_play_with_zerodata(aml_spdif->id);
ret = devm_snd_soc_register_component(dev, &aml_spdif_component,
&aml_spdif_dai[aml_spdif->id], 1);
if (ret) {

View File

@@ -50,6 +50,30 @@ void aml_spdif_enable(
}
}
void aml_spdif_mute(
struct aml_audio_controller *actrl,
int stream,
int index,
bool is_mute)
{
int mute_lr = 0;
if (is_mute)
mute_lr = 0x3;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
unsigned int offset, reg;
offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0;
reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * index;
aml_audiobus_update_bits(actrl,
reg, 0x3 << 21, mute_lr << 21);
} else {
aml_audiobus_update_bits(actrl,
EE_AUDIO_SPDIFIN_CTRL0, 0x3 << 6, mute_lr << 6);
}
}
void aml_spdif_arb_config(struct aml_audio_controller *actrl)
{
/* config ddr arb */
@@ -351,16 +375,6 @@ void spdifout_fifo_ctrl(int spdif_id, int fifo_id, int bitwidth)
audiobus_update_bits(reg, 1<<28, 1<<28);
}
static void spdifout_mute(int spdif_id)
{
unsigned int offset, reg;
/* mute */
offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0;
reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * spdif_id;
audiobus_update_bits(reg, 0x3 << 21, 0x3 << 21);
}
static bool spdifout_is_enable(int spdif_id)
{
unsigned int offset, reg, val;
@@ -403,8 +417,8 @@ void spdifout_samesource_set(int spdif_index, int fifo_id,
spdif_id = 0;
/* clk for spdif_b is always on */
if (!spdif_id)
spdifout_clk_ctrl(spdif_id, is_enable);
/*if (!spdif_id)*/
spdifout_clk_ctrl(spdif_id, /*is_enable*/true);
if (is_enable)
spdifout_fifo_ctrl(spdif_id, fifo_id, bitwidth);
@@ -507,7 +521,7 @@ void spdifout_play_with_zerodata(unsigned int spdif_id)
struct snd_pcm_runtime runtime;
substream.runtime = &runtime;
runtime.rate = 48000;
runtime.rate = sample_rate;
runtime.format = SNDRV_PCM_FORMAT_S16_LE;
runtime.channels = 2;
runtime.sample_bits = 16;
@@ -516,6 +530,11 @@ void spdifout_play_with_zerodata(unsigned int spdif_id)
if (spdif_id == 0)
src0_sel = 3;
/* spdif clk */
spdifout_clk_ctrl(spdif_id, true);
/* spdif to hdmitx */
spdifoutb_to_hdmitx_ctrl(spdif_id);
/* spdif ctrl */
spdifout_fifo_ctrl(spdif_id, frddr_index, bitwidth);
@@ -524,13 +543,20 @@ void spdifout_play_with_zerodata(unsigned int spdif_id)
spdif_set_channel_status_info(&chsts, spdif_id);
/* notify hdmitx audio */
spdifoutb_to_hdmitx_ctrl(spdif_id);
aout_notifier_call_chain(0x1, &substream);
frddr_init_default(frddr_index, src0_sel);
/* init frddr to output zero data. */
frddr_init_without_mngr(frddr_index, src0_sel);
/* spdif enable */
spdifout_enable(spdif_id, true);
spdifout_mute(spdif_id);
}
}
void spdifout_play_with_zerodata_free(unsigned int spdif_id)
{
pr_info("%s, spdif id:%d\n", __func__, spdif_id);
/* free frddr, then frddr in mngr */
frddr_deinit_without_mngr(spdif_id);
}

View File

@@ -28,6 +28,12 @@ extern void aml_spdif_enable(
int index,
bool is_enable);
extern void aml_spdif_mute(
struct aml_audio_controller *actrl,
int stream,
int index,
bool is_mute);
extern void aml_spdif_arb_config(struct aml_audio_controller *actrl);
extern int aml_spdifin_status_check(
@@ -69,4 +75,5 @@ extern void spdif_set_channel_status_info(
struct iec958_chsts *chsts, int spdif_id);
extern void spdifout_play_with_zerodata(unsigned int spdif_id);
extern void spdifout_play_with_zerodata_free(unsigned int spdif_id);
#endif