20 Dec, 2018

1 commit

  • The SOF implementation does not rely on the hdac_bus library, however
    for HDMI and HDaudio codec support it does need to deal with
    unsolicited events. Instead of re-inventing the wheel, export this
    symbol to reuse this part of the library directly.

    Signed-off-by: Keyon Jie
    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Takashi Iwai

    Keyon Jie
     

11 Dec, 2018

2 commits

  • After the recent refactoring, snd_hdac_display_power() doesn't return
    any error, hence it can be defined to return void.
    This makes many error checks redundant and allows us to reduce them
    gracefully.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • The current HD-audio code manages the DRM audio power via too complex
    redirections, and this seems even still unbalanced in a corner case as
    Intel DRM CI has been intermittently reporting. This patch is a big
    surgery for addressing the complexity and the possible unbalance.

    Basically the patch changes the display PM in the following ways:

    - Both HD-audio controller and codec drivers call a single helper,
    snd_hdac_display_power(). (Formerly, the display power control from
    a codec was done indirectly via link_power bus ops.)

    - snd_hdac_display_power() receives the codec address index. For
    turning on/off from the controller, pass HDA_CODEC_IDX_CONTROLLER.

    - snd_hdac_display_power() doesn't manage refcounts any longer, but
    keeps the power status in bitmap. If any of controller or codecs is
    turned on, the function updates the DRM power state via get_power()
    or put_power().

    Also this refactor allows us more cleanup:

    - The link_power bus ops is dropped, so there is no longer indirect
    management, as mentioned in the above.

    - hdac_device link_power_control flag is moved to hda_codec
    display_power_control flag, as it's only for HDA legacy.

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106525
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

26 Oct, 2018

1 commit

  • Pull sound updates from Takashi Iwai:
    "There have been little changes in ALSA core stuff, but ASoC core still
    kept rolling for the continued restructuring. The rest are lots of
    small driver-specific changes and some minor API updates. Here are
    highlights:

    General:
    - Appropriate fall-through annotations everywhere
    - Some code cleanup in memalloc code, handling non-cacahed pages more
    commonly in the helper
    - Deployment of SNDRV_PCM_INFO_SYNC_APPLPTR flag consistently

    Drivers:
    - More HD-audio CA0132 codec improvement for supporting other Creative
    boards
    - Plumbing legacy HD-audio codecs as ASoC BE on Intel SST; this will
    give move support of existing HD-audio devices with DSP
    - A few device-specific HD-audio quirks as usual
    - New quirk for RME CC devices and correction for B&W PX for USB-audio
    - FireWire: code refactoring including devres usages

    ASoC Core:
    - Continued componentization works; it's almost done!
    - A bunch of new for_each_foo macros
    - Cleanups and fixes in DAPM code

    ASoC Drivers:
    - MCLK support for several different devices, including CS42L51, STM32
    SAI, and MAX98373
    - Support for Allwinner A64 CODEC analog, Intel boards with DA7219 and
    MAX98927, Meson AXG PDM inputs, Nuvoton NAU8822, Renesas R8A7744 and
    TI PCM3060"

    * tag 'sound-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (299 commits)
    ASoC: stm32: sai: fix master clock naming
    ASoC: stm32: add clock dependency for sai
    ALSA: hda/ca0132 - Actually fix microphone issue
    ASoC: sun4i-i2s: move code from startup/shutdown hooks into pm_runtime hooks
    ASoC: wm2000: Remove wm2000_read helper function
    ASoC: cs42l51: fix mclk support
    ASoC: wm_adsp: Log addresses as 8 digits in wm_adsp_buffer_populate
    ASoC: wm_adsp: Rename memory fields in wm_adsp_buffer
    ASoC: cs42l51: add mclk support
    ASoC: stm32: sai: set sai as mclk clock provider
    ASoC: dt-bindings: add mclk support to cs42l51
    ASoC: dt-bindings: add mclk provider support to stm32 sai
    ASoC: soc-core: fix trivial checkpatch issues
    ASoC: dapm: Add support for hw_free on CODEC to CODEC links
    ASoC: Intel: kbl_da7219_max98927: minor white space clean up
    ALSA: i2c/cs8427: Fix int to char conversion
    ALSA: doc: Brush up the old writing-an-alsa-driver
    ASoC: rsnd: tidyup SSICR::SWSP for TDM
    ASoC: rsnd: enable TDM settings for SSI parent
    ASoC: pcm3168a: add hw constraint for capture channel
    ...

    Linus Torvalds
     

21 Oct, 2018

1 commit


04 Oct, 2018

1 commit


02 Oct, 2018

1 commit


20 Sep, 2018

1 commit

  • The timeout of audio component binding was incorrectly specified in
    msec, not in jiffies, which results in way too shorter timeout than
    expected.

    Along with fixing it, add the information print about the binding
    failure to show the unexpected situation more clearly.

    Fixes: a57942bfdd61 ("ALSA: hda: Make audio component support more generic")
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

18 Sep, 2018

1 commit


12 Sep, 2018

2 commits

  • Internally, skl_init_chip() calls snd_hdac_bus_init_chip() which
    1) sets bus->chip_init to prevent multiple entrances before device
    is stopped; 2) enables interrupt.

    We shouldn't use it for the purpose of resetting device only because
    1) when we really want to initialize device, we won't be able to do
    so; 2) we are ready to handle interrupt yet, and kernel crashes when
    interrupt comes in.

    Rename azx_reset() to snd_hdac_bus_reset_link(), and use it to reset
    device properly.

    Fixes: 60767abcea3d ("ASoC: Intel: Skylake: Reset the controller in probe")
    Reviewed-by: Takashi Iwai
    Signed-off-by: Yu Zhao
    Signed-off-by: Mark Brown

    Yu Zhao
     
  • In snd_hdac_bus_init_chip(), we enable interrupt before
    snd_hdac_bus_init_cmd_io() initializing dma buffers. If irq has
    been acquired and irq handler uses the dma buffer, kernel may crash
    when interrupt comes in.

    Fix the problem by postponing enabling irq after dma buffer
    initialization. And warn once on null dma buffer pointer during the
    initialization.

    Reviewed-by: Takashi Iwai
    Signed-off-by: Yu Zhao
    Signed-off-by: Mark Brown

    Yu Zhao
     

07 Sep, 2018

1 commit

  • Split regmap_config.use_single_rw into use_single_read and
    use_single_write. This change enables drivers of devices which only
    support bulk operations in one direction to use the regmap_bulk_*()
    functions for both directions and have their bulk operation split into
    single operations only when necessary.

    Update all struct regmap_config instances where use_single_rw==true to
    instead set both use_single_read and use_single_write. No attempt was
    made to evaluate whether it is possible to set only one of
    use_single_read or use_single_write.

    Signed-off-by: David Frey
    Signed-off-by: Mark Brown

    David Frey
     

04 Sep, 2018

1 commit


27 Jul, 2018

2 commits

  • The BDL pointer used in snd_hdac_dsp_prepare() should be declared as
    __le32, as warned by sparse:
    sound/hda/hdac_stream.c:655:47: warning: incorrect type in argument 4 (different base types)
    sound/hda/hdac_stream.c:655:47: expected restricted __le32 [usertype] **bdlp
    sound/hda/hdac_stream.c:655:47: got unsigned int [usertype] **

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • The PCM format type is defined with __bitwise, hence it can't be
    passed as integer but needs an explicit cast. In this patch, instead
    of the messy cast flood, define the format argument of
    snd_hdac_calc_stream_format() to be the proper snd_pcm_format_t type.

    This fixes sparse warnings like:
    sound/hda/hdac_device.c:760:38: warning: incorrect type in argument 1 (different base types)

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

24 Jul, 2018

1 commit

  • Currently HD-audio i915 audio binding doesn't support any delayed
    binding, and supposes that the i915 driver registers the component
    immediately. This has been OK, so far, but the work-in-progress
    change in i915 may introduce the asynchronous binding, which
    effectively delays the component registration.

    For addressing it, implement a completion to be synced with the master
    binding. The timeout is set to 10 seconds which should be long enough
    and hopefully be not too annoying if anyone boots up a debugging
    session with i915 KMS turned off.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

18 Jul, 2018

3 commits

  • This is the final step for more generic support of DRM audio
    component. The generic audio component code is now moved to its own
    file, and the symbols are renamed from snd_hac_i915_* to
    snd_hdac_acomp_*, respectively. The generic code is enabled via the
    new kconfig, CONFIG_SND_HDA_COMPONENT, while CONFIG_SND_HDA_I915 is
    kept as the super-class.

    Along with the split, three new callbacks are added to audio_ops:
    pin2port is for providing the conversion between the pin number and
    the widget id, and master_bind/master_unbin are called at binding /
    unbinding the master component, respectively. All these are optional,
    but used in i915 implementation and also other later implementations.

    A note about the new snd_hdac_acomp_init() function: there is a slight
    difference between this and the old snd_hdac_i915_init(). The latter
    (still) synchronizes with the master component binding, i.e. it
    assures that the relevant DRM component gets bound when it returns, or
    gives a negative error. Meanwhile the new function doesn't
    synchronize but just leaves as is. It's the responsibility by the
    caller's side to synchronize, or the caller may accept the
    asynchronous binding on the fly.

    v1->v2: Fix missing NULL check in master_bind/unbind

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • The HD-audio i915 binding code contains a single pointer, hdac_acomp,
    for allowing the access to audio component from the master bind/unbind
    callbacks. This was needed because the callbacks pass only the device
    pointer and we can't guarantee the object type assigned to the drvdata
    (which is free for each controller driver implementation).
    And this implementation will be a problem if we support multiple
    components for different DRM drivers, not only i915.

    As a solution, allocate the audio component object via devres and
    associate it with the given device, so that the component callbacks
    can refer to it via devres_find().

    The removal of the object is still done half-manually via
    devres_destroy() to make the code consistent (although it may work
    without the explicit call).

    Also, the snd_hda_i915_register_notifier() had the reference to
    hdac_acomp as well. In this patch, the corresponding code is removed
    by passing hdac_bus object to the function, too.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • For allowing other drivers to use the DRM audio component, rename the
    i915_audio_component_* with drm_audio_component_*, and split the
    generic part into drm_audio_component.h. The i915 specific stuff
    remains in struct i915_audio_component, which contains
    drm_audio_component as the base.

    The license of drm_audio_component.h is kept to MIT as same as the the
    original i915_component.h.

    This is a preliminary change for further development, and no
    functional changes by this patch itself, merely code-split and
    renames.

    v1->v2: Use SPDX for drm_audio_component.h, fix remaining i915
    argument in drm_audio_component.h

    Reviewed-by: Rodrigo Vivi
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

28 Jun, 2018

6 commits


24 Apr, 2018

1 commit

  • Introduce a new helper macro, snd_array_for_each(), to iterate for
    each snd_array element. It slightly improves the readability than
    lengthy open codes at each place.

    Along with it, add const prefix to some obvious places.

    There should be no functional changes by this.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

12 Feb, 2018

1 commit


05 Jan, 2018

1 commit


22 Dec, 2017

1 commit

  • Since the commit 97cc2ed27e5a ("ALSA: hda - Fix yet another i915
    pointer leftover in error path") cleared hdac_acomp pointer, the
    WARN_ON() non-NULL check in snd_hdac_i915_register_notifier() may give
    a false-positive warning, as the function gets called no matter
    whether the component is registered or not. For fixing it, let's get
    rid of the spurious WARN_ON().

    Fixes: 97cc2ed27e5a ("ALSA: hda - Fix yet another i915 pointer leftover in error path")
    Cc:
    Reported-by: Kouta Okamoto
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

01 Dec, 2017

1 commit

  • This patch renames all the variable instances of hdac_device with hdev
    to prepare the code base to remove the usage of hdac_ext_device
    data structures done in the following patches. Existing code uses hdev
    and hdac as variable names for hdac_device as well as hdac_ext_device,
    which creates confusion.

    Signed-off-by: Rakesh Ughreja
    Signed-off-by: Mark Brown

    Ughreja, Rakesh A
     

17 Nov, 2017

1 commit

  • We got a regression report about the HD-audio HDMI chmap, where some
    surround channels are reported as UNKNOWN. The git bisection pointed
    the culprit at the commit 9b3dc8aa3fb1 ("ALSA: hda - Register chmap
    obj as priv data instead of codec"). The story behind scene is like
    this:

    - While moving the code out of the legacy HDA to the HDA common place,
    the patch modifies the code to obtain the chmap array indirectly in
    a byte array, and it expands it to kctl value array.
    - At the latter operation, the size of the array is wrongly passed by
    sizeof() to the pointer.
    - It can be 4 on 32bit arch, thus too short for 6+ channels.
    (And that's the reason why it didn't hit other persons; it's 8 on
    64bit arch, thus it's usually enough.)

    The code was further changed meanwhile, but the problem persisted.
    Let's fix it by correctly evaluating the array size.

    Fixes: 9b3dc8aa3fb1 ("ALSA: hda - Register chmap obj as priv data instead of codec")
    Reported-by: VDR User
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

13 Nov, 2017

2 commits

  • …e/sound into for-linus

    ASoC: Updates for v4.15

    The biggest thing this release has been the conversion of the AC98 bus
    to the driver model, that's been a long time coming so thanks to Robert
    Jarzmik for his dedication there. Due to there being some AC97 MFD
    there's a few fairly large changes in input and the MFD layer, mainly to
    the wm97xx driver.

    There's also some drivers/drm changes to support the new AMD Stoney
    platform, these are shared with the DRM subsystem and should be being
    merged via both.

    Within the subsystem the overwhelming bulk of the changes is in the
    Intel drivers which continue to need lots of cleanups and fixes, this
    release they've also gained support for their open source firmware.
    There's also some large changs in the core as Morimoto-san continues to
    mirror operations into the component level in preparation for conversion
    of drivers to that.

    - The AC97 bus has finally caught up with the driver model thanks to
    some dedicated and persistent work from Robert Jarzmik.
    - Continued work from Morimoto-san on moving us towards being able to
    use components for everything.
    - Lots of cleanups for the Intel platform code, including support for
    their open source audio firmware.
    - Support for scaling MCLK with sample rate in simple-card.
    - Support for AMD Stoney platform.

    Takashi Iwai
     
  • Pull 4.15 updates to take over the previous urgent fixes.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

24 Oct, 2017

1 commit


19 Oct, 2017

1 commit

  • The refresh of HD-audio widget sysfs kobjects via
    snd_hdac_refresh_widget_sysfs() is slightly racy.
    The driver recreates the whole tree from scratch after deleting the
    whole. When CONFIG_DEBUG_KOBJECT_RELEASE option is used, kobject
    release doesn't happen immediately but delayed, while the re-creation
    of the same named kobject happens soon after invoking kobject_put().
    This may end up with the conflicts of duplicated kobjects, as found in
    the bug report below.

    In this patch, we take another approach to refresh the tree: instead
    of recreating the whole tree, just add the new nodes and delete the
    non-existing nodes. Since the refresh happens only once at
    initialization, no longer race would happen.

    Along with the code change, merge snd_hdac_refresh_widget_sysfs() with
    the existing snd_hdac_refresh_widgets() with an additional bool flag
    for simplifying the code.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197307
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

18 Oct, 2017

1 commit

  • The loop in snd_hdac_bus_parse_capabilities() may go to nirvana when
    it hits an invalid register value read:

    BUG: unable to handle kernel paging request at ffffad5dc41f3fff
    IP: pci_azx_readl+0x5/0x10 [snd_hda_intel]
    Call Trace:
    snd_hdac_bus_parse_capabilities+0x3c/0x1f0 [snd_hda_core]
    azx_probe_continue+0x7d5/0x940 [snd_hda_intel]
    .....

    This happened on a new Intel machine, and we need to check the value
    and abort the loop accordingly.

    [Note: the fixes tag below indicates only the commit where this patch
    can be applied; the original problem was introduced even before that
    commit]

    Fixes: 6720b38420a0 ("ALSA: hda - move bus_parse_capabilities to core")
    Cc:
    Acked-by: Vinod Koul
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

19 Jul, 2017

1 commit

  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    2610 304 8 2922 b6a sound/hda/hdac_i915.o

    File size After adding 'const':
    text data bss dec hex filename
    2674 240 8 2922 b6a sound/hda/hdac_i915.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: Takashi Iwai

    Arvind Yadav
     

20 Jun, 2017

1 commit

  • When the codec device is unregistered / freed, it may release the
    resource while being used in an unsolicited event like the jack
    detection work. This leads to use-after-free.

    The fix here is to unregister the device at first, i.e. removing the
    codec from the list, then flushing the pending works to assure that
    all unsol events are gone. After this point, we're free from
    accessing the codec via unsol events, thus can release the resources
    gracefully.

    The issue was spotted originally by Intel CI, but it couldn't be
    reproduced reliably by its nature. So let's hope this fix really
    addresses the whole issues.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196045
    Reported-by: Martin Peres
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

10 May, 2017

1 commit

  • Using jiffies in hdac_wait_for_cmd_dmas() to determine when to time out
    when interrupts are off (snd_hdac_bus_stop_cmd_io()/spin_lock_irq())
    causes hard lockup so unlock while waiting using jiffies.

    ------
    [ 1211.603046] NMI watchdog: Watchdog detected hard LOCKUP on cpu 3
    [ 1211.603047] Modules linked in: snd_hda_intel i915 vgem
    [ 1211.603053] irq event stamp: 13366
    [ 1211.603053] hardirqs last enabled at (13365):
    ...
    [ 1211.603059] Call Trace:
    [ 1211.603059] ? delay_tsc+0x3d/0xc0
    [ 1211.603059] __delay+0xa/0x10
    [ 1211.603060] __const_udelay+0x31/0x40
    [ 1211.603060] snd_hdac_bus_stop_cmd_io+0x96/0xe0 [snd_hda_core]
    [ 1211.603060] ? azx_dev_disconnect+0x20/0x20 [snd_hda_intel]
    [ 1211.603061] snd_hdac_bus_stop_chip+0xb1/0x100 [snd_hda_core]
    [ 1211.603061] azx_stop_chip+0x9/0x10 [snd_hda_codec]
    [ 1211.603061] azx_suspend+0x72/0x220 [snd_hda_intel]
    [ 1211.603061] pci_pm_suspend+0x71/0x140
    [ 1211.603062] dpm_run_callback+0x6f/0x330
    [ 1211.603062] ? pci_pm_freeze+0xe0/0xe0
    [ 1211.603062] __device_suspend+0xf9/0x370
    [ 1211.603062] ? dpm_watchdog_set+0x60/0x60
    [ 1211.603063] async_suspend+0x1a/0x90
    [ 1211.603063] async_run_entry_fn+0x34/0x160
    [ 1211.603063] process_one_work+0x1f4/0x6d0
    [ 1211.603063] ? process_one_work+0x16e/0x6d0
    [ 1211.603064] worker_thread+0x49/0x4a0
    [ 1211.603064] kthread+0x107/0x140
    [ 1211.603064] ? process_one_work+0x6d0/0x6d0
    [ 1211.603065] ? kthread_create_on_node+0x40/0x40
    [ 1211.603065] ret_from_fork+0x2e/0x40

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100419
    Fixes: 38b19ed7f81ec ("ALSA: hda: fix to wait for RIRB & CORB DMA to set")
    Reported-by: Marta Lofstedt
    Suggested-by: Takashi Iwai
    Signed-off-by: Jeeja KP
    Acked-by: Vinod Koul
    CC: stable # 4.7
    Signed-off-by: Takashi Iwai

    Jeeja KP