[PATCH 1/7] drm/hisilicon:Add hisilicon hibmc master driver.

2016-03-09 Thread Emil Velikov
Hi Rongrong Zou,

With the next revision sent out, I've missed out that you had
questions in here :-)

>> On 29 February 2016 at 00:58, lijianhua  wrote:
>>> +static struct drm_driver hibmc_driver = {

>>> +   .date   = "20151218",
>>
>> Afaict this date is mostly unused, then again it's quite off :-)
>
> Do you mean i should better remove this property?
>
Just update it ? Then again many other drivers haven't updated theirs,
in a long time so I'm not sure how useful the .date field is to begin
with.
Ah, yes. It serves mostly to be send back to userspace via the
DRM_VERSION ioctl.

If we were to break the ABI, this is one of the things that will go :-)

>>> +static int 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_private *hiprivate = drm_dev->dev_private;
>>> +
>>> +   drm_helper_resume_force_mode(drm_dev);
>>> +
>>> +   if (hiprivate->fbdev.initialized) {
>>> +   console_lock();
>>> +   fb_set_suspend(hiprivate->fbdev.helper.fbdev, 0);
These should be using the drm fb helpers from Archit - see commit
0843010bbd6 "drm/virtio: Use new drm_fb_helper functions" and alike.

Which brings the question:

Archit,
Is it too much to ask to create a cocci script for the fb helper
refactoring ? One that warns/updates cases that are using the fb
functions directly, as opposed to the helper. Otherwise things are
bound to get confused. Like in the radeon driver, which uses both fb
and the helper.

I believe that one should even remove the relevant select statements
from the driver Kconfigs (FB_CFB* and FB_SYS*), correct ?

Just a humble request, thanks.

>>> --- /dev/null
>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h

>>> +/* Vendor and Device id for HISILICON Graphics chip*/
>>> +#define PCI_VENDOR_ID_HIS 0x19e5
>>> +#define PCI_DEVID_HS_VGA 0x1711
>>> +
>
> I wonder where to place the 2 macros, any suggusetions, thanks.
>
include/linux/pci_ids.h looks like the place ?

Personally, I think that the above can be done with follow up patches.
Then again it's not my call to make.

Thanks
Emil


[PATCH 1/7] drm/hisilicon:Add hisilicon hibmc master driver.

2016-03-01 Thread Rongrong Zou
Hi, Emil

Thanks for reviewing this path.
在 2016/2/29 17:40, Emil Velikov 写道:
> On 29 February 2016 at 00:58, lijianhua  wrote:
>> Add hibmc DRM master driver for hi1710 which used in arm64 board.
>>
> Would be nice to give examples of what "arm64 board" this hardware is
> presently available. Some information about the device as seen in the
> cover letter, and/or a link to the cover letter would be nice to have.
>
Apply ,Will be fixed in next version.thanks!

>> Signed-off-by: lijianhua 
>> ---
>>   drivers/gpu/drm/Kconfig |   2 +
>>   drivers/gpu/drm/Makefile|   1 +
>>   drivers/gpu/drm/hisilicon/Kconfig   |   4 +
>>   drivers/gpu/drm/hisilicon/Makefile  |   4 +
>>   drivers/gpu/drm/hisilicon/hibmc/Kconfig |  13 +
>>   drivers/gpu/drm/hisilicon/hibmc/Makefile|   5 +
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 301 +++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  49 +++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.c  |  83 
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.h  | 484 
>> 
>>   10 files changed, 946 insertions(+)
>>   create mode 100644 drivers/gpu/drm/hisilicon/Kconfig
>>   create mode 100644 drivers/gpu/drm/hisilicon/Makefile
>>   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_drv.c
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.c
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.h
>>
>> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
>> index 8ae7ab6..600f94d 100644
>> --- a/drivers/gpu/drm/Kconfig
>> +++ b/drivers/gpu/drm/Kconfig
>> @@ -269,3 +269,5 @@ source "drivers/gpu/drm/imx/Kconfig"
>>   source "drivers/gpu/drm/vc4/Kconfig"
>>
>>   source "drivers/gpu/drm/etnaviv/Kconfig"
>> +
>> +source "drivers/gpu/drm/hisilicon/Kconfig"
>> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
>> index 61766de..6055483 100644
>> --- a/drivers/gpu/drm/Makefile
>> +++ b/drivers/gpu/drm/Makefile
>> @@ -74,3 +74,4 @@ obj-y += panel/
>>   obj-y  += bridge/
>>   obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
>>   obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
>> +obj-y  += hisilicon/
>> diff --git a/drivers/gpu/drm/hisilicon/Kconfig 
>> b/drivers/gpu/drm/hisilicon/Kconfig
>> new file mode 100644
>> index 000..1f10e17
>> --- /dev/null
>> +++ b/drivers/gpu/drm/hisilicon/Kconfig
>> @@ -0,0 +1,4 @@
>> +# hisilicon drm device configuration.
>> +# Please keep this sorted alphabetically.
>> +
>> +source "drivers/gpu/drm/hisilicon/hibmc/Kconfig"
>> diff --git a/drivers/gpu/drm/hisilicon/Makefile 
>> b/drivers/gpu/drm/hisilicon/Makefile
>> new file mode 100644
>> index 000..487d5b0
>> --- /dev/null
>> +++ b/drivers/gpu/drm/hisilicon/Makefile
>> @@ -0,0 +1,4 @@
>> +# Makefile for hisilicon drm drivers.
>> +# Please keep this list sorted alphabetically
>> +
>> +obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc/
>> \ No newline at end of file
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Kconfig 
>> b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
>> new file mode 100644
>> index 000..c60ace6
>> --- /dev/null
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
>> @@ -0,0 +1,13 @@
>> +config DRM_HISI_HIBMC
>> +   tristate "DRM Support for hisilicon hibmc dispi vga interface"
> Use proper capitalisation in the above ? Is the driver copied/derived
> from bochs - the above does not sounds right.

Apply ,Will be fixed in next version.thanks!

>
>> +   depends on DRM && PCI
>> +   select DRM_KMS_HELPER
>> +   select DRM_KMS_FB_HELPER
>> +   select DRM_GEM_CMA_HELPER
>> +   select DRM_KMS_CMA_HELPER
>> +   select FB_SYS_FILLRECT
>> +   select FB_SYS_COPYAREA
>> +   select FB_SYS_IMAGEBLIT
>> +   help
>> + Choose this option for qemu.
> Err what - too much copy/pasta ?

Apply ,thanks!

>
>> + 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..28e59bb
>> --- /dev/null
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
>> @@ -0,0 +1,5 @@
>> +ccflags-y := -Iinclude/drm
> Based on the includes in hibmc_drm_drv.c the above include isn't needed.

Apply ,thanks!
>
>> +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_hw.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..444ced8
>> --- /dev/null
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> @@ -0,0 +1,301 @@
>> +/*
>> + * Copyright 

[PATCH 1/7] drm/hisilicon:Add hisilicon hibmc master driver.

2016-02-29 Thread Emil Velikov
On 29 February 2016 at 00:58, lijianhua  wrote:
> Add hibmc DRM master driver for hi1710 which used in arm64 board.
>
Would be nice to give examples of what "arm64 board" this hardware is
presently available. Some information about the device as seen in the
cover letter, and/or a link to the cover letter would be nice to have.

> Signed-off-by: lijianhua 
> ---
>  drivers/gpu/drm/Kconfig |   2 +
>  drivers/gpu/drm/Makefile|   1 +
>  drivers/gpu/drm/hisilicon/Kconfig   |   4 +
>  drivers/gpu/drm/hisilicon/Makefile  |   4 +
>  drivers/gpu/drm/hisilicon/hibmc/Kconfig |  13 +
>  drivers/gpu/drm/hisilicon/hibmc/Makefile|   5 +
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 301 +++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  49 +++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.c  |  83 
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.h  | 484 
> 
>  10 files changed, 946 insertions(+)
>  create mode 100644 drivers/gpu/drm/hisilicon/Kconfig
>  create mode 100644 drivers/gpu/drm/hisilicon/Makefile
>  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_drv.c
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.c
>  create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.h
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 8ae7ab6..600f94d 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -269,3 +269,5 @@ source "drivers/gpu/drm/imx/Kconfig"
>  source "drivers/gpu/drm/vc4/Kconfig"
>
>  source "drivers/gpu/drm/etnaviv/Kconfig"
> +
> +source "drivers/gpu/drm/hisilicon/Kconfig"
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 61766de..6055483 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -74,3 +74,4 @@ obj-y += panel/
>  obj-y  += bridge/
>  obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
>  obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
> +obj-y  += hisilicon/
> diff --git a/drivers/gpu/drm/hisilicon/Kconfig 
> b/drivers/gpu/drm/hisilicon/Kconfig
> new file mode 100644
> index 000..1f10e17
> --- /dev/null
> +++ b/drivers/gpu/drm/hisilicon/Kconfig
> @@ -0,0 +1,4 @@
> +# hisilicon drm device configuration.
> +# Please keep this sorted alphabetically.
> +
> +source "drivers/gpu/drm/hisilicon/hibmc/Kconfig"
> diff --git a/drivers/gpu/drm/hisilicon/Makefile 
> b/drivers/gpu/drm/hisilicon/Makefile
> new file mode 100644
> index 000..487d5b0
> --- /dev/null
> +++ b/drivers/gpu/drm/hisilicon/Makefile
> @@ -0,0 +1,4 @@
> +# Makefile for hisilicon drm drivers.
> +# Please keep this list sorted alphabetically
> +
> +obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc/
> \ No newline at end of file
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Kconfig 
> b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
> new file mode 100644
> index 000..c60ace6
> --- /dev/null
> +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
> @@ -0,0 +1,13 @@
> +config DRM_HISI_HIBMC
> +   tristate "DRM Support for hisilicon hibmc dispi vga interface"
Use proper capitalisation in the above ? Is the driver copied/derived
from bochs - the above does not sounds right.

> +   depends on DRM && PCI
> +   select DRM_KMS_HELPER
> +   select DRM_KMS_FB_HELPER
> +   select DRM_GEM_CMA_HELPER
> +   select DRM_KMS_CMA_HELPER
> +   select FB_SYS_FILLRECT
> +   select FB_SYS_COPYAREA
> +   select FB_SYS_IMAGEBLIT
> +   help
> + Choose this option for qemu.
Err what - too much copy/pasta ?

> + 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..28e59bb
> --- /dev/null
> +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
> @@ -0,0 +1,5 @@
> +ccflags-y := -Iinclude/drm
Based on the includes in hibmc_drm_drv.c the above include isn't needed.

> +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_hw.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..444ced8
> --- /dev/null
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -0,0 +1,301 @@
> +/*
> + * Copyright (c) 2016 Huawei Limited.
> + *
> + * 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

[PATCH 1/7] drm/hisilicon:Add hisilicon hibmc master driver.

2016-02-29 Thread lijianhua
Add hibmc DRM master driver for hi1710 which used in arm64 board.

Signed-off-by: lijianhua 
---
 drivers/gpu/drm/Kconfig |   2 +
 drivers/gpu/drm/Makefile|   1 +
 drivers/gpu/drm/hisilicon/Kconfig   |   4 +
 drivers/gpu/drm/hisilicon/Makefile  |   4 +
 drivers/gpu/drm/hisilicon/hibmc/Kconfig |  13 +
 drivers/gpu/drm/hisilicon/hibmc/Makefile|   5 +
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 301 +++
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  49 +++
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.c  |  83 
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.h  | 484 
 10 files changed, 946 insertions(+)
 create mode 100644 drivers/gpu/drm/hisilicon/Kconfig
 create mode 100644 drivers/gpu/drm/hisilicon/Makefile
 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_drv.c
 create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
 create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.c
 create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_hw.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 8ae7ab6..600f94d 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -269,3 +269,5 @@ source "drivers/gpu/drm/imx/Kconfig"
 source "drivers/gpu/drm/vc4/Kconfig"

 source "drivers/gpu/drm/etnaviv/Kconfig"
+
+source "drivers/gpu/drm/hisilicon/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 61766de..6055483 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -74,3 +74,4 @@ obj-y += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
+obj-y  += hisilicon/
diff --git a/drivers/gpu/drm/hisilicon/Kconfig 
b/drivers/gpu/drm/hisilicon/Kconfig
new file mode 100644
index 000..1f10e17
--- /dev/null
+++ b/drivers/gpu/drm/hisilicon/Kconfig
@@ -0,0 +1,4 @@
+# hisilicon drm device configuration.
+# Please keep this sorted alphabetically.
+
+source "drivers/gpu/drm/hisilicon/hibmc/Kconfig"
diff --git a/drivers/gpu/drm/hisilicon/Makefile 
b/drivers/gpu/drm/hisilicon/Makefile
new file mode 100644
index 000..487d5b0
--- /dev/null
+++ b/drivers/gpu/drm/hisilicon/Makefile
@@ -0,0 +1,4 @@
+# Makefile for hisilicon drm drivers.
+# Please keep this list sorted alphabetically
+
+obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc/
\ No newline at end of file
diff --git a/drivers/gpu/drm/hisilicon/hibmc/Kconfig 
b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
new file mode 100644
index 000..c60ace6
--- /dev/null
+++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
@@ -0,0 +1,13 @@
+config DRM_HISI_HIBMC
+   tristate "DRM Support for hisilicon hibmc dispi vga interface"
+   depends on DRM && PCI
+   select DRM_KMS_HELPER
+   select DRM_KMS_FB_HELPER
+   select DRM_GEM_CMA_HELPER
+   select DRM_KMS_CMA_HELPER
+   select FB_SYS_FILLRECT
+   select FB_SYS_COPYAREA
+   select FB_SYS_IMAGEBLIT
+   help
+ Choose this option for qemu.
+ 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..28e59bb
--- /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_hw.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..444ced8
--- /dev/null
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2016 Huawei Limited.
+ *
+ * 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 
+
+#include "hibmc_drm_drv.h"
+#include "hibmc_drm_hw.h"
+
+unsigned char __iomem *mmio_bmc_vga;
+
+static const struct file_operations hibmc_fops = {
+   .owner  = THIS_MODULE,
+   .open   = drm_open,
+   .release= drm_release,
+   .unlocked_ioctl = drm_ioctl,
+#ifdef CONFIG_COMPAT
+   .compat_ioctl   = drm_compat_ioctl,
+#endif
+   .poll   = drm_poll,
+   .read   = drm_read,
+   .llseek = no_llseek,
+};
+
+int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe)
+{
+   return 0;
+}
+
+void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe)
+{
+}
+
+static struct drm_driver