From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
To: Moudy Ho <moudy.ho@mediatek.com>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
"Jernej Skrabec" <jernej.skrabec@siol.net>,
"Maoguang Meng" <maoguang.meng@mediatek.com>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"daoyuan huang" <daoyuan.huang@mediatek.com>,
"Ping-Hsun Wu" <ping-hsun.wu@mediatek.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Rob Landley" <rob@landley.net>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
linux-media@vger.kernel.org, DTML <devicetree@vger.kernel.org>,
"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
"Tomasz Figa" <tfiga@chromium.org>,
"Nicolas Boichat" <drinkcat@chromium.org>,
acourbot@chromium.org, "Pi-Hsun Shih" <pihsun@chromium.org>,
menghui.lin@mediatek.com,
"Sj Huang (黃信璋)" <sj.huang@mediatek.com>,
ben.lok@mediatek.com, randy.wu@mediatek.com,
srv_heupstream <srv_heupstream@mediatek.com>,
"Frederic Chen (陳俊元)" <frederic.chen@mediatek.com>
Subject: Re: [RFC PATCH V0 01/10] media: mtk-mdp3: Add Mediatek MDP Driver
Date: Wed, 23 Jun 2021 18:41:18 +0800 [thread overview]
Message-ID: <CAAOTY_9dhqYutP3EfNe8tPZ0GTPU04s5zGfyT-As74wLE6Zyrg@mail.gmail.com> (raw)
In-Reply-To: <20210623073549.24170-1-moudy.ho@mediatek.com>
Hi, Moudy:
Moudy Ho <moudy.ho@mediatek.com> 於 2021年6月23日 週三 下午3:46寫道:
>
> From: mtk18742 <moudy.ho@mediatek.com>
>
> Add MDP driver for MT8183
>
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> ---
[snip]
> +
> +#endif // __MMSYS_CONFIG_H__
> diff --git a/drivers/media/platform/mtk-mdp3/mmsys_mutex.h b/drivers/media/platform/mtk-mdp3/mmsys_mutex.h
> new file mode 100644
> index 000000000000..fb8c179f11af
> --- /dev/null
> +++ b/drivers/media/platform/mtk-mdp3/mmsys_mutex.h
> @@ -0,0 +1,35 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (c) 2019 MediaTek Inc.
> + * Author: Ping-Hsun Wu <ping-hsun.wu@mediatek.com>
> + */
> +
> +#ifndef __MMSYS_MUTEX_H__
> +#define __MMSYS_MUTEX_H__
> +
> +#include "mmsys_reg_base.h"
> +#include "mdp-platform.h"
> +
> +#define MM_MUTEX_INTEN 0x00
> +#define MM_MUTEX_INTSTA 0x04
> +#define MM_MUTEX_CFG 0x08
> +
> +#define MM_MUTEX_EN (0x20 + mutex_id * 0x20)
> +#define MM_MUTEX_GET (0x24 + mutex_id * 0x20)
> +#define MM_MUTEX_RST (0x28 + mutex_id * 0x20)
> +#define MM_MUTEX_MOD (MM_MUTEX_MOD_OFFSET + mutex_id * 0x20)
> +#define MM_MUTEX_SOF (MM_MUTEX_SOF_OFFSET + mutex_id * 0x20)
mtk_mutex driver is in drivers/soc/mediatek/mtk-mutex.c, so the
mtk_mutex control should be placed there.
> +
> +// MASK
> +#define MM_MUTEX_INTEN_MASK 0x0fff
> +#define MM_MUTEX_INTSTA_MASK 0x0fff
> +#define MM_MUTEX_DEBUG_OUT_SEL_MASK 0x03
> +#define MM_MUTEX_CFG_MASK 0x01
> +
> +#define MM_MUTEX_EN_MASK 0x01
> +#define MM_MUTEX_GET_MASK 0x03
> +#define MM_MUTEX_RST_MASK 0x01
> +#define MM_MUTEX_MOD_MASK 0x07ffffff
> +#define MM_MUTEX_SOF_MASK 0x0f
> +
[snip]
> +int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param)
> +{
> + struct mdp_cmd cmd;
> + struct mdp_path path;
> + int i, ret;
> +
> + if (atomic_read(&mdp->suspended))
> + return -ECANCELED;
> +
> + atomic_inc(&mdp->job_count);
> +
> + cmd.pkt = cmdq_pkt_create(mdp->cmdq_clt, SZ_16K);
> + if (IS_ERR(cmd.pkt)) {
> + atomic_dec(&mdp->job_count);
> + wake_up(&mdp->callback_wq);
> + return PTR_ERR(cmd.pkt);
> + }
> + cmd.event = &mdp->event[0];
> +
> + path.mdp_dev = mdp;
> + path.config = param->config;
> + path.param = param->param;
> + for (i = 0; i < param->param->num_outputs; i++) {
> + path.bounds[i].left = 0;
> + path.bounds[i].top = 0;
> + path.bounds[i].width =
> + param->param->outputs[i].buffer.format.width;
> + path.bounds[i].height =
> + param->param->outputs[i].buffer.format.height;
> + path.composes[i] = param->composes[i] ?
> + param->composes[i] : &path.bounds[i];
> + }
> + ret = mdp_path_config(mdp, &cmd, &path);
> + if (ret) {
> + atomic_dec(&mdp->job_count);
> + wake_up(&mdp->callback_wq);
> + return ret;
> + }
> +
> + // TODO: engine conflict dispatch
> + for (i = 0; i < param->config->num_components; i++)
> + mdp_comp_clock_on(&mdp->pdev->dev, path.comps[i].comp);
> +
> + if (param->wait) {
> + ret = cmdq_pkt_flush(cmd.pkt);
cmdq_pkt_flush() is removed in latest kernel, please rebase this
series onto latest kernel before you send patches.
Regards,
Chun-Kuang.
> +#ifdef MDP_DEBUG
> + if (ret) {
> + struct mdp_func_struct *p_func = mdp_get_func();
> +
> + p_func->mdp_dump_mmsys_config();
> + mdp_dump_info(~0, 1);
> + }
> +#endif
> + if (param->mdp_ctx)
> + mdp_m2m_job_finish(param->mdp_ctx);
> + cmdq_pkt_destroy(cmd.pkt);
> + for (i = 0; i < param->config->num_components; i++)
> + mdp_comp_clock_off(&mdp->pdev->dev, path.comps[i].comp);
> +
> + atomic_dec(&mdp->job_count);
> + wake_up(&mdp->callback_wq);
> + } else {
> + struct mdp_cmdq_cb_param *cb_param;
> + struct mdp_comp *comps;
> +
> + cb_param = kzalloc(sizeof(*cb_param), GFP_KERNEL);
> + if (!cb_param)
> + return -ENOMEM;
> + comps = kcalloc(param->config->num_components, sizeof(*comps),
> + GFP_KERNEL);
> + if (!comps) {
> + kfree(cb_param);
> + mdp_err("%s:comps alloc fail!\n", __func__);
> + return -ENOMEM;
> + }
> +
> + for (i = 0; i < param->config->num_components; i++)
> + memcpy(&comps[i], path.comps[i].comp,
> + sizeof(struct mdp_comp));
> + cb_param->mdp = mdp;
> + cb_param->user_cmdq_cb = param->cmdq_cb;
> + cb_param->user_cb_data = param->cb_data;
> + cb_param->pkt = cmd.pkt;
> + cb_param->comps = comps;
> + cb_param->num_comps = param->config->num_components;
> + cb_param->mdp_ctx = param->mdp_ctx;
> +
> + ret = cmdq_pkt_flush_async(cmd.pkt,
> + mdp_handle_cmdq_callback,
> + (void *)cb_param);
> + if (ret) {
> + mdp_err("%s:cmdq_pkt_flush_async fail!\n", __func__);
> + kfree(cb_param);
> + kfree(comps);
> + }
> + }
> + return ret;
> +}
> +
> --
> 2.18.0
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2021-06-23 10:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-23 7:35 [RFC PATCH V0 01/10] media: mtk-mdp3: Add Mediatek MDP Driver Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 02/10] media: mtk-mdp3: fix redundant process done caused KE Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 03/10] media: mtk-mdp3: revise suspend strategy Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 04/10] media: mtk-mdp3: add error handling in error return Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 05/10] media: mtk-mdp3: remove unnecessary Null check Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 06/10] media: mtk-mdp3: move clock on to precise place Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 07/10] media: mtk-mdp3: Fix unpaired settings Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 08/10] media: mtk-mdp3: remove illegal device node usage Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 09/10] media: mtk-mdp3: revise error handling about get/probe MDP3 Moudy Ho
2021-06-23 7:35 ` [RFC PATCH V0 10/10] media: mtk-mdp3: Adjust related settings for 5.13-rc1 Moudy Ho
2021-06-23 10:41 ` Chun-Kuang Hu [this message]
2021-07-02 12:00 ` [RFC PATCH V0 01/10] media: mtk-mdp3: Add Mediatek MDP Driver Enric Balletbo Serra
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=CAAOTY_9dhqYutP3EfNe8tPZ0GTPU04s5zGfyT-As74wLE6Zyrg@mail.gmail.com \
--to=chunkuang.hu@kernel.org \
--cc=acourbot@chromium.org \
--cc=ben.lok@mediatek.com \
--cc=daoyuan.huang@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=drinkcat@chromium.org \
--cc=frederic.chen@mediatek.com \
--cc=geert+renesas@glider.be \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jernej.skrabec@siol.net \
--cc=krzk@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=maoguang.meng@mediatek.com \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=menghui.lin@mediatek.com \
--cc=moudy.ho@mediatek.com \
--cc=pihsun@chromium.org \
--cc=ping-hsun.wu@mediatek.com \
--cc=randy.wu@mediatek.com \
--cc=rob@landley.net \
--cc=robh+dt@kernel.org \
--cc=sj.huang@mediatek.com \
--cc=srv_heupstream@mediatek.com \
--cc=tfiga@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).