Re: [PATCH] MAINTAINERS: Change maintainer for hisilicon DRM driver

2020-08-17 Thread Xinliang Liu
On Fri, 14 Aug 2020 at 15:26, Thomas Zimmermann  wrote:
>
> Hi,
>
> as a driver maintainer, you should have commit access to drm-misc. Head
> over to
>
>   https://drm.pages.freedesktop.org/maintainer-tools/commit-access.html
>
> for a description of what that means. The account is requested at
>
>   https://www.freedesktop.org/wiki/AccountRequests/
>
> as described under 'Legacy SSH accounts'.
>
> The first patch to commit would be your appointment as maintainer of
> hisilicon. :)

Yes, after you get the access of drm-misc.  It might be helpful to
reading the guidelines of drm-misc.
https://drm.pages.freedesktop.org/maintainer-tools/committer-drm-misc.html
We use dim tool to commit patches to drm-misc. It's good to learn how
to use dim tool. Please also  read the getting start guide
https://drm.pages.freedesktop.org/maintainer-tools/getting-started.html

Best,
Xinliang

>
> Best regards
> Thomas
>
> Am 11.08.20 um 10:23 schrieb Tian Tao:
> > Remove Rongrong Zou and change tiantao as hisilicon DRM maintainer.
> >
> > Signed-off-by: Tian Tao 
> > ---
> >  MAINTAINERS | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index f12a868..f4e49e0 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -5694,7 +5694,7 @@ F:  drivers/gpu/drm/gma500/
> >
> >  DRM DRIVERS FOR HISILICON
> >  M:   Xinliang Liu 
> > -M:   Rongrong Zou 
> > +M:   Tian Tao  
> >  R:   John Stultz 
> >  R:   Xinwei Kong 
> >  R:   Chen Feng 
> >
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] MAINTAINERS: Change maintainer for hisilicon DRM driver

2020-08-12 Thread Xinliang Liu
Hi,

On Tue, 11 Aug 2020 at 16:25, Tian Tao  wrote:
>
> Remove Rongrong Zou and change tiantao as hisilicon DRM maintainer.
>
> Signed-off-by: Tian Tao 

Thanks Tian Tao,
Tian Tao now is actively maintaining hibmc driver. Happy to hear this.
Acked-by: Xinliang Liu 

-Xinliang

> ---
>  MAINTAINERS | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f12a868..f4e49e0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5694,7 +5694,7 @@ F:drivers/gpu/drm/gma500/
>
>  DRM DRIVERS FOR HISILICON
>  M: Xinliang Liu 
> -M: Rongrong Zou 
> +M: Tian Tao  
>  R: John Stultz 
>  R: Xinwei Kong 
>  R: Chen Feng 
> --
> 2.7.4
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon/hibmc: Move drm_fbdev_generic_setup() down to avoid the splat

2020-07-09 Thread Xinliang Liu
Hi Zenghui,
Thanks for fixing this.
Applied to drm-misc-fixes.

Best,
-Xinliang

On Mon, 6 Jul 2020 at 22:53, Zenghui Yu  wrote:
>
> The HiSilicon hibmc driver triggers a splat at boot time as below
>
> [   14.137806] [ cut here ]
> [   14.142405] hibmc-drm :0a:00.0: Device has not been registered.
> [   14.148661] WARNING: CPU: 0 PID: 496 at 
> drivers/gpu/drm/drm_fb_helper.c:2233 drm_fbdev_generic_setup+0x15c/0x1b8
> [   14.158787] [...]
> [   14.278307] Call trace:
> [   14.280742]  drm_fbdev_generic_setup+0x15c/0x1b8
> [   14.285337]  hibmc_pci_probe+0x354/0x418
> [   14.289242]  local_pci_probe+0x44/0x98
> [   14.292974]  work_for_cpu_fn+0x20/0x30
> [   14.296708]  process_one_work+0x1c4/0x4e0
> [   14.300698]  worker_thread+0x2c8/0x528
> [   14.304431]  kthread+0x138/0x140
> [   14.307646]  ret_from_fork+0x10/0x18
> [   14.311205] ---[ end trace a2000ec2d838af4d ]---
>
> This turned out to be due to the fbdev device hasn't been registered when
> drm_fbdev_generic_setup() is invoked. Let's fix the splat by moving it down
> after drm_dev_register() which will follow the "Display driver example"
> documented by commit de99f0600a79 ("drm/drv: DOC: Add driver example
> code").
>
> Signed-off-by: Zenghui Yu 
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index a6fd0c29e5b8..544b9993c99e 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -307,8 +307,6 @@ static int hibmc_load(struct drm_device *dev)
> /* reset all the states of crtc/plane/encoder/connector */
> drm_mode_config_reset(dev);
>
> -   drm_fbdev_generic_setup(dev, dev->mode_config.preferred_depth);
> -
> return 0;
>
>  err:
> @@ -355,6 +353,9 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
>   ret);
> goto err_unload;
> }
> +
> +   drm_fbdev_generic_setup(dev, dev->mode_config.preferred_depth);
> +
> return 0;
>
>  err_unload:
> --
> 2.19.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: kirin: Revert change to add register connect helper functions

2020-04-13 Thread Xinliang Liu
On Thu, 9 Apr 2020 at 08:43, John Stultz  wrote:
>
> Daniel noted[1] that commit d606dc9a6323 ("drm: kirin: Add
> register connect helper functions in drm init") was unnecessary
> and incorrect, as drm_dev_register does register connectors for
> us.
>
> Thus, this patch reverts the change as suggested by Daniel.
>
> [1]: 
> https://lore.kernel.org/lkml/CAKMK7uHr5U-pPsxdQ4MpfK5v8iLjphDFug_3VTiUAf06nhS=y...@mail.gmail.com/
>
> Cc: Xu YiPing 
> Cc: Rongrong Zou 
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Cc: Chen Feng 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sam Ravnborg 
> Cc: dri-devel 
> Signed-off-by: John Stultz 

Thanks John for the fix.
Acked-by: Xinliang Liu 
Applied to drm-misc.

-Xinliang

> ---
>  .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c   |  1 -
>  .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c   | 43 ---
>  .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h   |  1 -
>  3 files changed, 45 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 86000127d4ee..c339e632522a 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -940,7 +940,6 @@ static struct drm_driver ade_driver = {
>  };
>
>  struct kirin_drm_data ade_driver_data = {
> -   .register_connects = false,
> .num_planes = ADE_CH_NUM,
> .prim_plane = ADE_CH1,
> .channel_formats = channel_formats,
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index d3145ae877d7..4349da3e2379 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -219,40 +219,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
> return 0;
>  }
>
> -static int kirin_drm_connectors_register(struct drm_device *dev)
> -{
> -   struct drm_connector *connector;
> -   struct drm_connector *failed_connector;
> -   struct drm_connector_list_iter conn_iter;
> -   int ret;
> -
> -   mutex_lock(>mode_config.mutex);
> -   drm_connector_list_iter_begin(dev, _iter);
> -   drm_for_each_connector_iter(connector, _iter) {
> -   ret = drm_connector_register(connector);
> -   if (ret) {
> -   failed_connector = connector;
> -   goto err;
> -   }
> -   }
> -   drm_connector_list_iter_end(_iter);
> -   mutex_unlock(>mode_config.mutex);
> -
> -   return 0;
> -
> -err:
> -   drm_connector_list_iter_begin(dev, _iter);
> -   drm_for_each_connector_iter(connector, _iter) {
> -   if (failed_connector == connector)
> -   break;
> -   drm_connector_unregister(connector);
> -   }
> -   drm_connector_list_iter_end(_iter);
> -   mutex_unlock(>mode_config.mutex);
> -
> -   return ret;
> -}
> -
>  static int kirin_drm_bind(struct device *dev)
>  {
> struct kirin_drm_data *driver_data;
> @@ -279,17 +245,8 @@ static int kirin_drm_bind(struct device *dev)
>
> drm_fbdev_generic_setup(drm_dev, 32);
>
> -   /* connectors should be registered after drm device register */
> -   if (driver_data->register_connects) {
> -   ret = kirin_drm_connectors_register(drm_dev);
> -   if (ret)
> -   goto err_drm_dev_unregister;
> -   }
> -
> return 0;
>
> -err_drm_dev_unregister:
> -   drm_dev_unregister(drm_dev);
>  err_kms_cleanup:
> kirin_drm_kms_cleanup(drm_dev);
>  err_drm_dev_put:
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> index 4d5c05a24065..dee8ec2f7f2e 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> @@ -37,7 +37,6 @@ struct kirin_drm_data {
> u32 channel_formats_cnt;
> int config_max_width;
> int config_max_height;
> -   bool register_connects;
> u32 num_planes;
> u32 prim_plane;
>
> --
> 2.17.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/4] drm/hisilicon: Code cleanup for hibmc_drv_vdac

2020-04-03 Thread Xinliang Liu
Hi Tao,

On Fri, 6 Mar 2020 at 11:44, Tian Tao  wrote:
>
> code cleanup for hibmc_drv_vdac.c, no actual function changes.
>
> Signed-off-by: Tian Tao 
> Signed-off-by: Gong junjie 
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 49 
> 
>  1 file changed, 16 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> index 678ac2e..f0e6bb8 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> @@ -52,32 +52,6 @@ static const struct drm_connector_funcs 
> hibmc_connector_funcs = {
> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  };
>
> -static struct drm_connector *
> -hibmc_connector_init(struct hibmc_drm_private *priv)
> -{
> -   struct drm_device *dev = priv->dev;
> -   struct drm_connector *connector;
> -   int ret;
> -
> -   connector = devm_kzalloc(dev->dev, sizeof(*connector), GFP_KERNEL);
> -   if (!connector) {
> -   DRM_ERROR("failed to alloc memory when init connector\n");
> -   return ERR_PTR(-ENOMEM);
> -   }
> -
> -   ret = drm_connector_init(dev, connector,
> -_connector_funcs,
> -DRM_MODE_CONNECTOR_VGA);
> -   if (ret) {
> -   DRM_ERROR("failed to init connector: %d\n", ret);
> -   return ERR_PTR(ret);
> -   }
> -   drm_connector_helper_add(connector,
> -_connector_helper_funcs);
> -
> -   return connector;
> -}
> -
>  static void hibmc_encoder_mode_set(struct drm_encoder *encoder,
>struct drm_display_mode *mode,
>struct drm_display_mode *adj_mode)
> @@ -109,13 +83,6 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv)
> struct drm_connector *connector;
> int ret;
>
> -   connector = hibmc_connector_init(priv);
> -   if (IS_ERR(connector)) {
> -   DRM_ERROR("failed to create connector: %ld\n",
> - PTR_ERR(connector));
> -   return PTR_ERR(connector);
> -   }
> -
> encoder = devm_kzalloc(dev->dev, sizeof(*encoder), GFP_KERNEL);
> if (!encoder) {
> DRM_ERROR("failed to alloc memory when init encoder\n");
> @@ -131,6 +98,22 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv)
> }
>
> drm_encoder_helper_add(encoder, _encoder_helper_funcs);
> +   connector = devm_kzalloc(dev->dev, sizeof(*connector), GFP_KERNEL);
> +   if (!connector) {
> +   DRM_ERROR("failed to alloc memory when init connector\n");
> +   return -ENOMEM;
> +   }
> +
> +   ret = drm_connector_init(dev, connector,
> +_connector_funcs,
> +DRM_MODE_CONNECTOR_VGA);
> +   if (ret) {
> +   DRM_ERROR("failed to init connector: %d\n", ret);
> +   return ret;
> +   }
> +
> +   drm_connector_helper_add(connector, _connector_helper_funcs);
> +   drm_connector_register(connector);

You don't need to register a non-hotplug connector as it will be
registered at drm_dev_register automatically.

See function definition:

 488 /**
 489  * drm_connector_register - register a connector
 490  * @connector: the connector to register
 491  *
 492  * Register userspace interfaces for a connector. Only call this
for connectors
 493  * which can be hotplugged after drm_dev_register() has been
called already,
 494  * e.g. DP MST connectors. All other connectors will be
registered automatically
 495  * when calling drm_dev_register().
 496  *
 497  * Returns:
 498  * Zero on success, error code on failure.
 499  */
 500 int drm_connector_register(struct drm_connector *connector)
 501 {


Besides, I don't think this patch cleans much things.

-Xinliang

> drm_connector_attach_encoder(connector, encoder);
>
> return 0;
> --
> 2.7.4
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/4] drm/hisilicon: Enforce 128-byte stride alignment to fix the hardware limitation

2020-04-03 Thread Xinliang Liu
Hi Tao,

On Fri, 6 Mar 2020 at 11:44, Tian Tao  wrote:
>
> because the hardware limitation,The initial color depth must set to 32bpp
> and must set the FB Offset of the display hardware to 128Byte alignment,
> which is used to solve the display problem at 800x600 and 1440x900
> resolution under 16bpp.
>
> Signed-off-by: Tian Tao 
> Signed-off-by: Gong junjie 

Thanks for the patch.
Acked-by: Xinliang Liu 
Applied to drm-misc.

-Xinliang

> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 9 +
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 4 ++--
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +-
>  3 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index 55b46a7..cc70e83 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -94,6 +94,10 @@ static int hibmc_plane_atomic_check(struct drm_plane 
> *plane,
> return -EINVAL;
> }
>
> +   if (state->fb->pitches[0] % 128 != 0) {
> +   DRM_DEBUG_ATOMIC("wrong stride with 128-byte aligned\n");
> +   return -EINVAL;
> +   }
> return 0;
>  }
>
> @@ -119,11 +123,8 @@ static void hibmc_plane_atomic_update(struct drm_plane 
> *plane,
> writel(gpu_addr, priv->mmio + HIBMC_CRT_FB_ADDRESS);
>
> reg = state->fb->width * (state->fb->format->cpp[0]);
> -   /* now line_pad is 16 */
> -   reg = PADDING(16, reg);
>
> -   line_l = state->fb->width * state->fb->format->cpp[0];
> -   line_l = PADDING(16, line_l);
> +   line_l = state->fb->pitches[0];
> writel(HIBMC_FIELD(HIBMC_CRT_FB_WIDTH_WIDTH, reg) |
>HIBMC_FIELD(HIBMC_CRT_FB_WIDTH_OFFS, line_l),
>priv->mmio + HIBMC_CRT_FB_WIDTH);
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 222356a..79a180a 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -94,7 +94,7 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv)
> priv->dev->mode_config.max_height = 1200;
>
> priv->dev->mode_config.fb_base = priv->fb_base;
> -   priv->dev->mode_config.preferred_depth = 24;
> +   priv->dev->mode_config.preferred_depth = 32;
> priv->dev->mode_config.prefer_shadow = 1;
>
> priv->dev->mode_config.funcs = (void *)_mode_funcs;
> @@ -307,7 +307,7 @@ static int hibmc_load(struct drm_device *dev)
> /* reset all the states of crtc/plane/encoder/connector */
> drm_mode_config_reset(dev);
>
> -   ret = drm_fbdev_generic_setup(dev, 16);
> +   ret = drm_fbdev_generic_setup(dev, dev->mode_config.preferred_depth);
> if (ret) {
> DRM_ERROR("failed to initialize fbdev: %d\n", ret);
> goto err;
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> index 99397ac..322bd54 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> @@ -50,7 +50,7 @@ void hibmc_mm_fini(struct hibmc_drm_private *hibmc)
>  int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
>   struct drm_mode_create_dumb *args)
>  {
> -   return drm_gem_vram_fill_create_dumb(file, dev, 0, 16, args);
> +   return drm_gem_vram_fill_create_dumb(file, dev, 0, 128, args);
>  }
>
>  const struct drm_mode_config_funcs hibmc_mode_funcs = {
> --
> 2.7.4
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: kirin: Revert "Fix for hikey620 display offset problem"

2020-03-05 Thread Xinliang Liu
On Wed, 4 Mar 2020 at 00:32, John Stultz  wrote:
>
> This reverts commit ff57c6513820efe945b61863cf4a51b79f18b592.
>
> With the commit ff57c6513820 ("drm: kirin: Fix for hikey620
> display offset problem") we added support for handling LDI
> overflows by resetting the hardware.
>
> However, its been observed that when we do hit the LDI overflow
> condition, the irq seems to be screaming, and we do nothing but
> stream:
>   [drm:ade_irq_handler [kirin_drm]] *ERROR* LDI underflow!
> over and over to the screen
>
> I've tried a few appraoches to avoid this, but none has yet
> been successful and the cure here is worse then the original
> disease, so revert this for now.

Sorry to hear that. Then it seems such underflow errors can't be
recovered via reset.
Anyway, for this patch
Acked-by: Xinliang Liu 

And applied to drm-misc .

-xinliang

>
> Cc: Xinliang Liu 
> Cc: Rongrong Zou 
> Cc: Xinwei Kong 
> Cc: Chen Feng 
> Cc: Sam Ravnborg 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: dri-devel 
> Fixes: ff57c6513820 ("drm: kirin: Fix for hikey620 display offset problem")
> Signed-off-by: John Stultz 
> ---
>  .../gpu/drm/hisilicon/kirin/kirin_ade_reg.h   |  1 -
>  .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c   | 20 ---
>  2 files changed, 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
> index 0da860200410..e2ac09894a6d 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
> @@ -83,7 +83,6 @@
>  #define VSIZE_OFST 20
>  #define LDI_INT_EN 0x741C
>  #define FRAME_END_INT_EN_OFST  1
> -#define UNDERFLOW_INT_EN_OFST  2
>  #define LDI_CTRL   0x7420
>  #define BPP_OFST   3
>  #define DATA_GATE_EN   BIT(2)
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 73cd28a6ea07..86000127d4ee 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -46,7 +46,6 @@ struct ade_hw_ctx {
> struct clk *media_noc_clk;
> struct clk *ade_pix_clk;
> struct reset_control *reset;
> -   struct work_struct display_reset_wq;
> bool power_on;
> int irq;
>
> @@ -136,7 +135,6 @@ static void ade_init(struct ade_hw_ctx *ctx)
>  */
> ade_update_bits(base + ADE_CTRL, FRM_END_START_OFST,
> FRM_END_START_MASK, REG_EFFECTIVE_IN_ADEEN_FRMEND);
> -   ade_update_bits(base + LDI_INT_EN, UNDERFLOW_INT_EN_OFST, MASK(1), 1);
>  }
>
>  static bool ade_crtc_mode_fixup(struct drm_crtc *crtc,
> @@ -304,17 +302,6 @@ static void ade_crtc_disable_vblank(struct drm_crtc 
> *crtc)
> MASK(1), 0);
>  }
>
> -static void drm_underflow_wq(struct work_struct *work)
> -{
> -   struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx,
> - display_reset_wq);
> -   struct drm_device *drm_dev = ctx->crtc->dev;
> -   struct drm_atomic_state *state;
> -
> -   state = drm_atomic_helper_suspend(drm_dev);
> -   drm_atomic_helper_resume(drm_dev, state);
> -}
> -
>  static irqreturn_t ade_irq_handler(int irq, void *data)
>  {
> struct ade_hw_ctx *ctx = data;
> @@ -331,12 +318,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data)
> MASK(1), 1);
> drm_crtc_handle_vblank(crtc);
> }
> -   if (status & BIT(UNDERFLOW_INT_EN_OFST)) {
> -   ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST,
> -   MASK(1), 1);
> -   DRM_ERROR("LDI underflow!");
> -   schedule_work(>display_reset_wq);
> -   }
>
> return IRQ_HANDLED;
>  }
> @@ -919,7 +900,6 @@ static void *ade_hw_ctx_alloc(struct platform_device 
> *pdev,
> if (ret)
> return ERR_PTR(-EIO);
>
> -   INIT_WORK(>display_reset_wq, drm_underflow_wq);
> ctx->crtc = crtc;
>
> return ctx;
> --
> 2.17.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: kirin: Revert "Fix for hikey620 display offset problem"

2020-03-05 Thread Xinliang Liu
On Wed, 4 Mar 2020 at 17:28, Xinliang Liu  wrote:
>
> On Wed, 4 Mar 2020 at 00:32, John Stultz  wrote:
> >
> > This reverts commit ff57c6513820efe945b61863cf4a51b79f18b592.
> >
> > With the commit ff57c6513820 ("drm: kirin: Fix for hikey620
> > display offset problem") we added support for handling LDI
> > overflows by resetting the hardware.
> >
> > However, its been observed that when we do hit the LDI overflow
> > condition, the irq seems to be screaming, and we do nothing but
> > stream:
> >   [drm:ade_irq_handler [kirin_drm]] *ERROR* LDI underflow!
> > over and over to the screen
> >
> > I've tried a few appraoches to avoid this, but none has yet
> > been successful and the cure here is worse then the original
> > disease, so revert this for now.
>
> Sorry to hear that. Then it seems such underflow errors can't be
> recovered via reset.
> Anyway, for this patch
> Acked-by: Xinliang Liu 

Sorry , should be:
 Acked-by: Xinliang Liu 

>
> And applied to drm-misc .
>
> -xinliang
>
> >
> > Cc: Xinliang Liu 
> > Cc: Rongrong Zou 
> > Cc: Xinwei Kong 
> > Cc: Chen Feng 
> > Cc: Sam Ravnborg 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: dri-devel 
> > Fixes: ff57c6513820 ("drm: kirin: Fix for hikey620 display offset problem")
> > Signed-off-by: John Stultz 
> > ---
> >  .../gpu/drm/hisilicon/kirin/kirin_ade_reg.h   |  1 -
> >  .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c   | 20 ---
> >  2 files changed, 21 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h 
> > b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
> > index 0da860200410..e2ac09894a6d 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
> > @@ -83,7 +83,6 @@
> >  #define VSIZE_OFST 20
> >  #define LDI_INT_EN 0x741C
> >  #define FRAME_END_INT_EN_OFST  1
> > -#define UNDERFLOW_INT_EN_OFST  2
> >  #define LDI_CTRL   0x7420
> >  #define BPP_OFST   3
> >  #define DATA_GATE_EN   BIT(2)
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> > b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > index 73cd28a6ea07..86000127d4ee 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > @@ -46,7 +46,6 @@ struct ade_hw_ctx {
> > struct clk *media_noc_clk;
> > struct clk *ade_pix_clk;
> > struct reset_control *reset;
> > -   struct work_struct display_reset_wq;
> > bool power_on;
> > int irq;
> >
> > @@ -136,7 +135,6 @@ static void ade_init(struct ade_hw_ctx *ctx)
> >  */
> > ade_update_bits(base + ADE_CTRL, FRM_END_START_OFST,
> > FRM_END_START_MASK, REG_EFFECTIVE_IN_ADEEN_FRMEND);
> > -   ade_update_bits(base + LDI_INT_EN, UNDERFLOW_INT_EN_OFST, MASK(1), 
> > 1);
> >  }
> >
> >  static bool ade_crtc_mode_fixup(struct drm_crtc *crtc,
> > @@ -304,17 +302,6 @@ static void ade_crtc_disable_vblank(struct drm_crtc 
> > *crtc)
> > MASK(1), 0);
> >  }
> >
> > -static void drm_underflow_wq(struct work_struct *work)
> > -{
> > -   struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx,
> > - display_reset_wq);
> > -   struct drm_device *drm_dev = ctx->crtc->dev;
> > -   struct drm_atomic_state *state;
> > -
> > -   state = drm_atomic_helper_suspend(drm_dev);
> > -   drm_atomic_helper_resume(drm_dev, state);
> > -}
> > -
> >  static irqreturn_t ade_irq_handler(int irq, void *data)
> >  {
> > struct ade_hw_ctx *ctx = data;
> > @@ -331,12 +318,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data)
> > MASK(1), 1);
> > drm_crtc_handle_vblank(crtc);
> > }
> > -   if (status & BIT(UNDERFLOW_INT_EN_OFST)) {
> > -   ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST,
> > -   MASK(1), 1);
> > -   DRM_ERROR("LDI underflow!");
> > -   schedule_work(>display_reset_wq);
> > -   }
> >
> > return IRQ_HANDLED;
> >  }
> > @@ -919,7 +900,6 @@ static void *ade_hw_ctx_alloc(struct platform_device 
> > *pdev,
> > if (ret)
> > return ERR_PTR(-EIO);
> >
> > -   INIT_WORK(>display_reset_wq, drm_underflow_wq);
> > ctx->crtc = crtc;
> >
> > return ctx;
> > --
> > 2.17.1
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/hisilicon: Fixed pcie resource conflict between drm and firmware

2020-02-27 Thread Xinliang Liu
Thanks for the patch.
Applied to drm-misc-next.

On Mon, 24 Feb 2020 at 14:02, Tian Tao  wrote:

> use the drm_fb_helper_remove_conflicting_pci_framebuffer to remove
> the framebuffer initialized by fireware/bootloader to avoid resource
> conflict.
>
> Signed-off-by: Tian Tao 
>
> ---
> v2: use the general API to remove the conflict resource instead of
> rolling
> our own.
> ---
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 4a8a4cf..7518980 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -327,6 +327,11 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
> struct drm_device *dev;
> int ret;
>
> +   ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev,
> +   "hibmcdrmfb");
> +   if (ret)
> +   return ret;
> +
> dev = drm_dev_alloc(_driver, >dev);
> if (IS_ERR(dev)) {
> DRM_ERROR("failed to allocate drm_device\n");
> --
> 2.7.4
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/hisilicon: Add the mode_valid function

2020-02-27 Thread Xinliang Liu
Thanks for the patch.
Applied to drm-misc-next.

On Wed, 8 Jan 2020 at 17:41, Tian Tao  wrote:

> add mode_valid function, we can make sure the resolution is valid.
>
> Signed-off-by: Tian Tao 
> Signed-off-by: Gong junjie 
> Reviewed-by: Thomas Zimmermann 
>
> ---
> v2: declare hibmc_crtc_mode_valid as static.
> Modify the return value of hibmc_crtc_mode_valid .
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 19 +++
>  1 file changed, 19 insertions(+)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index 843d784..675d629 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -242,6 +242,24 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc
> *crtc,
> hibmc_set_current_gate(priv, reg);
>  }
>
> +static enum drm_mode_status hibmc_crtc_mode_valid(struct drm_crtc *crtc,
> +   const struct drm_display_mode
> *mode)
> +{
> +   int i = 0;
> +   int vrefresh = drm_mode_vrefresh(mode);
> +
> +   if (vrefresh < 59 || vrefresh > 61)
> +   return MODE_NOCLOCK;
> +
> +   for (i = 0; i < ARRAY_SIZE(hibmc_pll_table); i++) {
> +   if (hibmc_pll_table[i].hdisplay == mode->hdisplay &&
> +   hibmc_pll_table[i].vdisplay == mode->vdisplay)
> +   return MODE_OK;
> +   }
> +
> +   return MODE_BAD;
> +}
> +
>  static unsigned int format_pll_reg(void)
>  {
> unsigned int pllreg = 0;
> @@ -510,6 +528,7 @@ static const struct drm_crtc_helper_funcs
> hibmc_crtc_helper_funcs = {
> .atomic_flush   = hibmc_crtc_atomic_flush,
> .atomic_enable  = hibmc_crtc_atomic_enable,
> .atomic_disable = hibmc_crtc_atomic_disable,
> +   .mode_valid = hibmc_crtc_mode_valid,
>  };
>
>  int hibmc_de_init(struct hibmc_drm_private *priv)
> --
> 2.7.4
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon: Enable the shadowfb for hibmc

2020-02-27 Thread Xinliang Liu
Thanks for the patch.
Applied to drm-misc-next.

On Sat, 11 Jan 2020 at 11:09, Tian Tao  wrote:

> set the prefer_shadow as 1,so we use the shadowfb to acceleration.
>
> Signed-off-by: Tian Tao 
> Signed-off-by: Gong junjie 
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index dbdeb2b..2883555 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -93,7 +93,7 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv)
>
> priv->dev->mode_config.fb_base = priv->fb_base;
> priv->dev->mode_config.preferred_depth = 24;
> -   priv->dev->mode_config.prefer_shadow = 0;
> +   priv->dev->mode_config.prefer_shadow = 1;
>
> priv->dev->mode_config.funcs = (void *)_mode_funcs;
>
> --
> 2.7.4
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon: fixed the wrong resolution configurations

2020-02-27 Thread Xinliang Liu
Thanks for the patch.
Applied to drm-misc-next.

On Fri, 3 Jan 2020 at 11:55, Tian Tao  wrote:

> The maximum resolution supported by hibmc is 1920 * 1200 instead of
> 1920 * 1440, this patch fixed this problem
>
> Signed-off-by: Tian Tao 
> Signed-off-by: Gong junjie 
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 2fd4ca9..dbdeb2b 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -89,7 +89,7 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv)
> priv->dev->mode_config.min_width = 0;
> priv->dev->mode_config.min_height = 0;
> priv->dev->mode_config.max_width = 1920;
> -   priv->dev->mode_config.max_height = 1440;
> +   priv->dev->mode_config.max_height = 1200;
>
> priv->dev->mode_config.fb_base = priv->fb_base;
> priv->dev->mode_config.preferred_depth = 24;
> --
> 2.7.4
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon: Add new clock/resolution configurations

2020-02-27 Thread Xinliang Liu
Thanks for the patch.
Applied to drm-misc-next.

On Tue, 31 Dec 2019 at 14:43, Tian Tao  wrote:

> Add the three new pll config for corresponding resolution 1440x900 and
> 1600x900, 640x480 for hibmc
>
> Signed-off-by: Tian Tao 
> Signed-off-by: Gong junjie 
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c   | 3 +++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h | 2 ++
>  2 files changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index f1ce6cb..6bf4334 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -40,6 +40,7 @@ struct hibmc_dislay_pll_config {
>  };
>
>  static const struct hibmc_dislay_pll_config hibmc_pll_table[] = {
> +   {640, 480, CRT_PLL1_HS_25MHZ, CRT_PLL2_HS_25MHZ},
> {800, 600, CRT_PLL1_HS_40MHZ, CRT_PLL2_HS_40MHZ},
> {1024, 768, CRT_PLL1_HS_65MHZ, CRT_PLL2_HS_65MHZ},
> {1152, 864, CRT_PLL1_HS_80MHZ_1152, CRT_PLL2_HS_80MHZ},
> @@ -47,6 +48,8 @@ static const struct hibmc_dislay_pll_config
> hibmc_pll_table[] = {
> {1280, 720, CRT_PLL1_HS_74MHZ, CRT_PLL2_HS_74MHZ},
> {1280, 960, CRT_PLL1_HS_108MHZ, CRT_PLL2_HS_108MHZ},
> {1280, 1024, CRT_PLL1_HS_108MHZ, CRT_PLL2_HS_108MHZ},
> +   {1440, 900, CRT_PLL1_HS_106MHZ, CRT_PLL2_HS_106MHZ},
> +   {1600, 900, CRT_PLL1_HS_108MHZ, CRT_PLL2_HS_108MHZ},
> {1600, 1200, CRT_PLL1_HS_162MHZ, CRT_PLL2_HS_162MHZ},
> {1920, 1080, CRT_PLL1_HS_148MHZ, CRT_PLL2_HS_148MHZ},
> {1920, 1200, CRT_PLL1_HS_193MHZ, CRT_PLL2_HS_193MHZ},
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> index 9b7e859..17b30c3 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> @@ -179,6 +179,7 @@
>  #define CRT_PLL1_HS_74MHZ  0x23941dc2
>  #define CRT_PLL1_HS_80MHZ  0x23941001
>  #define CRT_PLL1_HS_80MHZ_1152 0x23540fc2
> +#define CRT_PLL1_HS_106MHZ 0x237C1641
>  #define CRT_PLL1_HS_108MHZ 0x23b41b01
>  #define CRT_PLL1_HS_162MHZ 0x23480681
>  #define CRT_PLL1_HS_148MHZ 0x23541dc2
> @@ -191,6 +192,7 @@
>  #define CRT_PLL2_HS_78MHZ  0x50E147AE
>  #define CRT_PLL2_HS_74MHZ  0x602B6AE7
>  #define CRT_PLL2_HS_80MHZ  0x7000
> +#define CRT_PLL2_HS_106MHZ 0x0075c28f
>  #define CRT_PLL2_HS_108MHZ 0x8000
>  #define CRT_PLL2_HS_162MHZ 0xA000
>  #define CRT_PLL2_HS_148MHZ 0xB0CD
> --
> 2.7.4
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon: Set preferred mode resolution and maximum resolution

2020-02-25 Thread Xinliang Liu
On Wed, 19 Feb 2020 at 10:52, Tian Tao  wrote:

> set the preferred mode resolution to 1024 * 768 and maximum
> resolution to 1920 * 1200.
>
> Signed-off-by: Tian Tao 
> Signed-off-by: Gong junjie 
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> index 6d98fdc..82fc7d3 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> @@ -11,8 +11,10 @@
>   * Jianhua Li 
>   */
>
> +#include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #include "hibmc_drm_drv.h"
> @@ -20,7 +22,13 @@
>
>  static int hibmc_connector_get_modes(struct drm_connector *connector)
>  {
> -   return drm_add_modes_noedid(connector, 800, 600);
> +   int count;
> +
> +   drm_connector_update_edid_property(connector, NULL);
> +   count = drm_add_modes_noedid(connector, 1920, 1200);
>

Hi Tao, maybe it's better like this:
count = drm_add_modes_noedid( connector ,
  conn->dev->mode_config.max_width,
  conn->dev->mode_config.max_height);


> +   drm_set_preferred_mode(connector, 1024, 768);
> +
> +   return count;
>  }
>
>  static enum drm_mode_status hibmc_connector_mode_valid(struct
> drm_connector *connector,
> --
> 2.7.4
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon: Set preferred mode resolution and maximum resolution

2020-02-25 Thread Xinliang Liu
On Tue, 25 Feb 2020 at 10:19, Xinliang Liu  wrote:

>
>
> On Wed, 19 Feb 2020 at 10:52, Tian Tao  wrote:
>
>> set the preferred mode resolution to 1024 * 768 and maximum
>> resolution to 1920 * 1200.
>>
>> Signed-off-by: Tian Tao 
>> Signed-off-by: Gong junjie 
>> ---
>>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> index 6d98fdc..82fc7d3 100644
>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> @@ -11,8 +11,10 @@
>>   * Jianhua Li 
>>   */
>>
>> +#include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>
>>  #include "hibmc_drm_drv.h"
>> @@ -20,7 +22,13 @@
>>
>>  static int hibmc_connector_get_modes(struct drm_connector *connector)
>>  {
>> -   return drm_add_modes_noedid(connector, 800, 600);
>> +   int count;
>> +
>> +   drm_connector_update_edid_property(connector, NULL);
>>
>
And as there is no edid for the connector, don't think call
drm_connector_update_edid_property is required.


> +   count = drm_add_modes_noedid(connector, 1920, 1200);
>>
>
> Hi Tao, maybe it's better like this:
> count = drm_add_modes_noedid( connector ,
>   conn->dev->mode_config.max_width,
>   conn->dev->mode_config.max_height);
>
>
>> +   drm_set_preferred_mode(connector, 1024, 768);
>> +
>> +   return count;
>>  }
>>
>>  static enum drm_mode_status hibmc_connector_mode_valid(struct
>> drm_connector *connector,
>> --
>> 2.7.4
>>
>>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] MAINTAINERS: Update myself email address

2020-02-21 Thread Xinliang Liu
On Fri, 21 Feb 2020 at 02:22, Daniel Vetter  wrote:

> On Thu, Feb 20, 2020 at 07:21:41PM +0100, Daniel Vetter wrote:
> > On Thu, Feb 20, 2020 at 09:03:28AM +, Xinliang Liu wrote:
> > > Update myself email address.
> > > Add John Stultz as a reviewer. Thanks John.
> > > Update git tree to drm-misc
> >
> > Acked-by: Daniel Vetter 
> >
> > I guess you're going to push this to drm-misc?
>
> Oh and I guess time for John Stultz to apply for drm-misc commit rights,
>

Sure, if John would like.
But I will push this patch into drm-misc, thanks Daniel.
-Xinliang


> seems to be lacking.
> -Daniel
> >
> > >
> > > Signed-off-by: Xinliang Liu 
> > > ---
> > >  MAINTAINERS | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index 978766c6715e..befc3c0afc75 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -5600,12 +5600,13 @@ S:  Maintained
> > >  F: drivers/gpu/drm/gma500/
> > >
> > >  DRM DRIVERS FOR HISILICON
> > > -M: Xinliang Liu 
> > > +M: Xinliang Liu 
> > >  M: Rongrong Zou 
> > > +R: John Stultz 
> > >  R: Xinwei Kong 
> > >  R: Chen Feng 
> > >  L: dri-devel@lists.freedesktop.org
> > > -T: git git://github.com/xin3liang/linux.git
> > > +T: git git://anongit.freedesktop.org/drm/drm-misc
> > >  S: Maintained
> > >  F: drivers/gpu/drm/hisilicon/
> > >  F: Documentation/devicetree/bindings/display/hisilicon/
> > > --
> > > 2.20.1
> > >
> >
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
>
> --
> 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


[PATCH] MAINTAINERS: Update myself email address

2020-02-21 Thread Xinliang Liu
Update myself email address.
Add John Stultz as a reviewer. Thanks John.
Update git tree to drm-misc

Signed-off-by: Xinliang Liu 
---
 MAINTAINERS | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 978766c6715e..befc3c0afc75 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5600,12 +5600,13 @@ S:  Maintained
 F: drivers/gpu/drm/gma500/
 
 DRM DRIVERS FOR HISILICON
-M: Xinliang Liu 
+M: Xinliang Liu 
 M: Rongrong Zou 
+R: John Stultz 
 R: Xinwei Kong 
 R: Chen Feng 
 L: dri-devel@lists.freedesktop.org
-T: git git://github.com/xin3liang/linux.git
+T: git git://anongit.freedesktop.org/drm/drm-misc
 S: Maintained
 F: drivers/gpu/drm/hisilicon/
 F: Documentation/devicetree/bindings/display/hisilicon/
-- 
2.20.1

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


Re: [PATCH] drm/hisilicon: Fixed pcie resource conflict using the general API

2020-02-21 Thread Xinliang Liu
Hi tao,
Are you sending a wrong patch?
Function hibmc_remove_framebuffers is added by your prior reviewing patch.
Please send patch based on drm-misc-next branch[1] or linux-next.

Thanks,
-Xinliang

[1] https://anongit.freedesktop.org/git/drm-misc.git

On Fri, 21 Feb 2020 at 13:56, Tian Tao  wrote:

> the kernel provide the drm_fb_helper_remove_conflicting_pci_framebuffer
> to remvoe the pcie resource conflict,there is no need to driver it again.
>
> Signed-off-by: Tian Tao 
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22
> +-
>  1 file changed, 5 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 7ebe831..0f7dba7 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -47,22 +47,6 @@ static irqreturn_t hibmc_drm_interrupt(int irq, void
> *arg)
> return IRQ_HANDLED;
>  }
>
> -static void hibmc_remove_framebuffers(struct pci_dev *pdev)
> -{
> -   struct apertures_struct *ap;
> -
> -   ap = alloc_apertures(1);
> -   if (!ap)
> -   return;
> -
> -   ap->ranges[0].base = pci_resource_start(pdev, 0);
> -   ap->ranges[0].size = pci_resource_len(pdev, 0);
> -
> -   drm_fb_helper_remove_conflicting_framebuffers(ap, "hibmcdrmfb",
> false);
> -
> -   kfree(ap);
> -}
> -
>  static struct drm_driver hibmc_driver = {
> .driver_features= DRIVER_GEM | DRIVER_MODESET |
> DRIVER_ATOMIC,
> .fops   = _fops,
> @@ -343,7 +327,11 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
> struct drm_device *dev;
> int ret;
>
> -   hibmc_remove_framebuffers(pdev);
> +   ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev,
> +
>  "hibmcdrmfb");
> +   if (ret)
> +   return ret;
> +
>
> dev = drm_dev_alloc(_driver, >dev);
> if (IS_ERR(dev)) {
> --
> 2.7.4
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon/hibmc: add DPMS on/off function

2020-02-13 Thread Xinliang Liu
On Fri, 20 Dec 2019 at 10:31, Zhihui Chen  wrote:

> add DPMS function to turn on/off signal of monitor
>
> Signed-off-by: Zhihui Chen 
>

Thanks for the patch.
Acked-by: Xinliang Liu 
Applied to drm-misc-next.


> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c   | 16 
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h |  6 ++
>  2 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index 722e369f30d4..24de937c1cb1 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -189,6 +189,20 @@ static struct drm_plane *hibmc_plane_init(struct
> hibmc_drm_private *priv)
> return plane;
>  }
>
> +static void hibmc_crtc_dpms(struct drm_crtc *crtc, int dpms)
> +{
> +   struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +   unsigned int reg;
> +
> +   reg = readl(priv->mmio + HIBMC_CRT_DISP_CTL);
> +   reg &= ~HIBMC_CRT_DISP_CTL_DPMS_MASK;
> +   reg |= HIBMC_FIELD(HIBMC_CRT_DISP_CTL_DPMS, dpms);
> +   reg &= ~HIBMC_CRT_DISP_CTL_TIMING_MASK;
> +   if (dpms == HIBMC_CRT_DPMS_ON)
> +   reg |= HIBMC_CRT_DISP_CTL_TIMING(1);
> +   writel(reg, priv->mmio + HIBMC_CRT_DISP_CTL);
> +}
> +
>  static void hibmc_crtc_atomic_enable(struct drm_crtc *crtc,
>  struct drm_crtc_state *old_state)
>  {
> @@ -205,6 +219,7 @@ static void hibmc_crtc_atomic_enable(struct drm_crtc
> *crtc,
> reg |= HIBMC_CURR_GATE_DISPLAY(1);
> hibmc_set_current_gate(priv, reg);
> drm_crtc_vblank_on(crtc);
> +   hibmc_crtc_dpms(crtc, HIBMC_CRT_DPMS_ON);
>  }
>
>  static void hibmc_crtc_atomic_disable(struct drm_crtc *crtc,
> @@ -213,6 +228,7 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc
> *crtc,
> unsigned int reg;
> struct hibmc_drm_private *priv = crtc->dev->dev_private;
>
> +   hibmc_crtc_dpms(crtc, HIBMC_CRT_DPMS_OFF);
> drm_crtc_vblank_off(crtc);
>
> hibmc_set_power_mode(priv, HIBMC_PW_MODE_CTL_MODE_SLEEP);
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> index b63a1ee15ceb..b9e20cfcfb5a 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> @@ -68,6 +68,12 @@
>
>  #define HIBMC_CRT_DISP_CTL 0x80200
>
> +#define HIBMC_CRT_DISP_CTL_DPMS(x) ((x) << 30)
> +#define HIBMC_CRT_DISP_CTL_DPMS_MASK   0xc000
> +
> +#define HIBMC_CRT_DPMS_ON  0
> +#define HIBMC_CRT_DPMS_OFF 3
> +
>  #define HIBMC_CRT_DISP_CTL_CRTSELECT(x)((x) << 25)
>  #define HIBMC_CRT_DISP_CTL_CRTSELECT_MASK  0x200
>
> --
> 2.20.1
>
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon/hibmc: add gamma_set function

2020-02-13 Thread Xinliang Liu
On Mon, 23 Dec 2019 at 15:50, Zhihui Chen  wrote:

> add gamma_set function, and we can also use it to adjust the brightness of
> the
> display.
>
> Signed-off-by: Zhihui Chen 
>

Thanks for the patch.
Acked-by: Xinliang Liu 
Applied to drm-misc-next.


> ---
>  .../gpu/drm/hisilicon/hibmc/hibmc_drm_de.c| 37 +++
>  .../gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h  |  5 +++
>  2 files changed, 42 insertions(+)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index 24de937c1cb1..f1ce6cb099d0 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -456,6 +456,42 @@ static void hibmc_crtc_disable_vblank(struct drm_crtc
> *crtc)
>priv->mmio + HIBMC_RAW_INTERRUPT_EN);
>  }
>
> +static void hibmc_crtc_load_lut(struct drm_crtc *crtc)
> +{
> +   struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +   void __iomem   *mmio = priv->mmio;
> +   u16 *r, *g, *b;
> +   unsigned int reg;
> +   int i;
> +
> +   r = crtc->gamma_store;
> +   g = r + crtc->gamma_size;
> +   b = g + crtc->gamma_size;
> +
> +   for (i = 0; i < crtc->gamma_size; i++) {
> +   unsigned int offset = i << 2;
> +   u8 red = *r++ >> 8;
> +   u8 green = *g++ >> 8;
> +   u8 blue = *b++ >> 8;
> +   u32 rgb = (red << 16) | (green << 8) | blue;
> +
> +   writel(rgb, mmio + HIBMC_CRT_PALETTE + offset);
> +   }
> +
> +   reg = readl(priv->mmio + HIBMC_CRT_DISP_CTL);
> +   reg |= HIBMC_FIELD(HIBMC_CTL_DISP_CTL_GAMMA, 1);
> +   writel(reg, priv->mmio + HIBMC_CRT_DISP_CTL);
> +}
> +
> +static int hibmc_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16
> *green,
> + u16 *blue, uint32_t size,
> + struct drm_modeset_acquire_ctx *ctx)
> +{
> +   hibmc_crtc_load_lut(crtc);
> +
> +   return 0;
> +}
> +
>  static const struct drm_crtc_funcs hibmc_crtc_funcs = {
> .page_flip = drm_atomic_helper_page_flip,
> .set_config = drm_atomic_helper_set_config,
> @@ -465,6 +501,7 @@ static const struct drm_crtc_funcs hibmc_crtc_funcs = {
> .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> .enable_vblank = hibmc_crtc_enable_vblank,
> .disable_vblank = hibmc_crtc_disable_vblank,
> +   .gamma_set = hibmc_crtc_gamma_set,
>  };
>
>  static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> index b9e20cfcfb5a..9b7e85947113 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
> @@ -91,6 +91,9 @@
>  #define HIBMC_CRT_DISP_CTL_TIMING(x)   ((x) << 8)
>  #define HIBMC_CRT_DISP_CTL_TIMING_MASK 0x100
>
> +#define HIBMC_CTL_DISP_CTL_GAMMA(x)((x) << 3)
> +#define HIBMC_CTL_DISP_CTL_GAMMA_MASK  0x08
> +
>  #define HIBMC_CRT_DISP_CTL_PLANE(x)((x) << 2)
>  #define HIBMC_CRT_DISP_CTL_PLANE_MASK  4
>
> @@ -193,5 +196,7 @@
>  #define CRT_PLL2_HS_148MHZ 0xB0CD
>  #define CRT_PLL2_HS_193MHZ 0xC0872B02
>
> +#define HIBMC_CRT_PALETTE   0x80C00
> +
>  #define HIBMC_FIELD(field, value) (field(value) & field##_MASK)
>  #endif
> --
> 2.20.1
>
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon/hibmc: fix 'xset dpms force off' fail

2020-02-13 Thread Xinliang Liu
On Fri, 20 Dec 2019 at 10:30, Zhihui Chen  wrote:

> both crtc_state->adjusted_mode.hdisplay and
> crtc_state->adjusted_mode.vdisplay are 0 when switch dpms off,
> return -EINVAL cause switch dpms off fail.
>
> Signed-off-by: Zhihui Chen 
>

Thanks for the patch.
Acked-by: Xinliang Liu 
Applied to drm-misc-next.


> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index 6527a97f68a3..722e369f30d4 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -80,6 +80,9 @@ static int hibmc_plane_atomic_check(struct drm_plane
> *plane,
> return -EINVAL;
> }
>
> +   if (!crtc_state->enable)
> +   return 0;
> +
> if (state->crtc_x + state->crtc_w >
> crtc_state->adjusted_mode.hdisplay ||
> state->crtc_y + state->crtc_h >
> --
> 2.20.1
>
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon: Checked the resolution is valid before connector

2019-12-31 Thread Xinliang Liu
Hi tiantao,
Thanks for the patches.
I see you sent two patches about resolution. Could you just send them as a
series?

Xinliang

On Sat, 28 Dec 2019 at 08:59, Tian Tao  wrote:

> In the previous version, the callback function mode_valid of
> drm_connector_helper_funcs directly returned MODE_OK. Now we will
> ensure that the resolution is correct and return MODE_OK, otherwise
> return MODE_NOMODE.
>
> Signed-off-by: Tian Tao 
> Signed-off-by: Gong junjie 
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 41
> ++--
>  1 file changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> index 6d98fdc..3d08210 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> @@ -11,22 +11,59 @@
>   * Jianhua Li 
>   */
>
> +#include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #include "hibmc_drm_drv.h"
>  #include "hibmc_drm_regs.h"
>
> +static const struct hibmc_resolution {
> +   int w;
> +   int h;
> +} hibmc_modetables[] = {
> +   {640, 480}, {800, 600}, {1024, 768}, {1152, 864}, {1280, 768},
> +   {1280, 720}, {1280, 960}, {1280, 1024}, {1440, 900}, {1600, 900},
> +   {1600, 1200}, {1920, 1080}, {1920, 1200}
> +};
> +
> +static int hibmc_valid_mode(int w, int h)
> +{
> +   int size = sizeof(hibmc_modetables) / sizeof(struct
> hibmc_resolution);
> +   int i;
> +
> +   for (i = 0; i < size; i++) {
> +   if (hibmc_modetables[i].w == w && hibmc_modetables[i].h ==
> h)
> +   return 0;
> +   }
> +
> +   return -1;
> +}
> +
>  static int hibmc_connector_get_modes(struct drm_connector *connector)
>  {
> -   return drm_add_modes_noedid(connector, 800, 600);
> +   int count;
> +
> +   drm_connector_update_edid_property(connector, NULL);
> +   count = drm_add_modes_noedid(connector, 1920, 1200);
> +   drm_set_preferred_mode(connector, 1024, 768);
> +
> +   return count;
>  }
>
>  static enum drm_mode_status hibmc_connector_mode_valid(struct
> drm_connector *connector,
>   struct drm_display_mode *mode)
>  {
> -   return MODE_OK;
> +   int vrefresh = drm_mode_vrefresh(mode);
> +
> +   if (vrefresh < 59 || vrefresh > 61)
> +   return MODE_NOMODE;
> +   else if (hibmc_valid_mode(mode->hdisplay, mode->vdisplay) != 0)
> +   return MODE_NOMODE;
> +   else
> +   return MODE_OK;
>  }
>
>  static const struct drm_connector_helper_funcs
> --
> 2.7.4
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/3] HiBMC driver fixes

2018-09-27 Thread Xinliang Liu
On Wed, 26 Sep 2018 at 17:54, John Garry  wrote:
>
> On 26/09/2018 10:41, Xinliang Liu wrote:
> > On Wed, 26 Sep 2018 at 16:46, John Garry  wrote:
> >>
> >> On 26/09/2018 04:00, Xinliang Liu wrote:
> >>> Thanks John, good addressing!
> >>> The root cause as you said, our hibmc previous frame buffer format
> >>> depth setting is wrong which does not pass the new format sanity
> >>> checking drm_mode_legacy_fb_format.
> >>> For this series,  Reviewed-by: Xinliang Liu 
> >>> Applied to hisilicon-drm-next.
> >>
> >> I can't see this branch in the git associated with this driver from its
> >> MAINTAINERS entry (git://github.com/xin3liang/linux.git), but please
> > Not a branch, it is a tag: drm-hisilicon-next-2018-09-26
> >
> >> ensure these fixes are included in 4.19
> >
> > As it doesn't affect 4.19-rcx, I send a PULL for 4.20.
> > See mail "[GIT PULL] drm-hisilicon-next-2018-09-26"
>
> When Chris' change goes into 4.20 - which I suspect will be before yours
> - boot-time bisect will be broken.

Yeah, that's might be a problem.

>
> John
>
> >
> >>
> >> Thanks,
> >> John
> >>
> >>>
> >>> Thanks,
> >>> Xinliang
> >>>
> >>> On Sun, 23 Sep 2018 at 20:32, John Garry  wrote:
> >>>>
> >>>> This patchset fixes a couple of issues in probing the HiBMC driver, as
> >>>> follows:
> >>>> - fix the probe error path to not carry an error code in the pointer
> >>>> - don't use invalid legacy fb bpp/depth combination
> >>>>
> >>>> Another more trivial patch is for using the standard Huawei PCI vendor ID
> >>>> instead of hard-coding it.
> >>>>
> >>>> Tested on Huawei D05 board. I can see tux on BMC VGA console.
> >>>>
> >>>> John Garry (3):
> >>>>   drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer
> >>>> pointer
> >>>>   drm/hisilicon: hibmc: Don't overwrite fb helper surface depth
> >>>>   drm/hisilicon: hibmc: Use HUAWEI PCI vendor ID macro
> >>>>
> >>>>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 2 +-
> >>>>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 2 +-
> >>>>  2 files changed, 2 insertions(+), 2 deletions(-)
> >>>>
> >>>> --
> >>>> 1.9.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


Re: [GIT PULL] drm-hisilicon-next-2018-09-26

2018-09-27 Thread Xinliang Liu
On Thu, 27 Sep 2018 at 08:58, Dave Airlie  wrote:
>
> On Wed, 26 Sep 2018 at 15:58, Xinliang Liu  wrote:
> >
> > Hi Dave,
> > A few changes for 4.20. Please pull.
> > - A crash fix founded in recent linux-next from John Garry
> > - One sparse warning fix from Souptick Joarder
> > - Some xxx_unref cleanup from Thomas Zimmermann
> >
> > Thanks,
> > Xinliang
> >
> >
> > The following changes since commit 36c9c3c91128e2b892c9be0dd9ee9bd82cbe82ad:
> >
> >   Merge branch 'drm-next-4.20' of
> > git://people.freedesktop.org/~agd5f/linux into drm-next (2018-09-21
> > 09:52:53 +1000)
> >
> > are available in the git repository at:
> >
> >
> >   g...@github.com:xin3liang/linux.git tags/drm-hisilicon-next-2018-09-26
>
> Any idea why this url is on a second line with a blank line?

Dave, I may figure out why. I run the same git request-pull command on
two machines.
I see that the first machine has two blank lines between "are
available in the git repository at:" and
"g...@github.com:xin3liang/linux.git
tags/drm-hisilicon-next-2018-09-26".
Yet, another machine has one blank line.

The difference might be the git's version.
The first machine git's version is 1.9.1.
Another is 2.18.0.

Will avoid this issue use new git version in the future.

Thanks,
Xinliang



>> It's stopping scripts from picking this up for patchwork, is something
> editing the pull? can you remove it?
>
> I can process this one manually, just annoying.
>
> Dave.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/3] HiBMC driver fixes

2018-09-26 Thread Xinliang Liu
On Wed, 26 Sep 2018 at 16:46, John Garry  wrote:
>
> On 26/09/2018 04:00, Xinliang Liu wrote:
> > Thanks John, good addressing!
> > The root cause as you said, our hibmc previous frame buffer format
> > depth setting is wrong which does not pass the new format sanity
> > checking drm_mode_legacy_fb_format.
> > For this series,  Reviewed-by: Xinliang Liu 
> > Applied to hisilicon-drm-next.
>
> I can't see this branch in the git associated with this driver from its
> MAINTAINERS entry (git://github.com/xin3liang/linux.git), but please
Not a branch, it is a tag: drm-hisilicon-next-2018-09-26

> ensure these fixes are included in 4.19

As it doesn't affect 4.19-rcx, I send a PULL for 4.20.
See mail "[GIT PULL] drm-hisilicon-next-2018-09-26"

>
> Thanks,
> John
>
> >
> > Thanks,
> > Xinliang
> >
> > On Sun, 23 Sep 2018 at 20:32, John Garry  wrote:
> >>
> >> This patchset fixes a couple of issues in probing the HiBMC driver, as
> >> follows:
> >> - fix the probe error path to not carry an error code in the pointer
> >> - don't use invalid legacy fb bpp/depth combination
> >>
> >> Another more trivial patch is for using the standard Huawei PCI vendor ID
> >> instead of hard-coding it.
> >>
> >> Tested on Huawei D05 board. I can see tux on BMC VGA console.
> >>
> >> John Garry (3):
> >>   drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer
> >> pointer
> >>   drm/hisilicon: hibmc: Don't overwrite fb helper surface depth
> >>   drm/hisilicon: hibmc: Use HUAWEI PCI vendor ID macro
> >>
> >>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 2 +-
> >>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 2 +-
> >>  2 files changed, 2 insertions(+), 2 deletions(-)
> >>
> >> --
> >> 1.9.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


[GIT PULL] drm-hisilicon-next-2018-09-26

2018-09-25 Thread Xinliang Liu
Hi Dave,
A few changes for 4.20. Please pull.
- A crash fix founded in recent linux-next from John Garry
- One sparse warning fix from Souptick Joarder
- Some xxx_unref cleanup from Thomas Zimmermann

Thanks,
Xinliang


The following changes since commit 36c9c3c91128e2b892c9be0dd9ee9bd82cbe82ad:

  Merge branch 'drm-next-4.20' of
git://people.freedesktop.org/~agd5f/linux into drm-next (2018-09-21
09:52:53 +1000)

are available in the git repository at:


  g...@github.com:xin3liang/linux.git tags/drm-hisilicon-next-2018-09-26

for you to fetch changes up to c932c4f831e66fb5bb15229324825a4932ba3992:

  drm/hisilicon: Replace ttm_bo_unref with ttm_bo_put (2018-09-26
11:42:12 +0800)


John Garry (3):
  drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer pointer
  drm/hisilicon: hibmc: Don't overwrite fb helper surface depth
  drm/hisilicon: hibmc: Use HUAWEI PCI vendor ID macro

Souptick Joarder (1):
  gpu/drm/hisilicon: Convert drm_atomic_helper_suspend/resume()

Thomas Zimmermann (2):
  drm/hisilicon: Replace drm_dev_unref with drm_dev_put
  drm/hisilicon: Replace ttm_bo_unref with ttm_bo_put

 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 26
++
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |  1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |  2 +-
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c   |  2 +-
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c   |  8 
 5 files changed, 12 insertions(+), 27 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/hisilicon: Replace drm_dev_unref with drm_dev_put

2018-09-25 Thread Xinliang Liu
On Fri, 13 Jul 2018 at 16:48, Thomas Zimmermann  wrote:
>
> This patch unifies the naming of DRM functions for reference counting
> of struct drm_device. The resulting code is more aligned with the rest
> of the Linux kernel interfaces.
>
> Signed-off-by: Thomas Zimmermann 

Sorry for late reply.

Reviewed-by: Xinliang Liu 
Applied to hisilicon-drm-next.

Thanks,
Xinliang

> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 4 ++--
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index d4f6f1f9df5b..ec878c7e3f75 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -387,7 +387,7 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
>  err_disable:
> pci_disable_device(pdev);
>  err_free:
> -   drm_dev_unref(dev);
> +   drm_dev_put(dev);
>
> return ret;
>  }
> @@ -398,7 +398,7 @@ static void hibmc_pci_remove(struct pci_dev *pdev)
>
> drm_dev_unregister(dev);
> hibmc_unload(dev);
> -   drm_dev_unref(dev);
> +   drm_dev_put(dev);
>  }
>
>  static struct pci_device_id hibmc_pci_table[] = {
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index ddb0403f1975..e6a62d5a00a3 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -193,7 +193,7 @@ static int kirin_drm_bind(struct device *dev)
>
> ret = kirin_drm_kms_init(drm_dev);
> if (ret)
> -   goto err_drm_dev_unref;
> +   goto err_drm_dev_put;
>
> ret = drm_dev_register(drm_dev, 0);
> if (ret)
> @@ -203,8 +203,8 @@ static int kirin_drm_bind(struct device *dev)
>
>  err_kms_cleanup:
> kirin_drm_kms_cleanup(drm_dev);
> -err_drm_dev_unref:
> -   drm_dev_unref(drm_dev);
> +err_drm_dev_put:
> +   drm_dev_put(drm_dev);
>
> return ret;
>  }
> @@ -215,7 +215,7 @@ static void kirin_drm_unbind(struct device *dev)
>
> drm_dev_unregister(drm_dev);
> kirin_drm_kms_cleanup(drm_dev);
> -   drm_dev_unref(drm_dev);
> +   drm_dev_put(drm_dev);
>  }
>
>  static const struct component_master_ops kirin_drm_ops = {
> --
> 2.18.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] drm/hisilicon: Replace ttm_bo_unref with ttm_bo_put

2018-09-25 Thread Xinliang Liu
Hi Thomas, sorry for too late to reply.

On Tue, 31 Jul 2018 at 14:33, Thomas Zimmermann  wrote:
>
> The function ttm_bo_put releases a reference to a TTM buffer object. The
> function's name is more aligned to the Linux kernel convention of naming
> ref-counting function _get and _put.
>
> A call to ttm_bo_unref takes the address of the TTM BO object's pointer and
> clears the pointer's value to NULL. This is not necessary in most cases and
> sometimes even worked around by the calling code. A call to ttm_bo_put only
> releases the reference without clearing the pointer.
>
> The current behaviour of cleaning the pointer is kept in the calling code,
> but should be removed if not required in a later patch.
>
> Signed-off-by: Thomas Zimmermann 
Reviewed-by: Xinliang Liu 
Applied to hisilicon-drm-next.

Thanks,
Xinliang

> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> index 4871025f7573..2e3e0bdb8932 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> @@ -283,7 +283,7 @@ static void hibmc_bo_unref(struct hibmc_bo **bo)
> return;
>
> tbo = &((*bo)->bo);
> -   ttm_bo_unref();
> +   ttm_bo_put(tbo);
> *bo = NULL;
>  }
>
> --
> 2.18.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 0/3] HiBMC driver fixes

2018-09-25 Thread Xinliang Liu
Thanks John, good addressing!
The root cause as you said, our hibmc previous frame buffer format
depth setting is wrong which does not pass the new format sanity
checking drm_mode_legacy_fb_format.
For this series,  Reviewed-by: Xinliang Liu 
Applied to hisilicon-drm-next.

Thanks,
Xinliang

On Sun, 23 Sep 2018 at 20:32, John Garry  wrote:
>
> This patchset fixes a couple of issues in probing the HiBMC driver, as
> follows:
> - fix the probe error path to not carry an error code in the pointer
> - don't use invalid legacy fb bpp/depth combination
>
> Another more trivial patch is for using the standard Huawei PCI vendor ID
> instead of hard-coding it.
>
> Tested on Huawei D05 board. I can see tux on BMC VGA console.
>
> John Garry (3):
>   drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer
> pointer
>   drm/hisilicon: hibmc: Don't overwrite fb helper surface depth
>   drm/hisilicon: hibmc: Use HUAWEI PCI vendor ID macro
>
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 2 +-
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> --
> 1.9.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


Re: [PATCH] gpu/drm/hisilicon: Convert drm_atomic_helper_suspend/resume()

2018-09-25 Thread Xinliang Liu
Hi Souptick,

On Mon, 17 Sep 2018 at 15:40, Souptick Joarder  wrote:
>
> On Tue, Sep 11, 2018 at 2:04 PM Souptick Joarder  wrote:
> >
> > On Mon, Aug 6, 2018 at 8:16 PM Souptick Joarder  
> > wrote:
> > >
> > > convert drm_atomic_helper_suspend/resume() to use
> > > drm_mode_config_helper_suspend/resume().
> > >
> > > Fixed one sparse warning by making hibmc_drm_interrupt
> > > static.
> > >
> > > Signed-off-by: Ajit Negi 
> > > Signed-off-by: Souptick Joarder 
> > > Reviewed-by: Xinliang Liu 
> >
> > Can we get this patch in queue for 4.20 ??
>
> Daniel, can we get this patch in queue for 4.20, if no further comment  ?

Will send 4.20 drm-next pull for this patch. I am verifying it on our D05 board.

Thanks,
Xinliang

>
> >
> > > ---
> > > v2: remove ret variable from both suspend and resume.
> > > remove suspend_state from hibmc_drm_private struct.
> > >
> > >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 20 +++-
> > >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  1 -
> > >  2 files changed, 3 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
> > > b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > index d4f6f1f..ee24480 100644
> > > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > @@ -37,7 +37,7 @@
> > > .llseek = no_llseek,
> > >  };
> > >
> > > -irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> > > +static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> > >  {
> > > struct drm_device *dev = (struct drm_device *)arg;
> > > struct hibmc_drm_private *priv =
> > > @@ -74,30 +74,16 @@ static int __maybe_unused hibmc_pm_suspend(struct 
> > > device *dev)
> > >  {
> > > struct pci_dev *pdev = to_pci_dev(dev);
> > > struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > > -   struct hibmc_drm_private *priv = drm_dev->dev_private;
> > > -
> > > -   drm_kms_helper_poll_disable(drm_dev);
> > > -   priv->suspend_state = drm_atomic_helper_suspend(drm_dev);
> > > -   if (IS_ERR(priv->suspend_state)) {
> > > -   DRM_ERROR("drm_atomic_helper_suspend failed: %ld\n",
> > > - PTR_ERR(priv->suspend_state));
> > > -   drm_kms_helper_poll_enable(drm_dev);
> > > -   return PTR_ERR(priv->suspend_state);
> > > -   }
> > >
> > > -   return 0;
> > > +   return drm_mode_config_helper_suspend(drm_dev);
> > >  }
> > >
> > >  static int  __maybe_unused hibmc_pm_resume(struct device *dev)
> > >  {
> > > struct pci_dev *pdev = to_pci_dev(dev);
> > > struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > > -   struct hibmc_drm_private *priv = drm_dev->dev_private;
> > >
> > > -   drm_atomic_helper_resume(drm_dev, priv->suspend_state);
> > > -   drm_kms_helper_poll_enable(drm_dev);
> > > -
> > > -   return 0;
> > > +   return drm_mode_config_helper_resume(drm_dev);
> > >  }
> > >
> > >  static const struct dev_pm_ops hibmc_pm_ops = {
> > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h 
> > > b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > index e195521..45c25a4 100644
> > > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > @@ -47,7 +47,6 @@ struct hibmc_drm_private {
> > > /* drm */
> > > struct drm_device  *dev;
> > > bool mode_config_initialized;
> > > -   struct drm_atomic_state *suspend_state;
> > >
> > > /* ttm */
> > > struct drm_global_reference mem_global_ref;
> > > --
> > > 1.9.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


Re: [Ask for help] ATI HD 7470 card on arm64 platform

2017-12-10 Thread Xinliang Liu
On 7 December 2017 at 19:11, Michel Dänzer <mic...@daenzer.net> wrote:
> On 2017-12-07 10:35 AM, Xinliang Liu wrote:
>> Hi,
>>
>> We are trying ATI HD 7470 card on arm64 platform D05 with kernel 4.1.40.
>> But it failed with kernel log:
>> radeon 0005:01:00: ring 0 stalled for more than 1msec
>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>> last fence id 0x0002 on ring0)
>> radeon 0005:01:00: ring 0 stalled for more than 10500msec
>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>> last fence id 0x0002 on ring0)
>> radeon 0005:01:00: ring 0 stalled for more than 11000msec
>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>> last fence id 0x0002 on ring0)
>> radeon 0005:01:00: ring 0 stalled for more than 11500msec
>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>> last fence id 0x0002 on ring0)
>> ...
>>
>> Any clue?
>
> Any chance you can try a newer kernel? Somebody else (also @huawei.com
> incidentally) reported just this week on the mesa-dev mailing list that
> the amdgpu driver in the Ubuntu 4.13 kernel is working on an arm64 platform.
>
> If a newer kernel still doesn't work on your platform, please provide
> the full dmesg output.

Hope we have change to try newer kernel.
After tracking the mainline we had found that this commit[1] fixed this issue.
The root cause is that on old kernel ttm can't succeed to set page
writecombine property which make cpu/gpu in fatal status and stub.

Anyway, we should use newer kernel and keep on testing.


[1] f135b97 drm/ttm: recognize ARM64 arch in ioprot handler
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.15-rc2=f135b978c2dab3d439eacb8353d3c0aac6af072a


>
>
> BTW, in the other thread it was reported that Mesa has bugs which can be
> worked around by compiling it with -fsigned-char.

Thanks for letting us know this. Had looked into the mesa bug.

Thanks,
Xinliang

>
>
> --
> Earthling Michel Dänzer   |   http://www.amd.com
> Libre software enthusiast | Mesa and X developer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Ask for help] ATI HD 7470 card on arm64 platform

2017-12-07 Thread Xinliang Liu
cc z.liuxinli...@hisilicon.com

On 7 December 2017 at 17:54, Xinliang Liu <xinliang@linaro.org> wrote:
> Thanks Christian,
>
> add tangyongqian in the loop.
>
> On 7 December 2017 at 17:40, Christian König <christian.koe...@amd.com> wrote:
>> Hi Xinliang,
>>
>> please provide the output of lspci and the content of /proc/iomem
>
> will privide these info asap.
>
>
>
>>
>> Thanks,
>> Christian.
>>
>>
>> Am 07.12.2017 um 10:35 schrieb Xinliang Liu:
>>>
>>> Hi,
>>>
>>> We are trying ATI HD 7470 card on arm64 platform D05 with kernel 4.1.40.
>>> But it failed with kernel log:
>>> radeon 0005:01:00: ring 0 stalled for more than 1msec
>>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>>> last fence id 0x0002 on ring0)
>>> radeon 0005:01:00: ring 0 stalled for more than 10500msec
>>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>>> last fence id 0x0002 on ring0)
>>> radeon 0005:01:00: ring 0 stalled for more than 11000msec
>>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>>> last fence id 0x0002 on ring0)
>>> radeon 0005:01:00: ring 0 stalled for more than 11500msec
>>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>>> last fence id 0x0002 on ring0)
>>> ...
>>>
>>> Any clue?
>>> Any required setting on BIOS IO mem bar video ram? It seems that our
>>> PCIE controller doesn't support cacheable feature for IO mem bar video
>>> ram.
>>>
>>>
>>> Best,
>>> Xinliang
>>
>>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Ask for help] ATI HD 7470 card on arm64 platform

2017-12-07 Thread Xinliang Liu
Thanks Christian,

add tangyongqian in the loop.

On 7 December 2017 at 17:40, Christian König <christian.koe...@amd.com> wrote:
> Hi Xinliang,
>
> please provide the output of lspci and the content of /proc/iomem

will privide these info asap.



>
> Thanks,
> Christian.
>
>
> Am 07.12.2017 um 10:35 schrieb Xinliang Liu:
>>
>> Hi,
>>
>> We are trying ATI HD 7470 card on arm64 platform D05 with kernel 4.1.40.
>> But it failed with kernel log:
>> radeon 0005:01:00: ring 0 stalled for more than 1msec
>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>> last fence id 0x0002 on ring0)
>> radeon 0005:01:00: ring 0 stalled for more than 10500msec
>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>> last fence id 0x0002 on ring0)
>> radeon 0005:01:00: ring 0 stalled for more than 11000msec
>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>> last fence id 0x0002 on ring0)
>> radeon 0005:01:00: ring 0 stalled for more than 11500msec
>> radeon 0005:01:00: GPU lockup (current fence id 0x0001
>> last fence id 0x0002 on ring0)
>> ...
>>
>> Any clue?
>> Any required setting on BIOS IO mem bar video ram? It seems that our
>> PCIE controller doesn't support cacheable feature for IO mem bar video
>> ram.
>>
>>
>> Best,
>> Xinliang
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Ask for help] ATI HD 7470 card on arm64 platform

2017-12-07 Thread Xinliang Liu
Hi,

We are trying ATI HD 7470 card on arm64 platform D05 with kernel 4.1.40.
But it failed with kernel log:
radeon 0005:01:00: ring 0 stalled for more than 1msec
radeon 0005:01:00: GPU lockup (current fence id 0x0001
last fence id 0x0002 on ring0)
radeon 0005:01:00: ring 0 stalled for more than 10500msec
radeon 0005:01:00: GPU lockup (current fence id 0x0001
last fence id 0x0002 on ring0)
radeon 0005:01:00: ring 0 stalled for more than 11000msec
radeon 0005:01:00: GPU lockup (current fence id 0x0001
last fence id 0x0002 on ring0)
radeon 0005:01:00: ring 0 stalled for more than 11500msec
radeon 0005:01:00: GPU lockup (current fence id 0x0001
last fence id 0x0002 on ring0)
...

Any clue?
Any required setting on BIOS IO mem bar video ram? It seems that our
PCIE controller doesn't support cacheable feature for IO mem bar video
ram.


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


[GIT PULL] drm-hisilicon-next

2017-10-31 Thread Xinliang Liu
Hi Dave,
One fix for next.

Best,
Xinliang

The following changes since commit 62884cd386b876638720ef88374b31a84ca7ee5f:

  drm: Add four ioctls for managing drm mode object leases [v7]
(2017-10-25 16:31:30 +1000)

are available in the git repository at:

  g...@github.com:xin3liang/linux.git tags/drm-hisilicon-next-2017-11-01

for you to fetch changes up to a2f042430784d86eb2b7a6d2a869f552da30edba:

  drm/hisilicon: Ensure LDI regs are properly configured. (2017-11-01
10:36:50 +0800)


For 4.15


Peter Griffin (1):
  drm/hisilicon: Ensure LDI regs are properly configured.

 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 03/10] drm/hisilicon/kirin: Use drm_gem_fb_create()

2017-09-27 Thread Xinliang Liu
On 24 September 2017 at 20:26, Noralf Trønnes <nor...@tronnes.org> wrote:
> drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
> so use the function directly.
>
> Cc: Xinliang Liu <z.liuxinli...@hisilicon.com>
> Cc: Rongrong Zou <zourongr...@gmail.com>
> Cc: Xinwei Kong <kong.kongxin...@hisilicon.com>
> Cc: Chen Feng <puck.c...@hisilicon.com>
> Signed-off-by: Noralf Trønnes <nor...@tronnes.org>

Thanks,
Reviewed-by: Xinliang Liu <z.liuxinli...@hisilicon.com>

Best,
Xinliang
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index e27352c..c19ab4f 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -22,6 +22,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -56,7 +57,7 @@ static void kirin_fbdev_output_poll_changed(struct 
> drm_device *dev)
>  }
>
>  static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = {
> -   .fb_create = drm_fb_cma_create,
> +   .fb_create = drm_gem_fb_create,
> .output_poll_changed = kirin_fbdev_output_poll_changed,
> .atomic_check = drm_atomic_helper_check,
> .atomic_commit = drm_atomic_helper_commit,
> --
> 2.7.4
>
> ___
> 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: [GIT PULL] drm-hisilicon-next

2017-08-29 Thread Xinliang Liu
On 29 August 2017 at 21:57, Daniel Vetter <dan...@ffwll.ch> wrote:
> On Tue, Aug 29, 2017 at 11:54 AM, Xinliang Liu <xinliang@linaro.org> 
> wrote:
>> Hi Dave,
>>
>> On 29 August 2017 at 16:32, Daniel Vetter <dan...@ffwll.ch> wrote:
>>> On Tue, Aug 29, 2017 at 10:46:33AM +0800, Xinliang Liu wrote:
>>>> Hi Dave,
>>>> One fix for next.
>>>> Sorry for late pull request. If it can't catch this round, will resend
>>>> on next round.
>>>
>>> drm-misc is always open for features, which makes this a lot simpler. Just
>>> in case you want to reconsider moving hisilicon into drm-misc :-)
>>
>> If  moving hisilicon into drm-misc make things simpler, I would like to do 
>> it.
>> Just clarify how to do this:
>> I just need to change the git tree to drm-misc? I see a lot of drm
>> drivers maintainers set the their git tree to
>> git://anongit.freedesktop.org/drm/drm-misc.
>> The means to be an drm-misc maintainer, right?
>> I wonder how new driver specific features/fixes patches go into drm-misc 
>> then?
>>  Do I need to send a pull request to  drm-misc tree. I don't think I
>> have a write permission to drm-misc tree.
>
> You'll need to become drm-misc committer, and patches are pushed
> directly using the scripts we have:
>
> https://01.org/linuxgraphics/gfx-docs/maintainer-tools/dim.html
>
> Here's the rules for how drm-misc works:
>
> https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
>
> drm-misc is essentially a service provided to take care of some of the
> maintainer chores, but review and patch merging still needs to be done
> by the individual driver owners (i.e. we won't take a new driver
> without a committer for it).

Thanks Daniel,
We are considering  switch to a stable maintainer for hisilicon.
After that we will move hisilicon to drm-misc.

Best,
Xinliang


>
> Cheers, Daniel
>
>>
>> Best,
>> Xinliang
>>
>>> -Daniel
>>>
>>>>
>>>>
>>>> Best,
>>>> Xinliang
>>>>
>>>>
>>>> The following changes since commit 
>>>> 7846b12fe0b5feab5446d892f41b5140c1419109:
>>>>
>>>>   Merge branch 'drm-vmwgfx-next' of
>>>> git://people.freedesktop.org/~syeh/repos_linux into drm-next
>>>> (2017-08-29 10:38:14 +1000)
>>>>
>>>> are available in the git repository at:
>>>>
>>>>
>>>>   g...@github.com:xin3liang/linux.git tags/drm-hisilicon-next-2017-08-29
>>>>
>>>> for you to fetch changes up to 834fe0f6023a4fad68612dbbe93866c4df32142e:
>>>>
>>>>   drm/hisilicon: Ensure LDI regs are properly configured. (2017-08-29
>>>> 10:17:18 +0800)
>>>>
>>>> 
>>>> hisilicon-drm-next
>>>>
>>>> 
>>>> Peter Griffin (1):
>>>>   drm/hisilicon: Ensure LDI regs are properly configured.
>>>>
>>>>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
>>>>  1 file changed, 3 insertions(+)
>>>> ___
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>>
>>> --
>>> Daniel Vetter
>>> Software Engineer, Intel Corporation
>>> http://blog.ffwll.ch
>
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [GIT PULL] drm-hisilicon-next

2017-08-29 Thread Xinliang Liu
Hi Dave,

On 29 August 2017 at 16:32, Daniel Vetter <dan...@ffwll.ch> wrote:
> On Tue, Aug 29, 2017 at 10:46:33AM +0800, Xinliang Liu wrote:
>> Hi Dave,
>> One fix for next.
>> Sorry for late pull request. If it can't catch this round, will resend
>> on next round.
>
> drm-misc is always open for features, which makes this a lot simpler. Just
> in case you want to reconsider moving hisilicon into drm-misc :-)

If  moving hisilicon into drm-misc make things simpler, I would like to do it.
Just clarify how to do this:
I just need to change the git tree to drm-misc? I see a lot of drm
drivers maintainers set the their git tree to
git://anongit.freedesktop.org/drm/drm-misc.
The means to be an drm-misc maintainer, right?
I wonder how new driver specific features/fixes patches go into drm-misc then?
 Do I need to send a pull request to  drm-misc tree. I don't think I
have a write permission to drm-misc tree.

Best,
Xinliang

> -Daniel
>
>>
>>
>> Best,
>> Xinliang
>>
>>
>> The following changes since commit 7846b12fe0b5feab5446d892f41b5140c1419109:
>>
>>   Merge branch 'drm-vmwgfx-next' of
>> git://people.freedesktop.org/~syeh/repos_linux into drm-next
>> (2017-08-29 10:38:14 +1000)
>>
>> are available in the git repository at:
>>
>>
>>   g...@github.com:xin3liang/linux.git tags/drm-hisilicon-next-2017-08-29
>>
>> for you to fetch changes up to 834fe0f6023a4fad68612dbbe93866c4df32142e:
>>
>>   drm/hisilicon: Ensure LDI regs are properly configured. (2017-08-29
>> 10:17:18 +0800)
>>
>> 
>> hisilicon-drm-next
>>
>> 
>> Peter Griffin (1):
>>   drm/hisilicon: Ensure LDI regs are properly configured.
>>
>>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> ___
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> 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


[GIT PULL] drm-hisilicon-next

2017-08-28 Thread Xinliang Liu
Hi Dave,
One fix for next.
Sorry for late pull request. If it can't catch this round, will resend
on next round.


Best,
Xinliang


The following changes since commit 7846b12fe0b5feab5446d892f41b5140c1419109:

  Merge branch 'drm-vmwgfx-next' of
git://people.freedesktop.org/~syeh/repos_linux into drm-next
(2017-08-29 10:38:14 +1000)

are available in the git repository at:


  g...@github.com:xin3liang/linux.git tags/drm-hisilicon-next-2017-08-29

for you to fetch changes up to 834fe0f6023a4fad68612dbbe93866c4df32142e:

  drm/hisilicon: Ensure LDI regs are properly configured. (2017-08-29
10:17:18 +0800)


hisilicon-drm-next


Peter Griffin (1):
  drm/hisilicon: Ensure LDI regs are properly configured.

 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RESEND PATCH] drm/hisilicon: Ensure LDI regs are properly configured.

2017-08-28 Thread Xinliang Liu
Hi Daniel,

On 28 August 2017 at 16:51, Daniel Vetter <dan...@ffwll.ch> wrote:
> On Mon, Aug 28, 2017 at 04:44:30PM +0800, Xinliang Liu wrote:
>> Hi,
>>
>> On 15 August 2017 at 22:14, Peter Griffin <peter.grif...@linaro.org> wrote:
>>
>> > This patch fixes the following soft lockup:
>> >   BUG: soft lockup - CPU#0 stuck for 23s! [weston:307]
>> >
>> > On weston idle-timeout the IP is powered down and reset
>> > asserted. On weston resume we get a massive vblank
>> > IRQ storm due to the LDI registers having lost some state.
>> >
>> > This state loss is caused by ade_crtc_atomic_begin() not
>> > calling ade_ldi_set_mode(). With this patch applied
>> > resuming from Weston idle-timeout works well.
>> >
>> > Signed-off-by: Peter Griffin <peter.grif...@linaro.org>
>> > Tested-by: John Stultz <john.stu...@linaro.org>
>> >
>>
>> Thanks Peter,
>> This patch looks good to me.
>> Reviewed-by: Xinliang Liu <xinliang@linaro.org>
>>
>> @Sean, could you please help to apply to drm-misc if others has no more
>> comments, thanks.
>
> hisilicon isn't maintained in drm-misc, and you're the maintainer. This is
> not how it works. So either
> a) pick up the patch and send out a pull request to Dave Airlie
> b) move hisilicon over to drm-misc and become a drm-misc maintainer
> yourself. This needs a MAINTAINERS update to point the git tree at
> drm-misc.
>
> drm-misc maintainers don't maintain everyone else's driver as a service,
> that simply doesn't scale.

Sorry for my misunderstanding and thanks for pointing out that how
drm-misc works.
So I will pick up the patch and send a pull request.

Thanks,
Xinliang

>
> Thanks, Daniel
>
>>
>> Thanks,
>> Xinliang
>>
>>
>> > Cc: sta...@vger.kernel.org
>> > ---
>> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
>> >  1 file changed, 3 insertions(+)
>> >
>> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > index c96c228..72c6357 100644
>> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > @@ -519,9 +519,12 @@ static void ade_crtc_atomic_begin(struct drm_crtc
>> > *crtc,
>> >  {
>> > struct ade_crtc *acrtc = to_ade_crtc(crtc);
>> > struct ade_hw_ctx *ctx = acrtc->ctx;
>> > +   struct drm_display_mode *mode = >state->mode;
>> > +   struct drm_display_mode *adj_mode = >state->adjusted_mode;
>> >
>> > if (!ctx->power_on)
>> > (void)ade_power_up(ctx);
>> > +   ade_ldi_set_mode(acrtc, mode, adj_mode);
>> >  }
>> >
>> >  static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
>> > --
>> > 2.7.4
>> >
>> > ___
>> > 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
>
>
> --
> 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: [RESEND PATCH] drm/hisilicon: Ensure LDI regs are properly configured.

2017-08-28 Thread Xinliang Liu
Hi,

On 15 August 2017 at 22:14, Peter Griffin <peter.grif...@linaro.org> wrote:

> This patch fixes the following soft lockup:
>   BUG: soft lockup - CPU#0 stuck for 23s! [weston:307]
>
> On weston idle-timeout the IP is powered down and reset
> asserted. On weston resume we get a massive vblank
> IRQ storm due to the LDI registers having lost some state.
>
> This state loss is caused by ade_crtc_atomic_begin() not
> calling ade_ldi_set_mode(). With this patch applied
> resuming from Weston idle-timeout works well.
>
> Signed-off-by: Peter Griffin <peter.grif...@linaro.org>
> Tested-by: John Stultz <john.stu...@linaro.org>
>

​​Thanks Peter,
This patch looks good to me.
Reviewed-by: Xinliang Liu <xinliang@linaro.org>​

@Sean, could you please help to apply to drm-misc if others has no more
comments, thanks.

Thanks,
Xinliang
​

> Cc: sta...@vger.kernel.org
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index c96c228..72c6357 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -519,9 +519,12 @@ static void ade_crtc_atomic_begin(struct drm_crtc
> *crtc,
>  {
> struct ade_crtc *acrtc = to_ade_crtc(crtc);
> struct ade_hw_ctx *ctx = acrtc->ctx;
> +   struct drm_display_mode *mode = >state->mode;
> +   struct drm_display_mode *adj_mode = >state->adjusted_mode;
>
> if (!ctx->power_on)
> (void)ade_power_up(ctx);
> +   ade_ldi_set_mode(acrtc, mode, adj_mode);
>  }
>
>  static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
> --
> 2.7.4
>
> ___
> 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] drm: kirin: Add mode_valid logic to avoid mode clocks we can't generate

2017-08-28 Thread Xinliang Liu
On 23 August 2017 at 02:42, John Stultz <john.stu...@linaro.org> wrote:

> Currently the hikey dsi logic cannot generate accurate byte
> clocks values for all pixel clock values. Thus if a mode clock
> is selected that cannot match the calculated byte clock, the
> device will boot with a blank screen.
>
> This patch uses the new mode_valid callback (many thanks to
> Jose Abreu for upstreaming it!) to ensure we don't select
> modes we cannot generate.
>
> Also, since the ade crtc code will adjust the mode in mode_set,
> this patch also adds a mode_fixup callback which we use to make
> sure we are validating the mode clock that will eventually be
> used.
>
> Cc: Daniel Vetter <daniel.vet...@intel.com>
> Cc: Jani Nikula <jani.nik...@linux.intel.com>
> Cc: Sean Paul <seanp...@chromium.org>
> Cc: David Airlie <airl...@linux.ie>
> Cc: Rob Clark <robdcl...@gmail.com>
> Cc: Xinliang Liu <xinliang@linaro.org>
> Cc: Xinliang Liu <z.liuxinli...@hisilicon.com>
> Cc: Rongrong Zou <zourongr...@gmail.com>
> Cc: Xinwei Kong <kong.kongxin...@hisilicon.com>
> Cc: Chen Feng <puck.c...@hisilicon.com>
> Cc: Jose Abreu <jose.ab...@synopsys.com>
> Cc: Archit Taneja <arch...@codeaurora.org>
> Cc: dri-devel@lists.freedesktop.org
> Reviewed-by: Sean Paul <seanp...@chromium.org>
>

​Thanks John,
This patch looks good to me.
Reviewed-by: Xinliang Liu <xinliang@linaro.org>​

Thanks,
Xinliang



> Signed-off-by: John Stultz <john.stu...@linaro.org>
> ---
> v2: Reworked to calculate if modeclock matches the phy's
> byteclock, rather then using a whitelist of known modes.
>
> v3: Reworked to check across all possible crtcs (even though for
> us there is only one), and use mode_fixup instead of a custom
> function, as suggested by Jose and Daniel.
>
> v4: Fixes and improved error handling as suggested by Jose.
>
> v5: Small typo fix noted by Sean
> ---
>  drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c| 67
> +
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 14 ++
>  2 files changed, 81 insertions(+)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
> b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
> index f77dcfa..b4c7af3 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
> @@ -603,6 +603,72 @@ static void dsi_encoder_enable(struct drm_encoder
> *encoder)
> dsi->enable = true;
>  }
>
> +static enum drm_mode_status dsi_encoder_phy_mode_valid(
> +   struct drm_encoder *encoder,
> +   const struct drm_display_mode
> *mode)
> +{
> +   struct dw_dsi *dsi = encoder_to_dsi(encoder);
> +   struct mipi_phy_params phy;
> +   u32 bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
> +   u32 req_kHz, act_kHz, lane_byte_clk_kHz;
> +
> +   /* Calculate the lane byte clk using the adjusted mode clk */
> +   memset(, 0, sizeof(phy));
> +   req_kHz = mode->clock * bpp / dsi->lanes;
> +   act_kHz = dsi_calc_phy_rate(req_kHz, );
> +   lane_byte_clk_kHz = act_kHz / 8;
> +
> +   DRM_DEBUG_DRIVER("Checking mode %ix%i-%i@%i clock: %i...",
> +   mode->hdisplay, mode->vdisplay, bpp,
> +   drm_mode_vrefresh(mode), mode->clock);
> +
> +   /*
> +* Make sure the adjusted mode clock and the lane byte clk
> +* have a common denominator base frequency
> +*/
> +   if (mode->clock/dsi->lanes == lane_byte_clk_kHz/3) {
> +   DRM_DEBUG_DRIVER("OK!\n");
> +   return MODE_OK;
> +   }
> +
> +   DRM_DEBUG_DRIVER("BAD!\n");
> +   return MODE_BAD;
> +}
> +
> +static enum drm_mode_status dsi_encoder_mode_valid(struct drm_encoder
> *encoder,
> +   const struct drm_display_mode
> *mode)
> +
> +{
> +   const struct drm_crtc_helper_funcs *crtc_funcs = NULL;
> +   struct drm_crtc *crtc = NULL;
> +   struct drm_display_mode adj_mode;
> +   enum drm_mode_status ret;
> +
> +   /*
> +* The crtc might adjust the mode, so go through the
> +* possible crtcs (technically just one) and call
> +* mode_fixup to figure out the adjusted mode before we
> +* validate it.
> +*/
> +   drm_for_each_crtc(crtc, encoder->dev) {
> +   /*
> +* reset adj_mode to the mode value each time,
> +* so we don't adjust the mode twice
> 

Re: [PATCH v3 10/23] drm: hibmc: use vblank hooks in struct drm_crtc_funcs

2017-02-15 Thread Xinliang Liu
On 7 February 2017 at 17:16, Shawn Guo <shawn...@kernel.org> wrote:
> From: Shawn Guo <shawn@linaro.org>
>
> The vblank hooks in struct drm_driver are deprecated and only meant for
> legacy drivers.  For modern drivers with DRIVER_MODESET flag, the hooks
> in struct drm_crtc_funcs should be used instead.
>
> Signed-off-by: Shawn Guo <shawn@linaro.org>
> Cc: Xinliang Liu <z.liuxinli...@hisilicon.com>

Thanks Shawn for the rework patches,
For the hibmc,
Reviewed-by: Xinliang Liu <xinliang@linaro.org>

Thanks,
-xinliang

> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 20 
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22 --
>  2 files changed, 20 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index c655883d3613..59542bddc980 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -423,6 +423,24 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc 
> *crtc,
> spin_unlock_irqrestore(>dev->event_lock, flags);
>  }
>
> +static int hibmc_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +   struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +   writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> +  priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +
> +   return 0;
> +}
> +
> +static void hibmc_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +   struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +   writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> +  priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +}
> +
>  static const struct drm_crtc_funcs hibmc_crtc_funcs = {
> .page_flip = drm_atomic_helper_page_flip,
> .set_config = drm_atomic_helper_set_config,
> @@ -430,6 +448,8 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
> .reset = drm_atomic_helper_crtc_reset,
> .atomic_duplicate_state =  drm_atomic_helper_crtc_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +   .enable_vblank = hibmc_crtc_enable_vblank,
> +   .disable_vblank = hibmc_crtc_disable_vblank,
>  };
>
>  static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 8cac70454b57..2ffdbf9801bd 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -37,26 +37,6 @@
> .llseek = no_llseek,
>  };
>
> -static int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -   struct hibmc_drm_private *priv =
> -   (struct hibmc_drm_private *)dev->dev_private;
> -
> -   writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> -  priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -
> -   return 0;
> -}
> -
> -static void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -   struct hibmc_drm_private *priv =
> -   (struct hibmc_drm_private *)dev->dev_private;
> -
> -   writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> -  priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -}
> -
>  irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  {
> struct drm_device *dev = (struct drm_device *)arg;
> @@ -84,8 +64,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> .desc   = "hibmc drm driver",
> .major  = 1,
> .minor  = 0,
> -   .enable_vblank  = hibmc_enable_vblank,
> -   .disable_vblank = hibmc_disable_vblank,
> .gem_free_object_unlocked = hibmc_gem_free_object,
> .dumb_create= hibmc_dumb_create,
> .dumb_map_offset= hibmc_dumb_mmap_offset,
> --
> 1.9.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


Re: [PATCH v3 11/23] drm: kirin: use vblank hooks in struct drm_crtc_funcs

2017-02-15 Thread Xinliang Liu
On 7 February 2017 at 17:16, Shawn Guo <shawn...@kernel.org> wrote:
> From: Shawn Guo <shawn@linaro.org>
>
> The vblank hooks in struct drm_driver are deprecated and only meant for
> legacy drivers.  For modern drivers with DRIVER_MODESET flag, the hooks
> in struct drm_crtc_funcs should be used instead.
>
> Signed-off-by: Shawn Guo <shawn@linaro.org>
> Cc: Xinliang Liu <z.liuxinli...@hisilicon.com>

Thanks Shawn for the rework patches,
For the kirin,
Reviewed-by: Xinliang Liu <xinliang@linaro.org>

Thanks,
-xinliang

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 0624fab8046f..c96c228a9898 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -302,9 +302,8 @@ static void ade_set_medianoc_qos(struct ade_crtc *acrtc)
>SOCKET_QOS_EN, SOCKET_QOS_EN);
>  }
>
> -static int ade_enable_vblank(struct drm_device *dev, unsigned int pipe)
> +static int ade_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> -   struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> struct ade_crtc *acrtc = to_ade_crtc(crtc);
> struct ade_hw_ctx *ctx = acrtc->ctx;
> void __iomem *base = ctx->base;
> @@ -318,9 +317,8 @@ static int ade_enable_vblank(struct drm_device *dev, 
> unsigned int pipe)
> return 0;
>  }
>
> -static void ade_disable_vblank(struct drm_device *dev, unsigned int pipe)
> +static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> -   struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> struct ade_crtc *acrtc = to_ade_crtc(crtc);
> struct ade_hw_ctx *ctx = acrtc->ctx;
> void __iomem *base = ctx->base;
> @@ -570,6 +568,8 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
> .set_property = drm_atomic_helper_crtc_set_property,
> .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> .atomic_destroy_state   = drm_atomic_helper_crtc_destroy_state,
> +   .enable_vblank  = ade_crtc_enable_vblank,
> +   .disable_vblank = ade_crtc_disable_vblank,
>  };
>
>  static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> @@ -1025,8 +1025,6 @@ static int ade_drm_init(struct platform_device *pdev)
>IRQF_SHARED, dev->driver->name, acrtc);
> if (ret)
> return ret;
> -   dev->driver->enable_vblank = ade_enable_vblank;
> -   dev->driver->disable_vblank = ade_disable_vblank;
>
> return 0;
>  }
> --
> 1.9.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 v7 0/7] Add DRM driver for Hisilicon Hibmc

2016-11-17 Thread Xinliang Liu
Hi Rongrong,

Thanks for your hard work.

For this whole series patches:
Reviewed-by: Xinliang Liu 

Thanks,
-xinliang

On 16 November 2016 at 21:43, Rongrong Zou  wrote:
> This patch set adds a new drm driver for Hisilicon Hibmc. Hibmc is a
> BMC SoC with a display controller intergrated, usually it is used on
> server for Out-of-band management purpose. In this patch set, we just
> support basic function for Hibmc display subsystem. Hibmc display
> subsystem is connected to host CPU by PCIe as blow:
>
> +--+   +--+
> |  | PCIe  |  Hibmc   |
> |host CPU( |<->| display  |
> |arm64,x86)|   |subsystem |
> +--+   +--+
>
> Hardware Detail for Hibmc display subsystem
> ---
>
>   The display subsystem of Hibmc is show as bellow:
>   ++  ++  ++ ++
>   ||  ||  || ||
>   | FB |->| DE |->|VDAC|>|external|
>   ||  ||  || | VGA|
>   ++  ++  ++ ++
>
>   -DE(Display Engine) is the display controller.
>   -VDAC(Video Digital-to-Analog converter) converts the RGB diaital data
>   stream from DE to VGA analog signals.
>
> Change History
> 
> Changes in v7:
>   -remove hibmc_drm_power.c/hibmc_drm_power.h, move the functions to
>hibmc_drm_drv.c.
>   -remove hibmc_drm_de.h and move the struct defined in head file to
>hibmc_drm_de.c.
>   -plane is initialized inside crtc, not in hibmc_kms_init().
>   -connector is initialized inside encoder, not in hibmc_kms_init().
>   -remove plane/crtc/encoder/connector from hibmc_drm_private struct.
>   -call drm_atomic_helper_suspend/resume in hibmc_pm_suspend/resume.
>   -remove these empty stubs because caller will do NULL check.
> hibmc_plane_atomic_disable
> hibmc_crtc_atomic_check
> hibmc_encoder_disable
> hibmc_encoder_enable
> hibmc_encoder_atomic_check
>   -clean up in all error paths of creating driver-private framebuffer.
>
> Changes in v6:
>   -remove the embedded framebuffer and use a pointer of hibmc_framebuffer
>instead.
>   -remove the deprecated drm_framebuffer_unregister_private(),
>drm_framebuffer_unreference() will be called in hibmc_fbdev_destroy().
>   -uninstall irq in hibmc_unload().
>
> Changes in v5:
>   -rebase on v4.9-rc2.
>   -replace drm_fb_helper_set_suspend with drm_fb_helper_set_suspend_unlocked.
>and remove redundant console_lock and console_unlock.
>
> Changes in v4:
>   -remove unused include files, and include header file when it is needed.
>   -remove unused FLAG in Kconfig: DRM_GEM_CMA_HELPER/DRM_KMS_CMA_HELPER.
>   -remove drm_helper_disable_unused_functions, since we use DRIVER_ATOMIC.
>
> Changes in v3:
>   -enable KMS, in v2, only fbdev is enabled.
>   -management video memory with ttm.
>   -add vblank interrupt.
>   -remove drm_connector_register_all() and drm_connector_unregister_all().
>   -I have a basic test with igt.
>
> Changes in v2:
>   -Remove self-defined macros for bit operations.
>   -Remove unused register.
>   -Replace those deprecated functions with new version of them.
>   -use drm_connector_register_all() to register connector after
>drm_dev_register().
>
> The patch v2 is at
> https://lists.freedesktop.org/archives/dri-devel/2016-May/108661.html
>
> Rongrong Zou (7):
>   drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
>   drm/hisilicon/hibmc: Add video memory management
>   drm/hisilicon/hibmc: Add support for frame buffer
>   drm/hisilicon/hibmc: Add support for display engine
>   drm/hisilicon/hibmc: Add support for VDAC
>   drm/hisilicon/hibmc: Add support for vblank interrupt
>   MAINTAINERS: Update HISILICON DRM entries
>
>  MAINTAINERS   |   1 +
>  drivers/gpu/drm/hisilicon/Kconfig |   1 +
>  drivers/gpu/drm/hisilicon/Makefile|   1 +
>  drivers/gpu/drm/hisilicon/hibmc/Kconfig   |   9 +
>  drivers/gpu/drm/hisilicon/hibmc/Makefile  |   4 +
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c| 477 ++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 456 ++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   | 114 +
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 267 +++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h  | 196 
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c  | 147 ++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c   | 558 
> ++
>  12 files changed, 2231 insertions(+)
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Kconfig
>  create mode 1

[PATCH v3 1/9] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver

2016-10-18 Thread Xinliang Liu
On 14 October 2016 at 22:33, Benjamin Gaignard
 wrote:
> Just by curiosity, why using "old" TTM instead of GEM ? any particular 
> reasons ?

>From the linux kernel DRM mm doc[1] it says:
"GEM has simpler initialization and execution requirements than
 25 TTM, but has no video RAM management capabilities and is thus
limited to
 26 UMA devices."

So, I think we can't use GEM to managing video RAM.
But in fact, in this driver fb buffer is also created as an GEM object
though it use TTM to manage video RAM.
So GEM ,like its name, say mostly use for execution management ???

[1] Documentation/gpu/drm-mm.rst

-xinliang

>
> 2016-10-14 16:44 GMT+02:00 Rongrong Zou :
>> Hi Benjamin,
>>
>> Thanks for reviewing!
>>
>> Benjamin Gaignard 於 2016/10/14 16:29 寫道:
>>>
>>> [snip]
>>>
 --- /dev/null
 +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
 @@ -0,0 +1,15 @@
 +config DRM_HISI_HIBMC
 +   tristate "DRM Support for Hisilicon Hibmc"
 +   depends on DRM && PCI
 +   select DRM_KMS_HELPER
 +   select DRM_KMS_FB_HELPER
 +   select DRM_GEM_CMA_HELPER
 +   select DRM_KMS_CMA_HELPER
>>>
>>>
>>> since you use TTM I don't think that selecting DRM_GEM_CMA_HELPER and
>>> DRM_KMS_CMA_HELPER
>>> help you lot here.
>>> You could add configuration flags step by step in following patches
>>> that will make you needs more clear (that also true for #include)
>>
>>
>> will delete them, thanks.
>>
>>
>>>
 +   select FB_SYS_FILLRECT
 +   select FB_SYS_COPYAREA
 +   select FB_SYS_IMAGEBLIT
 +   select DRM_TTM
 +
 +   help
 + Choose this option if you have a Hisilicon Hibmc soc chipset.
 + If M is selected the module will be called hibmc-drm.
 diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile
 b/drivers/gpu/drm/hisilicon/hibmc/Makefile
 new file mode 100644
 index 000..97cf4a0
 --- /dev/null
 +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
 @@ -0,0 +1,5 @@
 +ccflags-y := -Iinclude/drm
 +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o
 +
 +obj-$(CONFIG_DRM_HISI_HIBMC)   +=hibmc-drm.o
 +#obj-y += hibmc-drm.o
 diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
 b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
 new file mode 100644
 index 000..52c9353
 --- /dev/null
 +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
 @@ -0,0 +1,288 @@
 +/* Hisilicon Hibmc SoC drm driver
 + *
 + * Based on the bochs drm driver.
 + *
 + * Copyright (c) 2016 Huawei Limited.
 + *
 + * Author:
 + * Rongrong Zou 
>>>
>>>
>>> ".com" is missing in you email address (same typo in all other files)
>>
>>
>> will fix it in next version, thanks. :)
>>
>>>
 + * Rongrong Zou 
 + * Jianhua Li 
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + */
 +
 +#include 
 +#include 
 +#include 
 +#include 
 +#include 
 +#include 
 +#include 
>>>
>>>
>>> cma_helpers look useless since you use TTM, no ?
>>
>>
>> I add TTM just in this version, and forgot to clean these
>> cma relevant code, will fix in next version. Thanks.
>>
>>>
 +#include 
 +
 +#include "hibmc_drm_drv.h"
 +#include "hibmc_drm_regs.h"
 +#include "hibmc_drm_power.h"
 +
>>
>>
>> Regards,
>> Rongrong
>
>
>
> --
> Benjamin Gaignard
>
> Graphic Study Group
>
> Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro: Facebook | Twitter | Blog


[PATCH] drm/hisilicon: Don't set drm_device->platformdev

2016-09-01 Thread Xinliang Liu
Hi,

On 29 August 2016 at 15:49, Daniel Vetter  wrote:
> It's deprecated and only should be used by drivers which still use
> drm_platform_init, not by anyone else.
>
> And indeed it's entirely unused and can be nuked.
>
> This required a bit more fudging, but I guess kirin_dc_ops really
> wants to operate on the platform_device, not something else. Also
> bonus points for implementing abstraction, and then storing the vfunc
> in a global variable.
>
> v2: Don't break the build s badly :(
> Note that the cleanup function is a bit confused: ade_data was never
> set as drvdata, and calling drm_crtc_cleanup directly is a bug - this
> is called indirectly through drm_mode_config_cleanup, which calls into
> crtc->destroy, which already has the call to drm_crtc_cleanup. Which
> means we can just nuke it.
>
> Note this is the 2nd attempt after the first one failed and had to be
> reverted again in
>
> commit 9cd2e854d61ccfa51686f3ed7b0c917708fc641f
> Author: Daniel Vetter 
> Date:   Wed Aug 17 13:59:40 2016 +0200
>
>     Revert "drm/hisilicon: Don't set drm_device->platformdev"
>
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Cc: Archit Taneja 
> Cc: Sean Paul 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 +++
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  8 +++-
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |  4 ++--
>  3 files changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 7e7a4d43d6b6..26022122bcd1 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -974,9 +974,9 @@ static int ade_dts_parse(struct platform_device *pdev, 
> struct ade_hw_ctx *ctx)
> return 0;
>  }
>
> -static int ade_drm_init(struct drm_device *dev)
> +static int ade_drm_init(struct platform_device *pdev)
>  {
> -   struct platform_device *pdev = dev->platformdev;
> +   struct drm_device *dev = platform_get_drvdata(pdev);

if we can get the platformdev here, how about just get pdev here and
don't change the parameter of ade_drm_init :
-   struct platform_device *pdev = dev->platformdev;
+   struct platform_device *pdev = o_platform_device(dev->dev);


Best,
-xinliang


> struct ade_data *ade;
> struct ade_hw_ctx *ctx;
> struct ade_crtc *acrtc;
> @@ -1035,13 +1035,8 @@ static int ade_drm_init(struct drm_device *dev)
> return 0;
>  }
>
> -static void ade_drm_cleanup(struct drm_device *dev)
> +static void ade_drm_cleanup(struct platform_device *pdev)
>  {
> -   struct platform_device *pdev = dev->platformdev;
> -   struct ade_data *ade = platform_get_drvdata(pdev);
> -   struct drm_crtc *crtc = >acrtc.base;
> -
> -   drm_crtc_cleanup(crtc);
>  }
>
>  const struct kirin_dc_ops ade_dc_ops = {
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 1fc2f502d20d..b9b8c25da5e3 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -41,7 +41,7 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
>  #endif
> drm_kms_helper_poll_fini(dev);
> drm_vblank_cleanup(dev);
> -   dc_ops->cleanup(dev);
> +   dc_ops->cleanup(to_platform_device(dev->dev));
> drm_mode_config_cleanup(dev);
> devm_kfree(dev->dev, priv);
> dev->dev_private = NULL;
> @@ -103,7 +103,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
> kirin_drm_mode_config_init(dev);
>
> /* display controller init */
> -   ret = dc_ops->init(dev);
> +   ret = dc_ops->init(to_platform_device(dev->dev));
> if (ret)
> goto err_mode_config_cleanup;
>
> @@ -137,7 +137,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
>  err_unbind_all:
> component_unbind_all(dev->dev, dev);
>  err_dc_cleanup:
> -   dc_ops->cleanup(dev);
> +   dc_ops->cleanup(to_platform_device(dev->dev));
>  err_mode_config_cleanup:
> drm_mode_config_cleanup(dev);
> devm_kfree(dev->dev, priv);
> @@ -210,8 +210,6 @@ static int kirin_drm_bind(struct device *dev)
> if (!drm_dev)
> return -ENOMEM;
>
> -   drm_dev->platformdev = to_platform_device(dev);
> -
> ret = kirin_drm_kms_init(drm_dev);
> if (ret)
> goto err_drm_dev_unref;
> diff --git a/drivers/gpu/drm/hisilicon/ki

[PATCH 2/2] drm/hisilicon: Make it compile again

2016-09-01 Thread Xinliang Liu
Hi,

On 26 August 2016 at 10:28, Rob Clark  wrote:
> On Thu, Aug 25, 2016 at 9:48 PM, Xinliang Liu  
> wrote:
>> On 17 August 2016 at 19:11, Daniel Vetter  wrote:
>>> On Wed, Aug 17, 2016 at 07:02:01PM +0800, Xinliang Liu wrote:
>>>> Hi,
>>>>
>>>> On 17 August 2016 at 18:17, Daniel Vetter  
>>>> wrote:
>>>> > I just broke the build :(
>>>> >
>>>> > Note that the cleanup function is a bit confused: ade_data was never
>>>> > set as drvdata, and calling drm_crtc_cleanup directly is a bug - this
>>>>
>>>> Yes, this is a bug. Thanks for pointing out this.
>>>>
>>>> > is called indirectly through drm_mode_config_cleanup, which calls into
>>>> > crtc->destroy, which already has the call to drm_crtc_cleanup. Which
>>>> > means we can just nuke it.
>>>> >
>>>> > Aside: I have no idea why this driver depends upon ARM64. It doesn't
>>>> > build warning-free on 32bit, but otherwise it's perfectly fine.
>>>>
>>>> Because this driver is written for ARM64 SoCs.
>>>
>>> It makes compile-testing harder, the same reasons why depending upon
>>
>> What compile-testing we will have? I just try to understand the problem.
>
> it is useful for others who don't have the hw to be able to compile
> test core changes (hence kconfig COMPILE_TEST option) to at least
> catch the sorts of problems that compilers can catch..

Understand! Thanks Rob.

-xinliang

>
> BR,
> -R
>
>
>> Thanks,
>> -xinliang
>>
>>> specific arm platforms is really annoying (but lukily that problem seems
>>> to have stopped being one for the drm subsystem at least). Depending on
>>> CONFIG_OF and other stuff that's really needed is perfectly fine, but imo
>>> depending upon specific platforms and stuff really isn't.
>>> -Daniel
>>>
>>>>
>>>> Thanks,
>>>> -xinliang
>>>>
>>>> >
>>>> > Cc: Xinliang Liu 
>>>> > Cc: Xinwei Kong 
>>>> > Cc: Chen Feng 
>>>> > Cc: Sean Paul 
>>>> > Fixes: d25bcfb8c2e1 ("drm/hisilicon: Don't set drm_device->platformdev")
>>>> > Signed-off-by: Daniel Vetter 
>>>> > ---
>>>> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 9 ++---
>>>> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ++--
>>>> >  2 files changed, 4 insertions(+), 9 deletions(-)
>>>> >
>>>> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
>>>> > b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>>>> > index 91188f33b1d9..c64c82cb7e71 100644
>>>> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>>>> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>>>> > @@ -991,7 +991,7 @@ static int ade_dts_parse(struct platform_device 
>>>> > *pdev, struct ade_hw_ctx *ctx)
>>>> >
>>>> >  static int ade_drm_init(struct platform_device *pdev)
>>>> >  {
>>>> > -   struct drm_device *drm_dev = platform_get_drvdata(dev);
>>>> > +   struct drm_device *dev = platform_get_drvdata(pdev);
>>>> > struct ade_data *ade;
>>>> > struct ade_hw_ctx *ctx;
>>>> > struct ade_crtc *acrtc;
>>>> > @@ -1052,14 +1052,9 @@ static int ade_drm_init(struct platform_device 
>>>> > *pdev)
>>>> >
>>>> >  static void ade_drm_cleanup(struct platform_device *pdev)
>>>> >  {
>>>> > -   struct drm_device *drm_dev = platform_get_drvdata(dev);
>>>> > -   struct ade_data *ade = platform_get_drvdata(pdev);
>>>> > -   struct drm_crtc *crtc = >acrtc.base;
>>>> > -
>>>> > -   drm_crtc_cleanup(crtc);
>>>> >  }
>>>> >
>>>> >  const struct kirin_dc_ops ade_dc_ops = {
>>>> > .init = ade_drm_init,
>>>> > .cleanup = ade_drm_cleanup
>>>> > -;
>>>> > +};
>>>> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
>>>> > b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>>>> > index 6b0f9f6c16e1..b9b8c25da5e3 100644
>>>> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>>>> > +++ b/drivers/gpu/drm/hisilicon/kirin/ki

[PATCH 2/2] drm/hisilicon: Make it compile again

2016-08-26 Thread Xinliang Liu
On 17 August 2016 at 19:11, Daniel Vetter  wrote:
> On Wed, Aug 17, 2016 at 07:02:01PM +0800, Xinliang Liu wrote:
>> Hi,
>>
>> On 17 August 2016 at 18:17, Daniel Vetter  wrote:
>> > I just broke the build :(
>> >
>> > Note that the cleanup function is a bit confused: ade_data was never
>> > set as drvdata, and calling drm_crtc_cleanup directly is a bug - this
>>
>> Yes, this is a bug. Thanks for pointing out this.
>>
>> > is called indirectly through drm_mode_config_cleanup, which calls into
>> > crtc->destroy, which already has the call to drm_crtc_cleanup. Which
>> > means we can just nuke it.
>> >
>> > Aside: I have no idea why this driver depends upon ARM64. It doesn't
>> > build warning-free on 32bit, but otherwise it's perfectly fine.
>>
>> Because this driver is written for ARM64 SoCs.
>
> It makes compile-testing harder, the same reasons why depending upon

What compile-testing we will have? I just try to understand the problem.

Thanks,
-xinliang

> specific arm platforms is really annoying (but lukily that problem seems
> to have stopped being one for the drm subsystem at least). Depending on
> CONFIG_OF and other stuff that's really needed is perfectly fine, but imo
> depending upon specific platforms and stuff really isn't.
> -Daniel
>
>>
>> Thanks,
>> -xinliang
>>
>> >
>> > Cc: Xinliang Liu 
>> > Cc: Xinwei Kong 
>> > Cc: Chen Feng 
>> > Cc: Sean Paul 
>> > Fixes: d25bcfb8c2e1 ("drm/hisilicon: Don't set drm_device->platformdev")
>> > Signed-off-by: Daniel Vetter 
>> > ---
>> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 9 ++---
>> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ++--
>> >  2 files changed, 4 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
>> > b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > index 91188f33b1d9..c64c82cb7e71 100644
>> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > @@ -991,7 +991,7 @@ static int ade_dts_parse(struct platform_device *pdev, 
>> > struct ade_hw_ctx *ctx)
>> >
>> >  static int ade_drm_init(struct platform_device *pdev)
>> >  {
>> > -   struct drm_device *drm_dev = platform_get_drvdata(dev);
>> > +   struct drm_device *dev = platform_get_drvdata(pdev);
>> > struct ade_data *ade;
>> > struct ade_hw_ctx *ctx;
>> > struct ade_crtc *acrtc;
>> > @@ -1052,14 +1052,9 @@ static int ade_drm_init(struct platform_device 
>> > *pdev)
>> >
>> >  static void ade_drm_cleanup(struct platform_device *pdev)
>> >  {
>> > -   struct drm_device *drm_dev = platform_get_drvdata(dev);
>> > -   struct ade_data *ade = platform_get_drvdata(pdev);
>> > -   struct drm_crtc *crtc = >acrtc.base;
>> > -
>> > -   drm_crtc_cleanup(crtc);
>> >  }
>> >
>> >  const struct kirin_dc_ops ade_dc_ops = {
>> > .init = ade_drm_init,
>> > .cleanup = ade_drm_cleanup
>> > -;
>> > +};
>> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
>> > b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> > index 6b0f9f6c16e1..b9b8c25da5e3 100644
>> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> > @@ -103,7 +103,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
>> > kirin_drm_mode_config_init(dev);
>> >
>> > /* display controller init */
>> > -   ret = dc_ops->init(to_platform_device(dev));
>> > +   ret = dc_ops->init(to_platform_device(dev->dev));
>> > if (ret)
>> > goto err_mode_config_cleanup;
>> >
>> > @@ -137,7 +137,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
>> >  err_unbind_all:
>> > component_unbind_all(dev->dev, dev);
>> >  err_dc_cleanup:
>> > -   dc_ops->cleanup(dev);
>> > +   dc_ops->cleanup(to_platform_device(dev->dev));
>> >  err_mode_config_cleanup:
>> > drm_mode_config_cleanup(dev);
>> > devm_kfree(dev->dev, priv);
>> > --
>> > 2.8.1
>> >
>> > ___
>> > dri-devel mailing list
>> > dri-devel at lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


[PATCH 2/2] drm/hisilicon: Make it compile again

2016-08-17 Thread Xinliang Liu
Hi,

On 17 August 2016 at 18:17, Daniel Vetter  wrote:
> I just broke the build :(
>
> Note that the cleanup function is a bit confused: ade_data was never
> set as drvdata, and calling drm_crtc_cleanup directly is a bug - this

Yes, this is a bug. Thanks for pointing out this.

> is called indirectly through drm_mode_config_cleanup, which calls into
> crtc->destroy, which already has the call to drm_crtc_cleanup. Which
> means we can just nuke it.
>
> Aside: I have no idea why this driver depends upon ARM64. It doesn't
> build warning-free on 32bit, but otherwise it's perfectly fine.

Because this driver is written for ARM64 SoCs.

Thanks,
-xinliang

>
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Cc: Chen Feng 
> Cc: Sean Paul 
> Fixes: d25bcfb8c2e1 ("drm/hisilicon: Don't set drm_device->platformdev")
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 9 ++---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ++--
>  2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 91188f33b1d9..c64c82cb7e71 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -991,7 +991,7 @@ static int ade_dts_parse(struct platform_device *pdev, 
> struct ade_hw_ctx *ctx)
>
>  static int ade_drm_init(struct platform_device *pdev)
>  {
> -   struct drm_device *drm_dev = platform_get_drvdata(dev);
> +   struct drm_device *dev = platform_get_drvdata(pdev);
> struct ade_data *ade;
> struct ade_hw_ctx *ctx;
> struct ade_crtc *acrtc;
> @@ -1052,14 +1052,9 @@ static int ade_drm_init(struct platform_device *pdev)
>
>  static void ade_drm_cleanup(struct platform_device *pdev)
>  {
> -   struct drm_device *drm_dev = platform_get_drvdata(dev);
> -   struct ade_data *ade = platform_get_drvdata(pdev);
> -   struct drm_crtc *crtc = >acrtc.base;
> -
> -   drm_crtc_cleanup(crtc);
>  }
>
>  const struct kirin_dc_ops ade_dc_ops = {
> .init = ade_drm_init,
> .cleanup = ade_drm_cleanup
> -;
> +};
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 6b0f9f6c16e1..b9b8c25da5e3 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -103,7 +103,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
> kirin_drm_mode_config_init(dev);
>
> /* display controller init */
> -   ret = dc_ops->init(to_platform_device(dev));
> +   ret = dc_ops->init(to_platform_device(dev->dev));
> if (ret)
> goto err_mode_config_cleanup;
>
> @@ -137,7 +137,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
>  err_unbind_all:
> component_unbind_all(dev->dev, dev);
>  err_dc_cleanup:
> -   dc_ops->cleanup(dev);
> +   dc_ops->cleanup(to_platform_device(dev->dev));
>  err_mode_config_cleanup:
> drm_mode_config_cleanup(dev);
> devm_kfree(dev->dev, priv);
> --
> 2.8.1
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 07/21] drm/hisilicon: Don't set drm_device->platformdev

2016-08-17 Thread Xinliang Liu
On 13 August 2016 at 04:48, Daniel Vetter  wrote:
> It's deprecated and only should be used by drivers which still use
> drm_platform_init, not by anyone else.
>
> And indeed it's entirely unused and can be nuked.
>
> This required a bit more fudging, but I guess kirin_dc_ops really
> wants to operate on the platform_device, not something else. Also
> bonus points for implementing abstraction, and then storing the vfunc
> in a global variable.
>
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Cc: Archit Taneja 
> Reviewed-by: Sean Paul 
> Signed-off-by: Daniel Vetter 

Reviewed-by: Xinliang Liu 

Thanks,
-xinliang

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 +-
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  6 ++
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |  4 ++--
>  3 files changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index c3707d47cd89..34c22823e5c2 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -987,9 +987,9 @@ static int ade_dts_parse(struct platform_device *pdev, 
> struct ade_hw_ctx *ctx)
> return 0;
>  }
>
> -static int ade_drm_init(struct drm_device *dev)
> +static int ade_drm_init(struct platform_device *pdev)
>  {
> -   struct platform_device *pdev = dev->platformdev;
> +   struct drm_device *drm_dev = platform_get_drvdata(dev);
> struct ade_data *ade;
> struct ade_hw_ctx *ctx;
> struct ade_crtc *acrtc;
> @@ -1048,9 +1048,9 @@ static int ade_drm_init(struct drm_device *dev)
> return 0;
>  }
>
> -static void ade_drm_cleanup(struct drm_device *dev)
> +static void ade_drm_cleanup(struct platform_device *pdev)
>  {
> -   struct platform_device *pdev = dev->platformdev;
> +   struct drm_device *drm_dev = platform_get_drvdata(dev);
> struct ade_data *ade = platform_get_drvdata(pdev);
> struct drm_crtc *crtc = >acrtc.base;
>
> @@ -1060,4 +1060,4 @@ static void ade_drm_cleanup(struct drm_device *dev)
>  const struct kirin_dc_ops ade_dc_ops = {
> .init = ade_drm_init,
> .cleanup = ade_drm_cleanup
> -};
> +;
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 1edd9bc80294..a31016af9b61 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -41,7 +41,7 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
>  #endif
> drm_kms_helper_poll_fini(dev);
> drm_vblank_cleanup(dev);
> -   dc_ops->cleanup(dev);
> +   dc_ops->cleanup(to_platform_device(dev->dev));
> drm_mode_config_cleanup(dev);
> devm_kfree(dev->dev, priv);
> dev->dev_private = NULL;
> @@ -103,7 +103,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
> kirin_drm_mode_config_init(dev);
>
> /* display controller init */
> -   ret = dc_ops->init(dev);
> +   ret = dc_ops->init(to_platform_device(dev));
> if (ret)
> goto err_mode_config_cleanup;
>
> @@ -210,8 +210,6 @@ static int kirin_drm_bind(struct device *dev)
> if (!drm_dev)
> return -ENOMEM;
>
> -   drm_dev->platformdev = to_platform_device(dev);
> -
> ret = kirin_drm_kms_init(drm_dev);
> if (ret)
> goto err_drm_dev_unref;
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> index 1a07caf8e7f4..a0bb217c4c64 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> @@ -15,8 +15,8 @@
>
>  /* display controller init/cleanup ops */
>  struct kirin_dc_ops {
> -   int (*init)(struct drm_device *dev);
> -   void (*cleanup)(struct drm_device *dev);
> +   int (*init)(struct platform_device *pdev);
> +   void (*cleanup)(struct platform_device *pdev);
>  };
>
>  struct kirin_drm_private {
> --
> 2.8.1
>


[PATCH -next] drm/hisilicon: Fix error handling of ade_power_up()

2016-07-26 Thread Xinliang Liu
On 19 July 2016 at 19:30, Wei Yongjun  wrote:
> From: Wei Yongjun 
>
> Fix the reset_control_deassert() fail and clk_prepare_enable() fail
> error handling of ade_power_up().
>
> Signed-off-by: Wei Yongjun 

Applied, thanks.

-xinliang

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index c3707d4..e2bd1e6 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -258,18 +258,24 @@ static int ade_power_up(struct ade_hw_ctx *ctx)
> ret = reset_control_deassert(ctx->reset);
> if (ret) {
> DRM_ERROR("failed to deassert reset\n");
> -   return ret;
> +   goto err_reset;
> }
>
> ret = clk_prepare_enable(ctx->ade_core_clk);
> if (ret) {
> DRM_ERROR("failed to enable ade_core_clk (%d)\n", ret);
> -   return ret;
> +   goto err_prepare_enable;
> }
>
> ade_init(ctx);
> ctx->power_on = true;
> return 0;
> +
> +err_prepare_enable:
> +   reset_control_assert(ctx->reset);
> +err_reset:
> +   clk_disable_unprepare(ctx->media_noc_clk);
> +   return ret;
>  }
>
>  static void ade_power_down(struct ade_hw_ctx *ctx)
>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH -next] drm/hisilicon: Fix return value check in ade_dts_parse()

2016-07-18 Thread Xinliang Liu
On 13 July 2016 at 20:43,   wrote:
> From: Wei Yongjun 
>
> In case of error, the function devm_clk_get() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun 

Hi, thanks. This patch had already applied to drm-hisilicon-next.

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 805f432..c3707d4 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -967,21 +967,21 @@ static int ade_dts_parse(struct platform_device *pdev, 
> struct ade_hw_ctx *ctx)
> }
>
> ctx->ade_core_clk = devm_clk_get(dev, "clk_ade_core");
> -   if (!ctx->ade_core_clk) {
> +   if (IS_ERR(ctx->ade_core_clk)) {
> DRM_ERROR("failed to parse clk ADE_CORE\n");
> -   return -ENODEV;
> +   return PTR_ERR(ctx->ade_core_clk);
> }
>
> ctx->media_noc_clk = devm_clk_get(dev, "clk_codec_jpeg");
> -   if (!ctx->media_noc_clk) {
> +   if (IS_ERR(ctx->media_noc_clk)) {
> DRM_ERROR("failed to parse clk CODEC_JPEG\n");
> -   return -ENODEV;
> +   return PTR_ERR(ctx->media_noc_clk);
> }
>
> ctx->ade_pix_clk = devm_clk_get(dev, "clk_ade_pix");
> -   if (!ctx->ade_pix_clk) {
> +   if (IS_ERR(ctx->ade_pix_clk)) {
> DRM_ERROR("failed to parse clk ADE_PIX\n");
> -   return -ENODEV;
> +   return PTR_ERR(ctx->ade_pix_clk);
> }
>
> return 0;
>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH -next] drm/hisilicon: Remove redundant dev_err call in ade_dts_parse()

2016-07-18 Thread Xinliang Liu
Hi, thanks. This patch had already applied to drm-hisilicon-next.


On 13 July 2016 at 20:44,   wrote:
> From: Wei Yongjun 
>
> There is a error message within devm_ioremap_resource
> already, so remove the dev_err call to avoid redundant
> error message.
>
> Signed-off-by: Wei Yongjun 
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 805f432..3aea3bb 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -944,10 +944,8 @@ static int ade_dts_parse(struct platform_device *pdev, 
> struct ade_hw_ctx *ctx)
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> ctx->base = devm_ioremap_resource(dev, res);
> -   if (IS_ERR(ctx->base)) {
> -   DRM_ERROR("failed to remap ade io base\n");
> +   if (IS_ERR(ctx->base))
> return  PTR_ERR(ctx->base);
> -   }
>
> ctx->reset = devm_reset_control_get(dev, NULL);
> if (IS_ERR(ctx->reset))
>
>
>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH -next] drm/hisilicon: Fix non static symbol warning

2016-07-18 Thread Xinliang Liu
On 13 July 2016 at 20:43,   wrote:
> From: Wei Yongjun 
>
> Fixes the following sparse warning:
>
> drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:107:5: warning:
>  symbol 'ade_get_channel_formats' was not declared. Should it be static?
>
> Signed-off-by: Wei Yongjun 

Thanks, applied to drm-hisilicon-next.

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 805f432..2a913cc 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -104,7 +104,7 @@ static const u32 channel_formats1[] = {
> DRM_FORMAT_ABGR
>  };
>
> -u32 ade_get_channel_formats(u8 ch, const u32 **formats)
> +static u32 ade_get_channel_formats(u8 ch, const u32 **formats)
>  {
> switch (ch) {
> case ADE_CH1:
>
>
>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[GIT PULL] drm-hisilicon-next

2016-07-04 Thread Xinliang Liu
Hi Dave,

This drm-hisilicon-next-2016-07-04 tag includes 3 small fixes for 4.8.
Please help to pull and let me know if there is any problem.

Thanks,
-xinliang



The following changes since commit dac2c48ca5ac9bb2d6339aaa733c60d5b801ee86:

  Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu
into drm-next (2016-07-02 16:21:35 +1000)

are available in the git repository at:

  git at github.com:xin3liang/linux.git tags/drm-hisilicon-next-2016-07-04

for you to fetch changes up to 85d8747d2a24e913fffac68024b2154db266c50c:

  drm/hisilicon: Fix ADE vblank on/off handling (2016-07-04 18:49:21 +0800)


Wei Yongjun (1):
  drm/hisilicon: Fix return value check in ade_dts_parse()

Xinliang Liu (1):
  drm/hisilicon: Fix ADE vblank on/off handling

Zoltan Kuscsik (1):
  drm/hisilicon: add select HISI_KIRIN_DW_DSI

 drivers/gpu/drm/hisilicon/kirin/Kconfig |  1 +
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 14 --
 2 files changed, 9 insertions(+), 6 deletions(-)



[PATCH v8 02/10] drm/hisilicon: Add hisilicon kirin drm master driver

2016-06-30 Thread Xinliang Liu
On 13 April 2016 at 20:15, Emil Velikov  wrote:
> Hi Xinliang,
>
> On 11 April 2016 at 09:55, Xinliang Liu  wrote:
>
>> +static int kirin_drm_connectors_register(struct drm_device *dev)
>> +{
>> +   struct drm_connector *connector;
>> +   struct drm_connector *failed_connector;
>> +   int ret;
>> +
>> +   mutex_lock(>mode_config.mutex);
>> +   drm_for_each_connector(connector, dev) {
>> +   ret = drm_connector_register(connector);
>> +   if (ret) {
>> +   failed_connector = connector;
>> +   goto err;
>> +   }
>> +   }
>> +   mutex_unlock(>mode_config.mutex);
>> +
>> +   return 0;
>> +
>> +err:
>> +   drm_for_each_connector(connector, dev) {
>> +   if (failed_connector == connector)
>> +   break;
>> +   drm_connector_unregister(connector);
>> +   }
>> +   mutex_unlock(>mode_config.mutex);
>> +
>> +   return ret;
>> +}
>> +
> Iirc we have new drm_connector_{un,}register_all() helpers.You might
> want to use it once they are in (i.e. not sure what your base is and
> if they have landed yet).
>
>
>> +static struct device_node *kirin_get_remote_node(struct device_node *np)
>> +{
>> +   struct device_node *endpoint, *remote;
>> +
>> +   /* get the first endpoint, in our case only one remote node
>> +* is connected to display controller.
>> +*/
>> +   endpoint = of_graph_get_next_endpoint(np, NULL);
>> +   if (!endpoint) {
>> +   DRM_ERROR("no valid endpoint node\n");
>> +   return ERR_PTR(-ENODEV);
>> +   }
>> +   of_node_put(endpoint);
>> +
>> +   remote = of_graph_get_remote_port_parent(endpoint);
>> +   if (!remote) {
>> +   DRM_ERROR("no valid remote node\n");
>> +   return ERR_PTR(-ENODEV);
>> +   }
>> +   of_node_put(remote);
>> +
>> +   if (!of_device_is_available(remote)) {
>> +   DRM_ERROR("not available for remote node\n");
>> +   return ERR_PTR(-ENODEV);
>> +   }
>> +
> This seems like a common pattern in many platform DRM drivers. Yet
> some tend to differ in subtle ways - I'm leaning that they might be
> bugs, but one cannot be too sure.
>
> A friendly request:
> Can you please follow up by adding a helper and removing the
> duplication thoughout ?

Hi emil, recently I found that there is already a helper to do such work.
It is drm_of_component_probe.

-xinliang


>
> Thanks
> Emil


[PATCH] drm/hisilicon: Fix ADE vblank on/off handling

2016-06-30 Thread Xinliang Liu
Vblank turn on should be called in crtc's enable callback.
And turn off called in crtc's disable callback.

Thanks to Daniel Vetter, this bug is reported by him.

Reported-by: Daniel Vetter 
Signed-off-by: Xinliang Liu 
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index ed76baad525f..805f4326fafe 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -487,6 +487,7 @@ static void ade_crtc_enable(struct drm_crtc *crtc)
ade_set_medianoc_qos(acrtc);
ade_display_enable(acrtc);
ade_dump_regs(ctx->base);
+   drm_crtc_vblank_on(crtc);
acrtc->enable = true;
 }

@@ -498,6 +499,7 @@ static void ade_crtc_disable(struct drm_crtc *crtc)
if (!acrtc->enable)
return;

+   drm_crtc_vblank_off(crtc);
ade_power_down(ctx);
acrtc->enable = false;
 }
-- 
2.8.3



[PATCH] arm64: dts: Add HDMI node for hi6220-hikey

2016-06-30 Thread Xinliang Liu
Add adv7533 HDMI DT node for HiKey board.

And this patch depends on the hikey display dts patch[1]
and adv7533 support patch[2].

[1] https://patchwork.kernel.org/patch/9189287/
[2] http://www.spinics.net/lists/linux-arm-msm/msg21305.html

Signed-off-by: Xinliang Liu 
---
 arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 33 ++
 1 file changed, 33 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts 
b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
index 90e77380f073..03c4a702b0eb 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
+++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
@@ -236,4 +236,37 @@

  {
status = "ok";
+
+   ports {
+   /* 1 for output port */
+   port at 1 {
+   reg = <1>;
+
+   dsi_out0: endpoint at 0 {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+};
+
+ {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "ok";
+
+   adv7533: adv7533 at 39 {
+   compatible = "adi,adv7533";
+   reg = <0x39>;
+   interrupt-parent = <>;
+   interrupts = <1 2>;
+   pd-gpio = < 4 0>;
+   adi,dsi-lanes = <4>;
+   adi,disable-timing-generator;
+
+   port {
+   adv7533_in: endpoint {
+   remote-endpoint = <_out0>;
+   };
+   };
+   };
 };
-- 
2.8.3



[PATCH] drm/hisilicon: add select HISI_KIRIN_DW_DSI

2016-06-29 Thread Xinliang Liu
Hi,

On 22 June 2016 at 20:59, Thierry Reding  wrote:
> On Wed, Jun 22, 2016 at 08:54:02AM +0800, Guodong Xu wrote:
>> On 21 June 2016 at 21:34, Thierry Reding  wrote:
>> > On Mon, Jun 20, 2016 at 11:59:03AM +0800, Xinliang Liu wrote:
>> >> From: Guodong Xu 
>> >>
>> >> Add select HISI_KIRIN_DW_DSI to Kconfig.
>> >> The DRM driver depends on dsi sub-driver.
>> >>
>> >> Signed-off-by: Zoltan Kuscsik 
>> >> ---
>> >>  drivers/gpu/drm/hisilicon/kirin/Kconfig | 1 +
>> >>  1 file changed, 1 insertion(+)
>> >
>> > You've got the Signed-off-by area messed up. If Guodong wrote this patch
>>
>> Hi, Xinliang,
>>
>> To clarify this, you don't need my Signed-off. Zoltan is the author,
>> and I am just the person who ever integrated that patch into my local
>> tree.
>
> If Zoltan is the author, then his name should be in the From: line
> above. As it is, git am will apply this with you as author. Also, see
> section 11) in Documentation/SubmittingPatches on why you need to add
> your S-o-b as well.

Thierry, that's right. I will resent the patch in the author of zoltan
and adding my s-o-b.

Thanks,
-xinliang

>
> Thierry


[PATCH 19/38] drm/hisilicon: Implement some semblance of vblank event handling

2016-06-22 Thread Xinliang Liu
On 21 June 2016 at 15:19, Daniel Vetter  wrote:
> On Tue, Jun 21, 2016 at 3:32 AM, Xinliang Liu  
> wrote:
>> My understanding is that drm_crtc_arm_vblank_event work together with
>> drm_crtc_handle_vblank (called in vblank interrupt).
>> Arm the event first in somewhere(like atomic_begin/flush) and then
>> send it out throuth drm_crtc_handle_vblank in vblank interrupt.
>> In the other way, drm_crtc_send_vblank_event work together with flip
>> interrupt. That's means event will be sent in flip interrupt
>> immediately.
>> Is this right?
>
> First part is right. Second part about drm_crtc_send_vblank event just
> sends out the vblank directly (using the last recorded vblank). The
> vblank subsystem doesn't itself interact with any interrupt.
>
> Note that there's kerneldoc for all of this. Please make sure it does
> describe things sufficiently well, and if not please send in patches
> to improve them.

Ok, I will take a look at the doc.

Thanks,
-xinliang

> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH] drm/hisilicon: add select HISI_KIRIN_DW_DSI

2016-06-22 Thread Xinliang Liu
From: Guodong Xu <guodong...@linaro.org>

Add select HISI_KIRIN_DW_DSI to Kconfig.
The DRM driver depends on dsi sub-driver.

v2: Add myself Signed-off-by, becuase others give me the right to
forward the patch.

Signed-off-by: Zoltan Kuscsik 
Signed-off-by: Xinliang Liu 
---
 drivers/gpu/drm/hisilicon/kirin/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/Kconfig 
b/drivers/gpu/drm/hisilicon/kirin/Kconfig
index ea0df6115f7e..499f64405dac 100644
--- a/drivers/gpu/drm/hisilicon/kirin/Kconfig
+++ b/drivers/gpu/drm/hisilicon/kirin/Kconfig
@@ -4,6 +4,7 @@ config DRM_HISI_KIRIN
select DRM_KMS_HELPER
select DRM_GEM_CMA_HELPER
select DRM_KMS_CMA_HELPER
+   select HISI_KIRIN_DW_DSI
help
  Choose this option if you have a hisilicon Kirin chipsets(hi6220).
  If M is selected the module will be called kirin-drm.
-- 
2.8.3



[PATCH] drm/hisilicon: add select HISI_KIRIN_DW_DSI

2016-06-22 Thread Xinliang Liu
On 22 June 2016 at 08:54, Guodong Xu  wrote:
> On 21 June 2016 at 21:34, Thierry Reding  wrote:
>> On Mon, Jun 20, 2016 at 11:59:03AM +0800, Xinliang Liu wrote:
>>> From: Guodong Xu 
>>>
>>> Add select HISI_KIRIN_DW_DSI to Kconfig.
>>> The DRM driver depends on dsi sub-driver.
>>>
>>> Signed-off-by: Zoltan Kuscsik 
>>> ---
>>>  drivers/gpu/drm/hisilicon/kirin/Kconfig | 1 +
>>>  1 file changed, 1 insertion(+)
>>
>> You've got the Signed-off-by area messed up. If Guodong wrote this patch
>
> Hi, Xinliang,
>
> To clarify this, you don't need my Signed-off. Zoltan is the author,
> and I am just the person who ever integrated that patch into my local
> tree.

OK, Guodong.
Thanks,
-xinliang

>
> -Guodong
>
>> that his Signed-off-by needs to be added. Your Signed-off by should also
>> be added because you forwarded the patch to the mailing list.
>>
>> Thierry


[PATCH] drm/hisilicon: add select HISI_KIRIN_DW_DSI

2016-06-22 Thread Xinliang Liu
Hi,

On 21 June 2016 at 21:34, Thierry Reding  wrote:
> On Mon, Jun 20, 2016 at 11:59:03AM +0800, Xinliang Liu wrote:
>> From: Guodong Xu 
>>
>> Add select HISI_KIRIN_DW_DSI to Kconfig.
>> The DRM driver depends on dsi sub-driver.
>>
>> Signed-off-by: Zoltan Kuscsik 
>> ---
>>  drivers/gpu/drm/hisilicon/kirin/Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>
> You've got the Signed-off-by area messed up. If Guodong wrote this patch
> that his Signed-off-by needs to be added. Your Signed-off by should also
> be added because you forwarded the patch to the mailing list.

Thierry, yes, you are right. I should add a Signed-off-by in the patch.

Thanks,
-xinliang

>
> Thierry


[PATCH] arm64: dts: Add display subsystem DT nodes for hi6220-hikey

2016-06-21 Thread Xinliang Liu
Add ade and dsi DT nodes for hikey board.

The binding docs were acked by Rob Herring in this thread:
https://lists.freedesktop.org/archives/dri-devel/2016-March/102135.html

Signed-off-by: Xinliang Liu 
---
 arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |  8 
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi  | 54 ++
 2 files changed, 62 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts 
b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
index e92a30c87a82..90e77380f073 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
+++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
@@ -229,3 +229,11 @@
  {
label = "LS-UART1";
 };
+
+ {
+   status = "ok";
+};
+
+ {
+   status = "ok";
+};
diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 0fb84814ded2..c53c9db94248 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -269,6 +269,11 @@
mboxes = < 1 0 11>;
};

+   medianoc_ade: medianoc_ade at f452 {
+   compatible = "syscon";
+   reg = <0x0 0xf452 0x0 0x4000>;
+   };
+
uart0: uart at f8015000 {   /* console */
compatible = "arm,pl011", "arm,primecell";
reg = <0x0 0xf8015000 0x0 0x1000>;
@@ -833,5 +838,54 @@
};
};
};
+
+   ade: ade at f410 {
+   compatible = "hisilicon,hi6220-ade";
+   reg = <0x0 0xf410 0x0 0x7800>;
+   reg-names = "ade_base";
+   hisilicon,noc-syscon = <_ade>;
+   resets = <_ctrl MEDIA_ADE>;
+   interrupts = <0 115 4>; /* ldi interrupt */
+
+   clocks = <_ctrl HI6220_ADE_CORE>,
+<_ctrl HI6220_CODEC_JPEG>,
+<_ctrl HI6220_ADE_PIX_SRC>;
+   /*clock name*/
+   clock-names  = "clk_ade_core",
+  "clk_codec_jpeg",
+  "clk_ade_pix";
+
+   assigned-clocks = <_ctrl HI6220_ADE_CORE>,
+   <_ctrl HI6220_CODEC_JPEG>;
+   assigned-clock-rates = <36000>, <28800>;
+   status = "disabled";
+
+   port {
+   ade_out: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+
+   dsi: dsi at f4107800 {
+   compatible = "hisilicon,hi6220-dsi";
+   reg = <0x0 0xf4107800 0x0 0x100>;
+   clocks = <_ctrl  HI6220_DSI_PCLK>;
+   clock-names = "pclk";
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* 0 for input port */
+   port at 0 {
+   reg = <0>;
+   dsi_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+   };
};
 };
-- 
2.8.3



[PATCH 19/38] drm/hisilicon: Implement some semblance of vblank event handling

2016-06-21 Thread Xinliang Liu
On 17 June 2016 at 20:24, Daniel Vetter  wrote:
> On Fri, Jun 17, 2016 at 04:38:06PM +0800, Xinliang Liu wrote:
>> Hi,
>>
>> On 17 June 2016 at 15:23, Daniel Vetter  wrote:
>> > On Fri, Jun 17, 2016 at 10:09:50AM +0800, Xinliang Liu wrote:
>> >> Hi Daniel,
>> >>
>> >> I have tested your David's drm-next branch[1] which including this patch.
>> >> In most time it is ok. But when switching modes or disable/re-enable
>> >> mode, it will encounter bellow error msg:
>> >> --
>> >> [  357.940728] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
>> >> [CRTC:24:crtc-0] flip_done timed out
>> >> [  368.004962] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
>> >> [CRTC:24:crtc-0] flip_done timed out
>> >> [  396.064871] INFO: rcu_preempt detected stalls on CPUs/tasks:
>> >> [  396.070548]  0-...: (3 GPs behind) idle=f4f/1/0 softirq=4253/4253 
>> >> fqs=19
>> >> [  396.077335]  7-...: (1 GPs behind) idle=71f/140/0
>> >> softirq=2444/2451 fqs=19
>> >> [  396.085332]  (detected by 1, t=6028 jiffies, g=3924, c=3923, q=246)
>> >> [  396.091600] Task dump for CPU 0:
>> >> [  396.094821] swapper/0   R  running task0 0  0 
>> >> 0x0002
>> >> [  396.101872] Call trace:
>> >> [  396.104323] [] __switch_to+0xa4/0xd4
>> >> [  396.109460] [] __boot_cpu_mode+0x0/0x80
>> >> [  396.114852] Task dump for CPU 7:
>> >> [  396.118072] XorgR  running task0  1658   1646 
>> >> 0x0002
>> >> [  396.125121] Call trace:
>> >> [  396.127562] [] __switch_to+0xc8/0xd4
>> >> [  396.132695] [] 0x800035567110
>> >> [  396.137569] rcu_preempt kthread starved for 1000 jiffies! g3924
>> >> c3923 f0x0 RCU_GP_WAIT_FQS(3) ->state=0x1
>> >> [  396.147130] rcu_preempt S 08085c10 0 7  2 
>> >> 0x
>> >> [  396.154180] Call trace:
>> >> [  396.156620] [] __switch_to+0xc8/0xd4
>> >> [  396.161758] [] __schedule+0x188/0x590
>> >> [  396.166978] [] schedule+0x3c/0xa0
>> >> [  396.171851] [] schedule_timeout+0x104/0x1a4
>> >> [  396.177595] [] rcu_gp_kthread+0x54c/0x814
>> >> [  396.183164] [] kthread+0xd4/0xe8
>> >> [  396.187951] [] ret_from_fork+0x10/0x40
>> >> --
>> >>
>> >> Then the console stuck. Any tips for addressing this issue?
>> >> I am running a debian system.
>> >>
>> >> [1] git://people.freedesktop.org/~airlied/linux drm-next
>> >
>> > hisilicon doesn't handle crtc_state->event correctly. Most likely when
>> > shutting down a CRTC if fails to send out that flip event, which means the
>> > waiting for flip_done times out. My patch tried to fix that (it's not
>> > correct, but it did work on other drivers).
>> >
>> > From a quick look what's wrong with hisilicon vblank handling:
>> > - You don't call drm_crtc_vblank_on/off, which means the core thinks
>> >   vblanks will keep working even when the CRTC is off. That throws off the
>> >   hack in my patch. You need to put a call to drm_crtc_vblank_off into
>> >   crtc->disable hook, and drm_crtc_vblank_on into crtc->enable.
>>
>> Yes, this is really a problem. I will add drm_crtc_vblank_on/off into
>>  crtc->disable/enable hook.
>> And try.
>>
>> >
>> > - While at it please review that the event sending is placed correctly and
>> >   can't race with the new buffers showing up on the screen. The event
>> >   should be signalled at exactly the time the buffers start to get scanned
>> >   out. The important bit is to make sure that even if something races or
>> >   gets delayed that it still happens together.
>>
>> Our display controller has a interrupt to indicate that  one
>> commit/flip is taken effect in hardware.
>> Should I put the sending event in this interrupt handler?
>
> Yes, that would be perfect. So instead of the drm_crtc_arm_vblank_event
> you put the event into a driver-private slot where the irq handler can
> pick it up and send it out using drm_crtc_send_vblank_event.
>
> Two important details:
> - You need to arm the event this way before the hw can fire this special
>   interrupt, so probably somewhere in atomic_begin.
> - the drm_crtc_send_vblank_event must be called after
>   drm_crtc_handle_vblank, because otherwise the vblank timestamp isn't
>   properly u

[PATCH] drm/hisilicon: add select HISI_KIRIN_DW_DSI

2016-06-20 Thread Xinliang Liu
From: Guodong Xu 

Add select HISI_KIRIN_DW_DSI to Kconfig.
The DRM driver depends on dsi sub-driver.

Signed-off-by: Zoltan Kuscsik 
---
 drivers/gpu/drm/hisilicon/kirin/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/Kconfig 
b/drivers/gpu/drm/hisilicon/kirin/Kconfig
index ea0df6115f7e..499f64405dac 100644
--- a/drivers/gpu/drm/hisilicon/kirin/Kconfig
+++ b/drivers/gpu/drm/hisilicon/kirin/Kconfig
@@ -4,6 +4,7 @@ config DRM_HISI_KIRIN
select DRM_KMS_HELPER
select DRM_GEM_CMA_HELPER
select DRM_KMS_CMA_HELPER
+   select HISI_KIRIN_DW_DSI
help
  Choose this option if you have a hisilicon Kirin chipsets(hi6220).
  If M is selected the module will be called kirin-drm.
-- 
2.8.3



[PATCH 4/7] drm/hisilicon: Remove redundant calls to drm_connector_register_all()

2016-06-20 Thread Xinliang Liu
Hi,

On 17 June 2016 at 16:25, Chris Wilson  wrote:
> Up to now, the recommendation was for drivers to call drm_dev_register()
> followed by drm_connector_register_all(). Now that
> drm_connector_register() is safe against multiple invocations, we can
> move drm_connector_register_all() to drm_dev_register() and not suffer
> from any backwards compatibility issues with drivers not following the
> more rigorous init ordering.
>
> Signed-off-by: Chris Wilson 
> Cc: Daniel Vetter 
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Cc: Chen Feng 
> Cc: David Airlie 
> Cc: dri-devel at lists.freedesktop.org

This patch looks fine to me. Thank you for your patch.

Acked-by: Xinliang Liu 

Thanks,
-xinliang

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 
>  1 file changed, 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 193657259ee9..ef2c32ec1616 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -221,19 +221,12 @@ static int kirin_drm_bind(struct device *dev)
> if (ret)
> goto err_kms_cleanup;
>
> -   /* connectors should be registered after drm device register */
> -   ret = drm_connector_register_all(drm_dev);
> -   if (ret)
> -   goto err_drm_dev_unregister;
> -
> DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
>  driver->name, driver->major, driver->minor, 
> driver->patchlevel,
>  driver->date, drm_dev->primary->index);
>
> return 0;
>
> -err_drm_dev_unregister:
> -   drm_dev_unregister(drm_dev);
>  err_kms_cleanup:
> kirin_drm_kms_cleanup(drm_dev);
>  err_drm_dev_unref:
> @@ -246,7 +239,6 @@ static void kirin_drm_unbind(struct device *dev)
>  {
> struct drm_device *drm_dev = dev_get_drvdata(dev);
>
> -   drm_connector_unregister_all(drm_dev);
> drm_dev_unregister(drm_dev);
> kirin_drm_kms_cleanup(drm_dev);
> drm_dev_unref(drm_dev);
> --
> 2.8.1
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH -next] drm/hisilicon: Fix return value check in ade_dts_parse()

2016-06-20 Thread Xinliang Liu
Hi,

On 18 June 2016 at 02:29,   wrote:
> From: Wei Yongjun 
>
> In case of error, the function devm_clk_get() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun 

Applied to drm-hisilicon-next. Thanks.

-xinliang

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index ed76baad..16834f4 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -965,21 +965,21 @@ static int ade_dts_parse(struct platform_device *pdev, 
> struct ade_hw_ctx *ctx)
> }
>
> ctx->ade_core_clk = devm_clk_get(dev, "clk_ade_core");
> -   if (!ctx->ade_core_clk) {
> +   if (IS_ERR(ctx->ade_core_clk)) {
> DRM_ERROR("failed to parse clk ADE_CORE\n");
> -   return -ENODEV;
> +   return PTR_ERR(ctx->ade_core_clk);
> }
>
> ctx->media_noc_clk = devm_clk_get(dev, "clk_codec_jpeg");
> -   if (!ctx->media_noc_clk) {
> +   if (IS_ERR(ctx->media_noc_clk)) {
> DRM_ERROR("failed to parse clk CODEC_JPEG\n");
> -   return -ENODEV;
> +   return PTR_ERR(ctx->media_noc_clk);
> }
>
> ctx->ade_pix_clk = devm_clk_get(dev, "clk_ade_pix");
> -   if (!ctx->ade_pix_clk) {
> +   if (IS_ERR(ctx->ade_pix_clk)) {
> DRM_ERROR("failed to parse clk ADE_PIX\n");
> -   return -ENODEV;
> +   return PTR_ERR(ctx->ade_pix_clk);
> }
>
> return 0;
>
>
>
>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 19/38] drm/hisilicon: Implement some semblance of vblank event handling

2016-06-17 Thread Xinliang Liu
Hi,

On 17 June 2016 at 15:23, Daniel Vetter  wrote:
> On Fri, Jun 17, 2016 at 10:09:50AM +0800, Xinliang Liu wrote:
>> Hi Daniel,
>>
>> I have tested your David's drm-next branch[1] which including this patch.
>> In most time it is ok. But when switching modes or disable/re-enable
>> mode, it will encounter bellow error msg:
>> --
>> [  357.940728] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
>> [CRTC:24:crtc-0] flip_done timed out
>> [  368.004962] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
>> [CRTC:24:crtc-0] flip_done timed out
>> [  396.064871] INFO: rcu_preempt detected stalls on CPUs/tasks:
>> [  396.070548]  0-...: (3 GPs behind) idle=f4f/1/0 softirq=4253/4253 fqs=19
>> [  396.077335]  7-...: (1 GPs behind) idle=71f/140/0
>> softirq=2444/2451 fqs=19
>> [  396.085332]  (detected by 1, t=6028 jiffies, g=3924, c=3923, q=246)
>> [  396.091600] Task dump for CPU 0:
>> [  396.094821] swapper/0   R  running task0 0  0 
>> 0x0002
>> [  396.101872] Call trace:
>> [  396.104323] [] __switch_to+0xa4/0xd4
>> [  396.109460] [] __boot_cpu_mode+0x0/0x80
>> [  396.114852] Task dump for CPU 7:
>> [  396.118072] XorgR  running task0  1658   1646 
>> 0x0002
>> [  396.125121] Call trace:
>> [  396.127562] [] __switch_to+0xc8/0xd4
>> [  396.132695] [] 0x800035567110
>> [  396.137569] rcu_preempt kthread starved for 1000 jiffies! g3924
>> c3923 f0x0 RCU_GP_WAIT_FQS(3) ->state=0x1
>> [  396.147130] rcu_preempt S 08085c10 0 7  2 
>> 0x
>> [  396.154180] Call trace:
>> [  396.156620] [] __switch_to+0xc8/0xd4
>> [  396.161758] [] __schedule+0x188/0x590
>> [  396.166978] [] schedule+0x3c/0xa0
>> [  396.171851] [] schedule_timeout+0x104/0x1a4
>> [  396.177595] [] rcu_gp_kthread+0x54c/0x814
>> [  396.183164] [] kthread+0xd4/0xe8
>> [  396.187951] [] ret_from_fork+0x10/0x40
>> --
>>
>> Then the console stuck. Any tips for addressing this issue?
>> I am running a debian system.
>>
>> [1] git://people.freedesktop.org/~airlied/linux drm-next
>
> hisilicon doesn't handle crtc_state->event correctly. Most likely when
> shutting down a CRTC if fails to send out that flip event, which means the
> waiting for flip_done times out. My patch tried to fix that (it's not
> correct, but it did work on other drivers).
>
> From a quick look what's wrong with hisilicon vblank handling:
> - You don't call drm_crtc_vblank_on/off, which means the core thinks
>   vblanks will keep working even when the CRTC is off. That throws off the
>   hack in my patch. You need to put a call to drm_crtc_vblank_off into
>   crtc->disable hook, and drm_crtc_vblank_on into crtc->enable.

Yes, this is really a problem. I will add drm_crtc_vblank_on/off into
 crtc->disable/enable hook.
And try.

>
> - While at it please review that the event sending is placed correctly and
>   can't race with the new buffers showing up on the screen. The event
>   should be signalled at exactly the time the buffers start to get scanned
>   out. The important bit is to make sure that even if something races or
>   gets delayed that it still happens together.

Our display controller has a interrupt to indicate that  one
commit/flip is taken effect in hardware.
Should I put the sending event in this interrupt handler?

Thanks,
-xinliang

>
> Cheers, Daniel
>>
>> Thanks,
>> -xinliang
>>
>> On 2 June 2016 at 06:06, Daniel Vetter  wrote:
>> > atomic_flush seems to be the right place, but I'm not entirely sure
>> > whether this will catch them all. It could be that when disabling the
>> > crtc we'll miss the vblank.
>> >
>> > While at it nuke the dummy functions.
>> >
>> > v2: Be more robust and either arm, when the CRTC is on, or just send
>> > the event out right away.
>> >
>> > Cc: Xinliang Liu 
>> > Cc: Xinwei Kong 
>> > Cc: Archit Taneja 
>> > Signed-off-by: Daniel Vetter 
>>
>> Acked-by: Xinliang Liu 
>>
>> > ---
>> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 20 
>> >  1 file changed, 12 insertions(+), 8 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
>> > b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > index fba6372d060e..ed76baad525f 100644
>> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> > @@ -502,13 +502,6 @@ static void ade_crtc_dis

[PATCH 19/38] drm/hisilicon: Implement some semblance of vblank event handling

2016-06-17 Thread Xinliang Liu
Hi Daniel,

I have tested your David's drm-next branch[1] which including this patch.
In most time it is ok. But when switching modes or disable/re-enable
mode, it will encounter bellow error msg:
--
[  357.940728] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
[CRTC:24:crtc-0] flip_done timed out
[  368.004962] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
[CRTC:24:crtc-0] flip_done timed out
[  396.064871] INFO: rcu_preempt detected stalls on CPUs/tasks:
[  396.070548]  0-...: (3 GPs behind) idle=f4f/1/0 softirq=4253/4253 fqs=19
[  396.077335]  7-...: (1 GPs behind) idle=71f/140/0
softirq=2444/2451 fqs=19
[  396.085332]  (detected by 1, t=6028 jiffies, g=3924, c=3923, q=246)
[  396.091600] Task dump for CPU 0:
[  396.094821] swapper/0   R  running task0 0  0 0x0002
[  396.101872] Call trace:
[  396.104323] [] __switch_to+0xa4/0xd4
[  396.109460] [] __boot_cpu_mode+0x0/0x80
[  396.114852] Task dump for CPU 7:
[  396.118072] XorgR  running task0  1658   1646 0x0002
[  396.125121] Call trace:
[  396.127562] [] __switch_to+0xc8/0xd4
[  396.132695] [] 0x800035567110
[  396.137569] rcu_preempt kthread starved for 1000 jiffies! g3924
c3923 f0x0 RCU_GP_WAIT_FQS(3) ->state=0x1
[  396.147130] rcu_preempt S 08085c10 0 7  2 0x
[  396.154180] Call trace:
[  396.156620] [] __switch_to+0xc8/0xd4
[  396.161758] [] __schedule+0x188/0x590
[  396.166978] [] schedule+0x3c/0xa0
[  396.171851] [] schedule_timeout+0x104/0x1a4
[  396.177595] [] rcu_gp_kthread+0x54c/0x814
[  396.183164] [] kthread+0xd4/0xe8
[  396.187951] [] ret_from_fork+0x10/0x40
--

Then the console stuck. Any tips for addressing this issue?
I am running a debian system.

[1] git://people.freedesktop.org/~airlied/linux drm-next

Thanks,
-xinliang

On 2 June 2016 at 06:06, Daniel Vetter  wrote:
> atomic_flush seems to be the right place, but I'm not entirely sure
> whether this will catch them all. It could be that when disabling the
> crtc we'll miss the vblank.
>
> While at it nuke the dummy functions.
>
> v2: Be more robust and either arm, when the CRTC is on, or just send
> the event out right away.
>
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Cc: Archit Taneja 
> Signed-off-by: Daniel Vetter 

Acked-by: Xinliang Liu 

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 20 
>  1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index fba6372d060e..ed76baad525f 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -502,13 +502,6 @@ static void ade_crtc_disable(struct drm_crtc *crtc)
> acrtc->enable = false;
>  }
>
> -static int ade_crtc_atomic_check(struct drm_crtc *crtc,
> -struct drm_crtc_state *state)
> -{
> -   /* do nothing */
> -   return 0;
> -}
> -
>  static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  {
> struct ade_crtc *acrtc = to_ade_crtc(crtc);
> @@ -537,6 +530,7 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
>  {
> struct ade_crtc *acrtc = to_ade_crtc(crtc);
> struct ade_hw_ctx *ctx = acrtc->ctx;
> +   struct drm_pending_vblank_event *event = crtc->state->event;
> void __iomem *base = ctx->base;
>
> /* only crtc is enabled regs take effect */
> @@ -545,12 +539,22 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
> /* flush ade registers */
> writel(ADE_ENABLE, base + ADE_EN);
> }
> +
> +   if (event) {
> +   crtc->state->event = NULL;
> +
> +   spin_lock_irq(>dev->event_lock);
> +   if (drm_crtc_vblank_get(crtc) == 0)
> +   drm_crtc_arm_vblank_event(crtc, event);
> +   else
> +   drm_crtc_send_vblank_event(crtc, event);
> +   spin_unlock_irq(>dev->event_lock);
> +   }
>  }
>
>  static const struct drm_crtc_helper_funcs ade_crtc_helper_funcs = {
> .enable = ade_crtc_enable,
> .disable= ade_crtc_disable,
> -   .atomic_check   = ade_crtc_atomic_check,
> .mode_set_nofb  = ade_crtc_mode_set_nofb,
> .atomic_begin   = ade_crtc_atomic_begin,
> .atomic_flush   = ade_crtc_atomic_flush,
> --
> 2.8.1
>


[PATCH 26/27] drm/hisilicon: Use lockless gem BO free callback

2016-06-12 Thread Xinliang Liu
Hi,

On 31 May 2016 at 01:53, Daniel Vetter  wrote:
> No dev->struct_mutex anywhere to be seen.
>
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Signed-off-by: Daniel Vetter 

Reviewed-by: Xinliang Liu 

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 3f94785fbcca..193657259ee9 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -173,7 +173,7 @@ static struct drm_driver kirin_drm_driver = {
> .fops   = _drm_fops,
> .set_busid  = drm_platform_set_busid,
>
> -   .gem_free_object= drm_gem_cma_free_object,
> +   .gem_free_object_unlocked = drm_gem_cma_free_object,
> .gem_vm_ops = _gem_cma_vm_ops,
> .dumb_create= kirin_gem_cma_dumb_create,
> .dumb_map_offset= drm_gem_cma_dumb_map_offset,
> --
> 2.8.1
>


[PATCH 26/27] drm/hisilicon: Use lockless gem BO free callback

2016-05-31 Thread Xinliang Liu
Hi, thanks for your patch.

On 31 May 2016 at 01:53, Daniel Vetter  wrote:
> No dev->struct_mutex anywhere to be seen.
>
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 3f94785fbcca..193657259ee9 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -173,7 +173,7 @@ static struct drm_driver kirin_drm_driver = {
> .fops   = _drm_fops,
> .set_busid  = drm_platform_set_busid,
>
> -   .gem_free_object= drm_gem_cma_free_object,
> +   .gem_free_object_unlocked = drm_gem_cma_free_object,

This patch looks good to me apply to drm-hisilicon-next.
Thanks,
-xinliang

> .gem_vm_ops = _gem_cma_vm_ops,
> .dumb_create= kirin_gem_cma_dumb_create,
> .dumb_map_offset= drm_gem_cma_dumb_map_offset,
> --
> 2.8.1
>


[path v2 0/7] Add DRM driver for Hisilicon Hibmc

2016-05-30 Thread Xinliang Liu
Hi Rongrong,

It seems that you haven't run the checkpatch script.
Please run this script to check your patches before you send them. Like bellow:
$ cd yourkerneldir
$ ./scripts/checkpatch.pl --strict yourpatches

Thanks,
-xinliang

On 29 May 2016 at 17:40, Rongrong Zou  wrote:
> This patch set adds a new drm driver for Hisilicon Hibmc. Hibmc is a
> base board management controller, usually it is used on server for
> Out-of-band management purpose. In this patch set, we just support basic
> function for Hibmc display subsystem. Hibmc display subsystem is connected
> to host CPU by PCIe as blow:
>
> +--+   +--+
> |  | PCIe  |  Hibmc   |
> |host CPU( |<->| display  |
> |arm64,x86)|   |subsystem |
> +--+   +--+
>
> Hardware Detail for Hibmc display subsystem
> ---
>
>   The display subsystem of Hibmc is show as bellow:
>   ++  ++  ++ ++
>   ||  ||  || ||
>   | FB |->| DE |->|VDAC|>|external|
>   ||  ||  || | VGA|
>   ++  ++  ++ ++
>
>   -DE(Display Engine) is the display controller.
>   -VDAC(Video Digital-to-Analog converter) converts the RGB diaital data
>   stream from DE to VGA analog signals.
>
> Change History
> 
>
> Changes in v2:
>   -Remove self-defined macros for bit operations.
>   -Remove unused register.
>   -Replace those deprecated functions with new version of them.
>   -use drm_connector_register_all() to register connector after
>drm_dev_register().
>
> The patch v1 is at
> https://lists.freedesktop.org/archives/dri-devel/2016-February/101921.html
> Sorry for too late sending.
>
>
> Rongrong Zou (7):
>   idrm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
>   drm/hisilicon/hibmc: Add plane for DE
>   drm/hisilicon/hibmc: Add crtc for DE
>   drm/hisilicon/hibmc: Add encoder for VDAC
>   drm/hisilicon/hibmc: Add connector for VDAC
>   drm/hisilicon/hibmc: Add support for frame buffer
>   drm/hisilicon/hibmc: Add maintainer for Hibmc DRM
>
>  MAINTAINERS   |   7 +
>  drivers/gpu/drm/hisilicon/Kconfig |   1 +
>  drivers/gpu/drm/hisilicon/Makefile|   3 +-
>  drivers/gpu/drm/hisilicon/hibmc/Kconfig   |  13 +
>  drivers/gpu/drm/hisilicon/hibmc/Makefile  |   4 +
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c| 477 
> ++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.h|  29 ++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 399 ++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |  64 +++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 286 +
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.c |  91 +
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.h |  28 ++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h  | 214 ++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c  | 174 
>  14 files changed, 1789 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Kconfig
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Makefile
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.h
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.c
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.h
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>
> --
> 1.9.1
>


[path v2 7/7] drm/hisilicon/hibmc: Add maintainer for Hibmc DRM

2016-05-30 Thread Xinliang Liu
On 29 May 2016 at 17:40, Rongrong Zou  wrote:
> Signed-off-by: Rongrong Zou 
> Signed-off-by: Jianhua Li 
> ---
>  MAINTAINERS | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f466673..a8a62e0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3957,6 +3957,13 @@ T:   git git://github.com/patjak/drm-gma500
>  S: Maintained
>  F: drivers/gpu/drm/gma500/
>
> +DRM DRIVERS FOR HIBMC
> +M: lijianhua 
> +M: Rongrong Zou 
> +L: dri-devel at lists.freedesktop.org
> +S: Maintained
> +F: drivers/gpu/drm/hisilicon/hibmc

Please add a "/" ad the end of this line.
And move this part into DRM DRIVERS FOR HISILICON

Thanks,
-xinliang

> +
>  DRM DRIVERS FOR HISILICON
>  M: Xinliang Liu 
>  R: Xinwei Kong 
> --
> 1.9.1
>


[PATCH v3 7/7] dt-bindings: drm/bridge: Update bindings for ADV7533

2016-05-17 Thread Xinliang Liu
On 17 May 2016 at 11:43, Archit Taneja  wrote:
>
>
> On 05/16/2016 05:31 PM, Laurent Pinchart wrote:
>>
>> Hi Archit,
>>
>> On Friday 22 Apr 2016 11:10:18 Archit Taneja wrote:
>>>
>>> On 04/22/2016 04:02 AM, Laurent Pinchart wrote:

 On Wednesday 09 Mar 2016 16:27:18 Archit Taneja wrote:
>
> Add description of ADV7533. Add the required and optional properties
> that
> are specific to it.
>
> Cc: devicetree at vger.kernel.org
> Cc: Rob Herring 
>
> Signed-off-by: Archit Taneja 
> ---
>
> .../bindings/display/bridge/adi,adv7511.txt| 25
> -
> 1 file changed, 20 insertions(+), 5 deletions(-)
>
> diff --git
> a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
> b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
> index
> 96c25ee..420da5a 100644
> --- a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
> +++ b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
>>
>>
>> [snip]
>>
> +- adi,disable-timing-generator: Only for ADV7533. Disables the
> internal
> timing
> +  generator. The chip will rely on the sync signals in the DSI data
> lanes,
> +  rather than generate its own timings for HDMI output.


 Isn't that something that should be selectable at runtime ?
>>>
>>>
>>> The timing generator can be enabled/disabled at runtime. Although, we
>>> don't have a way to tell the driver whether we want to keep it enabled
>>> or not.
>>>
>>> It's a hardware feature that works well on most platforms, but not on
>>> all. In particular, it works well on DB410c, but causes issues with
>>> the Hikey 96 board. The DSI host on Hikey has different clock sources
>>> that generate the display controller's pixel clock and DSI byte clock,
>>> whereas the Qualcomm SoC uses the same source. My guess is that the
>>> ADV7533's timing generator doesn't like it when the pixel data and
>>> clock are out of phase or something.
>>>
>>> Since it is a hardware feature which needs tweaking, I thought it
>>> qualified as a DT property.
>>
>>
>> The fact that a hardware generator is present is certainly describes the
>> hardware, but I'm not sure whether to enable it or not also qualifies as a
>> hardware feature.
>>
>> Are there use cases for using the timing generator conditionally on a
>> given
>> board ? As you implement support for disabling it, I assume it's not
>> mandatory. What feature(s) do we lose if we keep it disabled ?
>>
>
> The spec says it's recommended to use the internal timing generator. In
> the case of db410c, I observe an unstable output/flicker for certain
> modes if I don't enable it.
>
> In the case of hikey platform, it's the other way round.
>
> Xinliang, could you describe the problems you face when the timing
> generator is enabled?

Yes,  opening the timing generator of ADV7533 can benefit the HDMI
output signal.
But, for some circumstances, we need to disable timing generator:
To make modes work, the timing parameters (hfp, hbp, etc.) used by
ADV7533 timing generator should match the ones used in DSI.
If the timing parameters changed in DSI and these changing  timing
parameters can't pass to ADV7533, then it need to disable the timing
generator of ADV7533 to make mode work.
Some modes in HiKey is in this case.

Thanks,
-xinliang

>
>
> Thanks,
> Archit
>
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> hosted by The Linux Foundation


[GIT PULL 2nd] drm-hisilicon-next for 4.7

2016-05-11 Thread Xinliang Liu
Hi Dave,

This 2nd pull request includes 3 cleanup/fixes since last pull request for 4.7.

These patches are review here:
http://www.spinics.net/lists/dri-devel/msg106701.html
http://www.spinics.net/lists/dri-devel/msg106822.html

Please kindly let me know if there is any problem.

Best,
-xinliang

The following changes since commit 2e726dc4b4e2dd3ae3fe675f9d3af88a2d593ee1:

  Merge tag 'mediatek-drm-2016-05-09' of
git://git.pengutronix.de/git/pza/linux into drm-next (2016-05-10
15:01:47 +1000)

are available in the git repository at:

  git at github.com:xin3liang/linux.git drm-hisilicon-next

for you to fetch changes up to 1658437704d9f41eae2946774bdf2966245f:

  drm/hisilicon: Fix DRM_INFO printed issue (2016-05-11 19:05:36 +0800)


Daniel Vetter (1):
  drm/hisilicon: Use drm_connector_register_all

Xinliang Liu (2):
  drm/hisilicon: Make kirin_drm_unbind sufficient
  drm/hisilicon: Fix DRM_INFO printed issue

 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c|  3 ++-
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 38
+++---
 2 files changed, 9 insertions(+), 32 deletions(-)


[PATCH] drm/hisilicon: Use drm_connector_register_all

2016-05-10 Thread Xinliang Liu
Hi Daniel, Thank you for your patch.


On 6 May 2016 at 16:28, Daniel Vetter  wrote:
> Also, the unbind function is totally not sufficient, and it's calling
> the deprecated drm_put_dev. Please look at what other drivers are
> doing and fix things up.
>
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 31 
> +
>  1 file changed, 1 insertion(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index e6b9e40ced7d..cd3bcb048081 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -201,35 +201,6 @@ static int compare_of(struct device *dev, void *data)
> return dev->of_node == data;
>  }
>
> -static int kirin_drm_connectors_register(struct drm_device *dev)
> -{
> -   struct drm_connector *connector;
> -   struct drm_connector *failed_connector;
> -   int ret;
> -
> -   mutex_lock(>mode_config.mutex);
> -   drm_for_each_connector(connector, dev) {
> -   ret = drm_connector_register(connector);
> -   if (ret) {
> -   failed_connector = connector;
> -   goto err;
> -   }
> -   }
> -   mutex_unlock(>mode_config.mutex);
> -
> -   return 0;
> -
> -err:
> -   drm_for_each_connector(connector, dev) {
> -   if (failed_connector == connector)
> -   break;
> -   drm_connector_unregister(connector);
> -   }
> -   mutex_unlock(>mode_config.mutex);
> -
> -   return ret;
> -}
> -
>  static int kirin_drm_bind(struct device *dev)
>  {
> struct drm_driver *driver = _drm_driver;
> @@ -251,7 +222,7 @@ static int kirin_drm_bind(struct device *dev)
> goto err_kms_cleanup;
>
> /* connectors should be registered after drm device register */
> -   ret = kirin_drm_connectors_register(drm_dev);
> +   ret = drm_connector_register_all(drm_dev);
> if (ret)
> goto err_drm_dev_unregister;
>
> --
> 2.8.1
>

Tested-by: Xinliang Liu 

This patch looks good to me. It will be Applied to drm-hisilicon-next for 4.7.
As the unbind function is fixed in another patch[1]. Do you mind me to
reword the git log msg?

[1]: http://www.spinics.net/lists/dri-devel/msg106836.html

Thanks,
-xinliang


[PATCH 2/3] drm/hisilicon: Make kirin_drm_unbind sufficient

2016-05-10 Thread Xinliang Liu
On 9 May 2016 at 14:44, Daniel Vetter  wrote:
> On Mon, May 09, 2016 at 10:32:07AM +0800, Xinliang Liu wrote:
>> Remove deprecated drm_put_dev.
>> Clean up everything needed in unbind.
>> Thanks to Daniel Vetter, this issue is reported by him.
>>
>> Signed-off-by: Xinliang Liu 
>> Reported-by: Daniel Vetter 
>
> Acked-by: Daniel Vetter 

Thanks, Daniel.
-xinliang

>> ---
>>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 7 ++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
>> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> index bc410ee584b7..3f94785fbcca 100644
>> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> @@ -244,7 +244,12 @@ err_drm_dev_unref:
>>
>>  static void kirin_drm_unbind(struct device *dev)
>>  {
>> - drm_put_dev(dev_get_drvdata(dev));
>> + struct drm_device *drm_dev = dev_get_drvdata(dev);
>> +
>> + drm_connector_unregister_all(drm_dev);
>> + drm_dev_unregister(drm_dev);
>> + kirin_drm_kms_cleanup(drm_dev);
>> + drm_dev_unref(drm_dev);
>>  }
>>
>>  static const struct component_master_ops kirin_drm_ops = {
>> --
>> 2.8.2
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


[PATCH 1/3] drm/hisilicon: Use drm_connector_register_all

2016-05-09 Thread Xinliang Liu
On 9 May 2016 at 14:43, Daniel Vetter  wrote:
> On Mon, May 09, 2016 at 10:32:06AM +0800, Xinliang Liu wrote:
>> Use drm_connector_register_all helper to register connectors.
>> Thanks to Daniel Vetter, this patch is raised by him.
>>
>> Signed-off-by: Xinliang Liu 
>> Signed-off-by: Daniel Vetter 
>
> Seems like exactly my patch, except you've taken over authorship. Please
> merge mine instead (except when there's a bug).

OK, I will merge yours instead.

Thanks,
-xinliang

> -Daniel
>
>> ---
>>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 31 
>> +
>>  1 file changed, 1 insertion(+), 30 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
>> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> index e102c9e1e7b2..bc410ee584b7 100644
>> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> @@ -201,35 +201,6 @@ static int compare_of(struct device *dev, void *data)
>>   return dev->of_node == data;
>>  }
>>
>> -static int kirin_drm_connectors_register(struct drm_device *dev)
>> -{
>> - struct drm_connector *connector;
>> - struct drm_connector *failed_connector;
>> - int ret;
>> -
>> - mutex_lock(>mode_config.mutex);
>> - drm_for_each_connector(connector, dev) {
>> - ret = drm_connector_register(connector);
>> - if (ret) {
>> - failed_connector = connector;
>> - goto err;
>> - }
>> - }
>> - mutex_unlock(>mode_config.mutex);
>> -
>> - return 0;
>> -
>> -err:
>> - drm_for_each_connector(connector, dev) {
>> - if (failed_connector == connector)
>> - break;
>> - drm_connector_unregister(connector);
>> - }
>> - mutex_unlock(>mode_config.mutex);
>> -
>> - return ret;
>> -}
>> -
>>  static int kirin_drm_bind(struct device *dev)
>>  {
>>   struct drm_driver *driver = _drm_driver;
>> @@ -251,7 +222,7 @@ static int kirin_drm_bind(struct device *dev)
>>   goto err_kms_cleanup;
>>
>>   /* connectors should be registered after drm device register */
>> - ret = kirin_drm_connectors_register(drm_dev);
>> + ret = drm_connector_register_all(drm_dev);
>>   if (ret)
>>   goto err_drm_dev_unregister;
>>
>> --
>> 2.8.2
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch


[PATCH 3/3] drm/hisilicon: Fix no DRM_INFO is printed issue

2016-05-09 Thread Xinliang Liu
This patch fixed the bellow no DRM_INFO is printed issue:

if (!delay_count)
DRM_INFO("phylock and phystopstateclklane is not ready.\n");

The above info will not printed, under certain circumstances:
If ((BIT(0) | BIT(2)) & val) is never true, break will not happen and
delay_count will be max u32 value (?), and no DRM_INFO is printed.

Also if ((BIT(0) | BIT(2)) & val) is true at the last possible
loop round, break happens, but now delay_count is already zero
( because of earlier delay_count-- ) and DRM_INFO is erroneously
printed.

Thanks to Juha Leppänen, he reports to me this issue.

Signed-off-by: Xinliang Liu 
Reported-by: Juha Leppänen 
---
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c 
b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index bfbc2159250d..998452ad0fcb 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -430,12 +430,13 @@ static void dsi_set_mipi_phy(void __iomem *base,
 * wait for phy's clock ready
 */
delay_count = 100;
-   while (delay_count--) {
+   while (delay_count) {
val = readl(base +  PHY_STATUS);
if ((BIT(0) | BIT(2)) & val)
break;

udelay(1);
+   delay_count--;
}

if (!delay_count)
-- 
2.8.2



[PATCH 2/3] drm/hisilicon: Make kirin_drm_unbind sufficient

2016-05-09 Thread Xinliang Liu
Remove deprecated drm_put_dev.
Clean up everything needed in unbind.
Thanks to Daniel Vetter, this issue is reported by him.

Signed-off-by: Xinliang Liu 
Reported-by: Daniel Vetter 
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index bc410ee584b7..3f94785fbcca 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -244,7 +244,12 @@ err_drm_dev_unref:

 static void kirin_drm_unbind(struct device *dev)
 {
-   drm_put_dev(dev_get_drvdata(dev));
+   struct drm_device *drm_dev = dev_get_drvdata(dev);
+
+   drm_connector_unregister_all(drm_dev);
+   drm_dev_unregister(drm_dev);
+   kirin_drm_kms_cleanup(drm_dev);
+   drm_dev_unref(drm_dev);
 }

 static const struct component_master_ops kirin_drm_ops = {
-- 
2.8.2



[PATCH 1/3] drm/hisilicon: Use drm_connector_register_all

2016-05-09 Thread Xinliang Liu
Use drm_connector_register_all helper to register connectors.
Thanks to Daniel Vetter, this patch is raised by him.

Signed-off-by: Xinliang Liu 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 31 +
 1 file changed, 1 insertion(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index e102c9e1e7b2..bc410ee584b7 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -201,35 +201,6 @@ static int compare_of(struct device *dev, void *data)
return dev->of_node == data;
 }

-static int kirin_drm_connectors_register(struct drm_device *dev)
-{
-   struct drm_connector *connector;
-   struct drm_connector *failed_connector;
-   int ret;
-
-   mutex_lock(>mode_config.mutex);
-   drm_for_each_connector(connector, dev) {
-   ret = drm_connector_register(connector);
-   if (ret) {
-   failed_connector = connector;
-   goto err;
-   }
-   }
-   mutex_unlock(>mode_config.mutex);
-
-   return 0;
-
-err:
-   drm_for_each_connector(connector, dev) {
-   if (failed_connector == connector)
-   break;
-   drm_connector_unregister(connector);
-   }
-   mutex_unlock(>mode_config.mutex);
-
-   return ret;
-}
-
 static int kirin_drm_bind(struct device *dev)
 {
struct drm_driver *driver = _drm_driver;
@@ -251,7 +222,7 @@ static int kirin_drm_bind(struct device *dev)
goto err_kms_cleanup;

/* connectors should be registered after drm device register */
-   ret = kirin_drm_connectors_register(drm_dev);
+   ret = drm_connector_register_all(drm_dev);
if (ret)
goto err_drm_dev_unregister;

-- 
2.8.2



[PATCH 0/3] A few fixes for 4.7

2016-05-09 Thread Xinliang Liu
These fixes are found and fixed recently when hisilicon pull request
for 4.7 is merged into drm-next.
Thanks to Daniel Vetter and Juha Leppänen, who point out the things to
be fixed.

Xinliang Liu (3):
  drm/hisilicon: Use drm_connector_register_all
  drm/hisilicon: Make kirin_drm_unbind sufficient
  drm/hisilicon: Fix no DRM_INFO is printed issue

 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c|  3 +-
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 38 +
 2 files changed, 9 insertions(+), 32 deletions(-)

-- 
2.8.2



[PATCH] drm/hisilicon: Use drm_connector_register_all

2016-05-08 Thread Xinliang Liu
Hi Daniel,

On 6 May 2016 at 16:28, Daniel Vetter  wrote:
> Also, the unbind function is totally not sufficient, and it's calling
> the deprecated drm_put_dev. Please look at what other drivers are
> doing and fix things up.

will fix these things and send patch for review soon.

Thanks,
-xinliang

>
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 31 
> +
>  1 file changed, 1 insertion(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index e6b9e40ced7d..cd3bcb048081 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -201,35 +201,6 @@ static int compare_of(struct device *dev, void *data)
> return dev->of_node == data;
>  }
>
> -static int kirin_drm_connectors_register(struct drm_device *dev)
> -{
> -   struct drm_connector *connector;
> -   struct drm_connector *failed_connector;
> -   int ret;
> -
> -   mutex_lock(>mode_config.mutex);
> -   drm_for_each_connector(connector, dev) {
> -   ret = drm_connector_register(connector);
> -   if (ret) {
> -   failed_connector = connector;
> -   goto err;
> -   }
> -   }
> -   mutex_unlock(>mode_config.mutex);
> -
> -   return 0;
> -
> -err:
> -   drm_for_each_connector(connector, dev) {
> -   if (failed_connector == connector)
> -   break;
> -   drm_connector_unregister(connector);
> -   }
> -   mutex_unlock(>mode_config.mutex);
> -
> -   return ret;
> -}
> -
>  static int kirin_drm_bind(struct device *dev)
>  {
> struct drm_driver *driver = _drm_driver;
> @@ -251,7 +222,7 @@ static int kirin_drm_bind(struct device *dev)
> goto err_kms_cleanup;
>
> /* connectors should be registered after drm device register */
> -   ret = kirin_drm_connectors_register(drm_dev);
> +   ret = drm_connector_register_all(drm_dev);
> if (ret)
> goto err_drm_dev_unregister;
>
> --
> 2.8.1
>


[GIT PULL v3] drm-hisilicon-next for 4.7

2016-05-04 Thread Xinliang Liu
On 4 May 2016 at 15:24, Dave Airlie  wrote:
> On 29 April 2016 at 18:40, Xinliang Liu  wrote:
>> Hi Dave,
>>
>> v3:
>> This driver should only work on arm64 system.
>> So add ARM64 depends on to the Kconfig in this commit:
>> 23e7b2ab9a8f drm/hisilicon: Add hisilicon kirin drm master driver
>>
>> The 32-bit system compilation warnings and errors should not be existed.
>> Please help to try and let me know if there is any problem.
>>
>> Thanks,
>> -xinliang
>>
>> The following changes since commit b89359bdf0f1e95a4c5f92300594ba9dde323fc4:
>>
>>   Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu
>> into drm-next (2016-04-29 14:57:51 +1000)
>>
>> are available in the git repository at:
>
> git pull request seems to have lost the repo?

Sorry for that. Here it is:

The following changes since commit b89359bdf0f1e95a4c5f92300594ba9dde323fc4:

  Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu
into drm-next (2016-04-29 14:57:51 +1000)

are available in the git repository at:

  git at github.com:xin3liang/linux.git tags/drm-hisilicon-next-2016-04-29

for you to fetch changes up to c84ffde963e227bf68efb12315bd39c75e00ff05:

  MAINTAINERS: Add maintainer for hisilicon DRM driver (2016-04-29
16:39:15 +0800)


drm-hisilicon-next for 4.7

Add new hisilicon kirin drm driver:
- Add maintainer for hisilicon DRM driver
- Add support for external bridge
- Add designware dsi host driver
- Add designware dsi encoder driver
- Add cma fbdev and hotplug
- Add vblank driver for ADE
- Add plane driver for ADE
- Add crtc driver for ADE
- Add hisilicon kirin drm master driver
- Add device tree binding for hi6220 display subsystem


Xinliang Liu (10):
  drm/hisilicon: Add device tree binding for hi6220 display subsystem
  drm/hisilicon: Add hisilicon kirin drm master driver
  drm/hisilicon: Add crtc driver for ADE
  drm/hisilicon: Add plane driver for ADE
  drm/hisilicon: Add vblank driver for ADE
  drm/hisilicon: Add cma fbdev and hotplug
  drm/hisilicon: Add designware dsi encoder driver
  drm/hisilicon: Add designware dsi host driver
  drm/hisilicon: Add support for external bridge
  MAINTAINERS: Add maintainer for hisilicon DRM driver

 Documentation/devicetree/bindings/display/hisilicon/dw-dsi.txt   |   72 +++
 Documentation/devicetree/bindings/display/hisilicon/hisi-ade.txt |   64 +++
 MAINTAINERS  |   10 +
 drivers/gpu/drm/Kconfig  |2 +
 drivers/gpu/drm/Makefile |1 +
 drivers/gpu/drm/hisilicon/Kconfig|5 +
 drivers/gpu/drm/hisilicon/Makefile   |5 +
 drivers/gpu/drm/hisilicon/kirin/Kconfig  |   18 +
 drivers/gpu/drm/hisilicon/kirin/Makefile |6 +
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c |
857 ++
 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h |  103 
 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h  |
230 +
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c  |
1057 ++
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c  |
367 +++
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h  |   31 ++
 15 files changed, 2828 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/dw-dsi.txt
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/hisi-ade.txt
 create mode 100644 drivers/gpu/drm/hisilicon/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h

>
> Dave.


[PATCH v3 0/7] drm/i2c: adv7511: ADV7533 support

2016-05-03 Thread Xinliang Liu
On 9 March 2016 at 18:57, Archit Taneja  wrote:
> ADV7533 is a DSI to HDMI encoder chip. It's like ADV7511, but with an
> additional DSI RX block that takes in DSI video mode output.
>
> Trying to get this driver merged has had some challenges:
>
> - ADV7533 has an I2C control bus, but acts as a DSI peripheral too.
>   After discussions, it was concluded that we'd want to provide an
>   API to create MIPI DSI devices, rather than expose two different
>   interfaces on DT. The first version [1] tried the former approach
>   the second version [2] showed how the driver would look like if
>   exposed 2 DT nodes. This lateset patchset relies on the MIPI DSI
>   device creation API provided by [3], this has been accepted and
>   should be merged for 4.6.
>
> - The driver was designed as an I2C slave encoder. When ADV7533
>   patches were posted [1], it was modelled as a bridge, but ADV7511
>   and others were still left as I2C slave encoders. This wasn't
>   accepted. After discussions, it was decided that ADV7511 too would
>   be converted into a bridge driver, and all the users of ADV7511
>   should assume it is a bridge. This bridge conversion was done in
>   [4]. There is still some debate over whether the bridge driver be
>   involved in the connector creation, or the KMS driver that has
>   the whole view of the display pipeline. This discussion shouldn't
>   affect this patch set, though.
>
> This patch set enables ADV7533 support with the above two issues
> now resolved. It also incorporates ADV7533 specific features and fixes
> that we've discovered since the first version of this patch was posted.
>
> Tested on ADV7533 chips on DB410c. It should work on the Hikey board too.
> I'd appreaciate if someone could test it on a ADV7511 platform since I
> don't have one.
>
> [4]
> https://lists.freedesktop.org/archives/dri-devel/2016-January/098287.html
>
> [3]
> https://lkml.org/lkml/2016/2/12/67
>
> [2]
> https://lists.freedesktop.org/archives/dri-devel/2015-September/089884.html
>
> [1]:
> https://lists.freedesktop.org/archives/dri-devel/2015-July/087088.html
>
> Archit Taneja (7):
>   drm/i2c: adv7511: Convert to drm_bridge
>   drm/i2c: adv7511: Fix mutex deadlock when interrupts are disabled
>   drm/i2c: adv7511: Initial support for ADV7533
>   drm/i2c: adv7511: Create a MIPI DSI device
>   drm/i2c: adv7511: Use internal timing generator
>   drm/i2c: adv7511: Change number of DSI lanes dynamically
>   dt-bindings: drm/bridge: Update bindings for ADV7533
>
>  .../bindings/display/bridge/adi,adv7511.txt|  25 +-
>  drivers/gpu/drm/i2c/adv7511.c  | 539 
> +
>  2 files changed, 476 insertions(+), 88 deletions(-)
>
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> hosted by The Linux Foundation
>

This patch set is Tested-by: Xinliang Liu 

Thanks
-xinliang


[GIT PULL v3] drm-hisilicon-next for 4.7

2016-04-29 Thread Xinliang Liu
Hi Dave,

v3:
This driver should only work on arm64 system.
So add ARM64 depends on to the Kconfig in this commit:
23e7b2ab9a8f drm/hisilicon: Add hisilicon kirin drm master driver

The 32-bit system compilation warnings and errors should not be existed.
Please help to try and let me know if there is any problem.

Thanks,
-xinliang

The following changes since commit b89359bdf0f1e95a4c5f92300594ba9dde323fc4:

  Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu
into drm-next (2016-04-29 14:57:51 +1000)

are available in the git repository at:

for you to fetch changes up to c84ffde963e227bf68efb12315bd39c75e00ff05:

  MAINTAINERS: Add maintainer for hisilicon DRM driver (2016-04-29
16:39:15 +0800)


drm-hisilicon-next for 4.7

Add new hisilicon kirin drm driver:
- Add maintainer for hisilicon DRM driver
- Add support for external bridge
- Add designware dsi host driver
- Add designware dsi encoder driver
- Add cma fbdev and hotplug
- Add vblank driver for ADE
- Add plane driver for ADE
- Add crtc driver for ADE
- Add hisilicon kirin drm master driver
- Add device tree binding for hi6220 display subsystem


Xinliang Liu (10):
  drm/hisilicon: Add device tree binding for hi6220 display subsystem
  drm/hisilicon: Add hisilicon kirin drm master driver
  drm/hisilicon: Add crtc driver for ADE
  drm/hisilicon: Add plane driver for ADE
  drm/hisilicon: Add vblank driver for ADE
  drm/hisilicon: Add cma fbdev and hotplug
  drm/hisilicon: Add designware dsi encoder driver
  drm/hisilicon: Add designware dsi host driver
  drm/hisilicon: Add support for external bridge
  MAINTAINERS: Add maintainer for hisilicon DRM driver

 Documentation/devicetree/bindings/display/hisilicon/dw-dsi.txt   |   72 ++
 Documentation/devicetree/bindings/display/hisilicon/hisi-ade.txt |   64 ++
 MAINTAINERS  |   10 +
 drivers/gpu/drm/Kconfig  |2 +
 drivers/gpu/drm/Makefile |1 +
 drivers/gpu/drm/hisilicon/Kconfig|5 +
 drivers/gpu/drm/hisilicon/Makefile   |5 +
 drivers/gpu/drm/hisilicon/kirin/Kconfig  |   18 ++
 drivers/gpu/drm/hisilicon/kirin/Makefile |6 +
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c |
857 +
 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h |
103 +
 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h  |
230 +++
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c  |
1057 
++
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c  |
367 ++
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h  |   31 +++
 15 files changed, 2828 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/dw-dsi.txt
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/hisi-ade.txt
 create mode 100644 drivers/gpu/drm/hisilicon/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h


[GIT PULL v2] drm-hisilicon-next for 4.7

2016-04-28 Thread Xinliang Liu
Hi Dave,

V2 has fixed the module compilation error and warnings in this commit:
3d76c7e5bbdd drm/hisilicon: Add designware dsi encoder driver

Please help to try and let me know if there is any problem.

Thanks,
-xinliang

The following changes since commit 152ef5fa9e14e93e7efc43adad7dbcf35d7780f5:

  drm: Switch blobs to the new generic modeset obj refcounting
(2016-04-27 09:58:05 +1000)

are available in the git repository at:

  git at github.com:xin3liang/linux.git tags/drm-hisilicon-next-2016-04-28

for you to fetch changes up to 4f65fd49d7184bda4e3abddc04d5965109832b4f:

  MAINTAINERS: Add maintainer for hisilicon DRM driver (2016-04-28
11:06:54 +0800)


drm-hisilicon-next for 4.7

Add new hisilicon kirin drm driver:
- Add maintainer for hisilicon DRM driver
- Add support for external bridge
- Add designware dsi host driver
- Add designware dsi encoder driver
- Add cma fbdev and hotplug
- Add vblank driver for ADE
- Add plane driver for ADE
- Add crtc driver for ADE
- Add hisilicon kirin drm master driver
- Add device tree binding for hi6220 display subsystem


Xinliang Liu (10):
  drm/hisilicon: Add device tree binding for hi6220 display subsystem
  drm/hisilicon: Add hisilicon kirin drm master driver
  drm/hisilicon: Add crtc driver for ADE
  drm/hisilicon: Add plane driver for ADE
  drm/hisilicon: Add vblank driver for ADE
  drm/hisilicon: Add cma fbdev and hotplug
  drm/hisilicon: Add designware dsi encoder driver
  drm/hisilicon: Add designware dsi host driver
  drm/hisilicon: Add support for external bridge
  MAINTAINERS: Add maintainer for hisilicon DRM driver

 .../bindings/display/hisilicon/dw-dsi.txt  |   72 ++
 .../bindings/display/hisilicon/hisi-ade.txt|   64 ++
 MAINTAINERS|   10 +
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/hisilicon/Kconfig  |5 +
 drivers/gpu/drm/hisilicon/Makefile |5 +
 drivers/gpu/drm/hisilicon/kirin/Kconfig|   18 +
 drivers/gpu/drm/hisilicon/kirin/Makefile   |6 +
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c   |  857 
 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h   |  103 ++
 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h|  230 +
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c| 1057 
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c|  367 +++
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h|   31 +
 15 files changed, 2828 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/dw-dsi.txt
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/hisi-ade.txt
 create mode 100644 drivers/gpu/drm/hisilicon/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h


[GIT PULL] drm-hisilicon-next-2016-04-18 for 4.7

2016-04-28 Thread Xinliang Liu
Hi Dave,

Have fixed the module compilation error and warnings in this commit:
3d76c7e5bbdd drm/hisilicon: Add designware dsi encoder driver

Please help to pull the new tag drm-hisilicon-next-2016-04-28 and let
me know if there is any problem.

Thanks,
-xinliang


The following changes since commit 152ef5fa9e14e93e7efc43adad7dbcf35d7780f5:

  drm: Switch blobs to the new generic modeset obj refcounting
(2016-04-27 09:58:05 +1000)

are available in the git repository at:

  git at github.com:xin3liang/linux.git tags/drm-hisilicon-next-2016-04-28

for you to fetch changes up to 4f65fd49d7184bda4e3abddc04d5965109832b4f:

  MAINTAINERS: Add maintainer for hisilicon DRM driver (2016-04-28
11:06:54 +0800)


drm-hisilicon-next for 4.7

Add new hisilicon kirin drm driver:
- Add maintainer for hisilicon DRM driver
- Add support for external bridge
- Add designware dsi host driver
- Add designware dsi encoder driver
- Add cma fbdev and hotplug
- Add vblank driver for ADE
- Add plane driver for ADE
- Add crtc driver for ADE
- Add hisilicon kirin drm master driver
- Add device tree binding for hi6220 display subsystem


Xinliang Liu (10):
  drm/hisilicon: Add device tree binding for hi6220 display subsystem
  drm/hisilicon: Add hisilicon kirin drm master driver
  drm/hisilicon: Add crtc driver for ADE
  drm/hisilicon: Add plane driver for ADE
  drm/hisilicon: Add vblank driver for ADE
  drm/hisilicon: Add cma fbdev and hotplug
  drm/hisilicon: Add designware dsi encoder driver
  drm/hisilicon: Add designware dsi host driver
  drm/hisilicon: Add support for external bridge
  MAINTAINERS: Add maintainer for hisilicon DRM driver

 .../bindings/display/hisilicon/dw-dsi.txt  |   72 ++
 .../bindings/display/hisilicon/hisi-ade.txt|   64 ++
 MAINTAINERS|   10 +
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/hisilicon/Kconfig  |5 +
 drivers/gpu/drm/hisilicon/Makefile |5 +
 drivers/gpu/drm/hisilicon/kirin/Kconfig|   18 +
 drivers/gpu/drm/hisilicon/kirin/Makefile   |6 +
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c   |  857 
 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h   |  103 ++
 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h|  230 +
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c| 1057 
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c|  367 +++
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h|   31 +
 15 files changed, 2828 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/dw-dsi.txt
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/hisi-ade.txt
 create mode 100644 drivers/gpu/drm/hisilicon/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h

On 27 April 2016 at 07:43, Dave Airlie  wrote:
> On 19 April 2016 at 19:03, Xinliang Liu  wrote:
>> Hi Dave,
>>
>> This is the first pull request from drm-hisilicon and for 4.7.
>>
>> The patches add new hisilicon drm driver.
>>
>> The patches were reviewed here:
>> http://www.spinics.net/lists/dri-devel/msg104437.html
>>
>> DT binding docs were acked by Rob Herring  here:
>> https://lists.freedesktop.org/archives/dri-devel/2016-March/102135.html
>>
>> Please kindly let me know if there is any problem.
>
>  CC [M]  drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.o
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:
> In function ‘ade_init’:
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:169:134:
> warning: left shift count >= width of type [-Wshift-count-overflow]
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:170:134:
> warning: left shift count >= width of type [-Wshift-count-overflow]
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:171:134:
> warning: left shift count >= width of type [-Wshift-count-overflow]
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_

[GIT PULL] drm-hisilicon-next-2016-04-18 for 4.7

2016-04-27 Thread Xinliang Liu
On 27 April 2016 at 07:43, Dave Airlie  wrote:
> On 19 April 2016 at 19:03, Xinliang Liu  wrote:
>> Hi Dave,
>>
>> This is the first pull request from drm-hisilicon and for 4.7.
>>
>> The patches add new hisilicon drm driver.
>>
>> The patches were reviewed here:
>> http://www.spinics.net/lists/dri-devel/msg104437.html
>>
>> DT binding docs were acked by Rob Herring  here:
>> https://lists.freedesktop.org/archives/dri-devel/2016-March/102135.html
>>
>> Please kindly let me know if there is any problem.
>
>  CC [M]  drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.o
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:
> In function ‘ade_init’:
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:169:134:
> warning: left shift count >= width of type [-Wshift-count-overflow]
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:170:134:
> warning: left shift count >= width of type [-Wshift-count-overflow]
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:171:134:
> warning: left shift count >= width of type [-Wshift-count-overflow]
> /home/airlied/devel/kernel/drm-next/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:172:134:
> warning: left shift count >= width of type [-Wshift-count-overflow]
>   DTC drivers/gpu/drm/tilcdc/tilcdc_slave_compat.dtb
>   LD [M]  drivers/gpu/drm/hisilicon/kirin/kirin-drm.o
> drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.o: In function `init_module':
> dw_drm_dsi.c:(.init.text+0x0): multiple definition of `init_module'
> drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.o:kirin_drm_drv.c:(.init.text+0x0):
> first defined here
> drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.o: In function `cleanup_module':
> dw_drm_dsi.c:(.exit.text+0x0): multiple definition of `cleanup_module'
> drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.o:kirin_drm_drv.c:(.exit.text+0x0):
> first defined here
> /home/airlied/devel/kernel/drm-next/scripts/Makefile.build:428: recipe
> for target 'drivers/gpu/drm/hisilicon/kirin/kirin-drm.o' failed
> make[6]: *** [drivers/gpu/drm/hisilicon/kirin/kirin-drm.o] Error 1
> /home/airlied/devel/kernel/drm-next/scripts/Makefile.build:440: recipe
> for target 'drivers/gpu/drm/hisilicon/kirin' fai
>
> Please fix module compilation and the above warnings and resubmit.

OK, will fix and resubmit soon.

Best,
-xinliang

>
> Dave.


[GIT PULL] drm-hisilicon-next-2016-04-18 for 4.7

2016-04-19 Thread Xinliang Liu
Hi Dave,

This is the first pull request from drm-hisilicon and for 4.7.

The patches add new hisilicon drm driver.

The patches were reviewed here:
http://www.spinics.net/lists/dri-devel/msg104437.html

DT binding docs were acked by Rob Herring  here:
https://lists.freedesktop.org/archives/dri-devel/2016-March/102135.html

Please kindly let me know if there is any problem.

Best,
-xinliang


The following changes since commit f9fd2adaacd8dc0ecbb38d96f3c62f20f0697176:

  Merge branch 'gma500-next' of git://github.com/patjak/drm-gma500
into drm-next (2016-04-14 13:07:12 +1000)

are available in the git repository at:

  git at github.com:xin3liang/linux.git tags/drm-hisilicon-next-2016-04-18

for you to fetch changes up to 5ce2ec773b2ad8bdeea00b828b4d68d77dc11dee:

  MAINTAINERS: Add maintainer for hisilicon DRM driver (2016-04-18
11:21:31 +0800)


drm-hisilicon-next for 4.7

Add new hisilicon kirin drm driver:
- Add maintainer for hisilicon DRM driver
- Add support for external bridge
- Add designware dsi host driver
- Add designware dsi encoder driver
- Add cma fbdev and hotplug
- Add vblank driver for ADE
- Add plane driver for ADE
- Add crtc driver for ADE
- Add hisilicon kirin drm master driver
- Add device tree binding for hi6220 display subsystem


Xinliang Liu (10):
  drm/hisilicon: Add device tree binding for hi6220 display subsystem
  drm/hisilicon: Add hisilicon kirin drm master driver
  drm/hisilicon: Add crtc driver for ADE
  drm/hisilicon: Add plane driver for ADE
  drm/hisilicon: Add vblank driver for ADE
  drm/hisilicon: Add cma fbdev and hotplug
  drm/hisilicon: Add designware dsi encoder driver
  drm/hisilicon: Add designware dsi host driver
  drm/hisilicon: Add support for external bridge
  MAINTAINERS: Add maintainer for hisilicon DRM driver

 .../bindings/display/hisilicon/dw-dsi.txt  |   72 ++
 .../bindings/display/hisilicon/hisi-ade.txt|   64 ++
 MAINTAINERS|   10 +
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/hisilicon/Kconfig  |5 +
 drivers/gpu/drm/hisilicon/Makefile |5 +
 drivers/gpu/drm/hisilicon/kirin/Kconfig|   10 +
 drivers/gpu/drm/hisilicon/kirin/Makefile   |5 +
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c   |  857 
 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h   |  103 ++
 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h|  230 +
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c| 1057 
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c|  367 +++
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h|   31 +
 15 files changed, 2819 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/dw-dsi.txt
 create mode 100644
Documentation/devicetree/bindings/display/hisilicon/hisi-ade.txt
 create mode 100644 drivers/gpu/drm/hisilicon/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/Makefile
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/dw_dsi_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
 create mode 100644 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h


[PATCH v3 0/7] drm/i2c: adv7511: ADV7533 support

2016-04-19 Thread Xinliang Liu
On 18 April 2016 at 17:48, Archit Taneja  wrote:
> Hi,
>
>
> On 04/17/2016 05:01 PM, Xinliang Liu wrote:
>>
>> Hi Archit,
>> Thank you for the patches.
>>
>> On 9 March 2016 at 18:57, Archit Taneja  wrote:
>>>
>>> ADV7533 is a DSI to HDMI encoder chip. It's like ADV7511, but with an
>>> additional DSI RX block that takes in DSI video mode output.
>>>
>>> Trying to get this driver merged has had some challenges:
>>>
>>> - ADV7533 has an I2C control bus, but acts as a DSI peripheral too.
>>>After discussions, it was concluded that we'd want to provide an
>>>API to create MIPI DSI devices, rather than expose two different
>>>interfaces on DT. The first version [1] tried the former approach
>>>the second version [2] showed how the driver would look like if
>>>exposed 2 DT nodes. This lateset patchset relies on the MIPI DSI
>>>device creation API provided by [3], this has been accepted and
>>>should be merged for 4.6.
>>>
>>> - The driver was designed as an I2C slave encoder. When ADV7533
>>>patches were posted [1], it was modelled as a bridge, but ADV7511
>>>and others were still left as I2C slave encoders. This wasn't
>>>accepted. After discussions, it was decided that ADV7511 too would
>>>be converted into a bridge driver, and all the users of ADV7511
>>>should assume it is a bridge. This bridge conversion was done in
>>>[4]. There is still some debate over whether the bridge driver be
>>>involved in the connector creation, or the KMS driver that has
>>>the whole view of the display pipeline. This discussion shouldn't
>>>affect this patch set, though.
>>
>>
>> I also agree with Laurent Pinchart that bridge driver shoudn't get
>> involved in in the connector creation.
>> It is better for KMS driver that has the whole view of the display
>> pipeline.
>
>
> Yes, that's the eventual plan. We were thinking of creating an
> additional drm bridge api (drm_bridge_create_connector) that
> helps the KMS driver create a connector for the bridge.
>
> Since there are  certain connector related properties that the KMS
> driver may not be aware of, we were thinking of creating another
> drm_bridge op which fills up connector properties. Some properties
> (like whether we want POLLED HPD or not) are more platform specific,
> and would be parsed via the connector's DT node (that is, if DT is
> supported on that platform)
>
> For now, this series creates the connector in the bridge's
> attach op, but relies on the KMS driver to call
> drm_connector_register. The other stuff I mentioned above can come
> later.

This is great, if we have the plan.

>
>>
>> In this case, I mean creating bridge driver to support ADV7533. I
>> think this is something look like panel driver. Maybe we need to add
>> some callback to the bridge to avoid creating connector in bridge
>> driver.
>> We can refer to panel entity to see what callbacks to be added. One
>> callback I can see is the get_modes callback might be need.
>>
>>>
>>> This patch set enables ADV7533 support with the above two issues
>>> now resolved. It also incorporates ADV7533 specific features and fixes
>>> that we've discovered since the first version of this patch was posted.
>>>
>>> Tested on ADV7533 chips on DB410c. It should work on the Hikey board too.
>>
>>
>> I have tested the this tracking branch :
>>
>> https://git.linaro.org/landing-teams/working/qualcomm/kernel.git/shortlog/refs/heads/tracking-qcomlt-adv7511
>> it works for HiKey.
>> But it seems this patch set is a little different from the above
>> branch. I think I need to tested this patch set.
>
>
> Yes, it would be great if you could test the posted patch set and
> provided a Tested-by. The patches "drm/i2c: adv7511: Init regulators"
> and above need to still be applied from this branch. I'll post these
> out in another patch set later.

Sure, I will test them all.

Thanks,
-xinliang

>
> Thanks,
> Archit
>
>
>>
>> Thanks,
>> -xinliang
>>
>>> I'd appreaciate if someone could test it on a ADV7511 platform since I
>>> don't have one.
>>>
>>> [4]
>>> https://lists.freedesktop.org/archives/dri-devel/2016-January/098287.html
>>>
>>> [3]
>>> https://lkml.org/lkml/2016/2/12/67
>>>
>>> [2]
>>>
>>> https://lists.freedesktop.org/archives/dri-devel/2015-September/089884.html
>>>
&g

[PATCH v3 0/7] drm/i2c: adv7511: ADV7533 support

2016-04-17 Thread Xinliang Liu
Hi Archit,
Thank you for the patches.

On 9 March 2016 at 18:57, Archit Taneja  wrote:
> ADV7533 is a DSI to HDMI encoder chip. It's like ADV7511, but with an
> additional DSI RX block that takes in DSI video mode output.
>
> Trying to get this driver merged has had some challenges:
>
> - ADV7533 has an I2C control bus, but acts as a DSI peripheral too.
>   After discussions, it was concluded that we'd want to provide an
>   API to create MIPI DSI devices, rather than expose two different
>   interfaces on DT. The first version [1] tried the former approach
>   the second version [2] showed how the driver would look like if
>   exposed 2 DT nodes. This lateset patchset relies on the MIPI DSI
>   device creation API provided by [3], this has been accepted and
>   should be merged for 4.6.
>
> - The driver was designed as an I2C slave encoder. When ADV7533
>   patches were posted [1], it was modelled as a bridge, but ADV7511
>   and others were still left as I2C slave encoders. This wasn't
>   accepted. After discussions, it was decided that ADV7511 too would
>   be converted into a bridge driver, and all the users of ADV7511
>   should assume it is a bridge. This bridge conversion was done in
>   [4]. There is still some debate over whether the bridge driver be
>   involved in the connector creation, or the KMS driver that has
>   the whole view of the display pipeline. This discussion shouldn't
>   affect this patch set, though.

I also agree with Laurent Pinchart that bridge driver shoudn't get
involved in in the connector creation.
It is better for KMS driver that has the whole view of the display pipeline.

In this case, I mean creating bridge driver to support ADV7533. I
think this is something look like panel driver. Maybe we need to add
some callback to the bridge to avoid creating connector in bridge
driver.
We can refer to panel entity to see what callbacks to be added. One
callback I can see is the get_modes callback might be need.

>
> This patch set enables ADV7533 support with the above two issues
> now resolved. It also incorporates ADV7533 specific features and fixes
> that we've discovered since the first version of this patch was posted.
>
> Tested on ADV7533 chips on DB410c. It should work on the Hikey board too.

I have tested the this tracking branch :
https://git.linaro.org/landing-teams/working/qualcomm/kernel.git/shortlog/refs/heads/tracking-qcomlt-adv7511
it works for HiKey.
But it seems this patch set is a little different from the above
branch. I think I need to tested this patch set.

Thanks,
-xinliang

> I'd appreaciate if someone could test it on a ADV7511 platform since I
> don't have one.
>
> [4]
> https://lists.freedesktop.org/archives/dri-devel/2016-January/098287.html
>
> [3]
> https://lkml.org/lkml/2016/2/12/67
>
> [2]
> https://lists.freedesktop.org/archives/dri-devel/2015-September/089884.html
>
> [1]:
> https://lists.freedesktop.org/archives/dri-devel/2015-July/087088.html
>
> Archit Taneja (7):
>   drm/i2c: adv7511: Convert to drm_bridge
>   drm/i2c: adv7511: Fix mutex deadlock when interrupts are disabled
>   drm/i2c: adv7511: Initial support for ADV7533
>   drm/i2c: adv7511: Create a MIPI DSI device
>   drm/i2c: adv7511: Use internal timing generator
>   drm/i2c: adv7511: Change number of DSI lanes dynamically
>   dt-bindings: drm/bridge: Update bindings for ADV7533
>
>  .../bindings/display/bridge/adi,adv7511.txt|  25 +-
>  drivers/gpu/drm/i2c/adv7511.c  | 539 
> +
>  2 files changed, 476 insertions(+), 88 deletions(-)
>
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> hosted by The Linux Foundation
>


[PATCH v8 02/10] drm/hisilicon: Add hisilicon kirin drm master driver

2016-04-14 Thread Xinliang Liu
Hi Emil,

On 13 April 2016 at 20:15, Emil Velikov  wrote:
> Hi Xinliang,
>
> On 11 April 2016 at 09:55, Xinliang Liu  wrote:
>
>> +static int kirin_drm_connectors_register(struct drm_device *dev)
>> +{
>> +   struct drm_connector *connector;
>> +   struct drm_connector *failed_connector;
>> +   int ret;
>> +
>> +   mutex_lock(>mode_config.mutex);
>> +   drm_for_each_connector(connector, dev) {
>> +   ret = drm_connector_register(connector);
>> +   if (ret) {
>> +   failed_connector = connector;
>> +   goto err;
>> +   }
>> +   }
>> +   mutex_unlock(>mode_config.mutex);
>> +
>> +   return 0;
>> +
>> +err:
>> +   drm_for_each_connector(connector, dev) {
>> +   if (failed_connector == connector)
>> +   break;
>> +   drm_connector_unregister(connector);
>> +   }
>> +   mutex_unlock(>mode_config.mutex);
>> +
>> +   return ret;
>> +}
>> +
> Iirc we have new drm_connector_{un,}register_all() helpers.You might
> want to use it once they are in (i.e. not sure what your base is and
> if they have landed yet).

I can't find these drm_connector_{un,}register_all() helpers in latest
tag v4.6-rc3.

>
>
>> +static struct device_node *kirin_get_remote_node(struct device_node *np)
>> +{
>> +   struct device_node *endpoint, *remote;
>> +
>> +   /* get the first endpoint, in our case only one remote node
>> +* is connected to display controller.
>> +*/
>> +   endpoint = of_graph_get_next_endpoint(np, NULL);
>> +   if (!endpoint) {
>> +   DRM_ERROR("no valid endpoint node\n");
>> +   return ERR_PTR(-ENODEV);
>> +   }
>> +   of_node_put(endpoint);
>> +
>> +   remote = of_graph_get_remote_port_parent(endpoint);
>> +   if (!remote) {
>> +   DRM_ERROR("no valid remote node\n");
>> +   return ERR_PTR(-ENODEV);
>> +   }
>> +   of_node_put(remote);
>> +
>> +   if (!of_device_is_available(remote)) {
>> +   DRM_ERROR("not available for remote node\n");
>> +   return ERR_PTR(-ENODEV);
>> +   }
>> +
> This seems like a common pattern in many platform DRM drivers. Yet
> some tend to differ in subtle ways - I'm leaning that they might be
> bugs, but one cannot be too sure.
>
> A friendly request:
> Can you please follow up by adding a helper and removing the
> duplication thoughout ?

Yes, I will create another patch set for this. I think I need to
figure out other drivers requirements.
Maybe, I need to add one more parameter for this helper. That's
endpoint index to get which endpoint remote node.
I will follow up this.

Thanks,
-xinliang


>
> Thanks
> Emil


[PATCH v8 10/10] MAINTAINERS: Add maintainer for hisilicon DRM driver

2016-04-14 Thread Xinliang Liu
On 13 April 2016 at 19:54, Emil Velikov  wrote:
> Hi Xinliang,
>
> On 11 April 2016 at 09:55, Xinliang Liu  wrote:
>> Add maintainer and reviewer for hisilicon DRM driver.
>>
>> v8: None.
>> v7: None.
>> v6: None.
>> v5: None.
>> v4:
>> - Add Chen Feng  as Designated reviewer.
>> v3: First version.
>>
>> Signed-off-by: Xinliang Liu 
>> ---
>>  MAINTAINERS | 10 ++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 61a323a6b2cf..a2ef58860689 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -3840,6 +3840,16 @@ S:   Maintained
>>  F: drivers/gpu/drm/gma500
>>  F: include/drm/gma500*
>>
>> +DRM DRIVERS FOR HISILICON
>> +M: Xinliang Liu 
>> +R: Xinwei Kong 
>> +R: Chen Feng 
>> +L: dri-devel at lists.freedesktop.org
>> +T: git git://github.com/xin3liang/linux.git
>> +S: Maintained
>> +F: drivers/gpu/drm/hisilicon
>> +F: Documentation/devicetree/bindings/display/hisilicon
> Nit: Can you add append '/' on these two lines.
>
> As mentioned in commit 144308139cdce95e9c6cff3cc0ef12242181665f
>
> "It's clearer to have patterns marked as directories."

Sure Emil, I will fix this. Thanks to notice me this.

Thanks,
-xinliang

>
> Thanks
> Emil


[PATCH v8 00/10] Add DRM Driver for HiSilicon Kirin hi6220 SoC

2016-04-13 Thread Xinliang Liu
On 13 April 2016 at 00:08, Daniel Vetter  wrote:
> On Mon, Apr 11, 2016 at 04:55:33PM +0800, Xinliang Liu wrote:
>> This patch set adds a new drm driver for HiSilicon Kirin hi6220 SoC.
>> Current testing and support board is Hikey board which is one of Linaro
>> 96boards. It is an arm64 open source board. For more information about
>> this board, please access https://www.96boards.org.
>>
>> Hardware Detail
>> ---
>>   The display subsystem of Hi6220 SoC is shown as bellow:
>>  +-+   +--+ +-+ +-+
>>  | |   |  | | | | |
>>  | FB  |-->|   ADE|>| DSI |>|   External  |
>>  | |   |  | | | |  HDMI/panel |
>>  +-+   +--+ +-+ +-+
>>
>> - ADE(Advanced Display Engine) is the display controller. It contains 7
>> channels, 3 overlay compositors and a LDI.
>>   - A channel looks like: DMA-->clip-->scale-->ctrans(or called csc).
>>   - Overlay compositor is response to compose planes which come from 7
>>   channels and pass composed image to LDI.
>>   - LDI is response to generate timings and RGB data stream.
>> - DSI converts the RGB data stream from ADE to DSI packets.
>> - External HDMI/panel module is connected with DSI bus. Now Hikey use a
>>   ADI's ADV7533 external HDMI chip.
>
> I haven't looked at the details again, but seems it's all ready. Please
> create a pull request for the entire pile against drm-next and submit it
> to Dave Airlie.

Thanks Daniel, will send pull request to Dave soon.

Best,
-xinliang

>
> Thanks, Daniel
>
>>
>> Change History
>> -
>> Changes in v8:
>> - Rebase to v4.6-rc3
>>
>> Changes in v7:
>> - Add config.mutex protection when accessing mode_config.connector_list.
>> - Clean up match data getting of kirin_drm_drv.c.
>> - A few Regs define clean up and typo fixs for ADE crtc and DSI encoder
>>   driver.
>> - Fix vblank irq flag "DRIVER_IRQF_SHARED" to "IRQF_SHARED".
>>
>> Changes in v6:
>> - Cleanup values part of reg and clocks relevant properties.
>> - Change "pclk_dsi" clock name to "pclk".
>>
>> Changes in v5:
>> - Remove endpoint unit address of dsi output port.
>> - Use syscon to access ADE media NOC QoS registers instread of directly
>>   writing registers.
>> - Use reset controller to reset ADE instead of directly writing registers.
>>
>> Changes in v4:
>> - Describe more specific of clocks and ports of binding docs.
>> - Fix indentation of binding docs.
>>
>> Changes in v3:
>> - Move and rename all the files to kirin sub-directory.
>>   So that we could separate different seires SoCs' driver.
>> - Make ade as the drm master node.
>> - Replace drm_platform_init, load, unload implementation.
>> - Use assigned-clocks to set clock rate.
>> - Use ports to connect display relevant nodes.
>> - Rename hisi_drm_dsi.c to dw_drm_dsi.c
>> - Make encoder type as DRM_MODE_ENCODER_DSI.
>> - A few cleanup on regs and code.
>>
>> Changes in v2:
>> - Remove abtraction layer of plane/crtc/encoder/connector.
>> - Refactor atomic implementation according to Daniel Vetter's guides:
>> http://blog.ffwll.ch/2014/11/atomic-modeset-support-for-kms-drivers.html
>> http://blog.ffwll.ch/2015/09/xdc-2015-atomic-modesetting-for-drivers.html
>> http://blog.ffwll.ch/2015/08/atomic-modesetting-design-overview.html
>> - Use bridge instead of slave encoder to connect external HDMI.
>> - Move dt binding docs to bindings/display/hisilicon directory.
>>
>> Xinliang Liu (10):
>>   drm/hisilicon: Add device tree binding for hi6220 display subsystem
>>   drm/hisilicon: Add hisilicon kirin drm master driver
>>   drm/hisilicon: Add crtc driver for ADE
>>   drm/hisilicon: Add plane driver for ADE
>>   drm/hisilicon: Add vblank driver for ADE
>>   drm/hisilicon: Add cma fbdev and hotplug
>>   drm/hisilicon: Add designware dsi encoder driver
>>   drm/hisilicon: Add designware dsi host driver
>>   drm/hisilicon: Add support for external bridge
>>   MAINTAINERS: Add maintainer for hisilicon DRM driver
>>
>>  .../bindings/display/hisilicon/dw-dsi.txt  |   72 ++
>>  .../bindings/display/hisilicon/hisi-ade.txt|   64 ++
>>  MAINTAINERS|   10 +
>>  drivers/gpu/drm/Kconfig|2 +
>>  drivers/gpu/drm/Makefile   |1 +
>>  dr

[PATCH v8 10/10] MAINTAINERS: Add maintainer for hisilicon DRM driver

2016-04-11 Thread Xinliang Liu
Add maintainer and reviewer for hisilicon DRM driver.

v8: None.
v7: None.
v6: None.
v5: None.
v4:
- Add Chen Feng  as Designated reviewer.
v3: First version.

Signed-off-by: Xinliang Liu 
---
 MAINTAINERS | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 61a323a6b2cf..a2ef58860689 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3840,6 +3840,16 @@ S:   Maintained
 F: drivers/gpu/drm/gma500
 F: include/drm/gma500*

+DRM DRIVERS FOR HISILICON
+M: Xinliang Liu 
+R: Xinwei Kong 
+R: Chen Feng 
+L: dri-devel at lists.freedesktop.org
+T: git git://github.com/xin3liang/linux.git
+S: Maintained
+F: drivers/gpu/drm/hisilicon
+F: Documentation/devicetree/bindings/display/hisilicon
+
 DRM DRIVERS FOR NVIDIA TEGRA
 M: Thierry Reding 
 M: Terje Bergström 
-- 
2.8.0



[PATCH v8 09/10] drm/hisilicon: Add support for external bridge

2016-04-11 Thread Xinliang Liu
Add support for external HDMI bridge.

v8: None.
v7: None.
v6: None.
v5: None.
v4: None.
v3:
- Fix a typo: s/exteranl/external.
v2:
- Remove abtraction layer.

Signed-off-by: Xinliang Liu 
Signed-off-by: Xinwei Kong 
Reviewed-by: Archit Taneja 
---
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 52 
 1 file changed, 52 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c 
b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index ea7711832959..bfbc2159250d 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -80,6 +80,7 @@ struct dsi_hw_ctx {

 struct dw_dsi {
struct drm_encoder encoder;
+   struct drm_bridge *bridge;
struct mipi_dsi_host host;
struct drm_display_mode cur_mode;
struct dsi_hw_ctx *ctx;
@@ -700,6 +701,25 @@ static int dsi_host_init(struct device *dev, struct dw_dsi 
*dsi)
return 0;
 }

+static int dsi_bridge_init(struct drm_device *dev, struct dw_dsi *dsi)
+{
+   struct drm_encoder *encoder = >encoder;
+   struct drm_bridge *bridge = dsi->bridge;
+   int ret;
+
+   /* associate the bridge to dsi encoder */
+   encoder->bridge = bridge;
+   bridge->encoder = encoder;
+
+   ret = drm_bridge_attach(dev, bridge);
+   if (ret) {
+   DRM_ERROR("failed to attach external bridge\n");
+   return ret;
+   }
+
+   return 0;
+}
+
 static int dsi_bind(struct device *dev, struct device *master, void *data)
 {
struct dsi_data *ddata = dev_get_drvdata(dev);
@@ -715,6 +735,10 @@ static int dsi_bind(struct device *dev, struct device 
*master, void *data)
if (ret)
return ret;

+   ret = dsi_bridge_init(drm_dev, dsi);
+   if (ret)
+   return ret;
+
return 0;
 }

@@ -731,8 +755,36 @@ static const struct component_ops dsi_ops = {
 static int dsi_parse_dt(struct platform_device *pdev, struct dw_dsi *dsi)
 {
struct dsi_hw_ctx *ctx = dsi->ctx;
+   struct device_node *np = pdev->dev.of_node;
+   struct device_node *endpoint, *bridge_node;
+   struct drm_bridge *bridge;
struct resource *res;

+   /*
+* Get the endpoint node. In our case, dsi has one output port1
+* to which the external HDMI bridge is connected.
+*/
+   endpoint = of_graph_get_endpoint_by_regs(np, 1, -1);
+   if (!endpoint) {
+   DRM_ERROR("no valid endpoint node\n");
+   return -ENODEV;
+   }
+   of_node_put(endpoint);
+
+   bridge_node = of_graph_get_remote_port_parent(endpoint);
+   if (!bridge_node) {
+   DRM_ERROR("no valid bridge node\n");
+   return -ENODEV;
+   }
+   of_node_put(bridge_node);
+
+   bridge = of_drm_find_bridge(bridge_node);
+   if (!bridge) {
+   DRM_INFO("wait for external HDMI bridge driver.\n");
+   return -EPROBE_DEFER;
+   }
+   dsi->bridge = bridge;
+
ctx->pclk = devm_clk_get(>dev, "pclk");
if (IS_ERR(ctx->pclk)) {
DRM_ERROR("failed to get pclk clock\n");
-- 
2.8.0



[PATCH v8 08/10] drm/hisilicon: Add designware dsi host driver

2016-04-11 Thread Xinliang Liu
Add DesignWare dsi host driver for hi6220 SoC.

v8: None.
v7: None.
v6: None.
v5: None.
v4: None.
v3: None.
v2:
- Remove abtraction layer.

Signed-off-by: Xinliang Liu 
Signed-off-by: Xinwei Kong 
Reviewed-by: Archit Taneja 
---
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 50 
 1 file changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c 
b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index 1a930b77ec53..ea7711832959 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -80,6 +80,7 @@ struct dsi_hw_ctx {

 struct dw_dsi {
struct drm_encoder encoder;
+   struct mipi_dsi_host host;
struct drm_display_mode cur_mode;
struct dsi_hw_ctx *ctx;
struct mipi_phy_params phy;
@@ -654,6 +655,51 @@ static int dw_drm_encoder_init(struct device *dev,
return 0;
 }

+static int dsi_host_attach(struct mipi_dsi_host *host,
+  struct mipi_dsi_device *mdsi)
+{
+   struct dw_dsi *dsi = host_to_dsi(host);
+
+   if (mdsi->lanes < 1 || mdsi->lanes > 4) {
+   DRM_ERROR("dsi device params invalid\n");
+   return -EINVAL;
+   }
+
+   dsi->lanes = mdsi->lanes;
+   dsi->format = mdsi->format;
+   dsi->mode_flags = mdsi->mode_flags;
+
+   return 0;
+}
+
+static int dsi_host_detach(struct mipi_dsi_host *host,
+  struct mipi_dsi_device *mdsi)
+{
+   /* do nothing */
+   return 0;
+}
+
+static const struct mipi_dsi_host_ops dsi_host_ops = {
+   .attach = dsi_host_attach,
+   .detach = dsi_host_detach,
+};
+
+static int dsi_host_init(struct device *dev, struct dw_dsi *dsi)
+{
+   struct mipi_dsi_host *host = >host;
+   int ret;
+
+   host->dev = dev;
+   host->ops = _host_ops;
+   ret = mipi_dsi_host_register(host);
+   if (ret) {
+   DRM_ERROR("failed to register dsi host\n");
+   return ret;
+   }
+
+   return 0;
+}
+
 static int dsi_bind(struct device *dev, struct device *master, void *data)
 {
struct dsi_data *ddata = dev_get_drvdata(dev);
@@ -665,6 +711,10 @@ static int dsi_bind(struct device *dev, struct device 
*master, void *data)
if (ret)
return ret;

+   ret = dsi_host_init(dev, dsi);
+   if (ret)
+   return ret;
+
return 0;
 }

-- 
2.8.0



  1   2   3   >