Skip to content
Snippets Groups Projects

BL_INTERNAL: sound: codecs: tas2562: refactor volume control get function

Open Vitor Sato Eschholz requested to merge vsatoes/MAN-236 into mtk-android12-5.10
  1. Sep 22, 2023
    • Vitor Sato Eschholz's avatar
      BL_INTERNAL: sound: codecs: tas2562.c: expose registers as alsa controls · 9b22d803
      Vitor Sato Eschholz authored
      
      Expose registers of tas2562 to allow reading and writing from/to
      them using ALSA controls. This will allow user to set a amplifier
      configuration which differs from the default one.
      
      Test
      - Reading registers:
        console:/ # tinymix
        Mixer name: 'mt-snd-card'
        Number of controls: 363
        ctl     type    num     name                                     value
        [...]
        127     BYTE    1       PAGE0 SW_RESET                            00
        128     BYTE    1       PAGE0 PWR_CTL                             0d
        129     BYTE    1       PAGE0 PB_CFG1                             20
        130     BYTE    1       PAGE0 MISC_CFG1                           c6
        131     BYTE    1       PAGE0 MISC_CFG2                           22
        [...]
      
      - Write to register and read back:
        console:/ # tinymix "PAGE0 PWR_CTL" 0x0c
        console:/ # tinymix "PAGE0 PWR_CTL"
        PAGE0 PWR_CTL:  0c
      
      Signed-off-by: default avatarVitor Sato Eschholz <vsatoes@baylibre.com>
      9b22d803
    • Vitor Sato Eschholz's avatar
      BL_INTERNAL: sound: codecs: tas2562: refactor volume control get function · 93d65a82
      Vitor Sato Eschholz authored
      
      tas2562_volume_control_get() assumes that Digital Volume is only
      changed using the correspondent ALSA Control. However, it can also
      be changed by directly writing to DVC_CFG[1-4] registers, or by a
      software reset.
      
      To ensure tas2562_volume_control_get() returns the current digital
      volume level of the amplifier, update the function so that it reads
      the registers instead of returning the data internally stored.
      
      Signed-off-by: default avatarVitor Sato Eschholz <vsatoes@baylibre.com>
      93d65a82
Loading