Skip to content

ASoC: tegra: event based gpio control does not work #130

Closed

Description

@clamor-s

static int tegra_machine_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
struct snd_soc_dapm_context *dapm = w->dapm;
struct tegra_machine *machine = snd_soc_card_get_drvdata(dapm->card);
if (machine->asoc->dapm_event) {
int ret = machine->asoc->dapm_event(w, k, event);
if (ret <= 0)
return ret;
}
if (!strcmp(w->name, "Int Spk") || !strcmp(w->name, "Speakers"))
gpiod_set_value_cansleep(machine->gpiod_spkr_en,
SND_SOC_DAPM_EVENT_ON(event));
if (!strcmp(w->name, "Mic Jack"))
gpiod_set_value_cansleep(machine->gpiod_ext_mic_en,
SND_SOC_DAPM_EVENT_ON(event));
if (!strcmp(w->name, "Int Mic"))
gpiod_set_value_cansleep(machine->gpiod_int_mic_en,
SND_SOC_DAPM_EVENT_ON(event));
if (!strcmp(w->name, "Headphone") || !strcmp(w->name, "Headphone Jack"))
gpiod_set_value_cansleep(machine->gpiod_hp_mute,
!SND_SOC_DAPM_EVENT_ON(event));
return 0;
}

I am binding here https://github.com/clamor-s/linux/blob/p895/arch/arm/boot/dts/tegra30-lge-p895.dts#L1825-L1826 gpios, required for mics to work. If I just bind them as hogs everything is fine, but once I bind them inside tegra_asoc both mics fail.

Activity

  1. changed the title [-]Event based gpio control does not work[/-] [+]ASoC: tegra: event based gpio control does not work[/+] on Sep 24, 2022
  2. digetx commented on Oct 1, 2022

    @digetx
    Member

    You don't have Mic Jack and Int Mic in nvidia,audio-routing. DTB checker should tell you about the error.

  3. clamor-s commented on Oct 1, 2022

    @clamor-s
    MemberAuthor

    So I need to route audio via those in dts? Isn't enabling those in alsa ucm enough?

  4. digetx commented on Oct 1, 2022

    @digetx
    Member

    Although, the DT seems okay. There are no event handlers set up for Internal Mic 1 and Internal Mic 2 in the machine driver.

    You could either add tegra_machine_event() for Internal Mic 1 and Internal Mic 2 or use Mic Jack and Int Mic in the routing instead of Internal Mic 1/2.

  5. clamor-s commented on Oct 1, 2022

    @clamor-s
    MemberAuthor

    I would like to, but I have too much audio devices to handle since it is a phone. I will add tegra_machine_event() if you do not mind.

  6. digetx commented on Oct 1, 2022

    @digetx
    Member

    The problem with Internal Mic 1/2 that you can't tell which one is internal or external mic. I assume you'll need to use a custom machine->asoc->dapm_event() handler in this case.

  7. digetx commented on Oct 1, 2022

    @digetx
    Member

    Maybe adding new nvidia,int-mic1-en-gpios nvidia,int-mic2-en-gpios won't be a bad solution.

  8. digetx commented on Oct 1, 2022

    @digetx
    Member

    I'm not sure what are those Internal Mic 1/2, it looks like you have three mics. Perhaps one is noise cancellation?

  9. clamor-s commented on Oct 1, 2022

    @clamor-s
    MemberAuthor

    yes, mic2 is for noise cancellation. Mic1 is main and Mic Jack is headset.

    As I told, I have quite few of audio devices, since it is a phone.

  10. clamor-s commented on Oct 1, 2022

    @clamor-s
    MemberAuthor

    Adding tegra_machine_event worked perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions