summaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: sh: rz-ssi: Release the DMA channels in rz_ssi_probe() error pathLad Prabhakar2022-04-271-3/+10
| | | | | | | | | | | | DMA channels requested by rz_ssi_dma_request() in rz_ssi_probe() were never released in the error path apart from one place. This patch fixes this issue by calling rz_ssi_release_dma_channels() in the error path. Fixes: 26ac471c5354 ("ASoC: sh: rz-ssi: Add SSI DMAC support") Reported-by: Pavel Machek <pavel@denx.de> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20220426074922.13319-4-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Propagate error codes returned from platform_get_irq_byname()Lad Prabhakar2022-04-271-6/+3
| | | | | | | | | | | | | Propagate error codes returned from platform_get_irq_byname() instead of returning -ENODEV. platform_get_irq_byname() may return -EPROBE_DEFER, to handle such cases propagate the error codes. While at it drop the dev_err_probe() messages as platform_get_irq_byname() already does this for us in case of error. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20220426074922.13319-3-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Drop SSIFSR_TDC and SSIFSR_RDC macrosLad Prabhakar2022-04-271-2/+0
| | | | | | | | | | | The mask values of SSIFSR_TDC and SSIFSR_RDC macros are incorrect and they are unused in the file so just drop them. Reported-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20220426074922.13319-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: Make SND_SOC_RZ depend on ARCH_RZG2LBiju Das2022-04-251-1/+1
| | | | | | | | | | | | The SSI block is identical on Renesas RZ/G2L, RZ/G2UL and RZ/V2L SoC's, so instead of adding dependency for each SoC's add dependency on ARCH_RZG2L. The ARCH_RZG2L config option is already selected by ARCH_R9A07G043, ARCH_R9A07G044 and ARCH_R9A07G054. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20220423164443.146299-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: care return value from rsnd_node_fixed_index()Kuninori Morimoto2022-04-216-11/+43
| | | | | | | | | | | | | | | | | Renesas Sound is very complex, and thus it needs to use rsnd_node_fixed_index() to know enabled pin index. It returns error if strange pin was selected, but some codes didn't check it. This patch 1) indicates error message, 2) check return value. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87pmlbgn5t.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: care default case on rsnd_ssiu_busif_err_status_clear()Kuninori Morimoto2022-04-211-1/+3
| | | | | | | | | | | | | | | | | | | | commit cfb7b8bf1e2d66 ("ASoC: rsnd: tidyup rsnd_ssiu_busif_err_status_clear()") merged duplicate code, but it didn't care about default case, and causes smatch warnings. smatch warnings: sound/soc/sh/rcar/ssiu.c:112 rsnd_ssiu_busif_err_status_clear() \ error: uninitialized symbol 'offset'. sound/soc/sh/rcar/ssiu.c:114 rsnd_ssiu_busif_err_status_clear() \ error: uninitialized symbol 'shift'. This patch cares it. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87r15rgn6p.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: use inclusive language for DAIFMT maskKuninori Morimoto2022-04-051-1/+1
| | | | | | | | | It is still using discriminatory terms on DAIFMT mask. This patch tidyup it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87ilropdu9.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: fsi: Add check for clk_enableJiasheng Jiang2022-03-071-3/+16
| | | | | | | | | | | As the potential failure of the clk_enable(), it should be better to check it and return error if fails. Fixes: ab6f6d85210c ("ASoC: fsi: add master clock control functions") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Link: https://lore.kernel.org/r/20220302062844.46869-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Remove duplicate macrosLad Prabhakar2022-01-251-2/+0
| | | | | | | | | Remove SSICR_MST and SSICR_CKDV macros which are defined more than once. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20220125132457.14984-4-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Add rz_ssi_set_substream() helper functionLad Prabhakar2022-01-251-5/+13
| | | | | | | | | | | | | | | | | | | | | A copy of substream pointer is stored in priv structure during rz_ssi_dai_trigger() callback ie in SNDRV_PCM_TRIGGER_START case and the pointer is assigned to NULL in case of SNDRV_PCM_TRIGGER_STOP. The driver used the locks only in rz_ssi_stream_is_valid() and assigned the local substream pointer to NULL in rz_ssi_dai_trigger() callback but never locked it while making a local copy. This patch adds the rz_ssi_set_substream() helper function to set the substream pointer with locks acquired and replaces the instances of setting the local substream pointer with the rz_ssi_set_substream() function. Reported-by: Pavel Machek <pavel@denx.de> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20220125132457.14984-3-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Use a do-while loop in rz_ssi_pio_recv()Lad Prabhakar2022-01-251-8/+3
| | | | | | | | | | | | | Use a do-while loop while reading the samples from RX FIFO. The "done" flag was only changed as an outcome of the last if-statement (last step) in this entire procedure. This patch moves the condition from if statement to while and drops the "done" variable for readability. While at it, also drop the unneeded parentheses around runtime->dma_area. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20220125132457.14984-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Make return type of rz_ssi_stream_is_valid() to boolLad Prabhakar2022-01-241-4/+4
| | | | | | | | | | | | | rz_ssi_stream_is_valid() never returns an int, it returns the result of a condition which is either true or false. While at it, drop "!!" as the expression is boolean. Reported-by: Pavel Machek <pavel@denx.de> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20220110094711.8574-5-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Drop ssi parameter from rz_ssi_stream_init()Lad Prabhakar2022-01-241-8/+3
| | | | | | | | | | | | ssi parameter is unused in rz_ssi_stream_init() so just drop it. While at it, change the return type of rz_ssi_stream_init() to void instead of int. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20220110094711.8574-4-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Make the data structures available before registering the ↵Lad Prabhakar2022-01-241-2/+3
| | | | | | | | | | | | | handlers Initialize the spinlock and make the data structures available before registering the interrupt handlers. Reported-by: Pavel Machek <pavel@denx.de> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20220110094711.8574-3-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Drop calling rz_ssi_pio_recv() recursivelyLad Prabhakar2022-01-241-33/+35
| | | | | | | | | | | | | | | Instead of recursively calling rz_ssi_pio_recv() use a while loop to read the samples from RX fifo. This also fixes an issue where the return value of rz_ssi_pio_recv() was ignored when called recursively. Fixes: 03e786bd4341 ("ASoC: sh: Add RZ/G2L SSIF-2 driver") Reported-by: Pavel Machek <pavel@denx.de> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20220110094711.8574-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Check return value of pm_runtime_resume_and_get()Heiner Kallweit2021-12-171-1/+6
| | | | | | | | | | | | The return value of pm_runtime_resume_and_get() needs to be checked to avoid a usage count imbalance in the error case. This fix is basically the same as 92c959bae2e5 ("reset: renesas: Fix Runtime PM usage"), and the last step before pm_runtime_resume_and_get() can be annotated as __must_check. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/9fed506d-b780-55cd-45a4-9bd2407c910f@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: fixup DMAEngine APIKuninori Morimoto2021-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit d5bb69dc54ec1 ("ASoC: sh: rcar: dma: : use proper DMAENGINE API for termination") updated DMAEngine API _all() to _sync(), but it should be _async(). _all() and _async() are almost same, the difference is only return error code. _sync() will call dmaengine_synchronize() and will be kernel panic. This patch is needed for v5.15 or later. [ 27.293264] BUG: scheduling while atomic: irq/130-ec70000/131/0x00000003 [ 27.300084] 2 locks held by irq/130-ec70000/131: [ 27.304743] #0: ffff0004c274d908 (&group->lock){....}-{2:2}, at: _snd_pcm_stream_lock_irqsave+0x48/0x54 [ 27.314344] #1: ffff0004c1788c60 (&priv->lock#2){....}-{2:2}, at: rsnd_soc_dai_trigger+0x70/0x7bc [ 27.323409] irq event stamp: 206 [ 27.326664] hardirqs last enabled at (205): [<ffff80001082de50>] _raw_spin_unlock_irq+0x50/0xa0 [ 27.335529] hardirqs last disabled at (206): [<ffff80001082d9e4>] _raw_spin_lock_irqsave+0xc4/0xd0 [ 27.344564] softirqs last enabled at (0): [<ffff800010037324>] copy_process+0x644/0x1b10 [ 27.352819] softirqs last disabled at (0): [<0000000000000000>] 0x0 [ 27.359142] CPU: 0 PID: 131 Comm: irq/130-ec70000 Not tainted 5.14.0-rc1+ #918 [ 27.366429] Hardware name: Renesas H3ULCB Kingfisher board based on r8a77950 (DT) [ 27.373975] Call trace: [ 27.376442] dump_backtrace+0x0/0x1b4 [ 27.380141] show_stack+0x24/0x30 [ 27.383488] dump_stack_lvl+0x8c/0xb8 [ 27.387184] dump_stack+0x18/0x34 [ 27.390528] __schedule_bug+0x8c/0x9c [ 27.394224] __schedule+0x790/0x8dc [ 27.397746] schedule+0x7c/0x110 [ 27.401003] synchronize_irq+0x94/0xd0 [ 27.404786] rcar_dmac_device_synchronize+0x20/0x2c [ 27.409710] rsnd_dmaen_stop+0x50/0x64 [ 27.413495] rsnd_soc_dai_trigger+0x554/0x7bc [ 27.417890] snd_soc_pcm_dai_trigger+0xe8/0x264 Cc: <stable@kernel.org> Fixes: commit d5bb69dc54ec1 ("ASoC: sh: rcar: dma: : use proper DMAENGINE API for termination") Link: https://lore.kernel.org/r/TY2PR01MB3692889E1A7476C4322CC296D8AE9@TY2PR01MB3692.jpnprd01.prod.outlook.com Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87mtmfz36o.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: Fix an error handling path in 'rsnd_node_count()'Christophe JAILLET2021-10-291-0/+1
| | | | | | | | | | | | | If we return before the end of the 'for_each_child_of_node()' iterator, the reference taken on 'np' must be released. Add the missing 'of_node_put()' call. Fixes: c413983eb66a ("ASoC: rsnd: adjust disabled module") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/4c0e893cbfa21dc76c1ede0b6f4f8cff42209299.1634586167.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: adg: clearly handle clock error / NULL caseKuninori Morimoto2021-08-201-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver is assuming that all adg->clk[i] is not NULL. Because of this prerequisites, for_each_rsnd_clk() is possible to work for all clk without checking NULL. In other words, all adg->clk[i] should not NULL. Some SoC might doesn't have clk_a/b/c/i. devm_clk_get() returns error in such case. This driver calls rsnd_adg_null_clk_get() and use null_clk instead of NULL in such cases. But devm_clk_get() might returns NULL even though such clocks exist, but it doesn't mean error (user deliberately chose to disable the feature). NULL clk itself is not error from clk point of view, but is error from this driver point of view because it is not assuming such case. But current code is using IS_ERR() which doesn't care NULL. This driver uses IS_ERR_OR_NULL() instead of IS_ERR() for clk check. And it uses ERR_CAST() to clarify null_clk error. One concern here is that it unconditionally uses null_clk if clk_a/b/c/i was error. It is correct if it doesn't exist, but is not correct if it returns error even though it exist. It needs to check "clock-names" from DT before calling devm_clk_get() to handling such case. But let's assume it is overkill so far. Link: https://lore.kernel.org/r/YMCmhfQUimHCSH/n@mwanda Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87v940wyf9.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: core: make some arrays static const, makes object smallerKuninori Morimoto2021-08-201-3/+3
| | | | | | | | | | | | | | | | | | | Don't populate arrays on the stack but instead them static const. Makes the object code smaller by 48 bytes. Before: text data bss dec hex filename 20938 916 104 21958 55c6 ./sound/soc/sh/rcar/core.o After: text data bss dec hex filename 20890 916 104 21910 5596 ./sound/soc/sh/rcar/core.o gcc version 11.1.0) Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87tujkwydx.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Improve error handling in rz_ssi_dma_request functionBiju Das2021-08-191-2/+13
| | | | | | | | | | | | | | | dma_request_chan() returns error pointer in case of failures, but the rz_ssi_dma_request() checked for NULL pointer instead. This patch fixes the issue by checking for ERR_PTR() instead of NULL and sets the DMA pointers to NULL in error case so that ssi can fallback to PIO mode. Fixes: 26ac471c5354 ("ASoC: sh: rz-ssi: Add SSI DMAC support") Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20210818101450.15948-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Fix wrong operator used issueBiju Das2021-08-171-1/+1
| | | | | | | | | | Fix wrong operator used issue reported by Coverity by replacing | operator with & operator. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reported-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210816182336.29959-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Fix dereference of noderef expression warningBiju Das2021-08-161-1/+1
| | | | | | | | | | | Fix following sparse warning: sound/soc/sh/rz-ssi.c:156:15: sparse: warning: dereference of noderef expression Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/r/20210816132049.28128-1-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rz-ssi: Add SSI DMAC supportBiju Das2021-08-131-32/+224
| | | | | | | | | Add SSI DMAC support to RZ/G2L SoC. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20210813091156.10700-4-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: Add RZ/G2L SSIF-2 driverBiju Das2021-08-133-0/+881
| | | | | | | | | | | | Add serial sound interface(SSIF-2) driver support for RZ/G2L SoC. Based on the work done by Chris Brandt for RZ/A SSI driver. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20210813091156.10700-2-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: make some arrays static const, makes object smallerColin Ian King2021-08-021-3/+3
| | | | | | | | | | | | | | | | | | | Don't populate arrays on the stack but instead them static const. Makes the object code smaller by 242 bytes. Before: text data bss dec hex filename 23827 8764 0 32591 7f4f ./sound/soc/sh/rcar/ssi.o After: text data bss dec hex filename 23361 8988 0 32349 7e5d ./sound/soc/sh/rcar/ssi.o gcc version 10.2.0) Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210801063237.137998-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: sh: rcar: dma: : use proper DMAENGINE API for terminationWolfram Sang2021-07-111-1/+1
| | | | | | | | | | | dmaengine_terminate_all() is deprecated in favor of explicitly saying if it should be sync or async. Here, we want dmaengine_terminate_sync() because there is no other synchronization code in the driver to handle an async case. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20210623100545.3926-1-wsa+renesas@sang-engineering.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: fsi: fix spelling mistakeFlavio Suligoi2021-06-181-1/+1
| | | | | | | | Fix "thse" --> "these" in struct fsi_stream declaration. Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> Link: https://lore.kernel.org/r/20210618085324.1038524-1-f.suligoi@asem.it Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: fsi: add .auto_selectable_formats supportKuninori Morimoto2021-06-071-0/+15
| | | | | | | | | | | By this patch, DAI format might be automatically selected (Depends on paired DAI). Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87bl8wnc5x.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: add .auto_selectable_formats supportKuninori Morimoto2021-06-071-2/+29
| | | | | | | | | | | By this patch, DAI format might be automatically selected (Depends on paired DAI). Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87cztcnc6k.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge series "ASoC: rsnd: tidyup adg and header" from Kuninori Morimoto ↵Mark Brown2021-06-032-63/+97
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <kuninori.morimoto.gx@renesas.com>: Hi Mark I noticed that adg can be more clean code. And rsnd.h header comment was not so good because patch has been randomly added. This patch tidyup these. Kuninori Morimoto (5): ASoC: rsnd: adg: supply __printf(x, y) formatting for dbg_msg() ASoC: rsnd: adg: tidyup rsnd_adg_get_clkin/out() parameter ASoC: rsnd: adg: use more simple method for null_clk ASoC: rsnd: adg: check return value for rsnd_adg_get_clkin/out() ASoC: rsnd: tidyup __rsnd_mod_xxx macro comments sound/soc/sh/rcar/adg.c | 139 +++++++++++++++++++++++++-------------- sound/soc/sh/rcar/rsnd.h | 21 ++---- 2 files changed, 97 insertions(+), 63 deletions(-) -- 2.25.1
| * ASoC: rsnd: tidyup __rsnd_mod_xxx macro commentsKuninori Morimoto2021-06-031-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | status and __rsnd_mod_xxx were updated, but some related comments were not. And it has verbose comments. This patch cleanup/tidyup these. 1) adds missing "D" to status sample 2) remove verbose list for "H" 3) add "needs protect" to __rsnd_mod_call_xxx Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87o8cpi1zs.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: adg: check return value for rsnd_adg_get_clkin/out()Kuninori Morimoto2021-06-031-23/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current rsnd_adg_get_clkin/out() are void function, thus adg->clk/clkout[i] might be NULL. But, for_each_rsnd_clk/clkout() macros are assuming all clks are non NULL. Because of this mismatch, code can be complex and/or buggy. These functions return error by this patch, and make sure all clks are non NULL. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87pmx5i20m.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: adg: use more simple method for null_clkKuninori Morimoto2021-06-032-26/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 965386c97616c ("ASoC: rsnd: call unregister for null_hw when removed") tried unregister null_clk, but it has some issues. 1st issue is kernel will indicate below message when unregistering, because of its timing. unregistering should be happen after clk_disable(). clk_unregister: unregistering prepared clock: rsnd_adg_null 2nd issue is, it is using priv->null_clk, but it should be adg->null_clk. 3rd issue is it is using very complex clk registering method. more simple clk_register/unregister_fixed_rate() should be OK. This patch fixes these. Fixes: 965386c97616c ("ASoC: rsnd: call unregister for null_hw when removed") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87r1hli215.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: adg: tidyup rsnd_adg_get_clkin/out() parameterKuninori Morimoto2021-06-031-7/+7
| | | | | | | | | | | | | | | | | | | | set priv->adg before rsnd_adg_get_clkin/out() to be more simple code. Nothing is changed, but is preparation for next "ASoC: rsnd: adg: use more simple method for null_clk" patch Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sg21i21j.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: adg: supply __printf(x, y) formatting for dbg_msg()Kuninori Morimoto2021-06-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the following W=1 kernel build warning(s): sound/soc/sh/rcar/adg.c: In function 'dbg_msg': sound/soc/sh/rcar/adg.c:594:2: warning: function 'dbg_msg' might \ be a candidate for 'gnu_printf' format attribute\ [-Wsuggest-attribute=format] Fixes: 1f9c82b5ab83 ("ASoC: rsnd: add debugfs support") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87tumhi21r.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rsnd: check for zero node countColin Ian King2021-06-031-0/+3
|/ | | | | | | | | | | | | | Most callers of_get_child_count() check that "nr" is non-zero so it causes a static checker warning when we don't do that here. This does not cause a problem or a crash, but having zero SSUIes does not make sense either so let's add a check. Addresses-Coverity: ("Unchecked return value") Fixes: c413983eb66a ("ASoC: rsnd: adjust disabled module") Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210603110315.81146-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: adjust disabled moduleKuninori Morimoto2021-06-016-3/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In general Renesas SoC's SSI/SRC are all enabled, but some SoC is not. H2 E2 SRC0 <= SRC1 SRC1 SRC2 SRC2 ... ... Renesas Sound driver is assuming that *all* modules are enabled, and thus it is using *data array* to access each modules. Because of it, we have been using "status = disabled" at DT, and using *full size* array but avoiding disabled module. ex) rcar_sound,src { src-0 { => status = "disabled"; }; src1: src-1 { ... }; ... But R-Car D3 have many disabled modules (It has SSI3/SSI4, SRC5/SRC6), and Renesas SoC maintainer don't want above style on DT. ex) rcar_sound,src { => src0: src-0 { status = "disabled"; }; => src1: src-1 { status = "disabled"; }; => src2: src-2 { status = "disabled"; }; => src3: src-3 { status = "disabled"; }; => src4: src-4 { status = "disabled"; }; src5: src-5 { ... }; src6: src-6 { ... }; }; rcar_sound,ssi { => ssi0: ssi-0 { status = "disabled"; }; => ssi1: ssi-1 { status = "disabled"; }; => ssi2: ssi-2 { status = "disabled"; }; ssi3: ssi-3 { ... }; ssi4: ssi-4 { ... }; }; To adjust it, it needs to care about related for_each_child_of_node() loop on rsnd driver, and it is used from... > grep -l for_each_child_of_node sound/soc/sh/rcar/* sound/soc/sh/rcar/core.c sound/soc/sh/rcar/ctu.c sound/soc/sh/rcar/dma.c sound/soc/sh/rcar/dvc.c sound/soc/sh/rcar/mix.c sound/soc/sh/rcar/src.c sound/soc/sh/rcar/ssi.c sound/soc/sh/rcar/ssiu.c This patch adjust to this situation. By this patch, we can avoid disabled modules on DT rcar_sound,src { src5: src-5 { ... }; src6: src-6 { ... }; }; rcar_sound,ssi { ssi3: ssi-3 { ... }; ssi4: ssi-4 { ... }; }; Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/875yyzk017.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: tidyup rsnd_parse_connect_xxx()Kuninori Morimoto2021-06-013-3/+9
| | | | | | | | | | This patch tidyup rsnd_parse_connect_xxx() style. Nothing is changed, but is preparation for next "ASoC: rsnd: adjust disabled module" patch Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/877djfk01l.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: tidyup rsnd_dma_request_channel()Kuninori Morimoto2021-06-016-9/+9
| | | | | | | | | | This patch adds "char *name" to rsnd_dma_request_channel(). It is not yet used so far, but is preparation for next "ASoC: rsnd: adjust disabled module" patch Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/878s3vk01q.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: tidyup rsnd_parse_connect_common()Kuninori Morimoto2021-06-012-6/+6
| | | | | | | | | | This patch adds "char *name" to rsnd_parse_connect_common(). It is not yet used so far, but is preparation for next "ASoC: rsnd: adjust disabled module" patch Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87a6obk01v.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: tidyup rsnd_ssiu_busif_err_irq_ctrl()Kuninori Morimoto2021-05-271-21/+17
| | | | | | | | | rsnd_ssiu_busif_err_irq_ctrl() has very similar duplicated code. This patch merge and tidyup the code. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <87sg28lwxw.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: tidyup rsnd_ssiu_busif_err_status_clear()Kuninori Morimoto2021-05-271-24/+21
| | | | | | | | | rsnd_ssiu_busif_err_status_clear() has very similar duplicated code. This patch merge and tidyup the code. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <87tumolwy3.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: implement BUSIF related code in ssiu.cKuninori Morimoto2021-05-273-112/+108
| | | | | | | | | | BUSIF is SSIU feature, but its related code is implemented at ssi.c today. This patch moves it to ssiu.c Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <87v974lwy9.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: protect mod->statusKuninori Morimoto2021-05-272-26/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renesas Sound uses many modules (SSI/SSIU/SRC/CTU/MIX/DVC/DMA), and supports complex connections/path. Thus each modules needs to save its status to correctly control it. This status is updated when by .trigger, and .hw_params/.hw_free. Renesas Sound is protecting modules by using lock when .trigger, but it was not enough to protecting each modules "status" if it was used from many paths. 1) .hw_params/.hw_free update status 2) another doesn't update status, but overwrites by same value This patch do 1) protects .hw_params/.hw_free by lock 2) do nothing if no status update Without this patch, protected mod->status (= .trigger) might be overwrote by non protected mod->status (= .hw_params / .hw_free), and in such case, CTU/MIX/DVC/SSIU/SSI which are used from many paths might get damage. If above issue happens, Renesas Sound will be hung (= silence) and never be recoverd. I could reproduce this issue by continue playing very short sound with loop very long term (3-4 hours) through 2 inputs (= MIXer). For updating rsnd_status_update(), this patch removes rsnd_dai_call() debug message. Because we already have debugfs support, and is not good match to new code. Reported-by: Linh Phung T. Y <linh.phung.jy@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <87wnrklwyh.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: add debugfs supportKuninori Morimoto2021-05-2714-15/+298
| | | | | | | | | | Current rsnd supports #define DEBUG, but it is not helpful if issue happen after 4-5 hours. This patch adds debugfs support for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <87y2c0lwyn.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: incidate irq error messageKuninori Morimoto2021-05-273-12/+13
| | | | | | | | | | Current rsnd is using dev_dbg() if irq error happen, but it makes debug very difficult if some strange things happen. This patch uses dev_info() for it, and rename the macro name. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <87zgwglwyv.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: indicate unknown error at rsnd_dai_call()Kuninori Morimoto2021-05-271-5/+6
| | | | | | | | | | | Current rsnd_dai_call() doesn't indicate error message, thus it is very difficult to know the issue when strange things happen. This patch indicates error for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <871r9snbji.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: check BUIF error everytimeKuninori Morimoto2021-05-271-14/+3
| | | | | | | | | | Current ssi.c checks BUSIF when TDM mode, but it should be checked everytime. This patch do it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <8735u8nbjr.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: attach SSIU when SSI was DMA modeKuninori Morimoto2021-05-273-4/+7
| | | | | | | | | SSIU is not needed if SSI was PIO mode. This patch ignores such case. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-Id: <874keonbkg.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>