1. 08 Mar, 2021 5 commits
  2. 03 Mar, 2021 1 commit
  3. 02 Mar, 2021 1 commit
  4. 01 Mar, 2021 5 commits
    • Mark Brown's avatar
      Merge series "AsoC: rt5640/rt5651: Volume control fixes" from Hans de Goede <hdegoede@redhat.com>: · d27f8fea
      Mark Brown authored
      Hi All,
      
      Here is a series of rt5640/rt5651 volume-control fixes which I wrote
      while working on a bytcr-rt5640 UCM profile patch-series adding
      hardware-volume control to devices using this UCM profile.
      
      The UCM series will also work on older kernels, but it works best on
      kernels with this series applied, giving e.g. finer grained volume
      control and support for hardware muting the outputs.
      
      Regards,
      
      Hans
      
      Hans de Goede (5):
        ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor
          of 10
        ASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor
          of 10
        ASoC: rt5640: Add emulated 'DAC1 Playback Switch' control
        ASoC: rt5640: Rename 'Mono DAC Playback Volume' to 'DAC2 Playback
          Volume'
        ASoC: Intel: bytcr_rt5640: Add used AIF to the components string
      
       sound/soc/codecs/rt5640.c             | 106 +++++++++++++++++++++++---
       sound/soc/codecs/rt5640.h             |   4 +
       sound/soc/codecs/rt5651.c             |   4 +-
       sound/soc/intel/boards/bytcr_rt5640.c |  11 ++-
       4 files changed, 111 insertions(+), 14 deletions(-)
      
      --
      2.30.1
      d27f8fea
    • Hans de Goede's avatar
      ASoC: es8316: Simplify adc_pga_gain_tlv table · 4d4e677a
      Hans de Goede authored
      Most steps in this table are steps of 3dB (300 centi-dB), so we can
      simplify the table.
      
      This not only reduces the amount of space it takes inside the kernel,
      this also makes alsa-lib's mixer code actually accept the table, where
      as before this change alsa-lib saw the "ADC PGA Gain" control as a
      control without a dB scale.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210228160441.241110-1-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      4d4e677a
    • Benjamin Rood's avatar
      ASoC: sgtl5000: set DAP_AVC_CTRL register to correct default value on probe · d74fcdc5
      Benjamin Rood authored
      According to the SGTL5000 datasheet [1], the DAP_AVC_CTRL register has
      the following bit field definitions:
      
      | BITS  | FIELD       | RW | RESET | DEFINITION                        |
      | 15    | RSVD        | RO | 0x0   | Reserved                          |
      | 14    | RSVD        | RW | 0x1   | Reserved                          |
      | 13:12 | MAX_GAIN    | RW | 0x1   | Max Gain of AVC in expander mode  |
      | 11:10 | RSVD        | RO | 0x0   | Reserved                          |
      | 9:8   | LBI_RESP    | RW | 0x1   | Integrator Response               |
      | 7:6   | RSVD        | RO | 0x0   | Reserved                          |
      | 5     | HARD_LMT_EN | RW | 0x0   | Enable hard limiter mode          |
      | 4:1   | RSVD        | RO | 0x0   | Reserved                          |
      | 0     | EN          | RW | 0x0   | Enable/Disable AVC                |
      
      The original default value written to the DAP_AVC_CTRL register during
      sgtl5000_i2c_probe() was 0x0510.  This would incorrectly write values to
      bits 4 and 10, which are defined as RESERVED.  It would also not set
      bits 12 and 14 to their correct RESET values of 0x1, and instead set
      them to 0x0.  While the DAP_AVC module is effectively disabled because
      the EN bit is 0, this default value is still writing invalid values to
      registers that are marked as read-only and RESERVED as well as not
      setting bits 12 and 14 to their correct default values as defined by the
      datasheet.
      
      The correct value that should be written to the DAP_AVC_CTRL register is
      0x5100, which configures the register bits to the default values defined
      by the datasheet, and prevents any writes to bits defined as
      'read-only'.  Generally speaking, it is best practice to NOT attempt to
      write values to registers/bits defined as RESERVED, as it generally
      produces unwanted/undefined behavior, or errors.
      
      Also, all credit for this patch should go to my colleague Dan MacDonald
      <dmacdonald@curbellmedical.com> for finding this error in the first
      place.
      
      [1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdfSigned-off-by: default avatarBenjamin Rood <benjaminjrood@gmail.com>
      Reviewed-by: default avatarFabio Estevam <festevam@gmail.com>
      Link: https://lore.kernel.org/r/20210219183308.GA2117@ubuntu-devSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      d74fcdc5
    • Hans de Goede's avatar
      ASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor of 10 · e4ffab87
      Hans de Goede authored
      The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB,
      not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace
      apps which translate the dB scale to a linear scale. With the logarithmic
      dB scale being of by a factor of 10 we loose all precision in the lower
      area of the range when apps translate things to a linear scale.
      
      E.g. the 0 dB default, which corresponds with a value of 47 of the
      0 - 127 range for the control, would be shown as 0/100 in alsa-mixer.
      
      Since the centi-dB values used in the TLV struct cannot represent the
      0.375 dB step size used by these controls, change the TLV definition
      for them to specify a min and max value instead of min + stepsize.
      
      Note this mirrors commit 3f31f7d9 ("ASoC: rt5670: Fix dac- and adc-
      vol-tlv values being off by a factor of 10") which made the exact same
      change to the rt5670 codec driver.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210226143817.84287-3-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      e4ffab87
    • Hans de Goede's avatar
      ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor of 10 · 24a7b77d
      Hans de Goede authored
      The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB,
      not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace
      apps which translate the dB scale to a linear scale. With the logarithmic
      dB scale being of by a factor of 10 we loose all precision in the lower
      area of the range when apps translate things to a linear scale.
      
      E.g. the 0 dB default, which corresponds with a value of 47 of the
      0 - 127 range for the control, would be shown as 0/100 in alsa-mixer.
      
      Since the centi-dB values used in the TLV struct cannot represent the
      0.375 dB step size used by these controls, change the TLV definition
      for them to specify a min and max value instead of min + stepsize.
      
      Note this mirrors commit 3f31f7d9 ("ASoC: rt5670: Fix dac- and adc-
      vol-tlv values being off by a factor of 10") which made the exact same
      change to the rt5670 codec driver.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210226143817.84287-2-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      24a7b77d
  5. 25 Feb, 2021 1 commit
  6. 24 Feb, 2021 7 commits
    • Mark Brown's avatar
      Merge series "ASoC: rt5670: Various kcontrol fixes" from Hans de Goede <hdegoede@redhat.com>: · fa27f540
      Mark Brown authored
      Hi All,
      
      While working on adding hardware-volume control support to the UCM
      profile for the rt5672 and on adding LED trigger support to the
      rt5670 codec driver. I hit / noticed a couple of issues this series
      fixes these issues.
      
      Regards,
      
      Hans
      
      Hans de Goede (4):
        ASoC: rt5670: Remove 'OUT Channel Switch' control
        ASoC: rt5670: Remove 'HP Playback Switch' control
        ASoC: rt5670: Remove ADC vol-ctrl mute bits poking from Sto1 ADC mixer
          settings
        ASoC: rt5670: Add emulated 'DAC1 Playback Switch' control
      
       sound/soc/codecs/rt5670.c | 110 +++++++++++++++++++++++++++++++++-----
       sound/soc/codecs/rt5670.h |   9 ++--
       2 files changed, 101 insertions(+), 18 deletions(-)
      
      --
      2.30.1
      fa27f540
    • Shengjiu Wang's avatar
      ASoC: ak5558: Add MODULE_DEVICE_TABLE · 741c8397
      Shengjiu Wang authored
      Add missed MODULE_DEVICE_TABLE for the driver can be loaded
      automatically at boot.
      
      Fixes: 92088477 ("ASoC: ak5558: Add support for AK5558 ADC driver")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarShengjiu Wang <shengjiu.wang@nxp.com>
      Link: https://lore.kernel.org/r/1614149872-25510-2-git-send-email-shengjiu.wang@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      741c8397
    • Shengjiu Wang's avatar
      ASoC: ak4458: Add MODULE_DEVICE_TABLE · f84b4524
      Shengjiu Wang authored
      Add missed MODULE_DEVICE_TABLE for the driver can be loaded
      automatically at boot.
      
      Fixes: 08660086 ("ASoC: ak4458: Add support for AK4458 DAC driver")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarShengjiu Wang <shengjiu.wang@nxp.com>
      Link: https://lore.kernel.org/r/1614149872-25510-1-git-send-email-shengjiu.wang@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      f84b4524
    • Hans de Goede's avatar
      ASoC: rt5670: Add emulated 'DAC1 Playback Switch' control · 98204293
      Hans de Goede authored
      For reliable output-mute LED control we need a "DAC1 Playback Switch"
      control. The "DAC Playback volume" control is the only control in the
      path from the DAC1 data input to the speaker output, so the UCM profile
      for the speaker output will have its PlaybackMixerElem set to "DAC1".
      
      But userspace (pulseaudio) will set the "DAC1 Playback Volume" control to
      its softest setting (which is not fully muted) while still showing the
      speaker as being enabled at a low volume in the UI.
      
      If we were to set the SNDRV_CTL_ELEM_ACCESS_SPK_LED on the "DAC1 Playback
      Volume" control, this would mean then what pressing KEY_VOLUMEDOWN the
      speaker-mute LED (embedded in the volume-mute toggle key) would light
      while the UI is still showing the speaker as being enabled at a low
      volume, meaning that the UI and the LED are out of sync.
      
      Only after an _extra_ KEY_VOLUMEDOWN press would the UI show the
      speaker as being muted.
      
      The path from DAC1 data input to the speaker output does have
      a digital mixer with DAC1's data as one of its inputs direclty after
      the "DAC1 Playback Volume" control.
      
      This commit adds an emulated "DAC1 Playback Switch" control by:
      
      1. Declaring the enable flag for that mixers DAC1 input as well as the
      "DAC1 Playback Switch" control both as SND_SOC_NOPM controls.
      
      2. Storing the settings of both controls as driver-private data
      
      3. Only clearing the mute flag for the DAC1 input of that mixer if the
      stored values indicate both controls are enabled.
      
      This is a preparation patch for adding "audio-mute" LED trigger support.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210215142118.308516-5-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      98204293
    • Hans de Goede's avatar
      ASoC: rt5670: Remove ADC vol-ctrl mute bits poking from Sto1 ADC mixer settings · 674e4ff4
      Hans de Goede authored
      The SND_SOC_DAPM_MIXER declaration for "Sto1 ADC MIXL" and "Sto1 ADC MIXR"
      was using the mute bits from the RT5670_STO1_ADC_DIG_VOL control as mixer
      master mute bits.
      
      But these bits are already exposed to userspace as controls as part of the
      "ADC Capture Volume" / "ADC Capture Switch" control pair:
      
              SOC_DOUBLE("ADC Capture Switch", RT5670_STO1_ADC_DIG_VOL,
                      RT5670_L_MUTE_SFT, RT5670_R_MUTE_SFT, 1, 1),
              SOC_DOUBLE_TLV("ADC Capture Volume", RT5670_STO1_ADC_DIG_VOL,
                              RT5670_L_VOL_SFT, RT5670_R_VOL_SFT,
                              127, 0, adc_vol_tlv),
      
      Both the fact that the mute bits belong to the same reg as the vol-ctrl
      and the "Digital Mixer Path" diagram in the datasheet clearly shows that
      these mute bits are not part of the mixer and having 2 separate controls
      poking at the same bits is a bad idea.
      
      Remove the master-mute bits settings from the  "Sto1 ADC MIXL" and
      "Sto1 ADC MIXR" DAPM widget declarations, avoiding these bits getting
      poked from 2 different places.
      
      This should not cause any issues for userspace. AFAICT the rt567x codecs
      are only used on x86/ACPI devices and the UCM profiles used there already
      set the "ADC Capture Switch" as needed.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210215142118.308516-4-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      674e4ff4
    • Hans de Goede's avatar
      ASoC: rt5670: Remove 'HP Playback Switch' control · 8022f098
      Hans de Goede authored
      The RT5670_L_MUTE_SFT and RT5670_R_MUTE_SFT bits (bits 15 and 7) of the
      RT5670_HP_VOL register are set / unset by the headphones deplop code
      run by rt5670_hp_event() on SND_SOC_DAPM_POST_PMU / SND_SOC_DAPM_PRE_PMD.
      
      So we should not also export a control to userspace which toggles these
      same bits.
      
      This should not cause any issues for userspace. AFAICT the rt567x codecs
      are only used on x86/ACPI devices and the UCM profiles used there do not
      use the "HP Playback Switch" control.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210215142118.308516-3-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      8022f098
    • Hans de Goede's avatar
      ASoC: rt5670: Remove 'OUT Channel Switch' control · 30be2641
      Hans de Goede authored
      The "OUT Channel Switch" control is a left over from code copied from
      thr rt5640 codec driver.
      
      With the rt5640 codec driver the output volume controls have 2 pairs of
      mute bits:
      bit 7, 15: Mute Control for Spk/Headphone/Line Output Port
      bit 6, 14: Mute Control for Spk/Headphone/Line Volume Channel
      
      Bits 7 and 15 are normal mute bits on the rt5670/5672 which are
      controlled by 2 dapm widgets:
      	SND_SOC_DAPM_SWITCH("LOUT L Playback", SND_SOC_NOPM, 0, 0,
      			    &lout_l_enable_control),
      	SND_SOC_DAPM_SWITCH("LOUT R Playback", SND_SOC_NOPM, 0, 0,
      			    &lout_r_enable_control),
      
      But on the 5670/5672 bit 6 is always reserved, where as bit 14 is
      "LOUT Differential Mode" on the 5670 and also reserved on the 5672.
      
      So the "OUT Channel Switch" control which is controlling bits 6+14
      of the "LINE Output Control" register is bogus -> remove it.
      
      This should not cause any issues for userspace. AFAICT the rt567x codecs
      are only used on x86/ACPI devices and the UCM profiles used there do not
      use the "OUT Channel Switch" control.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210215142118.308516-2-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      30be2641
  7. 23 Feb, 2021 2 commits
  8. 22 Feb, 2021 2 commits
  9. 17 Feb, 2021 6 commits
  10. 15 Feb, 2021 1 commit
  11. 12 Feb, 2021 3 commits
  12. 11 Feb, 2021 6 commits