lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 31 May 2019 09:50:52 +0800
From:   CK Hu <ck.hu@...iatek.com>
To:     Jitao Shi <jitao.shi@...iatek.com>
CC:     Rob Herring <robh+dt@...nel.org>, Pawel Moll <pawel.moll@....com>,
        "Mark Rutland" <mark.rutland@....com>,
        Ian Campbell <ijc+devicetree@...lion.org.uk>,
        <linux-pwm@...r.kernel.org>, David Airlie <airlied@...ux.ie>,
        Matthias Brugger <matthias.bgg@...il.com>,
        "Thierry Reding" <treding@...dia.com>,
        Ajay Kumar <ajaykumar.rs@...sung.com>,
        "Inki Dae" <inki.dae@...sung.com>,
        Rahul Sharma <rahul.sharma@...sung.com>,
        "Sean Paul" <seanpaul@...omium.org>,
        Vincent Palatin <vpalatin@...omium.org>,
        "Andy Yan" <andy.yan@...k-chips.com>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Russell King <rmk+kernel@....linux.org.uk>,
        <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <dri-devel@...ts.freedesktop.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>,
        <srv_heupstream@...iatek.com>,
        Sascha Hauer <kernel@...gutronix.de>,
        <yingjoe.chen@...iatek.com>, <eddie.huang@...iatek.com>,
        <cawa.cheng@...iatek.com>, <bibby.hsieh@...iatek.com>,
        <stonea168@....com>
Subject: Re: [PATCH] drm/mediatek: add dsi module reset driver

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@...iatek.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);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ