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.

TAS6424L-Q1: "Auto Diagnostics Switch" kcontrol has been toggled in case of using /var/lib/alsa/asound.state

Part Number: TAS6424L-Q1
Other Parts Discussed in Thread: TAS6424

Dear TI

I would like to ask you a few questions regarding "Auto Diagnostics Switch" in tas6424.c

In my case, I would like to use asound.state which is including kcontrol state and I don't like to use "Auto Diagnostics Switch"

When I try to reboot my embeded board, snd_soc_get_strobe is called and asound.state is updated automatically.

As you know, when the embeded board is booted up, asound.state can be used for the default configuration.

================================================================================

- Cold boot

[    6.519993] snd_soc_put_strobe [tas6424] Auto Diagnostic: off, item[0]: 1 val1: 0, val2: 1, invert: 1, strobe: 1

- try to reboot

[   18.250693] snd_soc_get_strobe [tas6424] Auto Diagnostic: off, item[0]: 0, val: 1, invert: 1

- Probably, asound.state seems to be updated.

- Rebooting

[    7.259666] snd_soc_put_strobe [tas6424] Auto Diagnostic: on, item[0]: 0 val1: 1, val2: 0, invert: 1, strobe: 0

================================================================================

Please refer to my debug codes.

=================================================================================

int snd_soc_get_strobe(struct snd_kcontrol *kcontrol,                             
        struct snd_ctl_elem_value *ucontrol)                                      
{                                                                                  
       <snip>                                       
                                                                                   
        if (shift != 0 && val != 0)                                               
                val = val >> shift;                                               
        ucontrol->value.enumerated.item[0] = val ^ invert;                        
                                                                                  
        printk("%s [tas6424] Auto Diagnostic: %s, item[0]: %d, val: %d, invert: %d\n",
                        __func__,                                                 
                        (ucontrol->value.enumerated.item[0] == 0?"off":"on"),  
                        ucontrol->value.enumerated.item[0],                       
                        val,                                                      
                        invert);                                                  
                                                                                  
        return 0;                                                                 

<snip>

int snd_soc_put_strobe(struct snd_kcontrol *kcontrol,                          
        struct snd_ctl_elem_value *ucontrol)                                   
{                                                                               
       <snip>                                         
                                                                                
        printk("%s [tas6424] Auto Diagnostic: %s, item[0]: %d val1: %d, val2: %d, invert: %d, strobe: %d\n",
                        __func__,                                              
                        (val2 == 1?"off":"on"),                                
                        ucontrol->value.enumerated.item[0],                    
                        val1, val2, invert, strobe);                                           
                                                                                
        err = snd_soc_component_update_bits(component, reg, mask, val1);       
        if (err < 0)                                                           
                return err;                                                    
                                                                               
        return snd_soc_component_update_bits(component, reg, mask, val2);      
}

=================================================================================

So, whenever I try to reboot my board, Auto Diagnostic feature is toggled.

Isn't there any way to solve this problem without commenting out "Auto Diagnostics Switch" kcontrol?

If possible, I would like to use your original code.

Thank you.

Best Regards,

KW

  • KW,

    may you let me know where you get this code and which platform/board you are using? i don't remember we release this code.

    Dylan

  • Hello Dylan

    Please refer to this.

    github.com/.../tas6424.c

    In tas6424.c, you could see the code below.

    static const struct snd_kcontrol_new tas6424_snd_controls[] = {
     SOC_SINGLE_TLV("Speaker Driver CH1 Playback Volume",
             TAS6424_CH1_VOL_CTRL, 0, 0xff, 0, dac_tlv),
     SOC_SINGLE_TLV("Speaker Driver CH2 Playback Volume",
             TAS6424_CH2_VOL_CTRL, 0, 0xff, 0, dac_tlv),
     SOC_SINGLE_TLV("Speaker Driver CH3 Playback Volume",
             TAS6424_CH3_VOL_CTRL, 0, 0xff, 0, dac_tlv),
     SOC_SINGLE_TLV("Speaker Driver CH4 Playback Volume",
             TAS6424_CH4_VOL_CTRL, 0, 0xff, 0, dac_tlv),
     SOC_SINGLE_STROBE("Auto Diagnostics Switch", TAS6424_DC_DIAG_CTRL1,
         TAS6424_LDGBYPASS_SHIFT, 1),
    };

    Thank you.

    KW

  • KW,

    I am afraid we can't help you on this. we don't know what is happening on the problem of auto switch when reboot. you need go to github for help on this.

    what i can suggest is: just write the DC diag regsiter value from the default below.  change TAS6424_DC_DIAG_CTRL1 value from 0x00 to 0x01, and comments above code you showed, then auto diagntosic is disabled at all time.

    static const struct reg_default tas6424_reg_defaults[] = {
    { TAS6424_MODE_CTRL, 0x00 },
    { TAS6424_MISC_CTRL1, 0x32 },
    { TAS6424_MISC_CTRL2, 0x62 },
    { TAS6424_SAP_CTRL, 0x04 },
    { TAS6424_CH_STATE_CTRL, 0x55 },
    { TAS6424_CH1_VOL_CTRL, 0xcf },
    { TAS6424_CH2_VOL_CTRL, 0xcf },
    { TAS6424_CH3_VOL_CTRL, 0xcf },
    { TAS6424_CH4_VOL_CTRL, 0xcf },
    { TAS6424_DC_DIAG_CTRL1, 0x01 },
    { TAS6424_DC_DIAG_CTRL2, 0x11 },
    { TAS6424_DC_DIAG_CTRL3, 0x11 },
    { TAS6424_PIN_CTRL, 0xff },
    { TAS6424_AC_DIAG_CTRL1, 0x00 },
    { TAS6424_MISC_CTRL3, 0x00 },
    { TAS6424_CLIP_CTRL, 0x01 },
    { TAS6424_CLIP_WINDOW, 0x14 },
    { TAS6424_CLIP_WARN, 0x00 },
    { TAS6424_CBC_STAT, 0x00 },
    { TAS6424_MISC_CTRL4, 0x40 },
    };
  • Hello. Dylan

    Thank you for the quick reply.

    As you see the code, "Auto Diagnostics Switch" kcontrol is using snd_soc_get_strobe() and snd_soc_put_strobe(), since kcontrol has beed defined as SOC_SINGLE_STROBE.

    And this kcontrol value can be saved in /var/lib/alsa/asound.state which is quite common file.

    When the board is rebooted, this file can be updated with the current value and can be used in second booting.

    As you see the debug log I added, snd_soc_get_strobe can be called for saving the current value before the second boot.

    ================================================================================

    [    6.519993] snd_soc_put_strobe [tas6424] Auto Diagnostic: off, item[0]: 1 val1: 0, val2: 1, invert: 1, strobe: 1

    - try to reboot

    [   18.250693] snd_soc_get_strobe [tas6424] Auto Diagnostic: off, item[0]: 0, val: 1, invert: 1

    ================================================================================

    So, I think tas6424's kcontrol seems to not be working properly with asound.state.

    If you don't mind, could you test it with asound.state on your own board?

    The reason why I can't change the default value you suggested is because it could be changed when snd_soc_get_strobe is called for saving the it in asound.state.

    I appreciate it.

    Regards,

    KW

  • KW,

    can you trace into when this auto diagnostic switch changed?  is that read from device at every time booting? if yes, is the 3.3V supply for TAS6424 device is powered off during every time rebooting?

    for TAS6424 device, if 3.3V powered off, then register information will be lost, and go to default status "auto diagnostic on"

    Let me know your thoughts. 

    Dylan

  • Hello Dylan

    In my opinion, it isn't related to 3.3V supply, since the state has been changed from off to on and from on to off in next time.

    I think it has a correlation to kcontrol TAS6424 is using.

    When I tried to turn it off, the value wasn't chanaged finally, even though it seemed to be changed when kcontrol put was called.

    ===================================================

    root@euto-v9-sadk:~# amixer sget 'Auto Diagnostics',0
    Simple mixer control 'Auto Diagnostics',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [on]

    root@euto-v9-sadk:~#
    root@euto-v9-sadk:~# amixer sset 'Auto Diagnostics',0 'off'
    Simple mixer control 'Auto Diagnostics',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [off]

    root@euto-v9-sadk:~#
    root@euto-v9-sadk:~# amixer sget 'Auto Diagnostics',0
    Simple mixer control 'Auto Diagnostics',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [on]

    ===================================================

    When I traced it with the debug code, I could see the log below.

    ===================================================

    [   11.819138] snd_soc_get_strobe [tas6424] Auto Diagnostic: on, item[0]: 1, val: 0, invert: 1
    [   11.862319] snd_soc_get_strobe [tas6424] Auto Diagnostic: on, item[0]: 1, val: 0, invert: 1
    [   11.862409] snd_soc_get_strobe [tas6424] Auto Diagnostic: on, item[0]: 1, val: 0, invert: 1
    [   11.862419] snd_soc_put_strobe [tas6424] Auto Diagnostic: on->off, item[0]: 0 val1: 1, val2: 0, invert: 1, strobe: 0
    [   12.094383] snd_soc_get_strobe [tas6424] Auto Diagnostic: on, item[0]: 1, val: 0, invert: 1

    ===================================================

    In this case, item[0] has 1 in snd_soc_get_strobe()

    and when snd_soc_put_probe() is called during the reboot, the value has been changed.

    ===================================================

    [    2.476895] snd_soc_put_strobe [tas6424] Auto Diagnostic: off->on, item[0]: 1 val1: 0, val2: 1, invert: 1, strobe: 1
    [    2.630557] snd_soc_put_strobe [tas6424] Auto Diagnostic: off->on, item[0]: 1 val1: 0, val2: 1, invert: 1, strobe: 1

    reboot

    [    2.458441] snd_soc_put_strobe [tas6424] Auto Diagnostic: on->off, item[0]: 0 val1: 1, val2: 0, invert: 1, strobe: 0
    [    2.609023] snd_soc_put_strobe [tas6424] Auto Diagnostic: on->off, item[0]: 0 val1: 1, val2: 0, invert: 1, strobe: 0

    ===================================================

    If you think it is hard to check it, could you focus on why TAS6424's kcontrol doesn't work properly at first?

    Because the root cause is that item[0] has been toggled.

    Thank you.

    Regards,

    KW

  • KW,

    we don't know more details about kcontrol module, as the code is build by github.  I would suggest you go to Github for more help.

    Do you have IIC direct access?  TAS6424 is a really simple device, you can build your own module to control that. doesn'g have to use the code from github.

    Dylan

  • Hello Dylan

    OK,

    The reason why I asked you is because the author of TAS6426.c is one of your colleagues.

    I will use it without kcontrol in tas6424.c

    I can access the address using IIC like this.

    But this isn't related to wriing/reading 0x9 address.

    root@euto-v9-sadk:~/abox-test# i2cdump -f -y 15 0x6a
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 32 62 54 00 8f 8f 8f 8f 00 01 01 22 22 00 ff    .2bT.????.??""..
    10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    20: 00 00 01 14 00 00 40 21 0a 00 00 00 00 00 00 00    ..??..@!?.......
    30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    50: 00 00 00 aa 00 00 00 00 00 00 00 12 32 f2 00 00    ...?.......?2?..
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    Anyway thank you for your support.

    I appreciate it

    KW