From: CK Hu <ck.hu@mediatek.com>
To: Julien STEPHAN <jstephan@baylibre.com>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>,
Chun-Kuang Hu <chunkuang.hu@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
"David Airlie" <airlied@linux.ie>,
Daniel Vetter <daniel@ffwll.ch>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"open list:DRM DRIVERS FOR MEDIATEK"
<dri-devel@lists.freedesktop.org>,
"moderated list:DRM DRIVERS FOR MEDIATEK"
<linux-mediatek@lists.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-arm-kernel@lists.infradead.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/mediatek: allow commands to be sent during video mode
Date: Thu, 10 Feb 2022 10:43:28 +0800 [thread overview]
Message-ID: <f2fffc0a7d60d454f1722585f1352823910c30b3.camel@mediatek.com> (raw)
In-Reply-To: <20220124152250.441809-1-jstephan@baylibre.com>
Hi, Julien:
On Mon, 2022-01-24 at 16:22 +0100, Julien STEPHAN wrote:
> When the DSI is in video mode, all commands are rejected.
>
> Detect current DSI mode in mtk_dsi_host_transfer() and switch modes
> temporarily to allow commands to be sent.
Is this patch a bug-fix or new feature? If this is a bug-fix, add Fixes
tag [1] in this patch. If this is a new feature, describe more about
more about this feature, such as support more panel or something.
[1]
https://www.kernel.org/doc/html/v5.16/process/submitting-patches.html
Regards,
CK
>
> Signed-off-by: Julien STEPHAN <jstephan@baylibre.com>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dsi.c | 34 ++++++++++++++++++++++----
> ----
> 1 file changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 5d90d2eb0019..7d66fdc7f81d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -891,24 +891,34 @@ static ssize_t mtk_dsi_host_transfer(struct
> mipi_dsi_host *host,
> u8 read_data[16];
> void *src_addr;
> u8 irq_flag = CMD_DONE_INT_FLAG;
> -
> - if (readl(dsi->regs + DSI_MODE_CTRL) & MODE) {
> - DRM_ERROR("dsi engine is not command mode\n");
> - return -EINVAL;
> + u32 dsi_mode;
> +
> + dsi_mode = readl(dsi->regs + DSI_MODE_CTRL);
> + if (dsi_mode & MODE) {
> + mtk_dsi_stop(dsi);
> + if (mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG,
> 500)) {
> + recv_cnt = -EINVAL;
> + goto restore_dsi_mode;
> + }
> }
>
> if (MTK_DSI_HOST_IS_READ(msg->type))
> irq_flag |= LPRX_RD_RDY_INT_FLAG;
>
> - if (mtk_dsi_host_send_cmd(dsi, msg, irq_flag) < 0)
> - return -ETIME;
> + if (mtk_dsi_host_send_cmd(dsi, msg, irq_flag) < 0) {
> + recv_cnt = -ETIME;
> + goto restore_dsi_mode;
> + }
>
> - if (!MTK_DSI_HOST_IS_READ(msg->type))
> - return 0;
> + if (!MTK_DSI_HOST_IS_READ(msg->type)) {
> + recv_cnt = 0;
> + goto restore_dsi_mode;
> + }
>
> if (!msg->rx_buf) {
> DRM_ERROR("dsi receive buffer size may be NULL\n");
> - return -EINVAL;
> + recv_cnt = -EINVAL;
> + goto restore_dsi_mode;
> }
>
> for (i = 0; i < 16; i++)
> @@ -933,6 +943,12 @@ static ssize_t mtk_dsi_host_transfer(struct
> mipi_dsi_host *host,
> DRM_INFO("dsi get %d byte data from the panel address(0x%x)\n",
> recv_cnt, *((u8 *)(msg->tx_buf)));
>
> +restore_dsi_mode:
> + if (dsi_mode & MODE) {
> + mtk_dsi_set_mode(dsi);
> + mtk_dsi_start(dsi);
> + }
> +
> return recv_cnt;
> }
>
prev parent reply other threads:[~2022-02-10 2:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 15:22 Julien STEPHAN
2022-02-10 2:43 ` CK Hu [this message]
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=f2fffc0a7d60d454f1722585f1352823910c30b3.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=airlied@linux.ie \
--cc=chunkuang.hu@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jstephan@baylibre.com \
--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=mkorpershoek@baylibre.com \
--cc=p.zabel@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®