This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: Disabling audio codec power saving

Part Number: AM3358
Other Parts Discussed in Thread: TLV320AIC3106

I am using processor sdk 03.03 on a custom made board.

I am using the default audio entries from am335xevm-sk.dts device tree.

When playing audio with applay, I can hear pop sound. Playing again with less than 10 second down time, produces no pop sounds.

Scoping the audio control signals coming from the processor it looks like the audio module powers of after 10 seconds of being not used.

I would like to disable this feature but am struggling to do so.

The powersave.txt documentation in Documentation/sound/alsa only references AC97 and HD-audio drivers.

I am using simple-audio-card driver with tlv320aic3106 codec

Is it possible to disable power saving using these drivers>

Kind regards,

Ugnius

  • Hi Ugnius,

    Can you reproduce this issue on the AM335x TI StarterKit? This might be HW issue related to you custom board.

    Regarding audio codec power saving, which AM335x processor audio control signals you measure with scope?

    Check if AM335x audio pins are going from active to sleep mode. Check below wiki:

    processors.wiki.ti.com/.../Linux_Core_Power_Management_User's_Guide_(v4.4)

    Pop and click reduction: Pops and clicks can be reduced by powering the codec up/down in the correct sequence (including using digital mute). ASoC signals the codec when to change power states.

    e2e.ti.com/.../1692239
    e2e.ti.com/.../1400091

    Regards,
    Pavel
  • Hi Pavel,

    TLV320 input signals WCLK, BCLK, Din and Dout are all active when audio is playing.
    When it stops, for about 8s WCLK and BCLK are still active, then they stop.
    That is why I think that system is puting audio subsystem into sleep mode.

    I will double check this with starter kit and let you know.
  • I can confirm that the Starter kit has the same issue. The design Does not have amplifier and Audio is played to Headphone jack.
    But the effects are the same:
    * It sounds fine when it plays.
    * If I stop and replay within ~8s the sound is clear.
    * If I stop for more than ~8s then I hear a pop at the beginning of starting the playback.
  • I Tried reading the state of the control signals and they do change to sleep mode.
    I defined sleep mode to be identical to the active mode and can see by reading mode value that it does not go to sleep mode.
    The pop sound is still there however.
    Does that mean that issue is not caused by sleep mode of the driver?
  • I scoped the i2c lines controlling the Audio chip and can now see that MCU is disabling the power when sound stops playing.

    * When playing stops the Left and Right output DACS are muted.
    * In 5 seconds, if nothing is played, the power to all the outputs is disabled by sending i2c transaction.

    To disable this feature do I have to modify the driver source code for TLV320?
    Is there any guide/suggestions for that?

    Kind regards,
    Ugnius
  • Ugnius,

    First make sure that AM335x device is not going into low power mode and is always active. The possible low power modes are: DVFS/CPUFreq, CPUIdle, Standby, deepsleep0/mem, RTC-Only

    processors.wiki.ti.com/.../Linux_Core_Power_Management_User's_Guide_(v4.4)

    Check if davinci_mcasp_suspend() function is invoked:
    linux-kernel/sound/soc/davinci/davinci-mcasp.c

    Check also if davinci_mcasp_stop() -> mcasp_stop_tx() function is sending i2c command to AIC3x to enter low power mode. If this is the case, you should modify the mcasp audio driver (davinci-mcasp.c) to remove that.

    Regarding TLV320AIC3106 audio codec power management, check its driver:

    linux-kernel/sound/soc/codecs/tlv320aic3x.c

    For more information regarding TLV320AIC3106 audio codec power management and its driver (tlv320aic3x.c), you should aks/post in the audio convertors forum:

    e2e.ti.com/.../64

    One related e2e thread in this forum, link below:

    e2e.ti.com/.../397557

    Regards,
    Pavel
  • Thanks for your reply,

    The processor does not enter low power mode, it has GUI and SPI running on it at all time.

    I checked what is happening by adding prints in Driver Source.

    It looks like the end of playing is issued by the davinci-mcasp driver.

    Then in 5s all the output DACs are disabled by soc-dapm module.

    It runs soc_dapm_update_bits command to update the TLV320 registers.

    It looks like it has a defined sequence of steps for everything.

    So I guess I should modify it to not disable all outputs after every play. I am just not sure where it is defined.

    Would codec forums be best place to carry on this thread?

    As I am not sure weather this is the codec or the audio driver that sets up these transactions.

    Kind regards,

    Ugnius

  • Ugnius,

    Yes, DAPM (Dynamic Audio Power Management) is responsible for AIC3x low power.

    The ASoC layer is designed to address these issues and provide the following features:

    Dynamic Audio Power Management (DAPM): DAPM automatically sets the codec to it's minimum power state at all times. This includes powering up/down internal power blocks depending on the internal codec audio routing and any active streams.

    To achieve all this, ASoC splits an embedded audio system into three components:

    Codec driver: The codec driver is platform independent and contains audio controls, audio interface capabilities, codec dapm definition and codec IO functions.

    Machine driver: The machine driver handles any machine specific controls and audio events i.e. turning on an amp at start of playback.

     

    http://processors.wiki.ti.com/index.php/AM335x_Audio_Driver's_Guide

     


    DAPM feature is enabled/configured in codec driver [1] and machine driver [2]:

    [1] linux-kernel/sound/soc/codecs/tlv320aic3x.c

    [2] linux-kernel/sound/soc/davinci/davinci-evm.c

     

    See also:

    linux-kernel/Documentation/sound/alsa/soc/overview.txt

    linux-kernel/Documentation/sound/alsa/soc/pops_clicks.txt

    linux-kernel/Documentation/sound/alsa/soc/dapm.txt

     

    Regards,
    Pavel

  • Are there any examples how to modify the widget architecture?

    I tried to disable Path domain widgets, and set the associated register to value I want in the probe function.
    But if I do that, stream domain widgets that enable the left and right DACs do not work either.
  • I can not find examples of how to modify AIC3x DAPM widget architecture. The only example I have found is for not using DAPM at all:

    processors.wiki.ti.com/.../Sitara_Linux_Audio_DAC_Example

    The machine driver implements the system level settings such as the digital audio interface links definition and configuration, setup power supplies and clocks. It can also declare machine-level DAPM widgets and connect them with codec widgets.

    Regards,
    Pavel
  • Thanks Pavel,

    So this would use a different codec all together to drive the audio chip?
    I might try this out at some point.

    I think I managed to remove the unwanted sounds using the tlv320 driver. I removed the widgets:

    * LLOPM_CTRL

    * RLOPM_CTRL

    * HPLOUT_CTRL

    * HPROUT_CTRL

    * HPLCOM_CTRL

    * HPRCOM_CTRL

    And re-routed nodes that these widgets interconnected.
    I also removed the aic3x_set_power(codec, 0); function in SND_SOC_BIAS_OFF state.
    This now only disabled driver PLL when playback stops. And on the new playback no unwanted sounds are heard.

    Kind regards
    Ugnius