About adau1961 driver

I found the  macro in here https://github.com/analogdevicesinc/linux/blob/adau17x1/sound/soc/codecs/adau17x1.h

#define ADUA_SERIAL_PORT1_BCLK32          (0x0 << 5)

#define ADUA_SERIAL_PORT1_BCLK48          (0x1 << 5)

#define ADUA_SERIAL_PORT1_BCLK64          (0x2 << 5)

But I am strange that on page 55 of datasheet

Table 41. Serial Port Control 1 Register

Bits Bit Name Description

[7:5] BPF[2:0] Number of bit clock cycles per LRCLK audio frame.

Setting Bit Clock Cycles

000 64 (default)

001 32

010 48

011 128

100 256

who is right one ?

I am also puzzle that why  the Headphone playback switch is alway on  but my lineout switch always off?

numid=14,iface=MIXER,name='Headphone Playback Switch'

  ; type=BOOLEAN,access=rw------,values=2

  : values=on,on

numid=13,iface=MIXER,name='Headphone Playback Volume'

  ; type=INTEGER,access=rw---R--,values=2,min=0,max=63,step=0

  : values=37,37

  | dBscale-min=-57.00dB,step=1.00dB,mute=0

There is no script in the filesystem do such behavior.

Can anybody tell me why?

I use PLL, so the core clock is 1024fs =1024*44.1kHz, My MCLK input is 24MHz,

How to set or configure the BCLK? The BCLK and LRCLK of ADAU1961 is master.

Thank you

  • Dear Lars:

    I  just do not set "DAC Playback Mux" to "AIFIN" .,because I do not find the "DAC Playback Mux " item when run the command ---amixer contents

      Can you show me  which code  generate this  control in AD1761.c or ad17x1.c ?

    Is that will be show run command --amixer scontents?


    thank you !

    wangl

  • Hi Lars: I am using an old version of adau17x1.c from bf609-buildroot package it show that

    /*

    * Common code for ADAU1X61 and ADAU1X81 codecs

    *

    * Copyright 2011 Analog Devices Inc.

    * Author: Lars-Peter Clausen <lars@metafoo.de>

    *

    * Licensed under the GPL-2 or later.

    */

    I found that  in the link of you paste

    { "DAC Playback Mux", "AIFIN", "AIFIN" },

    but it is for adau17x1 which have dsp,I am using adau1961which do not have dsp in it

    here is my dump:

    root@am335x-evm:~# amixer contents

    numid=21,iface=MIXER,name='Headphone Bias'

      ; type=ENUMERATED,access=rw------,values=1,items=4

      ; Item #0 'Normal operation'

      ; Item #1 'Extreme power saving'

      ; Item #2 'Enhanced performance'

      ; Item #3 'Power saving'

      : values=0

    numid=14,iface=MIXER,name='Headphone Playback Switch'

      ; type=BOOLEAN,access=rw------,values=2

      : values=on,on

    numid=13,iface=MIXER,name='Headphone Playback Volume'

      ; type=INTEGER,access=rw---R--,values=2,min=0,max=63,step=0

      : values=37,37

      | dBscale-min=-57.00dB,step=1.00dB,mute=0

    numid=16,iface=MIXER,name='Lineout Playback Switch'

      ; type=BOOLEAN,access=rw------,values=2

      : values=off,off

    numid=15,iface=MIXER,name='Lineout Playback Volume'

      ; type=INTEGER,access=rw---R--,values=2,min=0,max=63,step=0

      : values=0,0

      | dBscale-min=-57.00dB,step=1.00dB,mute=0

    numid=6,iface=MIXER,name='Mic Bias Mode'

      ; type=ENUMERATED,access=rw------,values=1,items=2

      ; Item #0 'Normal operation'

      ; Item #1 'High performance'

      : values=0

    numid=12,iface=MIXER,name='Aux Capture Volume'

      ; type=INTEGER,access=rw---R--,values=2,min=0,max=7,step=0

      : values=0,0

      | dBscale-min=-15.00dB,step=3.00dB,mute=1

    numid=17,iface=MIXER,name='ADC Bias'

      ; type=ENUMERATED,access=rw------,values=1,items=4

      ; Item #0 'Normal operation'

      ; Item #1 'Extreme power saving'

      ; Item #2 'Enhanced performance'

      ; Item #3 'Power saving'

      : values=0

    numid=3,iface=MIXER,name='ADC High Pass Filter Switch'

      ; type=BOOLEAN,access=rw------,values=1

      : values=off

    numid=19,iface=MIXER,name='Capture Bias'

      ; type=ENUMERATED,access=rw------,values=1,items=3

      ; Item #0 'Normal operation'

      ; Item #1 'Enhanced performance'

      ; Item #2 'Power saving'

      : values=0

    numid=5,iface=MIXER,name='Capture Boost'

      ; type=ENUMERATED,access=rw------,values=1,items=4

      ; Item #0 'Normal operation'

      ; Item #1 'Boost Level 1'

      ; Item #2 'Boost Level 2'

      ; Item #3 'Boost Level 3'

      : values=0

    numid=20,iface=MIXER,name='Playback Bias'

      ; type=ENUMERATED,access=rw------,values=1,items=3

      ; Item #0 'Normal operation'

      ; Item #1 'Enhanced performance'

      ; Item #2 'Power saving'

      : values=0

    numid=4,iface=MIXER,name='Playback De-emphasis Switch'

      ; type=BOOLEAN,access=rw------,values=1

      : values=off

    numid=18,iface=MIXER,name='DAC Bias'

      ; type=ENUMERATED,access=rw------,values=1,items=4

      ; Item #0 'Normal operation'

      ; Item #1 'Extreme power saving'

      ; Item #2 'Enhanced performance'

      ; Item #3 'Power saving'

      : values=0

    numid=7,iface=MIXER,name='DAC Mono Stereo'

      ; type=ENUMERATED,access=rw------,values=1,items=4

      ; Item #0 'Stereo'

      ; Item #1 'Mono Left Channel (L+R)'

      ; Item #2 'Mono Right Channel (L+R)'

      ; Item #3 'Mono (L+R)'

      : values=0

    numid=1,iface=MIXER,name='Digital Capture Volume'

      ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0

      : values=255,255

      | dBminmax-min=-95.63dB,max=0.00dB

    numid=2,iface=MIXER,name='Digital Playback Volume'

      ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0

      : values=255,255

      | dBminmax-min=-95.63dB,max=0.00dB

    numid=8,iface=MIXER,name='Input 1 Capture Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=7,step=0

      : values=0

      | dBscale-min=-15.00dB,step=3.00dB,mute=1

    numid=9,iface=MIXER,name='Input 2 Capture Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=7,step=0

      : values=0

      | dBscale-min=-15.00dB,step=3.00dB,mute=1

    numid=10,iface=MIXER,name='Input 3 Capture Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=7,step=0

      : values=0

      | dBscale-min=-15.00dB,step=3.00dB,mute=1

    numid=11,iface=MIXER,name='Input 4 Capture Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=7,step=0

      : values=0

      | dBscale-min=-15.00dB,step=3.00dB,mute=1

    numid=24,iface=MIXER,name='Left LR Playback Mixer Left Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=2,step=0

      : values=0

      | dBscale-min=-6.00dB,step=6.00dB,mute=1

    numid=25,iface=MIXER,name='Left LR Playback Mixer Right Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=2,step=0

      : values=0

      | dBscale-min=-6.00dB,step=6.00dB,mute=1

    numid=33,iface=MIXER,name='Left Playback Mixer Aux Bypass Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=8,step=0

      : values=0

      | dBscale-min=-18.00dB,step=3.00dB,mute=1

    numid=35,iface=MIXER,name='Left Playback Mixer Left Bypass Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=8,step=0

      : values=0

      | dBscale-min=-18.00dB,step=3.00dB,mute=1

    numid=31,iface=MIXER,name='Left Playback Mixer Left DAC Switch'

      ; type=BOOLEAN,access=rw------,values=1

      : values=off

    numid=34,iface=MIXER,name='Left Playback Mixer Right Bypass Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=8,step=0

      : values=0

      | dBscale-min=-18.00dB,step=3.00dB,mute=1

    numid=32,iface=MIXER,name='Left Playback Mixer Right DAC Switch'

      ; type=BOOLEAN,access=rw------,values=1

      : values=off

    numid=22,iface=MIXER,name='Right LR Playback Mixer Left Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=2,step=0

      : values=0

      | dBscale-min=-6.00dB,step=6.00dB,mute=1

    numid=23,iface=MIXER,name='Right LR Playback Mixer Right Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=2,step=0

      : values=0

      | dBscale-min=-6.00dB,step=6.00dB,mute=1

    numid=28,iface=MIXER,name='Right Playback Mixer Aux Bypass Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=8,step=0

      : values=0

      | dBscale-min=-18.00dB,step=3.00dB,mute=1

    numid=30,iface=MIXER,name='Right Playback Mixer Left Bypass Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=8,step=0

      : values=0

      | dBscale-min=-18.00dB,step=3.00dB,mute=1

    numid=26,iface=MIXER,name='Right Playback Mixer Left DAC Switch'

      ; type=BOOLEAN,access=rw------,values=1

      : values=off

    numid=29,iface=MIXER,name='Right Playback Mixer Right Bypass Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=8,step=0

      : values=0

      | dBscale-min=-18.00dB,step=3.00dB,mute=1

    numid=27,iface=MIXER,name='Right Playback Mixer Right DAC Switch'

      ; type=BOOLEAN,access=rw------,values=1

      : values=off

  • HI  Lars:

    but ,it do not work ,I still  can not see the wave of BCLK pin on the scope .

    I also strange at that when I set the value as following  the mute is 1,it should be 0.

    root@am335x-evm:/# amixer cset numid=31 on

    numid=31,iface=MIXER,name='Left Playback Mixer Left DAC Switch'

      ; type=BOOLEAN,access=rw------,values=1

      : values=on

    root@am335x-evm:/# amixer cset numid=24 2

    numid=24,iface=MIXER,name='Left LR Playback Mixer Left Volume'

      ; type=INTEGER,access=rw---R--,values=1,min=0,max=2,step=0

      : values=2

      | dBscale-min=-6.00dB,step=6.00dB,mute=1

    another problem is that :in adau1761.c

    static const struct regmap_config adau1761_i2c_regmap_config = {

              .cache_type                    = REGCACHE_RBTREE,

    };

    adau17x1_pll_event() will call

    ret = regmap_raw_write(adau->regmap, ADAU17X1_PLL_CONTROL,

                                  adau->pll_regs, ARRAY_SIZE(adau->pll_regs));

    then it show the following warining ,I see in the regmap_raw_write()

    WARN_ON(map->cache_type != REGCACHE_NONE);

    How to deal with this? just comment the WARN?

    [  705.962748] ------------[ cut here ]------------

    [  705.967650] WARNING: at drivers/base/regmap/regmap.c:380 regmap_raw_write+0x68/0x6c()

    [  705.975923] Modules linked in:

    [  705.979141] Backtrace:

    [  705.981769] [<c0017978>] (dump_backtrace+0x0/0x110) from [<c040c2c8>] (dump_stack+0x18/0x1c)

    [  705.990682]  r6:c0518418 r5:0000017c r4:00000000 r3:c05dcec8

    [  705.996683] [<c040c2b0>] (dump_stack+0x0/0x1c) from [<c003d60c>] (warn_slowpath_common+0x5c/0x6c)

    [  706.006080] [<c003d5b0>] (warn_slowpath_common+0x0/0x6c) from [<c003d640>] (warn_slowpath_null+0x24/0x2c)

    [  706.016185]  r8:00000001 r7:cf9e7f6c r6:00000006 r5:00004002 r4:cf9dd0c0

    [  706.023102] r3:00000009

    [  706.025875] [<c003d61c>] (warn_slowpath_null+0x0/0x2c) from [<c0237938>] (regmap_raw_write+0x68/0x6c)

    [  706.035638] [<c02378d0>] (regmap_raw_write+0x0/0x6c) from [<c034ef7c>] (adau17x1_pll_event+0x5c/0x118)

    [  706.045466]  r7:cf9e20e8 r6:00000001 r5:00000001 r4:cf9e7f50

    [  706.051473] [<c034ef20>] (adau17x1_pll_event+0x0/0x118) from [<c0349874>] (dapm_seq_check_event.clone.12+0xcc/0x110)

    [  706.062581]  r5:c0542834 r4:cf9f0d40

    [  706.066368] [<c03497a8>] (dapm_seq_check_event.clone.12+0x0/0x110) from [<c0349984>] (dapm_seq_run_coalesced.clone.13+0xcc/0x1b0)

    [  706.078664]  r6:00000001 r5:cf9e20dc r4:cf9f0d40

    [  706.083564] [<c03498b8>] (dapm_seq_run_coalesced.clone.13+0x0/0x1b0) from [<c0349b00>] (dapm_seq_run.clone.14+0x98/0x3fc)

    [  706.095140] [<c0349a68>] (dapm_seq_run.clone.14+0x0/0x3fc) from [<c034a330>] (dapm_power_widgets+0x4cc/0x620)

    [  706.105618] [<c0349e64>] (dapm_power_widgets+0x0/0x620) from [<c034b49c>] (snd_soc_dapm_stream_event+0xd4/0x12c)

    [  706.116373] [<c034b3c8>] (snd_soc_dapm_stream_event+0x0/0x12c) from [<c034d374>] (soc_pcm_prepare+0x130/0x1b4)

    [  706.126944] [<c034d244>] (soc_pcm_prepare+0x0/0x1b4) from [<c0339850>] (snd_pcm_do_prepare+0x1c/0x34)

    [  706.136687] [<c0339834>] (snd_pcm_do_prepare+0x0/0x34) from [<c0339378>] (snd_pcm_action_single+0x40/0x80)

    [  706.146880]  r4:c0610514 r3:c0339834

    [  706.150682] [<c0339338>] (snd_pcm_action_single+0x0/0x80) from [<c033badc>] (snd_pcm_action_nonatomic+0x70/0x88)

    [  706.161632]  r7:00080002 r6:c0610514 r5:00080002 r4:cf9445c0

    [  706.167633] [<c033ba6c>] (snd_pcm_action_nonatomic+0x0/0x88) from [<c033c73c>] (snd_pcm_common_ioctl1+0x888/0xd8c)

    [  706.178569]  r6:cf9e8bd4 r5:cf9445c0 r4:00000000 r3:00000000

    [  706.184580] [<c033beb4>] (snd_pcm_common_ioctl1+0x0/0xd8c) from [<c033d078>] (snd_pcm_playback_ioctl1+0x40/0x3e4)

    [  706.195423] [<c033d038>] (snd_pcm_playback_ioctl1+0x0/0x3e4) from [<c033d454>] (snd_pcm_playback_ioctl+0x38/0x3c)

    [  706.206254]  r6:cf2d10a8 r5:00000000 r4:00000000

    [  706.211162] [<c033d41c>] (snd_pcm_playback_ioctl+0x0/0x3c) from [<c00b72c4>] (do_vfs_ioctl+0x88/0x528)

    [  706.220999] [<c00b723c>] (do_vfs_ioctl+0x0/0x528) from [<c00b77e0>] (sys_ioctl+0x7c/0x84)

    [  706.229671]  r9:cfb06000 r8:00000000 r7:00000004 r6:00004140 r5:00000000

    [  706.236586] r4:cf074140

    [  706.239373] [<c00b7764>] (sys_ioctl+0x0/0x84) from [<c0014280>] (ret_fast_syscall+0x0/0x30)

    [  706.248191]  r8:c0014428 r7:00000036 r6:0001dd88 r5:0002d6d0 r4:48e87cc8

    [  706.255293] ---[ end trace ba6048e29afbc125 ]---

  • Hi,

    Changing the "DAC Mono Stereo" control should have no effect on the sample rate. Can you provide the exact steps you perform (including all command line output), what results you get and what results you expected.

    Thanks,

    - Lars

  • Dear Lars:

    another strange thing is that

    when I set the  as following

    /# amixer cset numid=7 0

    numid=7,iface=MIXER,name='DAC Mono Stereo'

      ; type=ENUMERATED,access=rw------,values=1,items=4

      ; Item #0 'Stereo'

      ; Item #1 'Mono Left Channel (L+R)'

      ; Item #2 'Mono Right Channel (L+R)'

      ; Item #3 'Mono (L+R)'

      : values=0

    then I see the clock 2.82MHz on the scope which match the value expected, after aplay run over it changed to 6MHz.

    But the default value of  DAC Mono Stereo is zero and it stand for the register DAC control0  bit [7:6] ,the default value is 0 and stereo.