drm: Add support of ARC PGU display controller
Subsystems (6)
v5 cover drm: Add support of ARC PGU display controller
This series add support of ARC PGU display controller.
ARC PGU is a quite simple byte streamer that gets data from the framebuffer and pushes it to hte connected encoder (DP or HDMI).
It was tested on ARC SDP boards (axs101/103 in particular).
Note following series that introduces drm_connector_register_all()/drm_connector_unregister_all() is a prerequisite
now: https://lkml.org/lkml/2016/3/23/61
Changes v4 -> v5:
* Removed encode node from DT bindings example (as suggested by Rob)
Changes v3 -> v4:
* Main driver author is now set properly (thanks Carlos for all your efforts)
* Implemented correct hsync and vsync setup (thanks Jose)
* Dummy call-backs were removed (as suggested by Daniel)
* Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
* With above in mind we were able to adopt recently introduced drm_connector_register_all()/drm_connector_unregister_all()
* Implemented setup of properties (uncached) for FB user-pages
* Minor clean-up in DT binding docs and axs10x_mb.dtsi
Changes v2 -> v3:
* Improved failure path if arcpgu_connector wasn't allocated.
* Fixed driver building as module.
* Implemented uncached mapping of user-space FB pages.
* Again updated DT bindings docs.
Changes v1 -> v2:
* Clean-up of DT bindings documentation.
* Added missing "pxlclk" clock in axs10x_mb.dtsi.
Alexey Brodkin (4):
drm: Add DT bindings documentation for ARC PGU display controller
MAINTAINERS: Add maintainer for ARC PGU display controller
arc: Add our own implementation of fb_pgprotect()
arc: axs10x - add support of ARC PGU
Carlos Palminha (1):
drm: Add support of ARC PGU display controller
.../devicetree/bindings/display/snps,arcpgu.txt | 35 +++ MAINTAINERS | 6 + arch/arc/boot/dts/axs10x_mb.dtsi | 61 +++++ arch/arc/include/asm/fb.h | 19 ++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/arc/Kconfig | 10 + drivers/gpu/drm/arc/Makefile | 2 + drivers/gpu/drm/arc/arcpgu.h | 50 ++++ drivers/gpu/drm/arc/arcpgu_crtc.c | 257 +++++++++++++++++++ drivers/gpu/drm/arc/arcpgu_drv.c | 282 +++++++++++++++++++++ drivers/gpu/drm/arc/arcpgu_hdmi.c | 201 +++++++++++++++ drivers/gpu/drm/arc/arcpgu_regs.h | 40 +++ 13 files changed, 966 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt create mode 100644 arch/arc/include/asm/fb.h create mode 100644 drivers/gpu/drm/arc/Kconfig create mode 100644 drivers/gpu/drm/arc/Makefile create mode 100644 drivers/gpu/drm/arc/arcpgu.h create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h
Signature · 6 lines
2.5.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 1/5 drm: Add support of ARC PGU display controller
From: Carlos Palminha <[email protected]>
ARC PGU could be found on some development boards from Synopsys. This is a simple byte streamer that reads data from a framebuffer and sends data to the single encoder.
---
Note following series that introduces drm_connector_register_all()/drm_connector_unregister_all() is a prerequisite
now: https://lkml.org/lkml/2016/3/23/61
No changes v4 -> v5.
Changes v3 -> v4:
* The driver author is now set properly (thanks Carlos for all your efforts)
* Implemented correct hsync and vsync setup (thanks Jose)
* Dummy call-backs were removed (as suggested by Daniel)
* Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
* With above in mind we were able to adopt recently introduced drm_connector_register_all()/drm_connector_unregister_all()
Changes v2 -> v3:
* Improved failure path if arcpgu_connector wasn't allocated (thanks Jose).
* Fixed driver building as module (reported by 0-DAY kernel test infrastruct.)
* Implemented uncached mapping of user-space FB pages.
No changes v1 -> v2.
drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/arc/Kconfig | 10 ++ drivers/gpu/drm/arc/Makefile | 2 + drivers/gpu/drm/arc/arcpgu.h | 50 +++++++ drivers/gpu/drm/arc/arcpgu_crtc.c | 257 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/arc/arcpgu_drv.c | 282 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/arc/arcpgu_hdmi.c | 201 +++++++++++++++++++++++++++ drivers/gpu/drm/arc/arcpgu_regs.h | 40 ++++++ 9 files changed, 845 insertions(+) create mode 100644 drivers/gpu/drm/arc/Kconfig create mode 100644 drivers/gpu/drm/arc/Makefile create mode 100644 drivers/gpu/drm/arc/arcpgu.h create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h
drivers/gpu/drm/Kconfig +2 -0
@@ -281,3 +281,5 @@ source "drivers/gpu/drm/imx/Kconfig" source "drivers/gpu/drm/vc4/Kconfig" source "drivers/gpu/drm/etnaviv/Kconfig" + +source "drivers/gpu/drm/arc/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -78,3 +78,4 @@ obj-y += panel/ obj-y += bridge/ obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/ obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/ +obj-$(CONFIG_DRM_ARCPGU)+= arc/
drivers/gpu/drm/arc/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +config DRM_ARCPGU + tristate "ARC PGU" + depends on DRM && OF + select DRM_KMS_CMA_HELPER + select DRM_KMS_FB_HELPER + select DRM_KMS_HELPER + help + Choose this option if you have an ARC PGU controller. + + If M is selected the module will be called arcpgu.
drivers/gpu/drm/arc/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o +obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
drivers/gpu/drm/arc/arcpgu.h new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/arc/arcpgu_crtc.c new file +257 -0
257 lines not on this page · raw message
drivers/gpu/drm/arc/arcpgu_drv.c new file +282 -0
282 lines not on this page · raw message
drivers/gpu/drm/arc/arcpgu_hdmi.c new file +201 -0
201 lines not on this page · raw message
drivers/gpu/drm/arc/arcpgu_regs.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* ARC PGU DRM driver. +* +* Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#ifndef _ARC_PGU_REGS_H_ +#define _ARC_PGU_REGS_H_ + +#define ARCPGU_REG_CTRL 0x00 +#define ARCPGU_REG_STAT 0x04 +#define ARCPGU_REG_FMT 0x10 +#define ARCPGU_REG_HSYNC 0x14 +#define ARCPGU_REG_VSYNC 0x18 +#define ARCPGU_REG_ACTIVE 0x1c +#define ARCPGU_REG_BUF0_ADDR 0x40 +#define ARCPGU_REG_STRIDE 0x50 +#define ARCPGU_REG_START_SET 0x84 + +#define ARCPGU_REG_ID 0x3FC + +#define ARCPGU_CTRL_ENABLE_MASK 0x02 +#define ARCPGU_CTRL_VS_POL_MASK 0x1 +#define ARCPGU_CTRL_VS_POL_OFST 0x3 +#define ARCPGU_CTRL_HS_POL_MASK 0x1 +#define ARCPGU_CTRL_HS_POL_OFST 0x4 +#define ARCPGU_MODE_RGB888_MASK 0x04 +#define ARCPGU_STAT_BUSY_MASK 0x02 + +#endif
Signature · 1 line
2.5.0
kbuild test robot
build botreproduce:
Hi Carlos,
[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.6-rc1 next-20160401]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Alexey-Brodkin/drm-Add-support-of-ARC-PGU-display-controller/20160328-194009 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: x86_64-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/gpu/drm/arc/arcpgu_drv.c: In function 'arcpgu_probe':
>> drivers/gpu/drm/arc/arcpgu_drv.c:232:8: error: implicit declaration of function 'drm_connector_register_all' [-Werror=implicit-function-declaration]
ret = drm_connector_register_all(drm);
^
drivers/gpu/drm/arc/arcpgu_drv.c: In function 'arcpgu_remove':
drivers/gpu/drm/arc/arcpgu_drv.c:254:2: error: implicit declaration of function 'drm_connector_unregister_all' [-Werror=implicit-function-declaration]
drm_connector_unregister_all(drm);
^cc1: some warnings being treated as errors
vim +/drm_connector_register_all +232 drivers/gpu/drm/arc/arcpgu_drv.c
226 goto err_unref;
227
228 ret = drm_dev_register(drm, 0);
229 if (ret)
230 goto err_unload;
231
> 232 ret = drm_connector_register_all(drm);
233 if (ret)
234 goto err_unregister;
235
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 53176 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-snps-arc/attachments/20160403/7301c9f0/attachment-0001.obj>
PATCH v5 2/5 drm: Add DT bindings documentation for ARC PGU display controller
In reply to Alexey BrodkinThis add DT bindings documentation for ARC PGU display controller.
---
Changes v4 -> v5: (addressing Rob's comment)
* Added Rob's acked-by
* Remove "encoder-slave" from the example as well. Now only "pgu" node is mentioned in the example.
Changes v3 -> v4: (addressing Rob's comments)
* Removed "encoder-slave" from required properties
* Removed "0x" from node names
Changes v2 -> v3:
* Reverted back to initial larger version of example with minor fixes (thanks Rob for spotting those).
Changes v1 -> v2:
* Removed everything except PGU node itself.
.../devicetree/bindings/display/snps,arcpgu.txt | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt
Documentation/devicetree/bindings/display/snps,arcpgu.txt new file +35 -0
@@ -0,0 +1,35 @@ +ARC PGU + +This is a display controller found on several development boards produced +by Synopsys. The ARC PGU is an RGB streamer that reads the data from a +framebuffer and sends it to a single digital encoder (usually HDMI). + +Required properties: + - compatible: "snps,arcpgu" + - reg: Physical base address and length of the controller's registers. + - clocks: A list of phandle + clock-specifier pairs, one for each + entry in 'clock-names'. + - clock-names: A list of clock names. For ARC PGU it should contain: + - "pxlclk" for the clock feeding the output PLL of the controller. + +Required sub-nodes: + - port: The PGU connection to an encoder chip. + +Example: + +/ { + ... + + pgu@XXXXXXXX { + compatible = "snps,arcpgu"; + reg = <0xXXXXXXXX 0x400>; + clocks = <&clock_node>; + clock-names = "pxlclk"; + + port { + pgu_output: endpoint { + remote-endpoint = <&hdmi_enc_input>; + }; + }; + }; +};
Signature · 1 line
2.5.0
PATCH v5 3/5 MAINTAINERS: Add maintainer for ARC PGU display controller
In reply to Alexey BrodkinThis updates MAINTEINERS file with information about maintainer of ARC PGU display controller driver.
---
No changes v4 -> v5.
No changes v3 -> v4.
No changes v2 -> v3.
No changes v1 -> v2.
MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -827,6 +827,12 @@ S: Maintained F: drivers/net/arcnet/ F: include/uapi/linux/if_arcnet.h +ARC PGU DRM DRIVER +M: Alexey Brodkin <[email protected]> +S: Supported +F: drivers/gpu/drm/arc/ +F: Documentation/devicetree/bindings/display/snps,arcpgu.txt + ARM HDLCD DRM DRIVER M: Liviu Dudau <[email protected]> S: Supported
Signature · 1 line
2.5.0
PATCH v5 4/5 arc: Add our own implementation of fb_pgprotect()
In reply to Alexey BrodkinDuring mmaping of frame-buffer pages to user-space fb_protect() is called to set proper page settings.
In case of ARC we need to mark pages that are mmaped to user as uncached because of 2 reasons:
* Huge amount of data if passing through data cache will thrash cache a lot making cache almost useless for other less traffic hungry processes.
* Data written by user in FB will be immediately available for hardware (such as PGU etc) without requirements to flush data cache regularly.
---
No changes v4 -> v5.
Changes v3 -> v4:
* This change was introduced only in v4.
arch/arc/include/asm/fb.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 arch/arc/include/asm/fb.h
arch/arc/include/asm/fb.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef _ASM_FB_H_ +#define _ASM_FB_H_ + +#include <linux/fb.h> +#include <linux/fs.h> +#include <asm/page.h> + +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma, +unsigned long off) +{ + vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); +} + +static inline int fb_is_primary_device (struct fb_info *info) +{ +return 0 ; +} + +#endif /* _ASM_FB_H_ */
Signature · 1 line
2.5.0
RE: [PATCH 4/5 v5] arc: Add our own implementation of fb_pgprotect()
Hi Vineet,
Quoted 18 lines
From: Alexey Brodkin [[email protected]]
Sent: Monday, March 28, 2016 2:36 PM
To: [email protected]
Cc: [email protected]; Alexey Brodkin; Vineet Gupta; [email protected]
Subject: [PATCH 4/5 v5] arc: Add our own implementation offb_pgprotect()During mmaping of frame-buffer pages to user-space
fb_protect()is called to set proper page settings.In case of ARC we need to mark pages that are mmaped to user as uncached because of 2 reasons:
* Huge amount of data if passing through data cache will thrash cache a lot making cache almost useless for other less traffic hungry processes.
* Data written by user in FB will be immediately available for hardware (such as PGU etc) without requirements to flush data cache regularly.
Quoted 3 lines
Signed-off-by Alexey Brodkin <[email protected]>Cc Vineet Gupta <[email protected]>
Could you please pick up this patch in your tree so in DRM-related series won't be external dependencies any longer?
-Alexey
PATCH v5 5/5 arc: axs10x - add support of ARC PGU
In reply to Alexey BrodkinSynopsys DesignWare ARC SDP boards sport ARC SDP display controller attached to ADV7511 HDMI encoder.
That change adds desctiption of both ARC PGU and ADV7511 in ARC SDP'd base-board Device Tree.
---
No changes v4 -> v5.
Changes v3 -> v4:
* Removed "0x" from node names (as suggested by Rob)
No changes v2 -> v3.
Changes v1 -> v2:
* Added missing "pxlclk" clock in axs10x_mb.dtsi
arch/arc/boot/dts/axs10x_mb.dtsi | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
arch/arc/boot/dts/axs10x_mb.dtsi +61 -0
@@ -34,6 +34,12 @@ clock-frequency = <50000000>; #clock-cells = <0>; }; + + pguclk: pguclk { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <74440000>; + }; }; ethernet@0x18000 {
@@ -147,6 +153,37 @@ clocks = <&i2cclk>; interrupts = <16>; + adv7511:adv7511@39{ + compatible="adi,adv7511"; + reg = <0x39>; + interrupts = <23>; + adi,input-depth = <8>; + adi,input-colorspace = "rgb"; + adi,input-clock = "1x"; + adi,clock-delay = <0x03>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + /* RGB/YUV input */ + port@0 { + reg = <0>; + adv7511_input:endpoint { + remote-endpoint = <&pgu_output>; + }; + }; + + /* HDMI output */ + port@1 { + reg = <1>; + adv7511_output: endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + }; + eeprom@0x54{ compatible = "24c01"; reg = <0x54>;
@@ -160,6 +197,16 @@ }; }; + hdmi0: connector { + compatible = "hdmi-connector"; + type = "a"; + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&adv7511_output>; + }; + }; + }; + gpio0:gpio@13000 { compatible = "snps,dw-apb-gpio"; reg = <0x13000 0x1000>;
@@ -221,5 +268,19 @@ reg = <2>; }; }; + + pgu@17000 { + compatible = "snps,arcpgu"; + reg = <0x17000 0x400>; + encoder-slave = <&adv7511>; + clocks = <&pguclk>; + clock-names = "pxlclk"; + + port { + pgu_output: endpoint { + remote-endpoint = <&adv7511_input>; + }; + }; + }; }; };
Signature · 1 line
2.5.0