All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org, linux-mips@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	od@zcrc.me
Subject: Re: [PATCH v2 06/10] drm/ingenic: Set DMA descriptor chain address in probe
Date: Tue, 30 Jun 2020 13:54:51 +0200	[thread overview]
Message-ID: <FFMQCQ.LQ37IHUC6U3Z@crapouillou.net> (raw)
In-Reply-To: <20200630114453.GB560155@ravnborg.org>

Hi Sam,

Le mar. 30 juin 2020 à 13:44, Sam Ravnborg <sam@ravnborg.org> a écrit 
:
> Hi Paul.
> 
> On Tue, Jun 30, 2020 at 01:52:06AM +0200, Paul Cercueil wrote:
>>  The address of the DMA descriptor never changes. It can therefore 
>> be set
>>  in the probe function.
>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  ---
>> 
>>  Notes:
>>      v2: No change
>> 
>>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  index 924c8daf071a..f7b0c5dc8cd8 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  @@ -358,8 +358,6 @@ static void 
>> ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc,
>>   		ingenic_drm_crtc_update_ctrl(priv, finfo);
>> 
>>   		clk_set_rate(priv->pix_clk, state->adjusted_mode.clock * 1000);
>>  -
>>  -		regmap_write(priv->map, JZ_REG_LCD_DA0, priv->dma_hwdesc->next);
>>   	}
>> 
>>   	if (event) {
>>  @@ -757,6 +755,9 @@ static int ingenic_drm_probe(struct 
>> platform_device *pdev)
>>   		}
>>   	}
>> 
>>  +	/* Set address of our DMA descriptor chain */
>>  +	regmap_write(priv->map, JZ_REG_LCD_DA0, priv->dma_hwdesc_phys);
>>  +
> 
> 
> What is the purpose of this code after the assignment was moved:
> 
> static int ingenic_drm_probe(struct platform_device *pdev)
> {
> ...
> 	priv->dma_hwdesc->next = priv->dma_hwdesc_phys;
> 
> I do not see ->next used anymore.
> Could this assignment be dropped?
> 
> 
> And the following line:
> 	priv->dma_hwdesc->id = 0xdeafbead;
> 
> I can only see ->id be assingned, it is never referenced??
> 
> Maybe this is all related to the structure assumed by the data pointed
> to by JZ_REG_LCD_DA0?

As its name suggests, 'dma_hwdesc' points to a DMA hardware descriptor. 
Setting ->next sets the address of the next descriptor (which is itself 
since we only use one descriptor). The 'id' field will be copied by the 
hardware to a register when the DMA descriptor is loaded, so we can 
know from userspace (debugfs) what DMA descriptors are loaded by 
looking up the IDs.

-Paul

> 	Sam
> 
>>   	ret = drm_dev_register(drm, 0);
>>   	if (ret) {
>>   		dev_err(dev, "Failed to register DRM driver\n");
>>  --
>>  2.27.0
>> 
>>  _______________________________________________
>>  dri-devel mailing list
>>  dri-devel@lists.freedesktop.org
>>  https://lists.freedesktop.org/mailman/listinfo/dri-devel



WARNING: multiple messages have this Message-ID (diff)
From: Paul Cercueil <paul@crapouillou.net>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: devicetree@vger.kernel.org, od@zcrc.me,
	David Airlie <airlied@linux.ie>,
	linux-mips@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH v2 06/10] drm/ingenic: Set DMA descriptor chain address in probe
Date: Tue, 30 Jun 2020 13:54:51 +0200	[thread overview]
Message-ID: <FFMQCQ.LQ37IHUC6U3Z@crapouillou.net> (raw)
In-Reply-To: <20200630114453.GB560155@ravnborg.org>

Hi Sam,

Le mar. 30 juin 2020 à 13:44, Sam Ravnborg <sam@ravnborg.org> a écrit 
:
> Hi Paul.
> 
> On Tue, Jun 30, 2020 at 01:52:06AM +0200, Paul Cercueil wrote:
>>  The address of the DMA descriptor never changes. It can therefore 
>> be set
>>  in the probe function.
>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  ---
>> 
>>  Notes:
>>      v2: No change
>> 
>>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  index 924c8daf071a..f7b0c5dc8cd8 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  @@ -358,8 +358,6 @@ static void 
>> ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc,
>>   		ingenic_drm_crtc_update_ctrl(priv, finfo);
>> 
>>   		clk_set_rate(priv->pix_clk, state->adjusted_mode.clock * 1000);
>>  -
>>  -		regmap_write(priv->map, JZ_REG_LCD_DA0, priv->dma_hwdesc->next);
>>   	}
>> 
>>   	if (event) {
>>  @@ -757,6 +755,9 @@ static int ingenic_drm_probe(struct 
>> platform_device *pdev)
>>   		}
>>   	}
>> 
>>  +	/* Set address of our DMA descriptor chain */
>>  +	regmap_write(priv->map, JZ_REG_LCD_DA0, priv->dma_hwdesc_phys);
>>  +
> 
> 
> What is the purpose of this code after the assignment was moved:
> 
> static int ingenic_drm_probe(struct platform_device *pdev)
> {
> ...
> 	priv->dma_hwdesc->next = priv->dma_hwdesc_phys;
> 
> I do not see ->next used anymore.
> Could this assignment be dropped?
> 
> 
> And the following line:
> 	priv->dma_hwdesc->id = 0xdeafbead;
> 
> I can only see ->id be assingned, it is never referenced??
> 
> Maybe this is all related to the structure assumed by the data pointed
> to by JZ_REG_LCD_DA0?

As its name suggests, 'dma_hwdesc' points to a DMA hardware descriptor. 
Setting ->next sets the address of the next descriptor (which is itself 
since we only use one descriptor). The 'id' field will be copied by the 
hardware to a register when the DMA descriptor is loaded, so we can 
know from userspace (debugfs) what DMA descriptors are loaded by 
looking up the IDs.

-Paul

> 	Sam
> 
>>   	ret = drm_dev_register(drm, 0);
>>   	if (ret) {
>>   		dev_err(dev, "Failed to register DRM driver\n");
>>  --
>>  2.27.0
>> 
>>  _______________________________________________
>>  dri-devel mailing list
>>  dri-devel@lists.freedesktop.org
>>  https://lists.freedesktop.org/mailman/listinfo/dri-devel


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-06-30 11:55 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 23:52 [PATCH v2 01/10] dt-bindings: display: Convert ingenic,lcd.txt to YAML Paul Cercueil
2020-06-29 23:52 ` [PATCH v2 01/10] dt-bindings: display: Convert ingenic, lcd.txt " Paul Cercueil
2020-06-29 23:52 ` [PATCH v2 02/10] dt-bindings: display: Add ingenic,ipu.yaml Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil
2020-06-30 10:08   ` Sam Ravnborg
2020-06-30 10:08     ` Sam Ravnborg
2020-07-14  2:38   ` Rob Herring
2020-07-14  2:38     ` Rob Herring
2020-06-29 23:52 ` [PATCH v2 03/10] drm/ingenic: Rename ingenic-drm.c to ingenic-drm-drv.c Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil
2020-06-30 10:09   ` Sam Ravnborg
2020-06-30 10:09     ` Sam Ravnborg
2020-06-29 23:52 ` [PATCH v2 04/10] drm/ingenic: Add missing CR in debug strings Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil
2020-06-30 10:10   ` Sam Ravnborg
2020-06-30 10:10     ` Sam Ravnborg
2020-06-29 23:52 ` [PATCH v2 05/10] drm/ingenic: Fix incorrect assumption about plane->index Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil
2020-06-30 11:35   ` Sam Ravnborg
2020-06-30 11:35     ` Sam Ravnborg
2020-06-29 23:52 ` [PATCH v2 06/10] drm/ingenic: Set DMA descriptor chain address in probe Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil
2020-06-30 11:44   ` Sam Ravnborg
2020-06-30 11:44     ` Sam Ravnborg
2020-06-30 11:54     ` Paul Cercueil [this message]
2020-06-30 11:54       ` Paul Cercueil
2020-06-29 23:52 ` [PATCH v2 07/10] drm/ingenic: Move register definitions to ingenic-drm.h Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil
2020-06-30 11:46   ` Sam Ravnborg
2020-06-30 11:46     ` Sam Ravnborg
2020-06-29 23:52 ` [PATCH v2 08/10] drm/ingenic: Add support for OSD mode Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil
2020-06-30 12:05   ` Sam Ravnborg
2020-06-30 12:05     ` Sam Ravnborg
2020-06-30 14:39     ` Paul Cercueil
2020-06-30 14:39       ` Paul Cercueil
2020-06-29 23:52 ` [PATCH v2 09/10] drm/ingenic: Add support for the IPU Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil
2020-06-30 12:16   ` Sam Ravnborg
2020-06-30 12:16     ` Sam Ravnborg
2020-06-30 13:33     ` Paul Cercueil
2020-06-30 13:33       ` Paul Cercueil
2020-06-29 23:52 ` [PATCH v2 10/10] drm/ingenic: Support multiple panels/bridges Paul Cercueil
2020-06-29 23:52   ` Paul Cercueil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FFMQCQ.LQ37IHUC6U3Z@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=od@zcrc.me \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.