diff mbox series

[V4,2/4] dmaengine: imx-sdma: support hdmi audio

Message ID 20220901020059.50099-1-joy.zou@nxp.com (mailing list archive)
State New, archived
Headers show
Series [V4,1/4] dt-bindings: fsl-imx-sdma: Convert imx sdma to DT schema | expand

Commit Message

Joy Zou Sept. 1, 2022, 2 a.m. UTC
Add hdmi audio support in sdma.

Signed-off-by: Joy Zou <joy.zou@nxp.com>
---
 drivers/dma/imx-sdma.c      | 38 +++++++++++++++++++++++++++++--------
 include/linux/dma/imx-dma.h |  1 +
 2 files changed, 31 insertions(+), 8 deletions(-)

Comments

Vinod Koul Sept. 4, 2022, 4:16 p.m. UTC | #1
On 01-09-22, 10:00, Joy Zou wrote:
> Add hdmi audio support in sdma.

Pls make sure you thread your patches properly! They are broken threads!
Joy Zou Sept. 5, 2022, 7:01 a.m. UTC | #2
> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: 2022年9月5日 0:16
> To: Joy Zou <joy.zou@nxp.com>
> Cc: krzysztof.kozlowski@linaro.org; S.J. Wang <shengjiu.wang@nxp.com>;
> shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
> festevam@gmail.com; dl-linux-imx <linux-imx@nxp.com>;
> dmaengine@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org
> Subject: [EXT] Re: [PATCH V4 2/4] dmaengine: imx-sdma: support hdmi audio
> 
> Caution: EXT Email
> 
> On 01-09-22, 10:00, Joy Zou wrote:
> > Add hdmi audio support in sdma.
> 
> Pls make sure you thread your patches properly! They are broken threads!
I am trying to support for hdmi audio feature on community driver drivers/gpu/drm/bridge/synopsys/.
Thank you very much!
BR
Joy Zou
> 
> --
> ~Vinod
Krzysztof Kozlowski Sept. 5, 2022, 8:54 a.m. UTC | #3
On 05/09/2022 09:01, Joy Zou wrote:
> 
>> -----Original Message-----
>> From: Vinod Koul <vkoul@kernel.org>
>> Sent: 2022年9月5日 0:16
>> To: Joy Zou <joy.zou@nxp.com>
>> Cc: krzysztof.kozlowski@linaro.org; S.J. Wang <shengjiu.wang@nxp.com>;
>> shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
>> festevam@gmail.com; dl-linux-imx <linux-imx@nxp.com>;
>> dmaengine@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
>> linux-kernel@vger.kernel.org
>> Subject: [EXT] Re: [PATCH V4 2/4] dmaengine: imx-sdma: support hdmi audio
>>
>> Caution: EXT Email
>>
>> On 01-09-22, 10:00, Joy Zou wrote:
>>> Add hdmi audio support in sdma.
>>
>> Pls make sure you thread your patches properly! They are broken threads!
> I am trying to support for hdmi audio feature on community driver drivers/gpu/drm/bridge/synopsys/.

This does not answer to the problem you patches do not compose proper
thread. v5 which you sent now is also broken. Supporting HDMI audio
feature does not prevent you to send patches correctly, right?

Best regards,
Krzysztof
Joy Zou Sept. 5, 2022, 9:07 a.m. UTC | #4
> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Sent: 2022年9月5日 16:54
> To: Joy Zou <joy.zou@nxp.com>; Vinod Koul <vkoul@kernel.org>
> Cc: S.J. Wang <shengjiu.wang@nxp.com>; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
> dl-linux-imx <linux-imx@nxp.com>; dmaengine@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [EXT] Re: [PATCH V4 2/4] dmaengine: imx-sdma: support hdmi
> audio
> 
> Caution: EXT Email
> 
> On 05/09/2022 09:01, Joy Zou wrote:
> >
> >> -----Original Message-----
> >> From: Vinod Koul <vkoul@kernel.org>
> >> Sent: 2022年9月5日 0:16
> >> To: Joy Zou <joy.zou@nxp.com>
> >> Cc: krzysztof.kozlowski@linaro.org; S.J. Wang
> >> <shengjiu.wang@nxp.com>; shawnguo@kernel.org;
> s.hauer@pengutronix.de;
> >> kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
> >> <linux-imx@nxp.com>; dmaengine@vger.kernel.org;
> >> linux-arm-kernel@lists.infradead.org;
> >> linux-kernel@vger.kernel.org
> >> Subject: [EXT] Re: [PATCH V4 2/4] dmaengine: imx-sdma: support hdmi
> >> audio
> >>
> >> Caution: EXT Email
> >>
> >> On 01-09-22, 10:00, Joy Zou wrote:
> >>> Add hdmi audio support in sdma.
> >>
> >> Pls make sure you thread your patches properly! They are broken threads!
> > I am trying to support for hdmi audio feature on community driver
> drivers/gpu/drm/bridge/synopsys/.
> 
> This does not answer to the problem you patches do not compose proper
> thread. v5 which you sent now is also broken. Supporting HDMI audio feature
> does not prevent you to send patches correctly, right?
I am trying to support for hdmi audio feature on community driver drivers/gpu/drm/bridge/synopsys/.
I think the feature may take some time because I am not audio driver owner. I only want to update the others patch as soon as possible, so I send the patch v5. I am also solving the thread patches properly.
BR
Joy Zou

> 
> Best regards,
> Krzysztof
Vinod Koul Sept. 5, 2022, 11:03 a.m. UTC | #5
On 05-09-22, 09:07, Joy Zou wrote:
> > From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > >> On 01-09-22, 10:00, Joy Zou wrote:
> > >>> Add hdmi audio support in sdma.
> > >>
> > >> Pls make sure you thread your patches properly! They are broken threads!
> > > I am trying to support for hdmi audio feature on community driver
> > drivers/gpu/drm/bridge/synopsys/.
> > 
> > This does not answer to the problem you patches do not compose proper
> > thread. v5 which you sent now is also broken. Supporting HDMI audio feature
> > does not prevent you to send patches correctly, right?
> I am trying to support for hdmi audio feature on community driver drivers/gpu/drm/bridge/synopsys/.
> I think the feature may take some time because I am not audio driver owner. I only want to update the others patch as soon as possible, so I send the patch v5. I am also solving the thread patches properly.

Sorry you have not!

In my inbox, v5 1/2 and 2/2 do not appear as a single thread

Please fix the way you send the series and send them together, it is
very difficult to review when they are disjoint

FWIW, I checked the v5 2/2 and it does not have in-reply-to set, which
should point to 1/2.. If you are using git send-email, point both the
patches to it so that it will do that correctly for you
Joy Zou Sept. 6, 2022, 5:04 a.m. UTC | #6
> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: 2022年9月5日 19:03
> To: Joy Zou <joy.zou@nxp.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>; S.J. Wang
> <shengjiu.wang@nxp.com>; shawnguo@kernel.org; s.hauer@pengutronix.de;
> kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
> <linux-imx@nxp.com>; dmaengine@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [EXT] Re: [PATCH V4 2/4] dmaengine: imx-sdma: support hdmi
> audio
> 
> Caution: EXT Email
> 
> On 05-09-22, 09:07, Joy Zou wrote:
> > > From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > > >> On 01-09-22, 10:00, Joy Zou wrote:
> > > >>> Add hdmi audio support in sdma.
> > > >>
> > > >> Pls make sure you thread your patches properly! They are broken
> threads!
> > > > I am trying to support for hdmi audio feature on community driver
> > > drivers/gpu/drm/bridge/synopsys/.
> > >
> > > This does not answer to the problem you patches do not compose
> > > proper thread. v5 which you sent now is also broken. Supporting HDMI
> > > audio feature does not prevent you to send patches correctly, right?
> > I am trying to support for hdmi audio feature on community driver
> drivers/gpu/drm/bridge/synopsys/.
> > I think the feature may take some time because I am not audio driver owner.
> I only want to update the others patch as soon as possible, so I send the patch
> v5. I am also solving the thread patches properly.
> 
> Sorry you have not!
> 
> In my inbox, v5 1/2 and 2/2 do not appear as a single thread
> 
> Please fix the way you send the series and send them together, it is very
> difficult to review when they are disjoint
> 
> FWIW, I checked the v5 2/2 and it does not have in-reply-to set, which should
> point to 1/2.. If you are using git send-email, point both the patches to it so
> that it will do that correctly for you
I am very sorry. I find the root cause that the patch not appear as a single thread. I use the
git send-mail to send separately. I also know the patchwork can check it.
I'm so sorry to waste your time and effort. I am very grateful to your comments.
I will change next patch.
BR
Joy Zou

> 
> --
> ~Vinod
Vinod Koul Sept. 6, 2022, 5:16 a.m. UTC | #7
On 06-09-22, 05:04, Joy Zou wrote:
> 
> > -----Original Message-----
> > From: Vinod Koul <vkoul@kernel.org>
> > Sent: 2022年9月5日 19:03
> > To: Joy Zou <joy.zou@nxp.com>
> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>; S.J. Wang
> > <shengjiu.wang@nxp.com>; shawnguo@kernel.org; s.hauer@pengutronix.de;
> > kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
> > <linux-imx@nxp.com>; dmaengine@vger.kernel.org;
> > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> > Subject: Re: [EXT] Re: [PATCH V4 2/4] dmaengine: imx-sdma: support hdmi
> > audio
> > 
> > Caution: EXT Email
> > 
> > On 05-09-22, 09:07, Joy Zou wrote:
> > > > From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > > > >> On 01-09-22, 10:00, Joy Zou wrote:
> > > > >>> Add hdmi audio support in sdma.
> > > > >>
> > > > >> Pls make sure you thread your patches properly! They are broken
> > threads!
> > > > > I am trying to support for hdmi audio feature on community driver
> > > > drivers/gpu/drm/bridge/synopsys/.
> > > >
> > > > This does not answer to the problem you patches do not compose
> > > > proper thread. v5 which you sent now is also broken. Supporting HDMI
> > > > audio feature does not prevent you to send patches correctly, right?
> > > I am trying to support for hdmi audio feature on community driver
> > drivers/gpu/drm/bridge/synopsys/.
> > > I think the feature may take some time because I am not audio driver owner.
> > I only want to update the others patch as soon as possible, so I send the patch
> > v5. I am also solving the thread patches properly.
> > 
> > Sorry you have not!
> > 
> > In my inbox, v5 1/2 and 2/2 do not appear as a single thread
> > 
> > Please fix the way you send the series and send them together, it is very
> > difficult to review when they are disjoint
> > 
> > FWIW, I checked the v5 2/2 and it does not have in-reply-to set, which should
> > point to 1/2.. If you are using git send-email, point both the patches to it so
> > that it will do that correctly for you
> I am very sorry. I find the root cause that the patch not appear as a single thread. I use the
> git send-mail to send separately. I also know the patchwork can check it.

No, please point the whole series to git send-email

For example:
$ mkdir temp; cd temp
$ git format-patch -2 --cover-letter -v <patch version>
$ <update cover letter>
$ <run checkpatch etc and verify patches are in order>
$ git send-email *

That should do it for you!

> I'm so sorry to waste your time and effort. I am very grateful to your comments.
> I will change next patch.
> BR
> Joy Zou
> 
> > 
> > --
> > ~Vinod
Joy Zou Sept. 6, 2022, 5:24 a.m. UTC | #8
> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: 2022年9月6日 13:17
> To: Joy Zou <joy.zou@nxp.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>; S.J. Wang
> <shengjiu.wang@nxp.com>; shawnguo@kernel.org; s.hauer@pengutronix.de;
> kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
> <linux-imx@nxp.com>; dmaengine@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [EXT] Re: [PATCH V4 2/4] dmaengine: imx-sdma: support hdmi
> audio
> 
> Caution: EXT Email
> 
> On 06-09-22, 05:04, Joy Zou wrote:
> >
> > > -----Original Message-----
> > > From: Vinod Koul <vkoul@kernel.org>
> > > Sent: 2022年9月5日 19:03
> > > To: Joy Zou <joy.zou@nxp.com>
> > > Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>; S.J. Wang
> > > <shengjiu.wang@nxp.com>; shawnguo@kernel.org;
> > > s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
> > > dl-linux-imx <linux-imx@nxp.com>; dmaengine@vger.kernel.org;
> > > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> > > Subject: Re: [EXT] Re: [PATCH V4 2/4] dmaengine: imx-sdma: support
> > > hdmi audio
> > >
> > > Caution: EXT Email
> > >
> > > On 05-09-22, 09:07, Joy Zou wrote:
> > > > > From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > > > > >> On 01-09-22, 10:00, Joy Zou wrote:
> > > > > >>> Add hdmi audio support in sdma.
> > > > > >>
> > > > > >> Pls make sure you thread your patches properly! They are
> > > > > >> broken
> > > threads!
> > > > > > I am trying to support for hdmi audio feature on community
> > > > > > driver
> > > > > drivers/gpu/drm/bridge/synopsys/.
> > > > >
> > > > > This does not answer to the problem you patches do not compose
> > > > > proper thread. v5 which you sent now is also broken. Supporting
> > > > > HDMI audio feature does not prevent you to send patches correctly,
> right?
> > > > I am trying to support for hdmi audio feature on community driver
> > > drivers/gpu/drm/bridge/synopsys/.
> > > > I think the feature may take some time because I am not audio driver
> owner.
> > > I only want to update the others patch as soon as possible, so I
> > > send the patch v5. I am also solving the thread patches properly.
> > >
> > > Sorry you have not!
> > >
> > > In my inbox, v5 1/2 and 2/2 do not appear as a single thread
> > >
> > > Please fix the way you send the series and send them together, it is
> > > very difficult to review when they are disjoint
> > >
> > > FWIW, I checked the v5 2/2 and it does not have in-reply-to set,
> > > which should point to 1/2.. If you are using git send-email, point
> > > both the patches to it so that it will do that correctly for you
> > I am very sorry. I find the root cause that the patch not appear as a
> > single thread. I use the git send-mail to send separately. I also know the
> patchwork can check it.
> 
> No, please point the whole series to git send-email
> 
> For example:
> $ mkdir temp; cd temp
> $ git format-patch -2 --cover-letter -v <patch version> $ <update cover letter>
> $ <run checkpatch etc and verify patches are in order> $ git send-email *
> 
> That should do it for you!
Thanks Vinod! I also consulted my colleagues. I am sorry for using separately git send-mail to send
patch cause patch disjoint.
BR
Joy Zou
> 
> > I'm so sorry to waste your time and effort. I am very grateful to your
> comments.
> > I will change next patch.
> > BR
> > Joy Zou
> >
> > >
> > > --
> > > ~Vinod
> 
> --
> ~Vinod
diff mbox series

Patch

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index fbea5f62dd98..ab877ceeac3f 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -954,7 +954,10 @@  static irqreturn_t sdma_int_handler(int irq, void *dev_id)
 		desc = sdmac->desc;
 		if (desc) {
 			if (sdmac->flags & IMX_DMA_SG_LOOP) {
-				sdma_update_channel_loop(sdmac);
+				if (sdmac->peripheral_type != IMX_DMATYPE_HDMI)
+					sdma_update_channel_loop(sdmac);
+				else
+					vchan_cyclic_callback(&desc->vd);
 			} else {
 				mxc_sdma_handle_channel_normal(sdmac);
 				vchan_cookie_complete(&desc->vd);
@@ -1074,6 +1077,10 @@  static int sdma_get_pc(struct sdma_channel *sdmac,
 		per_2_emi = sdma->script_addrs->sai_2_mcu_addr;
 		emi_2_per = sdma->script_addrs->mcu_2_sai_addr;
 		break;
+	case IMX_DMATYPE_HDMI:
+		emi_2_per = sdma->script_addrs->hdmi_dma_addr;
+		sdmac->is_ram_script = true;
+		break;
 	default:
 		dev_err(sdma->dev, "Unsupported transfer type %d\n",
 			peripheral_type);
@@ -1125,11 +1132,16 @@  static int sdma_load_context(struct sdma_channel *sdmac)
 	/* Send by context the event mask,base address for peripheral
 	 * and watermark level
 	 */
-	context->gReg[0] = sdmac->event_mask[1];
-	context->gReg[1] = sdmac->event_mask[0];
-	context->gReg[2] = sdmac->per_addr;
-	context->gReg[6] = sdmac->shp_addr;
-	context->gReg[7] = sdmac->watermark_level;
+	if (sdmac->peripheral_type == IMX_DMATYPE_HDMI) {
+		context->gReg[4] = sdmac->per_addr;
+		context->gReg[6] = sdmac->shp_addr;
+	} else {
+		context->gReg[0] = sdmac->event_mask[1];
+		context->gReg[1] = sdmac->event_mask[0];
+		context->gReg[2] = sdmac->per_addr;
+		context->gReg[6] = sdmac->shp_addr;
+		context->gReg[7] = sdmac->watermark_level;
+	}
 
 	bd0->mode.command = C0_SETDM;
 	bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
@@ -1513,7 +1525,7 @@  static struct sdma_desc *sdma_transfer_init(struct sdma_channel *sdmac,
 	desc->sdmac = sdmac;
 	desc->num_bd = bds;
 
-	if (sdma_alloc_bd(desc))
+	if (bds && sdma_alloc_bd(desc))
 		goto err_desc_out;
 
 	/* No slave_config called in MEMCPY case, so do here */
@@ -1678,13 +1690,16 @@  static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
 {
 	struct sdma_channel *sdmac = to_sdma_chan(chan);
 	struct sdma_engine *sdma = sdmac->sdma;
-	int num_periods = buf_len / period_len;
+	int num_periods = 0;
 	int channel = sdmac->channel;
 	int i = 0, buf = 0;
 	struct sdma_desc *desc;
 
 	dev_dbg(sdma->dev, "%s channel: %d\n", __func__, channel);
 
+	if (sdmac->peripheral_type != IMX_DMATYPE_HDMI)
+		num_periods = buf_len / period_len;
+
 	sdma_config_write(chan, &sdmac->slave_config, direction);
 
 	desc = sdma_transfer_init(sdmac, direction, num_periods);
@@ -1701,6 +1716,9 @@  static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
 		goto err_bd_out;
 	}
 
+	if (sdmac->peripheral_type == IMX_DMATYPE_HDMI)
+		return vchan_tx_prep(&sdmac->vc, &desc->vd, flags);
+
 	while (buf < buf_len) {
 		struct sdma_buffer_descriptor *bd = &desc->bd[i];
 		int param;
@@ -1761,6 +1779,10 @@  static int sdma_config_write(struct dma_chan *chan,
 		sdmac->watermark_level |= (dmaengine_cfg->dst_maxburst << 16) &
 			SDMA_WATERMARK_LEVEL_HWML;
 		sdmac->word_size = dmaengine_cfg->dst_addr_width;
+	} else if (sdmac->peripheral_type == IMX_DMATYPE_HDMI) {
+		sdmac->per_address = dmaengine_cfg->dst_addr;
+		sdmac->per_address2 = dmaengine_cfg->src_addr;
+		sdmac->watermark_level = 0;
 	} else {
 		sdmac->per_address = dmaengine_cfg->dst_addr;
 		sdmac->watermark_level = dmaengine_cfg->dst_maxburst *
diff --git a/include/linux/dma/imx-dma.h b/include/linux/dma/imx-dma.h
index f487a4fa103a..cfec5f946e23 100644
--- a/include/linux/dma/imx-dma.h
+++ b/include/linux/dma/imx-dma.h
@@ -40,6 +40,7 @@  enum sdma_peripheral_type {
 	IMX_DMATYPE_ASRC_SP,	/* Shared ASRC */
 	IMX_DMATYPE_SAI,	/* SAI */
 	IMX_DMATYPE_MULTI_SAI,	/* MULTI FIFOs For Audio */
+	IMX_DMATYPE_HDMI,       /* HDMI Audio */
 };
 
 enum imx_dma_prio {