17 Dec, 2018

1 commit

  • [ Upstream commit 3ee9a76a8c5a10e1bfb04b81db767c6d562ddaf3 ]

    commit 4d230d12710646 ("ASoC: rsnd: fixup not to call clk_get/set under
    non-atomic") fixuped clock start timing. But it exchanged clock start
    checker from ssi->usrcnt to ssi->rate.

    Current rsnd_ssi_master_clk_start() is called from .prepare,
    but some player (for example GStreamer) might calls it many times.
    In such case, the checker might returns error even though it was not
    error. It should check ssi->usrcnt instead of ssi->rate.
    This patch fixup it. Without this patch, GStreamer can't switch
    48kHz / 44.1kHz.

    Reported-by: Yusuke Goda
    Signed-off-by: Kuninori Morimoto
    Tested-by: Yusuke Goda
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Kuninori Morimoto
     

18 Oct, 2018

2 commits

  • [ Upstream commit 6c92d5a2744e27619a8fcc9d74b91ee9f1cdebd1 ]

    Current rsnd driver will fallback to PIO mode if it can't get DMA
    handler. But, DMA might return -EPROBE_DEFER when probe timing.
    This driver always fallback to PIO mode especially from
    commit ac6bbf0cdf4206c ("iommu: Remove IOMMU_OF_DECLARE") because
    of this reason.

    The DMA driver will be probed later, but sound driver might be
    probed as PIO mode in such case. This patch fixup this issue.
    Then, -EPROBE_DEFER is not error. Thus, let's don't indicate error
    message in such case.
    And it needs to call rsnd_adg_remove() individually if probe failed,
    because it registers clk which should be unregister.

    Maybe PIO fallback feature itself is not needed,
    but let's keep it so far.

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Kuninori Morimoto
     
  • [ Upstream commit 69235ccf491d2e26aefd465c0d3ccd1e3b2a9a9c ]

    ADG has buffer over flow bug if DT has more than 3 clock-frequency.
    This patch fixup this issue, and uses first 2 values.

    clock-frequency = ; /* this is OK */
    clock-frequency = ; /* this is NG */

    Signed-off-by: Kuninori Morimoto
    Tested-by: Hiroyuki Yokoyama
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Kuninori Morimoto
     

29 Sep, 2018

1 commit

  • commit 4d230d12710646788af581ba0155d83ab48b955c upstream.

    Clocking operations clk_get/set_rate, are non-atomic,
    they shouldn't be called in soc_pcm_trigger() which is atomic.

    Following issue was found due to execution of clk_get_rate() causes
    sleep in soc_pcm_trigger(), which shouldn't be blocked.

    We can reproduce this issue by following
    > enable CONFIG_DEBUG_ATOMIC_SLEEP=y
    > compile, and boot
    > mount -t debugfs none /sys/kernel/debug
    > while true; do cat /sys/kernel/debug/clk/clk_summary > /dev/null; done &
    > while true; do aplay xxx; done

    This patch adds support to .prepare callback, and moves non-atomic
    clocking operations to it. As .prepare is non-atomic, it is always
    called before trigger_start/trigger_stop.

    BUG: sleeping function called from invalid context at kernel/locking/mutex.c:620
    in_atomic(): 1, irqs_disabled(): 128, pid: 2242, name: aplay
    INFO: lockdep is turned off.
    irq event stamp: 5964
    hardirqs last enabled at (5963): [] mutex_lock_nested+0x6e8/0x6f0
    hardirqs last disabled at (5964): [] _raw_spin_lock_irqsave+0x24/0x68
    softirqs last enabled at (5502): [] __do_softirq+0x560/0x10c0
    softirqs last disabled at (5495): [] irq_exit+0x160/0x25c
    Preemption disabled at:[ 62.904063] [] snd_pcm_stream_lock+0xb4/0xc0
    CPU: 2 PID: 2242 Comm: aplay Tainted: G B C 4.9.54+ #186
    Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
    Call trace:
    [] dump_backtrace+0x0/0x37c
    [] show_stack+0x14/0x1c
    [] dump_stack+0xfc/0x154
    [] ___might_sleep+0x57c/0x58c
    [] __might_sleep+0x208/0x21c
    [] mutex_lock_nested+0xb4/0x6f0
    [] clk_prepare_lock+0xb0/0x184
    [] clk_core_get_rate+0x14/0x54
    [] clk_get_rate+0x20/0x34
    [] rsnd_adg_ssi_clk_try_start+0x158/0x4f8 [snd_soc_rcar]
    [] rsnd_ssi_init+0x668/0x7a0 [snd_soc_rcar]
    [] rsnd_soc_dai_trigger+0x4bc/0xcf8 [snd_soc_rcar]
    [] soc_pcm_trigger+0x2a4/0x2d4

    Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
    Signed-off-by: Jiada Wang
    Signed-off-by: Timo Wischer
    [Kuninori: tidyup for upstream]
    Signed-off-by: Kuninori Morimoto
    Tested-by: Hiroyuki Yokoyama
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Jiada Wang
     

18 Aug, 2018

1 commit

  • commit b7165d26bf730567ab081bb9383aff82cd43d9ea upstream.

    Current ADG driver is over-writing flags. This patch fixes it.

    Reported-by: Hiroyuki Yokoyama
    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown
    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Greg Kroah-Hartman

    Kuninori Morimoto
     

03 Mar, 2018

1 commit

  • [ Upstream commit d5aa24825da5711f8cb829f873160ddf1a29b19c ]

    BRGCKR should use 0x80770000, instead of 0x80FF0000.

    R-Car Gen2 xxx_TIMSEL should use 0x0F1F,
    R-Car Gen3 xxx_TIMSEL should use 0x1F1F.
    Here, Gen3 doesn't support AVD, thus, both case can use 0x0F1F.

    Signed-off-by: Kuninori Morimoto
    Reviewed-by: Hiroyuki Yokoyama
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Kuninori Morimoto
     

25 Feb, 2018

1 commit

  • [ Upstream commit 33f801366bdf3f8b67dfe325b84f4051a090d01e ]

    Currently there is race condition between set of byte_pos and wrap
    it around when new buffer starts. If .pointer is called in-between
    it will result in inconsistent pointer position be returned
    from .pointer callback.

    This patch increments buffer pointer atomically to avoid this issue.

    Signed-off-by: Jiada Wang
    Reviewed-by: Takashi Sakamoto
    Acked-by: Kuninori Morimoto
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jiada Wang
     

20 Dec, 2017

1 commit


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
     

01 Sep, 2017

3 commits


22 Aug, 2017

1 commit


21 Aug, 2017

1 commit


18 Aug, 2017

2 commits


15 Aug, 2017

4 commits


10 Aug, 2017

7 commits

  • Omit an extra message for a memory allocation failure in these functions.

    This issue was detected by using the Coccinelle software.

    Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
    Signed-off-by: Markus Elfring
    Signed-off-by: Mark Brown

    Markus Elfring
     
  • Each module's dai callback function availability is controlled
    by mod->status. For example "always called", "call once".
    In .probe/.remove case, it needs to be called always, because
    .probe will call xxx_attach() function on .probe, especially
    if platform is using MIXer.
    For example, below case, MIX0/DVC0/SSI0 needs to be called twice.

    playback = ;
    playback = ;

    But in this case, SSI0 will call request_irq() twice.
    This patch add new RSND_SSI_PROBED flag and control it

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     
  • Current rsnd_ssi_mode_flags() is not useful. This patch adds
    new rsnd_ssi_flags_has/add() macro for it.

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     
  • commit 701172dca15b ("ASoC: rsnd: don't use devm_request_irq() for SSI")
    exchanged devm_request_irq() to request_irq() for SSI, because SSI will
    fallback into PIO mode if DMA doesn't work.
    But, because of it, PIO mode needed to call free_irq() when removing,
    not only DMA mode.
    This patch call free_irq() both PIO/DMA. Otherwise, rsnd IRQ handler
    will be increased if user tried many unbind/bind.

    Fixes: 701172dca15b ("ASoC: rsnd: don't use devm_request_irq() for SSI")
    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     
  • …/sound into asoc-rcar

    Mark Brown
     
  • commit 1f8754d4daea5f ("ASoC: rsnd: don't call free_irq() on
    Parent SSI") fixed Parent SSI duplicate free_irq().
    But on Renesas Sound, not only Parent SSI but also Multi SSI
    have same issue.
    This patch avoid duplicate free_irq() if it was not pure SSI.

    Fixes: 1f8754d4daea5f ("ASoC: rsnd: don't call free_irq() on Parent SSI")
    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     
  • R-Car Gen3 sound device can use TDM 16ch, but its usage is very
    limited. It is not yet supported.
    Let's remove unexpected/unsupported channel settings for now.
    This patch makes xx_ADINR register settings sanity without
    runtime check.

    R-Car Gen3 datasheet

    40.4.7 Note on Usage of the SSIU Module
    When an SSIU module is used in "TDM-16ch mode",
    only the transfer with the external memory is available.

    Reported-by: Nguyen Viet Dung
    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     

08 Aug, 2017

3 commits

  • In case of SSI0 playback, SSI1 capture, SSI0 might be shared for
    clock output if clock master mode.

    Current rsnd driver had been assumed that SSI clock contiguous
    output which is needed for SSI parent needs SSICR::EN (SSI module
    enable) bit.
    But, this bit controls data input/output, not for clock.
    Clock contiguous output needs SSICR : FORCE, SCKD, SWSD,
    and SSIWSR : CONT. Not SSICR : EN.

    Because of this wrong assumption, and insufficient control, on current
    code, for example, if it starts SSI0(playback) -> SSI1(capture) order,
    SSI0 SSICR::EN bit will temporarily be 0.
    It causes playback side underrun error. This is bug.
    We can reproduce this issue with SSI+SRC (without DVC), and capture
    during playback operation.

    This patch fixup current (wrong) assumption, and control SSICR::EN bit
    correctly.

    Reported-by: Hiroyuki Yokoyama
    Signed-off-by: Kuninori Morimoto
    Tested-by: Hiroyuki Yokoyama
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     
  • For example SSI0/SSI1 case, SSI1 can share pin with SSI0.
    And then, SSI1 needs SSI0's clock.
    This clock controlling is very picky and difficult to understand
    in current code.

    This patch adds new rsnd_ssi_can_output_clk() macro,
    the code will be more understandable.

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     
  • Make it the same style as other functions

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     

02 Aug, 2017

1 commit

  • ADG is registering fixed rate clock for audio_clkout, but it had not
    been unregister clock when removing.

    Salvator-X board is using ak4613 driver now, and it supports
    hw_constraints from commit 907cd8809eebc ("ASoC: ak4613: add
    hw_constraint rule for Sampling Rate").
    And this calculation is using input clk. This ak4613 input clock is
    ADG clkout on Salvator-X.

    Because ADG had not been unregister clkout when unbinding, it receives
    fixed rate clk register error when re-binding.
    Thus, ak4613 can't get correct input clock, and hw_constraints will be
    failed after re-binding.
    This means Salvator-X board can't use sound after unbind/bind.

    This patch solves this issue.

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     

28 Jul, 2017

1 commit


24 Jul, 2017

2 commits

  • Current rsnd kctrl is using both .private_value (for rsnd_kctrl_cfg)
    and .private_data (for rsnd_mod) on snd_kcontrol.
    But only 1 private data (= rsnd_kctrl_cfg) can be enough if it has
    rsnd_mod pointer.
    This patch doesn't use private_value.

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     
  • commit b047e1cce8 ("ASoC: ac97: Support multi-platform AC'97")
    modified hac_soc_platform_probe(), but "int ret" was missed.
    This patch adds missing "int ret", otherwise, we will get

    linux/sound/soc/sh/hac.c: In function 'hac_soc_platform_probe':
    linux/sound/soc/sh/hac.c:318: error: 'ret' undeclared (first use in this function)
    linux/sound/soc/sh/hac.c:318: error: (Each undeclared identifier is reported only once
    linux/sound/soc/sh/hac.c:318: error: for each function it appears in.)

    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     

18 Jul, 2017

1 commit

  • Remove unnecessary static on local variable ops.
    Such variable is initialized before being used,
    on every execution path throughout the function.
    The static has no benefit and, removing it reduces
    the code size.

    This issue was detected using Coccinelle and the following semantic patch:

    @bad exists@
    position p;
    identifier x;
    type T;
    @@

    static T x@p;
    ...
    x =

    @@
    identifier x;
    expression e;
    type T;
    position p != bad.p;
    @@

    -static
    T x@p;
    ... when != x
    when strict
    ?x = e;

    In the following log you can see the difference in the code size. Also,
    there is a significant difference in the bss segment. This log is the
    output of the size command, before and after the code change:

    before:
    text data bss dec hex filename
    3211 680 64 3955 f73 sound/soc/sh/rcar/ssiu.o

    after:
    text data bss dec hex filename
    3207 592 0 3799 ed7 sound/soc/sh/rcar/ssiu.o

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Mark Brown

    Gustavo A. R. Silva
     

17 Jul, 2017

2 commits

  • for_each_child_of_node performs an of_node_get on each iteration, so a
    jump out of the loop requires an of_node_put.

    The semantic patch that fixes this problem is as follows
    (http://coccinelle.lip6.fr):

    //
    @@
    local idexpression n;
    expression e,e1;
    identifier l;
    @@

    for_each_child_of_node(e1,n) {
    ...
    (
    of_node_put(n);
    |
    e = n
    |
    + of_node_put(n);
    ? goto l;
    )
    ...
    }
    ...
    l: ... when != n
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Mark Brown

    Julia Lawall
     
  • This dev_pm_ops structure is only stored in the pm field of a
    device_driver structure. This field is declared const, so
    dev_pm_ops structures that have this property can be declared
    as const also.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Mark Brown

    Gustavo A. R. Silva
     

04 Jul, 2017

1 commit

  • ASoC: Updates for v4.13

    The big news with this release is the of-graph card, this provides a
    replacement for simple-card that is much more flexibile and scalable,
    allowing many more systems to use a generic sound card than was possible
    before:

    - The of-graph card, finally merged after a long and dedicated effort
    by Morimoto-san.
    - New widget types intended mainly for use with DSPs.
    - New drivers for Allwinner V3s SoCs, Ensonic ES8316, several classes
    of x86 machine, Rockchip PDM controllers, STM32 I2S and S/PDIF
    controllers and ZTE AUD96P22 CODECs.

    Takashi Iwai
     

03 Jul, 2017

1 commit


30 Jun, 2017

1 commit

  • Don't populate the arrays path and cmd_case on the stack but make
    them static const. Makes the object code smaller:

    Before:
    text data bss dec hex filename
    2673 624 0 3297 ce1 sound/soc/sh/rcar/cmd.o

    After:
    text data bss dec hex filename
    2398 768 0 3166 c5e sound/soc/sh/rcar/cmd.o

    Signed-off-by: Colin Ian King
    Signed-off-by: Mark Brown

    Colin Ian King