diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-14 00:32:46 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-14 00:32:46 -0400 |
commit | 27287abb442999810eb15cd3ea35a790dd3f9c63 (patch) | |
tree | 47c5c5862ae5286a0d3cdb7db6786dc0a35e9993 | |
parent | 3c85f20a289d044f303f473ee6ab7502303fc3b0 (diff) | |
parent | 830c6578481e3b8649261062dfc5b0ac3c9374f8 (diff) |
Merge branch 'topic-arcpgu-sim' of https://github.com/foss-for-synopsys-dwc-arc-processors/linux into drm-next
Add support for arcgpu on the sim platform.
* 'topic-arcpgu-sim' of https://github.com/foss-for-synopsys-dwc-arc-processors/linux:
ARC: [nsimosci] Enable ARC PGU on nSIM OSCI virtual platforms
ARCv2: [vdk] Enable ARC PGU on HS38 VDK
drm/arcpgu: Make ARC PGU usable on simulation platforms
-rw-r--r-- | arch/arc/boot/dts/nsimosci.dts | 14 | ||||
-rw-r--r-- | arch/arc/boot/dts/nsimosci_hs.dts | 14 | ||||
-rw-r--r-- | arch/arc/boot/dts/nsimosci_hs_idu.dts | 14 | ||||
-rw-r--r-- | arch/arc/boot/dts/vdk_axs10x_mb.dtsi | 13 | ||||
-rw-r--r-- | arch/arc/boot/dts/vdk_hs38_smp.dts | 2 | ||||
-rw-r--r-- | arch/arc/configs/nsimosci_defconfig | 3 | ||||
-rw-r--r-- | arch/arc/configs/nsimosci_hs_defconfig | 3 | ||||
-rw-r--r-- | arch/arc/configs/nsimosci_hs_smp_defconfig | 3 | ||||
-rw-r--r-- | arch/arc/configs/vdk_hs38_smp_defconfig | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/arc/Makefile | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/arc/arcpgu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/arc/arcpgu_drv.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/arc/arcpgu_sim.c | 128 |
13 files changed, 189 insertions, 30 deletions
diff --git a/arch/arc/boot/dts/nsimosci.dts b/arch/arc/boot/dts/nsimosci.dts index b5b060adce8a..37c416defe90 100644 --- a/arch/arc/boot/dts/nsimosci.dts +++ b/arch/arc/boot/dts/nsimosci.dts | |||
@@ -20,7 +20,7 @@ | |||
20 | /* this is for console on PGU */ | 20 | /* this is for console on PGU */ |
21 | /* bootargs = "console=tty0 consoleblank=0"; */ | 21 | /* bootargs = "console=tty0 consoleblank=0"; */ |
22 | /* this is for console on serial */ | 22 | /* this is for console on serial */ |
23 | bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug"; | 23 | bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug video=640x480-24"; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | aliases { | 26 | aliases { |
@@ -58,9 +58,17 @@ | |||
58 | no-loopback-test = <1>; | 58 | no-loopback-test = <1>; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | pgu0: pgu@f9000000 { | 61 | pguclk: pguclk { |
62 | compatible = "snps,arcpgufb"; | 62 | #clock-cells = <0>; |
63 | compatible = "fixed-clock"; | ||
64 | clock-frequency = <25175000>; | ||
65 | }; | ||
66 | |||
67 | pgu@f9000000 { | ||
68 | compatible = "snps,arcpgu"; | ||
63 | reg = <0xf9000000 0x400>; | 69 | reg = <0xf9000000 0x400>; |
70 | clocks = <&pguclk>; | ||
71 | clock-names = "pxlclk"; | ||
64 | }; | 72 | }; |
65 | 73 | ||
66 | ps2: ps2@f9001000 { | 74 | ps2: ps2@f9001000 { |
diff --git a/arch/arc/boot/dts/nsimosci_hs.dts b/arch/arc/boot/dts/nsimosci_hs.dts index 325e73090a18..f2a22c49541d 100644 --- a/arch/arc/boot/dts/nsimosci_hs.dts +++ b/arch/arc/boot/dts/nsimosci_hs.dts | |||
@@ -20,7 +20,7 @@ | |||
20 | /* this is for console on PGU */ | 20 | /* this is for console on PGU */ |
21 | /* bootargs = "console=tty0 consoleblank=0"; */ | 21 | /* bootargs = "console=tty0 consoleblank=0"; */ |
22 | /* this is for console on serial */ | 22 | /* this is for console on serial */ |
23 | bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug"; | 23 | bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug video=640x480-24"; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | aliases { | 26 | aliases { |
@@ -58,9 +58,17 @@ | |||
58 | no-loopback-test = <1>; | 58 | no-loopback-test = <1>; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | pgu0: pgu@f9000000 { | 61 | pguclk: pguclk { |
62 | compatible = "snps,arcpgufb"; | 62 | #clock-cells = <0>; |
63 | compatible = "fixed-clock"; | ||
64 | clock-frequency = <25175000>; | ||
65 | }; | ||
66 | |||
67 | pgu@f9000000 { | ||
68 | compatible = "snps,arcpgu"; | ||
63 | reg = <0xf9000000 0x400>; | 69 | reg = <0xf9000000 0x400>; |
70 | clocks = <&pguclk>; | ||
71 | clock-names = "pxlclk"; | ||
64 | }; | 72 | }; |
65 | 73 | ||
66 | ps2: ps2@f9001000 { | 74 | ps2: ps2@f9001000 { |
diff --git a/arch/arc/boot/dts/nsimosci_hs_idu.dts b/arch/arc/boot/dts/nsimosci_hs_idu.dts index ee03d7126581..34457a5e7706 100644 --- a/arch/arc/boot/dts/nsimosci_hs_idu.dts +++ b/arch/arc/boot/dts/nsimosci_hs_idu.dts | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | chosen { | 19 | chosen { |
20 | /* this is for console on serial */ | 20 | /* this is for console on serial */ |
21 | bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblan=0 debug"; | 21 | bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblan=0 debug video=640x480-24"; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | aliases { | 24 | aliases { |
@@ -77,9 +77,17 @@ | |||
77 | no-loopback-test = <1>; | 77 | no-loopback-test = <1>; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | pgu0: pgu@f9000000 { | 80 | pguclk: pguclk { |
81 | compatible = "snps,arcpgufb"; | 81 | #clock-cells = <0>; |
82 | compatible = "fixed-clock"; | ||
83 | clock-frequency = <25175000>; | ||
84 | }; | ||
85 | |||
86 | pgu@f9000000 { | ||
87 | compatible = "snps,arcpgu"; | ||
82 | reg = <0xf9000000 0x400>; | 88 | reg = <0xf9000000 0x400>; |
89 | clocks = <&pguclk>; | ||
90 | clock-names = "pxlclk"; | ||
83 | }; | 91 | }; |
84 | 92 | ||
85 | ps2: ps2@f9001000 { | 93 | ps2: ps2@f9001000 { |
diff --git a/arch/arc/boot/dts/vdk_axs10x_mb.dtsi b/arch/arc/boot/dts/vdk_axs10x_mb.dtsi index 45cd665fca23..99498a4b4216 100644 --- a/arch/arc/boot/dts/vdk_axs10x_mb.dtsi +++ b/arch/arc/boot/dts/vdk_axs10x_mb.dtsi | |||
@@ -23,6 +23,11 @@ | |||
23 | #clock-cells = <0>; | 23 | #clock-cells = <0>; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | pguclk: pguclk { | ||
27 | #clock-cells = <0>; | ||
28 | compatible = "fixed-clock"; | ||
29 | clock-frequency = <25175000>; | ||
30 | }; | ||
26 | }; | 31 | }; |
27 | 32 | ||
28 | ethernet@0x18000 { | 33 | ethernet@0x18000 { |
@@ -75,11 +80,11 @@ | |||
75 | }; | 80 | }; |
76 | 81 | ||
77 | /* PGU output directly sent to virtual LCD screen; hdmi controller not modelled */ | 82 | /* PGU output directly sent to virtual LCD screen; hdmi controller not modelled */ |
78 | pgu@0x17000 { | 83 | pgu@17000 { |
79 | compatible = "snps,arcpgufb"; | 84 | compatible = "snps,arcpgu"; |
80 | reg = <0x17000 0x400>; | 85 | reg = <0x17000 0x400>; |
81 | clock-frequency = <51000000>; /* PGU'clock is initated in init function */ | 86 | clocks = <&pguclk>; |
82 | /* interrupts = <5>; PGU interrupts not used, this vector is used for ps2 below */ | 87 | clock-names = "pxlclk"; |
83 | }; | 88 | }; |
84 | 89 | ||
85 | /* VDK has additional ps2 keyboard/mouse interface integrated in LCD screen model */ | 90 | /* VDK has additional ps2 keyboard/mouse interface integrated in LCD screen model */ |
diff --git a/arch/arc/boot/dts/vdk_hs38_smp.dts b/arch/arc/boot/dts/vdk_hs38_smp.dts index 031a5bc79b3e..2ba60c399d99 100644 --- a/arch/arc/boot/dts/vdk_hs38_smp.dts +++ b/arch/arc/boot/dts/vdk_hs38_smp.dts | |||
@@ -16,6 +16,6 @@ | |||
16 | compatible = "snps,axs103"; | 16 | compatible = "snps,axs103"; |
17 | 17 | ||
18 | chosen { | 18 | chosen { |
19 | bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=tty0 console=ttyS3,115200n8 consoleblank=0"; | 19 | bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=tty0 console=ttyS3,115200n8 consoleblank=0 video=640x480-24"; |
20 | }; | 20 | }; |
21 | }; | 21 | }; |
diff --git a/arch/arc/configs/nsimosci_defconfig b/arch/arc/configs/nsimosci_defconfig index 42bafa552498..98cf20933bbb 100644 --- a/arch/arc/configs/nsimosci_defconfig +++ b/arch/arc/configs/nsimosci_defconfig | |||
@@ -58,7 +58,8 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1 | |||
58 | CONFIG_SERIAL_OF_PLATFORM=y | 58 | CONFIG_SERIAL_OF_PLATFORM=y |
59 | # CONFIG_HW_RANDOM is not set | 59 | # CONFIG_HW_RANDOM is not set |
60 | # CONFIG_HWMON is not set | 60 | # CONFIG_HWMON is not set |
61 | CONFIG_FB=y | 61 | CONFIG_DRM=y |
62 | CONFIG_DRM_ARCPGU=y | ||
62 | CONFIG_FRAMEBUFFER_CONSOLE=y | 63 | CONFIG_FRAMEBUFFER_CONSOLE=y |
63 | CONFIG_LOGO=y | 64 | CONFIG_LOGO=y |
64 | # CONFIG_HID is not set | 65 | # CONFIG_HID is not set |
diff --git a/arch/arc/configs/nsimosci_hs_defconfig b/arch/arc/configs/nsimosci_hs_defconfig index 4bb60c1cd4a2..ddf8b96d494e 100644 --- a/arch/arc/configs/nsimosci_hs_defconfig +++ b/arch/arc/configs/nsimosci_hs_defconfig | |||
@@ -57,7 +57,8 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1 | |||
57 | CONFIG_SERIAL_OF_PLATFORM=y | 57 | CONFIG_SERIAL_OF_PLATFORM=y |
58 | # CONFIG_HW_RANDOM is not set | 58 | # CONFIG_HW_RANDOM is not set |
59 | # CONFIG_HWMON is not set | 59 | # CONFIG_HWMON is not set |
60 | CONFIG_FB=y | 60 | CONFIG_DRM=y |
61 | CONFIG_DRM_ARCPGU=y | ||
61 | CONFIG_FRAMEBUFFER_CONSOLE=y | 62 | CONFIG_FRAMEBUFFER_CONSOLE=y |
62 | CONFIG_LOGO=y | 63 | CONFIG_LOGO=y |
63 | # CONFIG_HID is not set | 64 | # CONFIG_HID is not set |
diff --git a/arch/arc/configs/nsimosci_hs_smp_defconfig b/arch/arc/configs/nsimosci_hs_smp_defconfig index 7e88f4c720f8..ceb90745326e 100644 --- a/arch/arc/configs/nsimosci_hs_smp_defconfig +++ b/arch/arc/configs/nsimosci_hs_smp_defconfig | |||
@@ -70,7 +70,8 @@ CONFIG_SERIAL_8250_DW=y | |||
70 | CONFIG_SERIAL_OF_PLATFORM=y | 70 | CONFIG_SERIAL_OF_PLATFORM=y |
71 | # CONFIG_HW_RANDOM is not set | 71 | # CONFIG_HW_RANDOM is not set |
72 | # CONFIG_HWMON is not set | 72 | # CONFIG_HWMON is not set |
73 | CONFIG_FB=y | 73 | CONFIG_DRM=y |
74 | CONFIG_DRM_ARCPGU=y | ||
74 | CONFIG_FRAMEBUFFER_CONSOLE=y | 75 | CONFIG_FRAMEBUFFER_CONSOLE=y |
75 | CONFIG_LOGO=y | 76 | CONFIG_LOGO=y |
76 | # CONFIG_HID is not set | 77 | # CONFIG_HID is not set |
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig index 52ec315dc5c9..969b206d6c67 100644 --- a/arch/arc/configs/vdk_hs38_smp_defconfig +++ b/arch/arc/configs/vdk_hs38_smp_defconfig | |||
@@ -63,12 +63,9 @@ CONFIG_SERIAL_8250_DW=y | |||
63 | CONFIG_SERIAL_OF_PLATFORM=y | 63 | CONFIG_SERIAL_OF_PLATFORM=y |
64 | # CONFIG_HW_RANDOM is not set | 64 | # CONFIG_HW_RANDOM is not set |
65 | # CONFIG_HWMON is not set | 65 | # CONFIG_HWMON is not set |
66 | CONFIG_FB=y | 66 | CONFIG_DRM=y |
67 | CONFIG_ARCPGU_RGB888=y | 67 | CONFIG_DRM_ARCPGU=y |
68 | CONFIG_ARCPGU_DISPTYPE=0 | ||
69 | # CONFIG_VGA_CONSOLE is not set | ||
70 | CONFIG_FRAMEBUFFER_CONSOLE=y | 68 | CONFIG_FRAMEBUFFER_CONSOLE=y |
71 | CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | ||
72 | CONFIG_LOGO=y | 69 | CONFIG_LOGO=y |
73 | # CONFIG_LOGO_LINUX_MONO is not set | 70 | # CONFIG_LOGO_LINUX_MONO is not set |
74 | # CONFIG_LOGO_LINUX_VGA16 is not set | 71 | # CONFIG_LOGO_LINUX_VGA16 is not set |
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile index d48fda70f857..73de56a0139a 100644 --- a/drivers/gpu/drm/arc/Makefile +++ b/drivers/gpu/drm/arc/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o | 1 | arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o |
2 | obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o | 2 | obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o |
diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index 86574b698a78..329ac7570911 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h | |||
@@ -43,6 +43,7 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu, | |||
43 | 43 | ||
44 | int arc_pgu_setup_crtc(struct drm_device *dev); | 44 | int arc_pgu_setup_crtc(struct drm_device *dev); |
45 | int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np); | 45 | int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np); |
46 | int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np); | ||
46 | struct drm_fbdev_cma *arcpgu_fbdev_cma_init(struct drm_device *dev, | 47 | struct drm_fbdev_cma *arcpgu_fbdev_cma_init(struct drm_device *dev, |
47 | unsigned int preferred_bpp, unsigned int num_crtc, | 48 | unsigned int preferred_bpp, unsigned int num_crtc, |
48 | unsigned int max_conn_count); | 49 | unsigned int max_conn_count); |
diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 7675bbc70133..07c1bdeca489 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c | |||
@@ -149,15 +149,16 @@ static int arcpgu_load(struct drm_device *drm) | |||
149 | 149 | ||
150 | /* find the encoder node and initialize it */ | 150 | /* find the encoder node and initialize it */ |
151 | encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0); | 151 | encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0); |
152 | if (!encoder_node) { | 152 | if (encoder_node) { |
153 | dev_err(drm->dev, "failed to get an encoder slave node\n"); | 153 | ret = arcpgu_drm_hdmi_init(drm, encoder_node); |
154 | return -ENODEV; | 154 | if (ret < 0) |
155 | return ret; | ||
156 | } else { | ||
157 | ret = arcpgu_drm_sim_init(drm, 0); | ||
158 | if (ret < 0) | ||
159 | return ret; | ||
155 | } | 160 | } |
156 | 161 | ||
157 | ret = arcpgu_drm_hdmi_init(drm, encoder_node); | ||
158 | if (ret < 0) | ||
159 | return ret; | ||
160 | |||
161 | drm_mode_config_reset(drm); | 162 | drm_mode_config_reset(drm); |
162 | drm_kms_helper_poll_init(drm); | 163 | drm_kms_helper_poll_init(drm); |
163 | 164 | ||
diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c new file mode 100644 index 000000000000..2bf06d71556a --- /dev/null +++ b/drivers/gpu/drm/arc/arcpgu_sim.c | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * ARC PGU DRM driver. | ||
3 | * | ||
4 | * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <drm/drm_crtc_helper.h> | ||
18 | #include <drm/drm_encoder_slave.h> | ||
19 | #include <drm/drm_atomic_helper.h> | ||
20 | |||
21 | #include "arcpgu.h" | ||
22 | |||
23 | #define XRES_DEF 640 | ||
24 | #define YRES_DEF 480 | ||
25 | |||
26 | #define XRES_MAX 8192 | ||
27 | #define YRES_MAX 8192 | ||
28 | |||
29 | |||
30 | struct arcpgu_drm_connector { | ||
31 | struct drm_connector connector; | ||
32 | struct drm_encoder_slave *encoder_slave; | ||
33 | }; | ||
34 | |||
35 | static int arcpgu_drm_connector_get_modes(struct drm_connector *connector) | ||
36 | { | ||
37 | int count; | ||
38 | |||
39 | count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX); | ||
40 | drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF); | ||
41 | return count; | ||
42 | } | ||
43 | |||
44 | static enum drm_connector_status | ||
45 | arcpgu_drm_connector_detect(struct drm_connector *connector, bool force) | ||
46 | { | ||
47 | return connector_status_connected; | ||
48 | } | ||
49 | |||
50 | static void arcpgu_drm_connector_destroy(struct drm_connector *connector) | ||
51 | { | ||
52 | drm_connector_unregister(connector); | ||
53 | drm_connector_cleanup(connector); | ||
54 | } | ||
55 | |||
56 | static const struct drm_connector_helper_funcs | ||
57 | arcpgu_drm_connector_helper_funcs = { | ||
58 | .get_modes = arcpgu_drm_connector_get_modes, | ||
59 | }; | ||
60 | |||
61 | static const struct drm_connector_funcs arcpgu_drm_connector_funcs = { | ||
62 | .dpms = drm_helper_connector_dpms, | ||
63 | .reset = drm_atomic_helper_connector_reset, | ||
64 | .detect = arcpgu_drm_connector_detect, | ||
65 | .fill_modes = drm_helper_probe_single_connector_modes, | ||
66 | .destroy = arcpgu_drm_connector_destroy, | ||
67 | .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, | ||
68 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, | ||
69 | }; | ||
70 | |||
71 | static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = { | ||
72 | .destroy = drm_encoder_cleanup, | ||
73 | }; | ||
74 | |||
75 | int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) | ||
76 | { | ||
77 | struct arcpgu_drm_connector *arcpgu_connector; | ||
78 | struct drm_encoder_slave *encoder; | ||
79 | struct drm_connector *connector; | ||
80 | int ret; | ||
81 | |||
82 | encoder = devm_kzalloc(drm->dev, sizeof(*encoder), GFP_KERNEL); | ||
83 | if (encoder == NULL) | ||
84 | return -ENOMEM; | ||
85 | |||
86 | encoder->base.possible_crtcs = 1; | ||
87 | encoder->base.possible_clones = 0; | ||
88 | |||
89 | ret = drm_encoder_init(drm, &encoder->base, &arcpgu_drm_encoder_funcs, | ||
90 | DRM_MODE_ENCODER_VIRTUAL, NULL); | ||
91 | if (ret) | ||
92 | return ret; | ||
93 | |||
94 | arcpgu_connector = devm_kzalloc(drm->dev, sizeof(*arcpgu_connector), | ||
95 | GFP_KERNEL); | ||
96 | if (!arcpgu_connector) { | ||
97 | ret = -ENOMEM; | ||
98 | goto error_encoder_cleanup; | ||
99 | } | ||
100 | |||
101 | connector = &arcpgu_connector->connector; | ||
102 | drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs); | ||
103 | |||
104 | ret = drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs, | ||
105 | DRM_MODE_CONNECTOR_VIRTUAL); | ||
106 | if (ret < 0) { | ||
107 | dev_err(drm->dev, "failed to initialize drm connector\n"); | ||
108 | goto error_encoder_cleanup; | ||
109 | } | ||
110 | |||
111 | ret = drm_mode_connector_attach_encoder(connector, &encoder->base); | ||
112 | if (ret < 0) { | ||
113 | dev_err(drm->dev, "could not attach connector to encoder\n"); | ||
114 | drm_connector_unregister(connector); | ||
115 | goto error_connector_cleanup; | ||
116 | } | ||
117 | |||
118 | arcpgu_connector->encoder_slave = encoder; | ||
119 | |||
120 | return 0; | ||
121 | |||
122 | error_connector_cleanup: | ||
123 | drm_connector_cleanup(connector); | ||
124 | |||
125 | error_encoder_cleanup: | ||
126 | drm_encoder_cleanup(&encoder->base); | ||
127 | return ret; | ||
128 | } | ||