summaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/rcar/ssi.c
Commit message (Collapse)AuthorAgeFilesLines
* treewide: devm_kzalloc() -> devm_kcalloc()Kees Cook2018-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc(). This patch replaces cases of: devm_kzalloc(handle, a * b, gfp) with: devm_kcalloc(handle, a * b, gfp) as well as handling cases of: devm_kzalloc(handle, a * b * c, gfp) with: devm_kzalloc(handle, array3_size(a, b, c), gfp) as it's slightly less ugly than: devm_kcalloc(handle, array_size(a, b), c, gfp) This does, however, attempt to ignore constant size factors like: devm_kzalloc(handle, 4 * 1024, gfp) though any constants defined via macros get caught up in the conversion. Any factors with a sizeof() of "unsigned char", "char", and "u8" were dropped, since they're redundant. Some manual whitespace fixes were needed in this patch, as Coccinelle really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...". The Coccinelle script used for this was: // Fix redundant parens around sizeof(). @@ expression HANDLE; type TYPE; expression THING, E; @@ ( devm_kzalloc(HANDLE, - (sizeof(TYPE)) * E + sizeof(TYPE) * E , ...) | devm_kzalloc(HANDLE, - (sizeof(THING)) * E + sizeof(THING) * E , ...) ) // Drop single-byte sizes and redundant parens. @@ expression HANDLE; expression COUNT; typedef u8; typedef __u8; @@ ( devm_kzalloc(HANDLE, - sizeof(u8) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(__u8) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(char) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(unsigned char) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(u8) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(__u8) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(char) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(unsigned char) * COUNT + COUNT , ...) ) // 2-factor product with sizeof(type/expression) and identifier or constant. @@ expression HANDLE; type TYPE; expression THING; identifier COUNT_ID; constant COUNT_CONST; @@ ( - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (COUNT_ID) + COUNT_ID, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * COUNT_ID + COUNT_ID, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (COUNT_CONST) + COUNT_CONST, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * COUNT_CONST + COUNT_CONST, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (COUNT_ID) + COUNT_ID, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * COUNT_ID + COUNT_ID, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (COUNT_CONST) + COUNT_CONST, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * COUNT_CONST + COUNT_CONST, sizeof(THING) , ...) ) // 2-factor product, only identifiers. @@ expression HANDLE; identifier SIZE, COUNT; @@ - devm_kzalloc + devm_kcalloc (HANDLE, - SIZE * COUNT + COUNT, SIZE , ...) // 3-factor product with 1 sizeof(type) or sizeof(expression), with // redundant parens removed. @@ expression HANDLE; expression THING; identifier STRIDE, COUNT; type TYPE; @@ ( devm_kzalloc(HANDLE, - sizeof(TYPE) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) ) // 3-factor product with 2 sizeof(variable), with redundant parens removed. @@ expression HANDLE; expression THING1, THING2; identifier COUNT; type TYPE1, TYPE2; @@ ( devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(TYPE2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) ) // 3-factor product, only identifiers, with redundant parens removed. @@ expression HANDLE; identifier STRIDE, SIZE, COUNT; @@ ( devm_kzalloc(HANDLE, - (COUNT) * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) ) // Any remaining multi-factor products, first at least 3-factor products, // when they're not all constants... @@ expression HANDLE; expression E1, E2, E3; constant C1, C2, C3; @@ ( devm_kzalloc(HANDLE, C1 * C2 * C3, ...) | devm_kzalloc(HANDLE, - (E1) * E2 * E3 + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - (E1) * (E2) * E3 + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - (E1) * (E2) * (E3) + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - E1 * E2 * E3 + array3_size(E1, E2, E3) , ...) ) // And then all remaining 2 factors products when they're not all constants, // keeping sizeof() as the second factor argument. @@ expression HANDLE; expression THING, E1, E2; type TYPE; constant C1, C2, C3; @@ ( devm_kzalloc(HANDLE, sizeof(THING) * C2, ...) | devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...) | devm_kzalloc(HANDLE, C1 * C2 * C3, ...) | devm_kzalloc(HANDLE, C1 * C2, ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (E2) + E2, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * E2 + E2, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (E2) + E2, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * E2 + E2, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - (E1) * E2 + E1, E2 , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - (E1) * (E2) + E1, E2 , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - E1 * E2 + E1, E2 , ...) ) Signed-off-by: Kees Cook <keescook@chromium.org>
* ASoC: rsnd: ssi: wait maximum 5ms for status checkKuninori Morimoto2018-04-161-1/+1
| | | | | | | | | | | | | | | It is waiting udelay(50) x 1024 (= 50ms) for status check in worst case, but it is overkill. And we shouldn't use udelay() for 50us (linux/Documentation/timers/timers-howto.txt) Waiting maximum udelay(5) x 1024 (= 5ms) is very enough for status check. This patch fixes these issue. Reported-by: Hiromitsu Yamasaki <hiromitsu.yamasaki.ym@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: don't assume node full path name for HDMI probingKuninori Morimoto2018-04-161-2/+9
| | | | | | | | | | | | | | | | | | | | | | | Current ssi.c is assuming below 2 things to probing HDMI node. 1) remote node is including "hdmi0" or "hdmi1" in node name 2) remote_ep->full_name is including full path name But, these assumptions are broken by below 1) Node names should not use numerical suffixes commit 6b5ac2f1cb11 ("arm64: dts: renesas: r8a7795: Drop bogus HDMI node names suffixes") 2) node full_name no longer include full path name commit a7e4cfb0a7ca ("of/fdt: only store the device node basename in full_name") Because of these reasons, ssi.c can't probe HDMI on current kernel. This patch probes HDMI0/1 by using its address. Note is that we need to keep updating for this address for future generation chip. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Nguyen Viet Dung <dung.nguyen.aj@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: indicate IRQ error status for debugKuninori Morimoto2018-02-131-1/+15
| | | | | | | | | | | | | | | SSI/SRC have under/over flow error handling, and its status is useful for debuging. But sometimes it might be too much message, and it might blocks necessity other information. To avoid such situation, basically this patch indicates interrupt status debug message if DEBUG was defined, but it will be suppressed if RSND_DEBUG_NO_IRQ_STATUS was defined. Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: PIO related function cleanupKuninori Morimoto2017-12-111-81/+72
| | | | | | | | | | | | SSI had shared counting pointer position method between PIO/DMA mode before. But now DMA mode is using DMAEngine feature to get it. Thus, this counting pointer position method is needed for only PIO mode. We don't need to share code anymore. This patch names PIO related functions as rsnd_ssi_pio_xxx(), and merged/cleanuped each feature. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: don't use runtime->sample_bitsKuninori Morimoto2017-12-111-6/+3
| | | | | | | | | | | Current rsnd driver is judging 16bit/24bit data by using runtime->sample_bits, but it is indicating physical size, not format size. This is confusable code. This patch uses snd_pcm_format_width() to be more correct code. Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: ssi: remove unnesessary period_posJiada Wang2017-12-081-6/+3
| | | | | | | | | | | | | period_pos can always be calculated by byte_pos and byte_per_period, there is no reason to maintain this variable in rsnd_dai_stream. This patch removes period_pos from rsnd_ssi and calculates next_period_byte with consideration of actual byte_pos value. Signed-off-by: Jiada Wang <jiada_wang@mentor.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: ssi: fix race condition in rsnd_ssi_pointer_updateJiada Wang2017-12-081-6/+10
| | | | | | | | | | | | | | 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 <jiada_wang@mentor.com> Reviewed-by: Takashi Sakamoto <takashi.sakamoto@miraclelinux.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge remote-tracking branch 'asoc/topic/rcar' into asoc-nextMark Brown2017-11-101-24/+29
|\
| * ASoC: rsnd: rsnd_ssi_run_mods() needs to care ssi_parent_modKuninori Morimoto2017-11-011-3/+8
| | | | | | | | | | | | | | | | | | SSI parent mod might be NULL. ssi_parent_mod() needs to care about it. Otherwise, it uses negative shift. This patch fixes it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: Don't check SSISR::DIRQ when CaptureKuninori Morimoto2017-10-311-6/+9
| | | | | | | | | | | | | | | | | | | | When stop case, it was Playback, it need to check all data were completely sent. But in Capture case, it might not receive data anymore. SSISR::DIRQ check is not need for Capture case. Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: add generic rsnd_flags_xxx() macroKuninori Morimoto2017-10-041-15/+12
| | | | | | | | | | | | | | | | | | | | SSI is using rsnd_ssi_flags_xxx() macro to control flags. But it is useful macro not only for SSI. This patch replace it to more generic rsnd_flags_xxx(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rcar: skip disabled-SSI nodesKuninori Morimoto2017-10-031-1/+4
|/ | | | | | | | | | | | The current device tree representation of the R-Car SSI assumes that they are numbered consecutively, starting from 0. Alas, this is not the case with the R8A77995 (D3) SoC which SSI1/SSI2 aren't present. In order to keep the existing device trees working, I'm suggesting to use a disabled node for SSI0/SSI1. Teach the SSI probe to just skip disabled nodes. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: remove unused rsnd_xxx_to_dma()Kuninori Morimoto2017-08-221-1/+0
| | | | | Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: call request_irq/free_irq once in MIX caseKuninori Morimoto2017-08-101-5/+22
| | | | | | | | | | | | | | | | | | 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 = <&src0 &ctu02 &mix0 &dvc0 &ssi0>; playback = <&src2 &ctu03 &mix0 &dvc0 &ssi0>; 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 <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: add rsnd_ssi_flags_has/add() macroKuninori Morimoto2017-08-101-9/+10
| | | | | | | | 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 <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: call free_irq() both DMA/PIO modeKuninori Morimoto2017-08-101-18/+19
| | | | | | | | | | | | | | 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 <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge branch 'fix/rcar' of ↵Mark Brown2017-08-101-12/+34
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-rcar
| * ASoC: rsnd: avoid duplicate free_irq()Kuninori Morimoto2017-08-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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 <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: control SSICR::EN correctlyKuninori Morimoto2017-08-081-9/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rsnd: rsnd_ssi_can_output_clk() macroKuninori Morimoto2017-08-081-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rsnd: move rsnd_ssi_config_init() execute condition into it.Kuninori Morimoto2017-08-081-2/+4
| | | | | | | | | | | | | | Make it the same style as other functions Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rsnd: add missing of_node_putJulia Lawall2017-07-171-1/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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): // <smpl> @@ 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 // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: fixup unsigned expression compared with zero: main_rateKuninori Morimoto2017-06-211-4/+4
| | | | | | | | | | This patch fixes this WARNING sound/soc/sh/rcar/ssi.c:285:5-14: WARNING: Unsigned expression\ compared with zero: main_rate < 0 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: add rsnd_ssi_clk_query()Kuninori Morimoto2017-06-151-39/+56
| | | | | | | | | | | | | | | | | Current Renesas sound driver is assuming that all Sampling rate and channles are possible to use, but these are depends on inputed clock and SSI connection situation. For example, if it is using 1 SSI, enabled TDM mode and has 12288000 input clock, 2ch output can support until 192000Hz, but 6ch output can support until 64000Hz, 8ch can support 48000Hz. To control these situation correctly, it needs to support hw_constraints / refine feature. To support such feature, this patch adds new rsnd_ssi_clk_query(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: rename "slots" related variableKuninori Morimoto2017-06-151-1/+2
| | | | | | | | | | | | | | | Current Renesas sound driver has slots and slots_num in struct rsnd_dai, but these are very un-understandable naming (It had named from TDM slots). In this driver, the "slots" means total usable channels, and "stot_num" means SSI lane number if Multi SSI was used. To more understandable code, this patch renames "slots" to "max_channels", and "slots_num" to "ssi_lane", and replaces related functions name. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: cleanup pointer related codeKuninori Morimoto2017-06-071-3/+64
| | | | | | | | | Current rsnd driver is sharing pointer related code between PIO / DMA. But, it is used only PIO mode now, no longer needed. This patch cleanup these. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge branch 'fix/rcar' of ↵Mark Brown2017-06-071-3/+15
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-rcar
| * ASoC: rsnd: SSI PIO adjust to 24bit modeKuninori Morimoto2017-05-241-2/+9
| | | | | | | | | | | | | | | | | | commit 90431eb49bff ("ASoC: rsnd: don't use PDTA bit for 24bit on SSI") fixups 24bit mode data alignment, but PIO was not cared. This patch fixes PIO mode 24bit data alignment Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: don't call free_irq() on Parent SSIKuninori Morimoto2017-05-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | If SSI uses shared pin, some SSI will be used as parent SSI. Then, normal SSI's remove and Parent SSI's remove (these are same SSI) will be called when unbind or remove timing. In this case, free_irq() will be called twice. This patch solve this issue. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * ASoC: rsnd: don't use PDTA bit for 24bit on SSIKuninori Morimoto2017-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Current SSI uses PDTA bit which indicates data that Input/Output data are Right-Aligned. But, 24bit sound should be Left-Aligned in this HW. Because Linux is using Right-Aligned data, and HW uses Left-Aligned data, current 24bit data is missing lower 8bit. To fix this issue, this patch removes PDTA bit, and shift 8bit in necessary module Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rsnd: update pointer more accurateKuninori Morimoto2017-06-071-0/+12
| | | | | | | | | | | | | | | | | | | | | | Current rsnd driver updates pointer when DMA transfer was finished in DMA transfer mode. But PulseAudio requests more accurate pointer update when timer mode. This patch consider about DMA transfer residue and update more accurate pointer. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rsnd: remove unused rsnd_ssi_non_opsKuninori Morimoto2017-06-061-8/+0
| | | | | | | | | | | | | | rsnd_ssi_non_ops is never used. Let's remove it Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: rsnd: add HDMI output supportKuninori Morimoto2017-05-191-0/+58
|/ | | | | | | | | | | | | Renesas R-Car Gen3 can output HDMI sound if SSIU/SSI are connected to R-Car built-in HDMI device (R-Car Gen3 built-in HDMI device will be controlled by DRM/KMS driver). If SSIx was connected to HDMI0/1 on DT, SSI driver will detect it automatically by this patch. Note is that now Renesas R-Car sound driver is assuming that it is using OF-graph base simple card for HDMI sound. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rcar: ssi: don't set SSICR.CKDV = 000 with SSIWSR.CONTKuninori Morimoto2017-03-241-0/+9
| | | | | | | | | | | | R-Car Datasheet is indicating "SSICR.CKDV = 000 is invalid when SSIWSR.WS_MODE = 1 or SSIWSR.CONT = 1". Current driver will set CONT, thus, we shouldn't use CKDV = 000. This patch fixup it. Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: tidyup ssi->usrcnt counter check in hw_paramsKuninori Morimoto2016-12-071-3/+6
| | | | | | | | | | | | ssi->usrcnt will be updated on snd_soc_dai_ops::trigger, but snd_pcm_ops::hw_params will be called *before* it. Thus, ssi->usrcnt is still 0 when 1st call. rsnd_ssi_hw_params() needs to check its called count, this means trigger should be if (ssi->usrcnt) instead of if (ssi->usrcnt > 1). Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: remove rsnd_dma_detach()Kuninori Morimoto2016-10-251-2/+0
| | | | | | | | | DMA mod is now connected to stream via rsnd_dai_connect(). This means DMA mod can use .remove for its clearance. rsnd_dma_detach() is no longer needed. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: don't use devm_request_irq() for SSIKuninori Morimoto2016-10-251-8/+9
| | | | | | | | | | SSI will use DMA mode, and migh be fallback to PIO mode. Using devm_request_irq() makes its operation more complex when it fallbacks to PIO mode. Let's use manual request_irq()/free_irq() Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: remove non DT support for DMAKuninori Morimoto2016-10-251-2/+1
| | | | | | | | | Current Renesas Sound driver is based on DeviceTree, and no one is using this driver from non DT. Non-DT support is no longer needed. Let's remove it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: amend .probe/.remove call for DPCMKuninori Morimoto2016-10-241-1/+4
| | | | | | | | | | | | | commit 1a5658c2131 ("ASoC: rsnd: count .probe/.remove for rsnd_mod_call()") solved multi-resource-free issue, by putting .probe/.remove under count control. But,it breaks sound mixing case (if it was used under DPCM). In such case, it uses MIXn/DVCn/SSIn, and these should be always probed. This patch reverted above patch, and solved the same issue by modifing _rsnd_kctrl_remove() function. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: use of_property_read_boolJulia Lawall2016-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | Use of_property_read_bool to check for the existence of a property. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression e1,e2; statement S2,S1; @@ - if (of_get_property(e1,e2,NULL)) + if (of_property_read_bool(e1,e2)) S1 else S2 // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: add rsnd_src_get_in/out_rate()Kuninori Morimoto2016-03-071-2/+3
| | | | | | | | | | | SRC will convert rate, and then, CMD and SSI want to know its rate (= SRC.in / SRC.out) for each purpose. Current driver is supporting only Playback, but SRC+Capture support needs more flexibility. This patch adds rsnd_src_get_in/out_rate() for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: add rsnd_runtime_channel_xxx()Kuninori Morimoto2016-03-051-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Current SSI is supporting Normal SSI/Multi mode SSI/TDM mode SSI and its behavior is based on input channels. This input channel might be converted by CTU, and SSI needs to be Multi SSI mode / TDM SSI mode if 6ch input EX) 6ch input, CTU for 2ch, playback 6ch 6ch 2ch 2ch 2ch 2ch -> SRC -> CTU -> MIX -> DVC -> SSIU -> SSI EX) 6ch input, no CTU, Multi SSI, playback 6ch 6ch 6ch 6ch 6ch 2ch -> SRC -> CTU -> MIX -> DVC -> SSIU -> SSI0/SSI1/SSI2 Current driver is using rsnd_get_adinr_chan() / rsnd_get_slot_width() for this purpose, but it is complicated enough without meaning. This patch adds new rsnd_runtime_channel_xxx() which is caring CTU/Multi SSI. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: judge work SSI in runtimeKuninori Morimoto2016-02-201-0/+27
| | | | | | | | | | | | Current rsnd supports multi SSI (maximum 4 SSI for 8ch), and, it should determine whether using each SSI or not in runtime. All SSIs are not used even if there are 4 SSI in case of stereo. Current driver setups un-used SSI in such case. It is no problem, but not needed. This patch judges it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: judge multi SSI in runtimeKuninori Morimoto2016-02-201-2/+13
| | | | | | | | | | | | Current rsnd supports multi SSI (maximum 4 SSI for 8ch), and, it should determine whether using each SSI or not in runtime. Current judgement is vague, and had broken by c308abe45e2("ASoC: rsnd: rsnd_ssi_is_multi_slave() macro uses rsnd_ssi_multi_slaves()") This patch makes clean it, and solve this issue. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: move rsnd_ssi_irq() positionKuninori Morimoto2016-02-201-21/+21
| | | | | | | prepare for runtime judging for SSI work Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: Parent SSI attach is not needed if not clock masterKuninori Morimoto2016-02-201-3/+27
| | | | | | | | | | | | Parent SSI is needed if it is PIN sharing and clock master, otherwise, not needed. But, whether clockk master is judged on .set_fmt, thus, it can't call rsnd_ssi_parent_attach() on .probe. Now, .pcm_new will be called after .set_fmt, so this patch reuses it at this point. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: tidyup SSI init/start sequenceKuninori Morimoto2016-02-201-20/+16
| | | | | | | | | SSI want to have SSIWSR settings and SSICR settings without EN bit when init, and SSICR EN bit only when start timing. Otherwise, SSI output signal might be unstable. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: add missing .irq callback for DMAKuninori Morimoto2016-02-201-0/+1
| | | | | | | | commit b5b442abd9d5 ("ASoC: rsnd: add .irq callback") added .irq callback but SSI DMA is missing it. This patch adds it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: rsnd: fixup forever loop bug on SSIKuninori Morimoto2016-02-201-2/+1
| | | | | | | | | | | | commit b5b442abd9 ("ASoC: rsnd: add .irq callback") added .irq support, and it cares both parent SSI and normal SSI. But it should care only normal SSI. Otherwise SSI might be forever loop if SSI is used as both parent SSI and normal SSI (= 2 users), and if under/over run error happen. Because irq disable do nothing in such case. This patch solve this issue. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
OpenPOWER on IntegriCloud