Re: [PATCH v13 6/6] drm/mediatek: set dpi pin mode to gpio low to avoid leakage current

2020-03-11 Thread Chun-Kuang Hu
Jitao Shi  於 2020年3月11日 週三 下午3:19寫道:

> Config dpi pins mode to output and pull low when dpi is disabled.
> Aovid leakage current from some dpi pins (Hsync Vsync DE ... ).
>
>
Reviewed-by: Chun-Kuang Hu 


> Signed-off-by: Jitao Shi 
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 31 ++
>  1 file changed, 31 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 2871e68e7767..b6359e979588 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -10,7 +10,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -74,6 +76,9 @@ struct mtk_dpi {
> enum mtk_dpi_out_yc_map yc_map;
> enum mtk_dpi_out_bit_num bit_num;
> enum mtk_dpi_out_channel_swap channel_swap;
> +   struct pinctrl *pinctrl;
> +   struct pinctrl_state *pins_gpio;
> +   struct pinctrl_state *pins_dpi;
> int refcount;
> u32 pclk_sample;
>  };
> @@ -387,6 +392,9 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> if (--dpi->refcount != 0)
> return;
>
> +   if (dpi->pinctrl && dpi->pins_gpio)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> +
> mtk_dpi_disable(dpi);
> clk_disable_unprepare(dpi->pixel_clk);
> clk_disable_unprepare(dpi->engine_clk);
> @@ -411,6 +419,9 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
> goto err_pixel;
> }
>
> +   if (dpi->pinctrl && dpi->pins_dpi)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
> +
> mtk_dpi_enable(dpi);
> return 0;
>
> @@ -728,6 +739,26 @@ static int mtk_dpi_probe(struct platform_device *pdev)
> of_property_read_u32(ep, "pclk-sample", >pclk_sample);
> of_node_put(ep);
>
> +   dpi->pinctrl = devm_pinctrl_get(>dev);
> +   if (IS_ERR(dpi->pinctrl)) {
> +   dpi->pinctrl = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl!\n");
> +   }
> +   if (dpi->pinctrl) {
> +   dpi->pins_gpio = pinctrl_lookup_state(dpi->pinctrl,
> "sleep");
> +   if (IS_ERR(dpi->pins_gpio)) {
> +   dpi->pins_gpio = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl idle!\n");
> +   }
> +   if (dpi->pins_gpio)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> +
> +   dpi->pins_dpi = pinctrl_lookup_state(dpi->pinctrl,
> "default");
> +   if (IS_ERR(dpi->pins_dpi)) {
> +   dpi->pins_dpi = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl
> active!\n");
> +   }
> +   }
> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> dpi->regs = devm_ioremap_resource(dev, mem);
> if (IS_ERR(dpi->regs)) {
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v13 2/6] dt-bindings: display: mediatek: control dpi pins mode to avoid leakage

2020-03-11 Thread Chun-Kuang Hu
Jitao Shi  於 2020年3月11日 週三 下午3:18寫道:

> Add property "pinctrl-names" to swap pin mode between gpio and dpi mode.
> Set
> the dpi pins to gpio mode and output-low to avoid leakage current when dpi
> disabled.
>

Reviewed-by: Chun-Kuang Hu 


>
> Signed-off-by: Jitao Shi 
> ---
>  .../devicetree/bindings/display/mediatek/mediatek,dpi.txt  | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> index 58914cf681b8..260ae75ac640 100644
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> @@ -17,6 +17,10 @@ Required properties:
>Documentation/devicetree/bindings/graph.txt. This port should be
> connected
>to the input port of an attached HDMI or LVDS encoder chip.
>
> +Optional properties:
> +- pinctrl-names: Contain "default" and "sleep".
> +  pinctrl-names see
> Documentation/devicetree/bindings/pinctrlpinctrl-bindings.txt
> +
>  Example:
>
>  dpi0: dpi@1401d000 {
> @@ -27,6 +31,9 @@ dpi0: dpi@1401d000 {
>  < CLK_MM_DPI_ENGINE>,
>  < CLK_APMIXED_TVDPLL>;
> clock-names = "pixel", "engine", "pll";
> +   pinctrl-names = "default", "sleep";
> +   pinctrl-0 = <_pin_func>;
> +   pinctrl-1 = <_pin_idle>;
>
> port {
> dpi0_out: endpoint {
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 4/4] drm/mediatek: config mipitx impedance with calibration data

2020-04-10 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年4月10日 週五 下午12:33寫道:
>
> Read calibration data from nvmem, and config mipitx impedance with
> calibration data to make sure their impedance are 100ohm.
>
> Signed-off-by: Jitao Shi 
> ---
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.c| 40 +++
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.h|  3 ++
>  drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c | 21 ++
>  3 files changed, 64 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
> b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> index e301af64809e..5e91fc2c1318 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> @@ -88,6 +88,44 @@ static const struct phy_ops mtk_mipi_tx_ops = {
> .owner = THIS_MODULE,
>  };
>
> +static void mtk_mipi_tx_get_calibration_datal(struct mtk_mipi_tx *mipi_tx)
> +{
> +   struct nvmem_cell *cell;
> +   size_t len;
> +   u32 *buf;
> +
> +   memset(mipi_tx->rt_code, 0, sizeof(mipi_tx->rt_code));

You use kzalloc() to allocate mipi_tx, so this is already zero-initialized.

> +   cell = nvmem_cell_get(mipi_tx->dev, "calibration-data");
> +   if (IS_ERR(cell)) {
> +   dev_info(mipi_tx->dev, "can't get nvmem_cell_get, ignore 
> it\n");
> +   } else {

If you return when error, you could get rid of the 'else', so you
could reduce many 'tab' and reduce the probability of one line over 80
character.

> +   buf = (u32 *)nvmem_cell_read(cell, );
> +   nvmem_cell_put(cell);
> +
> +   if (IS_ERR(buf)) {
> +   dev_info(mipi_tx->dev, "can't get data, ignore it\n");
> +   } else {

Ditto.

Regards,
Chun-Kuang.

> +   if (len < 3 * sizeof(u32)) {
> +   dev_info(mipi_tx->dev, "invalid calibration 
> data\n");
> +   kfree(buf);
> +   return;
> +   }
> +
> +   mipi_tx->rt_code[0] = ((buf[0] >> 6 & 0x1f) << 5) |
> +  (buf[0] >> 11 & 0x1f);
> +   mipi_tx->rt_code[1] = ((buf[1] >> 27 & 0x1f) << 5) |
> +  (buf[0] >> 1 & 0x1f);
> +   mipi_tx->rt_code[2] = ((buf[1] >> 17 & 0x1f) << 5) |
> +  (buf[1] >> 22 & 0x1f);
> +   mipi_tx->rt_code[3] = ((buf[1] >> 7 & 0x1f) << 5) |
> +  (buf[1] >> 12 & 0x1f);
> +   mipi_tx->rt_code[4] = ((buf[2] >> 27 & 0x1f) << 5) |
> +  (buf[1] >> 2 & 0x1f);
> +   kfree(buf);
> +   }
> +   }
> +}
> +
>  static int mtk_mipi_tx_probe(struct platform_device *pdev)
>  {
> struct device *dev = >dev;
> @@ -174,6 +212,8 @@ static int mtk_mipi_tx_probe(struct platform_device *pdev)
>
> mipi_tx->dev = dev;
>
> +   mtk_mipi_tx_get_calibration_datal(mipi_tx);
> +
> return of_clk_add_provider(dev->of_node, of_clk_src_simple_get,
>mipi_tx->pll);
>  }
> diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.h 
> b/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> index eea44327fe9f..c76f07c3fdeb 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> +++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> @@ -12,9 +12,11 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> +#include 
>
>  struct mtk_mipitx_data {
> const u32 mppll_preserve;
> @@ -28,6 +30,7 @@ struct mtk_mipi_tx {
> void __iomem *regs;
> u32 data_rate;
> u32 mipitx_drive;
> +   u32 rt_code[5];
> const struct mtk_mipitx_data *driver_data;
> struct clk_hw pll_hw;
> struct clk *pll;
> diff --git a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c 
> b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> index e4cc967750cb..9f3e55aeebb2 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> @@ -28,6 +28,7 @@
>  #define MIPITX_PLL_CON40x003c
>  #define RG_DSI_PLL_IBIAS   (3 << 10)
>
> +#define MIPITX_D2P_RTCODE  0x0100
>  #define MIPITX_D2_SW_CTL_EN0x0144
>  #define MIPITX_D0_SW_CTL_EN0x0244
>  #define MIPITX_CK_CKMODE_EN0x0328
> @@ -108,6 +109,24 @@ static const struct clk_ops mtk_mipi_tx_pll_ops = {
> .recalc_rate = mtk_mipi_tx_pll_recalc_rate,
>  };
>
> +static void mtk_mipi_tx_config_calibration_data(struct mtk_mipi_tx *mipi_tx)
> +{
> +   int i, j;
> +
> +   for (i = 0; i < 5; i++) {
> +   if ((mipi_tx->rt_code[i] & 0x1f) == 0)
> +   mipi_tx->rt_code[i] |= 0x10;
> +
> +   if ((mipi_tx->rt_code[i] >> 5 & 0x1f) == 0)
> +   mipi_tx->rt_code[i] |= 0x10 << 5;
> +
> +  

Re: [PATCH v6 4/4] drm/mediatek: config mipitx impedance with calibration data

2020-04-11 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年4月11日 週六 下午3:45寫道:
>
> Read calibration data from nvmem, and config mipitx impedance with
> calibration data to make sure their impedance are 100ohm.

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Jitao Shi 
> ---
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.c| 40 +++
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.h|  3 ++
>  drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c | 21 ++
>  3 files changed, 64 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
> b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> index e301af64809e..8cee2591e728 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> @@ -88,6 +88,44 @@ static const struct phy_ops mtk_mipi_tx_ops = {
> .owner = THIS_MODULE,
>  };
>
> +static void mtk_mipi_tx_get_calibration_datal(struct mtk_mipi_tx *mipi_tx)
> +{
> +   struct nvmem_cell *cell;
> +   size_t len;
> +   u32 *buf;
> +
> +   cell = nvmem_cell_get(mipi_tx->dev, "calibration-data");
> +   if (IS_ERR(cell)) {
> +   dev_info(mipi_tx->dev, "can't get nvmem_cell_get, ignore 
> it\n");
> +   return;
> +   }
> +   buf = (u32 *)nvmem_cell_read(cell, );
> +   nvmem_cell_put(cell);
> +
> +   if (IS_ERR(buf)) {
> +   dev_info(mipi_tx->dev, "can't get data, ignore it\n");
> +   return;
> +   }
> +
> +   if (len < 3 * sizeof(u32)) {
> +   dev_info(mipi_tx->dev, "invalid calibration data\n");
> +   kfree(buf);
> +   return;
> +   }
> +
> +   mipi_tx->rt_code[0] = ((buf[0] >> 6 & 0x1f) << 5) |
> +  (buf[0] >> 11 & 0x1f);
> +   mipi_tx->rt_code[1] = ((buf[1] >> 27 & 0x1f) << 5) |
> +  (buf[0] >> 1 & 0x1f);
> +   mipi_tx->rt_code[2] = ((buf[1] >> 17 & 0x1f) << 5) |
> +  (buf[1] >> 22 & 0x1f);
> +   mipi_tx->rt_code[3] = ((buf[1] >> 7 & 0x1f) << 5) |
> +  (buf[1] >> 12 & 0x1f);
> +   mipi_tx->rt_code[4] = ((buf[2] >> 27 & 0x1f) << 5) |
> +  (buf[1] >> 2 & 0x1f);
> +   kfree(buf);
> +}
> +
>  static int mtk_mipi_tx_probe(struct platform_device *pdev)
>  {
> struct device *dev = >dev;
> @@ -174,6 +212,8 @@ static int mtk_mipi_tx_probe(struct platform_device *pdev)
>
> mipi_tx->dev = dev;
>
> +   mtk_mipi_tx_get_calibration_datal(mipi_tx);
> +
> return of_clk_add_provider(dev->of_node, of_clk_src_simple_get,
>mipi_tx->pll);
>  }
> diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.h 
> b/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> index eea44327fe9f..c76f07c3fdeb 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> +++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> @@ -12,9 +12,11 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> +#include 
>
>  struct mtk_mipitx_data {
> const u32 mppll_preserve;
> @@ -28,6 +30,7 @@ struct mtk_mipi_tx {
> void __iomem *regs;
> u32 data_rate;
> u32 mipitx_drive;
> +   u32 rt_code[5];
> const struct mtk_mipitx_data *driver_data;
> struct clk_hw pll_hw;
> struct clk *pll;
> diff --git a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c 
> b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> index e4cc967750cb..9f3e55aeebb2 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> @@ -28,6 +28,7 @@
>  #define MIPITX_PLL_CON40x003c
>  #define RG_DSI_PLL_IBIAS   (3 << 10)
>
> +#define MIPITX_D2P_RTCODE  0x0100
>  #define MIPITX_D2_SW_CTL_EN0x0144
>  #define MIPITX_D0_SW_CTL_EN0x0244
>  #define MIPITX_CK_CKMODE_EN0x0328
> @@ -108,6 +109,24 @@ static const struct clk_ops mtk_mipi_tx_pll_ops = {
> .recalc_rate = mtk_mipi_tx_pll_recalc_rate,
>  };
>
> +static void mtk_mipi_tx_config_calibration_data(struct mtk_mipi_tx *mipi_tx)
> +{
> +   int i, j;
> +
> +   for (i = 0; i < 5; i++) {
> +   if ((mipi_tx->rt_code[i] & 0x1f) == 0)
> +   mipi_tx->rt_code[i] |= 0x10;
> +
> +   if ((mipi_tx->rt_code[i] >> 5 & 0x1f) == 0)
> +   mipi_tx-

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-04-16 Thread Chun-Kuang Hu
Hi, Matthias:

Matthias Brugger  於 2020年3月26日 週四 下午11:45寫道:
>
>
>
> On 26/03/2020 15:51, CK Hu wrote:
> > Hi, Matthias:
> >
> > On Thu, 2020-03-26 at 12:54 +0100, Matthias Brugger wrote:
> >> Hi CK,
> >>
> >> On 26/03/2020 00:05, CK Hu wrote:
> >>> Hi, Matthias:
> >>>
> >>> On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
> 
>  On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> > Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions 
> > to
> > replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
> > Those functions will allow DRM driver and others to control the data
> > path routing.
> >
> > Signed-off-by: Enric Balletbo i Serra 
> > Reviewed-by: Matthias Brugger 
> > Reviewed-by: CK Hu 
> > Acked-by: CK Hu 
> 
>  This patch does not apply against v5.6-rc1.
>  Please rebase as this is a quite big patch and it won't be easy to do 
>  that by hand.
> >>>
> >>> I think this patch depends on [1] which has been acked by me and I have
> >>> not picked it. The simple way is that you pick [1] first and then pick
> >>> this series.
> >>>
> >>> [1]
> >>> https://patchwork.kernel.org/patch/11406227/
> >>>
> >>
> >> You would need to provide a stable tag for me that I can merge into my 
> >> tree. You
> >> can also try to merge my for-next [1] which has the newest version from 
> >> Enric.
> >> If you see any merge conflict, then we have to do something about it :)
> >>
> >> Regards,
> >> Matthias
> >>
> >> [1]
> >> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
> >>
> >
> > You have applied this series, so I would not apply other patches which
> > would conflict with this series. After this series land on main stream
> > (wish it happen in this merge window), I would rebase other patch on
> > main stream.
> >
>
> I haven't (yet) send the pull request. If you want to bring in your patches in
> v5.7 as well we can find a solution to that. Shall I provide you with a stable
> branch which you can merge? This way you can add all your patches in the pull
> request as well and we don't have to wait for v5.8 to get things into 
> mainline.
>
> Let me know and I'll provide you with a stable branch.

This series is in linux-next but does not in main stream. So would you
please provide a stable branch so I could pull this series?

Regards,
Chun-Kuang.

>
> Regards,
> Matthias
>
> > Regards,
> > CK
> >
> >>> Regards,
> >>> CK
> >>>
> 
>  Regards,
>  Matthias
> 
> > ---
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: mediatek: fix device passed to cmdq

2020-04-06 Thread Chun-Kuang Hu
Hi, Hsin-Yi:

Hsin-Yi Wang  於 2020年4月6日 週一 下午1:12寫道:
>
> drm device is now probed from mmsys. We need to use mmsys device to get gce
> nodes. Fix following errors:
>
> [0.740068] mediatek-drm mediatek-drm.1.auto: error -2 can't parse 
> gce-client-reg property (0)
> [0.748721] mediatek-drm mediatek-drm.1.auto: error -2 can't parse 
> gce-client-reg property (0)
> ...
> [2.659645] mediatek-drm mediatek-drm.1.auto: failed to request channel
> [2.666270] mediatek-drm mediatek-drm.1.auto: failed to request channel

Reviewed-by: Chun-Kuang Hu 

>
> Fixes: 1d367541aded ("soc / drm: mediatek: Fix mediatek-drm device probing")
> Signed-off-by: Hsin-Yi Wang 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 6 --
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 3 ++-
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 615a54e60fe2..8621f0289399 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -822,14 +822,16 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
>
>  #if IS_REACHABLE(CONFIG_MTK_CMDQ)
> mtk_crtc->cmdq_client =
> -   cmdq_mbox_create(dev, drm_crtc_index(_crtc->base),
> +   cmdq_mbox_create(mtk_crtc->mmsys_dev,
> +drm_crtc_index(_crtc->base),
>  2000);
> if (IS_ERR(mtk_crtc->cmdq_client)) {
> dev_dbg(dev, "mtk_crtc %d failed to create mailbox client, 
> writing register by CPU now\n",
> drm_crtc_index(_crtc->base));
> mtk_crtc->cmdq_client = NULL;
> }
> -   ret = of_property_read_u32_index(dev->of_node, "mediatek,gce-events",
> +   ret = of_property_read_u32_index(mtk_crtc->mmsys_dev->of_node,
> +"mediatek,gce-events",
>  drm_crtc_index(_crtc->base),
>  _crtc->cmdq_event);
> if (ret)
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index e2bb0d19ef99..dc78e86bccc0 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -517,7 +517,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
> goto err_node;
> }
>
> -   ret = mtk_ddp_comp_init(dev, node, comp, comp_id, 
> NULL);
> +   ret = mtk_ddp_comp_init(dev->parent, node, comp,
> +   comp_id, NULL);
> if (ret) {
> of_node_put(node);
> goto err_node;
> --
> 2.26.0.292.g33ef6b2f38-goog
>
>
> ___
> Linux-mediatek mailing list
> linux-media...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v15 1/3] dt-bindings: display: mediatek: control dpi pins mode to avoid leakage

2020-04-18 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年4月15日 週三 上午9:13寫道:
>
> Add property "pinctrl-names" to swap pin mode between gpio and dpi mode. Set
> the dpi pins to gpio mode and output-low to avoid leakage current when dpi
> disabled.

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Acked-by: Rob Herring 
> Reviewed-by: Chun-Kuang Hu 
> Signed-off-by: Jitao Shi 
> ---
>  Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt | 6 
> ++
>  1 file changed, 6 insertions(+)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> index 58914cf681b8..77def4456706 100644
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> @@ -17,6 +17,9 @@ Required properties:
>Documentation/devicetree/bindings/graph.txt. This port should be connected
>to the input port of an attached HDMI or LVDS encoder chip.
>
> +Optional properties:
> +- pinctrl-names: Contain "default" and "sleep".
> +
>  Example:
>
>  dpi0: dpi@1401d000 {
> @@ -27,6 +30,9 @@ dpi0: dpi@1401d000 {
>  < CLK_MM_DPI_ENGINE>,
>  < CLK_APMIXED_TVDPLL>;
> clock-names = "pixel", "engine", "pll";
> +   pinctrl-names = "default", "sleep";
> +   pinctrl-0 = <_pin_func>;
> +   pinctrl-1 = <_pin_idle>;
>
> port {
> dpi0_out: endpoint {
> --
> 2.12.5
> ___
> Linux-mediatek mailing list
> linux-media...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v15 3/3] drm/mediatek: set dpi pin mode to gpio low to avoid leakage current

2020-04-18 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年4月15日 週三 上午9:13寫道:
>
> Config dpi pins mode to output and pull low when dpi is disabled.
> Aovid leakage current from some dpi pins (Hsync Vsync DE ... ).

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,Chun-Kuang.

>
> Reviewed-by: Chun-Kuang Hu 
> Signed-off-by: Jitao Shi 
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 31 +++
>  1 file changed, 31 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 087f5ce732e1..1e01254788d9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -10,7 +10,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -74,6 +76,9 @@ struct mtk_dpi {
> enum mtk_dpi_out_yc_map yc_map;
> enum mtk_dpi_out_bit_num bit_num;
> enum mtk_dpi_out_channel_swap channel_swap;
> +   struct pinctrl *pinctrl;
> +   struct pinctrl_state *pins_gpio;
> +   struct pinctrl_state *pins_dpi;
> int refcount;
>  };
>
> @@ -379,6 +384,9 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> if (--dpi->refcount != 0)
> return;
>
> +   if (dpi->pinctrl && dpi->pins_gpio)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> +
> mtk_dpi_disable(dpi);
> clk_disable_unprepare(dpi->pixel_clk);
> clk_disable_unprepare(dpi->engine_clk);
> @@ -403,6 +411,9 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
> goto err_pixel;
> }
>
> +   if (dpi->pinctrl && dpi->pins_dpi)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
> +
> mtk_dpi_enable(dpi);
> return 0;
>
> @@ -705,6 +716,26 @@ static int mtk_dpi_probe(struct platform_device *pdev)
> dpi->dev = dev;
> dpi->conf = (struct mtk_dpi_conf *)of_device_get_match_data(dev);
>
> +   dpi->pinctrl = devm_pinctrl_get(>dev);
> +   if (IS_ERR(dpi->pinctrl)) {
> +   dpi->pinctrl = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl!\n");
> +   }
> +   if (dpi->pinctrl) {
> +   dpi->pins_gpio = pinctrl_lookup_state(dpi->pinctrl, "sleep");
> +   if (IS_ERR(dpi->pins_gpio)) {
> +   dpi->pins_gpio = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl idle!\n");
> +   }
> +   if (dpi->pins_gpio)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> +
> +   dpi->pins_dpi = pinctrl_lookup_state(dpi->pinctrl, "default");
> +   if (IS_ERR(dpi->pins_dpi)) {
> +   dpi->pins_dpi = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl active!\n");
> +   }
> +   }
> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> dpi->regs = devm_ioremap_resource(dev, mem);
> if (IS_ERR(dpi->regs)) {
> --
> 2.12.5
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6 1/4] dt-bindings: display: mediatek: add property to control mipi tx drive current

2020-04-18 Thread Chun-Kuang Hu
Hi, Rob:

How do you think about this patch? This patch looks good to me.

Regards,
Chun-Kuang.

Jitao Shi  於 2020年4月11日 週六 下午3:44寫道:
>
> Add a property to control mipi tx drive current:
> "drive-strength-microamp"
>
> Reviewed-by: Chun-Kuang Hu 
> Signed-off-by: Jitao Shi 
> ---
>  .../devicetree/bindings/display/mediatek/mediatek,dsi.txt| 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> index a19a6cc375ed..d78b6d6d8fab 100644
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> @@ -33,6 +33,10 @@ Required properties:
>  - #clock-cells: must be <0>;
>  - #phy-cells: must be <0>.
>
> +Optional properties:
> +- drive-strength-microamp: adjust driving current, should be 3000 ~ 6000. And
> +  the step is 200.
> +
>  Example:
>
>  mipi_tx0: mipi-dphy@10215000 {
> @@ -42,6 +46,7 @@ mipi_tx0: mipi-dphy@10215000 {
> clock-output-names = "mipi_tx0_pll";
> #clock-cells = <0>;
> #phy-cells = <0>;
> +   drive-strength-microamp = <4600>;
>  };
>
>  dsi0: dsi@1401b000 {
> --
> 2.21.0
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm: mediatek: fix device passed to cmdq

2020-04-09 Thread Chun-Kuang Hu
Hi, Hsin-Yi:

Hsin-Yi Wang  於 2020年4月9日 週四 下午2:02寫道:
>
> drm device is now probed from mmsys. We need to use mmsys device to get gce
> nodes. Fix following errors:
>
> [0.740068] mediatek-drm mediatek-drm.1.auto: error -2 can't parse 
> gce-client-reg property (0)
> [0.748721] mediatek-drm mediatek-drm.1.auto: error -2 can't parse 
> gce-client-reg property (0)
> ...
> [2.659645] mediatek-drm mediatek-drm.1.auto: failed to request channel
> [2.666270] mediatek-drm mediatek-drm.1.auto: failed to request channel

Reviewed-by: Chun-Kuang Hu 

>
> Fixes: 1d367541aded ("soc / drm: mediatek: Fix mediatek-drm device probing")
> Signed-off-by: Hsin-Yi Wang 
> Reviewed-by: Enric Balletbo i Serra 
> Tested-by: Enric Balletbo i Serra 
> ---
> The patch is based on
> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git
> branch v5.6-next/soc
>
> Change log:
> v1->v2:
> align with 60fa8c13ab1a ("drm/mediatek: Move gce event property to mutex 
> device node")
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 3 ++-
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 615a54e60fe2..7247c6f87f4a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -822,7 +822,8 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
>
>  #if IS_REACHABLE(CONFIG_MTK_CMDQ)
> mtk_crtc->cmdq_client =
> -   cmdq_mbox_create(dev, drm_crtc_index(_crtc->base),
> +   cmdq_mbox_create(mtk_crtc->mmsys_dev,
> +drm_crtc_index(_crtc->base),
>  2000);
> if (IS_ERR(mtk_crtc->cmdq_client)) {
> dev_dbg(dev, "mtk_crtc %d failed to create mailbox client, 
> writing register by CPU now\n",
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index e2bb0d19ef99..28418e5b83ee 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -517,7 +517,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
> goto err_node;
> }
>
> -   ret = mtk_ddp_comp_init(dev, node, comp, comp_id, 
> NULL);
> +   ret = mtk_ddp_comp_init(dev->parent, node, comp, 
> comp_id, NULL);
> if (ret) {
> of_node_put(node);
> goto err_node;
> --
> 2.26.0.292.g33ef6b2f38-goog
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 1/4] drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver

2020-04-02 Thread Chun-Kuang Hu
Hi, Matthias:

Matthias Brugger  於 2020年4月1日 週三 下午11:53寫道:
>
>
>
> On 01/04/2020 04:16, Chunfeng Yun wrote:
> > On Tue, 2020-03-31 at 23:57 +0800, Chun-Kuang Hu wrote:
> >> From: CK Hu 
> >>
> >> tz_disabled is used to control mtk_hdmi output signal, but this variable
> >> is stored in mtk_hdmi_phy and mtk_hdmi_phy does not use it. So move
> >> tz_disabled to mtk_hdmi where it's used.
> >>
> >> Signed-off-by: CK Hu 
> >> Signed-off-by: Chun-Kuang Hu 
> >> ---
> >>  drivers/gpu/drm/mediatek/mtk_hdmi.c   | 22 ---
> >>  drivers/gpu/drm/mediatek/mtk_hdmi_phy.h   |  1 -
> >>  .../gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c|  1 -
> >>  3 files changed, 19 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> >> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> >> index 5e4a4dbda443..878433c09c9b 100644
> >> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> >> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> >> @@ -144,11 +144,16 @@ struct hdmi_audio_param {
> >>  struct hdmi_codec_params codec_params;
> >>  };
> >>
> >> +struct mtk_hdmi_conf {
> >> +bool tz_disabled;
> >> +};
> >> +
> >>  struct mtk_hdmi {
> >>  struct drm_bridge bridge;
> >>  struct drm_bridge *next_bridge;
> >>  struct drm_connector conn;
> >>  struct device *dev;
> >> +const struct mtk_hdmi_conf *conf;
> >>  struct phy *phy;
> >>  struct device *cec_dev;
> >>  struct i2c_adapter *ddc_adpt;
> >> @@ -230,7 +235,6 @@ static void mtk_hdmi_hw_vid_black(struct mtk_hdmi 
> >> *hdmi, bool black)
> >>  static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool 
> >> enable)
> >>  {
> >>  struct arm_smccc_res res;
> >> -struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(hdmi->phy);
> >>
> >>  /*
> >>   * MT8173 HDMI hardware has an output control bit to enable/disable 
> >> HDMI
> >> @@ -238,7 +242,7 @@ static void mtk_hdmi_hw_make_reg_writable(struct 
> >> mtk_hdmi *hdmi, bool enable)
> >>   * The ARM trusted firmware provides an API for the HDMI driver to set
> >>   * this control bit to enable HDMI output in supervisor mode.
> >>   */
> >> -if (hdmi_phy->conf && hdmi_phy->conf->tz_disabled)
> >> +if (hdmi->conf->tz_disabled)
>
> Wouldn't we need to check:
> if (hdmi->conf && hdmi->conf->tz_disabled)

My design is: hdmi->conf would not be NULL.

>
> >>  regmap_update_bits(hdmi->sys_regmap,
> >> hdmi->sys_offset + HDMI_SYS_CFG20,
> >> 0x80008005, enable ? 0x8005 : 0x8000);
> >> @@ -1688,6 +1692,7 @@ static int mtk_drm_hdmi_probe(struct platform_device 
> >> *pdev)
> >>  return -ENOMEM;
> >>
> >>  hdmi->dev = dev;
> >> +hdmi->conf = of_device_get_match_data(dev);
> >>
> >>  ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev);
> >>  if (ret)
> >> @@ -1765,8 +1770,19 @@ static int mtk_hdmi_resume(struct device *dev)
> >>  static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops,
> >>   mtk_hdmi_suspend, mtk_hdmi_resume);
> >>
> >> +static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = {
> >> +.tz_disabled = true,
> >> +};
> >> +
> >> +static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8173;
> >> +
> >>  static const struct of_device_id mtk_drm_hdmi_of_ids[] = {
> >> -{ .compatible = "mediatek,mt8173-hdmi", },
> >> +{ .compatible = "mediatek,mt2701-hdmi",
> >> +  .data = _hdmi_conf_mt2701,
> >> +},
> >> +{ .compatible = "mediatek,mt8173-hdmi",
> >> +  .data = _hdmi_conf_mt8173,
>
> We don't have any data? Then we should set data to NULL instead.

My design is data would not be NULL, so I need not to check whether it
is NULL in driver.

Regards,
CK

>
> Regards,
> Matthias
>
> >> +},
> >>  {}
> >>  };
> >>
> >> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h 
> >> b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
> >> index 2d8b3182470d..fc1c2efd1128 100644
> >> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
> >> +++ b/drivers

Re: [PATCH v14 1/3] dt-bindings: display: mediatek: control dpi pins mode to avoid leakage

2020-04-04 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年4月3日 週五 下午4:04寫道:
>
> Add property "pinctrl-names" to swap pin mode between gpio and dpi mode. Set
> the dpi pins to gpio mode and output-low to avoid leakage current when dpi
> disabled.
>

Reviewed-by: Chun-Kuang Hu 

> Signed-off-by: Jitao Shi 
> ---
>  .../devicetree/bindings/display/mediatek/mediatek,dpi.txt   | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> index 58914cf681b8..77def4456706 100644
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> @@ -17,6 +17,9 @@ Required properties:
>Documentation/devicetree/bindings/graph.txt. This port should be connected
>to the input port of an attached HDMI or LVDS encoder chip.
>
> +Optional properties:
> +- pinctrl-names: Contain "default" and "sleep".
> +
>  Example:
>
>  dpi0: dpi@1401d000 {
> @@ -27,6 +30,9 @@ dpi0: dpi@1401d000 {
>  < CLK_MM_DPI_ENGINE>,
>  < CLK_APMIXED_TVDPLL>;
> clock-names = "pixel", "engine", "pll";
> +   pinctrl-names = "default", "sleep";
> +   pinctrl-0 = <_pin_func>;
> +   pinctrl-1 = <_pin_idle>;
>
> port {
> dpi0_out: endpoint {
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 4/4] drm/mediatek: config mipitx impedance with calibration data

2020-04-04 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年3月31日 週二 下午4:28寫道:
>
> Read calibration data from nvmem, and config mipitx impedance with
> calibration data to make sure their impedance are 100ohm.
>
> Signed-off-by: Jitao Shi 
> ---
>  drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c | 57 +++
>  1 file changed, 57 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c 
> b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> index e4cc967750cb..0f87cd3d1d7d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> @@ -5,6 +5,8 @@
>   */
>
>  #include "mtk_mipi_tx.h"
> +#include 
> +#include 
>
>  #define MIPITX_LANE_CON0x000c
>  #define RG_DSI_CPHY_T1DRV_EN   BIT(0)
> @@ -28,6 +30,7 @@
>  #define MIPITX_PLL_CON40x003c
>  #define RG_DSI_PLL_IBIAS   (3 << 10)
>
> +#define MIPITX_D2P_RTCODE  0x0100
>  #define MIPITX_D2_SW_CTL_EN0x0144
>  #define MIPITX_D0_SW_CTL_EN0x0244
>  #define MIPITX_CK_CKMODE_EN0x0328
> @@ -108,6 +111,58 @@ static const struct clk_ops mtk_mipi_tx_pll_ops = {
> .recalc_rate = mtk_mipi_tx_pll_recalc_rate,
>  };
>
> +static void mtk_mipi_tx_config_calibration_data(struct mtk_mipi_tx *mipi_tx)
> +{
> +   u32 *buf;
> +   u32 rt_code[5];
> +   int i, j;
> +   struct nvmem_cell *cell;
> +   struct device *dev = mipi_tx->dev;
> +   size_t len;
> +
> +   cell = nvmem_cell_get(dev, "calibration-data");
> +   if (IS_ERR(cell)) {
> +   dev_info(dev, "nvmem_cell_get fail\n");
> +   return;
> +   }
> +
> +   buf = (u32 *)nvmem_cell_read(cell, );
> +
> +   nvmem_cell_put(cell);
> +
> +   if (IS_ERR(buf)) {
> +   dev_info(dev, "can't get data\n");
> +   return;
> +   }
> +
> +   if (len < 3 * sizeof(u32)) {
> +   dev_info(dev, "invalid calibration data\n");
> +   kfree(buf);
> +   return;
> +   }
> +
> +   rt_code[0] = ((buf[0] >> 6 & 0x1f) << 5) | (buf[0] >> 11 & 0x1f);
> +   rt_code[1] = ((buf[1] >> 27 & 0x1f) << 5) | (buf[0] >> 1 & 0x1f);
> +   rt_code[2] = ((buf[1] >> 17 & 0x1f) << 5) | (buf[1] >> 22 & 0x1f);
> +   rt_code[3] = ((buf[1] >> 7 & 0x1f) << 5) | (buf[1] >> 12 & 0x1f);
> +   rt_code[4] = ((buf[2] >> 27 & 0x1f) << 5) | (buf[1] >> 2 & 0x1f);

Why not just save rt_code in nvmem and you don't need to translate here?
If you need to do so, please add description for this.

Regards,
Chun-Kuang.


> +
> +   for (i = 0; i < 5; i++) {
> +   if ((rt_code[i] & 0x1f) == 0)
> +   rt_code[i] |= 0x10;
> +
> +   if ((rt_code[i] >> 5 & 0x1f) == 0)
> +   rt_code[i] |= 0x10 << 5;
> +
> +   for (j = 0; j < 10; j++)
> +   mtk_mipi_tx_update_bits(mipi_tx,
> +   MIPITX_D2P_RTCODE * (i + 1) + j * 4,
> +   1, rt_code[i] >> j & 1);
> +   }
> +
> +   kfree(buf);
> +}
> +
>  static void mtk_mipi_tx_power_on_signal(struct phy *phy)
>  {
> struct mtk_mipi_tx *mipi_tx = phy_get_drvdata(phy);
> @@ -130,6 +185,8 @@ static void mtk_mipi_tx_power_on_signal(struct phy *phy)
> RG_DSI_HSTX_LDO_REF_SEL,
> (mipi_tx->mipitx_drive - 3000) / 200 << 6);
>
> +   mtk_mipi_tx_config_calibration_data(mipi_tx);
> +
> mtk_mipi_tx_set_bits(mipi_tx, MIPITX_CK_CKMODE_EN, DSI_CK_CKMODE_EN);
>  }
>
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v14 3/3] drm/mediatek: set dpi pin mode to gpio low to avoid leakage current

2020-04-04 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年4月3日 週五 下午4:04寫道:
>
> Config dpi pins mode to output and pull low when dpi is disabled.
> Aovid leakage current from some dpi pins (Hsync Vsync DE ... ).

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Jitao Shi 
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 31 ++
>  1 file changed, 31 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 087f5ce732e1..1e01254788d9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -10,7 +10,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -74,6 +76,9 @@ struct mtk_dpi {
> enum mtk_dpi_out_yc_map yc_map;
> enum mtk_dpi_out_bit_num bit_num;
> enum mtk_dpi_out_channel_swap channel_swap;
> +   struct pinctrl *pinctrl;
> +   struct pinctrl_state *pins_gpio;
> +   struct pinctrl_state *pins_dpi;
> int refcount;
>  };
>
> @@ -379,6 +384,9 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> if (--dpi->refcount != 0)
> return;
>
> +   if (dpi->pinctrl && dpi->pins_gpio)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> +
> mtk_dpi_disable(dpi);
> clk_disable_unprepare(dpi->pixel_clk);
> clk_disable_unprepare(dpi->engine_clk);
> @@ -403,6 +411,9 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
> goto err_pixel;
> }
>
> +   if (dpi->pinctrl && dpi->pins_dpi)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
> +
> mtk_dpi_enable(dpi);
> return 0;
>
> @@ -705,6 +716,26 @@ static int mtk_dpi_probe(struct platform_device *pdev)
> dpi->dev = dev;
> dpi->conf = (struct mtk_dpi_conf *)of_device_get_match_data(dev);
>
> +   dpi->pinctrl = devm_pinctrl_get(>dev);
> +   if (IS_ERR(dpi->pinctrl)) {
> +   dpi->pinctrl = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl!\n");
> +   }
> +   if (dpi->pinctrl) {
> +   dpi->pins_gpio = pinctrl_lookup_state(dpi->pinctrl, "sleep");
> +   if (IS_ERR(dpi->pins_gpio)) {
> +   dpi->pins_gpio = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl idle!\n");
> +   }
> +   if (dpi->pins_gpio)
> +   pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> +
> +   dpi->pins_dpi = pinctrl_lookup_state(dpi->pinctrl, "default");
> +   if (IS_ERR(dpi->pins_dpi)) {
> +   dpi->pins_dpi = NULL;
> +   dev_dbg(>dev, "Cannot find pinctrl active!\n");
> +   }
> +   }
> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> dpi->regs = devm_ioremap_resource(dev, mem);
> if (IS_ERR(dpi->regs)) {
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 2/4] dt-bindings: display: mediatek: get mipitx calibration data from nvmem

2020-04-04 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年3月31日 週二 下午4:28寫道:
>
> Add properties to get get mipitx calibration data.

Reviewed-by: Chun-Kuang Hu 

>
> Reviewed-by: Rob Herring 
> Signed-off-by: Jitao Shi 
> ---
>  .../devicetree/bindings/display/mediatek/mediatek,dsi.txt| 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> index d78b6d6d8fab..8e4729de8c85 100644
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> @@ -36,6 +36,9 @@ Required properties:
>  Optional properties:
>  - drive-strength-microamp: adjust driving current, should be 3000 ~ 6000. And
>the step is 200.
> +- nvmem-cells: A phandle to the calibration data provided by a nvmem device. 
> If
> +   unspecified default values shall be used.
> +- nvmem-cell-names: Should be "calibration-data"
>
>  Example:
>
> @@ -47,6 +50,8 @@ mipi_tx0: mipi-dphy@10215000 {
> #clock-cells = <0>;
> #phy-cells = <0>;
> drive-strength-microamp = <4600>;
> +   nvmem-cells= <_tx_calibration>;
> +   nvmem-cell-names = "calibration-data";
>  };
>
>  dsi0: dsi@1401b000 {
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 1/4] dt-bindings: display: mediatek: add property to control mipi tx drive current

2020-04-04 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年3月31日 週二 下午4:28寫道:
>
> Add a property to control mipi tx drive current:
> "drive-strength-microamp"

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Jitao Shi 
> ---
>  .../devicetree/bindings/display/mediatek/mediatek,dsi.txt| 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> index a19a6cc375ed..d78b6d6d8fab 100644
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
> @@ -33,6 +33,10 @@ Required properties:
>  - #clock-cells: must be <0>;
>  - #phy-cells: must be <0>.
>
> +Optional properties:
> +- drive-strength-microamp: adjust driving current, should be 3000 ~ 6000. And
> +  the step is 200.
> +
>  Example:
>
>  mipi_tx0: mipi-dphy@10215000 {
> @@ -42,6 +46,7 @@ mipi_tx0: mipi-dphy@10215000 {
> clock-output-names = "mipi_tx0_pll";
> #clock-cells = <0>;
> #phy-cells = <0>;
> +   drive-strength-microamp = <4600>;
>  };
>
>  dsi0: dsi@1401b000 {
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 3/4] drm/mediatek: add the mipitx driving control

2020-04-04 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年3月31日 週二 下午4:28寫道:
>
> Add a property in device tree to control the driving by different
> board.

Reviewed-by: Chun-Kuang Hu 

>
> Reviewed-by: Matthias Brugger 
> Signed-off-by: Jitao Shi 
> ---
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.c| 14 ++
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.h|  1 +
>  drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c |  7 +++
>  3 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
> b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> index e4d34484ecc8..e301af64809e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
> @@ -125,6 +125,20 @@ static int mtk_mipi_tx_probe(struct platform_device 
> *pdev)
> return ret;
> }
>
> +   ret = of_property_read_u32(dev->of_node, "drive-strength-microamp",
> +  _tx->mipitx_drive);
> +   /* If can't get the "mipi_tx->mipitx_drive", set it default 0x8 */
> +   if (ret < 0)
> +   mipi_tx->mipitx_drive = 4600;
> +
> +   /* check the mipitx_drive valid */
> +   if (mipi_tx->mipitx_drive > 6000 || mipi_tx->mipitx_drive < 3000) {
> +   dev_warn(dev, "drive-strength-microamp is invalid %d, not in 
> 3000 ~ 6000\n",
> +mipi_tx->mipitx_drive);
> +   mipi_tx->mipitx_drive = clamp_val(mipi_tx->mipitx_drive, 3000,
> + 6000);
> +   }
> +
> ref_clk_name = __clk_get_name(ref_clk);
>
> ret = of_property_read_string(dev->of_node, "clock-output-names",
> diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.h 
> b/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> index 413f35d86219..eea44327fe9f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> +++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.h
> @@ -27,6 +27,7 @@ struct mtk_mipi_tx {
> struct device *dev;
> void __iomem *regs;
> u32 data_rate;
> +   u32 mipitx_drive;
> const struct mtk_mipitx_data *driver_data;
> struct clk_hw pll_hw;
> struct clk *pll;
> diff --git a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c 
> b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> index 91f08a351fd0..e4cc967750cb 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> @@ -17,6 +17,9 @@
>  #define RG_DSI_BG_CORE_EN  BIT(7)
>  #define RG_DSI_PAD_TIEL_SELBIT(8)
>
> +#define MIPITX_VOLTAGE_SEL 0x0010
> +#define RG_DSI_HSTX_LDO_REF_SEL(0xf << 6)
> +
>  #define MIPITX_PLL_PWR 0x0028
>  #define MIPITX_PLL_CON00x002c
>  #define MIPITX_PLL_CON10x0030
> @@ -123,6 +126,10 @@ static void mtk_mipi_tx_power_on_signal(struct phy *phy)
> mtk_mipi_tx_clear_bits(mipi_tx, MIPITX_D3_SW_CTL_EN, DSI_SW_CTL_EN);
> mtk_mipi_tx_clear_bits(mipi_tx, MIPITX_CK_SW_CTL_EN, DSI_SW_CTL_EN);
>
> +   mtk_mipi_tx_update_bits(mipi_tx, MIPITX_VOLTAGE_SEL,
> +   RG_DSI_HSTX_LDO_REF_SEL,
> +   (mipi_tx->mipitx_drive - 3000) / 200 << 6);
> +
> mtk_mipi_tx_set_bits(mipi_tx, MIPITX_CK_CKMODE_EN, DSI_CK_CKMODE_EN);
>  }
>
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 4/4] drm/mediatek: config mipitx impedance with calibration data

2020-04-05 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年4月5日 週日 下午9:39寫道:
>
>
> On Sat, 2020-04-04 at 22:26 +0800, Chun-Kuang Hu wrote:
> > Hi, Jitao:
> >
> > Jitao Shi  於 2020年3月31日 週二 下午4:28寫道:
> > >
> > > Read calibration data from nvmem, and config mipitx impedance with
> > > calibration data to make sure their impedance are 100ohm.
> > >
> > > Signed-off-by: Jitao Shi 
> > > ---
> > >  drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c | 57 +++
> > >  1 file changed, 57 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c 
> > > b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> > > index e4cc967750cb..0f87cd3d1d7d 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
> > > @@ -5,6 +5,8 @@
> > >   */
> > >
> > >  #include "mtk_mipi_tx.h"
> > > +#include 
> > > +#include 
> > >
> > >  #define MIPITX_LANE_CON0x000c
> > >  #define RG_DSI_CPHY_T1DRV_EN   BIT(0)
> > > @@ -28,6 +30,7 @@
> > >  #define MIPITX_PLL_CON40x003c
> > >  #define RG_DSI_PLL_IBIAS   (3 << 10)
> > >
> > > +#define MIPITX_D2P_RTCODE  0x0100
> > >  #define MIPITX_D2_SW_CTL_EN0x0144
> > >  #define MIPITX_D0_SW_CTL_EN0x0244
> > >  #define MIPITX_CK_CKMODE_EN0x0328
> > > @@ -108,6 +111,58 @@ static const struct clk_ops mtk_mipi_tx_pll_ops = {
> > > .recalc_rate = mtk_mipi_tx_pll_recalc_rate,
> > >  };
> > >
> > > +static void mtk_mipi_tx_config_calibration_data(struct mtk_mipi_tx 
> > > *mipi_tx)
> > > +{
> > > +   u32 *buf;
> > > +   u32 rt_code[5];
> > > +   int i, j;
> > > +   struct nvmem_cell *cell;
> > > +   struct device *dev = mipi_tx->dev;
> > > +   size_t len;
> > > +
> > > +   cell = nvmem_cell_get(dev, "calibration-data");
> > > +   if (IS_ERR(cell)) {
> > > +   dev_info(dev, "nvmem_cell_get fail\n");
> > > +   return;
> > > +   }
> > > +
> > > +   buf = (u32 *)nvmem_cell_read(cell, );
> > > +
> > > +   nvmem_cell_put(cell);
> > > +
> > > +   if (IS_ERR(buf)) {
> > > +   dev_info(dev, "can't get data\n");
> > > +   return;
> > > +   }
> > > +
> > > +   if (len < 3 * sizeof(u32)) {
> > > +   dev_info(dev, "invalid calibration data\n");
> > > +   kfree(buf);
> > > +   return;
> > > +   }
> > > +
> > > +   rt_code[0] = ((buf[0] >> 6 & 0x1f) << 5) | (buf[0] >> 11 & 0x1f);
> > > +   rt_code[1] = ((buf[1] >> 27 & 0x1f) << 5) | (buf[0] >> 1 & 0x1f);
> > > +   rt_code[2] = ((buf[1] >> 17 & 0x1f) << 5) | (buf[1] >> 22 & 0x1f);
> > > +   rt_code[3] = ((buf[1] >> 7 & 0x1f) << 5) | (buf[1] >> 12 & 0x1f);
> > > +   rt_code[4] = ((buf[2] >> 27 & 0x1f) << 5) | (buf[1] >> 2 & 0x1f);
> >
> > Why not just save rt_code in nvmem and you don't need to translate here?
> > If you need to do so, please add description for this.
> >
> > Regards,
> > Chun-Kuang.
> >
>
> Hi Chun-Kuang,
>
> The calibration data is flashed in rom when the IC FT test
> And the data struct can't be stored again

OK, it looks like this transtation is necessary.
If it's fixed, I would like to get the rt_code when probe or somewhere
initialization.

Regards,
Chun-Kuang.

>
> Best Regards
> JItao
> >
> > > +
> > > +   for (i = 0; i < 5; i++) {
> > > +   if ((rt_code[i] & 0x1f) == 0)
> > > +   rt_code[i] |= 0x10;
> > > +
> > > +   if ((rt_code[i] >> 5 & 0x1f) == 0)
> > > +   rt_code[i] |= 0x10 << 5;
> > > +
> > > +   for (j = 0; j < 10; j++)
> > > +   mtk_mipi_tx_update_bits(mipi_tx,
> > > +   MIPITX_D2P_RTCODE * (i + 1) + j * 4,
> > > +   1, rt_code[i] >> j & 1);
> > > +   }
> > > +
> > > +   kfree(buf);
> > > +}
> > > +
> > >  static void mtk_mipi_tx_power_on_signal(struct phy *phy)
> > >  {
> > > struct mtk_mipi_tx *mipi_tx = phy_get_drvdata(phy);
> > > @@ -130,6 +185,8 @@ static void mtk_mipi_tx_power_on_signal(struct phy 
> > > *phy)
> > > RG_DSI_HSTX_LDO_REF_SEL,
> > > (mipi_tx->mipitx_drive - 3000) / 200 << 
> > > 6);
> > >
> > > +   mtk_mipi_tx_config_calibration_data(mipi_tx);
> > > +
> > > mtk_mipi_tx_set_bits(mipi_tx, MIPITX_CK_CKMODE_EN, 
> > > DSI_CK_CKMODE_EN);
> > >  }
> > >
> > > --
> > > 2.21.0
> > > ___
> > > dri-devel mailing list
> > > dri-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 1/4] drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver

2020-04-03 Thread Chun-Kuang Hu
Chunfeng Yun  於 2020年4月3日 週五 上午10:59寫道:
>
> On Thu, 2020-04-02 at 20:49 +0800, Chun-Kuang Hu wrote:
> > Hi, Matthias:
> >
> > Matthias Brugger  於 2020年4月1日 週三 下午11:53寫道:
> > >
> > >
> > >
> > > On 01/04/2020 04:16, Chunfeng Yun wrote:
> > > > On Tue, 2020-03-31 at 23:57 +0800, Chun-Kuang Hu wrote:
> > > >> From: CK Hu 
> > > >>
> > > >> tz_disabled is used to control mtk_hdmi output signal, but this 
> > > >> variable
> > > >> is stored in mtk_hdmi_phy and mtk_hdmi_phy does not use it. So move
> > > >> tz_disabled to mtk_hdmi where it's used.
> > > >>
> > > >> Signed-off-by: CK Hu 
> > > >> Signed-off-by: Chun-Kuang Hu 
> > > >> ---
> > > >>  drivers/gpu/drm/mediatek/mtk_hdmi.c   | 22 ---
> > > >>  drivers/gpu/drm/mediatek/mtk_hdmi_phy.h   |  1 -
> > > >>  .../gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c|  1 -
> > > >>  3 files changed, 19 insertions(+), 5 deletions(-)
> > > >>
> > > >> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> > > >> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> > > >> index 5e4a4dbda443..878433c09c9b 100644
> > > >> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> > > >> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> > > >> @@ -144,11 +144,16 @@ struct hdmi_audio_param {
> > > >>  struct hdmi_codec_params codec_params;
> > > >>  };
> > > >>
> > > >> +struct mtk_hdmi_conf {
> > > >> +bool tz_disabled;
> > > >> +};
> > > >> +
> > > >>  struct mtk_hdmi {
> > > >>  struct drm_bridge bridge;
> > > >>  struct drm_bridge *next_bridge;
> > > >>  struct drm_connector conn;
> > > >>  struct device *dev;
> > > >> +const struct mtk_hdmi_conf *conf;
> > > >>  struct phy *phy;
> > > >>  struct device *cec_dev;
> > > >>  struct i2c_adapter *ddc_adpt;
> > > >> @@ -230,7 +235,6 @@ static void mtk_hdmi_hw_vid_black(struct mtk_hdmi 
> > > >> *hdmi, bool black)
> > > >>  static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool 
> > > >> enable)
> > > >>  {
> > > >>  struct arm_smccc_res res;
> > > >> -struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(hdmi->phy);
> > > >>
> > > >>  /*
> > > >>   * MT8173 HDMI hardware has an output control bit to 
> > > >> enable/disable HDMI
> > > >> @@ -238,7 +242,7 @@ static void mtk_hdmi_hw_make_reg_writable(struct 
> > > >> mtk_hdmi *hdmi, bool enable)
> > > >>   * The ARM trusted firmware provides an API for the HDMI driver 
> > > >> to set
> > > >>   * this control bit to enable HDMI output in supervisor mode.
> > > >>   */
> > > >> -if (hdmi_phy->conf && hdmi_phy->conf->tz_disabled)
> > > >> +if (hdmi->conf->tz_disabled)
> > >
> > > Wouldn't we need to check:
> > > if (hdmi->conf && hdmi->conf->tz_disabled)
> >
> > My design is: hdmi->conf would not be NULL.
> >
> > >
> > > >>  regmap_update_bits(hdmi->sys_regmap,
> > > >> hdmi->sys_offset + HDMI_SYS_CFG20,
> > > >> 0x80008005, enable ? 0x8005 : 
> > > >> 0x8000);
> > > >> @@ -1688,6 +1692,7 @@ static int mtk_drm_hdmi_probe(struct 
> > > >> platform_device *pdev)
> > > >>  return -ENOMEM;
> > > >>
> > > >>  hdmi->dev = dev;
> > > >> +hdmi->conf = of_device_get_match_data(dev);
> > > >>
> > > >>  ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev);
> > > >>  if (ret)
> > > >> @@ -1765,8 +1770,19 @@ static int mtk_hdmi_resume(struct device *dev)
> > > >>  static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops,
> > > >>   mtk_hdmi_suspend, mtk_hdmi_resume);
> > > >>
> > > >> +static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = {
> > > >> +.tz_disabled = true,
> > > >> +};
> > > >> +

Re: [PATCH v12 3/5] clk / soc: mediatek: Move mt8173 MMSYS to platform driver

2020-03-25 Thread Chun-Kuang Hu
Stephen Boyd  於 2020年3月21日 週六 上午7:14寫道:
>
> Quoting Enric Balletbo i Serra (2020-03-11 09:53:20)
> > From: Matthias Brugger 
> >
> > There is no strong reason for this to use CLK_OF_DECLARE instead of
> > being a platform driver. Plus, MMSYS provides clocks but also a shared
> > register space for the mediatek-drm and the mediatek-mdp
> > driver. So move the MMSYS clocks to a new platform driver and also
> > create a new MMSYS platform driver in drivers/soc/mediatek that
> > instantiates the clock driver.
> >
> > Signed-off-by: Matthias Brugger 
> > Signed-off-by: Enric Balletbo i Serra 
> > Reviewed-by: CK Hu 
> > ---
>
> Reviewed-by: Stephen Boyd 
>
> Unless you want me to pick this up by itself?

I would like Matthias to pick up this series together.

> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 3/4] drm/mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek folder

2020-03-31 Thread Chun-Kuang Hu
Hi, Neil:

Neil Armstrong  於 2020年3月31日 週二 下午4:05寫道:
>
> Hi,
>
> On 30/03/2020 16:12, Chun-Kuang Hu wrote:
> > From: CK Hu 
> >
> > mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
> > more suitable to place a phy driver into phy driver folder, so move
> > mtk_hdmi_phy driver into phy driver folder.
>
> Pretty sure the subject should start with "phy: " and have an ack from Kishon.

I would modify the subject in next version and wait for Kishon's ack.

Regards,
Chun-Kuang.

>
> Neil
>
> >
> > Signed-off-by: CK Hu 
> > Signed-off-by: Chun-Kuang Hu 
> > ---
> >  drivers/gpu/drm/mediatek/Kconfig   | 7 ---
> >  drivers/gpu/drm/mediatek/Makefile  | 6 --
> >  drivers/phy/mediatek/Kconfig   | 7 +++
> >  drivers/phy/mediatek/Makefile  | 7 +++
> >  .../mediatek/phy-mtk-hdmi-mt2701.c}| 2 +-
> >  .../mediatek/phy-mtk-hdmi-mt8173.c}| 2 +-
> >  .../mtk_hdmi_phy.c => phy/mediatek/phy-mtk-hdmi.c} | 2 +-
> >  .../mtk_hdmi_phy.h => phy/mediatek/phy-mtk-hdmi.h} | 0
> >  8 files changed, 17 insertions(+), 16 deletions(-)
> >  rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
> > phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
> >  rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
> > phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
> >  rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
> > phy/mediatek/phy-mtk-hdmi.c} (99%)
> >  rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
> > phy/mediatek/phy-mtk-hdmi.h} (100%)
> >
> > diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> > b/drivers/gpu/drm/mediatek/Kconfig
> > index ff6a1eb4ae83..2427d5bf699d 100644
> > --- a/drivers/gpu/drm/mediatek/Kconfig
> > +++ b/drivers/gpu/drm/mediatek/Kconfig
> > @@ -26,10 +26,3 @@ config DRM_MEDIATEK_HDMI
> >   select PHY_MTK_HDMI
> >   help
> > DRM/KMS HDMI driver for Mediatek SoCs
> > -
> > -config PHY_MTK_HDMI
> > -tristate "MediaTek HDMI-PHY Driver"
> > -depends on ARCH_MEDIATEK && OF
> > -select GENERIC_PHY
> > -help
> > -  Enable this to support HDMI-PHY
> > diff --git a/drivers/gpu/drm/mediatek/Makefile 
> > b/drivers/gpu/drm/mediatek/Makefile
> > index fcbef23aa6ce..77b0fd86063d 100644
> > --- a/drivers/gpu/drm/mediatek/Makefile
> > +++ b/drivers/gpu/drm/mediatek/Makefile
> > @@ -22,9 +22,3 @@ mediatek-drm-hdmi-objs := mtk_cec.o \
> > mtk_hdmi_ddc.o
> >
> >  obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
> > -
> > -phy-mtk-hdmi-drv-objs := mtk_hdmi_phy.o \
> > -  mtk_mt2701_hdmi_phy.o \
> > -  mtk_mt8173_hdmi_phy.o
> > -
> > -obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
> > diff --git a/drivers/phy/mediatek/Kconfig b/drivers/phy/mediatek/Kconfig
> > index dee757c957f2..10f0ec2d5b54 100644
> > --- a/drivers/phy/mediatek/Kconfig
> > +++ b/drivers/phy/mediatek/Kconfig
> > @@ -35,3 +35,10 @@ config PHY_MTK_XSPHY
> > Enable this to support the SuperSpeedPlus XS-PHY transceiver for
> > USB3.1 GEN2 controllers on MediaTek chips. The driver supports
> > multiple USB2.0, USB3.1 GEN2 ports.
> > +
> > +config PHY_MTK_HDMI
> > +tristate "MediaTek HDMI-PHY Driver"
> > +depends on ARCH_MEDIATEK && OF
> > +select GENERIC_PHY
> > +help
> > +  Enable this to support HDMI-PHY
> > diff --git a/drivers/phy/mediatek/Makefile b/drivers/phy/mediatek/Makefile
> > index 08a8e6a97b1e..cda074c53235 100644
> > --- a/drivers/phy/mediatek/Makefile
> > +++ b/drivers/phy/mediatek/Makefile
> > @@ -6,3 +6,10 @@
> >  obj-$(CONFIG_PHY_MTK_TPHY)   += phy-mtk-tphy.o
> >  obj-$(CONFIG_PHY_MTK_UFS)+= phy-mtk-ufs.o
> >  obj-$(CONFIG_PHY_MTK_XSPHY)  += phy-mtk-xsphy.o
> > +
> > +phy-mtk-hdmi-drv-objs := phy-mtk-hdmi.o \
> > +  phy-mtk-hdmi-mt2701.o \
> > +  phy-mtk-hdmi-mt8173.o
> > +
> > +obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
> > +
> > diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c 
> > b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
> > similarity index 99%
> > rename from drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
> > rename to drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
>

[PATCH v3 4/4] MAINTAINERS: add files for Mediatek DRM drivers

2020-03-31 Thread Chun-Kuang Hu
Mediatek HDMI phy driver is moved from drivers/gpu/drm/mediatek to
drivers/phy/mediatek, so add the new folder to the Mediatek DRM drivers'
information.

Signed-off-by: Chun-Kuang Hu 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 38fe2f3f7b6f..129777037538 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5612,6 +5612,7 @@ M:Philipp Zabel 
 L: dri-devel@lists.freedesktop.org
 S: Supported
 F: drivers/gpu/drm/mediatek/
+F: drivers/phy/mediatek/phy-mtk-hdmi*
 F: Documentation/devicetree/bindings/display/mediatek/
 
 DRM DRIVERS FOR NVIDIA TEGRA
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 0/4] Move Mediatek HDMI PHY driver from DRM folder to PHY folder

2020-03-31 Thread Chun-Kuang Hu
mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
more suitable to place a phy driver into phy driver folder, so move
mtk_hdmi_phy driver into phy driver folder.

Changes in v3:
- Modify [PATCH v2 3/4] prefix.

Changes in v2:
- include module.h in mtk_hdmi.c

CK Hu (3):
  drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver
  drm/mediatek: Separate mtk_hdmi_phy to an independent module
  phy: mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek
folder

Chun-Kuang Hu (1):
  MAINTAINERS: add files for Mediatek DRM drivers

 MAINTAINERS   |  1 +
 drivers/gpu/drm/mediatek/Kconfig  |  2 +-
 drivers/gpu/drm/mediatek/Makefile |  5 +---
 drivers/gpu/drm/mediatek/mtk_hdmi.c   | 24 +++
 drivers/gpu/drm/mediatek/mtk_hdmi.h   |  1 -
 drivers/phy/mediatek/Kconfig  |  7 ++
 drivers/phy/mediatek/Makefile |  7 ++
 .../mediatek/phy-mtk-hdmi-mt2701.c}   |  3 +--
 .../mediatek/phy-mtk-hdmi-mt8173.c}   |  2 +-
 .../mediatek/phy-mtk-hdmi.c}  |  3 ++-
 .../mediatek/phy-mtk-hdmi.h}  |  2 --
 11 files changed, 41 insertions(+), 16 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi.c} (98%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
phy/mediatek/phy-mtk-hdmi.h} (95%)

-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 1/4] drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver

2020-03-31 Thread Chun-Kuang Hu
From: CK Hu 

tz_disabled is used to control mtk_hdmi output signal, but this variable
is stored in mtk_hdmi_phy and mtk_hdmi_phy does not use it. So move
tz_disabled to mtk_hdmi where it's used.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c   | 22 ---
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h   |  1 -
 .../gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c|  1 -
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 5e4a4dbda443..878433c09c9b 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -144,11 +144,16 @@ struct hdmi_audio_param {
struct hdmi_codec_params codec_params;
 };
 
+struct mtk_hdmi_conf {
+   bool tz_disabled;
+};
+
 struct mtk_hdmi {
struct drm_bridge bridge;
struct drm_bridge *next_bridge;
struct drm_connector conn;
struct device *dev;
+   const struct mtk_hdmi_conf *conf;
struct phy *phy;
struct device *cec_dev;
struct i2c_adapter *ddc_adpt;
@@ -230,7 +235,6 @@ static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, 
bool black)
 static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
 {
struct arm_smccc_res res;
-   struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(hdmi->phy);
 
/*
 * MT8173 HDMI hardware has an output control bit to enable/disable HDMI
@@ -238,7 +242,7 @@ static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi 
*hdmi, bool enable)
 * The ARM trusted firmware provides an API for the HDMI driver to set
 * this control bit to enable HDMI output in supervisor mode.
 */
-   if (hdmi_phy->conf && hdmi_phy->conf->tz_disabled)
+   if (hdmi->conf->tz_disabled)
regmap_update_bits(hdmi->sys_regmap,
   hdmi->sys_offset + HDMI_SYS_CFG20,
   0x80008005, enable ? 0x8005 : 0x8000);
@@ -1688,6 +1692,7 @@ static int mtk_drm_hdmi_probe(struct platform_device 
*pdev)
return -ENOMEM;
 
hdmi->dev = dev;
+   hdmi->conf = of_device_get_match_data(dev);
 
ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev);
if (ret)
@@ -1765,8 +1770,19 @@ static int mtk_hdmi_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops,
 mtk_hdmi_suspend, mtk_hdmi_resume);
 
+static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = {
+   .tz_disabled = true,
+};
+
+static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8173;
+
 static const struct of_device_id mtk_drm_hdmi_of_ids[] = {
-   { .compatible = "mediatek,mt8173-hdmi", },
+   { .compatible = "mediatek,mt2701-hdmi",
+ .data = _hdmi_conf_mt2701,
+   },
+   { .compatible = "mediatek,mt8173-hdmi",
+ .data = _hdmi_conf_mt8173,
+   },
{}
 };
 
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
index 2d8b3182470d..fc1c2efd1128 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
@@ -20,7 +20,6 @@
 struct mtk_hdmi_phy;
 
 struct mtk_hdmi_phy_conf {
-   bool tz_disabled;
unsigned long flags;
const struct clk_ops *hdmi_phy_clk_ops;
void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c 
b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
index d3cc4022e988..99fe05cd3598 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
+++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
@@ -237,7 +237,6 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy 
*hdmi_phy)
 }
 
 struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = {
-   .tz_disabled = true,
.flags = CLK_SET_RATE_GATE,
.hdmi_phy_clk_ops = _hdmi_phy_pll_ops,
.hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 3/4] phy: mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek folder

2020-03-31 Thread Chun-Kuang Hu
From: CK Hu 

mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
more suitable to place a phy driver into phy driver folder, so move
mtk_hdmi_phy driver into phy driver folder.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/Kconfig   | 7 ---
 drivers/gpu/drm/mediatek/Makefile  | 6 --
 drivers/phy/mediatek/Kconfig   | 7 +++
 drivers/phy/mediatek/Makefile  | 7 +++
 .../mediatek/phy-mtk-hdmi-mt2701.c}| 2 +-
 .../mediatek/phy-mtk-hdmi-mt8173.c}| 2 +-
 .../mtk_hdmi_phy.c => phy/mediatek/phy-mtk-hdmi.c} | 2 +-
 .../mtk_hdmi_phy.h => phy/mediatek/phy-mtk-hdmi.h} | 0
 8 files changed, 17 insertions(+), 16 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
phy/mediatek/phy-mtk-hdmi.h} (100%)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index ff6a1eb4ae83..2427d5bf699d 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -26,10 +26,3 @@ config DRM_MEDIATEK_HDMI
select PHY_MTK_HDMI
help
  DRM/KMS HDMI driver for Mediatek SoCs
-
-config PHY_MTK_HDMI
-tristate "MediaTek HDMI-PHY Driver"
-depends on ARCH_MEDIATEK && OF
-select GENERIC_PHY
-help
-  Enable this to support HDMI-PHY
diff --git a/drivers/gpu/drm/mediatek/Makefile 
b/drivers/gpu/drm/mediatek/Makefile
index fcbef23aa6ce..77b0fd86063d 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -22,9 +22,3 @@ mediatek-drm-hdmi-objs := mtk_cec.o \
  mtk_hdmi_ddc.o
 
 obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
-
-phy-mtk-hdmi-drv-objs := mtk_hdmi_phy.o \
-mtk_mt2701_hdmi_phy.o \
-mtk_mt8173_hdmi_phy.o
-
-obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
diff --git a/drivers/phy/mediatek/Kconfig b/drivers/phy/mediatek/Kconfig
index dee757c957f2..10f0ec2d5b54 100644
--- a/drivers/phy/mediatek/Kconfig
+++ b/drivers/phy/mediatek/Kconfig
@@ -35,3 +35,10 @@ config PHY_MTK_XSPHY
  Enable this to support the SuperSpeedPlus XS-PHY transceiver for
  USB3.1 GEN2 controllers on MediaTek chips. The driver supports
  multiple USB2.0, USB3.1 GEN2 ports.
+
+config PHY_MTK_HDMI
+tristate "MediaTek HDMI-PHY Driver"
+depends on ARCH_MEDIATEK && OF
+select GENERIC_PHY
+help
+  Enable this to support HDMI-PHY
diff --git a/drivers/phy/mediatek/Makefile b/drivers/phy/mediatek/Makefile
index 08a8e6a97b1e..cda074c53235 100644
--- a/drivers/phy/mediatek/Makefile
+++ b/drivers/phy/mediatek/Makefile
@@ -6,3 +6,10 @@
 obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o
 obj-$(CONFIG_PHY_MTK_UFS)  += phy-mtk-ufs.o
 obj-$(CONFIG_PHY_MTK_XSPHY)+= phy-mtk-xsphy.o
+
+phy-mtk-hdmi-drv-objs := phy-mtk-hdmi.o \
+phy-mtk-hdmi-mt2701.o \
+phy-mtk-hdmi-mt8173.o
+
+obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
+
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
index 99fe05cd3598..a6cb1dea3d0c 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
@@ -4,7 +4,7 @@
  * Author: Chunhui Dai 
  */
 
-#include "mtk_hdmi_phy.h"
+#include "phy-mtk-hdmi.h"
 
 #define HDMI_CON0  0x00
 #define RG_HDMITX_DRV_IBIAS0
diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
index b55f51675205..3521c4893c53 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
@@ -4,7 +4,7 @@
  * Author: Jie Qiu 
  */
 
-#include "mtk_hdmi_phy.h"
+#include "phy-mtk-hdmi.h"
 
 #define HDMI_CON0  0x00
 #define RG_HDMITX_PLL_EN   BIT(31)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi.c
index fe022acddbef..8fc83f01a720 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
+++ b/drivers/phy

[PATCH v3 2/4] drm/mediatek: Separate mtk_hdmi_phy to an independent module

2020-03-31 Thread Chun-Kuang Hu
From: CK Hu 

mtk_hdmi_phy is a part of mtk_hdmi module, but phy driver should be an
independent module rather than be part of drm module, so separate the phy
driver to an independent module.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/Kconfig|  9 -
 drivers/gpu/drm/mediatek/Makefile   | 11 +++
 drivers/gpu/drm/mediatek/mtk_hdmi.c |  2 +-
 drivers/gpu/drm/mediatek/mtk_hdmi.h |  1 -
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |  1 +
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h |  1 -
 6 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index fa5ffc4fe823..ff6a1eb4ae83 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -23,6 +23,13 @@ config DRM_MEDIATEK_HDMI
tristate "DRM HDMI Support for Mediatek SoCs"
depends on DRM_MEDIATEK
select SND_SOC_HDMI_CODEC if SND_SOC
-   select GENERIC_PHY
+   select PHY_MTK_HDMI
help
  DRM/KMS HDMI driver for Mediatek SoCs
+
+config PHY_MTK_HDMI
+tristate "MediaTek HDMI-PHY Driver"
+depends on ARCH_MEDIATEK && OF
+select GENERIC_PHY
+help
+  Enable this to support HDMI-PHY
diff --git a/drivers/gpu/drm/mediatek/Makefile 
b/drivers/gpu/drm/mediatek/Makefile
index b7a82ed5788f..fcbef23aa6ce 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -19,9 +19,12 @@ obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o
 
 mediatek-drm-hdmi-objs := mtk_cec.o \
  mtk_hdmi.o \
- mtk_hdmi_ddc.o \
- mtk_mt2701_hdmi_phy.o \
- mtk_mt8173_hdmi_phy.o \
- mtk_hdmi_phy.o
+ mtk_hdmi_ddc.o
 
 obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
+
+phy-mtk-hdmi-drv-objs := mtk_hdmi_phy.o \
+mtk_mt2701_hdmi_phy.o \
+mtk_mt8173_hdmi_phy.o
+
+obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 878433c09c9b..ee72ece0e54d 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1797,7 +1798,6 @@ static struct platform_driver mtk_hdmi_driver = {
 };
 
 static struct platform_driver * const mtk_hdmi_drivers[] = {
-   _hdmi_phy_driver,
_hdmi_ddc_driver,
_cec_driver,
_hdmi_driver,
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi.h
index bb3653de6bd1..472bf141c92b 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.h
@@ -5,7 +5,6 @@
  */
 #ifndef _MTK_HDMI_CTRL_H
 #define _MTK_HDMI_CTRL_H
-#include "mtk_hdmi_phy.h"
 
 struct platform_driver;
 
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
index 5223498502c4..fe022acddbef 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
@@ -205,6 +205,7 @@ struct platform_driver mtk_hdmi_phy_driver = {
.of_match_table = mtk_hdmi_phy_match,
},
 };
+module_platform_driver(mtk_hdmi_phy_driver);
 
 MODULE_DESCRIPTION("MediaTek HDMI PHY Driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
index fc1c2efd1128..b13e1d5f8e78 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
@@ -49,7 +49,6 @@ void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 
offset,
   u32 val, u32 mask);
 struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw);
 
-extern struct platform_driver mtk_hdmi_phy_driver;
 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf;
 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf;
 
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 1/4] drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver

2020-03-30 Thread Chun-Kuang Hu
From: CK Hu 

tz_disabled is used to control mtk_hdmi output signal, but this variable
is stored in mtk_hdmi_phy and mtk_hdmi_phy does not use it. So move
tz_disabled to mtk_hdmi where it's used.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c   | 22 ---
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h   |  1 -
 .../gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c|  1 -
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 5e4a4dbda443..878433c09c9b 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -144,11 +144,16 @@ struct hdmi_audio_param {
struct hdmi_codec_params codec_params;
 };
 
+struct mtk_hdmi_conf {
+   bool tz_disabled;
+};
+
 struct mtk_hdmi {
struct drm_bridge bridge;
struct drm_bridge *next_bridge;
struct drm_connector conn;
struct device *dev;
+   const struct mtk_hdmi_conf *conf;
struct phy *phy;
struct device *cec_dev;
struct i2c_adapter *ddc_adpt;
@@ -230,7 +235,6 @@ static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, 
bool black)
 static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
 {
struct arm_smccc_res res;
-   struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(hdmi->phy);
 
/*
 * MT8173 HDMI hardware has an output control bit to enable/disable HDMI
@@ -238,7 +242,7 @@ static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi 
*hdmi, bool enable)
 * The ARM trusted firmware provides an API for the HDMI driver to set
 * this control bit to enable HDMI output in supervisor mode.
 */
-   if (hdmi_phy->conf && hdmi_phy->conf->tz_disabled)
+   if (hdmi->conf->tz_disabled)
regmap_update_bits(hdmi->sys_regmap,
   hdmi->sys_offset + HDMI_SYS_CFG20,
   0x80008005, enable ? 0x8005 : 0x8000);
@@ -1688,6 +1692,7 @@ static int mtk_drm_hdmi_probe(struct platform_device 
*pdev)
return -ENOMEM;
 
hdmi->dev = dev;
+   hdmi->conf = of_device_get_match_data(dev);
 
ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev);
if (ret)
@@ -1765,8 +1770,19 @@ static int mtk_hdmi_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops,
 mtk_hdmi_suspend, mtk_hdmi_resume);
 
+static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = {
+   .tz_disabled = true,
+};
+
+static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8173;
+
 static const struct of_device_id mtk_drm_hdmi_of_ids[] = {
-   { .compatible = "mediatek,mt8173-hdmi", },
+   { .compatible = "mediatek,mt2701-hdmi",
+ .data = _hdmi_conf_mt2701,
+   },
+   { .compatible = "mediatek,mt8173-hdmi",
+ .data = _hdmi_conf_mt8173,
+   },
{}
 };
 
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
index 2d8b3182470d..fc1c2efd1128 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
@@ -20,7 +20,6 @@
 struct mtk_hdmi_phy;
 
 struct mtk_hdmi_phy_conf {
-   bool tz_disabled;
unsigned long flags;
const struct clk_ops *hdmi_phy_clk_ops;
void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c 
b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
index d3cc4022e988..99fe05cd3598 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
+++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
@@ -237,7 +237,6 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy 
*hdmi_phy)
 }
 
 struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = {
-   .tz_disabled = true,
.flags = CLK_SET_RATE_GATE,
.hdmi_phy_clk_ops = _hdmi_phy_pll_ops,
.hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 4/4] MAINTAINERS: add files for Mediatek DRM drivers

2020-03-30 Thread Chun-Kuang Hu
Mediatek HDMI phy driver is moved from drivers/gpu/drm/mediatek to
drivers/phy/mediatek, so add the new folder to the Mediatek DRM drivers'
information.

Signed-off-by: Chun-Kuang Hu 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 38fe2f3f7b6f..129777037538 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5612,6 +5612,7 @@ M:Philipp Zabel 
 L: dri-devel@lists.freedesktop.org
 S: Supported
 F: drivers/gpu/drm/mediatek/
+F: drivers/phy/mediatek/phy-mtk-hdmi*
 F: Documentation/devicetree/bindings/display/mediatek/
 
 DRM DRIVERS FOR NVIDIA TEGRA
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 0/4] Move Mediatek HDMI PHY driver from DRM folder to PHY folder

2020-03-30 Thread Chun-Kuang Hu
mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
more suitable to place a phy driver into phy driver folder, so move
mtk_hdmi_phy driver into phy driver folder.

Changes in v2:
- include module.h in mtk_hdmi.c

CK Hu (3):
  drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver
  drm/mediatek: Separate mtk_hdmi_phy to an independent module
  drm/mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek
folder

Chun-Kuang Hu (1):
  MAINTAINERS: add files for Mediatek DRM drivers

 MAINTAINERS   |  1 +
 drivers/gpu/drm/mediatek/Kconfig  |  2 +-
 drivers/gpu/drm/mediatek/Makefile |  5 +---
 drivers/gpu/drm/mediatek/mtk_hdmi.c   | 24 +++
 drivers/gpu/drm/mediatek/mtk_hdmi.h   |  1 -
 drivers/phy/mediatek/Kconfig  |  7 ++
 drivers/phy/mediatek/Makefile |  7 ++
 .../mediatek/phy-mtk-hdmi-mt2701.c}   |  3 +--
 .../mediatek/phy-mtk-hdmi-mt8173.c}   |  2 +-
 .../mediatek/phy-mtk-hdmi.c}  |  3 ++-
 .../mediatek/phy-mtk-hdmi.h}  |  2 --
 11 files changed, 41 insertions(+), 16 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi.c} (98%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
phy/mediatek/phy-mtk-hdmi.h} (95%)

-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 2/4] drm/mediatek: Separate mtk_hdmi_phy to an independent module

2020-03-30 Thread Chun-Kuang Hu
From: CK Hu 

mtk_hdmi_phy is a part of mtk_hdmi module, but phy driver should be an
independent module rather than be part of drm module, so separate the phy
driver to an independent module.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/Kconfig|  9 -
 drivers/gpu/drm/mediatek/Makefile   | 11 +++
 drivers/gpu/drm/mediatek/mtk_hdmi.c |  2 +-
 drivers/gpu/drm/mediatek/mtk_hdmi.h |  1 -
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |  1 +
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h |  1 -
 6 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index fa5ffc4fe823..ff6a1eb4ae83 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -23,6 +23,13 @@ config DRM_MEDIATEK_HDMI
tristate "DRM HDMI Support for Mediatek SoCs"
depends on DRM_MEDIATEK
select SND_SOC_HDMI_CODEC if SND_SOC
-   select GENERIC_PHY
+   select PHY_MTK_HDMI
help
  DRM/KMS HDMI driver for Mediatek SoCs
+
+config PHY_MTK_HDMI
+tristate "MediaTek HDMI-PHY Driver"
+depends on ARCH_MEDIATEK && OF
+select GENERIC_PHY
+help
+  Enable this to support HDMI-PHY
diff --git a/drivers/gpu/drm/mediatek/Makefile 
b/drivers/gpu/drm/mediatek/Makefile
index b7a82ed5788f..fcbef23aa6ce 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -19,9 +19,12 @@ obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o
 
 mediatek-drm-hdmi-objs := mtk_cec.o \
  mtk_hdmi.o \
- mtk_hdmi_ddc.o \
- mtk_mt2701_hdmi_phy.o \
- mtk_mt8173_hdmi_phy.o \
- mtk_hdmi_phy.o
+ mtk_hdmi_ddc.o
 
 obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
+
+phy-mtk-hdmi-drv-objs := mtk_hdmi_phy.o \
+mtk_mt2701_hdmi_phy.o \
+mtk_mt8173_hdmi_phy.o
+
+obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 878433c09c9b..ee72ece0e54d 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1797,7 +1798,6 @@ static struct platform_driver mtk_hdmi_driver = {
 };
 
 static struct platform_driver * const mtk_hdmi_drivers[] = {
-   _hdmi_phy_driver,
_hdmi_ddc_driver,
_cec_driver,
_hdmi_driver,
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi.h
index bb3653de6bd1..472bf141c92b 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.h
@@ -5,7 +5,6 @@
  */
 #ifndef _MTK_HDMI_CTRL_H
 #define _MTK_HDMI_CTRL_H
-#include "mtk_hdmi_phy.h"
 
 struct platform_driver;
 
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
index 5223498502c4..fe022acddbef 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
@@ -205,6 +205,7 @@ struct platform_driver mtk_hdmi_phy_driver = {
.of_match_table = mtk_hdmi_phy_match,
},
 };
+module_platform_driver(mtk_hdmi_phy_driver);
 
 MODULE_DESCRIPTION("MediaTek HDMI PHY Driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
index fc1c2efd1128..b13e1d5f8e78 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
@@ -49,7 +49,6 @@ void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 
offset,
   u32 val, u32 mask);
 struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw);
 
-extern struct platform_driver mtk_hdmi_phy_driver;
 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf;
 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf;
 
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 3/4] drm/mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek folder

2020-03-30 Thread Chun-Kuang Hu
From: CK Hu 

mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
more suitable to place a phy driver into phy driver folder, so move
mtk_hdmi_phy driver into phy driver folder.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/Kconfig   | 7 ---
 drivers/gpu/drm/mediatek/Makefile  | 6 --
 drivers/phy/mediatek/Kconfig   | 7 +++
 drivers/phy/mediatek/Makefile  | 7 +++
 .../mediatek/phy-mtk-hdmi-mt2701.c}| 2 +-
 .../mediatek/phy-mtk-hdmi-mt8173.c}| 2 +-
 .../mtk_hdmi_phy.c => phy/mediatek/phy-mtk-hdmi.c} | 2 +-
 .../mtk_hdmi_phy.h => phy/mediatek/phy-mtk-hdmi.h} | 0
 8 files changed, 17 insertions(+), 16 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
phy/mediatek/phy-mtk-hdmi.h} (100%)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index ff6a1eb4ae83..2427d5bf699d 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -26,10 +26,3 @@ config DRM_MEDIATEK_HDMI
select PHY_MTK_HDMI
help
  DRM/KMS HDMI driver for Mediatek SoCs
-
-config PHY_MTK_HDMI
-tristate "MediaTek HDMI-PHY Driver"
-depends on ARCH_MEDIATEK && OF
-select GENERIC_PHY
-help
-  Enable this to support HDMI-PHY
diff --git a/drivers/gpu/drm/mediatek/Makefile 
b/drivers/gpu/drm/mediatek/Makefile
index fcbef23aa6ce..77b0fd86063d 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -22,9 +22,3 @@ mediatek-drm-hdmi-objs := mtk_cec.o \
  mtk_hdmi_ddc.o
 
 obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
-
-phy-mtk-hdmi-drv-objs := mtk_hdmi_phy.o \
-mtk_mt2701_hdmi_phy.o \
-mtk_mt8173_hdmi_phy.o
-
-obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
diff --git a/drivers/phy/mediatek/Kconfig b/drivers/phy/mediatek/Kconfig
index dee757c957f2..10f0ec2d5b54 100644
--- a/drivers/phy/mediatek/Kconfig
+++ b/drivers/phy/mediatek/Kconfig
@@ -35,3 +35,10 @@ config PHY_MTK_XSPHY
  Enable this to support the SuperSpeedPlus XS-PHY transceiver for
  USB3.1 GEN2 controllers on MediaTek chips. The driver supports
  multiple USB2.0, USB3.1 GEN2 ports.
+
+config PHY_MTK_HDMI
+tristate "MediaTek HDMI-PHY Driver"
+depends on ARCH_MEDIATEK && OF
+select GENERIC_PHY
+help
+  Enable this to support HDMI-PHY
diff --git a/drivers/phy/mediatek/Makefile b/drivers/phy/mediatek/Makefile
index 08a8e6a97b1e..cda074c53235 100644
--- a/drivers/phy/mediatek/Makefile
+++ b/drivers/phy/mediatek/Makefile
@@ -6,3 +6,10 @@
 obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o
 obj-$(CONFIG_PHY_MTK_UFS)  += phy-mtk-ufs.o
 obj-$(CONFIG_PHY_MTK_XSPHY)+= phy-mtk-xsphy.o
+
+phy-mtk-hdmi-drv-objs := phy-mtk-hdmi.o \
+phy-mtk-hdmi-mt2701.o \
+phy-mtk-hdmi-mt8173.o
+
+obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
+
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
index 99fe05cd3598..a6cb1dea3d0c 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
@@ -4,7 +4,7 @@
  * Author: Chunhui Dai 
  */
 
-#include "mtk_hdmi_phy.h"
+#include "phy-mtk-hdmi.h"
 
 #define HDMI_CON0  0x00
 #define RG_HDMITX_DRV_IBIAS0
diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
index b55f51675205..3521c4893c53 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
@@ -4,7 +4,7 @@
  * Author: Jie Qiu 
  */
 
-#include "mtk_hdmi_phy.h"
+#include "phy-mtk-hdmi.h"
 
 #define HDMI_CON0  0x00
 #define RG_HDMITX_PLL_EN   BIT(31)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi.c
index fe022acddbef..8fc83f01a720 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
+++ b/drivers/phy

Re: [PATCH -next] drm/mediatek: Fix Kconfig warning

2020-04-28 Thread Chun-Kuang Hu
Daniel Vetter  於 2020年4月28日 週二 下午10:55寫道:
>
> On Sun, Apr 26, 2020 at 04:20:39PM +0800, Chun-Kuang Hu wrote:
> > Hi, YueHaibing:
> >
> > YueHaibing  於 2020年4月20日 週一 下午10:04寫道:
> > >
> > > WARNING: unmet direct dependencies detected for MTK_MMSYS
> > >   Depends on [n]: (ARCH_MEDIATEK [=y] || COMPILE_TEST [=n]) && 
> > > COMMON_CLK_MT8173_MMSYS [=n]
> > >   Selected by [y]:
> > >   - DRM_MEDIATEK [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_MEDIATEK 
> > > [=y] || ARM && COMPILE_TEST [=n]) && COMMON_CLK [=y] && HAVE_ARM_SMCCC 
> > > [=y] && OF [=y]
> > >
> > > Add missing dependcy COMMON_CLK_MT8173_MMSYS to fix this.
> >
> > From the code relationship, mediatek drm has relation with mediatek
> > mmsys, and mediatek mmsys has relation with medaitek clock.
> > So I think it's better that CONFIG_MTK_MMSYS select
> > CONFIG_COMMON_CLK_MT8173_MMSYS.
>
> select is very strongly discouraged and should only be used for Kconfig
> symbols not visible to users.

Okay, maybe the better solution is that DRM_MEDIATEK depend on MTK_MMSYS.

Regards,
Chun-Kuang.

> -Daniel
>
> >
> > Regards,
> > Chun-Kuang.
> >
> > >
> > > Fixes: 2c758e301ed9 ("soc / drm: mediatek: Move routing control to mmsys 
> > > device")
> > > Signed-off-by: YueHaibing 
> > > ---
> > >  drivers/gpu/drm/mediatek/Kconfig | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> > > b/drivers/gpu/drm/mediatek/Kconfig
> > > index c420f5a3d33b..4d9b5540de68 100644
> > > --- a/drivers/gpu/drm/mediatek/Kconfig
> > > +++ b/drivers/gpu/drm/mediatek/Kconfig
> > > @@ -6,6 +6,7 @@ config DRM_MEDIATEK
> > > depends on COMMON_CLK
> > > depends on HAVE_ARM_SMCCC
> > > depends on OF
> > > +   depends on COMMON_CLK_MT8173_MMSYS
> > > select DRM_GEM_CMA_HELPER
> > > select DRM_KMS_HELPER
> > > select DRM_MIPI_DSI
> > > --
> > > 2.17.1
> > >
> > >
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0

2020-04-28 Thread Chun-Kuang Hu
Hi, Anand,

Anand K. Mistry  於 2020年4月28日 週二 上午9:54寫道:
>
> On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu  wrote:
> >
> > Hi, Anand:
> >
> > Anand K Mistry  於 2020年4月20日 週一 下午2:09寫道:
> > >
> > > If dma_map_sg() merges pages when creating the mapping, only the first
> > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > > entries with sg_dma_len() == 0.
> > >
> > > Signed-off-by: Anand K Mistry 
> > > ---
> > >  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> > > b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > @@ -224,6 +224,9 @@ struct drm_gem_object 
> > > *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > >
> > > expected = sg_dma_address(sg->sgl);
> > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > +   if (!sg_dma_len(s))
> > > +   break;
> >
> > I think this should be 'continue'
>
> scatterlist.h has the comment:
> /*
>  * These macros should be used after a dma_map_sg call has been done
>  * to get bus addresses of each of the SG entries and their lengths.
>  * You should only work with the number of sg entries dma_map_sg
>  * returns, or alternatively stop on the first sg_dma_len(sg) which
>  * is 0.
>  */
>
> So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> the documented approach.
>

Okay, you're right. So

Reviewed-by: Chun-Kuang Hu 

> >
> > Regards,
> > Chun-Kuang.
> >
> > > +
> > > if (sg_dma_address(s) != expected) {
> > > DRM_ERROR("sg_table is not contiguous");
> > > ret = -EINVAL;
> > > --
> > > 2.26.1.301.g55bc3eb7cb9-goog
> > >
> > >
> > > ___
> > > Linux-mediatek mailing list
> > > linux-media...@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0

2020-04-26 Thread Chun-Kuang Hu
Hi, Anand:

Anand K Mistry  於 2020年4月20日 週一 下午2:09寫道:
>
> If dma_map_sg() merges pages when creating the mapping, only the first
> entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> entries with sg_dma_len() == 0.
>
> Signed-off-by: Anand K Mistry 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index b04a3c2b111e09..f8fd8b98c30e3d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -224,6 +224,9 @@ struct drm_gem_object 
> *mtk_gem_prime_import_sg_table(struct drm_device *dev,
>
> expected = sg_dma_address(sg->sgl);
> for_each_sg(sg->sgl, s, sg->nents, i) {
> +   if (!sg_dma_len(s))
> +   break;

I think this should be 'continue'

Regards,
Chun-Kuang.

> +
> if (sg_dma_address(s) != expected) {
> DRM_ERROR("sg_table is not contiguous");
> ret = -EINVAL;
> --
> 2.26.1.301.g55bc3eb7cb9-goog
>
>
> ___
> Linux-mediatek mailing list
> linux-media...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH -next] drm/mediatek: Fix Kconfig warning

2020-04-26 Thread Chun-Kuang Hu
Hi, YueHaibing:

YueHaibing  於 2020年4月20日 週一 下午10:04寫道:
>
> WARNING: unmet direct dependencies detected for MTK_MMSYS
>   Depends on [n]: (ARCH_MEDIATEK [=y] || COMPILE_TEST [=n]) && 
> COMMON_CLK_MT8173_MMSYS [=n]
>   Selected by [y]:
>   - DRM_MEDIATEK [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_MEDIATEK [=y] || 
> ARM && COMPILE_TEST [=n]) && COMMON_CLK [=y] && HAVE_ARM_SMCCC [=y] && OF [=y]
>
> Add missing dependcy COMMON_CLK_MT8173_MMSYS to fix this.

From the code relationship, mediatek drm has relation with mediatek
mmsys, and mediatek mmsys has relation with medaitek clock.
So I think it's better that CONFIG_MTK_MMSYS select
CONFIG_COMMON_CLK_MT8173_MMSYS.

Regards,
Chun-Kuang.

>
> Fixes: 2c758e301ed9 ("soc / drm: mediatek: Move routing control to mmsys 
> device")
> Signed-off-by: YueHaibing 
> ---
>  drivers/gpu/drm/mediatek/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> b/drivers/gpu/drm/mediatek/Kconfig
> index c420f5a3d33b..4d9b5540de68 100644
> --- a/drivers/gpu/drm/mediatek/Kconfig
> +++ b/drivers/gpu/drm/mediatek/Kconfig
> @@ -6,6 +6,7 @@ config DRM_MEDIATEK
> depends on COMMON_CLK
> depends on HAVE_ARM_SMCCC
> depends on OF
> +   depends on COMMON_CLK_MT8173_MMSYS
> select DRM_GEM_CMA_HELPER
> select DRM_KMS_HELPER
> select DRM_MIPI_DSI
> --
> 2.17.1
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: Remove debug messages for function calls

2020-04-25 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年2月26日 週三 下午7:27寫道:
>
> Equivalent information can be nowadays obtained using function tracer.

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 5 -
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 2 --
>  2 files changed, 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index a236499123aa..882c690d3f13 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -192,7 +192,6 @@ static int mtk_crtc_ddp_clk_enable(struct mtk_drm_crtc 
> *mtk_crtc)
> int ret;
> int i;
>
> -   DRM_DEBUG_DRIVER("%s\n", __func__);
> for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
> ret = clk_prepare_enable(mtk_crtc->ddp_comp[i]->clk);
> if (ret) {
> @@ -212,7 +211,6 @@ static void mtk_crtc_ddp_clk_disable(struct mtk_drm_crtc 
> *mtk_crtc)
>  {
> int i;
>
> -   DRM_DEBUG_DRIVER("%s\n", __func__);
> for (i = 0; i < mtk_crtc->ddp_comp_nr; i++)
> clk_disable_unprepare(mtk_crtc->ddp_comp[i]->clk);
>  }
> @@ -257,7 +255,6 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
> *mtk_crtc)
> int ret;
> int i;
>
> -   DRM_DEBUG_DRIVER("%s\n", __func__);
> if (WARN_ON(!crtc->state))
> return -EINVAL;
>
> @@ -298,7 +295,6 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
> *mtk_crtc)
> goto err_mutex_unprepare;
> }
>
> -   DRM_DEBUG_DRIVER("mediatek_ddp_ddp_path_setup\n");
> for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
> mtk_ddp_add_comp_to_path(mtk_crtc->config_regs,
>  mtk_crtc->ddp_comp[i]->id,
> @@ -348,7 +344,6 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc 
> *mtk_crtc)
> struct drm_crtc *crtc = _crtc->base;
> int i;
>
> -   DRM_DEBUG_DRIVER("%s\n", __func__);
> for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
> mtk_ddp_comp_stop(mtk_crtc->ddp_comp[i]);
> if (i == 1)
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 17f118ee0e57..4934834977b3 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -570,7 +570,6 @@ static int mtk_drm_sys_suspend(struct device *dev)
> int ret;
>
> ret = drm_mode_config_helper_suspend(drm);
> -   DRM_DEBUG_DRIVER("mtk_drm_sys_suspend\n");
>
> return ret;
>  }
> @@ -582,7 +581,6 @@ static int mtk_drm_sys_resume(struct device *dev)
> int ret;
>
> ret = drm_mode_config_helper_resume(drm);
> -   DRM_DEBUG_DRIVER("mtk_drm_sys_resume\n");
>
> return ret;
>  }
> --
> 2.25.0
>
>
> ___
> Linux-mediatek mailing list
> linux-media...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6 0/4] Config mipi tx current and impedance

2020-04-21 Thread Chun-Kuang Hu
Hi, Jitao:

For this series, applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

Jitao Shi  於 2020年4月11日 週六 下午3:44寫道:
>
> Changes since v5:
>  - remove memset()
>  - add return to remove "else"
>
> Changes since v4:
>  - add Reviewed-by:
>  - move the get the calibration data code to probe.
>
> Changes since v3:
>  - refine drive-strength-microamp as from 3000 to 6000.
>
> Changes since v2:
>  - fix the title of commit message.
>  - rename mipitx-current-drive to drive-strength-microamp
>
> Changes since v1:
>  - fix coding style.
>  - change mtk_mipi_tx_config_calibration_data() to void
>
> Jitao Shi (4):
>   dt-bindings: display: mediatek: add property to control mipi tx drive
> current
>   dt-bindings: display: mediatek: get mipitx calibration data from nvmem
>   drm/mediatek: add the mipitx driving control
>   drm/mediatek: config mipitx impedance with calibration data
>
>  .../display/mediatek/mediatek,dsi.txt | 10 
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.c| 54 +++
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.h|  4 ++
>  drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c | 28 ++
>  4 files changed, 96 insertions(+)
>
> --
> 2.21.0
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v15 2/3] dt-bindings: display: mediatek: convert the document format from txt to yaml

2020-04-21 Thread Chun-Kuang Hu
Hi, Jitao:

Please fixup these checkpatch warnings.

WARNING: Missing commit description - Add an appropriate one
WARNING: DT binding docs and includes should be a separate patch. See:
Documentation/devicetree/bindings/submitting-patches.txt
WARNING: DT binding docs and includes should be a separate patch. See:
Documentation/devicetree/bindings/submitting-patches.txt
WARNING: DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)
#71: FILE: 
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml:1:
+# SPDX-License-Identifier: GPL-2.0

Regards,
Chun-Kuang.

Jitao Shi  於 2020年4月15日 週三 上午9:13寫道:
>
> Signed-off-by: Jitao Shi 
> ---
>  .../bindings/display/mediatek/mediatek,dpi.txt | 42 --
>  .../bindings/display/mediatek/mediatek,dpi.yaml| 97 
> ++
>  2 files changed, 97 insertions(+), 42 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
>  create mode 100644 
> Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml
>
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> deleted file mode 100644
> index 77def4456706..
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -Mediatek DPI Device
> -===
> -
> -The Mediatek DPI function block is a sink of the display subsystem and
> -provides 8-bit RGB/YUV444 or 8/10/10-bit YUV422 pixel data on a parallel
> -output bus.
> -
> -Required properties:
> -- compatible: "mediatek,-dpi"
> -  the supported chips are mt2701 , mt8173 and mt8183.
> -- reg: Physical base address and length of the controller's registers
> -- interrupts: The interrupt signal from the function block.
> -- clocks: device clocks
> -  See Documentation/devicetree/bindings/clock/clock-bindings.txt for details.
> -- clock-names: must contain "pixel", "engine", and "pll"
> -- port: Output port node with endpoint definitions as described in
> -  Documentation/devicetree/bindings/graph.txt. This port should be connected
> -  to the input port of an attached HDMI or LVDS encoder chip.
> -
> -Optional properties:
> -- pinctrl-names: Contain "default" and "sleep".
> -
> -Example:
> -
> -dpi0: dpi@1401d000 {
> -   compatible = "mediatek,mt8173-dpi";
> -   reg = <0 0x1401d000 0 0x1000>;
> -   interrupts = ;
> -   clocks = < CLK_MM_DPI_PIXEL>,
> -< CLK_MM_DPI_ENGINE>,
> -< CLK_APMIXED_TVDPLL>;
> -   clock-names = "pixel", "engine", "pll";
> -   pinctrl-names = "default", "sleep";
> -   pinctrl-0 = <_pin_func>;
> -   pinctrl-1 = <_pin_idle>;
> -
> -   port {
> -   dpi0_out: endpoint {
> -   remote-endpoint = <_in>;
> -   };
> -   };
> -};
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml
> new file mode 100644
> index ..2c2d6a71cb8b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml
> @@ -0,0 +1,97 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/mediatek/mediatek,dpi.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: mediatek DPI Controller Device Tree Bindings
> +
> +maintainers:
> +  - CK Hu 
> +  - Jitao shi 
> +
> +description: |
> +  The Mediatek DPI function block is a sink of the display subsystem and
> +  provides 8-bit RGB/YUV444 or 8/10/10-bit YUV422 pixel data on a parallel
> +  output bus.
> +
> +properties:
> +  compatible:
> +enum:
> +  - mediatek,mt2701-dpi
> +  - mediatek,mt8173-dpi
> +  - mediatek,mt8183-dpi
> +
> +  reg:
> +maxItems: 1
> +
> +  interrupts:
> +maxItems: 1
> +
> +  clocks:
> +items:
> +  - description: Pixel Clock
> +  - description: Engine Clock
> +  - description: DPI PLL
> +
> +  clock-names:
> +items:
> +  - const: pixel
> +  - const: engine
> +  - const: pll
> +
> +  pinctrl-0: true
> +  pinctrl-1: true
> +
> +  pinctrl-names:
> +items:
> +  - const: default
> +  - const: sleep
> +
> +  port:
> +type: object
> +description:
> +  Output port node with endpoint definitions as described in
> +  Documentation/devicetree/bindings/graph.txt. This port should be 
> connected
> +  to the input port of an attached HDMI or LVDS encoder chip.
> +
> +properties:
> +  endpoint:
> +type: object
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +  - clock-names
> +  - port
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +#include 
> +#include 
> +#include 
> +#include 
> +dpi0: dpi@1401d000 {
> +compatible = "mediatek,mt8173-dpi";

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-04-21 Thread Chun-Kuang Hu
Hi, Matthias:

Matthias Brugger  於 2020年4月21日 週二 下午5:31寫道:
>
>
>
> On 4/16/20 6:22 PM, Chun-Kuang Hu wrote:
> > Hi, Matthias:
> >
> > Matthias Brugger  於 2020年3月26日 週四 下午11:45寫道:
> >>
> >>
> >>
> >> On 26/03/2020 15:51, CK Hu wrote:
> >>> Hi, Matthias:
> >>>
> >>> On Thu, 2020-03-26 at 12:54 +0100, Matthias Brugger wrote:
> >>>> Hi CK,
> >>>>
> >>>> On 26/03/2020 00:05, CK Hu wrote:
> >>>>> Hi, Matthias:
> >>>>>
> >>>>> On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
> >>>>>>
> >>>>>> On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> >>>>>>> Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() 
> >>>>>>> functions to
> >>>>>>> replace mtk_ddp_add_comp_to_path() and 
> >>>>>>> mtk_ddp_remove_comp_from_path().
> >>>>>>> Those functions will allow DRM driver and others to control the data
> >>>>>>> path routing.
> >>>>>>>
> >>>>>>> Signed-off-by: Enric Balletbo i Serra 
> >>>>>>> Reviewed-by: Matthias Brugger 
> >>>>>>> Reviewed-by: CK Hu 
> >>>>>>> Acked-by: CK Hu 
> >>>>>>
> >>>>>> This patch does not apply against v5.6-rc1.
> >>>>>> Please rebase as this is a quite big patch and it won't be easy to do 
> >>>>>> that by hand.
> >>>>>
> >>>>> I think this patch depends on [1] which has been acked by me and I have
> >>>>> not picked it. The simple way is that you pick [1] first and then pick
> >>>>> this series.
> >>>>>
> >>>>> [1]
> >>>>> https://patchwork.kernel.org/patch/11406227/
> >>>>>
> >>>>
> >>>> You would need to provide a stable tag for me that I can merge into my 
> >>>> tree. You
> >>>> can also try to merge my for-next [1] which has the newest version from 
> >>>> Enric.
> >>>> If you see any merge conflict, then we have to do something about it :)
> >>>>
> >>>> Regards,
> >>>> Matthias
> >>>>
> >>>> [1]
> >>>> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
> >>>>
> >>>
> >>> You have applied this series, so I would not apply other patches which
> >>> would conflict with this series. After this series land on main stream
> >>> (wish it happen in this merge window), I would rebase other patch on
> >>> main stream.
> >>>
> >>
> >> I haven't (yet) send the pull request. If you want to bring in your 
> >> patches in
> >> v5.7 as well we can find a solution to that. Shall I provide you with a 
> >> stable
> >> branch which you can merge? This way you can add all your patches in the 
> >> pull
> >> request as well and we don't have to wait for v5.8 to get things into 
> >> mainline.
> >>
> >> Let me know and I'll provide you with a stable branch.
> >
> > This series is in linux-next but does not in main stream. So would you
> > please provide a stable branch so I could pull this series?
> >
>
> Please find the pull request below:
>
> The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:
>
>   Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)
>
> are available in the Git repository at:
>
>
> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/
> tags/v5.7-next-drm-stable
>
> for you to fetch changes up to 667c769246b01c53ad0925d603d2a2531abd3ef2:
>
>   soc / drm: mediatek: Fix mediatek-drm device probing (2020-04-13
> 13:01:16 +0200)
>
> 
> Enric Balletbo i Serra (3):
>   dt-bindings: mediatek: Update mmsys binding to reflect it is a
> system controller
>   soc / drm: mediatek: Move routing control to mmsys device
>   soc / drm: mediatek: Fix mediatek-drm device probing
>
> Matthias Brugger (2):
>   drm/mediatek: Omit warning on probe defers
>   clk / soc: mediatek: Move mt8173 MMSYS to platform driver
>
>  Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt |   7 +--
>  drivers/clk/mediatek/Kconfig

Re: [PATCH v3 -next] drm/mediatek: Fix Kconfig warning

2020-04-29 Thread Chun-Kuang Hu
Hi, YueHaibing:

YueHaibing  於 2020年4月29日 週三 下午3:14寫道:
>
> WARNING: unmet direct dependencies detected for MTK_MMSYS
>   Depends on [n]: (ARCH_MEDIATEK [=y] || COMPILE_TEST [=n]) && 
> COMMON_CLK_MT8173_MMSYS [=n]
>   Selected by [y]:
>   - DRM_MEDIATEK [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_MEDIATEK [=y] || 
> ARM && COMPILE_TEST [=n]) && COMMON_CLK [=y] && HAVE_ARM_SMCCC [=y] && OF [=y]
>
> Make DRM_MEDIATEK depend on MTK_MMSYS to fix this.

Reviewed-by: Chun-Kuang Hu 

>
> Fixes: 2c758e301ed9 ("soc / drm: mediatek: Move routing control to mmsys 
> device")
> Signed-off-by: YueHaibing 
> ---
> v3: make DRM_MEDIATEK depends on MTK_MMSYS
> v2: select COMMON_CLK_MT8173_MMSYS instead of adding DRM_MEDIATEK dependency
> ---
>  drivers/gpu/drm/mediatek/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> b/drivers/gpu/drm/mediatek/Kconfig
> index c420f5a3d33b..aa74aac3cbcc 100644
> --- a/drivers/gpu/drm/mediatek/Kconfig
> +++ b/drivers/gpu/drm/mediatek/Kconfig
> @@ -6,12 +6,12 @@ config DRM_MEDIATEK
> depends on COMMON_CLK
> depends on HAVE_ARM_SMCCC
> depends on OF
> +   depends on MTK_MMSYS
> select DRM_GEM_CMA_HELPER
> select DRM_KMS_HELPER
> select DRM_MIPI_DSI
> select DRM_PANEL
> select MEMORY
> -   select MTK_MMSYS
> select MTK_SMI
> select VIDEOMODE_HELPERS
> help
> --
> 2.17.1
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit

2020-04-29 Thread Chun-Kuang Hu
Hi, Bernard:

Bernard Zhao  於 2020年4月27日 週一 下午3:53寫道:
>
> This code change is to make code bit more readable.
> Optimise array size align to HDMI macro define.
> Add check if len is overange.

One patch should just do one thing, but this do three things.
So break this into three patches.

Regards,
Chun-Kuang.

>
> Signed-off-by: Bernard Zhao 
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..40fb5154ed5d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi 
> *hdmi, u8 *buffer,
> u8 checksum;
> int ctrl_frame_en = 0;
>
> -   frame_type = *buffer;
> -   buffer += 1;
> -   frame_ver = *buffer;
> -   buffer += 1;
> -   frame_len = *buffer;
> -   buffer += 1;
> -   checksum = *buffer;
> -   buffer += 1;
> +   frame_type = *buffer++;
> +   frame_ver = *buffer++;
> +   frame_len = *buffer++;
> +   checksum = *buffer++;
> frame_data = buffer;
> +   if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
> +   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
> +   return;
> +   }
>
> dev_dbg(hdmi->dev,
> 
> "frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi 
> *hdmi,
> struct drm_display_mode *mode)
>  {
> struct hdmi_avi_infoframe frame;
> -   u8 buffer[17];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
> ssize_t err;
>
> err = drm_hdmi_avi_infoframe_from_display_mode(,
> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi 
> *hdmi,
> const char *product)
>  {
> struct hdmi_spd_infoframe frame;
> -   u8 buffer[29];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
> ssize_t err;
>
> err = hdmi_spd_infoframe_init(, vendor, product);
> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi 
> *hdmi,
>  static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
>  {
> struct hdmi_audio_infoframe frame;
> -   u8 buffer[14];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
> ssize_t err;
>
> err = hdmi_audio_infoframe_init();
> --
> 2.26.2
>
>
> ___
> Linux-mediatek mailing list
> linux-media...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 6/7] drm/mediatek: mtk_dsi: Use the drm_panel_bridge API

2020-05-01 Thread Chun-Kuang Hu
Enric Balletbo i Serra  於 2020年4月17日 週五 下午11:06寫道:
>
> Replace the manual panel handling code by a drm_panel_bridge. This
> simplifies the driver and allows all components in the display pipeline
> to be treated as bridges, paving the way to generic connector handling.
>
> Signed-off-by: Enric Balletbo i Serra 
> Reviewed-by: Laurent Pinchart 
> ---
>
> Changes in v3:
> - Use next_bridge field to store the panel bridge. (Laurent Pinchart)
> - Add the bridge.type field. (Laurent Pinchart)
> - This patch requires https://lkml.org/lkml/2020/4/16/2080 to work
>   properly.
>
> Changes in v2:
> - Do not set connector_type for panel here. (Sam Ravnborg)
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 187 +++--
>  1 file changed, 14 insertions(+), 173 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d68694ff00dc..157097c63b23 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -182,8 +182,6 @@ struct mtk_dsi {
> struct mipi_dsi_host host;
> struct drm_encoder encoder;
> struct drm_bridge bridge;
> -   struct drm_connector conn;
> -   struct drm_panel *panel;
> struct drm_bridge *next_bridge;
> struct phy *phy;
>
> @@ -212,11 +210,6 @@ static inline struct mtk_dsi *bridge_to_dsi(struct 
> drm_bridge *b)
> return container_of(b, struct mtk_dsi, bridge);
>  }
>
> -static inline struct mtk_dsi *connector_to_dsi(struct drm_connector *c)
> -{
> -   return container_of(c, struct mtk_dsi, conn);
> -}
> -
>  static inline struct mtk_dsi *host_to_dsi(struct mipi_dsi_host *h)
>  {
> return container_of(h, struct mtk_dsi, host);
> @@ -682,16 +675,7 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)
> mtk_dsi_lane0_ulp_mode_leave(dsi);
> mtk_dsi_clk_hs_mode(dsi, 0);
>
> -   if (dsi->panel) {
> -   if (drm_panel_prepare(dsi->panel)) {
> -   DRM_ERROR("failed to prepare the panel\n");
> -   goto err_disable_digital_clk;
> -   }
> -   }
> -
> return 0;
> -err_disable_digital_clk:
> -   clk_disable_unprepare(dsi->digital_clk);
>  err_disable_engine_clk:
> clk_disable_unprepare(dsi->engine_clk);
>  err_phy_power_off:
> @@ -718,15 +702,7 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
>  */
> mtk_dsi_stop(dsi);
>
> -   if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) {
> -   if (dsi->panel) {
> -   if (drm_panel_unprepare(dsi->panel)) {
> -   DRM_ERROR("failed to unprepare the panel\n");
> -   return;
> -   }
> -   }
> -   }
> -
> +   mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
> mtk_dsi_reset_engine(dsi);
> mtk_dsi_lane0_ulp_mode_enter(dsi);
> mtk_dsi_clk_ulp_mode_enter(dsi);
> @@ -757,19 +733,7 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi)
>
> mtk_dsi_start(dsi);
>
> -   if (dsi->panel) {
> -   if (drm_panel_enable(dsi->panel)) {
> -   DRM_ERROR("failed to enable the panel\n");
> -   goto err_dsi_power_off;
> -   }
> -   }
> -
> dsi->enabled = true;
> -
> -   return;
> -err_dsi_power_off:
> -   mtk_dsi_stop(dsi);
> -   mtk_dsi_poweroff(dsi);
>  }
>
>  static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> @@ -777,34 +741,19 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> if (!dsi->enabled)
> return;
>
> -   if (dsi->panel) {
> -   if (drm_panel_disable(dsi->panel)) {
> -   DRM_ERROR("failed to disable the panel\n");
> -   return;
> -   }
> -   }
> -
> mtk_dsi_poweroff(dsi);
>
> dsi->enabled = false;
>  }
>
> -static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi 
> *dsi);
> -static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi);
> -
>  static int mtk_dsi_bridge_attach(struct drm_bridge *bridge,
>  enum drm_bridge_attach_flags flags)
>  {
> struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> -   return mtk_dsi_create_conn_enc(bridge->dev, dsi);
> -}
> -
> -static void mtk_dsi_bridge_detach(struct drm_bridge *bridge)
> -{
> -   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
> -
> -   mtk_dsi_destroy_conn_enc(dsi);
> +   /* Attach the panel or bridge to the dsi bridge */
> +   return drm_bridge_attach(bridge->encoder, dsi->next_bridge,
> +>bridge, flags);
>  }
>
>  static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,
> @@ -830,115 +779,13 @@ static void mtk_dsi_bridge_enable(struct drm_bridge 
> *bridge)
> mtk_output_dsi_enable(dsi);
>  }
>
> -static int 

Re: [PATCH v3 6/7] drm/mediatek: mtk_dsi: Use the drm_panel_bridge API

2020-05-01 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年4月17日 週五 下午11:06寫道:
>
> Replace the manual panel handling code by a drm_panel_bridge. This
> simplifies the driver and allows all components in the display pipeline
> to be treated as bridges, paving the way to generic connector handling.
>

Reviewed-by: Chun-Kuang Hu 

> Signed-off-by: Enric Balletbo i Serra 
> Reviewed-by: Laurent Pinchart 
> ---
>
> Changes in v3:
> - Use next_bridge field to store the panel bridge. (Laurent Pinchart)
> - Add the bridge.type field. (Laurent Pinchart)
> - This patch requires https://lkml.org/lkml/2020/4/16/2080 to work
>   properly.
>
> Changes in v2:
> - Do not set connector_type for panel here. (Sam Ravnborg)
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 187 +++--
>  1 file changed, 14 insertions(+), 173 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d68694ff00dc..157097c63b23 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -182,8 +182,6 @@ struct mtk_dsi {
> struct mipi_dsi_host host;
> struct drm_encoder encoder;
> struct drm_bridge bridge;
> -   struct drm_connector conn;
> -   struct drm_panel *panel;
> struct drm_bridge *next_bridge;
> struct phy *phy;
>
> @@ -212,11 +210,6 @@ static inline struct mtk_dsi *bridge_to_dsi(struct 
> drm_bridge *b)
> return container_of(b, struct mtk_dsi, bridge);
>  }
>
> -static inline struct mtk_dsi *connector_to_dsi(struct drm_connector *c)
> -{
> -   return container_of(c, struct mtk_dsi, conn);
> -}
> -
>  static inline struct mtk_dsi *host_to_dsi(struct mipi_dsi_host *h)
>  {
> return container_of(h, struct mtk_dsi, host);
> @@ -682,16 +675,7 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)
> mtk_dsi_lane0_ulp_mode_leave(dsi);
> mtk_dsi_clk_hs_mode(dsi, 0);
>
> -   if (dsi->panel) {
> -   if (drm_panel_prepare(dsi->panel)) {
> -   DRM_ERROR("failed to prepare the panel\n");
> -   goto err_disable_digital_clk;
> -   }
> -   }
> -
> return 0;
> -err_disable_digital_clk:
> -   clk_disable_unprepare(dsi->digital_clk);
>  err_disable_engine_clk:
> clk_disable_unprepare(dsi->engine_clk);
>  err_phy_power_off:
> @@ -718,15 +702,7 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
>  */
> mtk_dsi_stop(dsi);
>
> -   if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) {
> -   if (dsi->panel) {
> -   if (drm_panel_unprepare(dsi->panel)) {
> -   DRM_ERROR("failed to unprepare the panel\n");
> -   return;
> -   }
> -   }
> -   }
> -
> +   mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
> mtk_dsi_reset_engine(dsi);
> mtk_dsi_lane0_ulp_mode_enter(dsi);
> mtk_dsi_clk_ulp_mode_enter(dsi);
> @@ -757,19 +733,7 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi)
>
> mtk_dsi_start(dsi);
>
> -   if (dsi->panel) {
> -   if (drm_panel_enable(dsi->panel)) {
> -   DRM_ERROR("failed to enable the panel\n");
> -   goto err_dsi_power_off;
> -   }
> -   }
> -
> dsi->enabled = true;
> -
> -   return;
> -err_dsi_power_off:
> -   mtk_dsi_stop(dsi);
> -   mtk_dsi_poweroff(dsi);
>  }
>
>  static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> @@ -777,34 +741,19 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> if (!dsi->enabled)
> return;
>
> -   if (dsi->panel) {
> -   if (drm_panel_disable(dsi->panel)) {
> -   DRM_ERROR("failed to disable the panel\n");
> -   return;
> -   }
> -   }
> -
> mtk_dsi_poweroff(dsi);
>
> dsi->enabled = false;
>  }
>
> -static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi 
> *dsi);
> -static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi);
> -
>  static int mtk_dsi_bridge_attach(struct drm_bridge *bridge,
>  enum drm_bridge_attach_flags flags)
>  {
> struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> -   return mtk_dsi_create_conn_enc(bridge->dev, dsi);
> -}
> -
> -static void mtk_dsi_bridge_detach(struct drm_bridge *bridge)
> -{
&g

Re: [PATCH v3 5/7] drm/mediatek: mtk_dsi: Use simple encoder

2020-05-01 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年4月17日 週五 下午11:06寫道:
>
> The mtk_dsi driver uses an empty implementation for its encoder. Replace
> the code with the generic simple encoder.

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Enric Balletbo i Serra 
> Reviewed-by: Laurent Pinchart 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++---
>  1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 869ae0a2e9f8..d68694ff00dc 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -22,6 +22,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "mtk_drm_ddp_comp.h"
>
> @@ -788,15 +789,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> dsi->enabled = false;
>  }
>
> -static void mtk_dsi_encoder_destroy(struct drm_encoder *encoder)
> -{
> -   drm_encoder_cleanup(encoder);
> -}
> -
> -static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = {
> -   .destroy = mtk_dsi_encoder_destroy,
> -};
> -
>  static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi 
> *dsi);
>  static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi);
>
> @@ -1140,8 +1132,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, 
> struct mtk_dsi *dsi)
>  {
> int ret;
>
> -   ret = drm_encoder_init(drm, >encoder, _dsi_encoder_funcs,
> -  DRM_MODE_ENCODER_DSI, NULL);
> +   ret = drm_simple_encoder_init(drm, >encoder,
> + DRM_MODE_ENCODER_DSI);
> if (ret) {
> DRM_ERROR("Failed to encoder init to drm\n");
> return ret;
> --
> 2.25.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 4/7] drm/mediatek: mtk_dsi: Convert to bridge driver

2020-05-01 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年4月17日 週五 下午11:06寫道:
>
> Convert mtk_dsi to a bridge driver with built-in encoder support for
> compatibility with existing component drivers.
>
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
> Changes in v3:
> - Add the bridge.type. (Laurent Pinchart)
>
> Changes in v2: None
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 93 ++
>  1 file changed, 69 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 37b8d7ffd835..869ae0a2e9f8 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -180,6 +180,7 @@ struct mtk_dsi {
> struct device *dev;
> struct mipi_dsi_host host;
> struct drm_encoder encoder;
> +   struct drm_bridge bridge;
> struct drm_connector conn;
> struct drm_panel *panel;
> struct drm_bridge *next_bridge;
> @@ -205,9 +206,9 @@ struct mtk_dsi {
> const struct mtk_dsi_driver_data *driver_data;
>  };
>
> -static inline struct mtk_dsi *encoder_to_dsi(struct drm_encoder *e)
> +static inline struct mtk_dsi *bridge_to_dsi(struct drm_bridge *b)
>  {
> -   return container_of(e, struct mtk_dsi, encoder);
> +   return container_of(b, struct mtk_dsi, bridge);
>  }
>
>  static inline struct mtk_dsi *connector_to_dsi(struct drm_connector *c)
> @@ -796,32 +797,43 @@ static const struct drm_encoder_funcs 
> mtk_dsi_encoder_funcs = {
> .destroy = mtk_dsi_encoder_destroy,
>  };
>
> -static bool mtk_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
> -  const struct drm_display_mode *mode,
> -  struct drm_display_mode *adjusted_mode)
> +static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi 
> *dsi);
> +static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi);
> +
> +static int mtk_dsi_bridge_attach(struct drm_bridge *bridge,
> +enum drm_bridge_attach_flags flags)
> +{
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
> +
> +   return mtk_dsi_create_conn_enc(bridge->dev, dsi);
> +}
> +
> +static void mtk_dsi_bridge_detach(struct drm_bridge *bridge)
>  {
> -   return true;
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
> +
> +   mtk_dsi_destroy_conn_enc(dsi);
>  }
>
> -static void mtk_dsi_encoder_mode_set(struct drm_encoder *encoder,
> -struct drm_display_mode *mode,
> -struct drm_display_mode *adjusted)
> +static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,
> +   const struct drm_display_mode *mode,
> +   const struct drm_display_mode *adjusted)
>  {
> -   struct mtk_dsi *dsi = encoder_to_dsi(encoder);
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> drm_display_mode_to_videomode(adjusted, >vm);
>  }
>
> -static void mtk_dsi_encoder_disable(struct drm_encoder *encoder)
> +static void mtk_dsi_bridge_disable(struct drm_bridge *bridge)
>  {
> -   struct mtk_dsi *dsi = encoder_to_dsi(encoder);
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> mtk_output_dsi_disable(dsi);
>  }
>
> -static void mtk_dsi_encoder_enable(struct drm_encoder *encoder)
> +static void mtk_dsi_bridge_enable(struct drm_bridge *bridge)
>  {
> -   struct mtk_dsi *dsi = encoder_to_dsi(encoder);
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> mtk_output_dsi_enable(dsi);
>  }
> @@ -833,11 +845,12 @@ static int mtk_dsi_connector_get_modes(struct 
> drm_connector *connector)
> return drm_panel_get_modes(dsi->panel, connector);
>  }
>
> -static const struct drm_encoder_helper_funcs mtk_dsi_encoder_helper_funcs = {
> -   .mode_fixup = mtk_dsi_encoder_mode_fixup,
> -   .mode_set = mtk_dsi_encoder_mode_set,
> -   .disable = mtk_dsi_encoder_disable,
> -   .enable = mtk_dsi_encoder_enable,
> +static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
> +   .attach = mtk_dsi_bridge_attach,
> +   .detach = mtk_dsi_bridge_detach,
> +   .disable = mtk_dsi_bridge_disable,
> +   .enable = mtk_dsi_bridge_enable,
> +   .mode_set = mtk_dsi_bridge_mode_set,
>  };
>
>  static const struct drm_connector_funcs mtk_dsi_connector_funcs = {
> @@ -1123,6 +1136,34 @@ static const struct mipi_dsi_host_ops mtk_dsi_ops = {
> .transfer = mtk_dsi_host_transfer,
>  };
>
> +static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> +{
> +   int ret;
> +
> +   ret = drm_encoder_init(drm, >encoder, _dsi_encoder_funcs,
> +  DRM_MODE_ENCODER_DSI, NULL);

I'm a bit confused here. drm_encoder_init() exist here and in
mtk_dsi_create_conn_enc(). Do you plan to init encodr twice?

> +   if (ret) {
> +   DRM_ERROR("Failed to encoder init to drm\n");
> + 

Re: [PATCH v3 7/7] drm/mediatek: mtk_dsi: Create connector for bridges

2020-05-01 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年4月17日 週五 下午11:06寫道:
>
> Use the drm_bridge_connector helper to create a connector for pipelines
> that use drm_bridge. This allows splitting connector operations across
> multiple bridges when necessary, instead of having the last bridge in
> the chain creating the connector and handling all connector operations
> internally.
>
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
> Changes in v3:
> - Move the bridge.type line to the patch that adds drm_bridge support. 
> (Laurent Pinchart)
>
> Changes in v2: None
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 157097c63b23..85f76b01ae4d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -17,6 +17,7 @@
>
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -183,6 +184,7 @@ struct mtk_dsi {
> struct drm_encoder encoder;
> struct drm_bridge bridge;
> struct drm_bridge *next_bridge;
> +   struct drm_connector *connector;
> struct phy *phy;
>
> void __iomem *regs;
> @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, 
> struct mtk_dsi *dsi)
>  */
> dsi->encoder.possible_crtcs = 1;
>
> -   ret = drm_bridge_attach(>encoder, >bridge, NULL, 0);
> +   ret = drm_bridge_attach(>encoder, >bridge, NULL,
> +   DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> if (ret)
> goto err_cleanup_encoder;
>
> +   dsi->connector = drm_bridge_connector_init(drm, >encoder);
> +   if (IS_ERR(dsi->connector)) {
> +   DRM_ERROR("Unable to create bridge connector\n");
> +   ret = PTR_ERR(dsi->connector);
> +   goto err_cleanup_encoder;
> +   }
> +   drm_connector_attach_encoder(dsi->connector, >encoder);
> +

I'm not very clear about how brige-connector works, but why connector
does not attach to panel?

Regards,
Chun-Kuang.

> return 0;
>
>  err_cleanup_encoder:
> --
> 2.25.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit

2020-04-30 Thread Chun-Kuang Hu
Hi, Bernard:

Bernard  於 2020年4月30日 週四 下午2:32寫道:
>
>
>
> 发件人:Chun-Kuang Hu 
> 发送日期:2020-04-29 22:22:50
> 收件人:Bernard Zhao 
> 抄送人:Chun-Kuang Hu ,Philipp Zabel 
> ,David Airlie ,Daniel Vetter 
> ,Matthias Brugger ,DRI Development 
> ,Linux ARM 
> ,"moderated list:ARM/Mediatek SoC 
> support" ,linux-kernel 
> ,opensource.ker...@vivo.com
> 主题:Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit>Hi, 
> Bernard:
> >
> >Bernard Zhao  於 2020年4月27日 週一 下午3:53寫道:
> >>
> >> This code change is to make code bit more readable.
> >> Optimise array size align to HDMI macro define.
> >> Add check if len is overange.
> >
> >One patch should just do one thing, but this do three things.
> >So break this into three patches.
> >
> >Regards,
> >Chun-Kuang.
>
> Hi
> This optimization is mainly to make the code a bit readable.
> These modifications are related, main in several related function calls in 
> the same file.
> I was a bit confused that if it is really necessary to change to three 
> separate patch submissions?
>
> Regards
> Bernard
>
> >>
> >> Signed-off-by: Bernard Zhao 
> >> ---
> >>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++---
> >>  1 file changed, 11 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> >> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> >> index ff43a3d80410..40fb5154ed5d 100644
> >> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> >> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> >> @@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct 
> >> mtk_hdmi *hdmi, u8 *buffer,
> >> u8 checksum;
> >> int ctrl_frame_en = 0;
> >>
> >> -   frame_type = *buffer;
> >> -   buffer += 1;
> >> -   frame_ver = *buffer;
> >> -   buffer += 1;
> >> -   frame_len = *buffer;
> >> -   buffer += 1;
> >> -   checksum = *buffer;
> >> -   buffer += 1;
> >> +   frame_type = *buffer++;
> >> +   frame_ver = *buffer++;
> >> +   frame_len = *buffer++;
> >> +   checksum = *buffer++;

This part looks like cleanup, so keep in this patch.

> >> frame_data = buffer;
> >> +   if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
> >> +   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
> >> +   return;

This is error checking, not cleanup the coding style, so move this to
another patch.

> >> +   }
> >>
> >> dev_dbg(hdmi->dev,
> >> 
> >> "frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
> >> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct 
> >> mtk_hdmi *hdmi,
> >> struct drm_display_mode *mode)
> >>  {
> >> struct hdmi_avi_infoframe frame;
> >> -   u8 buffer[17];
> >> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];

This is to symbolize the number, symbolization is more than cleanup.

Regards,
Chun-Kuang.

> >> ssize_t err;
> >>
> >> err = drm_hdmi_avi_infoframe_from_display_mode(,
> >> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct 
> >> mtk_hdmi *hdmi,
> >> const char *product)
> >>  {
> >> struct hdmi_spd_infoframe frame;
> >> -   u8 buffer[29];
> >> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
> >> ssize_t err;
> >>
> >> err = hdmi_spd_infoframe_init(, vendor, product);
> >> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct 
> >> mtk_hdmi *hdmi,
> >>  static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
> >>  {
> >> struct hdmi_audio_infoframe frame;
> >> -   u8 buffer[14];
> >> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
> >> ssize_t err;
> >>
> >> err = hdmi_audio_infoframe_init();
> >> --
> >> 2.26.2
> >>
> >>
> >> ___
> >> Linux-mediatek mailing list
> >> linux-media...@lists.infradead.org
> >> http://lists.infradead.org/mailman/listinfo/linux-mediatek
>
>
> ___
> Linux-mediatek mailing list
> linux-media...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 4/7] drm/mediatek: mtk_dsi: Convert to bridge driver

2020-05-01 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月1日 週五 下午11:23寫道:
>
> Convert mtk_dsi to a bridge driver with built-in encoder support for
> compatibility with existing component drivers.

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Enric Balletbo i Serra 
> Acked-by: Sam Ravnborg 
> ---
>
> Changes in v4:
> - Remove double call to drm_encoder_init(). (Chun-Kuang Hu)
> - Cleanup the encoder in mtk_dsi_unbind(). (Chun-Kuang Hu)
>
> Changes in v3:
> - Add the bridge.type. (Laurent Pinchart)
>
> Changes in v2: None
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 108 +++--
>  1 file changed, 70 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 37b8d7ffd835..38cbdcb15fff 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -180,6 +180,7 @@ struct mtk_dsi {
> struct device *dev;
> struct mipi_dsi_host host;
> struct drm_encoder encoder;
> +   struct drm_bridge bridge;
> struct drm_connector conn;
> struct drm_panel *panel;
> struct drm_bridge *next_bridge;
> @@ -205,9 +206,9 @@ struct mtk_dsi {
> const struct mtk_dsi_driver_data *driver_data;
>  };
>
> -static inline struct mtk_dsi *encoder_to_dsi(struct drm_encoder *e)
> +static inline struct mtk_dsi *bridge_to_dsi(struct drm_bridge *b)
>  {
> -   return container_of(e, struct mtk_dsi, encoder);
> +   return container_of(b, struct mtk_dsi, bridge);
>  }
>
>  static inline struct mtk_dsi *connector_to_dsi(struct drm_connector *c)
> @@ -796,32 +797,43 @@ static const struct drm_encoder_funcs 
> mtk_dsi_encoder_funcs = {
> .destroy = mtk_dsi_encoder_destroy,
>  };
>
> -static bool mtk_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
> -  const struct drm_display_mode *mode,
> -  struct drm_display_mode *adjusted_mode)
> +static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi 
> *dsi);
> +static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi);
> +
> +static int mtk_dsi_bridge_attach(struct drm_bridge *bridge,
> +enum drm_bridge_attach_flags flags)
>  {
> -   return true;
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
> +
> +   return mtk_dsi_create_conn_enc(bridge->dev, dsi);
> +}
> +
> +static void mtk_dsi_bridge_detach(struct drm_bridge *bridge)
> +{
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
> +
> +   mtk_dsi_destroy_conn_enc(dsi);
>  }
>
> -static void mtk_dsi_encoder_mode_set(struct drm_encoder *encoder,
> -struct drm_display_mode *mode,
> -struct drm_display_mode *adjusted)
> +static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,
> +   const struct drm_display_mode *mode,
> +   const struct drm_display_mode *adjusted)
>  {
> -   struct mtk_dsi *dsi = encoder_to_dsi(encoder);
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> drm_display_mode_to_videomode(adjusted, >vm);
>  }
>
> -static void mtk_dsi_encoder_disable(struct drm_encoder *encoder)
> +static void mtk_dsi_bridge_disable(struct drm_bridge *bridge)
>  {
> -   struct mtk_dsi *dsi = encoder_to_dsi(encoder);
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> mtk_output_dsi_disable(dsi);
>  }
>
> -static void mtk_dsi_encoder_enable(struct drm_encoder *encoder)
> +static void mtk_dsi_bridge_enable(struct drm_bridge *bridge)
>  {
> -   struct mtk_dsi *dsi = encoder_to_dsi(encoder);
> +   struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> mtk_output_dsi_enable(dsi);
>  }
> @@ -833,11 +845,12 @@ static int mtk_dsi_connector_get_modes(struct 
> drm_connector *connector)
> return drm_panel_get_modes(dsi->panel, connector);
>  }
>
> -static const struct drm_encoder_helper_funcs mtk_dsi_encoder_helper_funcs = {
> -   .mode_fixup = mtk_dsi_encoder_mode_fixup,
> -   .mode_set = mtk_dsi_encoder_mode_set,
> -   .disable = mtk_dsi_encoder_disable,
> -   .enable = mtk_dsi_encoder_enable,
> +static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
> +   .attach = mtk_dsi_bridge_attach,
> +   .detach = mtk_dsi_bridge_detach,
> +   .disable = mtk_dsi_bridge_disable,
> +   .enable = mtk_dsi_bridge_enable,
> +   .mode_set = mtk_dsi_bridge_mode_set,
>  };
>
>  static const struct drm_connector_funcs mtk_dsi_connector_funcs = {

Re: [PATCH v4 3/7] drm/mediatek: mtk_dsi: Rename bridge to next_bridge

2020-05-01 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月1日 週五 下午11:23寫道:
>
> This is really a cosmetic change just to make a bit more readable the
> code after convert the driver to drm_bridge. The bridge variable name
> will be used by the encoder drm_bridge, and the chained bridge will be
> named next_bridge.

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Enric Balletbo i Serra 
> Reviewed-by: Laurent Pinchart 
> Acked-by: Sam Ravnborg 
> ---
>
> Changes in v4: None
> Changes in v3:
> - Replace s/bridge/next bridge/ for comment. (Laurent Pinchart)
>
> Changes in v2: None
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index cfa45d6abd74..37b8d7ffd835 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -182,7 +182,7 @@ struct mtk_dsi {
> struct drm_encoder encoder;
> struct drm_connector conn;
> struct drm_panel *panel;
> -   struct drm_bridge *bridge;
> +   struct drm_bridge *next_bridge;
> struct phy *phy;
>
> void __iomem *regs;
> @@ -902,9 +902,10 @@ static int mtk_dsi_create_conn_enc(struct drm_device 
> *drm, struct mtk_dsi *dsi)
>  */
> dsi->encoder.possible_crtcs = 1;
>
> -   /* If there's a bridge, attach to it and let it create the connector 
> */
> -   if (dsi->bridge) {
> -   ret = drm_bridge_attach(>encoder, dsi->bridge, NULL, 0);
> +   /* If there's a next bridge, attach to it and let it create the 
> connector */
> +   if (dsi->next_bridge) {
> +   ret = drm_bridge_attach(>encoder, dsi->next_bridge, NULL,
> +   0);
> if (ret) {
> DRM_ERROR("Failed to attach bridge to drm\n");
> goto err_encoder_cleanup;
> @@ -1185,7 +1186,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
> }
>
> ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> - >panel, >bridge);
> + >panel, >next_bridge);
> if (ret)
> goto err_unregister_host;
>
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 7/7] drm/mediatek: mtk_dsi: Create connector for bridges

2020-05-01 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月1日 週五 下午10:59寫道:
>
> Hi Chun-Kuang,
>
> Thank you for your review.
>
> On 1/5/20 16:26, Chun-Kuang Hu wrote:
> > Hi, Enric:
> >
> > Enric Balletbo i Serra  於 2020年4月17日 週五 
> > 下午11:06寫道:
> >>
> >> Use the drm_bridge_connector helper to create a connector for pipelines
> >> that use drm_bridge. This allows splitting connector operations across
> >> multiple bridges when necessary, instead of having the last bridge in
> >> the chain creating the connector and handling all connector operations
> >> internally.
> >>
> >> Signed-off-by: Enric Balletbo i Serra 
> >> ---
> >>
> >> Changes in v3:
> >> - Move the bridge.type line to the patch that adds drm_bridge support. 
> >> (Laurent Pinchart)
> >>
> >> Changes in v2: None
> >>
> >>  drivers/gpu/drm/mediatek/mtk_dsi.c | 13 -
> >>  1 file changed, 12 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> >> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> >> index 157097c63b23..85f76b01ae4d 100644
> >> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> >> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> >> @@ -17,6 +17,7 @@
> >>
> >>  #include 
> >>  #include 
> >> +#include 
> >>  #include 
> >>  #include 
> >>  #include 
> >> @@ -183,6 +184,7 @@ struct mtk_dsi {
> >> struct drm_encoder encoder;
> >> struct drm_bridge bridge;
> >> struct drm_bridge *next_bridge;
> >> +   struct drm_connector *connector;
> >> struct phy *phy;
> >>
> >> void __iomem *regs;
> >> @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm_device 
> >> *drm, struct mtk_dsi *dsi)
> >>  */
> >> dsi->encoder.possible_crtcs = 1;
> >>
> >> -   ret = drm_bridge_attach(>encoder, >bridge, NULL, 0);
> >> +   ret = drm_bridge_attach(>encoder, >bridge, NULL,
> >> +   DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> >> if (ret)
> >> goto err_cleanup_encoder;
> >>
> >> +   dsi->connector = drm_bridge_connector_init(drm, >encoder);
> >> +   if (IS_ERR(dsi->connector)) {
> >> +   DRM_ERROR("Unable to create bridge connector\n");
> >> +   ret = PTR_ERR(dsi->connector);
> >> +   goto err_cleanup_encoder;
> >> +   }
> >> +   drm_connector_attach_encoder(dsi->connector, >encoder);
> >> +
> >
> > I'm not very clear about how brige-connector works, but why connector
> > does not attach to panel?
> >
>
> Laurent or other drm maintainers might have more details than me, but, AFAIK 
> the
> drm_bridge_connector_init initializes a connector for a chain of bridges that
> starts at the @encoder. At this point you don't know which bridge is connected
> to the panel physically but doesn't really matter as what you know is that 
> will
> be only one connector in the  chain.

I think the panel is wrapped into next_bridge here,

if (panel) {
dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);

so the next_bridge is a panel_bridge, in its attach function
panel_bridge_attach(),
according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
it would create connector and attach connector to panel.

I'm not sure this flag would exist or not, but for both case, it's strange.
If exist, you create connector in this patch but no where to attach
connector to panel.
If not exist, the next_brige would create one connector and this brige
would create another connector.

I think in your case, mtk_dsi does not directly connect to a panel, so
I need a exact explain. Or someone could test this on a
directly-connect-panel platform.

Regards,
Chun-Kuang.

>
> Thanks,
>  Enric
>
> > Regards,
> > Chun-Kuang.
> >
> >> return 0;
> >>
> >>  err_cleanup_encoder:
> >> --
> >> 2.25.1
> >>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/3] Convert mtk-dpi to drm_bridge API

2020-05-09 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月4日 週一 下午10:14寫道:
>
> The mtk-dpi driver still uses the drm_encoder API which is now somehow
> deprecated. We started to move all the Mediatek drivers to the drm_bridge API,
> like we did for the mtk-dsi driver [1], this is another small step to be able 
> to
> fully convert the DRM Mediatek drivers to the drm_bridge API. A dummy
> drm_encoder is maintained in the mtk-dpi driver but the end goal is move all 
> the
> dummy drm_encoder (mtk-dsi, mtk-dpi, etc) to the main mtk_drm_drv driver.

For this series, applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Best regards,
>  Enric
>
> [1] https://lore.kernel.org/patchwork/project/lkml/list/?series=441559
>
> Enric Balletbo i Serra (3):
>   drm/mediatek: mtk_dpi: Rename bridge to next_bridge
>   drm/mediatek: mtk_dpi: Convert to bridge driver
>   drm/mediatek: mtk_dpi: Use simple encoder
>
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 84 ++
>  1 file changed, 39 insertions(+), 45 deletions(-)
>
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/mediatek: cleanup coding style in mediatek a bit

2020-05-09 Thread Chun-Kuang Hu
Hi, Bernard:

Bernard Zhao  於 2020年5月6日 週三 下午8:34寫道:
>
> This code change is to make code bit more readable.
>

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang

> Signed-off-by: Bernard Zhao 
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..43e9876fd50c 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -311,14 +311,10 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi 
> *hdmi, u8 *buffer,
> u8 checksum;
> int ctrl_frame_en = 0;
>
> -   frame_type = *buffer;
> -   buffer += 1;
> -   frame_ver = *buffer;
> -   buffer += 1;
> -   frame_len = *buffer;
> -   buffer += 1;
> -   checksum = *buffer;
> -   buffer += 1;
> +   frame_type = *buffer++;
> +   frame_ver = *buffer++;
> +   frame_len = *buffer++;
> +   checksum = *buffer++;
> frame_data = buffer;
>
> dev_dbg(hdmi->dev,
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: eliminate the magic number in array size

2020-05-09 Thread Chun-Kuang Hu
Hi, Bernard:

Bernard Zhao  於 2020年5月6日 週三 下午8:43寫道:
>
> Eiminate the magic number in array size, there macro defines in
> hdmi.h.

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang

>
> Signed-off-by: Bernard Zhao 
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..4c962c7f06e5 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi 
> *hdmi,
> struct drm_display_mode *mode)
>  {
> struct hdmi_avi_infoframe frame;
> -   u8 buffer[17];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
> ssize_t err;
>
> err = drm_hdmi_avi_infoframe_from_display_mode(,
> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi 
> *hdmi,
> const char *product)
>  {
> struct hdmi_spd_infoframe frame;
> -   u8 buffer[29];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
> ssize_t err;
>
> err = hdmi_spd_infoframe_init(, vendor, product);
> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi 
> *hdmi,
>  static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
>  {
> struct hdmi_audio_infoframe frame;
> -   u8 buffer[14];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
> ssize_t err;
>
> err = hdmi_audio_infoframe_init();
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[GIT PULL] mediatek drm next for 5.8

2020-05-13 Thread Chun-Kuang Hu
Hi, Dave & Daniel:

This include dpi pin mode swap, config mipi_tx current and impedance,
convert mtk-dpi to drm_bridge API, and some fixup.

The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:
  Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)
are available in the Git repository at:
  ssh://g...@gitolite.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git
tags/mediatek-drm-next-5.8
for you to fetch changes up to 23b29ff9f13a8fb5a12be9fedb8b614b9dede46a:
  drm/mediatek: Eliminate the magic number in array size (2020-05-10
09:08:30 +0800)

Mediatek DRM Next for Linux 5.8

Anand K Mistry (1):
  drm/mediatek: Stop iterating dma addresses when sg_dma_len() == 0
Bernard Zhao (2):
  drm/mediatek: Cleanup coding style in mediatek a bit
  drm/mediatek: Eliminate the magic number in array size
Chun-Kuang Hu (1):
  Merge tag 'v5.7-next-drm-stable' of
ssh://gitolite.kernel.org/.../matthias.bgg/linux into
mediatek-drm-next
Enric Balletbo i Serra (7):
  dt-bindings: mediatek: Update mmsys binding to reflect it is a
system controller
  soc / drm: mediatek: Move routing control to mmsys device
  soc / drm: mediatek: Fix mediatek-drm device probing
  drm/mediatek: Remove debug messages for function calls
  drm/mediatek: mtk_dpi: Rename bridge to next_bridge
  drm/mediatek: mtk_dpi: Convert to bridge driver
  drm/mediatek: mtk_dpi: Use simple encoder
Hsin-Yi Wang (1):
  drm/mediatek: Fix device passed to cmdq
Jitao Shi (6):
  dt-bindings: display: mediatek: control dpi pins mode to avoid leakage
  drm/mediatek: set dpi pin mode to gpio low to avoid leakage current
  dt-bindings: display: mediatek: add property to control mipi tx
drive current
  dt-bindings: display: mediatek: get mipitx calibration data from nvmem
  drm/mediatek: add the mipitx driving control
  drm/mediatek: config mipitx impedance with calibration data
Matthias Brugger (2):
  drm/mediatek: Omit warning on probe defers
  clk / soc: mediatek: Move mt8173 MMSYS to platform driver
YueHaibing (1):
  drm/mediatek: Fix Kconfig warning
 Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt   |   7 +-
 Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt |   6 +
 Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt |  10 ++
 drivers/clk/mediatek/Kconfig|   7 +
 drivers/clk/mediatek/Makefile   |   1 +
 drivers/clk/mediatek/clk-mt8173-mm.c|
146 +++
 drivers/clk/mediatek/clk-mt8173.c   |
104 --
 drivers/gpu/drm/mediatek/Kconfig|   1 +
 drivers/gpu/drm/mediatek/mtk_disp_color.c   |   5 +-
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c |   5 +-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c|   5 +-
 drivers/gpu/drm/mediatek/mtk_dpi.c  |
127 ++---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  27 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  |
259 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  |
 50 +++
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
 drivers/gpu/drm/mediatek/mtk_drm_gem.c  |   3 +
 drivers/gpu/drm/mediatek/mtk_dsi.c  |   8 +-
 drivers/gpu/drm/mediatek/mtk_hdmi.c |  22 ++-
 drivers/gpu/drm/mediatek/mtk_mipi_tx.c  |
 54 +++
 drivers/gpu/drm/mediatek/mtk_mipi_tx.h  |   4 +
 drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c   |  28 
 drivers/soc/mediatek/Kconfig|   8 ++
 drivers/soc/mediatek/Makefile   |   1 +
 drivers/soc/mediatek/mtk-mmsys.c|
337 
 include/linux/soc/mediatek/mtk-mmsys.h  |  20 +++
 27 files changed, 778 insertions(+), 476 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8173-mm.c
 create mode 100644 drivers/soc/mediatek/mtk-mmsys.c
 create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[GIT PULL v2] mediatek drm next for 5.8

2020-05-17 Thread Chun-Kuang Hu
Hi, Dave & Daniel:

This include dpi pin mode swap, config mipi_tx current and impedance,
and some fixup. I drop drm_bridge patches in this version.

The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:
  Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)
are available in the Git repository at:
  https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git
tags/mediatek-drm-next-5.8
for you to fetch changes up to 007d274a017bb4e2ef7b922c2f54f40cf2073664:
  drm/mediatek: Eliminate the magic number in array size (2020-05-16
17:08:47 +0800)

Mediatek DRM Next for Linux 5.8

Anand K Mistry (1):
  drm/mediatek: Stop iterating dma addresses when sg_dma_len() == 0
Bernard Zhao (2):
  drm/mediatek: Cleanup coding style in mediatek a bit
  drm/mediatek: Eliminate the magic number in array size
Chun-Kuang Hu (1):
  Merge tag 'v5.7-next-drm-stable' of
ssh://gitolite.kernel.org/.../matthias.bgg/linux into
mediatek-drm-next
Enric Balletbo i Serra (4):
  dt-bindings: mediatek: Update mmsys binding to reflect it is a
system controller
  soc / drm: mediatek: Move routing control to mmsys device
  soc / drm: mediatek: Fix mediatek-drm device probing
  drm/mediatek: Remove debug messages for function calls
Hsin-Yi Wang (1):
  drm/mediatek: Fix device passed to cmdq
Jitao Shi (6):
  dt-bindings: display: mediatek: control dpi pins mode to avoid leakage
  drm/mediatek: set dpi pin mode to gpio low to avoid leakage current
  dt-bindings: display: mediatek: add property to control mipi tx
drive current
  dt-bindings: display: mediatek: get mipitx calibration data from nvmem
  drm/mediatek: add the mipitx driving control
  drm/mediatek: config mipitx impedance with calibration data
Matthias Brugger (2):
  drm/mediatek: Omit warning on probe defers
  clk / soc: mediatek: Move mt8173 MMSYS to platform driver
YueHaibing (1):
  drm/mediatek: Fix Kconfig warning
 Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt   |   7 +-
 Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt |   6 +
 Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt |  10 ++
 drivers/clk/mediatek/Kconfig|   7 +
 drivers/clk/mediatek/Makefile   |   1 +
 drivers/clk/mediatek/clk-mt8173-mm.c|
146 +++
 drivers/clk/mediatek/clk-mt8173.c   |
104 --
 drivers/gpu/drm/mediatek/Kconfig|   1 +
 drivers/gpu/drm/mediatek/mtk_disp_color.c   |   5 +-
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c |   5 +-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c|   5 +-
 drivers/gpu/drm/mediatek/mtk_dpi.c  |
 43 +-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  27 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  |
259 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  |
 50 +++
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
 drivers/gpu/drm/mediatek/mtk_drm_gem.c  |   3 +
 drivers/gpu/drm/mediatek/mtk_dsi.c  |   8 +-
 drivers/gpu/drm/mediatek/mtk_hdmi.c |  22 ++-
 drivers/gpu/drm/mediatek/mtk_mipi_tx.c  |
 54 +++
 drivers/gpu/drm/mediatek/mtk_mipi_tx.h  |   4 +
 drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c   |  28 
 drivers/soc/mediatek/Kconfig|   8 ++
 drivers/soc/mediatek/Makefile   |   1 +
 drivers/soc/mediatek/mtk-mmsys.c|
337 
 include/linux/soc/mediatek/mtk-mmsys.h  |  20 +++
 27 files changed, 739 insertions(+), 431 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8173-mm.c
 create mode 100644 drivers/soc/mediatek/mtk-mmsys.c
 create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm/mediatek: mtk_dpi: Convert to bridge driver

2020-05-05 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月4日 週一 下午10:14寫道:
>
> Convert mtk_dpi to a bridge driver with built-in encoder support for
> compatibility with existing component drivers.

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 66 +++---
>  1 file changed, 34 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 7112125dc3d1..baad198c69eb 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -61,6 +61,7 @@ enum mtk_dpi_out_color_format {
>  struct mtk_dpi {
> struct mtk_ddp_comp ddp_comp;
> struct drm_encoder encoder;
> +   struct drm_bridge bridge;
> struct drm_bridge *next_bridge;
> void __iomem *regs;
> struct device *dev;
> @@ -77,9 +78,9 @@ struct mtk_dpi {
> int refcount;
>  };
>
> -static inline struct mtk_dpi *mtk_dpi_from_encoder(struct drm_encoder *e)
> +static inline struct mtk_dpi *bridge_to_dpi(struct drm_bridge *b)
>  {
> -   return container_of(e, struct mtk_dpi, encoder);
> +   return container_of(b, struct mtk_dpi, bridge);
>  }
>
>  enum mtk_dpi_polarity {
> @@ -518,50 +519,44 @@ static const struct drm_encoder_funcs 
> mtk_dpi_encoder_funcs = {
> .destroy = mtk_dpi_encoder_destroy,
>  };
>
> -static bool mtk_dpi_encoder_mode_fixup(struct drm_encoder *encoder,
> -  const struct drm_display_mode *mode,
> -  struct drm_display_mode *adjusted_mode)
> +static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> +enum drm_bridge_attach_flags flags)
>  {
> -   return true;
> +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> +
> +   return drm_bridge_attach(bridge->encoder, dpi->next_bridge,
> +>bridge, flags);
>  }
>
> -static void mtk_dpi_encoder_mode_set(struct drm_encoder *encoder,
> -struct drm_display_mode *mode,
> -struct drm_display_mode *adjusted_mode)
> +static void mtk_dpi_bridge_mode_set(struct drm_bridge *bridge,
> +   const struct drm_display_mode *mode,
> +   const struct drm_display_mode *adjusted_mode)
>  {
> -   struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
> +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
>
> drm_mode_copy(>mode, adjusted_mode);
>  }
>
> -static void mtk_dpi_encoder_disable(struct drm_encoder *encoder)
> +static void mtk_dpi_bridge_disable(struct drm_bridge *bridge)
>  {
> -   struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
> +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
>
> mtk_dpi_power_off(dpi);
>  }
>
> -static void mtk_dpi_encoder_enable(struct drm_encoder *encoder)
> +static void mtk_dpi_bridge_enable(struct drm_bridge *bridge)
>  {
> -   struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
> +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
>
> mtk_dpi_power_on(dpi);
> mtk_dpi_set_display_mode(dpi, >mode);
>  }
>
> -static int mtk_dpi_atomic_check(struct drm_encoder *encoder,
> -   struct drm_crtc_state *crtc_state,
> -   struct drm_connector_state *conn_state)
> -{
> -   return 0;
> -}
> -
> -static const struct drm_encoder_helper_funcs mtk_dpi_encoder_helper_funcs = {
> -   .mode_fixup = mtk_dpi_encoder_mode_fixup,
> -   .mode_set = mtk_dpi_encoder_mode_set,
> -   .disable = mtk_dpi_encoder_disable,
> -   .enable = mtk_dpi_encoder_enable,
> -   .atomic_check = mtk_dpi_atomic_check,
> +static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> +   .attach = mtk_dpi_bridge_attach,
> +   .mode_set = mtk_dpi_bridge_mode_set,
> +   .disable = mtk_dpi_bridge_disable,
> +   .enable = mtk_dpi_bridge_enable,
>  };
>
>  static void mtk_dpi_start(struct mtk_ddp_comp *comp)
> @@ -602,16 +597,13 @@ static int mtk_dpi_bind(struct device *dev, struct 
> device *master, void *data)
> dev_err(dev, "Failed to initialize decoder: %d\n", ret);
> goto err_unregister;
> }
> -   drm_encoder_helper_add(>encoder, _dpi_encoder_helper_funcs);
>
> /* Currently DPI0 is fixed to be driven by OVL1 */
> dpi->encoder.possible_crtcs = BIT(1);
>
> -   ret = drm_bridge_attach(>encoder, dpi->next_bridge, NULL, 0);
&

Re: [PATCH 3/3] drm/mediatek: mtk_dpi: Use simple encoder

2020-05-05 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月4日 週一 下午10:14寫道:
>
> The mtk_dpi driver uses an empty implementation for its encoder. Replace
> the code with the generic simple encoder.

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++---
>  1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index baad198c69eb..80778b2aac2a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "mtk_dpi_regs.h"
>  #include "mtk_drm_ddp_comp.h"
> @@ -510,15 +511,6 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> return 0;
>  }
>
> -static void mtk_dpi_encoder_destroy(struct drm_encoder *encoder)
> -{
> -   drm_encoder_cleanup(encoder);
> -}
> -
> -static const struct drm_encoder_funcs mtk_dpi_encoder_funcs = {
> -   .destroy = mtk_dpi_encoder_destroy,
> -};
> -
>  static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
>  enum drm_bridge_attach_flags flags)
>  {
> @@ -591,8 +583,8 @@ static int mtk_dpi_bind(struct device *dev, struct device 
> *master, void *data)
> return ret;
> }
>
> -   ret = drm_encoder_init(drm_dev, >encoder, _dpi_encoder_funcs,
> -  DRM_MODE_ENCODER_TMDS, NULL);
> +   ret = drm_simple_encoder_init(drm_dev, >encoder,
> + DRM_MODE_ENCODER_TMDS);
> if (ret) {
> dev_err(dev, "Failed to initialize decoder: %d\n", ret);
> goto err_unregister;
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 -next] drm/mediatek: Fix Kconfig warning

2020-05-05 Thread Chun-Kuang Hu
Hi, YueHaibing:

Chun-Kuang Hu  於 2020年4月29日 週三 下午10:15寫道:
>
> Hi, YueHaibing:
>
> YueHaibing  於 2020年4月29日 週三 下午3:14寫道:
> >
> > WARNING: unmet direct dependencies detected for MTK_MMSYS
> >   Depends on [n]: (ARCH_MEDIATEK [=y] || COMPILE_TEST [=n]) && 
> > COMMON_CLK_MT8173_MMSYS [=n]
> >   Selected by [y]:
> >   - DRM_MEDIATEK [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_MEDIATEK [=y] 
> > || ARM && COMPILE_TEST [=n]) && COMMON_CLK [=y] && HAVE_ARM_SMCCC [=y] && 
> > OF [=y]
> >
> > Make DRM_MEDIATEK depend on MTK_MMSYS to fix this.
>
> Reviewed-by: Chun-Kuang Hu 
>

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

> >
> > Fixes: 2c758e301ed9 ("soc / drm: mediatek: Move routing control to mmsys 
> > device")
> > Signed-off-by: YueHaibing 
> > ---
> > v3: make DRM_MEDIATEK depends on MTK_MMSYS
> > v2: select COMMON_CLK_MT8173_MMSYS instead of adding DRM_MEDIATEK dependency
> > ---
> >  drivers/gpu/drm/mediatek/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> > b/drivers/gpu/drm/mediatek/Kconfig
> > index c420f5a3d33b..aa74aac3cbcc 100644
> > --- a/drivers/gpu/drm/mediatek/Kconfig
> > +++ b/drivers/gpu/drm/mediatek/Kconfig
> > @@ -6,12 +6,12 @@ config DRM_MEDIATEK
> > depends on COMMON_CLK
> > depends on HAVE_ARM_SMCCC
> > depends on OF
> > +   depends on MTK_MMSYS
> > select DRM_GEM_CMA_HELPER
> > select DRM_KMS_HELPER
> > select DRM_MIPI_DSI
> > select DRM_PANEL
> > select MEMORY
> > -   select MTK_MMSYS
> > select MTK_SMI
> > select VIDEOMODE_HELPERS
> > help
> > --
> > 2.17.1
> >
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0

2020-05-05 Thread Chun-Kuang Hu
Hi, Anand,

Chun-Kuang Hu  於 2020年4月29日 週三 上午12:37寫道:
>
> Hi, Anand,
>
> Anand K. Mistry  於 2020年4月28日 週二 上午9:54寫道:
> >
> > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu  wrote:
> > >
> > > Hi, Anand:
> > >
> > > Anand K Mistry  於 2020年4月20日 週一 下午2:09寫道:
> > > >
> > > > If dma_map_sg() merges pages when creating the mapping, only the first
> > > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > > > entries with sg_dma_len() == 0.
> > > >
> > > > Signed-off-by: Anand K Mistry 

Author should sign off this patch, please give a sign off tag by author.

Regards,
Chun-Kuang.

> > > > ---
> > > >  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> > > > b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > @@ -224,6 +224,9 @@ struct drm_gem_object 
> > > > *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > >
> > > > expected = sg_dma_address(sg->sgl);
> > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > +   if (!sg_dma_len(s))
> > > > +   break;
> > >
> > > I think this should be 'continue'
> >
> > scatterlist.h has the comment:
> > /*
> >  * These macros should be used after a dma_map_sg call has been done
> >  * to get bus addresses of each of the SG entries and their lengths.
> >  * You should only work with the number of sg entries dma_map_sg
> >  * returns, or alternatively stop on the first sg_dma_len(sg) which
> >  * is 0.
> >  */
> >
> > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> > the documented approach.
> >
>
> Okay, you're right. So
>
> Reviewed-by: Chun-Kuang Hu 
>
> > >
> > > Regards,
> > > Chun-Kuang.
> > >
> > > > +
> > > > if (sg_dma_address(s) != expected) {
> > > > DRM_ERROR("sg_table is not contiguous");
> > > > ret = -EINVAL;
> > > > --
> > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > >
> > > >
> > > > ___
> > > > Linux-mediatek mailing list
> > > > linux-media...@lists.infradead.org
> > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 20/36] drm/mediatek: remove _unlocked suffix in drm_object_put_unlocked

2020-05-09 Thread Chun-Kuang Hu
Hi, Emil:

Emil Velikov  於 2020年5月7日 週四 下午11:11寫道:
>
> From: Emil Velikov 
>
> Spelling out _unlocked for each and every driver is a annoying.
> Especially if we consider how many drivers, do not know (or need to)
> about the horror stories involving struct_mutex.
>
> Just drop the suffix. It makes the API cleaner.
>
> Done via the following script:
>
> __from=drm_gem_object_put_unlocked
> __to=drm_gem_object_put
> for __file in $(git grep --name-only $__from); do
>   sed -i  "s/$__from/$__to/g" $__file;
> done

Acked-by: Chun-Kuang Hu 

>
> Cc: Chun-Kuang Hu 
> Cc: Philipp Zabel 
> Cc: David Airlie 
> Signed-off-by: Emil Velikov 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index b04a3c2b111e..fcb81f354224 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -117,7 +117,7 @@ int mtk_drm_gem_dumb_create(struct drm_file *file_priv, 
> struct drm_device *dev,
> goto err_handle_create;
>
> /* drop reference from allocate - handle holds it now. */
> -   drm_gem_object_put_unlocked(_gem->base);
> +   drm_gem_object_put(_gem->base);
>
> return 0;
>
> --
> 2.25.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0

2020-05-09 Thread Chun-Kuang Hu
Hi, Anand:

Anand Mistry  於 2020年5月7日 週四 下午7:56寫道:
>
> On Wed, May 6, 2020 at 10:59 PM Chun-Kuang Hu  wrote:
> >
> > Hi, Anand:
> >
> > Anand Mistry  於 2020年5月6日 週三 下午7:03寫道:
> > >
> > > On Wed, May 6, 2020 at 10:25 AM Chun-Kuang Hu  
> > > wrote:
> > > >
> > > > Hi, Anand,
> > > >
> > > > Chun-Kuang Hu  於 2020年4月29日 週三 上午12:37寫道:
> > > > >
> > > > > Hi, Anand,
> > > > >
> > > > > Anand K. Mistry  於 2020年4月28日 週二 上午9:54寫道:
> > > > > >
> > > > > > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu 
> > > > > >  wrote:
> > > > > > >
> > > > > > > Hi, Anand:
> > > > > > >
> > > > > > > Anand K Mistry  於 2020年4月20日 週一 下午2:09寫道:
> > > > > > > >
> > > > > > > > If dma_map_sg() merges pages when creating the mapping, only 
> > > > > > > > the first
> > > > > > > > entries will have a valid sg_dma_address() and sg_dma_len(), 
> > > > > > > > followed by
> > > > > > > > entries with sg_dma_len() == 0.
> > > > > > > >
> > > > > > > > Signed-off-by: Anand K Mistry 
> > > >
> > > > Author should sign off this patch, please give a sign off tag by author.
> > >
> > > Sorry, email issues meant i sent the patch from a different account.
> > > Should I re-send the
> > > patch from the same account as the sign-off line? I'm still working my
> > > way through the kernel patch process.
> > >
> >
> > If you want to use chromium account, you could simply reply this email
> > with a sign-off-by tag of chromium account.
>
> Ack. As path of least resistance, here:
>
> Signed-off-by: Anand K Mistry 
>

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> >
> > Regards,
> > Chun-Kuang.
> >
> > > >
> > > > Regards,
> > > > Chun-Kuang.
> > > >
> > > > > > > > ---
> > > > > > > >  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > > > > > >  1 file changed, 3 insertions(+)
> > > > > > > >
> > > > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> > > > > > > > b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > > @@ -224,6 +224,9 @@ struct drm_gem_object 
> > > > > > > > *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > > > > > >
> > > > > > > > expected = sg_dma_address(sg->sgl);
> > > > > > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > > > > > +   if (!sg_dma_len(s))
> > > > > > > > +   break;
> > > > > > >
> > > > > > > I think this should be 'continue'
> > > > > >
> > > > > > scatterlist.h has the comment:
> > > > > > /*
> > > > > >  * These macros should be used after a dma_map_sg call has been done
> > > > > >  * to get bus addresses of each of the SG entries and their lengths.
> > > > > >  * You should only work with the number of sg entries dma_map_sg
> > > > > >  * returns, or alternatively stop on the first sg_dma_len(sg) which
> > > > > >  * is 0.
> > > > > >  */
> > > > > >
> > > > > > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> > > > > > the documented approach.
> > > > > >
> > > > >
> > > > > Okay, you're right. So
> > > > >
> > > > > Reviewed-by: Chun-Kuang Hu 
> > > > >
> > > > > > >
> > > > > > > Regards,
> > > > > > > Chun-Kuang.
> > > > > > >
> > > > > > > > +
> > > > > > > > if (sg_dma_address(s) != expected) {
> > > > > > > > DRM_ERROR("sg_table is not contiguous");
> > > > > > > > ret = -EINVAL;
> > > > > > > > --
> > > > > > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > > > > > >
> > > > > > > >
> > > > > > > > ___
> > > > > > > > Linux-mediatek mailing list
> > > > > > > > linux-media...@lists.infradead.org
> > > > > > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [GIT PULL] mediatek drm next for 5.8

2020-05-13 Thread Chun-Kuang Hu
Hi, Daniel:

Daniel Vetter  於 2020年5月14日 週四 上午3:45寫道:
>
> On Thu, May 14, 2020 at 12:16:59AM +0800, Chun-Kuang Hu wrote:
> > Hi, Dave & Daniel:
> >
> > This include dpi pin mode swap, config mipi_tx current and impedance,
> > convert mtk-dpi to drm_bridge API, and some fixup.
> >
> > The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:
> >   Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)
> > are available in the Git repository at:
> >   
> > ssh://g...@gitolite.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git
> > tags/mediatek-drm-next-5.8
>
> Your pull request is badly line wrapped, and I don't have an ssh account
> on that machine ... Maybe airlied has, not sure. http:// or git:// would
> be a bunch easier, and then signed that. Plus if your pull isn't
> linewrapped we can stuff it directly into scripts.

This is my first time to request-pull on that server, I would try to
make things easier and resend request.

>
> All I quickly wanted to quickly check is your new bridge driver.
> - was that reviewed/acked by bridge maintainers? There's a lot of rework
>   going on right now, need to make sure we're not adding new bridge
>   drivers that use old style
>
> - why is this bridge driver not in drm/bridge/ directory?

I does not notice that drm bridge has maintainer, I would drop bridge
series first, and wait for ack of bridge maintainer.
mtk-dpi is also a drm encoder, and I grep 'drm_bridge_add' and find
many out side of bridge folder, so maybe we need to discuss more about
this.

Regards,
Chun-Kuang.

>
> Cheers, Daniel
>
> > for you to fetch changes up to 23b29ff9f13a8fb5a12be9fedb8b614b9dede46a:
> >   drm/mediatek: Eliminate the magic number in array size (2020-05-10
> > 09:08:30 +0800)
> > 
> > Mediatek DRM Next for Linux 5.8
> > 
> > Anand K Mistry (1):
> >   drm/mediatek: Stop iterating dma addresses when sg_dma_len() == 0
> > Bernard Zhao (2):
> >   drm/mediatek: Cleanup coding style in mediatek a bit
> >   drm/mediatek: Eliminate the magic number in array size
> > Chun-Kuang Hu (1):
> >   Merge tag 'v5.7-next-drm-stable' of
> > ssh://gitolite.kernel.org/.../matthias.bgg/linux into
> > mediatek-drm-next
> > Enric Balletbo i Serra (7):
> >   dt-bindings: mediatek: Update mmsys binding to reflect it is a
> > system controller
> >   soc / drm: mediatek: Move routing control to mmsys device
> >   soc / drm: mediatek: Fix mediatek-drm device probing
> >   drm/mediatek: Remove debug messages for function calls
> >   drm/mediatek: mtk_dpi: Rename bridge to next_bridge
> >   drm/mediatek: mtk_dpi: Convert to bridge driver
> >   drm/mediatek: mtk_dpi: Use simple encoder
> > Hsin-Yi Wang (1):
> >   drm/mediatek: Fix device passed to cmdq
> > Jitao Shi (6):
> >   dt-bindings: display: mediatek: control dpi pins mode to avoid leakage
> >   drm/mediatek: set dpi pin mode to gpio low to avoid leakage current
> >   dt-bindings: display: mediatek: add property to control mipi tx
> > drive current
> >   dt-bindings: display: mediatek: get mipitx calibration data from nvmem
> >   drm/mediatek: add the mipitx driving control
> >   drm/mediatek: config mipitx impedance with calibration data
> > Matthias Brugger (2):
> >   drm/mediatek: Omit warning on probe defers
> >   clk / soc: mediatek: Move mt8173 MMSYS to platform driver
> > YueHaibing (1):
> >   drm/mediatek: Fix Kconfig warning
> >  Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt   |   7 
> > +-
> >  Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt |   6 +
> >  Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt |  10 
> > ++
> >  drivers/clk/mediatek/Kconfig|   7 +
> >  drivers/clk/mediatek/Makefile   |   1 +
> >  drivers/clk/mediatek/clk-mt8173-mm.c|
> > 146 +++
> >  drivers/clk/mediatek/clk-mt8173.c   |
> > 104 --
> >  drivers/gpu/drm/mediatek/Kconfig|   1 +
> >  drivers/gpu/drm/mediatek/mtk_disp_color.c   |   5 
> > +-
> >  drivers/gpu/drm/mediatek/mtk_disp_ovl.c |   5 
> > +-
> >  drivers/gpu/drm/mediatek/mtk_disp_rdma.c 

Re: [PATCH 0/3] Convert mtk-dpi to drm_bridge API

2020-05-16 Thread Chun-Kuang Hu
Hi, Enric:

Chun-Kuang Hu  於 2020年5月10日 週日 上午9:24寫道:
>
> Hi, Enric:
>
> Enric Balletbo i Serra  於 2020年5月4日 週一 
> 下午10:14寫道:
> >
> > The mtk-dpi driver still uses the drm_encoder API which is now somehow
> > deprecated. We started to move all the Mediatek drivers to the drm_bridge 
> > API,
> > like we did for the mtk-dsi driver [1], this is another small step to be 
> > able to
> > fully convert the DRM Mediatek drivers to the drm_bridge API. A dummy
> > drm_encoder is maintained in the mtk-dpi driver but the end goal is move 
> > all the
> > dummy drm_encoder (mtk-dsi, mtk-dpi, etc) to the main mtk_drm_drv driver.
>
> For this series, applied to mediatek-drm-next [1], thanks.
>
> [1] 
> https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
>

I remove this series from mediatek-drm-next because drm bridge driver
need ack of drm bridge maintainer.

Regards,
Chun-Kuang.

> Regards,
> Chun-Kuang.
>
> >
> > Best regards,
> >  Enric
> >
> > [1] https://lore.kernel.org/patchwork/project/lkml/list/?series=441559
> >
> > Enric Balletbo i Serra (3):
> >   drm/mediatek: mtk_dpi: Rename bridge to next_bridge
> >   drm/mediatek: mtk_dpi: Convert to bridge driver
> >   drm/mediatek: mtk_dpi: Use simple encoder
> >
> >  drivers/gpu/drm/mediatek/mtk_dpi.c | 84 ++
> >  1 file changed, 39 insertions(+), 45 deletions(-)
> >
> > --
> > 2.26.2
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges

2020-05-16 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月15日 週五 上午1:35寫道:
>
> Hi again,
>
> On 14/5/20 19:12, Enric Balletbo i Serra wrote:
> > Hi Chun-Kuang,
> >
> > On 14/5/20 18:44, Chun-Kuang Hu wrote:
> >> Hi, Enric:
> >>
> >> Enric Balletbo i Serra  於 2020年5月14日 週四 
> >> 下午11:42寫道:
> >>>
> >>> Hi Chun-Kuang,
> >>>
> >>> On 14/5/20 16:28, Chun-Kuang Hu wrote:
> >>>> Hi, Enric:
> >>>>
> >>>> Enric Balletbo Serra  於 2020年5月14日 週四 上午12:41寫道:
> >>>>>
> >>>>> Hi Chun-Kuang,
> >>>>>
> >>>>> Missatge de Enric Balletbo i Serra  del
> >>>>> dia dv., 1 de maig 2020 a les 17:25:
> >>>>>>
> >>>>>> Use the drm_bridge_connector helper to create a connector for pipelines
> >>>>>> that use drm_bridge. This allows splitting connector operations across
> >>>>>> multiple bridges when necessary, instead of having the last bridge in
> >>>>>> the chain creating the connector and handling all connector operations
> >>>>>> internally.
> >>>>>>
> >>>>>> Signed-off-by: Enric Balletbo i Serra 
> >>>>>> Acked-by: Sam Ravnborg 
> >>>>>
> >>>>> A gentle ping on this, I think that this one is the only one that
> >>>>> still needs a review in the series.
> >>>>
> >>>> This is what I reply in patch v3:
> >>>>
> >>>
> >>> Sorry for missing this.
> >>>
> >>>> I think the panel is wrapped into next_bridge here,
> >>>>
> >>>
> >>> Yes, you can have for example:
> >>>
> >>> 1. drm_bridge (mtk_dsi) -> drm_bridge (ps8640 - dsi-to-edp) -> 
> >>> drm_panel_bridge
> >>> (edp panel)
> >>>
> >>> or a
> >>>
> >>> 2. drm_bridge (mtk_dsi)-> drm_panel_bridge (dsi panel)
> >>>
> >>> The _first_ one is my use case
> >>>
> >>>> if (panel) {
> >>>
> >>> This handles the second case, where you attach a dsi panel.
> >>>
> >>>> dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
> >>>>
> >>>> so the next_bridge is a panel_bridge, in its attach function
> >>>> panel_bridge_attach(),
> >>>> according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
> >>>> it would create connector and attach connector to panel.
> >>>>
> >>>> I'm not sure this flag would exist or not, but for both case, it's 
> >>>> strange.
> >>>> If exist, you create connector in this patch but no where to attach
> >>>> connector to panel.
> >>>
> >>> Yes, in fact, this is transitional patch needed, as once I converted 
> >>> mtk_dpi,
> >>> mtk_dsi and mtk_hdmi to the new drm_bridge API the 
> >>> drm_bridge_connector_init()
> >>> will be done in mtk_drm_drv. We will need to call 
> >>> drm_bridge_connector_init for
> >>> dpi and dsi pipes and remove that call from mtk_dsi and mtk_dpi drivers. 
> >>> The
> >>> graphic controller driver should create connectors and CRTCs, as example 
> >>> you can
> >>> take a look at drivers/gpu/drm/omapdrm/omap_drv.c
> >>>
> >>
> >> I have such question because I've reviewed omap's driver. In omap's
> >> driver, after it call drm_bridge_connector_init(), it does this:
> >>
> >> if (pipe->output->panel) {
> >> ret = drm_panel_attach(pipe->output->panel,
> >>   pipe->connector);
> >> if (ret < 0)
> >> return ret;
> >> }
> >>
> >> In this patch, you does not do this.
> >>
> >
> > I see, so yes, I am probably missing call drm_panel_attach in case there is 
> > a
> > direct panel attached. Thanks for pointing it.
> >
> > I'll send a new version adding the drm_panel_attach call.
> >
>
> Wait, shouldn't panel be attached on the call of mtk_dsi_bridge_attach as
> next_bridge points to a bridge or a panel?
>
> static int mtk_dsi_bridge_attach(struct drm_bridge *bridge,
>  enum drm_bridge_attach_flags flags)
> {
> struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> /* Attach th

Re: [PATCH] drm/mediatek: Delete not used of_device_get_match_data

2020-05-18 Thread Chun-Kuang Hu
Hi, Matthias:

 於 2020年5月18日 週一 下午7:23寫道:
>
> From: Matthias Brugger 
>
> The driver will be loaded by via a platform device. So we
> will need to get the device_node from the parent device.
> Depending on this we will set the driver data.
> As all this is done later already, just delete the call to
> of_device_get_match_data.
>

Reviewed-by: Chun-Kuang Hu 

> Signed-off-by: Matthias Brugger 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index e2bb0d19ef99..63ec92ba0e92 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -447,7 +447,6 @@ static int mtk_drm_probe(struct platform_device *pdev)
> if (!private)
> return -ENOMEM;
>
> -   private->data = of_device_get_match_data(dev);
> private->mmsys_dev = dev->parent;
> if (!private->mmsys_dev) {
> dev_err(dev, "Failed to get MMSYS device\n");
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges

2020-05-14 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo Serra  於 2020年5月14日 週四 上午12:41寫道:
>
> Hi Chun-Kuang,
>
> Missatge de Enric Balletbo i Serra  del
> dia dv., 1 de maig 2020 a les 17:25:
> >
> > Use the drm_bridge_connector helper to create a connector for pipelines
> > that use drm_bridge. This allows splitting connector operations across
> > multiple bridges when necessary, instead of having the last bridge in
> > the chain creating the connector and handling all connector operations
> > internally.
> >
> > Signed-off-by: Enric Balletbo i Serra 
> > Acked-by: Sam Ravnborg 
>
> A gentle ping on this, I think that this one is the only one that
> still needs a review in the series.

This is what I reply in patch v3:

I think the panel is wrapped into next_bridge here,

if (panel) {
dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);

so the next_bridge is a panel_bridge, in its attach function
panel_bridge_attach(),
according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
it would create connector and attach connector to panel.

I'm not sure this flag would exist or not, but for both case, it's strange.
If exist, you create connector in this patch but no where to attach
connector to panel.
If not exist, the next_brige would create one connector and this brige
would create another connector.

I think in your case, mtk_dsi does not directly connect to a panel, so
I need a exact explain. Or someone could test this on a
directly-connect-panel platform.

Regards,
Chun-Kuang.

>
> Thanks,
>  Enric
>
> > ---
> >
> > Changes in v4: None
> > Changes in v3:
> > - Move the bridge.type line to the patch that adds drm_bridge support. 
> > (Laurent Pinchart)
> >
> > Changes in v2: None
> >
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 13 -
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> > b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index 4f3bd095c1ee..471fcafdf348 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -17,6 +17,7 @@
> >
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -183,6 +184,7 @@ struct mtk_dsi {
> > struct drm_encoder encoder;
> > struct drm_bridge bridge;
> > struct drm_bridge *next_bridge;
> > +   struct drm_connector *connector;
> > struct phy *phy;
> >
> > void __iomem *regs;
> > @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm_device 
> > *drm, struct mtk_dsi *dsi)
> >  */
> > dsi->encoder.possible_crtcs = 1;
> >
> > -   ret = drm_bridge_attach(>encoder, >bridge, NULL, 0);
> > +   ret = drm_bridge_attach(>encoder, >bridge, NULL,
> > +   DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> > if (ret)
> > goto err_cleanup_encoder;
> >
> > +   dsi->connector = drm_bridge_connector_init(drm, >encoder);
> > +   if (IS_ERR(dsi->connector)) {
> > +   DRM_ERROR("Unable to create bridge connector\n");
> > +   ret = PTR_ERR(dsi->connector);
> > +   goto err_cleanup_encoder;
> > +   }
> > +   drm_connector_attach_encoder(dsi->connector, >encoder);
> > +
> > return 0;
> >
> >  err_cleanup_encoder:
> > --
> > 2.26.2
> >
> >
> > ___
> > Linux-mediatek mailing list
> > linux-media...@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges

2020-05-14 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月14日 週四 下午11:42寫道:
>
> Hi Chun-Kuang,
>
> On 14/5/20 16:28, Chun-Kuang Hu wrote:
> > Hi, Enric:
> >
> > Enric Balletbo Serra  於 2020年5月14日 週四 上午12:41寫道:
> >>
> >> Hi Chun-Kuang,
> >>
> >> Missatge de Enric Balletbo i Serra  del
> >> dia dv., 1 de maig 2020 a les 17:25:
> >>>
> >>> Use the drm_bridge_connector helper to create a connector for pipelines
> >>> that use drm_bridge. This allows splitting connector operations across
> >>> multiple bridges when necessary, instead of having the last bridge in
> >>> the chain creating the connector and handling all connector operations
> >>> internally.
> >>>
> >>> Signed-off-by: Enric Balletbo i Serra 
> >>> Acked-by: Sam Ravnborg 
> >>
> >> A gentle ping on this, I think that this one is the only one that
> >> still needs a review in the series.
> >
> > This is what I reply in patch v3:
> >
>
> Sorry for missing this.
>
> > I think the panel is wrapped into next_bridge here,
> >
>
> Yes, you can have for example:
>
> 1. drm_bridge (mtk_dsi) -> drm_bridge (ps8640 - dsi-to-edp) -> 
> drm_panel_bridge
> (edp panel)
>
> or a
>
> 2. drm_bridge (mtk_dsi)-> drm_panel_bridge (dsi panel)
>
> The _first_ one is my use case
>
> > if (panel) {
>
> This handles the second case, where you attach a dsi panel.
>
> > dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
> >
> > so the next_bridge is a panel_bridge, in its attach function
> > panel_bridge_attach(),
> > according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
> > it would create connector and attach connector to panel.
> >
> > I'm not sure this flag would exist or not, but for both case, it's strange.
> > If exist, you create connector in this patch but no where to attach
> > connector to panel.
>
> Yes, in fact, this is transitional patch needed, as once I converted mtk_dpi,
> mtk_dsi and mtk_hdmi to the new drm_bridge API the drm_bridge_connector_init()
> will be done in mtk_drm_drv. We will need to call drm_bridge_connector_init 
> for
> dpi and dsi pipes and remove that call from mtk_dsi and mtk_dpi drivers. The
> graphic controller driver should create connectors and CRTCs, as example you 
> can
> take a look at drivers/gpu/drm/omapdrm/omap_drv.c
>

I have such question because I've reviewed omap's driver. In omap's
driver, after it call drm_bridge_connector_init(), it does this:

if (pipe->output->panel) {
ret = drm_panel_attach(pipe->output->panel,
  pipe->connector);
if (ret < 0)
return ret;
}

In this patch, you does not do this.

> > If not exist, the next_brige would create one connector and this brige
> > would create another connector.
> >
> > I think in your case, mtk_dsi does not directly connect to a panel, so
>
> Exactly
>
> > I need a exact explain. Or someone could test this on a
> > directly-connect-panel platform.
>
> I don't think I am breaking this use case but AFAICS there is no users in
> mainline that directly connect a panel using the mediatek driver. As I said my
> use case is the other so I can't really test. Do you know anyone that can 
> test this?

I'm not sure who can test this, but [1], which is sent by YT Shen in a
series, is a patch to support dsi command mode so dsi could directly
connect to panel.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.7-rc5=21898816831fc60c92dd634ab4316a24da7eb4af

It's better that someone could test this case, but if no one would
test this, I could also accept a good-look patch.

Regards,
Chun-Kuang.

>
> Thanks,
>  Enric
>
> >
> > Regards,
> > Chun-Kuang.
> >
> >>
> >> Thanks,
> >>  Enric
> >>
> >>> ---
> >>>
> >>> Changes in v4: None
> >>> Changes in v3:
> >>> - Move the bridge.type line to the patch that adds drm_bridge support. 
> >>> (Laurent Pinchart)
> >>>
> >>> Changes in v2: None
> >>>
> >>>  drivers/gpu/drm/mediatek/mtk_dsi.c | 13 -
> >>>  1 file changed, 12 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
> >>> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> >>> index 4f3bd095c1ee..471fcafdf348 100644
> >>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> >>> +++ b/drivers/

Re: [PATCH v13 1/6] dt-bindings: media: add pclk-sample dual edge property

2020-03-17 Thread Chun-Kuang Hu
Hi, Jitao:

I agree with Neil, so please base on Boris' effort to negotiate with bridge.

Regards,
Chun-Kuang Hu

Neil Armstrong  於 2020年3月11日 週三 下午9:53寫道:

>
> Hi,
>
> On 11/03/2020 08:18, Jitao Shi wrote:
> > Some chips's sample mode are rising, falling and dual edge (both
> > falling and rising edge).
> > Extern the pclk-sample property to support dual edge.
> >
> > Acked-by: Rob Herring 
> > Reviewed-by: CK Hu 
> > Signed-off-by: Jitao Shi 
> > ---
> >  Documentation/devicetree/bindings/media/video-interfaces.txt | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt 
> > b/Documentation/devicetree/bindings/media/video-interfaces.txt
> > index f884ada0bffc..da9ad24935db 100644
> > --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
> > +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> > @@ -118,8 +118,8 @@ Optional endpoint properties
> >  - data-enable-active: similar to HSYNC and VSYNC, specifies the data enable
> >signal polarity.
> >  - field-even-active: field signal level during the even field data 
> > transmission.
> > -- pclk-sample: sample data on rising (1) or falling (0) edge of the pixel 
> > clock
> > -  signal.
> > +- pclk-sample: sample data on rising (1), falling (0) or both rising and
> > +  falling (2) edge of the pixel clock signal.
> >  - sync-on-green-active: active state of Sync-on-green (SoG) signal, 0/1 for
> >LOW/HIGH respectively.
> >  - data-lanes: an array of physical data lane indexes. Position of an entry
> >
>
> This changes the bus format, but we recently introduced a bus format 
> negociation
> between bridges to avoid adding such properties into DT, and make bus format 
> setup
> dynamic between an encoder and a bridge.
>
> It would be great to use that instead.
>
> Neil
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/4] Move Mediatek HDMI PHY driver from DRM folder to PHY folder

2020-03-22 Thread Chun-Kuang Hu
mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
more suitable to place a phy driver into phy driver folder, so move
mtk_hdmi_phy driver into phy driver folder.

CK Hu (3):
  drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver
  drm/mediatek: Separate mtk_hdmi_phy to an independent module
  drm/mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek
folder

Chun-Kuang Hu (1):
  MAINTAINERS: add files for Mediatek DRM drivers

 MAINTAINERS   |  1 +
 drivers/gpu/drm/mediatek/Kconfig  |  2 +-
 drivers/gpu/drm/mediatek/Makefile |  5 +---
 drivers/gpu/drm/mediatek/mtk_hdmi.c   | 23 +++
 drivers/gpu/drm/mediatek/mtk_hdmi.h   |  1 -
 drivers/phy/mediatek/Kconfig  |  7 ++
 drivers/phy/mediatek/Makefile |  7 ++
 .../mediatek/phy-mtk-hdmi-mt2701.c}   |  3 +--
 .../mediatek/phy-mtk-hdmi-mt8173.c}   |  2 +-
 .../mediatek/phy-mtk-hdmi.c}  |  3 ++-
 .../mediatek/phy-mtk-hdmi.h}  |  2 --
 11 files changed, 40 insertions(+), 16 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi.c} (98%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
phy/mediatek/phy-mtk-hdmi.h} (95%)

-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/4] drm/mediatek: Separate mtk_hdmi_phy to an independent module

2020-03-22 Thread Chun-Kuang Hu
From: CK Hu 

mtk_hdmi_phy is a part of mtk_hdmi module, but phy driver should be an
independent module rather than be part of drm module, so separate the phy
driver to an independent module.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/Kconfig|  9 -
 drivers/gpu/drm/mediatek/Makefile   | 11 +++
 drivers/gpu/drm/mediatek/mtk_hdmi.c |  1 -
 drivers/gpu/drm/mediatek/mtk_hdmi.h |  1 -
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |  1 +
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h |  1 -
 6 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index fa5ffc4fe823..ff6a1eb4ae83 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -23,6 +23,13 @@ config DRM_MEDIATEK_HDMI
tristate "DRM HDMI Support for Mediatek SoCs"
depends on DRM_MEDIATEK
select SND_SOC_HDMI_CODEC if SND_SOC
-   select GENERIC_PHY
+   select PHY_MTK_HDMI
help
  DRM/KMS HDMI driver for Mediatek SoCs
+
+config PHY_MTK_HDMI
+tristate "MediaTek HDMI-PHY Driver"
+depends on ARCH_MEDIATEK && OF
+select GENERIC_PHY
+help
+  Enable this to support HDMI-PHY
diff --git a/drivers/gpu/drm/mediatek/Makefile 
b/drivers/gpu/drm/mediatek/Makefile
index b7a82ed5788f..fcbef23aa6ce 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -19,9 +19,12 @@ obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o
 
 mediatek-drm-hdmi-objs := mtk_cec.o \
  mtk_hdmi.o \
- mtk_hdmi_ddc.o \
- mtk_mt2701_hdmi_phy.o \
- mtk_mt8173_hdmi_phy.o \
- mtk_hdmi_phy.o
+ mtk_hdmi_ddc.o
 
 obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
+
+phy-mtk-hdmi-drv-objs := mtk_hdmi_phy.o \
+mtk_mt2701_hdmi_phy.o \
+mtk_mt8173_hdmi_phy.o
+
+obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 878433c09c9b..17399bdae22d 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1797,7 +1797,6 @@ static struct platform_driver mtk_hdmi_driver = {
 };
 
 static struct platform_driver * const mtk_hdmi_drivers[] = {
-   _hdmi_phy_driver,
_hdmi_ddc_driver,
_cec_driver,
_hdmi_driver,
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi.h
index bb3653de6bd1..472bf141c92b 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.h
@@ -5,7 +5,6 @@
  */
 #ifndef _MTK_HDMI_CTRL_H
 #define _MTK_HDMI_CTRL_H
-#include "mtk_hdmi_phy.h"
 
 struct platform_driver;
 
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
index 5223498502c4..fe022acddbef 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
@@ -205,6 +205,7 @@ struct platform_driver mtk_hdmi_phy_driver = {
.of_match_table = mtk_hdmi_phy_match,
},
 };
+module_platform_driver(mtk_hdmi_phy_driver);
 
 MODULE_DESCRIPTION("MediaTek HDMI PHY Driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
index fc1c2efd1128..b13e1d5f8e78 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
@@ -49,7 +49,6 @@ void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 
offset,
   u32 val, u32 mask);
 struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw);
 
-extern struct platform_driver mtk_hdmi_phy_driver;
 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf;
 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf;
 
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/4] drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver

2020-03-22 Thread Chun-Kuang Hu
From: CK Hu 

tz_disabled is used to control mtk_hdmi output signal, but this variable
is stored in mtk_hdmi_phy and mtk_hdmi_phy does not use it. So move
tz_disabled to mtk_hdmi where it's used.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c   | 22 ---
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h   |  1 -
 .../gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c|  1 -
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 5e4a4dbda443..878433c09c9b 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -144,11 +144,16 @@ struct hdmi_audio_param {
struct hdmi_codec_params codec_params;
 };
 
+struct mtk_hdmi_conf {
+   bool tz_disabled;
+};
+
 struct mtk_hdmi {
struct drm_bridge bridge;
struct drm_bridge *next_bridge;
struct drm_connector conn;
struct device *dev;
+   const struct mtk_hdmi_conf *conf;
struct phy *phy;
struct device *cec_dev;
struct i2c_adapter *ddc_adpt;
@@ -230,7 +235,6 @@ static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, 
bool black)
 static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
 {
struct arm_smccc_res res;
-   struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(hdmi->phy);
 
/*
 * MT8173 HDMI hardware has an output control bit to enable/disable HDMI
@@ -238,7 +242,7 @@ static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi 
*hdmi, bool enable)
 * The ARM trusted firmware provides an API for the HDMI driver to set
 * this control bit to enable HDMI output in supervisor mode.
 */
-   if (hdmi_phy->conf && hdmi_phy->conf->tz_disabled)
+   if (hdmi->conf->tz_disabled)
regmap_update_bits(hdmi->sys_regmap,
   hdmi->sys_offset + HDMI_SYS_CFG20,
   0x80008005, enable ? 0x8005 : 0x8000);
@@ -1688,6 +1692,7 @@ static int mtk_drm_hdmi_probe(struct platform_device 
*pdev)
return -ENOMEM;
 
hdmi->dev = dev;
+   hdmi->conf = of_device_get_match_data(dev);
 
ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev);
if (ret)
@@ -1765,8 +1770,19 @@ static int mtk_hdmi_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops,
 mtk_hdmi_suspend, mtk_hdmi_resume);
 
+static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = {
+   .tz_disabled = true,
+};
+
+static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8173;
+
 static const struct of_device_id mtk_drm_hdmi_of_ids[] = {
-   { .compatible = "mediatek,mt8173-hdmi", },
+   { .compatible = "mediatek,mt2701-hdmi",
+ .data = _hdmi_conf_mt2701,
+   },
+   { .compatible = "mediatek,mt8173-hdmi",
+ .data = _hdmi_conf_mt8173,
+   },
{}
 };
 
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h 
b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
index 2d8b3182470d..fc1c2efd1128 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
@@ -20,7 +20,6 @@
 struct mtk_hdmi_phy;
 
 struct mtk_hdmi_phy_conf {
-   bool tz_disabled;
unsigned long flags;
const struct clk_ops *hdmi_phy_clk_ops;
void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c 
b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
index d3cc4022e988..99fe05cd3598 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
+++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
@@ -237,7 +237,6 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy 
*hdmi_phy)
 }
 
 struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = {
-   .tz_disabled = true,
.flags = CLK_SET_RATE_GATE,
.hdmi_phy_clk_ops = _hdmi_phy_pll_ops,
.hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/4] MAINTAINERS: add files for Mediatek DRM drivers

2020-03-22 Thread Chun-Kuang Hu
Mediatek HDMI phy driver is moved from drivers/gpu/drm/mediatek to
drivers/phy/mediatek, so add the new folder to the Mediatek DRM drivers'
information.

Signed-off-by: Chun-Kuang Hu 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 38fe2f3f7b6f..129777037538 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5612,6 +5612,7 @@ M:Philipp Zabel 
 L: dri-devel@lists.freedesktop.org
 S: Supported
 F: drivers/gpu/drm/mediatek/
+F: drivers/phy/mediatek/phy-mtk-hdmi*
 F: Documentation/devicetree/bindings/display/mediatek/
 
 DRM DRIVERS FOR NVIDIA TEGRA
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/4] drm/mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek folder

2020-03-22 Thread Chun-Kuang Hu
From: CK Hu 

mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
more suitable to place a phy driver into phy driver folder, so move
mtk_hdmi_phy driver into phy driver folder.

Signed-off-by: CK Hu 
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/Kconfig   | 7 ---
 drivers/gpu/drm/mediatek/Makefile  | 6 --
 drivers/phy/mediatek/Kconfig   | 7 +++
 drivers/phy/mediatek/Makefile  | 7 +++
 .../mediatek/phy-mtk-hdmi-mt2701.c}| 2 +-
 .../mediatek/phy-mtk-hdmi-mt8173.c}| 2 +-
 .../mtk_hdmi_phy.c => phy/mediatek/phy-mtk-hdmi.c} | 2 +-
 .../mtk_hdmi_phy.h => phy/mediatek/phy-mtk-hdmi.h} | 0
 8 files changed, 17 insertions(+), 16 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
phy/mediatek/phy-mtk-hdmi.h} (100%)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index ff6a1eb4ae83..2427d5bf699d 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -26,10 +26,3 @@ config DRM_MEDIATEK_HDMI
select PHY_MTK_HDMI
help
  DRM/KMS HDMI driver for Mediatek SoCs
-
-config PHY_MTK_HDMI
-tristate "MediaTek HDMI-PHY Driver"
-depends on ARCH_MEDIATEK && OF
-select GENERIC_PHY
-help
-  Enable this to support HDMI-PHY
diff --git a/drivers/gpu/drm/mediatek/Makefile 
b/drivers/gpu/drm/mediatek/Makefile
index fcbef23aa6ce..77b0fd86063d 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -22,9 +22,3 @@ mediatek-drm-hdmi-objs := mtk_cec.o \
  mtk_hdmi_ddc.o
 
 obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
-
-phy-mtk-hdmi-drv-objs := mtk_hdmi_phy.o \
-mtk_mt2701_hdmi_phy.o \
-mtk_mt8173_hdmi_phy.o
-
-obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
diff --git a/drivers/phy/mediatek/Kconfig b/drivers/phy/mediatek/Kconfig
index dee757c957f2..10f0ec2d5b54 100644
--- a/drivers/phy/mediatek/Kconfig
+++ b/drivers/phy/mediatek/Kconfig
@@ -35,3 +35,10 @@ config PHY_MTK_XSPHY
  Enable this to support the SuperSpeedPlus XS-PHY transceiver for
  USB3.1 GEN2 controllers on MediaTek chips. The driver supports
  multiple USB2.0, USB3.1 GEN2 ports.
+
+config PHY_MTK_HDMI
+tristate "MediaTek HDMI-PHY Driver"
+depends on ARCH_MEDIATEK && OF
+select GENERIC_PHY
+help
+  Enable this to support HDMI-PHY
diff --git a/drivers/phy/mediatek/Makefile b/drivers/phy/mediatek/Makefile
index 08a8e6a97b1e..cda074c53235 100644
--- a/drivers/phy/mediatek/Makefile
+++ b/drivers/phy/mediatek/Makefile
@@ -6,3 +6,10 @@
 obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o
 obj-$(CONFIG_PHY_MTK_UFS)  += phy-mtk-ufs.o
 obj-$(CONFIG_PHY_MTK_XSPHY)+= phy-mtk-xsphy.o
+
+phy-mtk-hdmi-drv-objs := phy-mtk-hdmi.o \
+phy-mtk-hdmi-mt2701.o \
+phy-mtk-hdmi-mt8173.o
+
+obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
+
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
index 99fe05cd3598..a6cb1dea3d0c 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
@@ -4,7 +4,7 @@
  * Author: Chunhui Dai 
  */
 
-#include "mtk_hdmi_phy.h"
+#include "phy-mtk-hdmi.h"
 
 #define HDMI_CON0  0x00
 #define RG_HDMITX_DRV_IBIAS0
diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
index b55f51675205..3521c4893c53 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
+++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8173.c
@@ -4,7 +4,7 @@
  * Author: Jie Qiu 
  */
 
-#include "mtk_hdmi_phy.h"
+#include "phy-mtk-hdmi.h"
 
 #define HDMI_CON0  0x00
 #define RG_HDMITX_PLL_EN   BIT(31)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c 
b/drivers/phy/mediatek/phy-mtk-hdmi.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
rename to drivers/phy/mediatek/phy-mtk-hdmi.c
index fe022acddbef..8fc83f01a720 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
+++ b/drivers/phy

Re: [PATCH 40/51] drm/mtk: Drop explicit drm_mode_config_cleanup call

2020-03-23 Thread Chun-Kuang Hu
Daniel Vetter  於 2020年3月23日 週一 下午10:51寫道:
>
> It's right above the drm_dev_put().
>
> This is made possible by a preceeding patch which added a drmm_
> cleanup action to drm_mode_config_init(), hence all we need to do to
> ensure that drm_mode_config_cleanup() is run on final drm_device
> cleanup is check the new error code for _init().
>
> Aside: Another driver with a bit much devm_kzalloc, which should
> probably use drmm_kzalloc instead ...
>
> v2: Explain why this cleanup is possible (Laurent).
>
> v3: Use drmm_mode_config_init() for more clarity (Sam, Thomas)
>

Acked-by: Chun-Kuang Hu 

> Acked-by: Sam Ravnborg 
> Cc: Sam Ravnborg 
> Cc: Thomas Zimmermann 
> Cc: Laurent Pinchart 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 0563c681..2eaa9080d250 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -162,7 +162,9 @@ static int mtk_drm_kms_init(struct drm_device *drm)
> }
> private->mutex_dev = >dev;
>
> -   drm_mode_config_init(drm);
> +   ret = drmm_mode_config_init(drm);
> +   if (ret)
> +   return ret;
>
> drm->mode_config.min_width = 64;
> drm->mode_config.min_height = 64;
> @@ -179,7 +181,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
>
> ret = component_bind_all(drm->dev, drm);
> if (ret)
> -   goto err_config_cleanup;
> +   return ret;
>
> /*
>  * We currently support two fixed data streams, each optional,
> @@ -255,8 +257,6 @@ static int mtk_drm_kms_init(struct drm_device *drm)
> dma_dev->dma_parms = NULL;
>  err_component_unbind:
> component_unbind_all(drm->dev, drm);
> -err_config_cleanup:
> -   drm_mode_config_cleanup(drm);
>
> return ret;
>  }
> @@ -272,7 +272,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
> private->dma_dev->dma_parms = NULL;
>
> component_unbind_all(drm->dev, drm);
> -   drm_mode_config_cleanup(drm);
>  }
>
>  static const struct file_operations mtk_drm_fops = {
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] MAINTAINERS: Update Chun-Kuang Hu's email address

2020-03-07 Thread Chun-Kuang Hu
Update my email address to @kernel.org

Signed-off-by: Chun-Kuang Hu 
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 38fe2f3f7b6f..dceaeebce52a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5607,7 +5607,7 @@ F:include/uapi/drm/lima_drm.h
 T: git git://anongit.freedesktop.org/drm/drm-misc
 
 DRM DRIVERS FOR MEDIATEK
-M: CK Hu 
+M: Chun-Kuang Hu 
 M: Philipp Zabel 
 L: dri-devel@lists.freedesktop.org
 S: Supported
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/3] drm/mediatek: mtk_dpi: Rename bridge to next_bridge

2020-05-05 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月4日 週一 下午10:14寫道:
>
> This is really a cosmetic change just to make a bit more readable the
> code after convert the driver to drm_bridge. The bridge variable name
> will be used by the encoder drm_bridge, and the chained bridge will be
> named next_bridge.

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 7fbfa95bab09..7112125dc3d1 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -61,7 +61,7 @@ enum mtk_dpi_out_color_format {
>  struct mtk_dpi {
> struct mtk_ddp_comp ddp_comp;
> struct drm_encoder encoder;
> -   struct drm_bridge *bridge;
> +   struct drm_bridge *next_bridge;
> void __iomem *regs;
> struct device *dev;
> struct clk *engine_clk;
> @@ -607,7 +607,7 @@ static int mtk_dpi_bind(struct device *dev, struct device 
> *master, void *data)
> /* Currently DPI0 is fixed to be driven by OVL1 */
> dpi->encoder.possible_crtcs = BIT(1);
>
> -   ret = drm_bridge_attach(>encoder, dpi->bridge, NULL, 0);
> +   ret = drm_bridge_attach(>encoder, dpi->next_bridge, NULL, 0);
> if (ret) {
> dev_err(dev, "Failed to attach bridge: %d\n", ret);
> goto err_cleanup;
> @@ -747,11 +747,11 @@ static int mtk_dpi_probe(struct platform_device *pdev)
> }
>
> ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> - NULL, >bridge);
> + NULL, >next_bridge);
> if (ret)
> return ret;
>
> -   dev_info(dev, "Found bridge node: %pOF\n", dpi->bridge->of_node);
> +   dev_info(dev, "Found bridge node: %pOF\n", dpi->next_bridge->of_node);
>
> comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DPI);
> if (comp_id < 0) {
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/mediatek: cleanup coding style in mediatek a bit

2020-05-06 Thread Chun-Kuang Hu
Hi, Bernard:

Bernard Zhao  於 2020年5月6日 週三 下午8:34寫道:
>
> This code change is to make code bit more readable.
>

Reviewed-by: Chun-Kuang Hu 

> Signed-off-by: Bernard Zhao 
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..43e9876fd50c 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -311,14 +311,10 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi 
> *hdmi, u8 *buffer,
> u8 checksum;
> int ctrl_frame_en = 0;
>
> -   frame_type = *buffer;
> -   buffer += 1;
> -   frame_ver = *buffer;
> -   buffer += 1;
> -   frame_len = *buffer;
> -   buffer += 1;
> -   checksum = *buffer;
> -   buffer += 1;
> +   frame_type = *buffer++;
> +   frame_ver = *buffer++;
> +   frame_len = *buffer++;
> +   checksum = *buffer++;
> frame_data = buffer;
>
> dev_dbg(hdmi->dev,
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0

2020-05-06 Thread Chun-Kuang Hu
Hi, Anand:

Anand Mistry  於 2020年5月6日 週三 下午7:03寫道:
>
> On Wed, May 6, 2020 at 10:25 AM Chun-Kuang Hu  wrote:
> >
> > Hi, Anand,
> >
> > Chun-Kuang Hu  於 2020年4月29日 週三 上午12:37寫道:
> > >
> > > Hi, Anand,
> > >
> > > Anand K. Mistry  於 2020年4月28日 週二 上午9:54寫道:
> > > >
> > > > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu  
> > > > wrote:
> > > > >
> > > > > Hi, Anand:
> > > > >
> > > > > Anand K Mistry  於 2020年4月20日 週一 下午2:09寫道:
> > > > > >
> > > > > > If dma_map_sg() merges pages when creating the mapping, only the 
> > > > > > first
> > > > > > entries will have a valid sg_dma_address() and sg_dma_len(), 
> > > > > > followed by
> > > > > > entries with sg_dma_len() == 0.
> > > > > >
> > > > > > Signed-off-by: Anand K Mistry 
> >
> > Author should sign off this patch, please give a sign off tag by author.
>
> Sorry, email issues meant i sent the patch from a different account.
> Should I re-send the
> patch from the same account as the sign-off line? I'm still working my
> way through the kernel patch process.
>

If you want to use chromium account, you could simply reply this email
with a sign-off-by tag of chromium account.

Regards,
Chun-Kuang.

> >
> > Regards,
> > Chun-Kuang.
> >
> > > > > > ---
> > > > > >  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > > > >  1 file changed, 3 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> > > > > > b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > @@ -224,6 +224,9 @@ struct drm_gem_object 
> > > > > > *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > > > >
> > > > > > expected = sg_dma_address(sg->sgl);
> > > > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > > > +   if (!sg_dma_len(s))
> > > > > > +       break;
> > > > >
> > > > > I think this should be 'continue'
> > > >
> > > > scatterlist.h has the comment:
> > > > /*
> > > >  * These macros should be used after a dma_map_sg call has been done
> > > >  * to get bus addresses of each of the SG entries and their lengths.
> > > >  * You should only work with the number of sg entries dma_map_sg
> > > >  * returns, or alternatively stop on the first sg_dma_len(sg) which
> > > >  * is 0.
> > > >  */
> > > >
> > > > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> > > > the documented approach.
> > > >
> > >
> > > Okay, you're right. So
> > >
> > > Reviewed-by: Chun-Kuang Hu 
> > >
> > > > >
> > > > > Regards,
> > > > > Chun-Kuang.
> > > > >
> > > > > > +
> > > > > > if (sg_dma_address(s) != expected) {
> > > > > > DRM_ERROR("sg_table is not contiguous");
> > > > > > ret = -EINVAL;
> > > > > > --
> > > > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > > > >
> > > > > >
> > > > > > ___
> > > > > > Linux-mediatek mailing list
> > > > > > linux-media...@lists.infradead.org
> > > > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: eliminate the magic number in array size

2020-05-06 Thread Chun-Kuang Hu
Hi, Bernard:

Bernard Zhao  於 2020年5月6日 週三 下午8:43寫道:
>
> Eiminate the magic number in array size, there macro defines in
> hdmi.h.

Reviewed-by: Chun-Kuang Hu 

>
> Signed-off-by: Bernard Zhao 
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..4c962c7f06e5 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi 
> *hdmi,
> struct drm_display_mode *mode)
>  {
> struct hdmi_avi_infoframe frame;
> -   u8 buffer[17];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
> ssize_t err;
>
> err = drm_hdmi_avi_infoframe_from_display_mode(,
> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi 
> *hdmi,
> const char *product)
>  {
> struct hdmi_spd_infoframe frame;
> -   u8 buffer[29];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
> ssize_t err;
>
> err = hdmi_spd_infoframe_init(, vendor, product);
> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi 
> *hdmi,
>  static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
>  {
> struct hdmi_audio_infoframe frame;
> -   u8 buffer[14];
> +   u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
> ssize_t err;
>
> err = hdmi_audio_infoframe_init();
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: mtk_hdmi: Remove debug messages for function calls

2020-05-19 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月19日 週二 下午5:41寫道:
>
> Equivalent information can be nowadays obtained using function tracer
>

Reviewed-by: Chun-Kuang Hu 

> Signed-off-by: Enric Balletbo i Serra 
> ---
>
>  drivers/gpu/drm/mediatek/mtk_hdmi.c| 12 +---
>  drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c |  4 
>  2 files changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index b0555a7cb3b4..172d67294435 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -1634,8 +1634,6 @@ static int mtk_hdmi_audio_startup(struct device *dev, 
> void *data)
>  {
> struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
>
> -   dev_dbg(dev, "%s\n", __func__);
> -
> mtk_hdmi_audio_enable(hdmi);
>
> return 0;
> @@ -1645,8 +1643,6 @@ static void mtk_hdmi_audio_shutdown(struct device *dev, 
> void *data)
>  {
> struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
>
> -   dev_dbg(dev, "%s\n", __func__);
> -
> mtk_hdmi_audio_disable(hdmi);
>  }
>
> @@ -1655,8 +1651,6 @@ mtk_hdmi_audio_digital_mute(struct device *dev, void 
> *data, bool enable)
>  {
> struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
>
> -   dev_dbg(dev, "%s(%d)\n", __func__, enable);
> -
> if (enable)
> mtk_hdmi_hw_aud_mute(hdmi);
> else
> @@ -1669,8 +1663,6 @@ static int mtk_hdmi_audio_get_eld(struct device *dev, 
> void *data, uint8_t *buf,
>  {
> struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
>
> -   dev_dbg(dev, "%s\n", __func__);
> -
> memcpy(buf, hdmi->conn.eld, min(sizeof(hdmi->conn.eld), len));
>
> return 0;
> @@ -1770,7 +1762,6 @@ static int mtk_drm_hdmi_probe(struct platform_device 
> *pdev)
> goto err_bridge_remove;
> }
>
> -   dev_dbg(dev, "mediatek hdmi probe success\n");
> return 0;
>
>  err_bridge_remove:
> @@ -1793,7 +1784,7 @@ static int mtk_hdmi_suspend(struct device *dev)
> struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
>
> mtk_hdmi_clk_disable_audio(hdmi);
> -   dev_dbg(dev, "hdmi suspend success!\n");
> +
> return 0;
>  }
>
> @@ -1808,7 +1799,6 @@ static int mtk_hdmi_resume(struct device *dev)
> return ret;
> }
>
> -   dev_dbg(dev, "hdmi resume success!\n");
> return 0;
>  }
>  #endif
> diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c 
> b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
> index b55f51675205..1c3575372230 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
> @@ -159,8 +159,6 @@ static int mtk_hdmi_pll_prepare(struct clk_hw *hw)
>  {
> struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
>
> -   dev_dbg(hdmi_phy->dev, "%s\n", __func__);
> -
> mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON1, RG_HDMITX_PLL_AUTOK_EN);
> mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_PLL_POSDIV);
> mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON3, RG_HDMITX_MHLCK_EN);
> @@ -178,8 +176,6 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw)
>  {
> struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
>
> -   dev_dbg(hdmi_phy->dev, "%s\n", __func__);
> -
> mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON1, RG_HDMITX_PLL_TXDIV_EN);
> mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON1, 
> RG_HDMITX_PLL_BIAS_LPF_EN);
> usleep_range(100, 150);
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: mtk_mt8173_hdmi_phy: Remove unnused const variables

2020-05-19 Thread Chun-Kuang Hu
Hi, Enric:

Enric Balletbo i Serra  於 2020年5月19日 週二 下午5:40寫道:
>
> There are some `static const u8` variables that are not used, this
> triggers a warning building with `make W=1`, it is safe to remove them,
> so do it and make the compiler more happy.
>

Reviewed-by: Chun-Kuang Hu 

> Signed-off-by: Enric Balletbo i Serra 
> ---
>
>  .../gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c| 48 ---
>  1 file changed, 48 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c 
> b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
> index 1c3575372230..827b93786fac 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
> @@ -107,54 +107,6 @@
>  #define RGS_HDMITX_5T1_EDG (0xf << 4)
>  #define RGS_HDMITX_PLUG_TSTBIT(0)
>
> -static const u8 PREDIV[3][4] = {
> -   {0x0, 0x0, 0x0, 0x0},   /* 27Mhz */
> -   {0x1, 0x1, 0x1, 0x1},   /* 74Mhz */
> -   {0x1, 0x1, 0x1, 0x1}/* 148Mhz */
> -};
> -
> -static const u8 TXDIV[3][4] = {
> -   {0x3, 0x3, 0x3, 0x2},   /* 27Mhz */
> -   {0x2, 0x1, 0x1, 0x1},   /* 74Mhz */
> -   {0x1, 0x0, 0x0, 0x0}/* 148Mhz */
> -};
> -
> -static const u8 FBKSEL[3][4] = {
> -   {0x1, 0x1, 0x1, 0x1},   /* 27Mhz */
> -   {0x1, 0x0, 0x1, 0x1},   /* 74Mhz */
> -   {0x1, 0x0, 0x1, 0x1}/* 148Mhz */
> -};
> -
> -static const u8 FBKDIV[3][4] = {
> -   {19, 24, 29, 19},   /* 27Mhz */
> -   {19, 24, 14, 19},   /* 74Mhz */
> -   {19, 24, 14, 19}/* 148Mhz */
> -};
> -
> -static const u8 DIVEN[3][4] = {
> -   {0x2, 0x1, 0x1, 0x2},   /* 27Mhz */
> -   {0x2, 0x2, 0x2, 0x2},   /* 74Mhz */
> -   {0x2, 0x2, 0x2, 0x2}/* 148Mhz */
> -};
> -
> -static const u8 HTPLLBP[3][4] = {
> -   {0xc, 0xc, 0x8, 0xc},   /* 27Mhz */
> -   {0xc, 0xf, 0xf, 0xc},   /* 74Mhz */
> -   {0xc, 0xf, 0xf, 0xc}/* 148Mhz */
> -};
> -
> -static const u8 HTPLLBC[3][4] = {
> -   {0x2, 0x3, 0x3, 0x2},   /* 27Mhz */
> -   {0x2, 0x3, 0x3, 0x2},   /* 74Mhz */
> -   {0x2, 0x3, 0x3, 0x2}/* 148Mhz */
> -};
> -
> -static const u8 HTPLLBR[3][4] = {
> -   {0x1, 0x1, 0x0, 0x1},   /* 27Mhz */
> -   {0x1, 0x2, 0x2, 0x1},   /* 74Mhz */
> -   {0x1, 0x2, 0x2, 0x1}/* 148Mhz */
> -};
> -
>  static int mtk_hdmi_pll_prepare(struct clk_hw *hw)
>  {
> struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[GIT PULL v3] mediatek drm next for 5.8

2020-05-20 Thread Chun-Kuang Hu
Hi, Dave & Daniel:

This include dpi pin mode swap, config mipi_tx current and impedance,
and some fixup. I drop backmerge patches and related fixup in this version.

The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:

  Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git 
tags/mediatek-drm-next-5.8

for you to fetch changes up to 3852489c79abe31101f07e395c63cce64de0c6d6:

  drm/mediatek: Eliminate the magic number in array size (2020-05-21 00:10:08 
+0800)


Mediatek DRM Next for Linux 5.8


Anand K Mistry (1):
  drm/mediatek: Stop iterating dma addresses when sg_dma_len() == 0

Bernard Zhao (2):
  drm/mediatek: Cleanup coding style in mediatek a bit
  drm/mediatek: Eliminate the magic number in array size

Jitao Shi (6):
  dt-bindings: display: mediatek: control dpi pins mode to avoid leakage
  drm/mediatek: set dpi pin mode to gpio low to avoid leakage current
  dt-bindings: display: mediatek: add property to control mipi tx drive 
current
  dt-bindings: display: mediatek: get mipitx calibration data from nvmem
  drm/mediatek: add the mipitx driving control
  drm/mediatek: config mipitx impedance with calibration data

 .../bindings/display/mediatek/mediatek,dpi.txt |  6 +++
 .../bindings/display/mediatek/mediatek,dsi.txt | 10 
 drivers/gpu/drm/mediatek/mtk_dpi.c | 31 +
 drivers/gpu/drm/mediatek/mtk_drm_gem.c |  3 ++
 drivers/gpu/drm/mediatek/mtk_hdmi.c| 18 +++-
 drivers/gpu/drm/mediatek/mtk_mipi_tx.c | 54 ++
 drivers/gpu/drm/mediatek/mtk_mipi_tx.h |  4 ++
 drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c  | 28 +++
 8 files changed, 143 insertions(+), 11 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [GIT PULL v2] mediatek drm next for 5.8

2020-05-21 Thread Chun-Kuang Hu
Hi, Dave:

Dave Airlie  於 2020年5月20日 週三 下午1:47寫道:
>
> On Wed, 20 May 2020 at 15:44, Dave Airlie  wrote:
> >
> > On Mon, 18 May 2020 at 10:06, Chun-Kuang Hu  wrote:
> > >
> > > Hi, Dave & Daniel:
> > >
> > > This include dpi pin mode swap, config mipi_tx current and impedance,
> > > and some fixup. I drop drm_bridge patches in this version.
> > >
> > > The following changes since commit 
> > > 8f3d9f354286745c751374f5f1fcafee6b3f3136:
> > >   Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)
> > > are available in the Git repository at:
> > >   https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git
> > > tags/mediatek-drm-next-5.8
> > > for you to fetch changes up to 007d274a017bb4e2ef7b922c2f54f40cf2073664:
> >
> > Did you edit this by hand or pass it through some mailserver that
> > chewed it up, I had to reconstruct this pull from the above bits, I've
> > no idea why it's so messed up in the first place.
>
> and why does it contain an unexplained backmerge?
>
>  Merge tag 'v5.7-next-drm-stable' of
> ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux
> into mediatek-drm-next
>
> Please don't ever backmerge fixes into next pull, without a long
> explaination or if you really need it ask us first,
>
> Please resend this again cleaned up.

OK, to make things easier, I just resend and cleaned up.
If one day I need a backmerge fixes, I would ask you first.

Regards,
Chun-Kuang.

>
> Dave.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [GIT PULL v2] mediatek drm next for 5.8

2020-05-21 Thread Chun-Kuang Hu
Hi, Dave:

Dave Airlie  於 2020年5月20日 週三 下午1:44寫道:
>
> On Mon, 18 May 2020 at 10:06, Chun-Kuang Hu  wrote:
> >
> > Hi, Dave & Daniel:
> >
> > This include dpi pin mode swap, config mipi_tx current and impedance,
> > and some fixup. I drop drm_bridge patches in this version.
> >
> > The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:
> >   Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)
> > are available in the Git repository at:
> >   https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git
> > tags/mediatek-drm-next-5.8
> > for you to fetch changes up to 007d274a017bb4e2ef7b922c2f54f40cf2073664:
>
> Did you edit this by hand or pass it through some mailserver that
> chewed it up, I had to reconstruct this pull from the above bits, I've
> no idea why it's so messed up in the first place.

The idea is that gmail would wrap words, so I change to use 'git
send-email' in v3.

Regards,
Chun-Kuang.

>
> Dave.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 0/7] make hdmi work on bananapi-r2

2020-09-03 Thread Chun-Kuang Hu
Frank Wunderlich  於 2020年9月3日 週四 下午11:07寫道:
>
> Hi
>
> Any opinion about DTS Patches? Which maintainer will include it in tree? Is 
> any ack/review needed?

According to maintainer list [1], the maintainer is

ARM/Mediatek SoC support
M: Matthias Brugger 
L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
L: linux-media...@lists.infradead.org (moderated for non-subscribers)
S: Maintained
W: https://mtk.bcnfs.org/
C: irc://chat.freenode.net/linux-mediatek
F: arch/arm/boot/dts/mt6*
F: arch/arm/boot/dts/mt7*
F: arch/arm/boot/dts/mt8*
F: arch/arm/mach-mediatek/
F: arch/arm64/boot/dts/mediatek/
F: drivers/soc/mediatek/
N: mtk
N: mt[678]
K: mediatek


Regards,
Chun-Kuang.

[1] https://www.kernel.org/doc/linux/MAINTAINERS

> regards Frank
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v9 10/32] drm: mediatek: use common helper for a scatterlist contiguity check

2020-09-01 Thread Chun-Kuang Hu
Hi, Marek:

Marek Szyprowski  於 2020年8月26日 週三 下午2:35寫道:
>
> Use common helper for checking the contiguity of the imported dma-buf and
> do this check before allocating resources, so the error path is simpler.
>

Acked-by: Chun-Kuang Hu 

> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 28 ++
>  1 file changed, 6 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index 6190cc3b7b0d..3654ec732029 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -212,37 +212,21 @@ struct drm_gem_object 
> *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> struct dma_buf_attachment *attach, struct sg_table 
> *sg)
>  {
> struct mtk_drm_gem_obj *mtk_gem;
> -   int ret;
> -   struct scatterlist *s;
> -   unsigned int i;
> -   dma_addr_t expected;
>
> -   mtk_gem = mtk_drm_gem_init(dev, attach->dmabuf->size);
> +   /* check if the entries in the sg_table are contiguous */
> +   if (drm_prime_get_contiguous_size(sg) < attach->dmabuf->size) {
> +   DRM_ERROR("sg_table is not contiguous");
> +   return ERR_PTR(-EINVAL);
> +   }
>
> +   mtk_gem = mtk_drm_gem_init(dev, attach->dmabuf->size);
> if (IS_ERR(mtk_gem))
> return ERR_CAST(mtk_gem);
>
> -   expected = sg_dma_address(sg->sgl);
> -   for_each_sg(sg->sgl, s, sg->nents, i) {
> -   if (!sg_dma_len(s))
> -   break;
> -
> -   if (sg_dma_address(s) != expected) {
> -   DRM_ERROR("sg_table is not contiguous");
> -   ret = -EINVAL;
> -   goto err_gem_free;
> -   }
> -   expected = sg_dma_address(s) + sg_dma_len(s);
> -   }
> -
> mtk_gem->dma_addr = sg_dma_address(sg->sgl);
> mtk_gem->sg = sg;
>
> return _gem->base;
> -
> -err_gem_free:
> -   kfree(mtk_gem);
> -   return ERR_PTR(ret);
>  }
>
>  void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
> --
> 2.17.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v9 11/32] drm: mediatek: use common helper for extracting pages array

2020-09-01 Thread Chun-Kuang Hu
Robin Murphy  於 2020年9月2日 週三 上午2:55寫道:
>
> On 2020-08-26 07:32, Marek Szyprowski wrote:
> > Use common helper for converting a sg_table object into struct
> > page pointer array.
>
> Reviewed-by: Robin Murphy 
>
> Side note: is mtk_drm_gem_prime_vmap() missing a call to
> sg_free_table(sgt) before its kfree(sgt)?

Yes, we need another patch to fix that bug, But for this patch,

Acked-by: Chun-Kuang Hu 

>
> > Signed-off-by: Marek Szyprowski 
> > ---
> >   drivers/gpu/drm/mediatek/mtk_drm_gem.c | 9 ++---
> >   1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
> > b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > index 3654ec732029..0583e557ad37 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > @@ -233,9 +233,7 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
> >   {
> >   struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
> >   struct sg_table *sgt;
> > - struct sg_page_iter iter;
> >   unsigned int npages;
> > - unsigned int i = 0;
> >
> >   if (mtk_gem->kvaddr)
> >   return mtk_gem->kvaddr;
> > @@ -249,11 +247,8 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object 
> > *obj)
> >   if (!mtk_gem->pages)
> >   goto out;
> >
> > - for_each_sg_page(sgt->sgl, , sgt->orig_nents, 0) {
> > - mtk_gem->pages[i++] = sg_page_iter_page();
> > - if (i > npages)
> > - break;
> > - }
> > + drm_prime_sg_to_page_addr_arrays(sgt, mtk_gem->pages, NULL, npages);
> > +
> >   mtk_gem->kvaddr = vmap(mtk_gem->pages, npages, VM_MAP,
> >  pgprot_writecombine(PAGE_KERNEL));
> >
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 0/4] Move Mediatek HDMI PHY driver from DRM folder to PHY folder

2020-09-02 Thread Chun-Kuang Hu
Chun-Kuang Hu  於 2020年8月23日 週日 上午9:48寫道:
>
> mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
> more suitable to place a phy driver into phy driver folder, so move
> mtk_hdmi_phy driver into phy driver folder.

For this series, applied to mediatek-drm-next [1].

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Changes in v5:
> - Fixup indent in Kconfig.
> - Refine config help message.
> - Refine Makefile.
>
> Changes in v4:
> - Rebase onto 5.9-rc1
> - Remove mtk_hdmi_conf_mt8173.
>
> Changes in v3:
> - Modify [PATCH v2 3/4] prefix.
>
> Changes in v2:
> - include module.h in mtk_hdmi.c
>
> CK Hu (3):
>   drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver
>   drm/mediatek: Separate mtk_hdmi_phy to an independent module
>   phy: mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek
> folder
>
> Chun-Kuang Hu (1):
>   MAINTAINERS: add files for Mediatek DRM drivers
>
>  MAINTAINERS   |  1 +
>  drivers/gpu/drm/mediatek/Kconfig  |  2 +-
>  drivers/gpu/drm/mediatek/Makefile |  5 +
>  drivers/gpu/drm/mediatek/mtk_hdmi.c   | 21 +++
>  drivers/gpu/drm/mediatek/mtk_hdmi.h   |  1 -
>  drivers/phy/mediatek/Kconfig  |  7 +++
>  drivers/phy/mediatek/Makefile |  5 +
>  .../mediatek/phy-mtk-hdmi-mt2701.c}   |  3 +--
>  .../mediatek/phy-mtk-hdmi-mt8173.c}   |  2 +-
>  .../mediatek/phy-mtk-hdmi.c}  |  3 ++-
>  .../mediatek/phy-mtk-hdmi.h}  |  2 --
>  11 files changed, 36 insertions(+), 16 deletions(-)
>  rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
> phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
>  rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
> phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
>  rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
> phy/mediatek/phy-mtk-hdmi.c} (98%)
>  rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
> phy/mediatek/phy-mtk-hdmi.h} (95%)
>
> --
> 2.17.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: add missing put_device() call in mtk_ddp_comp_init()

2020-09-07 Thread Chun-Kuang Hu
Hi Yu Kuai:

Yu Kuai  於 2020年9月5日 週六 下午4:31寫道:
>
> if of_find_device_by_node() succeed, mtk_ddp_comp_init() doesn't have
> a corresponding put_device(). Thus add put_device() to fix the exception
> handling for this function implementation.
>

This patch looks good to me, but I find another thing related to this.
mtk_ddp_comp_init() is called in a loop in mtk_drm_probe(), when this
component init fail, I think we should uninitialize previous
successive init component and put their device. Would you like to make
this patch more complete?

Regards,
Chun-Kuang.

> Fixes: d0afe37f5209 ("drm/mediatek: support CMDQ interface in ddp component")
> Signed-off-by: Yu Kuai 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 57c88de9a329..526648885b97 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -496,6 +496,7 @@ int mtk_ddp_comp_init(struct device *dev, struct 
> device_node *node,
>  #if IS_REACHABLE(CONFIG_MTK_CMDQ)
> if (of_address_to_resource(node, 0, ) != 0) {
> dev_err(dev, "Missing reg in %s node\n", node->full_name);
> +   put_device(_pdev->dev);
> return -EINVAL;
> }
> comp->regs_pa = res.start;
> --
> 2.25.4
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RESEND PATCH v2 1/2] drm/mediatek: mtk_dpi: Rename bridge to next_bridge

2020-09-09 Thread Chun-Kuang Hu
Hi, Andrzej & Neil:

Enric Balletbo i Serra  於 2020年8月26日 週三 下午4:53寫道:
>
> This is really a cosmetic change just to make a bit more readable the
> code after convert the driver to drm_bridge. The bridge variable name
> will be used by the encoder drm_bridge, and the chained bridge will be
> named next_bridge.

This is a DRM-bridge related patch, how do you think about it?

Regards,
Chun-Kuang.

>
> Reviewed-by: Chun-Kuang Hu 
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
> Changes in v2: None
>
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index d4f0fb7ad312..f7372dbdac0e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -64,7 +64,7 @@ enum mtk_dpi_out_color_format {
>  struct mtk_dpi {
> struct mtk_ddp_comp ddp_comp;
> struct drm_encoder encoder;
> -   struct drm_bridge *bridge;
> +   struct drm_bridge *next_bridge;
> void __iomem *regs;
> struct device *dev;
> struct clk *engine_clk;
> @@ -610,7 +610,7 @@ static int mtk_dpi_bind(struct device *dev, struct device 
> *master, void *data)
> /* Currently DPI0 is fixed to be driven by OVL1 */
> dpi->encoder.possible_crtcs = BIT(1);
>
> -   ret = drm_bridge_attach(>encoder, dpi->bridge, NULL, 0);
> +   ret = drm_bridge_attach(>encoder, dpi->next_bridge, NULL, 0);
> if (ret) {
> dev_err(dev, "Failed to attach bridge: %d\n", ret);
> goto err_cleanup;
> @@ -770,11 +770,11 @@ static int mtk_dpi_probe(struct platform_device *pdev)
> }
>
> ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> - NULL, >bridge);
> + NULL, >next_bridge);
> if (ret)
> return ret;
>
> -   dev_info(dev, "Found bridge node: %pOF\n", dpi->bridge->of_node);
> +   dev_info(dev, "Found bridge node: %pOF\n", dpi->next_bridge->of_node);
>
> comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DPI);
> if (comp_id < 0) {
> --
> 2.28.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RESEND PATCH v2 2/2] drm/mediatek: mtk_dpi: Convert to bridge driver

2020-09-09 Thread Chun-Kuang Hu
Hi, Andrzej & Neil:

Enric Balletbo i Serra  於 2020年8月26日 週三 下午4:53寫道:

>
> Convert mtk_dpi to a bridge driver with built-in encoder support for
> compatibility with existing component drivers.
>

This is a DRM-bridge related patch, how do you think about it?

Regards,
Chun-Kuang.

> Reviewed-by: Chun-Kuang Hu 
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
> Changes in v2:
> - Maintain error message when attach to bridge fails. (Boris)
>
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 71 ++
>  1 file changed, 42 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index f7372dbdac0e..589ef33a1780 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -64,6 +64,7 @@ enum mtk_dpi_out_color_format {
>  struct mtk_dpi {
> struct mtk_ddp_comp ddp_comp;
> struct drm_encoder encoder;
> +   struct drm_bridge bridge;
> struct drm_bridge *next_bridge;
> void __iomem *regs;
> struct device *dev;
> @@ -83,9 +84,9 @@ struct mtk_dpi {
> int refcount;
>  };
>
> -static inline struct mtk_dpi *mtk_dpi_from_encoder(struct drm_encoder *e)
> +static inline struct mtk_dpi *bridge_to_dpi(struct drm_bridge *b)
>  {
> -   return container_of(e, struct mtk_dpi, encoder);
> +   return container_of(b, struct mtk_dpi, bridge);
>  }
>
>  enum mtk_dpi_polarity {
> @@ -521,50 +522,53 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> return 0;
>  }
>
> -static bool mtk_dpi_encoder_mode_fixup(struct drm_encoder *encoder,
> -  const struct drm_display_mode *mode,
> -  struct drm_display_mode *adjusted_mode)
> +static void mtk_dpi_encoder_destroy(struct drm_encoder *encoder)
>  {
> -   return true;
> +   drm_encoder_cleanup(encoder);
>  }
>
> -static void mtk_dpi_encoder_mode_set(struct drm_encoder *encoder,
> -struct drm_display_mode *mode,
> -struct drm_display_mode *adjusted_mode)
> +static const struct drm_encoder_funcs mtk_dpi_encoder_funcs = {
> +   .destroy = mtk_dpi_encoder_destroy,
> +};
> +
> +static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> +enum drm_bridge_attach_flags flags)
>  {
> -   struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
> +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> +
> +   return drm_bridge_attach(bridge->encoder, dpi->next_bridge,
> +>bridge, flags);
> +}
> +
> +static void mtk_dpi_bridge_mode_set(struct drm_bridge *bridge,
> +   const struct drm_display_mode *mode,
> +   const struct drm_display_mode *adjusted_mode)
> +{
> +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
>
> drm_mode_copy(>mode, adjusted_mode);
>  }
>
> -static void mtk_dpi_encoder_disable(struct drm_encoder *encoder)
> +static void mtk_dpi_bridge_disable(struct drm_bridge *bridge)
>  {
> -   struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
> +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
>
> mtk_dpi_power_off(dpi);
>  }
>
> -static void mtk_dpi_encoder_enable(struct drm_encoder *encoder)
> +static void mtk_dpi_bridge_enable(struct drm_bridge *bridge)
>  {
> -   struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
> +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
>
> mtk_dpi_power_on(dpi);
> mtk_dpi_set_display_mode(dpi, >mode);
>  }
>
> -static int mtk_dpi_atomic_check(struct drm_encoder *encoder,
> -   struct drm_crtc_state *crtc_state,
> -   struct drm_connector_state *conn_state)
> -{
> -   return 0;
> -}
> -
> -static const struct drm_encoder_helper_funcs mtk_dpi_encoder_helper_funcs = {
> -   .mode_fixup = mtk_dpi_encoder_mode_fixup,
> -   .mode_set = mtk_dpi_encoder_mode_set,
> -   .disable = mtk_dpi_encoder_disable,
> -   .enable = mtk_dpi_encoder_enable,
> -   .atomic_check = mtk_dpi_atomic_check,
> +static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> +   .attach = mtk_dpi_bridge_attach,
> +   .mode_set = mtk_dpi_bridge_mode_set,
> +   .disable = mtk_dpi_bridge_disable,
> +   .enable = mtk_dpi_bridge_enable,
>  };
>
>  static void mtk_dpi_start(struct mtk_ddp_comp *comp)
> @@ -605,12 +609,11 @@ static int mtk_dpi_bind(struct device *dev, struct 
> device *master, void *data)

Re: [RESEND PATCH v2 2/2] drm/mediatek: mtk_dpi: Convert to bridge driver

2020-09-12 Thread Chun-Kuang Hu
Hi,

Daniel Vetter  於 2020年9月10日 週四 下午1:48寫道:
>
> On Thu, Sep 10, 2020 at 06:35:21AM +0800, Chun-Kuang Hu wrote:
> > Hi, Andrzej & Neil:
> >
> > Enric Balletbo i Serra  於 2020年8月26日 週三 
> > 下午4:53寫道:
> >
> > >
> > > Convert mtk_dpi to a bridge driver with built-in encoder support for
> > > compatibility with existing component drivers.
> > >
> >
> > This is a DRM-bridge related patch, how do you think about it?
>
> bridge stuff is also maintained in drm-misc, so good to go imo.
>
> For the bigger picture I think it'd be really good if bridges drivers
> would use the of bridge lookup, and not hand roll something with
> component. So 2nd step of converting this over to a proper bridge driver
> would be to replace the component code here too.

OK, so this series is applied to mediatek-drm-next [1].

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Cheers, Daniel
>
> >
> > Regards,
> > Chun-Kuang.
> >
> > > Reviewed-by: Chun-Kuang Hu 
> > > Signed-off-by: Enric Balletbo i Serra 
> > > ---
> > >
> > > Changes in v2:
> > > - Maintain error message when attach to bridge fails. (Boris)
> > >
> > >  drivers/gpu/drm/mediatek/mtk_dpi.c | 71 ++
> > >  1 file changed, 42 insertions(+), 29 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> > > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > index f7372dbdac0e..589ef33a1780 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > @@ -64,6 +64,7 @@ enum mtk_dpi_out_color_format {
> > >  struct mtk_dpi {
> > > struct mtk_ddp_comp ddp_comp;
> > > struct drm_encoder encoder;
> > > +   struct drm_bridge bridge;
> > > struct drm_bridge *next_bridge;
> > > void __iomem *regs;
> > > struct device *dev;
> > > @@ -83,9 +84,9 @@ struct mtk_dpi {
> > > int refcount;
> > >  };
> > >
> > > -static inline struct mtk_dpi *mtk_dpi_from_encoder(struct drm_encoder *e)
> > > +static inline struct mtk_dpi *bridge_to_dpi(struct drm_bridge *b)
> > >  {
> > > -   return container_of(e, struct mtk_dpi, encoder);
> > > +   return container_of(b, struct mtk_dpi, bridge);
> > >  }
> > >
> > >  enum mtk_dpi_polarity {
> > > @@ -521,50 +522,53 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi 
> > > *dpi,
> > > return 0;
> > >  }
> > >
> > > -static bool mtk_dpi_encoder_mode_fixup(struct drm_encoder *encoder,
> > > -  const struct drm_display_mode 
> > > *mode,
> > > -  struct drm_display_mode 
> > > *adjusted_mode)
> > > +static void mtk_dpi_encoder_destroy(struct drm_encoder *encoder)
> > >  {
> > > -   return true;
> > > +   drm_encoder_cleanup(encoder);
> > >  }
> > >
> > > -static void mtk_dpi_encoder_mode_set(struct drm_encoder *encoder,
> > > -struct drm_display_mode *mode,
> > > -struct drm_display_mode 
> > > *adjusted_mode)
> > > +static const struct drm_encoder_funcs mtk_dpi_encoder_funcs = {
> > > +   .destroy = mtk_dpi_encoder_destroy,
> > > +};
> > > +
> > > +static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> > > +enum drm_bridge_attach_flags flags)
> > >  {
> > > -   struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
> > > +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > > +
> > > +   return drm_bridge_attach(bridge->encoder, dpi->next_bridge,
> > > +>bridge, flags);
> > > +}
> > > +
> > > +static void mtk_dpi_bridge_mode_set(struct drm_bridge *bridge,
> > > +   const struct drm_display_mode *mode,
> > > +   const struct drm_display_mode 
> > > *adjusted_mode)
> > > +{
> > > +   struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > >
> > > drm_mode_copy(>mode, adjusted_mode);
> > >  }
> > >
> > > -static void mtk_dpi_encoder_disable(struct drm_encoder 

Re: [PATCH v6 1/4] drm/mediatek: disable tmds on mt2701

2020-09-14 Thread Chun-Kuang Hu
Hi, Frank:

Frank Wunderlich  於 2020年9月4日 週五 下午7:01寫道:
>
> From: chunhui dai 
>
> Without that patch if you use specific resolutions like 1280x1024,
> I can see distortion in the output. It seems as if the
> frequency for updating the pixel of the image is out of sync.
>
> For initialization tmds needs to be active, but can be disabled after init
> to fix blurry display

As discussed with Jitao offline, he agree this patch, so I applied
this patch to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Signed-off-by: chunhui dai 
> Signed-off-by: Frank Wunderlich 
> Tested-by: Frank Wunderlich 
> ---
>  drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c | 1 +
>  drivers/phy/mediatek/phy-mtk-hdmi.c| 3 +++
>  drivers/phy/mediatek/phy-mtk-hdmi.h| 1 +
>  3 files changed, 5 insertions(+)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c 
> b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
> index a6cb1dea3d0c..b74c65a1762c 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt2701.c
> @@ -238,6 +238,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy 
> *hdmi_phy)
>
>  struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = {
> .flags = CLK_SET_RATE_GATE,
> +   .pll_default_off = true,
> .hdmi_phy_clk_ops = _hdmi_phy_pll_ops,
> .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
> .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds,
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi.c 
> b/drivers/phy/mediatek/phy-mtk-hdmi.c
> index 8fc83f01a720..47c029d4b270 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi.c
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi.c
> @@ -184,6 +184,9 @@ static int mtk_hdmi_phy_probe(struct platform_device 
> *pdev)
> return PTR_ERR(phy_provider);
> }
>
> +   if (hdmi_phy->conf->pll_default_off)
> +   hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);
> +
> return of_clk_add_provider(dev->of_node, of_clk_src_simple_get,
>hdmi_phy->pll);
>  }
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi.h 
> b/drivers/phy/mediatek/phy-mtk-hdmi.h
> index b13e1d5f8e78..dcf9bb13699b 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi.h
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi.h
> @@ -21,6 +21,7 @@ struct mtk_hdmi_phy;
>
>  struct mtk_hdmi_phy_conf {
> unsigned long flags;
> +   bool pll_default_off;
> const struct clk_ops *hdmi_phy_clk_ops;
> void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
> void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
> --
> 2.25.1
>
>
> ___
> Linux-mediatek mailing list
> linux-media...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[GIT PULL] mediatek drm next for 5.10

2020-09-14 Thread Chun-Kuang Hu
Hi, Dave & Daniel:

This includes:

1. Move Mediatek HDMI PHY driver from DRM folder to PHY folder
2. Convert mtk-dpi to drm_bridge API
3. Disable tmds on mt2701

Regards,
Chun-Kuang.

The following changes since commit 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5:

  Linux 5.9-rc1 (2020-08-16 13:04:57 -0700)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git 
tags/mediatek-drm-next-5.10

for you to fetch changes up to 09e872d558ba6a7f4468c4e8cdf0cd5a99bfc175:

  drm/mediatek: Disable tmds on mt2701 (2020-09-14 23:05:23 +0800)


Mediatek DRM Next for Linux 5.10

1. Move Mediatek HDMI PHY driver from DRM folder to PHY folder
2. Convert mtk-dpi to drm_bridge API
3. Disable tmds on mt2701


CK Hu (3):
  drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver
  drm/mediatek: Separate mtk_hdmi_phy to an independent module
  phy: mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek folder

Chun-Kuang Hu (1):
  MAINTAINERS: add files for Mediatek DRM drivers

Enric Balletbo i Serra (2):
  drm/mediatek: mtk_dpi: Rename bridge to next_bridge
  drm/mediatek: mtk_dpi: Convert to bridge driver

Frank Wunderlich (2):
  dt-bindings: mediatek: add mt7623 display-nodes
  drm/mediatek: Add ddp routing for mt7623

Stu Hsieh (1):
  drm/mediatek: dpi/dsi: Change the getting possible_crtc way

chunhui dai (1):
  drm/mediatek: Disable tmds on mt2701

 Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt   
|  2 +-
 Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
|  2 +-
 Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
|  4 ++--
 Documentation/devicetree/bindings/display/mediatek/mediatek,hdmi.txt   
|  4 
 MAINTAINERS
|  1 +
 drivers/gpu/drm/mediatek/Kconfig   
|  2 +-
 drivers/gpu/drm/mediatek/Makefile  
|  5 +
 drivers/gpu/drm/mediatek/mtk_dpi.c 
| 80 
++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
| 38 ++
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
|  2 ++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c 
| 23 +++
 drivers/gpu/drm/mediatek/mtk_dsi.c 
|  6 +-
 drivers/gpu/drm/mediatek/mtk_hdmi.c
| 21 +
 drivers/gpu/drm/mediatek/mtk_hdmi.h
|  1 -
 drivers/phy/mediatek/Kconfig   
|  7 +++
 drivers/phy/mediatek/Makefile  
|  5 +
 drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt2701.c} |  4 ++--
 drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt8173.c} |  2 +-
 drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => phy/mediatek/phy-mtk-hdmi.c}   
|  6 +-
 drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => phy/mediatek/phy-mtk-hdmi.h}   
|  3 +--
 20 files changed, 159 insertions(+), 59 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
phy/mediatek/phy-mtk-hdmi.c} (96%)
 rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
phy/mediatek/phy-mtk-hdmi.h} (95%)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/mediatek: Use CPU when fail to get cmdq event

2020-09-02 Thread Chun-Kuang Hu
Even though cmdq client is created successfully, without the cmdq event,
cmdq could not work correctly, so use CPU when fail to get cmdq event.

Fixes: 60fa8c13ab1a ("drm/mediatek: Move gce event property to mutex device 
node")
Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 3fc5511330b9..4d29568be3f5 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -831,13 +831,19 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
drm_crtc_index(_crtc->base));
mtk_crtc->cmdq_client = NULL;
}
-   ret = of_property_read_u32_index(priv->mutex_node,
-"mediatek,gce-events",
-drm_crtc_index(_crtc->base),
-_crtc->cmdq_event);
-   if (ret)
-   dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events 
property\n",
-   drm_crtc_index(_crtc->base));
+
+   if (mtk_crtc->cmdq_client) {
+   ret = of_property_read_u32_index(priv->mutex_node,
+"mediatek,gce-events",
+
drm_crtc_index(_crtc->base),
+_crtc->cmdq_event);
+   if (ret) {
+   dev_dbg(dev, "mtk_crtc %d failed to get 
mediatek,gce-events property\n",
+   drm_crtc_index(_crtc->base));
+   cmdq_mbox_destroy(mtk_crtc->cmdq_client);
+   mtk_crtc->cmdq_client = NULL;
+   }
+   }
 #endif
return 0;
 }
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 3/4] phy: mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek folder

2020-08-31 Thread Chun-Kuang Hu
Hi, Chunfeng:

Chunfeng Yun  於 2020年8月31日 週一 上午9:48寫道:
>
> On Mon, 2020-08-31 at 07:03 +0800, Chun-Kuang Hu wrote:
> > Hi, Chunfeng & Kishon:
> >
> > How do you feel about this patch?
> It's fine to me,
>
> Reviewed-by: Chunfeng Yun 
>

Could you give an 'Acked-by' tag on this patch? So I could apply the
whole series into my tree.

Regards,
Chun-Kuang.

> Thanks a lot
>
> >
> > Regards,
> > Chun-Kuang.
> >
> > Chun-Kuang Hu  於 2020年8月23日 週日 上午9:48寫道:
> > >
> > > From: CK Hu 
> > >
> > > mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
> > > more suitable to place a phy driver into phy driver folder, so move
> > > mtk_hdmi_phy driver into phy driver folder.
> > >
> > > Signed-off-by: CK Hu 
> > > Signed-off-by: Chun-Kuang Hu 
> > > ---
> > >  drivers/gpu/drm/mediatek/Kconfig   | 7 ---
> > >  drivers/gpu/drm/mediatek/Makefile  | 6 --
> > >  drivers/phy/mediatek/Kconfig   | 7 +++
> > >  drivers/phy/mediatek/Makefile  | 5 +
> > >  .../mediatek/phy-mtk-hdmi-mt2701.c}| 2 +-
> > >  .../mediatek/phy-mtk-hdmi-mt8173.c}| 2 +-
> > >  .../mtk_hdmi_phy.c => phy/mediatek/phy-mtk-hdmi.c} | 2 +-
> > >  .../mtk_hdmi_phy.h => phy/mediatek/phy-mtk-hdmi.h} | 0
> > >  8 files changed, 15 insertions(+), 16 deletions(-)
> > >  rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
> > > phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
> > >  rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
> > > phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
> > >  rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
> > > phy/mediatek/phy-mtk-hdmi.c} (99%)
> > >  rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
> > > phy/mediatek/phy-mtk-hdmi.h} (100%)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> > > b/drivers/gpu/drm/mediatek/Kconfig
> > > index 6363f2c1cdbc..65cd03a4be29 100644
> > > --- a/drivers/gpu/drm/mediatek/Kconfig
> > > +++ b/drivers/gpu/drm/mediatek/Kconfig
> > > @@ -27,10 +27,3 @@ config DRM_MEDIATEK_HDMI
> > > select PHY_MTK_HDMI
> > > help
> > >   DRM/KMS HDMI driver for Mediatek SoCs
> > > -
> > > -config PHY_MTK_HDMI
> > > -   tristate "MediaTek HDMI-PHY Driver"
> > > -   depends on ARCH_MEDIATEK && OF
> > > -   select GENERIC_PHY
> > > -   help
> > > - Support HDMI PHY for Mediatek SoCs.
> > > diff --git a/drivers/gpu/drm/mediatek/Makefile 
> > > b/drivers/gpu/drm/mediatek/Makefile
> > > index fcbef23aa6ce..77b0fd86063d 100644
> > > --- a/drivers/gpu/drm/mediatek/Makefile
> > > +++ b/drivers/gpu/drm/mediatek/Makefile
> > > @@ -22,9 +22,3 @@ mediatek-drm-hdmi-objs := mtk_cec.o \
> > >   mtk_hdmi_ddc.o
> > >
> > >  obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
> > > -
> > > -phy-mtk-hdmi-drv-objs := mtk_hdmi_phy.o \
> > > -mtk_mt2701_hdmi_phy.o \
> > > -mtk_mt8173_hdmi_phy.o
> > > -
> > > -obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
> > > diff --git a/drivers/phy/mediatek/Kconfig b/drivers/phy/mediatek/Kconfig
> > > index dee757c957f2..50c5e9306e19 100644
> > > --- a/drivers/phy/mediatek/Kconfig
> > > +++ b/drivers/phy/mediatek/Kconfig
> > > @@ -35,3 +35,10 @@ config PHY_MTK_XSPHY
> > >   Enable this to support the SuperSpeedPlus XS-PHY transceiver for
> > >   USB3.1 GEN2 controllers on MediaTek chips. The driver supports
> > >   multiple USB2.0, USB3.1 GEN2 ports.
> > > +
> > > +config PHY_MTK_HDMI
> > > +   tristate "MediaTek HDMI-PHY Driver"
> > > +   depends on ARCH_MEDIATEK && OF
> > > +   select GENERIC_PHY
> > > +   help
> > > + Support HDMI PHY for Mediatek SoCs.
> > > diff --git a/drivers/phy/mediatek/Makefile b/drivers/phy/mediatek/Makefile
> > > index 08a8e6a97b1e..6325e38709ed 100644
> > > --- a/drivers/phy/mediatek/Makefile
> > > +++ b/drivers/phy/mediatek/Makefile
> > > @@ -6,3 +6,8 @@
> > >  obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o
> > >  obj-$(CONFI

Re: [PATCH v5 4/4] MAINTAINERS: add files for Mediatek DRM drivers

2020-08-31 Thread Chun-Kuang Hu
Hi, Chunfeng:

Chunfeng Yun  於 2020年8月31日 週一 上午9:50寫道:
>
> On Sun, 2020-08-23 at 09:48 +0800, Chun-Kuang Hu wrote:
> > Mediatek HDMI phy driver is moved from drivers/gpu/drm/mediatek to
> > drivers/phy/mediatek, so add the new folder to the Mediatek DRM drivers'
> > information.
> >
> > Signed-off-by: Chun-Kuang Hu 
> > Reviewed-by: Matthias Brugger 
> > ---
> >  MAINTAINERS | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index deaafb617361..191bacf02209 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -5793,6 +5793,7 @@ L:  dri-devel@lists.freedesktop.org
> >  S:   Supported
> >  F:   Documentation/devicetree/bindings/display/mediatek/
> >  F:   drivers/gpu/drm/mediatek/
> > +F:   drivers/phy/mediatek/phy-mtk-hdmi*
> >
> >  DRM DRIVERS FOR NVIDIA TEGRA
> >  M:   Thierry Reding 
>
> Reviewed-by: Chunfeng Yun 
>

Could you give an 'Acked-by' tag on this patch? So I could apply the
whole series into my tree.

Regards,
Chun-Kuang.

> Thanks
>
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/mediatek: Use CPU when fail to get cmdq event

2020-09-08 Thread Chun-Kuang Hu
Chun-Kuang Hu  於 2020年9月3日 週四 上午6:06寫道:
>
> Even though cmdq client is created successfully, without the cmdq event,
> cmdq could not work correctly, so use CPU when fail to get cmdq event.

Applied to mediatek-drm-fixes [1].

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-fixes

Regards,
Chun-Kuang.

>
> Fixes: 60fa8c13ab1a ("drm/mediatek: Move gce event property to mutex device 
> node")
> Signed-off-by: Chun-Kuang Hu 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 20 +---
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 3fc5511330b9..4d29568be3f5 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -831,13 +831,19 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
> drm_crtc_index(_crtc->base));
> mtk_crtc->cmdq_client = NULL;
> }
> -   ret = of_property_read_u32_index(priv->mutex_node,
> -"mediatek,gce-events",
> -drm_crtc_index(_crtc->base),
> -_crtc->cmdq_event);
> -   if (ret)
> -   dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events 
> property\n",
> -   drm_crtc_index(_crtc->base));
> +
> +   if (mtk_crtc->cmdq_client) {
> +   ret = of_property_read_u32_index(priv->mutex_node,
> +"mediatek,gce-events",
> +
> drm_crtc_index(_crtc->base),
> +_crtc->cmdq_event);
> +   if (ret) {
> +   dev_dbg(dev, "mtk_crtc %d failed to get 
> mediatek,gce-events property\n",
> +   drm_crtc_index(_crtc->base));
> +   cmdq_mbox_destroy(mtk_crtc->cmdq_client);
> +   mtk_crtc->cmdq_client = NULL;
> +   }
> +   }
>  #endif
> return 0;
>  }
> --
> 2.17.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/mediatek: mtk_hdmi: add MT8167 support for HDMI

2020-10-13 Thread Chun-Kuang Hu
Hi, Fabien:

Fabien Parent  於 2020年10月14日 週三 上午2:19寫道:
>
> Add support for HDMI on MT8167. HDMI on MT8167 is similar to
> MT8173/MT2701 execpt for the two registers: SYS_CFG1C and SYS_CFG20
>
> Signed-off-by: Fabien Parent 
> ---
>
> Changelog:
> v2: fix name of pdata structure
>
>  drivers/gpu/drm/mediatek/mtk_hdmi.c  | 7 +++
>  drivers/gpu/drm/mediatek/mtk_hdmi_regs.h | 2 ++
>  2 files changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index 57370c036497..484ea9cd654a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -1835,9 +1835,16 @@ static struct mtk_hdmi_data mt8173_hdmi_driver_data = {
> .sys_cfg20 = HDMI_SYS_CFG20,
>  };
>
> +static struct mtk_hdmi_data mt8167_hdmi_driver_data = {
> +   .sys_cfg1c = MT8167_HDMI_SYS_CFG1C,
> +   .sys_cfg20 = MT8167_HDMI_SYS_CFG20,
> +};
> +
>  static const struct of_device_id mtk_drm_hdmi_of_ids[] = {
> { .compatible = "mediatek,mt8173-hdmi",
>   .data = _hdmi_driver_data },
> +   { .compatible = "mediatek,mt8167-hdmi",

I think we should add this compatible string in Mediatek HDMI binding
document [1].

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/display/mediatek/mediatek,hdmi.txt?h=v5.9

Regards,
Chun-Kuang.

> + .data = _hdmi_driver_data },
> {}
>  };
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_regs.h 
> b/drivers/gpu/drm/mediatek/mtk_hdmi_regs.h
> index 2050ba45b23a..a0f9c367d7aa 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_regs.h
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_regs.h
> @@ -195,6 +195,7 @@
>  #define GEN_RGB(0 << 7)
>
>  #define HDMI_SYS_CFG1C 0x000
> +#define MT8167_HDMI_SYS_CFG1C  0x800
>  #define HDMI_ONBIT(0)
>  #define HDMI_RST   BIT(1)
>  #define ANLG_ONBIT(2)
> @@ -211,6 +212,7 @@
>  #define HTPLG_PIN_SEL_OFF  BIT(30)
>  #define AES_EFUSE_ENABLE   BIT(31)
>  #define HDMI_SYS_CFG20 0x004
> +#define MT8167_HDMI_SYS_CFG20  0x804
>  #define DEEP_COLOR_MODE_MASK   (3 << 1)
>  #define COLOR_8BIT_MODE(0 << 1)
>  #define COLOR_10BIT_MODE   (1 << 1)
> --
> 2.28.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [v4 PATCH 0/2] fix scrolling of panel with small hfp or hbp

2020-10-12 Thread Chun-Kuang Hu
Hi, Jitao:

Jitao Shi  於 2020年10月10日 週六 下午3:09寫道:
>
> Changes since v3:
>  - Revert v2, for v2 will cause some bridge ic no output. the cause
>the video linetime doesn't match display mode from get mode.
>  - Make sure the horizontal_frontporch_byte and horizontal_backporch_byte
>are > 0.

Because v2 is merged into mainline, I think you should merge 1/2 and
2/2 to one patch which fix the problem caused by v2.

Regards,
Chun-Kuang.

>
> Jitao Shi (2):
>   Revert "drm/mediatek: dsi: Fix scrolling of panel with small hfp or
> hbp"
>   drm/mediatek: dsi: fix scrolling of panel with small hfp or hbp
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 65 
> +++---
>  1 file changed, 25 insertions(+), 40 deletions(-)
>
> --
> 2.12.5
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   3   4   5   6   7   8   >