All of lore.kernel.org
 help / color / mirror / Atom feed
From: CK Hu <ck.hu@mediatek.com>
To: HS Liao <hs.liao@mediatek.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com,
	Sascha Hauer <kernel@pengutronix.de>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Nicolas Boichat <drinkcat@chromium.org>,
	cawa cheng <cawa.cheng@mediatek.com>,
	Bibby Hsieh <bibby.hsieh@mediatek.com>,
	YT Shen <yt.shen@mediatek.com>,
	Daoyuan Huang <daoyuan.huang@mediatek.com>,
	Damon Chu <damon.chu@mediatek.com>,
	Josh-YC Liu <josh-yc.liu@mediatek.com>,
	Glory Hung <glory.hung@mediatek.co>
Subject: Re: [PATCH v14 2/4] CMDQ: Mediatek CMDQ driver
Date: Fri, 30 Sep 2016 11:06:18 +0800	[thread overview]
Message-ID: <1475204778.13398.28.camel@mtksdaap41> (raw)
In-Reply-To: <1473039885-24009-3-git-send-email-hs.liao@mediatek.com>

Hi, HS:

On Mon, 2016-09-05 at 09:44 +0800, HS Liao wrote:
> This patch is first version of Mediatek Command Queue(CMDQ) driver. The
> CMDQ is used to help write registers with critical time limitation,
> such as updating display configuration during the vblank. It controls
> Global Command Engine (GCE) hardware to achieve this requirement.
> Currently, CMDQ only supports display related hardwares, but we expect
> it can be extended to other hardwares for future requirements.
> 
> Signed-off-by: HS Liao <hs.liao@mediatek.com>
> Signed-off-by: CK Hu <ck.hu@mediatek.com>
> ---

[snip...]

> +
> +struct cmdq_task {
> +	struct cmdq		*cmdq;
> +	struct list_head	list_entry;
> +	void			*va_base;
> +	dma_addr_t		pa_base;
> +	size_t			cmd_buf_size; /* command occupied size */
> +	size_t			buf_size; /* real buffer size */
> +	bool			finalized;
> +	struct cmdq_thread	*thread;

I think thread info could be removed from cmdq_task. Only
cmdq_task_handle_error() and cmdq_task_insert_into_thread() use
task->thread and caller of both function has the thread info. So you
could just pass thread info into these two function and remove thread
info in cmdq_task.

> +	struct cmdq_task_cb	cb;

I think this callback function is equal to mailbox client tx_done
callback. It's better to use already-defined interface rather than
creating your own.

> +};
> +

[snip...]

> +
> +static int cmdq_suspend(struct device *dev)
> +{
> +	struct cmdq *cmdq = dev_get_drvdata(dev);
> +	struct cmdq_thread *thread;
> +	int i;
> +	bool task_running = false;
> +
> +	mutex_lock(&cmdq->task_mutex);
> +	cmdq->suspended = true;
> +	mutex_unlock(&cmdq->task_mutex);
> +
> +	for (i = 0; i < ARRAY_SIZE(cmdq->thread); i++) {
> +		thread = &cmdq->thread[i];
> +		if (!list_empty(&thread->task_busy_list)) {
> +			mod_timer(&thread->timeout, jiffies + 1);
> +			task_running = true;
> +		}
> +	}
> +
> +	if (task_running) {
> +		dev_warn(dev, "exist running task(s) in suspend\n");
> +		msleep(20);

Why sleep here? It looks like a recovery but could 20ms recovery
something? I think warning message is enough because you see the warning
message, and you fix the bug, so no need to recovery anything.

> +	}
> +
> +	clk_unprepare(cmdq->clock);
> +	return 0;
> +}
> +

Regards,
CK

WARNING: multiple messages have this Message-ID (diff)
From: ck.hu@mediatek.com (CK Hu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v14 2/4] CMDQ: Mediatek CMDQ driver
Date: Fri, 30 Sep 2016 11:06:18 +0800	[thread overview]
Message-ID: <1475204778.13398.28.camel@mtksdaap41> (raw)
In-Reply-To: <1473039885-24009-3-git-send-email-hs.liao@mediatek.com>

Hi, HS:

On Mon, 2016-09-05 at 09:44 +0800, HS Liao wrote:
> This patch is first version of Mediatek Command Queue(CMDQ) driver. The
> CMDQ is used to help write registers with critical time limitation,
> such as updating display configuration during the vblank. It controls
> Global Command Engine (GCE) hardware to achieve this requirement.
> Currently, CMDQ only supports display related hardwares, but we expect
> it can be extended to other hardwares for future requirements.
> 
> Signed-off-by: HS Liao <hs.liao@mediatek.com>
> Signed-off-by: CK Hu <ck.hu@mediatek.com>
> ---

[snip...]

> +
> +struct cmdq_task {
> +	struct cmdq		*cmdq;
> +	struct list_head	list_entry;
> +	void			*va_base;
> +	dma_addr_t		pa_base;
> +	size_t			cmd_buf_size; /* command occupied size */
> +	size_t			buf_size; /* real buffer size */
> +	bool			finalized;
> +	struct cmdq_thread	*thread;

I think thread info could be removed from cmdq_task. Only
cmdq_task_handle_error() and cmdq_task_insert_into_thread() use
task->thread and caller of both function has the thread info. So you
could just pass thread info into these two function and remove thread
info in cmdq_task.

> +	struct cmdq_task_cb	cb;

I think this callback function is equal to mailbox client tx_done
callback. It's better to use already-defined interface rather than
creating your own.

> +};
> +

[snip...]

> +
> +static int cmdq_suspend(struct device *dev)
> +{
> +	struct cmdq *cmdq = dev_get_drvdata(dev);
> +	struct cmdq_thread *thread;
> +	int i;
> +	bool task_running = false;
> +
> +	mutex_lock(&cmdq->task_mutex);
> +	cmdq->suspended = true;
> +	mutex_unlock(&cmdq->task_mutex);
> +
> +	for (i = 0; i < ARRAY_SIZE(cmdq->thread); i++) {
> +		thread = &cmdq->thread[i];
> +		if (!list_empty(&thread->task_busy_list)) {
> +			mod_timer(&thread->timeout, jiffies + 1);
> +			task_running = true;
> +		}
> +	}
> +
> +	if (task_running) {
> +		dev_warn(dev, "exist running task(s) in suspend\n");
> +		msleep(20);

Why sleep here? It looks like a recovery but could 20ms recovery
something? I think warning message is enough because you see the warning
message, and you fix the bug, so no need to recovery anything.

> +	}
> +
> +	clk_unprepare(cmdq->clock);
> +	return 0;
> +}
> +

Regards,
CK

WARNING: multiple messages have this Message-ID (diff)
From: CK Hu <ck.hu@mediatek.com>
To: HS Liao <hs.liao@mediatek.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	"Daniel Kurtz" <djkurtz@chromium.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<srv_heupstream@mediatek.com>,
	Sascha Hauer <kernel@pengutronix.de>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	Nicolas Boichat <drinkcat@chromium.org>,
	cawa cheng <cawa.cheng@mediatek.com>,
	Bibby Hsieh <bibby.hsieh@mediatek.com>,
	YT Shen <yt.shen@mediatek.com>,
	Daoyuan Huang <daoyuan.huang@mediatek.com>,
	Damon Chu <damon.chu@mediatek.com>,
	"Josh-YC Liu" <josh-yc.liu@mediatek.com>,
	Glory Hung <glory.hung@mediatek.com>,
	Jiaguang Zhang <jiaguang.zhang@mediatek.com>,
	Dennis-YC Hsieh <dennis-yc.hsieh@mediatek.com>,
	Monica Wang <monica.wang@mediatek.com>
Subject: Re: [PATCH v14 2/4] CMDQ: Mediatek CMDQ driver
Date: Fri, 30 Sep 2016 11:06:18 +0800	[thread overview]
Message-ID: <1475204778.13398.28.camel@mtksdaap41> (raw)
In-Reply-To: <1473039885-24009-3-git-send-email-hs.liao@mediatek.com>

Hi, HS:

On Mon, 2016-09-05 at 09:44 +0800, HS Liao wrote:
> This patch is first version of Mediatek Command Queue(CMDQ) driver. The
> CMDQ is used to help write registers with critical time limitation,
> such as updating display configuration during the vblank. It controls
> Global Command Engine (GCE) hardware to achieve this requirement.
> Currently, CMDQ only supports display related hardwares, but we expect
> it can be extended to other hardwares for future requirements.
> 
> Signed-off-by: HS Liao <hs.liao@mediatek.com>
> Signed-off-by: CK Hu <ck.hu@mediatek.com>
> ---

[snip...]

> +
> +struct cmdq_task {
> +	struct cmdq		*cmdq;
> +	struct list_head	list_entry;
> +	void			*va_base;
> +	dma_addr_t		pa_base;
> +	size_t			cmd_buf_size; /* command occupied size */
> +	size_t			buf_size; /* real buffer size */
> +	bool			finalized;
> +	struct cmdq_thread	*thread;

I think thread info could be removed from cmdq_task. Only
cmdq_task_handle_error() and cmdq_task_insert_into_thread() use
task->thread and caller of both function has the thread info. So you
could just pass thread info into these two function and remove thread
info in cmdq_task.

> +	struct cmdq_task_cb	cb;

I think this callback function is equal to mailbox client tx_done
callback. It's better to use already-defined interface rather than
creating your own.

> +};
> +

[snip...]

> +
> +static int cmdq_suspend(struct device *dev)
> +{
> +	struct cmdq *cmdq = dev_get_drvdata(dev);
> +	struct cmdq_thread *thread;
> +	int i;
> +	bool task_running = false;
> +
> +	mutex_lock(&cmdq->task_mutex);
> +	cmdq->suspended = true;
> +	mutex_unlock(&cmdq->task_mutex);
> +
> +	for (i = 0; i < ARRAY_SIZE(cmdq->thread); i++) {
> +		thread = &cmdq->thread[i];
> +		if (!list_empty(&thread->task_busy_list)) {
> +			mod_timer(&thread->timeout, jiffies + 1);
> +			task_running = true;
> +		}
> +	}
> +
> +	if (task_running) {
> +		dev_warn(dev, "exist running task(s) in suspend\n");
> +		msleep(20);

Why sleep here? It looks like a recovery but could 20ms recovery
something? I think warning message is enough because you see the warning
message, and you fix the bug, so no need to recovery anything.

> +	}
> +
> +	clk_unprepare(cmdq->clock);
> +	return 0;
> +}
> +

Regards,
CK

  parent reply	other threads:[~2016-09-30  3:06 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05  1:44 [PATCH v14 0/4] Mediatek MT8173 CMDQ support HS Liao
2016-09-05  1:44 ` HS Liao
2016-09-05  1:44 ` HS Liao
2016-09-05  1:44 ` [PATCH v14 1/4] dt-bindings: soc: Add documentation for the MediaTek GCE unit HS Liao
2016-09-05  1:44   ` HS Liao
2016-09-05  1:44   ` HS Liao
2016-09-05  1:44 ` [PATCH v14 2/4] CMDQ: Mediatek CMDQ driver HS Liao
2016-09-05  1:44   ` HS Liao
2016-09-05  1:44   ` HS Liao
2016-09-22  8:17   ` Jassi Brar
2016-09-22  8:17     ` Jassi Brar
2016-09-22  8:17     ` Jassi Brar
2016-09-23  9:28     ` Horng-Shyang Liao
2016-09-23  9:28       ` Horng-Shyang Liao
2016-09-23  9:28       ` Horng-Shyang Liao
2016-09-30  8:56       ` Horng-Shyang Liao
2016-09-30  8:56         ` Horng-Shyang Liao
2016-09-30  8:56         ` Horng-Shyang Liao
2016-09-30  3:06   ` CK Hu [this message]
2016-09-30  3:06     ` CK Hu
2016-09-30  3:06     ` CK Hu
2016-09-30  8:56     ` Horng-Shyang Liao
2016-09-30  8:56       ` Horng-Shyang Liao
2016-09-30  8:56       ` Horng-Shyang Liao
2016-09-30  9:11       ` CK Hu
2016-09-30  9:11         ` CK Hu
2016-09-30  9:11         ` CK Hu
2016-09-30  9:47         ` Horng-Shyang Liao
2016-09-30  9:47           ` Horng-Shyang Liao
2016-09-30  9:47           ` Horng-Shyang Liao
2016-10-05  2:54           ` Horng-Shyang Liao
2016-10-05  2:54             ` Horng-Shyang Liao
2016-10-05  2:54             ` Horng-Shyang Liao
2016-10-05  3:37             ` Jassi Brar
2016-10-05  3:37               ` Jassi Brar
2016-10-05  3:37               ` Jassi Brar
2016-10-05 12:31               ` Horng-Shyang Liao
2016-10-05 12:31                 ` Horng-Shyang Liao
2016-10-05 12:31                 ` Horng-Shyang Liao
2016-10-05 14:43                 ` Jassi Brar
2016-10-05 14:43                   ` Jassi Brar
2016-10-05 14:43                   ` Jassi Brar
2016-10-06 13:01                   ` Horng-Shyang Liao
2016-10-06 13:01                     ` Horng-Shyang Liao
2016-10-06 13:01                     ` Horng-Shyang Liao
2016-10-06 13:10                     ` Jassi Brar
2016-10-06 13:10                       ` Jassi Brar
2016-10-06 13:10                       ` Jassi Brar
     [not found]                       ` <CAJe_ZheptRQSmQp2gagqUyXqkOpi1qaTo8QPDTFpQ-+62B6kUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-11  2:40                         ` Horng-Shyang Liao
2016-10-11  2:40                           ` Horng-Shyang Liao
2016-10-11  2:40                           ` Horng-Shyang Liao
2016-10-11  4:19                           ` Jassi Brar
2016-10-11  4:19                             ` Jassi Brar
2016-10-11  4:19                             ` Jassi Brar
     [not found] ` <1473039885-24009-1-git-send-email-hs.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-09-05  1:44   ` [PATCH v14 3/4] arm64: dts: mt8173: Add GCE node HS Liao
2016-09-05  1:44     ` HS Liao
2016-09-05  1:44     ` HS Liao
2016-09-05  1:44   ` [PATCH v14 4/4] CMDQ: save more energy in idle HS Liao
2016-09-05  1:44     ` HS Liao
2016-09-05  1:44     ` HS Liao
     [not found]     ` <1473039885-24009-5-git-send-email-hs.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-09-22  7:52       ` Jassi Brar
2016-09-22  7:52         ` Jassi Brar
2016-09-22  7:52         ` Jassi Brar
2016-09-23  9:28         ` Horng-Shyang Liao
2016-09-23  9:28           ` Horng-Shyang Liao
2016-09-23  9:28           ` Horng-Shyang Liao
2016-09-30  8:56           ` Horng-Shyang Liao
2016-09-30  8:56             ` Horng-Shyang Liao
2016-09-30  8:56             ` Horng-Shyang Liao
2016-09-30  9:01             ` Matthias Brugger
2016-09-30  9:01               ` Matthias Brugger
2016-09-30  9:01               ` Matthias Brugger
2016-09-19  6:43   ` [PATCH v14 0/4] Mediatek MT8173 CMDQ support Horng-Shyang Liao
2016-09-19  6:43     ` Horng-Shyang Liao
2016-09-19  6:43     ` Horng-Shyang Liao

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=1475204778.13398.28.camel@mtksdaap41 \
    --to=ck.hu@mediatek.com \
    --cc=bibby.hsieh@mediatek.com \
    --cc=cawa.cheng@mediatek.com \
    --cc=damon.chu@mediatek.com \
    --cc=daoyuan.huang@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=djkurtz@chromium.org \
    --cc=drinkcat@chromium.org \
    --cc=glory.hung@mediatek.co \
    --cc=hs.liao@mediatek.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=josh-yc.liu@mediatek.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=srv_heupstream@mediatek.com \
    --cc=yt.shen@mediatek.com \
    /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.