Post Go back to editing

ssm4567 驱动初始化时soft_reset写入0,出错,返回-5,其它寄存器写入默认值正常,可以正常读出

Hi ADI,

   we using ssm4567 on linux 3.10, while driver init, write soft_reset(0xff) to 0, return error code -5. other register can read write ok. what's the problem?



attach debug log
[edited by: sarvdo at 1:43 AM (GMT -5) on 10 Nov 2021]
Parents
  • Hi Dave Thib # echo -n "file soc-core.c +p" >/sys/kernel/debug/dynamic_debug/control # insmod /lib/modules/3.10.65/snd-soc-ssm4567.ko # insmod /lib/modules/3.10.65/snd-soc-ssm4567-i2c.ko [ 685.418075] ssm4567 4-0034: probe [ 685.422026] ssm4567 4-0034: Error in caching of register: f890 ret: -5 [ 685.429207] ssm4567 4-0034: codec register 4-0034 [ 685.434634] ssm4567 4-0034: ASoC: dai register 4-0034 #1 [ 685.440578] ssm4567 4-0034: ASoC: Mapped DAI ssm4567-hifi to CODEC ssm4567.4-0034 [ 685.448784] ssm4567 4-0034: ASoC: Registered DAI 'ssm4567-hifi' [ 685.455531] ssm4567 4-0034: ASoC: Registered codec 'ssm4567.4-0034' [ 685.462694] i2c-core: driver [ssm4567] registered the addr of soft_reset in the spec of ssm4567  is 0xFF, not 0xF890, Thanks.

Reply
  • Hi Dave Thib # echo -n "file soc-core.c +p" >/sys/kernel/debug/dynamic_debug/control # insmod /lib/modules/3.10.65/snd-soc-ssm4567.ko # insmod /lib/modules/3.10.65/snd-soc-ssm4567-i2c.ko [ 685.418075] ssm4567 4-0034: probe [ 685.422026] ssm4567 4-0034: Error in caching of register: f890 ret: -5 [ 685.429207] ssm4567 4-0034: codec register 4-0034 [ 685.434634] ssm4567 4-0034: ASoC: dai register 4-0034 #1 [ 685.440578] ssm4567 4-0034: ASoC: Mapped DAI ssm4567-hifi to CODEC ssm4567.4-0034 [ 685.448784] ssm4567 4-0034: ASoC: Registered DAI 'ssm4567-hifi' [ 685.455531] ssm4567 4-0034: ASoC: Registered codec 'ssm4567.4-0034' [ 685.462694] i2c-core: driver [ssm4567] registered the addr of soft_reset in the spec of ssm4567  is 0xFF, not 0xF890, Thanks.

Children
  • Hi,

      Change soft_reset to 0xF890 still has error. the addr of soft_reset in the spec of ssm4567  is 0xFF, not 0xF890, Thanks.

    # mount -t debugfs none /sys/kernel/debug/
    # echo -n "file soc-core.c +p" >/sys/kernel/debug/dynamic_debug/control
    # insmod /lib/modules/3.10.65/snd-soc-ssm4567.ko
    # insmod /lib/modules/3.10.65/snd-soc-ssm4567-i2c.ko
    [   58.767379] ssm4567 4-0034: probe
    [   58.771305] ssm4567 4-0034: Error in caching of register: ff ret: -5
    [   58.778253] ssm4567 4-0034: codec register 4-0034
    [   58.783631] ssm4567 4-0034: ASoC: dai register 4-0034 #1
    [   58.789440] ssm4567 4-0034: ASoC: Mapped DAI ssm4567-hifi to CODEC ssm4567.4-0034
    [   58.797928] ssm4567 4-0034: ASoC: Registered DAI 'ssm4567-hifi'
    [   58.804613] ssm4567 4-0034: ASoC: Registered codec 'ssm4567.4-0034'
    [   58.811792] i2c-core: driver [ssm4567] registered
    [   58.812103] snddaudio0 sound.4: ASoC: binding sysvoice at idx 0
    [   58.812388] ssm4567 4-0034: read 0 => 81
    [   58.812454] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late -2
    [   58.812460] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late -1
    [   58.812466] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late 0
    [   58.812504] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late 1
    [   58.812509] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late 2
    [   58.812544] ssm4567 4-0034: read 0 => 81
    [   58.812558] ssm4567 4-0034: read 0 => 81
    [   58.812573] ssm4567 4-0034: read 0 => 81
    [   58.812595] ssm4567 4-0034: read 0 => 81
    [   58.812634] ssm4567 4-0034: read 0 => 81
    [   58.812764] i2c i2c-4: master_xfer[0] W, addr=0x34, len=2
    [   58.813182] i2c i2c-4: master_xfer[0] W, addr=0x34, len=2
    [   58.813481] i2c i2c-4: master_xfer[0] W, addr=0x34, len=2
    # [   58.907585] snddaudio0 sound.4:  ssm4567-hifi <-> 1c22000.daudio mapping ok

    Our Questions #2. how to config/ctrl the audio path let the speak play wav file by tinymix and aplay tools?  Thanks. It's so urgent issue for us. Please help us on it. Thanks.

    Mixer name: 'snddaudio0'
    Number of controls: 10
    ctl     type    num     name                                     value
    0       BOOL    1       DAC High Pass Filter Switch              On
    1       BOOL    1       DAC Low Power Switch                     On
    2       INT     1       Master Playback Volume                   225
    3       BOOL    1       Low-EMI Switch                           On
    4       ENUM    1       Limiter Mode                             Enable Limiter
    5       ENUM    1       Limiter Attack Rate                      20 us/dB
    6       ENUM    1       Limiter Release Rate                     1600 ms/dB
    7       ENUM    1       Limiter Attack Threshold                 6.0Vp
    8       ENUM    1       sunxi daudio audio hub mode              hub_enable
    9       BOOL    1       Amplifier Boost Switch                   On

  • Questions #2. how to config/ctrl the audio path by tinymix tool.

    Please supply the config/control cmd list:

    X is ctrl index number/name

    tinymix  X 0/1/X

    tinymix  X On/Off

    tinymix  X  XX

  • Question #3 how to confirm that the driver and codec work well? check the register?

  • Hello,

    The SOFT_RESET register address is 0xFF not 0xF890.

    This register is Write Once type. It will always read 0. It does not store its value. i.e. when you write 0 to this register it will issue a RESET to internal blocks and bring all the register values to default. 

    I assume the part when configured is working correctly and the issue is only related to read value of this register. 

    I do not see any value in reading this register 0xFF. Since you are getting error in the driver reading this register, is it possible for you to either ignore or remove the read for this register? 

    Regards

    Rajeev

  • Hi,

    First can you please point us to the source of the driver you use for ssm4567? I'm asking this because I see that you have kernel 3.10.65 but I was not able to find ssm4567 in the sources for that version and it looks like the driver was merged in upstream later. Did you backported it from a newer kernel version?

    Related to the problems you're seeing:

    The error "Error in caching of register: ff ret: -5" can be expected because register 0xFF is write only. I think in datasheet there is a mistake being marked R only. So when regmap framework tries to read that register in order to cache it is failing.

    In 5.15 upstream the SSM4567_REG_SOFT_RESET register is not in readable_reg list so check to be the same on your version of the driver.

    #2: For configuring I think the tool you want is amixer. It can list you all available controls and allows you to read the current state of a control and also set the state. We have a good wiki page for this topic here.

    #3: If you want to just readback registers and check if what you set over amixer applied correctly to the chip I think you can leverage the Linux debugfs regmap interface.

  • Hi btogorean

      Thanks.

      #2 we has the tinymix already,   we need tinymix cmds list to let the speak play wav audio.

    Mixer name: 'snddaudio0'
    Number of controls: 10
    ctl     type    num     name                                     value
    0       BOOL    1       DAC High Pass Filter Switch              On
    1       BOOL    1       DAC Low Power Switch                     On
    2       INT     1       Master Playback Volume                   225
    3       BOOL    1       Low-EMI Switch                           On
    4       ENUM    1       Limiter Mode                             Enable Limiter
    5       ENUM    1       Limiter Attack Rate                      20 us/dB
    6       ENUM    1       Limiter Release Rate                     1600 ms/dB
    7       ENUM    1       Limiter Attack Threshold                 6.0Vp
    8       ENUM    1       sunxi daudio audio hub mode              hub_enable
    9       BOOL    1       Amplifier Boost Switch                   On

    where is the  wiki page for this topic?

    #3.  Could you confirm that the driver we porting is OK or NOT. we need to know wether it works well ok not.

    the following log is right or wrong?  or we need to check other item for confirm that the driver which we loaded is ok or not?

    # mount -t debugfs none /sys/kernel/debug/
    # echo -n "file soc-core.c +p" >/sys/kernel/debug/dynamic_debug/control
    # insmod /lib/modules/3.10.65/snd-soc-ssm4567.ko
    # insmod /lib/modules/3.10.65/snd-soc-ssm4567-i2c.ko
    [   58.767379] ssm4567 4-0034: probe
    [   58.771305] ssm4567 4-0034: Error in caching of register: ff ret: -5
    [   58.778253] ssm4567 4-0034: codec register 4-0034
    [   58.783631] ssm4567 4-0034: ASoC: dai register 4-0034 #1
    [   58.789440] ssm4567 4-0034: ASoC: Mapped DAI ssm4567-hifi to CODEC ssm4567.4-0034
    [   58.797928] ssm4567 4-0034: ASoC: Registered DAI 'ssm4567-hifi'
    [   58.804613] ssm4567 4-0034: ASoC: Registered codec 'ssm4567.4-0034'
    [   58.811792] i2c-core: driver [ssm4567] registered
    [   58.812103] snddaudio0 sound.4: ASoC: binding sysvoice at idx 0
    [   58.812388] ssm4567 4-0034: read 0 => 81
    [   58.812454] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late -2
    [   58.812460] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late -1
    [   58.812466] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late 0
    [   58.812504] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late 1
    [   58.812509] snddaudio0 sound.4: ASoC: probe snddaudio0 dai link 0 late 2
    [   58.812544] ssm4567 4-0034: read 0 => 81
    [   58.812558] ssm4567 4-0034: read 0 => 81
    [   58.812573] ssm4567 4-0034: read 0 => 81
    [   58.812595] ssm4567 4-0034: read 0 => 81
    [   58.812634] ssm4567 4-0034: read 0 => 81
    [   58.812764] i2c i2c-4: master_xfer[0] W, addr=0x34, len=2
    [   58.813182] i2c i2c-4: master_xfer[0] W, addr=0x34, len=2
    [   58.813481] i2c i2c-4: master_xfer[0] W, addr=0x34, len=2
    # [   58.907585] snddaudio0 sound.4:  ssm4567-hifi <-> 1c22000.daudio mapping ok

  • Hi ADI

      Please give the tinymix cmds list DIRECTLY!   for us to using aplay xxx.wav  let the speaker play the voice.

  • Thanks a lot for your help to answer the question from customer.Customer is urgent due to tight schedule.

    Really appreciate.

  • #4

    # tinyplay /mnt/test.wav  -D 1
    Sample is 2 channels, device only supports <= 1 channels

    what's the reason?

  • Hi,

    Sorry but I missed the link to wiki page for amixer. You can find it here: Linux Sound Driver [Analog Devices Wiki]

    Unfortunately we don't support that "tinyalsa" lib so you have to figure out by yourself the adaptations ad commands you have to issue through "tinyalsa"

    You ask if the driver you ported is ok but please provide its sources to be able to respond that. Otherwise we don't know what are you porting. DMESG looks fine. Did you probed the I2S  lines? Is your CPU putting any data out?

    SSM4567 is a single output channel (mono) part. That's why it has only one channel.