• J
    ASoC: nau8825: non-clock jack detection for power saving at standby · 2ec30f60
    John Hsu 提交于
    The driver changes jack type detection interruption to non-clock archi-
    tecture for less 1mW power saving. The architecture is called manual mode
    jack detection. It has no hardware debounce, no jack type detection, but
    only detecting jack insertion. After jack insertion, the driver will
    switch to auto mode jack detection with internal clock which can detect
    microphone, jack type and do hardware debounce.
    
    The manual architecture has these main changes including codec initiation,
    interruption, clock control, and power management. When codec initiation
    or system resume, the clock is closed as jack insertion detection at man-
    ual mode, and bypass debounce circuit. These configurations move to resume
    setup function when setup bias level after resume.
    
    When jack insertion detection happens, the manual mode turns off and make
    configuration about jack type detection interruption at auto mode in auto
    irq setup function which can detect microphone and jack type. The inter-
    ruption will switch to manual mode again with clock free until jack ejec-
    tion happens.
    
    The system clock configuration adds clock disable option which can disable
    internal VCO clock. Before the system clock change, there is an restric-
    tion added to make sure clock disabled and not config any clock when no
    headset connected.
    
    In power management, we involve the solution about races and jack detec-
    tion in resume from Ben Zhang in the following patch and list his comment.
    [PATCH] ASoC: nau8825: Fix jack detection across suspend
    "Jack plug status is rechecked at resume to handle plug/unplug
    in S3 when the chip has no power."
    "Suspend/resume callbacks are moved from the i2c dev_pm_ops to
    snd_soc_codec_driver. soc_resume_deferred is a delayed work
    which may trigger nau8825_set_bias_level. The bias change races
    against dev_pm_ops, causing jack detection issues.
    soc_resume_deferred ensures bias change and snd_soc_codec_driver
    suspend/resume are sequenced correctly."
    
    Change SAR widget to supply type which can prevent the codec keeping at
    SND_SOC_BIAS_ON during suspend. The codec suspend function can just invoke
    normally.
    
    Before the system suspends, the driver turns off all interruptions. Keep
    the interruption quiet before resume setup completes. The ADC channel will
    be disabled which is needed for interruptions at audo mode.
    Signed-off-by: NJohn Hsu <KCHSU0@nuvoton.com>
    Signed-off-by: NMark Brown <broonie@kernel.org>
    2ec30f60
nau8825.c 51.6 KB