lkml.org 
[lkml]   [2018]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.18 14/48] ASoC: rsnd: don't fallback to PIO mode when -EPROBE_DEFER
    Date
    From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

    [ 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 <kuninori.morimoto.gx@renesas.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    ---
    sound/soc/sh/rcar/core.c | 10 +++++++++-
    sound/soc/sh/rcar/dma.c | 4 ++++
    2 files changed, 13 insertions(+), 1 deletion(-)

    diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
    index ff13189a7ee4..982a72e73ea9 100644
    --- a/sound/soc/sh/rcar/core.c
    +++ b/sound/soc/sh/rcar/core.c
    @@ -482,7 +482,7 @@ static int rsnd_status_update(u32 *status,
    (func_call && (mod)->ops->fn) ? #fn : ""); \
    if (func_call && (mod)->ops->fn) \
    tmp = (mod)->ops->fn(mod, io, param); \
    - if (tmp) \
    + if (tmp && (tmp != -EPROBE_DEFER)) \
    dev_err(dev, "%s[%d] : %s error %d\n", \
    rsnd_mod_name(mod), rsnd_mod_id(mod), \
    #fn, tmp); \
    @@ -1550,6 +1550,14 @@ static int rsnd_probe(struct platform_device *pdev)
    rsnd_dai_call(remove, &rdai->capture, priv);
    }

    + /*
    + * adg is very special mod which can't use rsnd_dai_call(remove),
    + * and it registers ADG clock on probe.
    + * It should be unregister if probe failed.
    + * Mainly it is assuming -EPROBE_DEFER case
    + */
    + rsnd_adg_remove(priv);
    +
    return ret;
    }

    diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
    index ef82b94d038b..2f3f4108fda5 100644
    --- a/sound/soc/sh/rcar/dma.c
    +++ b/sound/soc/sh/rcar/dma.c
    @@ -244,6 +244,10 @@ static int rsnd_dmaen_attach(struct rsnd_dai_stream *io,
    /* try to get DMAEngine channel */
    chan = rsnd_dmaen_request_channel(io, mod_from, mod_to);
    if (IS_ERR_OR_NULL(chan)) {
    + /* Let's follow when -EPROBE_DEFER case */
    + if (PTR_ERR(chan) == -EPROBE_DEFER)
    + return PTR_ERR(chan);
    +
    /*
    * DMA failed. try to PIO mode
    * see
    --
    2.17.1
    \
     
     \ /
      Last update: 2018-10-05 18:27    [W:3.414 / U:0.728 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site