Add sound support to iwg22d
Subsystems (5)
cover Add sound support to iwg22d
Hello Ben,
this series adds sound support to the iwg22d board by backporting all the necessary patches, including some fixes.
There is a dependency with series:
https://lists.cip-project.org/pipermail/cip-dev/2018-July/001462.html
This work is based on top of linux-4.4.y-cip, commit 4d769b2b8749e89dfc7ea179a44f652dcfbedb37 ("PM / OPP: Move error message to debug level").
Thanks,
Fab
Biju Das (9):
ARM: dts: r8a7745: Add audio clocks
ARM: dts: r8a7745: Add audio DMAC support
ARM: dts: r8a7745: Add sound support
ARM: dts: iwg22d-sodimm: Enable SGTL5000 audio codec
ARM: dts: iwg22d-sodimm: Sound PIO support
ARM: dts: iwg22d-sodimm: Sound DMA support on DTS
ARM: dts: iwg22d-sodimm: Sound DMA support via BUSIF on DTS
ARM: dts: iwg22d-sodimm: Sound DMA support via SRC on DTS
ARM: dts: iwg22d-sodimm: Sound DMA support via DVC on DTS
Kuninori Morimoto (5):
ASoC: rsnd: remove platform boot support from src.c
dmaengine: rcar-dmac: clear pertinence number of channels
dmaengine: rcar-dmac: use list_add() on rcar_dmac_desc_put()
dmaengine: rcar-dmac: ensure CHCR DE bit is actually 0 after clearing
dmaengine: rcar-dmac: use TCRB instead of TCR for residue
Laurent Pinchart (1):
dmaengine: rcar-dmac: Fix residue reporting for pending descriptors
Muhammad Hamza Farooq (2):
dmaengine: rcar-dmac: use result of updated get_residue in tx_status
dmaengine: rcar-dmac: Fixed active descriptor initializing
Niklas S?derlund (1):
dmaengine: rcar-dmac: warn if transfer cannot start as TE = 1
Sergei Shtylyov (1):
rcar: src: skip disabled-SRC nodes
arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts | 92 ++++++++++++ arch/arm/boot/dts/r8a7745.dtsi | 222 ++++++++++++++++++++++++++++ drivers/dma/sh/rcar-dmac.c | 87 ++++++++++- sound/soc/sh/rcar/src.c | 165 +++++++-------------- 4 files changed, 451 insertions(+), 115 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/19 ASoC: rsnd: remove platform boot support from src.c
From: Kuninori Morimoto <[email protected]>
No board is using Renesas sound driver via platform boot now. This means all user is using DT boot. Platform boot support is no longer needed. But, it strongly depends on platform boot style. This patch removes platform boot support from src.c
(reworked to fit the context)
--- sound/soc/sh/rcar/src.c | 161 ++++++++++++++++-------------------------------- 1 file changed, 52 insertions(+), 109 deletions(-)
sound/soc/sh/rcar/src.c +52 -109
@@ -30,6 +30,7 @@ struct rsnd_src {#define RSND_SRC_NAME_SIZE 16 +#define rsnd_src_get (priv, id) ((struct rsnd_src *)(priv->src) + id)#define rsnd_src_nr (priv) ((priv)->src_nr)#define rsnd_enable_sync_convert (src) ((src)->sen.val)#define rsnd_src_of_node (priv) \
@@ -69,55 +70,6 @@ struct rsnd_src {* |-----------------| */ -/* -* How to use SRC bypass mode for debugging -* -* SRC has bypass mode, and it is useful for debugging. -* In Gen2 case, -* SRCm_MODE controls whether SRC is used or not -* SSI_MODE0 controls whether SSIU which receives SRC data -* is used or not. -* Both SRCm_MODE/SSI_MODE0 settings are needed if you use SRC, -* but SRC bypass mode needs SSI_MODE0 only. -* -* This driver request -* struct rsnd_src_platform_info { -* u32 convert_rate; -* int dma_id; -* } -* -* rsnd_src_convert_rate() indicates -* above convert_rate, and it controls -* whether SRC is used or not. -* -* ex) doesn't use SRC -* static struct rsnd_dai_platform_info rsnd_dai = { -* .playback = { .ssi = &rsnd_ssi[0], }, -* }; -* -* ex) uses SRC -* static struct rsnd_src_platform_info rsnd_src[] = { -* RSND_SCU(48000, 0), -* ... -* }; -* static struct rsnd_dai_platform_info rsnd_dai = { -* .playback = { .ssi = &rsnd_ssi[0], .src = &rsnd_src[0] }, -* }; -* -* ex) uses SRC bypass mode -* static struct rsnd_src_platform_info rsnd_src[] = { -* RSND_SCU(0, 0), -* ... -* }; -* static struct rsnd_dai_platform_info rsnd_dai = { -* .playback = { .ssi = &rsnd_ssi[0], .src = &rsnd_src[0] }, -* }; -* -*/ - -/* -* Gen1/Gen2 common functions -*/ static void rsnd_src_soft_reset (struct rsnd_mod *mod) {rsnd_mod_write (mod,SRC_SWRSR ,0 );
@@ -997,51 +949,7 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id)if (WARN_ON (id <0 || id >=rsnd_src_nr (priv))) id =0 ; -return rsnd_mod_get ((struct rsnd_src *)(priv->src) + id); -} - -static void rsnd_of_parse_src (struct platform_device *pdev, -const struct rsnd_of_data *of_data, -struct rsnd_priv *priv) -{ -struct device_node *src_node; -struct device_node *np; -struct rcar_snd_info *info =rsnd_priv_to_info (priv); -struct rsnd_src_platform_info *src_info; -struct device *dev = &pdev->dev; -int nr, i; - -if (!of_data) -return ; - - src_node =rsnd_src_of_node (priv); -if (!src_node) -return ; - - nr =of_get_child_count (src_node); -if (!nr) - goto rsnd_of_parse_src_end; - - src_info =devm_kzalloc (dev, -sizeof (struct rsnd_src_platform_info ) * nr, -GFP_KERNEL ); -if (!src_info) { -dev_err (dev,"src info allocation error\n" ); - goto rsnd_of_parse_src_end; - } - - info->src_info = src_info; - info->src_info_nr = nr; - - i =0 ; -for_each_child_of_node (src_node, np) { - src_info[i].irq =irq_of_parse_and_map (np,0 ); - - i++; - } - -rsnd_of_parse_src_end: -of_node_put (src_node); +return rsnd_mod_get (rsnd_src_get (priv, id)); } int rsnd_src_probe(struct platform_device *pdev,
@@ -1049,6 +957,9 @@ int rsnd_src_probe(struct platform_device *pdev, struct rsnd_priv *priv) {struct rcar_snd_info *info =rsnd_priv_to_info (priv); +struct rsnd_src_platform_info *src_info; +struct device_node *node; +struct device_node *np;struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_src *src;struct rsnd_mod_ops *ops;
@@ -1068,38 +979,70 @@ int rsnd_src_probe(struct platform_device *pdev,return -EIO ; } -rsnd_of_parse_src (pdev, of_data, priv); + node =rsnd_src_of_node (priv); +if (!node) +return 0 ;/* not used is not error */ -/* -* init SRC -*/ - nr = info->src_info_nr; -if (!nr) -return 0 ; + nr =of_get_child_count (node); +if (!nr) { + ret = -EINVAL ; + goto rsnd_src_probe_done; + } + + src_info =devm_kzalloc (dev, +sizeof (struct rsnd_src_platform_info ) * nr, +GFP_KERNEL ); +if (!src_info) { + ret = -ENOMEM ; + goto rsnd_src_probe_done; + } + + info->src_info = src_info; + info->src_info_nr = nr; src =devm_kzalloc (dev,sizeof (*src) * nr,GFP_KERNEL ); -if (!src) -return -ENOMEM ; +if (!src) { + ret = -ENOMEM ; + goto rsnd_src_probe_done; + } priv->src_nr = nr; priv->src = src; -for_each_rsnd_src (src, priv, i) { + i =0 ; +for_each_child_of_node (node, np) { + src =rsnd_src_get (priv, i); +snprintf (name,RSND_SRC_NAME_SIZE ,"%s.%d" ,SRC_NAME , i); + src_info[i].irq =irq_of_parse_and_map (np,0 ); +if (!src_info[i].irq) { + ret = -EINVAL ; + goto rsnd_src_probe_done; + } + clk =devm_clk_get (dev, name); -if (IS_ERR (clk)) -return PTR_ERR (clk); +if (IS_ERR (clk)) { + ret =PTR_ERR (clk); + goto rsnd_src_probe_done; + } - src->info = &info->src_info[i]; + src->info = &src_info[i]; ret =rsnd_mod_init (priv,rsnd_mod_get (src), ops, clk,RSND_MOD_SRC , i);if (ret) -return ret; + goto rsnd_src_probe_done; + + i++; } -return 0 ; + ret =0 ; + +rsnd_src_probe_done: +of_node_put (node); + +return ret; } void rsnd_src_remove(struct platform_device *pdev,
Signature · 1 line
2.7.4
PATCH 1/19 ASoC: rsnd: remove platform boot support from src.c
Quoted 11 lines · Fabrizio Castro
From: Kuninori Morimoto <[email protected]>
No board is using Renesas sound driver via platform boot now. This means all user is using DT boot. Platform boot support is no longer needed. But, it strongly depends on platform boot style. This patch removes platform boot support from
src.cSigned-off-by Kuninori Morimoto <[email protected]>Signed-off-by Mark Brown <[email protected]>(cherry picked from commit adf6a6815952c6c6092ae15e27c1b782fd96c6a3)(reworked to fit the context)
[...]
This isn't a sufficient explanation of the backporting change. The upstream version appears to remove all use of struct rsnd_src_platform_info from the driver, but this version extends the use of that structure.
Ben.
Signature · 3 lines
Ben Hutchings, Software Developer ? Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomPATCH 1/19 ASoC: rsnd: remove platform boot support from src.c
Hello Ben,
Thank you for your feedback.
Quoted 19 lines
-----Original Message-----
From: Ben Hutchings <[email protected]>
Sent: 24 August 2018 18:29
To: Fabrizio Castro <[email protected]>
Cc: cip-dev at lists.cip-project.org; Chris Paterson <[email protected]>; Biju Das <[email protected]>
Subject: Re: [PATCH 01/19] ASoC: rsnd: remove platform boot support fromsrc.cQuoted 11 lines · Fabrizio Castro
From: Kuninori Morimoto <[email protected]>
No board is using Renesas sound driver via platform boot now. This means all user is using DT boot. Platform boot support is no longer needed. But, it strongly depends on platform boot style. This patch removes platform boot support from
src.cSigned-off-by Kuninori Morimoto <[email protected]>Signed-off-by Mark Brown <[email protected]>(cherry picked from commit adf6a6815952c6c6092ae15e27c1b782fd96c6a3)(reworked to fit the context)
Quoted 6 lines
[...]
This isn't a sufficient explanation of the backporting change. The upstream version appears to remove all use of struct
rsnd_src_platform_infofrom the driver, but this version extends the use of that structure.
Will send a v2 to improve the description.
Cheers,
Fab
Quoted 7 lines
Ben.
--
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH 1/19 ASoC: rsnd: remove platform boot support from src.c
Hello Ben,
I am sorry about the delay of my answer.
Quoted 32 lines
Subject: Re: [cip-dev] [PATCH 01/19] ASoC: rsnd: remove platform boot support from
src.cHello Ben,
Thank you for your feedback.
Quoted 25 lines
-----Original Message-----
From: Ben Hutchings <[email protected]>
Sent: 24 August 2018 18:29
To: Fabrizio Castro <[email protected]>
Cc: cip-dev at lists.cip-project.org; Chris Paterson <[email protected]>; Biju Das <[email protected]>
Subject: Re: [PATCH 01/19] ASoC: rsnd: remove platform boot support fromsrc.cQuoted 11 lines · Fabrizio Castro
From: Kuninori Morimoto <[email protected]>
No board is using Renesas sound driver via platform boot now. This means all user is using DT boot. Platform boot support is no longer needed. But, it strongly depends on platform boot style. This patch removes platform boot support from
src.cSigned-off-by Kuninori Morimoto <[email protected]>Signed-off-by Mark Brown <[email protected]>(cherry picked from commit adf6a6815952c6c6092ae15e27c1b782fd96c6a3)(reworked to fit the context)
[...]
This isn't a sufficient explanation of the backporting change. The upstream version appears to remove all use of struct
rsnd_src_platform_infofrom the driver, but this version extends the use of that structure.
r8a7745 doesn't have clock "src.0" leaving a gap in the clock names. The fix for this was made upstream with commit de1965159a34 ("rcar: src:
skip disabled-SRC nodes"). This patch prepares the context for the fix, however since it is applied to quite a different version of the file it has been reworked to support the replacing of for_each_rsnd_src with for_each_child_of_node loop.
I could try and backport lots more patches to get a cleaner history, but I fear that would actually make the code unstable.
Do you have any recommendation for a better log?
The other thing I could do is try and fix the problem in a different way without backporting any patch. What are your thoughts about this?
Thanks,
Fab
Quoted 17 lines
Will send a v2 to improve the description.
Cheers,
FabQuoted 7 lines
Ben.
--
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom
Quoted 6 lines
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
_______________________________________________
cip-dev mailing list
cip-dev at lists.cip-project.org
https://lists.cip-project.org/mailman/listinfo/cip-dev
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH 1/19 ASoC: rsnd: remove platform boot support from src.c
Hello Ben,
Have you given any more thought about this?
Thanks,
Fab
Quoted 74 lines
Subject: RE: [cip-dev] [PATCH 01/19] ASoC: rsnd: remove platform boot support from
src.cHello Ben,
I am sorry about the delay of my answer.
Quoted 32 lines
Subject: Re: [cip-dev] [PATCH 01/19] ASoC: rsnd: remove platform boot support from
src.cHello Ben,
Thank you for your feedback.
Quoted 25 lines
-----Original Message-----
From: Ben Hutchings <[email protected]>
Sent: 24 August 2018 18:29
To: Fabrizio Castro <[email protected]>
Cc: cip-dev at lists.cip-project.org; Chris Paterson <[email protected]>; Biju Das <[email protected]>
Subject: Re: [PATCH 01/19] ASoC: rsnd: remove platform boot support fromsrc.cQuoted 11 lines · Fabrizio Castro
From: Kuninori Morimoto <[email protected]>
No board is using Renesas sound driver via platform boot now. This means all user is using DT boot. Platform boot support is no longer needed. But, it strongly depends on platform boot style. This patch removes platform boot support from
src.cSigned-off-by Kuninori Morimoto <[email protected]>Signed-off-by Mark Brown <[email protected]>(cherry picked from commit adf6a6815952c6c6092ae15e27c1b782fd96c6a3)(reworked to fit the context)
[...]
This isn't a sufficient explanation of the backporting change. The upstream version appears to remove all use of struct
rsnd_src_platform_infofrom the driver, but this version extends the use of that structure.r8a7745 doesn't have clock "src.0" leaving a gap in the clock names. The fix for this was made upstream with commit
de1965159a34("rcar: src:
skip disabled-SRC nodes"). This patch prepares the context for the fix, however since it is applied to quite a different version of the file it has been reworked to support the replacing offor_each_rsnd_srcwithfor_each_child_of_nodeloop.I could try and backport lots more patches to get a cleaner history, but I fear that would actually make the code unstable.
Do you have any recommendation for a better log?
The other thing I could do is try and fix the problem in a different way without backporting any patch. What are your thoughts about this?
Thanks,
FabQuoted 17 lines
Will send a v2 to improve the description.
Cheers,
FabQuoted 7 lines
Ben.
--
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom
Quoted 7 lines
Quoted 1 line
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England
&
Quoted 5 lines
Wales under Registered No. 04586709.
_______________________________________________
cip-dev mailing list
cip-dev at lists.cip-project.org
https://lists.cip-project.org/mailman/listinfo/cip-dev
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH 1/19 ASoC: rsnd: remove platform boot support from src.c
In reply to Fabrizio CastroOn Mon, 2018-09-03 at 10:10 +0000, Fabrizio Castro wrote:
[...]
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
This isn't a sufficient explanation of the backporting change.??The upstream version appears to remove all use of struct
rsnd_src_platform_infofrom the driver, but this version extends the use of that structure.r8a7745 doesn't have clock "src.0" leaving a gap in the clock names. The fix for this was made upstream with commit
de1965159a34("rcar: src:
skip disabled-SRC nodes"). This patch prepares the context for the fix, however since it is applied to quite a different version of the file it has been reworked to support the replacing offor_each_rsnd_srcwithfor_each_child_of_nodeloop.
Quoted 4 lines
I could try and backport lots more patches to get a cleaner history, but I fear that would actually make the code unstable.
Do you have any recommendation for a better log?
[...]
The above is roughly what I was looking for, so I've gone ahead and replaced the upstream commit message. Thanks.
Ben.
Signature · 3 lines
Ben Hutchings, Software Developer ? Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United KingdomPATCH 1/19 ASoC: rsnd: remove platform boot support from src.c
Thank you Ben!
Cheers,
Fab
Quoted 25 lines
Subject: Re: [cip-dev] [PATCH 01/19] ASoC: rsnd: remove platform boot support from
src.cOn Mon, 2018-09-03 at 10:10 +0000, Fabrizio Castro wrote:
[...]Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
This isn't a sufficient explanation of the backporting change. The upstream version appears to remove all use of struct
rsnd_src_platform_infofrom the driver, but this version extends the use of that structure.r8a7745 doesn't have clock "src.0" leaving a gap in the clock names. The fix for this was made upstream with commit
de1965159a34("rcar: src:
skip disabled-SRC nodes"). This patch prepares the context for the fix, however since it is applied to quite a different version of the file it has been reworked to support the replacing offor_each_rsnd_srcwithfor_each_child_of_nodeloop.Quoted 4 lines
I could try and backport lots more patches to get a cleaner history, but I fear that would actually make the code unstable.
Do you have any recommendation for a better log?
[...]
The above is roughly what I was looking for, so I've gone ahead and replaced the upstream commit message. Thanks.
Quoted 6 lines
Ben.
--
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH 2/19 rcar: src: skip disabled-SRC nodes
In reply to Fabrizio CastroFrom: Sergei Shtylyov <[email protected]>
The current device tree representation of the R-Car Sample Rate Converters (SRC) assumes that they are numbered consecutively, starting from 0. Alas, this is not the case with the R8A7794 SoC where SRC0 isn't present. In order to keep the existing device trees working, I'm suggesting to use a disabled node for SRC0. Teach the SRC probe to just skip disabled nodes.
--- sound/soc/sh/rcar/src.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/sh/rcar/src.c +4 -0
@@ -1011,6 +1011,9 @@ int rsnd_src_probe(struct platform_device *pdev, i =0 ;for_each_child_of_node (node, np) { +if (!of_device_is_available (np)) + goto skip; + src =rsnd_src_get (priv, i); snprintf(name, RSND_SRC_NAME_SIZE, "%s.%d",
@@ -1034,6 +1037,7 @@ int rsnd_src_probe(struct platform_device *pdev,if (ret) goto rsnd_src_probe_done; +skip: i++; }
Signature · 1 line
2.7.4
PATCH 3/19 dmaengine: rcar-dmac: clear pertinence number of channels
In reply to Fabrizio CastroFrom: Kuninori Morimoto <[email protected]>
DMACHCLR clears each channels, but its channel number is based on its SoC or IP. Current driver is using fixed 0x7fff (= for 15ch), it is not good match for Gen3 or Gen2 Audio DMAC. This patch fixes it
--- drivers/dma/sh/rcar-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/rcar-dmac.c +1 -1
@@ -413,7 +413,7 @@ static int rcar_dmac_init(struct rcar_dmac *dmac)u16 dmaor;/* Clear all channels and enable the DMAC globally. */ -rcar_dmac_write (dmac,RCAR_DMACHCLR ,0x7fff ); +rcar_dmac_write (dmac,RCAR_DMACHCLR ,GENMASK (dmac->n_channels -1 ,0 ));rcar_dmac_write (dmac,RCAR_DMAOR ,RCAR_DMAOR_PRI_FIXED |RCAR_DMAOR_DME );
Signature · 1 line
2.7.4
PATCH 4/19 dmaengine: rcar-dmac: use list_add() on rcar_dmac_desc_put()
In reply to Fabrizio CastroFrom: Kuninori Morimoto <[email protected]>
For each descriptor, in addition to the memory used by the descriptors structure itself, the driver allocates a list of chunks as well as a buffer for hardware descriptors. Descriptors themselves are preallocated, and allocation of the chunks and buffer is performed the first time the descriptor is used. The memory isn't freed when the transfer is completed, as the chunks and buffer will be needed again when the descriptor is reused internally, so the driver keeps the memory around.
If only a few descriptors are used concurrently, the current list_add_tail() implementation will result in all preallocated descriptors being used before going back to the first one, and will thus allocate chunks and a buffer for all preallocated descriptors. Using list_add() will put the complete descriptor at the head of the list of available descriptors, so the next transfer will be more likely to reuse a descriptor that already has associated memory instead of one that has never been used before.
--- drivers/dma/sh/rcar-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/rcar-dmac.c +1 -1
@@ -510,7 +510,7 @@ static void rcar_dmac_desc_put(struct rcar_dmac_chan *chan,spin_lock_irqsave (&chan->lock, flags);list_splice_tail_init (&desc->chunks, &chan->desc.chunks_free); -list_add_tail (&desc->node, &chan->desc.free); +list_add (&desc->node, &chan->desc.free);spin_unlock_irqrestore (&chan->lock, flags); }
Signature · 1 line
2.7.4
PATCH 5/19 dmaengine: rcar-dmac: use result of updated get_residue in tx_status
In reply to Fabrizio CastroFrom: Muhammad Hamza Farooq <[email protected]>
The hardware might have complete the transfer but the interrupt handler might not have had a chance to run. If rcar_dmac_chan_get_residue() which reads HW registers finds that there is no residue return DMA_COMPLETE.
--- drivers/dma/sh/rcar-dmac.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/sh/rcar-dmac.c +4 -0
@@ -1202,6 +1202,10 @@ static enum dma_status rcar_dmac_tx_status(struct dma_chan *chan, residue =rcar_dmac_chan_get_residue (rchan, cookie);spin_unlock_irqrestore (&rchan->lock, flags); +/* if there's no residue, the cookie is complete */ +if (!residue) +return DMA_COMPLETE ; +dma_set_residue (txstate, residue);return status;
Signature · 1 line
2.7.4
PATCH 6/19 dmaengine: rcar-dmac: warn if transfer cannot start as TE = 1
In reply to Fabrizio CastroFrom: Niklas S?derlund <[email protected]>
The documentation states one should make sure both DE and TE are cleared before starting a transaction. This patch extends the current warning to look at both DE and TE.
Based on previous work from Muhammad Hamza Farooq.
--- drivers/dma/sh/rcar-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/rcar-dmac.c +1 -1
@@ -311,7 +311,7 @@ static bool rcar_dmac_chan_is_busy(struct rcar_dmac_chan *chan) {u32 chcr =rcar_dmac_chan_read (chan,RCAR_DMACHCR ); -return (chcr & (RCAR_DMACHCR_DE |RCAR_DMACHCR_TE )) ==RCAR_DMACHCR_DE ; +return !!(chcr & (RCAR_DMACHCR_DE |RCAR_DMACHCR_TE )); }static void rcar_dmac_chan_start_xfer (struct rcar_dmac_chan *chan)
Signature · 1 line
2.7.4
PATCH 7/19 dmaengine: rcar-dmac: Fixed active descriptor initializing
In reply to Fabrizio CastroFrom: Muhammad Hamza Farooq <[email protected]>
Running descriptor pointer is set to NULL upon freeing resources. Other- wise, rcar_dmac_issue_pending might not start new transfers
--- drivers/dma/sh/rcar-dmac.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/sh/rcar-dmac.c +2 -0
@@ -990,6 +990,8 @@ static void rcar_dmac_free_chan_resources(struct dma_chan *chan)list_splice_init (&rchan->desc.done, &list);list_splice_init (&rchan->desc.wait, &list); + rchan->desc.running =NULL ; +list_for_each_entry (desc, &list, node)rcar_dmac_realloc_hwdesc (rchan, desc,0 );
Signature · 1 line
2.7.4
PATCH 8/19 dmaengine: rcar-dmac: Fix residue reporting for pending descriptors
In reply to Fabrizio CastroFrom: Laurent Pinchart <[email protected]>
Cookies corresponding to pending transfers have a residue value equal to the full size of the corresponding descriptor. The driver miscomputes that and uses the size of the active descriptor instead. Fix it.
--- drivers/dma/sh/rcar-dmac.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
drivers/dma/sh/rcar-dmac.c +29 -2
@@ -1145,6 +1145,7 @@ static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan,struct rcar_dmac_desc *desc = chan->desc.running;struct rcar_dmac_xfer_chunk *running =NULL ;struct rcar_dmac_xfer_chunk *chunk; +enum dma_status status;unsigned int residue =0 ;unsigned int dptr =0 ;
@@ -1152,12 +1153,38 @@ static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan,return 0 ;/* +* If the cookie corresponds to a descriptor that has been completed +* there is no residue. The same check has already been performed by the +* caller but without holding the channel lock, so the descriptor could +* now be complete. +*/ + status =dma_cookie_status (&chan->chan, cookie,NULL ); +if (status ==DMA_COMPLETE ) +return 0 ; + +/* * If the cookie doesn't correspond to the currently running transfer * then the descriptor hasn't been processed yet, and the residue is * equal to the full descriptor size. */ -if (cookie != desc->async_tx.cookie) -return desc->size; +if (cookie != desc->async_tx.cookie) { +list_for_each_entry (desc, &chan->desc.pending, node) { +if (cookie == desc->async_tx.cookie) +return desc->size; + } +list_for_each_entry (desc, &chan->desc.active, node) { +if (cookie == desc->async_tx.cookie) +return desc->size; + } + +/* +* No descriptor found for the cookie, there's thus no residue. +* This shouldn't happen if the calling driver passes a correct +* cookie value. +*/ +WARN (1 ,"No descriptor for cookie!" ); +return 0 ; + }/* * In descriptor mode the descriptor running pointer is not maintained
Signature · 1 line
2.7.4
PATCH 9/19 dmaengine: rcar-dmac: ensure CHCR DE bit is actually 0 after clearing
In reply to Fabrizio CastroFrom: Kuninori Morimoto <[email protected]>
DMAC reads data from source device, and buffered it until transferable size for sink device. Because of this behavior, DMAC is including buffered data .
Now, CHCR DE bit is controlling DMA transfer enable/disable.
If DE bit was cleared during data transferring, or during buffering, it will flush buffered data if source device was peripheral device (The buffered data will be removed if source device was memory). Because of this behavior, driver should ensure that DE bit is actually 0 after clearing.
This patch adds new rcar_dmac_chcr_de_barrier() and call it after CHCR register access.
--- drivers/dma/sh/rcar-dmac.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/dma/sh/rcar-dmac.c +22 -0
@@ -10,6 +10,7 @@* published by the Free Software Foundation. */ +#include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/dmaengine.h> #include <linux/interrupt.h>
@@ -716,6 +717,24 @@ static int rcar_dmac_fill_hwdesc(struct rcar_dmac_chan *chan,/* ----------------------------------------------------------------------------- * Stop and reset */ +static void rcar_dmac_chcr_de_barrier (struct rcar_dmac_chan *chan) +{ +u32 chcr; +unsigned int i; + +/* +* Ensure that the setting of the DE bit is actually 0 after +* clearing it. +*/ +for (i =0 ; i <1024 ; i++) { + chcr =rcar_dmac_chan_read (chan,RCAR_DMACHCR ); +if (!(chcr &RCAR_DMACHCR_DE )) +return ; +udelay (1 ); + } + +dev_err (chan->chan.device->dev,"CHCR DE check error\n" ); +}static void rcar_dmac_chan_halt (struct rcar_dmac_chan *chan) {
@@ -724,6 +743,7 @@ static void rcar_dmac_chan_halt(struct rcar_dmac_chan *chan) chcr &= ~(RCAR_DMACHCR_DSE |RCAR_DMACHCR_DSIE |RCAR_DMACHCR_IE |RCAR_DMACHCR_TE |RCAR_DMACHCR_DE );rcar_dmac_chan_write (chan,RCAR_DMACHCR , chcr); +rcar_dmac_chcr_de_barrier (chan); }static void rcar_dmac_chan_reinit (struct rcar_dmac_chan *chan)
@@ -1373,6 +1393,8 @@ static irqreturn_t rcar_dmac_isr_channel(int irq, void *dev)if (chcr &RCAR_DMACHCR_TE ) mask |=RCAR_DMACHCR_DE ;rcar_dmac_chan_write (chan,RCAR_DMACHCR , chcr & ~mask); +if (mask &RCAR_DMACHCR_DE ) +rcar_dmac_chcr_de_barrier (chan);if (chcr &RCAR_DMACHCR_DSE ) ret |=rcar_dmac_isr_desc_stage_end (chan);
Signature · 1 line
2.7.4
PATCH 10/19 dmaengine: rcar-dmac: use TCRB instead of TCR for residue
In reply to Fabrizio CastroFrom: Kuninori Morimoto <[email protected]>
SYS/RT/Audio DMAC includes independent data buffers for reading and writing. Therefore, the read transfer counter and write transfer counter have different values.
TCR indicates read counter, and TCRB indicates write counter. The relationship is like below.
TCR TCRB [SOURCE] -> [DMAC] -> [SINK]
In the MEM_TO_DEV direction, what really matters is how much data has been written to the device. If the DMA is interrupted between read and write, then, the data doesn't end up in the destination, so shouldn't be counted. TCRB is thus the register we should use in this cases.
In the DEV_TO_MEM direction, the situation is more complex. Both the read and write side are important. What matters from a data consumer point of view is how much data has been written to memory. On the other hand, if the transfer is interrupted between read and write, we'll end up losing data. It can also be important to report.
In the MEM_TO_MEM direction, what matters is of course how much data has been written to memory from data consumer point of view. Here, because read and write have independent data buffers, it will take a while for TCR and TCRB to become equal. Thus we should check TCRB in this case, too.
Thus, all cases we should check TCRB instead of TCR.
Without this patch, Sound Capture has noise after PulseAudio support (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate")), because the recorder will use wrong residue counter which indicates transferred from sound device, but in reality the data was not yet put to memory and recorder will record it.
However, because DMAC is buffering data until it can be transferable size, TCRB might not be updated.
For example, if consumer doesn't know how much data can be received, it requests enough size to DMAC. But in reality, it might receive very few data. In such case, DMAC just buffered it until transferable size, and no TCRB updated.
In such case, this buffered data will be transferred if CHCR::DE bit was cleared, and this is happen if rcar_dmac_chan_halt(). In other word, it happen when consumer called dmaengine_terminate_all().
Because of this behavior, it need to flush buffered data when it returns "residue" (= dmaengine_tx_status()).
Otherwise, consumer might calculate wrong things if it called dmaengine_tx_status() and dmaengine_terminate_all() consecutively.
--- drivers/dma/sh/rcar-dmac.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/dma/sh/rcar-dmac.c +21 -1
@@ -736,6 +736,23 @@ static void rcar_dmac_chcr_de_barrier(struct rcar_dmac_chan *chan)dev_err (chan->chan.device->dev,"CHCR DE check error\n" ); } +static void rcar_dmac_sync_tcr (struct rcar_dmac_chan *chan) +{ +u32 chcr =rcar_dmac_chan_read (chan,RCAR_DMACHCR ); + +if (!(chcr &RCAR_DMACHCR_DE )) +return ; + +/* set DE=0 and flush remaining data */ +rcar_dmac_chan_write (chan,RCAR_DMACHCR , (chcr & ~RCAR_DMACHCR_DE )); + +/* make sure all remaining data was flushed */ +rcar_dmac_chcr_de_barrier (chan); + +/* back DE */ +rcar_dmac_chan_write (chan,RCAR_DMACHCR , chcr); +} +static void rcar_dmac_chan_halt (struct rcar_dmac_chan *chan) {u32 chcr =rcar_dmac_chan_read (chan,RCAR_DMACHCR );
@@ -1228,8 +1245,11 @@ static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan, residue += chunk->size; } +if (desc->direction ==DMA_DEV_TO_MEM ) +rcar_dmac_sync_tcr (chan); +/* Add the residue for the current chunk. */ - residue +=rcar_dmac_chan_read (chan,RCAR_DMATCR ) << desc->xfer_shift; + residue +=rcar_dmac_chan_read (chan,RCAR_DMATCRB ) << desc->xfer_shift;return residue; }
Signature · 1 line
2.7.4
PATCH 11/19 ARM: dts: r8a7745: Add audio clocks
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
Describe the external audio clocks required by the sound driver. Boards that provide audio clocks need to override the clock frequencies.
--- arch/arm/boot/dts/r8a7745.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm/boot/dts/r8a7745.dtsi +21 -0
@@ -34,6 +34,27 @@ vin1 = &vin1; }; + /* + * The external audio clocks are configured as 0 Hz fixed + * frequency clocks by default. Boards that provide audio + * clocks should override them. + */ + audio_clka: audio_clka { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <0>; + }; + audio_clkb: audio_clkb { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <0>; + }; + audio_clkc: audio_clkc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <0>; + }; + /* External CAN clock */ can_clk: can { compatible = "fixed-clock";
Signature · 1 line
2.7.4
PATCH 12/19 ARM: dts: r8a7745: Add audio DMAC support
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
Instantiate the audio DMA controller on the r8a7745 device tree.
(modified clocks and power-domains properties. removed resets property)
--- arch/arm/boot/dts/r8a7745.dtsi | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/arm/boot/dts/r8a7745.dtsi +30 -0
@@ -935,6 +935,36 @@ status = "disabled"; }; + audma0: dma-controller at ec700000 { + compatible = "renesas,dmac-r8a7745", + "renesas,rcar-dmac"; + reg = <0 0xec700000 0 0x10000>; + interrupts = <GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 320 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 321 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 322 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 323 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 325 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 326 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 328 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 329 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 330 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH + GIC_SPI 332 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "error", + "ch0", "ch1", "ch2", "ch3", + "ch4", "ch5", "ch6", "ch7", + "ch8", "ch9", "ch10", "ch11", + "ch12"; + clocks = <&mstp5_clks R8A7745_CLK_AUDIO_DMAC0>; + clock-names = "fck"; + power-domains = <&cpg_clocks>; + #dma-cells = <1>; + dma-channels = <13>; + }; + pci0: pci at ee090000 { compatible = "renesas,pci-r8a7745", "renesas,pci-rcar-gen2";
Signature · 1 line
2.7.4
PATCH 13/19 ARM: dts: r8a7745: Add sound support
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
Define the generic r8a7745(RZ/G1E) part of the sound device node.
This patch is based on the r8a7794 sound work by Sergei Shtylyov.
(modified clocks and power-domains properties. Removed resets and reset-names properties. Also changed rcar_sound,module children names (e.g. from ssi-0 to ssi at 0) to make them similar to other R-Car Gen2 devices in 4.4)
--- arch/arm/boot/dts/r8a7745.dtsi | 171 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+)
arch/arm/boot/dts/r8a7745.dtsi +171 -0
@@ -935,6 +935,177 @@ status = "disabled"; }; + rcar_sound: sound at ec500000 { + /* + * #sound-dai-cells is required + * + * Single DAI : #sound-dai-cells = <0>; <&rcar_sound>; + * Multi DAI : #sound-dai-cells = <1>; <&rcar_sound N>; + */ + compatible = "renesas,rcar_sound-r8a7745", + "renesas,rcar_sound-gen2"; + reg = <0 0xec500000 0 0x1000>, /* SCU */ + <0 0xec5a0000 0 0x100>, /* ADG */ + <0 0xec540000 0 0x1000>, /* SSIU */ + <0 0xec541000 0 0x280>, /* SSI */ + <0 0xec740000 0 0x200>; /* Audio DMAC peri peri */ + reg-names = "scu", "adg", "ssiu", "ssi", "audmapp"; + + clocks = <&mstp10_clks R8A7745_CLK_SSI_ALL>, + <&mstp10_clks R8A7745_CLK_SSI9>, <&mstp10_clks R8A7745_CLK_SSI8>, + <&mstp10_clks R8A7745_CLK_SSI7>, <&mstp10_clks R8A7745_CLK_SSI6>, + <&mstp10_clks R8A7745_CLK_SSI5>, <&mstp10_clks R8A7745_CLK_SSI4>, + <&mstp10_clks R8A7745_CLK_SSI3>, <&mstp10_clks R8A7745_CLK_SSI2>, + <&mstp10_clks R8A7745_CLK_SSI1>, <&mstp10_clks R8A7745_CLK_SSI0>, + <&mstp10_clks R8A7745_CLK_SCU_SRC6>, <&mstp10_clks R8A7745_CLK_SCU_SRC5>, + <&mstp10_clks R8A7745_CLK_SCU_SRC4>, <&mstp10_clks R8A7745_CLK_SCU_SRC3>, + <&mstp10_clks R8A7745_CLK_SCU_SRC2>, <&mstp10_clks R8A7745_CLK_SCU_SRC1>, + <&mstp10_clks R8A7745_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7745_CLK_SCU_CTU1_MIX1>, + <&mstp10_clks R8A7745_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7745_CLK_SCU_CTU1_MIX1>, + <&mstp10_clks R8A7745_CLK_SCU_DVC0>, <&mstp10_clks R8A7745_CLK_SCU_DVC1>, + <&audio_clka>, <&audio_clkb>, <&audio_clkc>, + <&m2_clk>; + clock-names = "ssi-all", + "ssi.9", "ssi.8", "ssi.7", "ssi.6", + "ssi.5", "ssi.4", "ssi.3", "ssi.2", + "ssi.1", "ssi.0", + "src.6", "src.5", "src.4", "src.3", + "src.2", "src.1", + "ctu.0", "ctu.1", + "mix.0", "mix.1", + "dvc.0", "dvc.1", + "clk_a", "clk_b", "clk_c", "clk_i"; + power-domains = <&cpg_clocks>; + + status = "disabled"; + + rcar_sound,dvc { + dvc0: dvc at 0 { + dmas = <&audma0 0xbc>; + dma-names = "tx"; + }; + dvc1: dvc at 1 { + dmas = <&audma0 0xbe>; + dma-names = "tx"; + }; + }; + + rcar_sound,mix { + mix0: mix at 0 { }; + mix1: mix at 1 { }; + }; + + rcar_sound,ctu { + ctu00: ctu at 0 { }; + ctu01: ctu at 1 { }; + ctu02: ctu at 2 { }; + ctu03: ctu at 3 { }; + ctu10: ctu at 4 { }; + ctu11: ctu at 5 { }; + ctu12: ctu at 6 { }; + ctu13: ctu at 7 { }; + }; + + rcar_sound,src { + src at 0 { + status = "disabled"; + }; + src1: src at 1 { + interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x87>, <&audma0 0x9c>; + dma-names = "rx", "tx"; + }; + src2: src at 2 { + interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x89>, <&audma0 0x9e>; + dma-names = "rx", "tx"; + }; + src3: src at 3 { + interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x8b>, <&audma0 0xa0>; + dma-names = "rx", "tx"; + }; + src4: src at 4 { + interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x8d>, <&audma0 0xb0>; + dma-names = "rx", "tx"; + }; + src5: src at 5 { + interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x8f>, <&audma0 0xb2>; + dma-names = "rx", "tx"; + }; + src6: src at 6 { + interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x91>, <&audma0 0xb4>; + dma-names = "rx", "tx"; + }; + }; + + rcar_sound,ssi { + ssi0: ssi at 0 { + interrupts = <GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x01>, <&audma0 0x02>, + <&audma0 0x15>, <&audma0 0x16>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi1: ssi at 1 { + interrupts = <GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x03>, <&audma0 0x04>, + <&audma0 0x49>, <&audma0 0x4a>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi2: ssi at 2 { + interrupts = <GIC_SPI 372 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x05>, <&audma0 0x06>, + <&audma0 0x63>, <&audma0 0x64>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi3: ssi at 3 { + interrupts = <GIC_SPI 373 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x07>, <&audma0 0x08>, + <&audma0 0x6f>, <&audma0 0x70>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi4: ssi at 4 { + interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x09>, <&audma0 0x0a>, + <&audma0 0x71>, <&audma0 0x72>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi5: ssi at 5 { + interrupts = <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x0b>, <&audma0 0x0c>, + <&audma0 0x73>, <&audma0 0x74>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi6: ssi at 6 { + interrupts = <GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x0d>, <&audma0 0x0e>, + <&audma0 0x75>, <&audma0 0x76>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi7: ssi at 7 { + interrupts = <GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x0f>, <&audma0 0x10>, + <&audma0 0x79>, <&audma0 0x7a>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi8: ssi at 8 { + interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x11>, <&audma0 0x12>, + <&audma0 0x7b>, <&audma0 0x7c>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + ssi9: ssi at 9 { + interrupts = <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>; + dmas = <&audma0 0x13>, <&audma0 0x14>, + <&audma0 0x7d>, <&audma0 0x7e>; + dma-names = "rx", "tx", "rxu", "txu"; + }; + }; + }; + audma0: dma-controller at ec700000 { compatible = "renesas,dmac-r8a7745", "renesas,rcar-dmac";
Signature · 1 line
2.7.4
PATCH 14/19 ARM: dts: iwg22d-sodimm: Enable SGTL5000 audio codec
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
This patch enables SGTL5000 audio codec on the carrier board.
--- arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts +28 -0
@@ -26,6 +26,12 @@ stdout-path = "serial3:115200n8"; }; + audio_clock: audio_clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <26000000>; + }; + vccq_sdhi0: regulator-vccq-sdhi0 { compatible = "regulator-gpio";
@@ -55,6 +61,23 @@ status = "okay"; }; +&i2c5 { + pinctrl-0 = <&i2c5_pins>; + pinctrl-names = "default"; + + status = "okay"; + clock-frequency = <400000>; + + sgtl5000: codec at a { + compatible = "fsl,sgtl5000"; + #sound-dai-cells = <0>; + reg = <0x0a>; + clocks = <&audio_clock>; + VDDA-supply = <®_3p3v>; + VDDIO-supply = <®_3p3v>; + }; +}; + &pfc { can0_pins: can0 { groups = "can0_data";
@@ -66,6 +89,11 @@ function = "hscif1"; }; + i2c5_pins: i2c5 { + groups = "i2c5_b"; + function = "i2c5"; + }; + scif4_pins: scif4 { groups = "scif4_data_b"; function = "scif4";
Signature · 1 line
2.7.4
PATCH 15/19 ARM: dts: iwg22d-sodimm: Sound PIO support
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
Enable sound PIO support on carrier board.
--- arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts +46 -0
@@ -32,6 +32,21 @@ clock-frequency = <26000000>; }; + rsnd_sgtl5000: sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,bitclock-master = <&sndcodec>; + simple-audio-card,frame-master = <&sndcodec>; + + sndcpu: simple-audio-card,cpu { + sound-dai = <&rcar_sound>; + }; + + sndcodec: simple-audio-card,codec { + sound-dai = <&sgtl5000>; + }; + }; + vccq_sdhi0: regulator-vccq-sdhi0 { compatible = "regulator-gpio";
@@ -110,6 +125,11 @@ power-source = <3300>; }; + sound_pins: sound { + groups = "ssi34_ctrl", "ssi3_data", "ssi4_data"; + function = "ssi"; + }; + usb0_pins: usb0 { groups = "usb0"; function = "usb0";
@@ -121,6 +141,23 @@ }; }; +&rcar_sound { + pinctrl-0 = <&sound_pins>; + pinctrl-names = "default"; + status = "okay"; + + /* Single DAI */ + + #sound-dai-cells = <0>; + + rcar_sound,dai { + dai0 { + playback = <&ssi3>; + capture = <&ssi4>; + }; + }; +}; + &scif4 { pinctrl-0 = <&scif4_pins>; pinctrl-names = "default";
@@ -169,6 +206,15 @@ pinctrl-names = "default"; }; +&ssi3 { + pio-transfer; +}; + +&ssi4 { + pio-transfer; + shared-pin; +}; + &usbphy { status = "okay"; };
Signature · 1 line
2.7.4
PATCH 16/19 ARM: dts: iwg22d-sodimm: Sound DMA support on DTS
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
DMA transfer to/from SSI
DMA
[MEM] -> [SSI]
DMA
[MEM] <- [SSI]
--- arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts +2 -2
@@ -207,11 +207,11 @@ }; &ssi3 { - pio-transfer; + no-busif; }; &ssi4 { - pio-transfer; + no-busif; shared-pin; };
Signature · 1 line
2.7.4
PATCH 17/19 ARM: dts: iwg22d-sodimm: Sound DMA support via BUSIF on DTS
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
DMA transfer to/from SSIU
DMA
[MEM] -> [SSIU] -> [SSI]
DMA
[MEM] <- [SSIU] <- [SSI]
--- arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts | 5 ----- 1 file changed, 5 deletions(-)
arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts +0 -5
@@ -206,12 +206,7 @@ pinctrl-names = "default"; }; -&ssi3 { - no-busif; -}; - &ssi4 { - no-busif; shared-pin; };
Signature · 1 line
2.7.4
PATCH 18/19 ARM: dts: iwg22d-sodimm: Sound DMA support via SRC on DTS
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
DMA transfer to/from SRC
DMA DMApp
[MEM] -> [SRC] -> [SSIU] -> [SSI]
DMA DMApp
[MEM] <- [SRC] <- [SSIU] <- [SSI]
Current sound driver is supporting SSI/SRC random connection. So, this patch is trying
SSI3 -> SRC3
SSI4 <- SRC4
--- arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts +2 -2
@@ -152,8 +152,8 @@ rcar_sound,dai { dai0 { - playback = <&ssi3>; - capture = <&ssi4>; + playback = <&ssi3 &src3>; + capture = <&ssi4 &src4>; }; }; };
Signature · 1 line
2.7.4
PATCH 19/19 ARM: dts: iwg22d-sodimm: Sound DMA support via DVC on DTS
In reply to Fabrizio CastroFrom: Biju Das <[email protected]>
DMA transfer uses DVC
DMA DMApp
[MEM] -> [SRC] -> [DVC] -> [SSIU] -> [SSI]
DMA DMApp
[MEM] <- [DVC] <- [SRC] <- [SSIU] <- [SSI]
--- arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts +25 -2
@@ -8,6 +8,29 @@ * kind, whether express or implied. */ +/* + * SSI-SGTL5000 + * + * This command is required when Playback/Capture + * + * amixer set "DVC Out" 100% + * amixer set "DVC In" 100% + * + * You can use Mute + * + * amixer set "DVC Out Mute" on + * amixer set "DVC In Mute" on + * + * You can use Volume Ramp + * + * amixer set "DVC Out Ramp Up Rate" "0.125 dB/64 steps" + * amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps" + * amixer set "DVC Out Ramp" on + * aplay xxx.wav & + * amixer set "DVC Out" 80% // Volume Down + * amixer set "DVC Out" 100% // Volume Up + */ + /dts-v1/; #include "r8a7745-iwg22m.dtsi"
@@ -152,8 +175,8 @@ rcar_sound,dai { dai0 { - playback = <&ssi3 &src3>; - capture = <&ssi4 &src4>; + playback = <&ssi3 &src3 &dvc0>; + capture = <&ssi4 &src4 &dvc1>; }; }; };
Signature · 1 line
2.7.4