From: CK Hu <ck.hu@mediatek.com>
To: Jitao Shi <jitao.shi@mediatek.com>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
linux-pwm@vger.kernel.org, David Airlie <airlied@linux.ie>,
Matthias Brugger <matthias.bgg@gmail.com>,
Thierry Reding <treding@nvidia.com>,
Ajay Kumar <ajaykumar.rs@samsung.com>,
Inki Dae <inki.dae@samsung.com>,
Rahul Sharma <rahul.sharma@samsung.com>,
Sean Paul <seanpaul@chromium.org>,
Vincent Palatin <vpalatin@chromium.org>,
Andy Yan <andy.yan@rock-chips.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Russell King <rmk+kernel@arm.linux.org.uk>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org, linux-media
Subject: Re: [PATCH] drm/mediatek: add dsi module reset driver
Date: Fri, 31 May 2019 09:50:52 +0800 [thread overview]
Message-ID: <1559267452.9102.0.camel@mtksdaap41> (raw)
In-Reply-To: <20190519111513.73919-1-jitao.shi@mediatek.com>
Hi, Jitao:
On Sun, 2019-05-19 at 19:15 +0800, Jitao Shi wrote:
> Reset dsi HW to default when power on. Prevent the setting differet
> between bootloader and kernel.
>
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dsi.c | 35 ++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index b00eb2d2e086..39ccb34a7c7f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -21,10 +21,12 @@
> #include <linux/component.h>
> #include <linux/iopoll.h>
> #include <linux/irq.h>
> +#include <linux/mfd/syscon.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> +#include <linux/regmap.h>
> #include <video/mipi_display.h>
> #include <video/videomode.h>
>
> @@ -146,6 +148,8 @@
> #define T_HS_EXIT 7
> #define T_HS_ZERO 10
>
> +#define MMSYS_SW_RST_DSI_B BIT(25)
> +
> #define NS_TO_CYCLE(n, c) ((n) / (c) + (((n) % (c)) ? 1 : 0))
>
> #define MTK_DSI_HOST_IS_READ(type) \
> @@ -165,6 +169,8 @@ struct mtk_dsi {
> struct drm_panel *panel;
> struct drm_bridge *bridge;
> struct phy *phy;
> + struct regmap *mmsys_sw_rst_b;
> + u32 sw_rst_b;
>
> void __iomem *regs;
>
> @@ -238,6 +244,16 @@ static void mtk_dsi_disable(struct mtk_dsi *dsi)
> mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, 0);
> }
>
> +static void mtk_dsi_reset_all(struct mtk_dsi *dsi)
> +{
> + regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
> + MMSYS_SW_RST_DSI_B, ~MMSYS_SW_RST_DSI_B);
> + usleep_range(1000, 1100);
> +
> + regmap_update_bits(dsi->mmsys_sw_rst_b, dsi->sw_rst_b,
> + MMSYS_SW_RST_DSI_B, MMSYS_SW_RST_DSI_B);
> +}
> +
> static void mtk_dsi_reset_engine(struct mtk_dsi *dsi)
> {
> mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, DSI_RESET);
> @@ -831,6 +847,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
> goto err_encoder_cleanup;
> }
>
> + mtk_dsi_reset_all(dsi);
> +
> return 0;
>
> err_encoder_cleanup:
> @@ -1087,6 +1105,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
> struct mtk_dsi *dsi;
> struct device *dev = &pdev->dev;
> struct resource *regs;
> + struct regmap *regmap;
> int irq_num;
> int comp_id;
> int ret;
> @@ -1139,6 +1158,22 @@ static int mtk_dsi_probe(struct platform_device *pdev)
> return ret;
> }
>
> + regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
> + "mediatek,syscon-dsi");
Where is the binding document for "mediatek,syscon-dsi"?
Regards,
CK
> + ret = of_property_read_u32_index(dev->of_node, "mediatek,syscon-dsi", 1,
> + &dsi->sw_rst_b);
> +
> + if (IS_ERR(regmap))
> + ret = PTR_ERR(regmap);
> +
> + if (ret) {
> + ret = PTR_ERR(regmap);
> + dev_err(dev, "Failed to get mmsys registers: %d\n", ret);
> + return ret;
> + }
> +
> + dsi->mmsys_sw_rst_b = regmap;
> +
> comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DSI);
> if (comp_id < 0) {
> dev_err(dev, "Failed to identify by alias: %d\n", comp_id);
prev parent reply other threads:[~2019-05-31 1:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-19 11:15 [PATCH] drm/mediatek: add dsi module reset driver Jitao Shi
2019-05-19 17:48 ` kbuild test robot
2019-05-31 1:50 ` 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=1559267452.9102.0.camel@mtksdaap41 \
--to=ck.hu@mediatek.com \
--cc=airlied@linux.ie \
--cc=ajaykumar.rs@samsung.com \
--cc=andy.yan@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=inki.dae@samsung.com \
--cc=jitao.shi@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=pawel.moll@arm.com \
--cc=rahul.sharma@samsung.com \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=robh+dt@kernel.org \
--cc=seanpaul@chromium.org \
--cc=treding@nvidia.com \
--cc=vpalatin@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).