F: include/dt-bindings/clock/amlogic,g12a-audio-clk.h
F: include/linux/amlogic/media/sound/auge_utils.h
F: sound/soc/amlogic/auge/*
-F: sound/soc/codecs/amlogic/aml_codec_t9015.c
+F: sound/soc/amlogic/common/*
+F: sound/soc/codecs/amlogic/aml_codec_t9015.c
\ No newline at end of file
compatible = "amlogic, aml_codec_T9015";
reg = <0x0 0xFF632000 0x0 0x2000>;
is_auge_used = <1>; /* meson or auge chipset used */
- tdmout_index = <0>;
- status = "disabled";
+ tdmout_index = <1>;
+ status = "okay";
};
auge_sound {
compatible = "amlogic, g12a-sound-card";
aml-audio-card,name = "AML-AUGESOUND";
+ aml-audio-card,aux-devs = <&amlogic_codec>;
+ /*avout mute gpio*/
+ avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
+
aml-audio-card,dai-link@0 {
format = "dsp_a";
mclk-fs = <512>;
system-clock-frequency = <12288000>;
};
codec {
- sound-dai = <&dummy_codec &dummy_codec>;
+ sound-dai = <&dummy_codec &amlogic_codec>;
};
};
/* Audio Related end */
}; /* end of / */
+&i2c3 {
+ status = "okay";
+ pinctrl-names="default";
+ pinctrl-0=<&c_i2c_master_pin1>;
+
+ tas5707_36: tas5707_36@36 {
+ compatible = "ti,tas5707";
+ #sound-dai-cells = <0>;
+ reg = <0x1b>;
+ status = "disabled";
+ reset_pin = <&gpio GPIOA_5 0>;
+ };
+
+};
+
&audiobus {
aml_tdma: tdma {
compatible = "amlogic, g12a-snd-tdma";
aml_tdmb: tdmb {
compatible = "amlogic, g12a-snd-tdmb";
#sound-dai-cells = <0>;
- dai-tdm-lane-slot-mask-in = <1 1 1 1>;
+ 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>;
clock-names = "mclk", "clk_srcpll";
pinctrl-names = "tdm_pins";
- pinctrl-0 = <&tdmb_mclk /*&tdmout_b &tdmin_b*/>;
+ pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
};
aml_tdmc: tdmc {
clock-names = "sysclk", "fixed_clk", "gate_spdifin",
"gate_spdifout", "clk_spdifin", "clk_spdifout";
interrupts =
- <GIC_SPI 87 IRQ_TYPE_EDGE_RISING>;
+ <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "irq_spdifin";
pinctrl-names = "spdif_pins";
&clkaudio CLKID_AUDIO_SPDIFOUTB_CTRL>;
clock-names = "sysclk",
"gate_spdifout", "clk_spdifout";
- pinctrl-names = "spdif_pins";
- pinctrl-0 = <&spdifout_b>;
+ //pinctrl-names = "spdif_pins";
+ //pinctrl-0 = <&spdifout>;
status = "okay";
};
aml_pdm: pdm {
};
};
tdmout_b: tdmout_b {
- mux { /* GPIOA_1, GPIOA_2 */
+ mux { /* GPIOA_1, GPIOA_2, GPIOA_3 */
groups = "tdmb_sclk",
- "tdmb_fs";
+ "tdmb_fs",
+ "tdmb_dout0";
function = "tdmb_out";
};
};
tdmin_b:tdmin_b {
- mux { /* GPIOA_3, GPIOA_4 */
- groups = "tdmb_din0",
- "tdmb_din1";
+ mux { /* GPIOA_4 */
+ groups = "tdmb_din1";
function = "tdmb_in";
};
};
mux { /* GPIOA_12, GPIOA_13, GPIOA_10, GPIOA_8, GPIOA_7*/
groups = "tdmc_sclk_a",
"tdmc_fs_a",
- "tdmc_dout0"
+ "tdmc_dout0_a"
/*, "tdmc_dout2",
* "tdmc_dout3"
*/;
};
};
- spdifout: spdifout {
- mux {/* GPIOH_4 */
- groups = " spdif_out_h";
- function = "spdif_out";
- };
- };
+ /* GPIOH_4 */
+ /*
+ * spdifout: spdifout {
+ * mux {
+ * groups = "spdif_out_h";
+ * function = "spdif_out";
+ * };
+ *};
+ */
pdmin: pdmin {
mux { /* gpioa_5, gpioa_6, gpioa_7, gpioa_8, gpioa_9*/
groups = "pdm_din0_a",
- "pdm_din1_a",
+ /*"pdm_din1_a",*/
"pdm_din2_a",
"pdm_din3_a",
"pdm_dclk_a";
}; /* end of pinctrl_periphs */
&pinctrl_aobus {
- spdifout_b: spdifout_b {
+ spdifout: spdifout {
mux { /* gpiao_10 */
groups = "spdif_out_ao";
function = "spdif_out_ao";
function = "pwm_e";
};
};
+
+ c_i2c_master_pin1:c_i2c_pin1 {
+ mux {
+ groups = "i2c3_sck_a",
+ "i2c3_sda_a";
+ function = "i2c3";
+ };
+ };
};
&pinctrl_aobus {
CONFIG_AMLOGIC_SND_SOC=y
CONFIG_AMLOGIC_SND_SOC_MESON=y
CONFIG_AMLOGIC_SND_SOC_AUGE=y
+CONFIG_AMLOGIC_SND_SOC_COMMON=y
CONFIG_AMLOGIC_SND_SPLIT_MODE=y
CONFIG_HIDRAW=y
CONFIG_UHID=y
# All the supported SoCs
source "sound/soc/amlogic/meson/Kconfig"
source "sound/soc/amlogic/auge/Kconfig"
+source "sound/soc/amlogic/common/Kconfig"
endif # AMLOGIC_SND_SOC
obj-$(CONFIG_AMLOGIC_SND_SOC) += meson/
obj-$(CONFIG_AMLOGIC_SND_SOC) += auge/
+obj-$(CONFIG_AMLOGIC_SND_SOC) += common/
// TODO: check skew for g12a
audiobus_write(EE_AUDIO_TOACODEC_CTRL0,
1 << 31
- | tdmout_id << 12 /* data 0*/
+ | ((tdmout_id << 2)) << 12 /* data 0*/
| tdmout_id << 8 /* lrclk */
+ | 1 << 7 /* Bclk_cap_inv*/
| tdmout_id << 4 /* bclk */
| tdmout_id << 0 /* mclk */
);
struct snd_soc_dai_link *dai_link;
int spk_mute_gpio;
bool spk_mute_active_low;
+ struct gpio_desc *avout_mute_desc;
struct loopback_cfg lb_cfg;
struct timer_list timer;
struct work_struct work;
ARRAY_SIZE(card_controls));
}
+ priv->avout_mute_desc = gpiod_get(dev,
+ "avout_mute",
+ GPIOD_OUT_HIGH);
+
+ gpiod_direction_output(priv->avout_mute_desc,
+ GPIOF_OUT_INIT_HIGH);
+ pr_info("set av out GPIOF_OUT_INIT_HIGH!\n");
+
return 0;
}
#define PDM_MUTE_VALUE 0x00d
/* clk pad */
-#define EE_AUDIO_MST_PAD_CTRL 0x007
+#define EE_AUDIO_MST_PAD_CTRL0 0x007
+#define EE_AUDIO_MST_PAD_CTRL1 0x008
+#define EE_AUDIO_SW_RESET 0x009
/* spdifout_b clk*/
#define EE_AUDIO_CLK_SPDIFOUT_B_CTRL 0x02d
#include "spdif_hw.h"
#include "audio_utils.h"
+#include <linux/amlogic/media/sound/aout_notify.h>
+
#define DRV_NAME "aml_spdif"
#define SPDIF_A 0
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
struct frddr *fr = p_spdif->fddr;
+ enum frddr_dest dst;
+
+ switch (p_spdif->id) {
+ case 0:
+ dst = SPDIFOUT;
+ break;
+ case 1:
+ dst = SPDIFOUT_B;
+ break;
+ default:
+ dev_err(p_spdif->dev, "invalid id: %d\n", p_spdif->id);
+ return -EINVAL;
+ }
fifo_id = aml_frddr_get_fifo_id(fr);
- aml_frddr_select_dst(fr, SPDIFOUT);
+ aml_frddr_select_dst(fr, dst);
aml_frddr_set_fifos(fr, 0x40, 0x20);
+
+ // TODO: TOHDMITX_CTRL0
+ if (p_spdif->id == 1) {
+ /* HDMI audio stream type ID */
+ #define AOUT_EVENT_IEC_60958_PCM 0x1
+
+ spdifoutb_to_hdmitx_ctrl();
+ aout_notifier_call_chain(AOUT_EVENT_IEC_60958_PCM,
+ substream);
+ }
} else {
struct toddr *to = p_spdif->tddr;
unsigned int msb, lsb, toddr_type;
static struct snd_soc_dai_driver aml_spdif_dai[] = {
{
.name = "SPDIF",
- .id = 0,
+ .id = 1,
.probe = aml_dai_spdif_probe,
.remove = aml_dai_spdif_remove,
.playback = {
},
{
.name = "SPDIF-B",
- .id = 1,
+ .id = 2,
.probe = aml_dai_spdif_probe,
.remove = aml_dai_spdif_remove,
.playback = {
if (p_spdif->irq_spdifin < 0)
dev_err(dev, "platform_get_irq_byname failed\n");
+ /* spdif pinmux */
+ p_spdif->pin_ctl = devm_pinctrl_get_select(dev, "spdif_pins");
+ if (IS_ERR(p_spdif->pin_ctl)) {
+ dev_info(dev, "aml_spdif_get_pins error!\n");
+ return PTR_ERR(p_spdif->pin_ctl);
+ }
}
/* clock for spdif in */
return ret;
}
- /* spdif pinmux */
- p_spdif->pin_ctl = devm_pinctrl_get_select(dev, "spdif_pins");
- if (IS_ERR(p_spdif->pin_ctl)) {
- dev_info(dev, "aml_spdif_get_pins error!\n");
- return PTR_ERR(p_spdif->pin_ctl);
- }
-
return 0;
}
} else
dev_warn_once(dev,
"check whether to update spdif chipinfo\n");
+
pr_info("%s, spdif ID = %u\n", __func__, aml_spdif->id);
/* get audio controller */
if (frddrtype)
*frddrtype = (val >> 4) & 0x7;
}
+
+void spdifoutb_to_hdmitx_ctrl(void)
+{
+ audiobus_write(EE_AUDIO_TOHDMITX_CTRL0,
+ 1 << 31
+ | 0 << 2 /* spdif_clk_inv */
+ | 1 << 1 /* spdif_out_b */
+ | 1 << 0 /* spdif_clk_b */
+ );
+}
extern void aml_spdifout_get_aed_info(int spdifout_id,
int *bitwidth, int *frddrtype);
+extern void spdifoutb_to_hdmitx_ctrl(void);
#endif
/* output en (oe) for pinmux */
bool oe_fn;
+
+ /* clk pad */
+ bool clk_pad_ctl;
};
struct aml_tdm {
stream, p_tdm->id, swap_val);
}
+
+ return 0;
+}
+
+static int aml_tdm_set_clk_pad(struct aml_tdm *p_tdm)
+{
+ unsigned int mpad, mclk_sel;
+
+ // TODO: update pad
+ if (p_tdm->id >= 1) {
+ mpad = p_tdm->id - 1;
+ mclk_sel = p_tdm->id;
+ } else {
+ mpad = 0;
+ mclk_sel = 0;
+ }
+
+ /* clk pad */
+ aml_tdm_clk_pad_select(p_tdm->actrl, mpad, mclk_sel,
+ p_tdm->id, p_tdm->clk_sel);
+
return 0;
}
if (ret)
return ret;
+ if (p_tdm->chipinfo && p_tdm->chipinfo->clk_pad_ctl) {
+ ret = aml_tdm_set_clk_pad(p_tdm);
+ if (ret)
+ return ret;
+ }
+
return 0;
}
.id = TDM_A,
.sclk_ws_inv = true,
.oe_fn = true,
+ .clk_pad_ctl = true,
};
struct tdm_chipinfo g12a_tdmb_chipinfo = {
.id = TDM_B,
.sclk_ws_inv = true,
.oe_fn = true,
+ .clk_pad_ctl = true,
};
struct tdm_chipinfo g12a_tdmc_chipinfo = {
.id = TDM_C,
.sclk_ws_inv = true,
.oe_fn = true,
+ .clk_pad_ctl = true,
};
-
static const struct of_device_id aml_tdm_device_id[] = {
{
.compatible = "amlogic, axg-snd-tdma",
if (frddrtype)
*frddrtype = (val >> 4) & 0x7;
}
+
+void aml_tdm_clk_pad_select(
+ struct aml_audio_controller *actrl,
+ int mpad, int mclk_sel,
+ int tdm_index, int clk_sel)
+{
+ unsigned int reg, mask_offset, val_offset;
+
+ // TODO: fix mclk
+ if (mpad == 0) {
+ mask_offset = 0x7 << 0;
+ val_offset = mclk_sel << 0;
+ } else if (mpad == 1) {
+ mask_offset = 0x7 << 4;
+ val_offset = mclk_sel << 4;
+ } else {
+ pr_err("unknown tdm mpad:%d\n", mpad);
+ return;
+ }
+ reg = EE_AUDIO_MST_PAD_CTRL0;
+ aml_audiobus_update_bits(actrl, reg,
+ mask_offset, val_offset);
+
+ reg = EE_AUDIO_MST_PAD_CTRL1;
+ switch (tdm_index) {
+ case 0:
+ mask_offset = 0x7 << 16 | 0x7 << 0;
+ val_offset = clk_sel << 16 | clk_sel << 0;
+ break;
+ case 1:
+ mask_offset = 0x7 << 20 | 0x7 << 4;
+ val_offset = clk_sel << 20 | clk_sel << 4;
+ break;
+ case 2:
+ mask_offset = 0x7 << 24 | 0x7 << 8;
+ val_offset = clk_sel << 24 | clk_sel << 8;
+ break;
+ default:
+ pr_err("unknown tdm index:%d\n", tdm_index);
+ return;
+ }
+ aml_audiobus_update_bits(actrl, reg,
+ mask_offset, val_offset);
+
+}
extern void aml_tdmout_get_aed_info(int tdmout_id,
int *bitwidth, int *frddrtype);
+extern void aml_tdm_clk_pad_select(
+ struct aml_audio_controller *actrl,
+ int mpad, int mclk_sel,
+ int tdm_index, int clk_sel);
#endif
--- /dev/null
+menuconfig AMLOGIC_SND_SOC_COMMON
+ bool "Amlogic Common for ASoC"
+ default n
+ help
+ Say Y or M if you want to add support for common interface attached to
+ the Amlogic Asoc interface. You will also need
+ to select the audio interfaces to support below.
--- /dev/null
+obj-y += notify.o
obj-$(CONFIG_AMLOGIC_SND_SOC_MESON) += snd-soc-i2s2-dai.o
obj-$(CONFIG_AMLOGIC_SND_SOC_MESON) += snd-soc-pcm-dai.o
obj-$(CONFIG_AMLOGIC_SND_SOC_MESON) += snd-soc-hw.o
-obj-$(CONFIG_AMLOGIC_SND_SOC_MESON) += notify.o
obj-$(CONFIG_AMLOGIC_SND_SOC_MESON) += snd-soc-hw-pcm2bt.o
obj-$(CONFIG_AMLOGIC_SND_SOC_MESON) += snd-soc-spdif-dai.o
obj-$(CONFIG_AMLOGIC_SND_SOC_MESON) += snd-soc-dmic.o