Skip to content

Commit

Permalink
ODROID-COMMON: adjust sound card dai link for spdif_out.
Browse files Browse the repository at this point in the history
hw:0,0 -> tdmc <-> internal DAC
hw:0,1 -> spdif_b <-> hdmitx
hw:0,2 -> spdif_a <-> spdif_out(GPIOA_11)

Change-Id: I2d31ec832d6cb82e2363977cbcbc5bc96fa3f993
  • Loading branch information
Kevin Kim authored and tobetter committed Dec 11, 2018
1 parent 895b49d commit 25a4db2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 58 deletions.
82 changes: 24 additions & 58 deletions arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi
Expand Up @@ -120,6 +120,7 @@
/* spdif_b to hdmi, only playback */
aml-audio-card,dai-link@1 {
mclk-fs = <128>;
continuous-clock;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
Expand All @@ -133,25 +134,16 @@
};
};

/* spdif_out GPIOA_11 */
aml-audio-card,dai-link@2 {
format = "i2s";
mclk-fs = <256>;
//continuous-clock;
//bitclock-inversion;
//frame-inversion;
bitclock-master = <&aml_tdmb>;
frame-master = <&aml_tdmb>;
mclk-fs = <128>;
/* suffix-name, sync with android audio hal
* what's the dai link used for
*/
suffix-name = "alsaPORT-pcm";
suffix-name = "alsaPORT-spdif";
cpu {
sound-dai = <&aml_tdmb>;
dai-tdm-slot-tx-mask = <1 1>;
dai-tdm-slot-rx-mask = <1 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
system-clock-frequency = <12288000>;
sound-dai = <&aml_spdif>;
system-clock-frequency = <6144000>;
};
codec {
sound-dai = <&dummy_codec>;
Expand Down Expand Up @@ -344,22 +336,7 @@
};

&audiobus {
aml_tdmb: tdmb {
compatible = "amlogic, g12a-snd-tdmb";
#sound-dai-cells = <0>;
dai-tdm-lane-slot-mask-in = <0 1 0 0>;
dai-tdm-lane-slot-mask-out = <1 0 0 0>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0>;
clock-names = "mclk", "clk_srcpll", "samesource_sysclk";
pinctrl-names = "tdm_pins";
pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
status = "okay";
};

/* copy a useless tdm to output for hdmi, no pinmux */
/* tdmc to internal DAC output, no pinmux */
aml_tdmc: tdmc {
compatible = "amlogic, g12a-snd-tdmc";
#sound-dai-cells = <0>;
Expand All @@ -373,6 +350,23 @@
status = "okay";
};

aml_spdif: spdif {
compatible = "amlogic, g12a-snd-spdif-a";
#sound-dai-cells = <0>;
clocks = <&clkc CLKID_MPLL0
&clkc CLKID_FCLK_DIV4
&clkaudio CLKID_AUDIO_SPDIFIN
&clkaudio CLKID_AUDIO_SPDIFOUT
&clkaudio CLKID_AUDIO_SPDIFIN_CTRL
&clkaudio CLKID_AUDIO_SPDIFOUT_CTRL>;
clock-names = "sysclk", "fixed_clk", "gate_spdifin",
"gate_spdifout", "clk_spdifin", "clk_spdifout";
interrupts = <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "irq_spdifin";
pinctrl-names = "spdif_pins";
pinctrl-0 = <&spdifout>;
status = "okay";
};
aml_spdif_b: spdif_b {
compatible = "amlogic, g12a-snd-spdif-b";
#sound-dai-cells = <0>;
Expand All @@ -381,8 +375,6 @@
&clkaudio CLKID_AUDIO_SPDIFOUTB_CTRL>;
clock-names = "sysclk",
"gate_spdifout", "clk_spdifout";
pinctrl-names = "spdif_pins";
pinctrl-0 = <&spdifout>;
status = "okay";
};
aml_loopback: loopback {
Expand Down Expand Up @@ -473,32 +465,6 @@
drive-strength = <3>;
};
};
tdmb_mclk: tdmb_mclk {
mux {
groups = "mclk0_a";
function = "mclk0";
drive-strength = <2>;
};
};
tdmout_b: tdmout_b {
mux { /* GPIOA_1, GPIOA_2, GPIOA_3 */
groups = "tdmb_sclk",
"tdmb_fs",
"tdmb_dout0";
function = "tdmb_out";
drive-strength = <2>;
};
};

tdmin_b:tdmin_b {
mux { /* GPIOA_4 */
groups = "tdmb_din1"
/*,"tdmb_slv_sclk", "tdmb_slv_fs"*/;
function = "tdmb_in";
drive-strength = <2>;
};
};

spdifout: spdifout {
mux {/* GPIOA_11 */
groups = "spdif_out_a11";
Expand Down
11 changes: 11 additions & 0 deletions sound/soc/amlogic/auge/spdif.c
Expand Up @@ -951,12 +951,23 @@ static int aml_dai_spdif_prepare(
spdif_get_channel_status_info(&chsts, runtime->rate);
spdif_set_channel_status_info(&chsts, p_spdif->id);

#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
/* TOHDMITX_CTRL0
* ODROID is spdif_b only would notify to hdmitx
*/
if (p_spdif->id == 1) {
spdifout_to_hdmitx_ctrl(p_spdif->id);
/* notify to hdmitx */
spdif_notify_to_hdmitx(substream);
}
#else
/* TOHDMITX_CTRL0
* Both spdif_a/spdif_b would notify to hdmitx
*/
spdifout_to_hdmitx_ctrl(p_spdif->id);
/* notify to hdmitx */
spdif_notify_to_hdmitx(substream);
#endif

} else {
struct toddr *to = p_spdif->tddr;
Expand Down
7 changes: 7 additions & 0 deletions sound/soc/amlogic/auge/spdif_hw.c
Expand Up @@ -611,8 +611,15 @@ void spdifout_play_with_zerodata(unsigned int spdif_id)

/* spdif clk */
spdifout_clk_ctrl(spdif_id, true);

#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
/* ODROID spdif_b only to hdmitx */
if (spdif_id == 1)
spdifout_to_hdmitx_ctrl(spdif_id);
#else
/* spdif to hdmitx */
spdifout_to_hdmitx_ctrl(spdif_id);
#endif

/* spdif ctrl */
spdifout_fifo_ctrl(spdif_id, frddr_index, bitwidth);
Expand Down

0 comments on commit 25a4db2

Please sign in to comment.