[alsa-devel] simple-audio-card and headphone jack detect

Paul Cercueil paul at crapouillou.net
Sat Jan 19 02:04:12 CET 2019


Hello,

I am using the simple-card and simple-amplifier drivers with the
following devicetree:

amp: audio-amp {
    compatible = "simple-audio-amplifier";
    enable-gpios = <&gpc 15 GPIO_ACTIVE_HIGH>;
};

sound-card {
    compatible = "simple-audio-card";

    simple-audio-card,name = "rs90-audio";
    simple-audio-card,format = "i2s";

    simple-audio-card,widgets =
        "Speaker", "Speaker",
        "Headphone", "Headphones";
    simple-audio-card,routing =
        "INL", "LHPOUT",
        "INR", "RHPOUT",
        "Headphones", "LHPOUT",
        "Headphones", "RHPOUT",
        "Speaker", "OUTL",
        "Speaker", "OUTR";

    simple-audio-card,hp-det-gpio = <&gpd 16 GPIO_ACTIVE_LOW>;
    simple-audio-card,aux-devs = <&amp>;

    simple-audio-card,cpu {
        sound-dai = <&aic>;
    };

    simple-audio-card,codec {
        sound-dai = <&codec>;

        bitclock-master;
        frame-master;
    };
};

My codec outputs on the LHPOUT/RHPOUT lines. INL/INR and OUTL/OUTR
are the inputs/outputs of the simple-amplifier.

So far so good, when no audio is playing the audio amp is disabled
(GPIO is low), and it gets enabled as soon as I start to play audio.

What is not working, and what I am trying to achieve, is to have the
external audio amplifier disabled as soon as headphones are plugged.

Is that something the core handles for me?
Any suggestions to make it work?

Thanks,
-Paul




More information about the Alsa-devel mailing list