Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and TLV320AIC3x support for M8 audio #7

Open
wants to merge 4 commits into
base: Nougat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Documentation/devicetree/bindings/sound/tlv320aic3x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Required properties:

- compatible - "string" - One of:
"ti,tlv320aic3x" - Generic TLV320AIC3x device
"ti,tlv320aic32x4" - TLV320AIC32x4
"ti,tlv320aic33" - TLV320AIC33
"ti,tlv320aic3007" - TLV320AIC3007
"ti,tlv320aic3106" - TLV320AIC3106
"ti,tlv320aic3104" - TLV320AIC3104


- reg - <int> - I2C slave address
Expand All @@ -19,6 +19,7 @@ Optional properties:

- gpio-reset - gpio pin number used for codec reset
- ai3x-gpio-func - <array of 2 int> - AIC3X_GPIO1 & AIC3X_GPIO2 Functionality
- Not supported on tlv320aic3104
- ai3x-micbias-vg - MicBias Voltage required.
1 - MICBIAS output is powered to 2.0V,
2 - MICBIAS output is powered to 2.5V,
Expand All @@ -37,7 +38,13 @@ CODEC output pins:
* HPLCOM
* HPRCOM

CODEC input pins:
CODEC input pins for TLV320AIC3104:
* MIC2L
* MIC2R
* LINE1L
* LINE1R

CODEC input pins for other compatible codecs:
* MIC3L
* MIC3R
* LINE1L
Expand Down
1 change: 1 addition & 0 deletions sound/soc/aml/m8/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ menuconfig SND_AML_M8
select SND_SOC_AMLT9015S
select SND_SOC_AMLTXLX_ACODEC
select SND_SOC_TLV320AIC32X4
select SND_SOC_TLV320AIC3X

if SND_AML_M8

Expand Down
23 changes: 13 additions & 10 deletions sound/soc/aml/m8/aml_m8.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ static int aml_m8_set_spk(struct snd_kcontrol *kcontrol,

msleep_interruptible(10);
if (!IS_ERR(p_audio->mute_desc))
gpiod_direction_output(p_audio->mute_desc, aml_m8_spk_enabled);
gpiod_direction_output(p_audio->mute_desc,
!aml_m8_spk_enabled != !p_audio->mute_inv ?
GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH);

if (aml_m8_spk_enabled == 1)
msleep_interruptible(100);
Expand Down Expand Up @@ -312,7 +314,6 @@ static int aml_resume_post(struct snd_soc_card *card)
{
struct aml_audio_private_data *p_aml_audio;
struct pinctrl_state *state;
int val = 0;

pr_info("enter %s\n", __func__);
p_aml_audio = snd_soc_card_get_drvdata(card);
Expand All @@ -339,9 +340,9 @@ static int aml_resume_post(struct snd_soc_card *card)
if (!IS_ERR(p_aml_audio->mute_desc)) {
if (p_aml_audio->sleep_time)
msleep(p_aml_audio->sleep_time);
val = p_aml_audio->mute_inv ?
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
gpiod_direction_output(p_aml_audio->mute_desc, val);
gpiod_direction_output(p_aml_audio->mute_desc,
!aml_m8_spk_enabled != !p_aml_audio->mute_inv ?
GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH);
}
return 0;
}
Expand All @@ -359,15 +360,15 @@ static int speaker_events(struct snd_soc_dapm_widget *w,
case SND_SOC_DAPM_POST_PMU:
pr_info("audio speaker on\n");
val = p_audio->mute_inv ?
GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH;
gpiod_direction_output(p_audio->mute_desc, 1);
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
gpiod_direction_output(p_audio->mute_desc, val);
aml_m8_spk_enabled = 1;
msleep(p_audio->sleep_time);
break;
case SND_SOC_DAPM_PRE_PMD:
pr_info("audio speaker off\n");
val = p_audio->mute_inv ?
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH;
gpiod_direction_output(p_audio->mute_desc, val);
aml_m8_spk_enabled = 0;
break;
Expand Down Expand Up @@ -572,7 +573,7 @@ static void aml_m8_pinmux_init(struct snd_soc_card *card)
if (p_aml_audio->sleep_time)
msleep(p_aml_audio->sleep_time);
val = p_aml_audio->mute_inv ?
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH;
gpiod_direction_output(p_aml_audio->mute_desc, val);
}

Expand Down Expand Up @@ -864,8 +865,10 @@ static int aml_card_dais_parse_of(struct snd_soc_card *card)
ret =
aml_card_dai_parse_of(dev, &dai_links[i], init, cpu_node,
codec_node, plat_node);
if (ret < 0)
return ret;
}
if (NULL != strstr(dai_links[0].codec_dai_name, "tlv320aic32x4"))
if (NULL != strstr(dai_links[0].codec_dai_name, "tlv320"))
dai_links[0].ops = &aml_asoc_ops;

err:
Expand Down
Loading