//frame-inversion;
//bitclock-master = <&tdmacodec>;
//frame-master = <&tdmacodec>;
+ /* suffix-name, sync with android audio hal
+ * what's the dai link used for
+ */
+ suffix-name = "alsaPORT-pcm";
tdmacpu: cpu {
sound-dai = <&aml_tdma>;
dai-tdm-slot-tx-mask =
frame-master = <&aml_tdmb>;
//bitclock-master = <&tdmbcodec>;
//frame-master = <&tdmbcodec>;
+ /* suffix-name, sync with android audio hal
+ * what's the dai link used for
+ */
+ suffix-name = "alsaPORT-i2s";
cpu {
sound-dai = <&aml_tdmb>;
};
tdmbcodec: codec {
sound-dai = <&dummy_codec &dummy_codec
- &amlogic_codec /*&ad82584f_62*/>;
+ &amlogic_codec &ad82584f_62>;
};
};
//frame-inversion;
bitclock-master = <&aml_tdmc>;
frame-master = <&aml_tdmc>;
+ /* suffix-name, sync with android audio hal
+ * what's the dai link used for
+ */
+ //suffix-name = "alsaPORT-tdm";
cpu {
sound-dai = <&aml_tdmc>;
dai-tdm-slot-tx-mask = <1 1>;
aml-audio-card,dai-link@3 {
mclk-fs = <64>;
+ /* suffix-name, sync with android audio hal
+ * what's the dai link used for
+ */
+ suffix-name = "alsaPORT-pdm";
cpu {
sound-dai = <&aml_pdm>;
};
aml-audio-card,dai-link@4 {
mclk-fs = <128>;
+ /* suffix-name, sync with android audio hal
+ * what's the dai link used for
+ */
+ suffix-name = "alsaPORT-spdif";
cpu {
sound-dai = <&aml_spdif>;
system-clock-frequency = <6144000>;
};
aml-audio-card,dai-link@5 {
mclk-fs = <128>;
+ /* suffix-name, sync with android audio hal
+ * what's the dai link used for
+ */
+ suffix-name = "alsaPORT-hdmi";
cpu {
sound-dai = <&aml_spdif_b>;
system-clock-frequency = <6144000>;
dai-tdm-lane-slot-mask-out = <1 0 0 0>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
- &clkc CLKID_MPLL1>;
- clock-names = "mclk", "clk_srcpll";
+ &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>;
/*
struct aml_card_data {
struct snd_soc_card snd_card;
struct aml_dai_props {
+ /* sync with android audio hal,
+ * dai link is used for which output,
+ */
+ const char *suffix_name;
+
struct aml_dai cpu_dai;
struct aml_dai codec_dai;
unsigned int mclk_fs;
if (ret < 0)
goto dai_link_of_err;
- ret = aml_card_set_dailink_name(dev, dai_link,
- "%s-%s",
- dai_link->cpu_dai_name,
- dai_link->codecs->dai_name);
+ /* sync with android audio hal, what's the link used for. */
+ of_property_read_string(node, "suffix-name", &dai_props->suffix_name);
+
+ if (dai_props->suffix_name)
+ ret = aml_card_set_dailink_name(dev, dai_link,
+ "%s-%s-%s",
+ dai_link->cpu_dai_name,
+ dai_link->codecs->dai_name,
+ dai_props->suffix_name);
+ else
+ ret = aml_card_set_dailink_name(dev, dai_link,
+ "%s-%s",
+ dai_link->cpu_dai_name,
+ dai_link->codecs->dai_name);
if (ret < 0)
goto dai_link_of_err;
reg = calc_frddr_address(EE_AUDIO_FRDDR_A_CTRL0, reg_base);
aml_audiobus_update_bits(actrl, reg, 1<<31, enable<<31);
+ if (!enable)
+ aml_audiobus_write(actrl, reg, 0x0);
+
/* check for Audio EQ/DRC */
aml_check_aed(enable, fr->dest);
}
return 0;
}
+
+void sharebuffer_get_mclk_fs_ratio(int samesource_sel,
+ int *pll_mclk_ratio, int *mclk_fs_ratio)
+{
+ if (samesource_sel < 0) {
+ pr_err("Not support same source\n");
+ } else if (samesource_sel < 3) {
+ // TODO: same with tdm
+ } else if (samesource_sel < 5) {
+ /* spdif a/b */
+ *pll_mclk_ratio = 4;
+ *mclk_fs_ratio = 128;
+ }
+}
void *pfrddr, int samesource_sel);
extern int sharebuffer_trigger(int cmd, int samesource_sel);
+extern void sharebuffer_get_mclk_fs_ratio(int samesource_sel,
+ int *pll_mclk_ratio, int *mclk_fs_ratio);
#endif
struct clk *clk;
struct clk *clk_gate;
struct clk *mclk;
+ struct clk *samesrc_sysclk;
bool contns_clk;
unsigned int id;
/* bclk src selection */
return ret;
}
+ /* share buffer trigger */
+ if (p_tdm->chipinfo
+ && (p_tdm->chipinfo->same_src_fn)
+ && (p_tdm->samesource_sel >= 0)) {
+ int mux = 0, ratio = 0;
+
+ sharebuffer_get_mclk_fs_ratio(p_tdm->samesource_sel,
+ &mux, &ratio);
+ pr_info("samesource sysclk:%d\n", rate * ratio * mux);
+ if (p_tdm->samesrc_sysclk)
+ clk_set_rate(p_tdm->samesrc_sysclk,
+ rate * ratio * mux);
+ }
+
return 0;
}
/* default no same source */
if (p_tdm->chipinfo &&
p_tdm->chipinfo->same_src_fn) {
+
ret = of_property_read_u32(node, "samesource_sel",
&p_tdm->samesource_sel);
if (ret < 0)
p_tdm->samesource_sel = -1;
-
+ else {
+ p_tdm->samesrc_sysclk = devm_clk_get(&pdev->dev,
+ "samesource_sysclk");
+ if (IS_ERR(p_tdm->samesrc_sysclk)) {
+ dev_err(&pdev->dev,
+ "Can't retrieve samesrc_sysclk clock\n");
+ return PTR_ERR(p_tdm->samesrc_sysclk);
+ }
+ }
pr_info("TDM id %d samesource_sel:%d\n",
p_tdm->id,
p_tdm->samesource_sel);