08 Sep, 2022

2 commits

  • [ Upstream commit 2e6481a3f3ee6234ce577454e1d88aca55f51d47 ]

    The struct nhlt_format's fmt_config is a flexible array, it must not be
    used as normal array.
    When moving to the next nhlt_fmt_cfg we need to take into account the data
    behind the ->config.caps (indicated by ->config.size).

    Fixes: a864e8f159b13 ("ALSA: hda: intel-nhlt: verify config type")
    Signed-off-by: Peter Ujfalusi
    Reviewed-by: Pierre-Louis Bossart
    Reviewed-by: Jaska Uimonen
    Link: https://lore.kernel.org/r/20220823122405.18464-1-peter.ujfalusi@linux.intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Peter Ujfalusi
     
  • [ Upstream commit 6376ab02374822e1e8758a848ee736a182786a2e ]

    The module and function information can be added with
    'modprobe foo dyndbg=+pmf'

    Suggested-by: Greg KH
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Péter Ujfalusi
    Reviewed-by: Bard Liao
    Link: https://lore.kernel.org/r/20220616220559.136160-1-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Pierre-Louis Bossart
     

22 Jun, 2022

1 commit

  • [ Upstream commit 527f4643e03c298c1e3321cfa27866b1374a55e1 ]

    Added the support of new Huawei codec HW8326. The HW8326 is developed
    by Huawei with Realtek's IP Core, and it's compatible with ALC256.

    Signed-off-by: huangwenhui
    Link: https://lore.kernel.org/r/20220608082357.26898-1-huangwenhuia@uniontech.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    huangwenhui
     

27 Jan, 2022

1 commit

  • [ Upstream commit 6dd21ad81bf96478db3403b1bbe251c0612d0431 ]

    HDA uses a timecounter to read a hardware clock running at 24 MHz. The
    conversion factor is set with a mult value of 125 and a shift value of 0,
    which is not converting the hardware clock to nanoseconds, it is converting
    to 1/3 nanoseconds because the conversion factor from 24Mhz to nanoseconds
    is 125/3. The usage sites divide the "nanoseconds" value returned by
    timecounter_read() by 3 to get a real nanoseconds value.

    There is a lengthy comment in azx_timecounter_init() explaining this
    choice. That comment makes blatantly wrong assumptions about how
    timecounters work and what can overflow.

    The comment says:

    * Applying the 1/3 factor as part of the multiplication
    * requires at least 20 bits for a decent precision, however
    * overflows occur after about 4 hours or less, not a option.

    timecounters operate on time deltas between two readouts of a clock and use
    the mult/shift pair to calculate a precise nanoseconds value:

    delta_nsec = (delta_clock * mult) >> shift;

    The fractional part is also taken into account and preserved to prevent
    accumulated rounding errors. For details see cyclecounter_cyc2ns().

    The mult/shift pair has to be chosen so that the multiplication of the
    maximum expected delta value does not result in a 64bit overflow. As the
    counter wraps around on 32bit, the maximum observable delta between two
    reads is (1 << 32) - 1 which is about 178.9 seconds.

    That in turn means the maximum multiplication factor which fits into an u32
    will not cause a 64bit overflow ever because it's guaranteed that:

    ((1 << 32) - 1) ^ 2 < (1 << 64)

    The resulting correct multiplication factor is 2796202667 and the shift
    value is 26, i.e. 26 bit precision. The overflow of the multiplication
    would happen exactly at a clock readout delta of 6597069765 which is way
    after the wrap around of the hardware clock at around 274.8 seconds which
    is off from the claimed 4 hours by more than an order of magnitude.

    If the counter ever wraps around the last read value then the calculation
    is off by the number of wrap arounds times 178.9 seconds because the
    overflow cannot be observed.

    Use clocks_calc_mult_shift(), which calculates the most accurate mult/shift
    pair based on the given clock frequency, and remove the bogus comment along
    with the divisions at the readout sites.

    Fixes: 5d890f591d15 ("ALSA: hda: support for wallclock timestamps")
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/871r35kwji.ffs@tglx
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Thomas Gleixner
     

05 Jan, 2022

2 commits

  • [ Upstream commit 78ea40efb48e978756db2ce45fcfa55bac056b91 ]

    In the HDAS ACPI scope, the SoundWire may not be the direct child of HDAS.
    It needs to go through the ACPI table at max depth of 2 to find the
    SoundWire device from HDAS.

    Reviewed-by: Péter Ujfalusi
    Signed-off-by: Libin Yang
    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20211221010817.23636-3-yung-chuan.liao@linux.intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Libin Yang
     
  • [ Upstream commit 385f287f9853da402d94278e59f594501c1d1dad ]

    The existing code currently sets a pointer to an ACPI handle before
    checking that it's actually a SoundWire controller. This can lead to
    issues where the graph walk continues and eventually fails, but the
    pointer was set already.

    This patch changes the logic so that the information provided to
    the caller is set when a controller is found.

    Reviewed-by: Péter Ujfalusi
    Signed-off-by: Libin Yang
    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20211221010817.23636-2-yung-chuan.liao@linux.intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Libin Yang
     

08 Dec, 2021

1 commit

  • commit ae26c08e6c8071ba8febb0c7c0829da96c75248c upstream.

    We've added quirks for ESS8336 but missed CML, add quirks for both LP
    and H versions.

    BugLink: https://github.com/thesofproject/linux/issues/3248
    Fixes: 9d36ceab9415 ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
    Signed-off-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     

01 Dec, 2021

1 commit

  • [ Upstream commit fa9730b4f28b7bd183d28a0bf636ab7108de35d7 ]

    These devices are based on an I2C/I2S device, we need to force the use
    of the SOF driver otherwise the legacy HDaudio driver will be loaded -
    only HDMI will be supported.

    We previously added support for other Intel platforms but missed
    JasperLake.

    BugLink: https://github.com/thesofproject/linux/issues/3210
    Fixes: 9d36ceab9415 ('ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec')
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Kai Vehmanen
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20211027023254.24955-1-yung-chuan.liao@linux.intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Pierre-Louis Bossart
     

25 Nov, 2021

3 commits

  • commit 1465d06a6d8580e73ae65f8590392df58c5ed2fd upstream.

    The fields 'opened', 'running', 'assigned_key' are all protected by a
    spinlock, but the spinlock is not taken when looking for a
    stream. This can result in a possible race between assign() and
    release().

    Fix by taking the spinlock before walking through the bus stream list.

    Signed-off-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20210924192417.169243-2-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai
    Cc: Scott Bruce
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     
  • commit 868ddfcef31ff93ea8961b2e81ea7fe12f6f144b upstream.

    The code for hdac_ext_stream seems inherited from hdac_stream, and
    similar locking issues are present: the use of the bus->reg_lock
    spinlock is inconsistent, with only writes to specific fields being
    protected.

    Apply similar fix as in hdac_stream by protecting all accesses to
    'link_locked' and 'decoupled' fields, with a new helper
    snd_hdac_ext_stream_decouple_locked() added to simplify code
    changes.

    Signed-off-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20210924192417.169243-4-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     
  • [ Upstream commit 9d36ceab94151f07cf3fcb067213ac87937adf12 ]

    These devices are based on an I2C/I2S device, we need to force the use
    of the SOF driver otherwise the legacy HDaudio driver will be loaded -
    only HDMI will be supported.

    Co-developed-by: Huajun Li
    Signed-off-by: Huajun Li
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20211004213512.220836-3-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Pierre-Louis Bossart
     

13 Oct, 2021

1 commit

  • The snd_hdac_bus_reset_link() contains logic to clear STATESTS register
    before performing controller reset. This code dates back to an old
    bugfix in commit e8a7f136f5ed ("[ALSA] hda-intel - Improve HD-audio
    codec probing robustness"). Originally the code was added to
    azx_reset().

    The code was moved around in commit a41d122449be ("ALSA: hda - Embed bus
    into controller object") and ended up to snd_hdac_bus_reset_link() and
    called primarily via snd_hdac_bus_init_chip().

    The logic to clear STATESTS is correct when snd_hdac_bus_init_chip() is
    called when controller is not in reset. In this case, STATESTS can be
    cleared. This can be useful e.g. when forcing a controller reset to retry
    codec probe. A normal non-power-on reset will not clear the bits.

    However, this old logic is problematic when controller is already in
    reset. The HDA specification states that controller must be taken out of
    reset before writing to registers other than GCTL.CRST (1.0a spec,
    3.3.7). The write to STATESTS in snd_hdac_bus_reset_link() will be lost
    if the controller is already in reset per the HDA specification mentioned.

    This has been harmless on older hardware. On newer generation of Intel
    PCIe based HDA controllers, if configured to report issues, this write
    will emit an unsupported request error. If ACPI Platform Error Interface
    (APEI) is enabled in kernel, this will end up to kernel log.

    Fix the code in snd_hdac_bus_reset_link() to only clear the STATESTS if
    the function is called when controller is not in reset. Otherwise
    clearing the bits is not possible and should be skipped.

    Signed-off-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20211012142935.3731820-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Takashi Iwai

    Kai Vehmanen
     

20 Jul, 2021

1 commit

  • We missed the fact that ElkhartLake platforms have two different PCI
    IDs. We only added one so the SOF driver is never selected by the
    autodetection logic for the missing configuration.

    BugLink: https://github.com/thesofproject/linux/issues/2990
    Fixes: cc8f81c7e625 ('ALSA: hda: fix intel DSP config')
    Signed-off-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20210719231746.557325-1-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai

    Pierre-Louis Bossart
     

30 May, 2021

1 commit

  • Add HD Audio PCI ID for Intel AlderLake-M. Add rules to
    snd_intel_dsp_find_config() to choose SOF driver for ADL-M systems with
    PCH-DMIC or Soundwire codecs, and legacy driver for the rest.

    Signed-off-by: Kai Vehmanen
    Reviewed-by: Péter Ujfalusi
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20210528185123.48332-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Takashi Iwai

    Kai Vehmanen
     

30 Mar, 2021

1 commit

  • ALSA: control - add generic LED API

    This patchset tries to resolve the diversity in the audio LED
    control among the ALSA drivers. A new control layer registration
    is introduced which allows to run additional operations on
    top of the elementary ALSA sound controls.

    A new control access group (three bits in the access flags)
    was introduced to carry the LED group information for
    the sound controls. The low-level sound drivers can just
    mark those controls using this access group. This information
    is not exported to the user space, but user space can
    manage the LED sound control associations through sysfs
    (last patch) per Mark's request. It makes things fully
    configurable in the kernel and user space (UCM).

    The actual state ('route') evaluation is really easy
    (the minimal value check for all channels / controls / cards).
    If there's more complicated logic for a given hardware,
    the card driver may eventually export a new read-only
    sound control for the LED group and do the logic itself.

    The new LED trigger control code is completely separated
    and possibly optional (there's no symbol dependency).
    The full code separation allows eventually to move this
    LED trigger control to the user space in future.
    Actually it replaces the already present functionality
    in the kernel space (HDA drivers) and allows a quick adoption
    for the recent hardware (ASoC codecs including SoundWire).

    snd_ctl_led 24576 0

    The sound driver implementation is really easy:

    1) call snd_ctl_led_request() when control LED layer should be
    automatically activated
    / it calls module_request("snd-ctl-led") on demand /
    2) mark all related kcontrols with
    SNDRV_CTL_ELEM_ACCESS_SPK_LED or
    SNDRV_CTL_ELEM_ACCESS_MIC_LED

    Link: https://lore.kernel.org/r/20210317172945.842280-1-perex@perex.cz
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

19 Mar, 2021

2 commits

  • This reverts commit f8e4ae10de43 ("ALSA: hda: Allow setting
    preallocation again for x86").

    The reverted commit itself is a revert of c31427d0d21e ("ALSA: hda: No
    preallocation on x86 platforms"). It was needed because HDA allowed very
    big allocations, up to 1GB per stream. However as previous commit in
    this series changes maximum allowed allocation per stream to 4MB, we can
    safely revert it back.

    On systems where there are a lot of FrontEnds, when
    CONFIG_SND_HDA_PREALLOC_SIZE != 0 ALSA core allocates memory for each
    FE, which may cause out of memory problems due to per card limit. Force
    config to 0 on X86, so memory will be allocated on as needed basis.

    Bug: https://bugzilla.kernel.org/show_bug.cgi?id=201251#c322
    Suggested-by: Takashi Iwai
    Reviewed-by: Cezary Rojewski
    Signed-off-by: Amadeusz Sławiński
    Link: https://lore.kernel.org/r/20210318160618.2504068-4-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Takashi Iwai

    Amadeusz Sławiński
     
  • Signed-off-by: huangjianghui
    Link: https://lore.kernel.org/r/20210319013854.48830-1-huangjianghui@uniontech.com
    Signed-off-by: Takashi Iwai

    huangjianghui
     

04 Mar, 2021

1 commit

  • On some Lenovo systems if the microphone is disabled in the BIOS
    only the NHLT table header is created, with no data. This means
    the endpoints field is not correctly set to zero - leading to an
    unintialised variable and hence invalid descriptors are parsed
    leading to page faults.

    The Lenovo firmware team is addressing this, but adding a check
    preventing invalid tables being parsed is worthwhile.

    Tested on a Lenovo T14.

    Tested-by: Philipp Leskovitz
    Reported-by: Philipp Leskovitz
    Signed-off-by: Mark Pearson
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20210302141003.7342-1-markpearson@lenovo.com
    Signed-off-by: Takashi Iwai

    Mark Pearson
     

03 Mar, 2021

1 commit

  • ALSA/ASoC/SOF/SoundWire: fix Kconfig issues

    In January, Intel kbuild bot and Arnd Bergmann reported multiple
    issues with randconfig. This patchset builds on Arnd's suggestions to

    a) expose ACPI and PCI devices in separate modules, while sof-acpi-dev
    and sof-pci-dev become helpers. This will result in minor changes
    required for developers/testers, i.e. modprobe snd-sof-pci will no
    longer result in a probe. The SOF CI was already updated to deal with
    this module dependency change and introduction of new modules.

    b) Fix SOF/SoundWire/DSP_config dependencies by moving the code
    required to detect SoundWire presence in ACPI tables to sound/hda.

    Link: https://lore.kernel.org/r/20210302003125.1178419-1-pierre-louis.bossart@linux.intel.com

    Takashi Iwai
     

02 Mar, 2021

4 commits

  • We rely on implicit includes, list out explicitly what this code
    relies on.

    Suggested-by: Guennadi Liakhovetski
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Kai Vehmanen
    Reviewed-by: Guennadi Liakhovetski
    Reviewed-by: Bard Liao
    Acked-by: Mark Brown
    Acked-by: Vinod Koul
    Link: https://lore.kernel.org/r/20210302003125.1178419-8-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai

    Pierre-Louis Bossart
     
  • The ACPI scan capabilities is called from the intel-dspconfig as well
    as the SOF/HDaudio drivers. This creates dependencies and randconfig issues
    when HDaudio and SOF/SoundWire are not all configured as modules.

    To simplify Kconfig dependencies between HDAudio, SoundWire, SOF and
    intel-dspconfig, move the ACPI scan helpers to a dedicated
    module. This follows the same idea as NHLT helpers which are already
    handled as a dedicated module.

    The only functional change is that the kernel parameter to filter
    links is now handled by a different module, but that was only provided
    for developers needing work-arounds for early BIOS releases.

    Reported-by: Arnd Bergmann
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Kai Vehmanen
    Reviewed-by: Guennadi Liakhovetski
    Reviewed-by: Bard Liao
    Acked-by: Mark Brown
    Acked-by: Vinod Koul
    Link: https://lore.kernel.org/r/20210302003125.1178419-7-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai

    Pierre-Louis Bossart
     
  • Multiple bug reports report issues with the SOF and SST drivers when
    dealing with single microphone cases.

    We currently read the DMIC array information unconditionally but we
    don't check that the configuration type is actually a mic array.

    When the DMIC link does not rely on a mic array configuration, the
    recommendation is to check the format information to infer the maximum
    number of channels, and map this to the number of microphones.

    This leaves a potential for a mismatch between actual microphones
    available in hardware and what the ACPI table contains, but we have no
    other source of information.

    Note that single microphone configurations can alternatively be
    handled with a 'mic array' configuration along with a 'vendor-defined'
    geometry.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201251
    BugLink: https://github.com/thesofproject/linux/issues/2725
    Fixes: 7a33ea70e1868 ('ALSA: hda: intel-nhlt: handle NHLT VENDOR_DEFINED DMIC geometry')
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Guennadi Liakhovetski
    Reviewed-by: Rander Wang
    Reviewed-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20210302000146.1177770-1-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai

    Pierre-Louis Bossart
     
  • v5.12-rc1 flags new warnings with make W=1, fix missing or broken
    function descriptors.

    sound/pci/hda/hda_codec.c:3492: warning: expecting prototype for
    snd_hda_input_mux_info_info(). Prototype was for
    snd_hda_input_mux_info() instead

    sound/pci/hda/hda_codec.c:3521: warning: expecting prototype for
    snd_hda_input_mux_info_put(). Prototype was for
    snd_hda_input_mux_put() instead

    sound/pci/hda/hda_codec.c:3958: warning: expecting prototype for
    _snd_hda_pin_ctl(). Prototype was for _snd_hda_set_pin_ctl() instead

    sound/pci/hda/hda_jack.c:223: warning: expecting prototype for
    snd_hda_set_dirty_all(). Prototype was for
    snd_hda_jack_set_dirty_all() instead

    sound/pci/hda/hda_jack.c:309: warning: expecting prototype for
    snd_hda_jack_detect_enable_mst(). Prototype was for
    snd_hda_jack_detect_enable_callback_mst() instead

    sound/pci/hda/hda_generic.c:3933: warning: expecting prototype for
    snd_dha_gen_add_mute_led_cdev(). Prototype was for
    snd_hda_gen_add_mute_led_cdev() instead

    sound/pci/hda/hda_generic.c:4093: warning: expecting prototype for
    snd_dha_gen_add_micmute_led_cdev(). Prototype was for
    snd_hda_gen_add_micmute_led_cdev() instead

    sound/pci/hda/patch_ca0132.c:2357: warning: expecting prototype for
    Prepare and send the SCP message to DSP(). Prototype was for
    dspio_scp() instead

    sound/pci/hda/patch_ca0132.c:2883: warning: expecting prototype for
    Allocate router ports(). Prototype was for dsp_allocate_router_ports()
    instead

    sound/pci/hda/patch_ca0132.c:3202: warning: expecting prototype for
    Write a block of data into DSP code or data RAM using pre(). Prototype
    was for dspxfr_one_seg() instead

    sound/pci/hda/patch_ca0132.c:3397: warning: expecting prototype for
    data overlay to DSP memories(). Prototype was for dspxfr_image()
    instead

    sound/hda/hdac_regmap.c:393: warning: expecting prototype for
    snd_hdac_regmap_init(). Prototype was for snd_hdac_regmap_exit()
    instead

    sound/hda/ext/hdac_ext_controller.c:142: warning: expecting prototype
    for snd_hdac_ext_bus_get_link_index(). Prototype was for
    snd_hdac_ext_bus_get_link() instead

    sound/hda/ext/hdac_ext_stream.c:140: warning: expecting prototype for
    snd_hdac_ext_linkstream_start(). Prototype was for
    snd_hdac_ext_link_stream_start() instead

    Signed-off-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20210301174617.116960-1-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai

    Pierre-Louis Bossart
     

18 Feb, 2021

1 commit

  • Add rules to select SOF driver for Alder Lake systems if a digital
    microphone or SoundWire codecs are present in the system. This is
    following same rules as for older Tiger Lake systems.

    Signed-off-by: Kai Vehmanen
    Reviewed-by: Xiuli Pan
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20210210111310.2227417-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Takashi Iwai

    Kai Vehmanen
     

09 Feb, 2021

1 commit

  • The kernel has 2 drivers for the Low Power Engine audio-block on
    Bay- and Cherry-Trail SoCs. The old SST driver and the new SOF
    driver. If both drivers are enabled then the kernel will default
    to using the old SST driver, unless told otherwise through the
    snd_intel_dspcfg.dsp_driver module-parameter.

    Add a boolean SND_INTEL_BYT_PREFER_SOF Kconfig option, which when set to Y
    will make the kernel default to the new SOF driver instead.
    The option defaults to n, preserving the current behavior.

    Making this configurable will help distributions such as Fedora:
    https://fedoraproject.org/w/index.php?title=Changes/SofDefaultForIntelLpe
    to test using SOF on BYT/CHT during the transition phase where we
    have both drivers (eventually the old driver and this option will
    be removed).

    Note that this drops the acpi_config_table[] containing 2 entries per ACPI
    hardware-id if both drivers are enabled. snd_intel_acpi_dsp_find_config()
    will always return the first hit, so we only need a single entry with the
    flags value set depending on the Kconfig settings.

    Suggested-by: Takashi Iwai
    Signed-off-by: Hans de Goede
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20210208135919.135600-1-hdegoede@redhat.com
    Signed-off-by: Takashi Iwai

    Hans de Goede
     

08 Feb, 2021

1 commit

  • The extended HDA bus (hdac_ext) provides interfaces for more
    fine-grained control of individual links than what plain HDA
    provides for. Links can be powered off when they are not used and if
    all links are released, controller can shut down the command DMA.

    These interfaces are currently not used by common HDA codec drivers.
    When a HDA codec is runtime suspended, it calls snd_hdac_codec_link_down(),
    but there is no link to the HDA extended bus, and on controller side
    the links are shut down only when all codecs are suspended.

    This patch adds link_power() to hdac_bus ops. Controllers using the HDA
    extended core, can use this to plug in snd_hdac_ext_bus_link_power() to
    implement more fine-grained control of link power.

    No change is needed for plain HDA controllers nor to existing HDA
    codec drivers.

    Co-developed-by: Ranjani Sridharan
    Signed-off-by: Ranjani Sridharan
    Signed-off-by: Kai Vehmanen
    Acked-by: Mark Brown
    Link: https://lore.kernel.org/r/20210205184630.1938761-2-kai.vehmanen@linux.intel.com
    Signed-off-by: Takashi Iwai

    Kai Vehmanen
     

03 Feb, 2021

1 commit


31 Jan, 2021

1 commit

  • The only usage of hdac_dev_attr_group is to put its address in an array
    of pointers to const attribute_group structs. Make it const to allow the
    compiler to put it in read-only memory.

    Signed-off-by: Rikard Falkeborn
    Link: https://lore.kernel.org/r/20210131001241.2278-3-rikard.falkeborn@gmail.com
    Signed-off-by: Takashi Iwai

    Rikard Falkeborn
     

25 Jan, 2021

1 commit

  • Adding PCI id for TGL-H. Like for other TGL platforms, SOF is used if
    Soundwire codecs or PCH-DMIC is detected.

    Signed-off-by: Bard Liao
    Reviewed-by: Xiuli Pan
    Reviewed-by: Libin Yang
    Signed-off-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20210125083051.828205-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Takashi Iwai

    Bard Liao
     

25 Dec, 2020

1 commit

  • Use DIV_ROUND_UP() and roundup() instead of open-coding them. This
    documents intent and makes it more clear what is going on for the casual
    reviewer.

    Generated using the following the Coccinelle semantic patch.

    //
    @@
    expression x, y;
    @@
    -((((x) + (y) - 1) / (y)) * y)
    +roundup(x, y)

    @r1@
    expression x;
    constant C1;
    constant C2;
    @@
    (x + C1) / C2

    @script:python@
    C1 << r1.C1;
    C2 << r1.C2;
    @@
    print C1, C2
    try:
    if int(C1) != int(C2) - 1:
    cocci.include_match(False)
    except:
    cocci.include_match(False)

    @@
    expression r1.x;
    constant r1.C1;
    constant r1.C2;
    @@
    -(((x) + C1) / C2)
    +DIV_ROUND_UP(x, C2)
    //

    Signed-off-by: Lars-Peter Clausen
    Link: https://lore.kernel.org/r/20201223172229.781-9-lars@metafoo.de
    Signed-off-by: Takashi Iwai

    Lars-Peter Clausen
     

05 Dec, 2020

1 commit


20 Nov, 2020

3 commits

  • On Haswell/Broadwell/Baytrail/Braswell, the DSP is not used for the
    HDMI/DP interface, and setting the dsp_driver parameter to a value > 1
    has the side effect of preventing the HDaudio legacy driver from
    probing.

    The DSP driver selection should really only handle cases where a DSP
    is actually used. This patch traps all known PCI devices and makes
    sure the HDaudio driver can always be probed.

    Signed-off-by: Pierre-Louis Bossart
    Acked-by: Takashi Iwai
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Rander Wang
    Reviewed-by: Guennadi Liakhovetski
    Link: https://lore.kernel.org/r/20201112223825.39765-15-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     
  • Add ACPI IDs for Broadwell (and Haswell for consistency). This
    addition is required for dynamic selection of drivers on those
    devices.

    Signed-off-by: Pierre-Louis Bossart
    Acked-by: Takashi Iwai
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Rander Wang
    Reviewed-by: Guennadi Liakhovetski
    Link: https://lore.kernel.org/r/20201112223825.39765-11-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     
  • Mirror capabilities provided for PCI devices, so that distributions
    can select which ACPI driver is loaded at run-time with kernel
    parameters and DMI tables instead of forcing a build-time selection.

    The "legacy" option supported for HDaudio has no meaning here and will
    be ignored.

    The 'SST' driver based on closed-source firmware has the priority to
    avoid any impact on users, and the choice to use SOF is strictly
    opt-in. This may change at some point when the 'SST' driver is
    deprecated on Baytrail/Cherrytrail.

    Signed-off-by: Pierre-Louis Bossart
    Acked-by: Takashi Iwai
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Rander Wang
    Reviewed-by: Guennadi Liakhovetski
    Link: https://lore.kernel.org/r/20201112223825.39765-4-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     

03 Nov, 2020

1 commit


12 Oct, 2020

1 commit

  • …e/sound into for-linus

    ASoC: Updates for v5.10

    Not a huge amount going on in the core for ASoC this time but quite a
    lot of driver activity, especially for the Intel platforms:

    - Replacement of the DSP driver for some older x86 systems with a new
    one which was written with closer reference to the DSP firmware so
    should hopefully be more robust and maintainable.
    - A big batch of static checker and other fixes for the rest of the x86
    DSP drivers.
    - Cleanup of the error unwinding code from Morimoto-san, hopefully
    making it more robust.
    - Helpers for parsing auxiluary devices from the device tree from
    Stephan Gerhold.
    - New support for AllWinner A64, Cirrus Logic CS4234, Mediatek MT6359
    Microchip S/PDIF TX and RX controllers, Realtek RT1015P, and Texas
    Instruments J721E, TAS2110, TAS2564 and TAS2764

    Takashi Iwai
     

09 Oct, 2020

1 commit

  • Current hdac_i915 uses a static completion instance to wait
    for i915 driver to complete the component bind.

    This design is not safe if multiple HDA controllers are active and
    communicating with different i915 instances, and can lead to list
    corruption and failed audio driver probe.

    Fix the design by moving completion mechanism to common acomp
    code and remove the related code from hdac_i915.

    Fixes: 7b882fe3e3e8 ("ALSA: hda - handle multiple i915 device instances")
    Co-developed-by: Kai Vehmanen
    Signed-off-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20201006161722.500256-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

06 Oct, 2020

1 commit


25 Sep, 2020

1 commit

  • Drop the kerneldoc markup for connectivity_check() as it's an
    static helper function. Fixes the following make W=1 warning:

    sound/hda/hdac_i915.c:80: warning: Function parameter or member 'i915' not described in 'connectivity_check'
    sound/hda/hdac_i915.c:80: warning: Function parameter or member 'hdac' not described in 'connectivity_check'

    Fixes: 7b882fe3e3e8 ('ALSA: hda - handle multiple i915 device instances')
    Signed-off-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20200924161027.3402260-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Takashi Iwai

    Kai Vehmanen
     

22 Sep, 2020

1 commit

  • To provide backward compatibility to older systems, the SOF HDA driver
    allows user to specify which HDMI codec driver to use at runtime via
    kernel parameter. This mechanism has a subtle flaw in that it assumes
    the codec drivers not to be loaded when the SOF PCI driver is loaded.

    The problem is rooted in use of the hdev->type field.
    snd_hdac_ext_bus_device_init() initializes this field to HDA_DEV_ASOC.
    This signals the HDA core that ASoC drivers should be considered in
    driver matching (hda_bus_match()). The SOF and SST drivers continue by
    overriding this field to HDA_DEV_LEGACY and proceeding to load driver
    modules with request_module(). Correct drivers will get loaded and
    attached.

    If however the codec drivers are already loaded when
    snd_hdac_ext_bus_device_init() is called, the matching will not work as
    expected as device type is still set to HDA_DEV_ASOC. Specifically if
    hdac-hdmi is attached when machine driver is configured to use hdac-hda,
    this leads to out-of-bounds memory access in
    hda_dsp_hdmi_build_controls().

    Fix the issue by adding codec type as a parameter to
    snd_hdac_ext_bus_device_init() and ensuring type is set correctly from
    the start.

    Fixes: 139c7febad1a ("ASoC: SOF: Intel: add support for snd-hda-codec-hdmi")
    Signed-off-by: Kai Vehmanen
    Reviewed-by: Guennadi Liakhovetski
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200921100841.2882662-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Mark Brown

    Kai Vehmanen