aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/rcar-du/Makefile3
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_vga.c86
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_vga.h2
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_vgacon.c95
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_vgacon.h23
5 files changed, 123 insertions, 86 deletions
diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
index 5def510599b0..45a8479aed0d 100644
--- a/drivers/gpu/drm/rcar-du/Makefile
+++ b/drivers/gpu/drm/rcar-du/Makefile
@@ -4,6 +4,7 @@ rcar-du-drm-y := rcar_du_crtc.o \
4 rcar_du_lvds.o \ 4 rcar_du_lvds.o \
5 rcar_du_lvdscon.o \ 5 rcar_du_lvdscon.o \
6 rcar_du_plane.o \ 6 rcar_du_plane.o \
7 rcar_du_vga.o 7 rcar_du_vga.o \
8 rcar_du_vgacon.o
8 9
9obj-$(CONFIG_DRM_RCAR_DU) += rcar-du-drm.o 10obj-$(CONFIG_DRM_RCAR_DU) += rcar-du-drm.o
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vga.c b/drivers/gpu/drm/rcar-du/rcar_du_vga.c
index 327289ec380d..369ab32d5652 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vga.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vga.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * rcar_du_vga.c -- R-Car Display Unit VGA DAC and Connector 2 * rcar_du_vga.c -- R-Car Display Unit VGA DAC
3 * 3 *
4 * Copyright (C) 2013 Renesas Corporation 4 * Copyright (C) 2013 Renesas Corporation
5 * 5 *
@@ -18,89 +18,7 @@
18#include "rcar_du_drv.h" 18#include "rcar_du_drv.h"
19#include "rcar_du_kms.h" 19#include "rcar_du_kms.h"
20#include "rcar_du_vga.h" 20#include "rcar_du_vga.h"
21 21#include "rcar_du_vgacon.h"
22/* -----------------------------------------------------------------------------
23 * Connector
24 */
25
26static int rcar_du_vga_connector_get_modes(struct drm_connector *connector)
27{
28 return 0;
29}
30
31static int rcar_du_vga_connector_mode_valid(struct drm_connector *connector,
32 struct drm_display_mode *mode)
33{
34 return MODE_OK;
35}
36
37static const struct drm_connector_helper_funcs connector_helper_funcs = {
38 .get_modes = rcar_du_vga_connector_get_modes,
39 .mode_valid = rcar_du_vga_connector_mode_valid,
40 .best_encoder = rcar_du_connector_best_encoder,
41};
42
43static void rcar_du_vga_connector_destroy(struct drm_connector *connector)
44{
45 drm_sysfs_connector_remove(connector);
46 drm_connector_cleanup(connector);
47}
48
49static enum drm_connector_status
50rcar_du_vga_connector_detect(struct drm_connector *connector, bool force)
51{
52 return connector_status_unknown;
53}
54
55static const struct drm_connector_funcs connector_funcs = {
56 .dpms = drm_helper_connector_dpms,
57 .detect = rcar_du_vga_connector_detect,
58 .fill_modes = drm_helper_probe_single_connector_modes,
59 .destroy = rcar_du_vga_connector_destroy,
60};
61
62static int rcar_du_vga_connector_init(struct rcar_du_device *rcdu,
63 struct rcar_du_encoder *renc)
64{
65 struct rcar_du_connector *rcon;
66 struct drm_connector *connector;
67 int ret;
68
69 rcon = devm_kzalloc(rcdu->dev, sizeof(*rcon), GFP_KERNEL);
70 if (rcon == NULL)
71 return -ENOMEM;
72
73 connector = &rcon->connector;
74 connector->display_info.width_mm = 0;
75 connector->display_info.height_mm = 0;
76
77 ret = drm_connector_init(rcdu->ddev, connector, &connector_funcs,
78 DRM_MODE_CONNECTOR_VGA);
79 if (ret < 0)
80 return ret;
81
82 drm_connector_helper_add(connector, &connector_helper_funcs);
83 ret = drm_sysfs_connector_add(connector);
84 if (ret < 0)
85 return ret;
86
87 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
88 drm_object_property_set_value(&connector->base,
89 rcdu->ddev->mode_config.dpms_property, DRM_MODE_DPMS_OFF);
90
91 ret = drm_mode_connector_attach_encoder(connector, &renc->encoder);
92 if (ret < 0)
93 return ret;
94
95 connector->encoder = &renc->encoder;
96 rcon->encoder = renc;
97
98 return 0;
99}
100
101/* -----------------------------------------------------------------------------
102 * Encoder
103 */
104 22
105static void rcar_du_vga_encoder_dpms(struct drm_encoder *encoder, int mode) 23static void rcar_du_vga_encoder_dpms(struct drm_encoder *encoder, int mode)
106{ 24{
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vga.h b/drivers/gpu/drm/rcar-du/rcar_du_vga.h
index 66b4d2d7190d..b969b2075b57 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vga.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vga.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * rcar_du_vga.h -- R-Car Display Unit VGA DAC and Connector 2 * rcar_du_vga.h -- R-Car Display Unit VGA DAC
3 * 3 *
4 * Copyright (C) 2013 Renesas Corporation 4 * Copyright (C) 2013 Renesas Corporation
5 * 5 *
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
new file mode 100644
index 000000000000..2ee320333615
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
@@ -0,0 +1,95 @@
1/*
2 * rcar_du_vgacon.c -- R-Car Display Unit VGA Connector
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <drm/drmP.h>
15#include <drm/drm_crtc.h>
16#include <drm/drm_crtc_helper.h>
17
18#include "rcar_du_drv.h"
19#include "rcar_du_kms.h"
20#include "rcar_du_vgacon.h"
21
22static int rcar_du_vga_connector_get_modes(struct drm_connector *connector)
23{
24 return 0;
25}
26
27static int rcar_du_vga_connector_mode_valid(struct drm_connector *connector,
28 struct drm_display_mode *mode)
29{
30 return MODE_OK;
31}
32
33static const struct drm_connector_helper_funcs connector_helper_funcs = {
34 .get_modes = rcar_du_vga_connector_get_modes,
35 .mode_valid = rcar_du_vga_connector_mode_valid,
36 .best_encoder = rcar_du_connector_best_encoder,
37};
38
39static void rcar_du_vga_connector_destroy(struct drm_connector *connector)
40{
41 drm_sysfs_connector_remove(connector);
42 drm_connector_cleanup(connector);
43}
44
45static enum drm_connector_status
46rcar_du_vga_connector_detect(struct drm_connector *connector, bool force)
47{
48 return connector_status_unknown;
49}
50
51static const struct drm_connector_funcs connector_funcs = {
52 .dpms = drm_helper_connector_dpms,
53 .detect = rcar_du_vga_connector_detect,
54 .fill_modes = drm_helper_probe_single_connector_modes,
55 .destroy = rcar_du_vga_connector_destroy,
56};
57
58int rcar_du_vga_connector_init(struct rcar_du_device *rcdu,
59 struct rcar_du_encoder *renc)
60{
61 struct rcar_du_connector *rcon;
62 struct drm_connector *connector;
63 int ret;
64
65 rcon = devm_kzalloc(rcdu->dev, sizeof(*rcon), GFP_KERNEL);
66 if (rcon == NULL)
67 return -ENOMEM;
68
69 connector = &rcon->connector;
70 connector->display_info.width_mm = 0;
71 connector->display_info.height_mm = 0;
72
73 ret = drm_connector_init(rcdu->ddev, connector, &connector_funcs,
74 DRM_MODE_CONNECTOR_VGA);
75 if (ret < 0)
76 return ret;
77
78 drm_connector_helper_add(connector, &connector_helper_funcs);
79 ret = drm_sysfs_connector_add(connector);
80 if (ret < 0)
81 return ret;
82
83 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
84 drm_object_property_set_value(&connector->base,
85 rcdu->ddev->mode_config.dpms_property, DRM_MODE_DPMS_OFF);
86
87 ret = drm_mode_connector_attach_encoder(connector, &renc->encoder);
88 if (ret < 0)
89 return ret;
90
91 connector->encoder = &renc->encoder;
92 rcon->encoder = renc;
93
94 return 0;
95}
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.h b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.h
new file mode 100644
index 000000000000..b12b0cf7f117
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.h
@@ -0,0 +1,23 @@
1/*
2 * rcar_du_vgacon.h -- R-Car Display Unit VGA Connector
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_VGACON_H__
15#define __RCAR_DU_VGACON_H__
16
17struct rcar_du_device;
18struct rcar_du_encoder;
19
20int rcar_du_vga_connector_init(struct rcar_du_device *rcdu,
21 struct rcar_du_encoder *renc);
22
23#endif /* __RCAR_DU_VGACON_H__ */