#ifdef CONFIG_AMLOGIC_HDMITX
#include <linux/amlogic/media/vout/hdmi_tx/hdmi_tx_ext.h>
#endif
+#include "spdif_dai.h"
#define DRV_NAME "spdif-dit"
"audio_spdif_out_mute");
if (IS_ERR(v_spdif_codec.p_pinctrl_out_mute_state)) {
devm_pinctrl_put(v_spdif_codec.p_pinctrl_out_mute);
+ v_spdif_codec.p_pinctrl_out_mute_state = NULL;
dev_err(dev, "audio_spdif_out_mute can't get pinctrl\n");
}
}
"audio_spdif_out");
if (IS_ERR(v_spdif_codec.p_pinctrl_out_state)) {
devm_pinctrl_put(v_spdif_codec.p_pinctrl_out);
+ v_spdif_codec.p_pinctrl_out_state = NULL;
dev_err(dev, "audio_spdif_out can't get pinctrl\n");
}
}
return 0;
}
+static const char *const spdif_format_texts[10] = {
+ "2 CH PCM", "DTS RAW Mode", "Dolby Digital", "DTS",
+ "DD+", "DTS-HD", "Multi-channel LPCM", "TrueHD", "DTS-HD MA",
+ "HIGH SR Stereo LPCM"
+};
+
+static const struct soc_enum spdif_format_enum =
+ SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(spdif_format_texts),
+ spdif_format_texts);
+
+static int spdif_format_get_enum(
+ struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ ucontrol->value.enumerated.item[0] = IEC958_mode_codec;
+ return 0;
+}
+
+static int spdif_format_set_enum(
+ struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ int index = ucontrol->value.enumerated.item[0];
+
+ if (index >= 10) {
+ pr_err("bad parameter for spdif format set\n");
+ return -1;
+ }
+ IEC958_mode_codec = index;
+ return 0;
+}
+
#ifdef CONFIG_AMLOGIC_HDMITX
/* call HDMITX API to enable/disable internal audio out */
static int aml_get_hdmi_out_audio(struct snd_kcontrol *kcontrol,
static const struct snd_kcontrol_new spdif_controls[] = {
SOC_SINGLE_BOOL_EXT("Audio spdif mute",
- 0, aml_audio_get_spdif_mute,
- aml_audio_set_spdif_mute),
+ 0, aml_audio_get_spdif_mute,
+ aml_audio_set_spdif_mute),
+ SOC_ENUM_EXT("Audio spdif format",
+ spdif_format_enum,
+ spdif_format_get_enum,
+ spdif_format_set_enum),
#ifdef CONFIG_AMLOGIC_HDMITX
SOC_SINGLE_BOOL_EXT("Audio hdmi-out mute",
0, aml_get_hdmi_out_audio,
{0x00800000, 0x0, 0x0, 0x0, 0x0},
};
-static int DRC0_enable(int enable)
-{
- if (enable == 1) {
- aml_eqdrc_write(AED_DRC_THD0, aml_drc_tko_table[2]);
- aml_eqdrc_write(AED_DRC_K0, aml_drc_tko_table[4]);
- } else {
- aml_eqdrc_write(AED_DRC_THD0, 0xbf000000);
- aml_eqdrc_write(AED_DRC_K0, 0x40000);
- }
- return 0;
-}
-
static const char *const audio_in_source_texts[] = {
"LINEIN", "ATV", "HDMI", "SPDIFIN" };
| (channel_1_volume << 8) /* channel 1 volume: 0dB*/
| (channel_2_volume << 0) /* channel 2 volume: 0dB*/
);
- aml_eqdrc_write(AED_EQ_VOLUME_SLEW_CNT, 0x40);
+ /*fast attrack*/
+ aml_eqdrc_write(AED_EQ_VOLUME_SLEW_CNT, 0x5);
aml_eqdrc_write(AED_MUTE, 0);
return 0;
}
if (audin_src == 0) {
/* select external codec ADC as I2S source */
aml_audin_update_bits(AUDIN_SOURCE_SEL, 3, 0);
-
- External_Mute(0);
} else if (audin_src == 1) {
/* select ATV output as I2S source */
aml_audin_update_bits(AUDIN_SOURCE_SEL, 3, 1);
-
- External_Mute(0);
} else if (audin_src == 2) {
/* select HDMI-rx as Audio In source */
/* [14:12]cntl_hdmirx_chsts_sel: */
0);
} else if (audin_src == 3) {
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x3 << 4, 0);
-
- External_Mute(0);
}
return 0;
if (audin_src == 0) {
/* select internal codec ADC in TXL as I2S source */
aml_audin_update_bits(AUDIN_SOURCE_SEL, 3, 3);
-
- DRC0_enable(1);
- External_Mute(0);
} else if (audin_src == 1) {
/* select ATV output as I2S source */
aml_audin_update_bits(AUDIN_SOURCE_SEL, 3, 1);
-
- DRC0_enable(1);
- External_Mute(0);
} else if (audin_src == 2) {
/* select HDMI-rx as Audio In source */
/* [14:12]cntl_hdmirx_chsts_sel: */
0xf << 8);
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x7 << 12,
0);
- DRC0_enable(0);
} else if (audin_src == 3) {
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x3 << 4, 0);
- DRC0_enable(0);
- External_Mute(0);
}
return 0;
/* select internal codec ADC in TXLX as HDMI-i2s*/
aml_audin_update_bits(AUDIN_SOURCE_SEL, 3 << 16,
3 << 16);
-
- DRC0_enable(1);
- External_Mute(0);
} else if (audin_src == 1) {
/* select ATV output as I2S source */
- DRC0_enable(1);
- External_Mute(0);
} else if (audin_src == 2) {
/* select HDMI-rx as Audio In source */
/* [14:12]cntl_hdmirx_chsts_sel: */
/* 1=Select HDMIRX SPDIF output as AUDIN source */
/* [1:0] i2sin_src_sel: */
/* 2=Select HDMIRX I2S output as AUDIN source */
- aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x3, 2);
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x3 << 4,
1 << 4);
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0xf << 8,
0xf << 8);
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x7 << 12,
0);
- DRC0_enable(0);
} else if (audin_src == 3) {
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x3 << 4, 0);
- DRC0_enable(0);
- External_Mute(0);
}
return 0;
/* select internal codec ADC in TXLX as HDMI-i2s*/
aml_audin_update_bits(AUDIN_SOURCE_SEL, 3 << 16,
3 << 16);
-
- DRC0_enable(1);
- External_Mute(0);
} else if (audin_src == 1) {
/* select ATV output as I2S source */
-
- DRC0_enable(1);
- External_Mute(0);
} else if (audin_src == 2) {
/* select HDMI-rx as Audio In source */
/* [14:12]cntl_hdmirx_chsts_sel: */
/* 1=Select HDMIRX SPDIF output as AUDIN source */
/* [1:0] i2sin_src_sel: */
/* 2=Select HDMIRX I2S output as AUDIN source */
-
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x3 << 4,
1 << 4);
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0xf << 8,
0xf << 8);
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x7 << 12,
0);
- DRC0_enable(0);
} else if (audin_src == 3) {
aml_audin_update_bits(AUDIN_SOURCE_SEL, 0x3 << 4, 0);
- DRC0_enable(0);
- External_Mute(0);
}
return 0;