diff options
| -rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_drv.c | 170 | ||||
| -rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_drv.h | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_kms.c | 231 | ||||
| -rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 30 | ||||
| -rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_lvdscon.h | 3 |
7 files changed, 344 insertions, 106 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 941d422fc410..d212efa6a495 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
| 16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/of_device.h> | ||
| 18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 19 | #include <linux/pm.h> | 20 | #include <linux/pm.h> |
| 20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
| @@ -30,6 +31,97 @@ | |||
| 30 | #include "rcar_du_regs.h" | 31 | #include "rcar_du_regs.h" |
| 31 | 32 | ||
| 32 | /* ----------------------------------------------------------------------------- | 33 | /* ----------------------------------------------------------------------------- |
| 34 | * Device Information | ||
| 35 | */ | ||
| 36 | |||
| 37 | static const struct rcar_du_device_info rcar_du_r8a7779_info = { | ||
| 38 | .features = 0, | ||
| 39 | .num_crtcs = 2, | ||
| 40 | .routes = { | ||
| 41 | /* R8A7779 has two RGB outputs and one (currently unsupported) | ||
| 42 | * TCON output. | ||
| 43 | */ | ||
| 44 | [RCAR_DU_OUTPUT_DPAD0] = { | ||
| 45 | .possible_crtcs = BIT(0), | ||
| 46 | .encoder_type = DRM_MODE_ENCODER_NONE, | ||
| 47 | .port = 0, | ||
| 48 | }, | ||
| 49 | [RCAR_DU_OUTPUT_DPAD1] = { | ||
| 50 | .possible_crtcs = BIT(1) | BIT(0), | ||
| 51 | .encoder_type = DRM_MODE_ENCODER_NONE, | ||
| 52 | .port = 1, | ||
| 53 | }, | ||
| 54 | }, | ||
| 55 | .num_lvds = 0, | ||
| 56 | }; | ||
| 57 | |||
| 58 | static const struct rcar_du_device_info rcar_du_r8a7790_info = { | ||
| 59 | .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_DEFR8, | ||
| 60 | .quirks = RCAR_DU_QUIRK_ALIGN_128B | RCAR_DU_QUIRK_LVDS_LANES, | ||
| 61 | .num_crtcs = 3, | ||
| 62 | .routes = { | ||
| 63 | /* R8A7790 has one RGB output, two LVDS outputs and one | ||
| 64 | * (currently unsupported) TCON output. | ||
| 65 | */ | ||
| 66 | [RCAR_DU_OUTPUT_DPAD0] = { | ||
| 67 | .possible_crtcs = BIT(2) | BIT(1) | BIT(0), | ||
| 68 | .encoder_type = DRM_MODE_ENCODER_NONE, | ||
| 69 | .port = 0, | ||
| 70 | }, | ||
| 71 | [RCAR_DU_OUTPUT_LVDS0] = { | ||
| 72 | .possible_crtcs = BIT(0), | ||
| 73 | .encoder_type = DRM_MODE_ENCODER_LVDS, | ||
| 74 | .port = 1, | ||
| 75 | }, | ||
| 76 | [RCAR_DU_OUTPUT_LVDS1] = { | ||
| 77 | .possible_crtcs = BIT(2) | BIT(1), | ||
| 78 | .encoder_type = DRM_MODE_ENCODER_LVDS, | ||
| 79 | .port = 2, | ||
| 80 | }, | ||
| 81 | }, | ||
| 82 | .num_lvds = 2, | ||
| 83 | }; | ||
| 84 | |||
| 85 | static const struct rcar_du_device_info rcar_du_r8a7791_info = { | ||
| 86 | .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_DEFR8, | ||
| 87 | .num_crtcs = 2, | ||
| 88 | .routes = { | ||
| 89 | /* R8A7791 has one RGB output, one LVDS output and one | ||
| 90 | * (currently unsupported) TCON output. | ||
| 91 | */ | ||
| 92 | [RCAR_DU_OUTPUT_DPAD0] = { | ||
| 93 | .possible_crtcs = BIT(1), | ||
| 94 | .encoder_type = DRM_MODE_ENCODER_NONE, | ||
| 95 | .port = 0, | ||
| 96 | }, | ||
| 97 | [RCAR_DU_OUTPUT_LVDS0] = { | ||
| 98 | .possible_crtcs = BIT(0), | ||
| 99 | .encoder_type = DRM_MODE_ENCODER_LVDS, | ||
| 100 | .port = 1, | ||
| 101 | }, | ||
| 102 | }, | ||
| 103 | .num_lvds = 1, | ||
| 104 | }; | ||
| 105 | |||
| 106 | static const struct platform_device_id rcar_du_id_table[] = { | ||
| 107 | { "rcar-du-r8a7779", (kernel_ulong_t)&rcar_du_r8a7779_info }, | ||
| 108 | { "rcar-du-r8a7790", (kernel_ulong_t)&rcar_du_r8a7790_info }, | ||
| 109 | { "rcar-du-r8a7791", (kernel_ulong_t)&rcar_du_r8a7791_info }, | ||
| 110 | { } | ||
| 111 | }; | ||
| 112 | |||
| 113 | MODULE_DEVICE_TABLE(platform, rcar_du_id_table); | ||
| 114 | |||
| 115 | static const struct of_device_id rcar_du_of_table[] = { | ||
| 116 | { .compatible = "renesas,du-r8a7779", .data = &rcar_du_r8a7779_info }, | ||
| 117 | { .compatible = "renesas,du-r8a7790", .data = &rcar_du_r8a7790_info }, | ||
| 118 | { .compatible = "renesas,du-r8a7791", .data = &rcar_du_r8a7791_info }, | ||
| 119 | { } | ||
| 120 | }; | ||
| 121 | |||
| 122 | MODULE_DEVICE_TABLE(of, rcar_du_of_table); | ||
| 123 | |||
| 124 | /* ----------------------------------------------------------------------------- | ||
| 33 | * DRM operations | 125 | * DRM operations |
| 34 | */ | 126 | */ |
| 35 | 127 | ||
| @@ -53,12 +145,13 @@ static int rcar_du_unload(struct drm_device *dev) | |||
| 53 | static int rcar_du_load(struct drm_device *dev, unsigned long flags) | 145 | static int rcar_du_load(struct drm_device *dev, unsigned long flags) |
| 54 | { | 146 | { |
| 55 | struct platform_device *pdev = dev->platformdev; | 147 | struct platform_device *pdev = dev->platformdev; |
| 148 | struct device_node *np = pdev->dev.of_node; | ||
| 56 | struct rcar_du_platform_data *pdata = pdev->dev.platform_data; | 149 | struct rcar_du_platform_data *pdata = pdev->dev.platform_data; |
| 57 | struct rcar_du_device *rcdu; | 150 | struct rcar_du_device *rcdu; |
| 58 | struct resource *mem; | 151 | struct resource *mem; |
| 59 | int ret; | 152 | int ret; |
| 60 | 153 | ||
| 61 | if (pdata == NULL) { | 154 | if (pdata == NULL && np == NULL) { |
| 62 | dev_err(dev->dev, "no platform data\n"); | 155 | dev_err(dev->dev, "no platform data\n"); |
| 63 | return -ENODEV; | 156 | return -ENODEV; |
| 64 | } | 157 | } |
| @@ -71,7 +164,8 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags) | |||
| 71 | 164 | ||
| 72 | rcdu->dev = &pdev->dev; | 165 | rcdu->dev = &pdev->dev; |
| 73 | rcdu->pdata = pdata; | 166 | rcdu->pdata = pdata; |
| 74 | rcdu->info = (struct rcar_du_device_info *)pdev->id_entry->driver_data; | 167 | rcdu->info = np ? of_match_device(rcar_du_of_table, rcdu->dev)->data |
| 168 | : (void *)platform_get_device_id(pdev)->driver_data; | ||
| 75 | rcdu->ddev = dev; | 169 | rcdu->ddev = dev; |
| 76 | dev->dev_private = rcdu; | 170 | dev->dev_private = rcdu; |
| 77 | 171 | ||
| @@ -232,77 +326,6 @@ static int rcar_du_remove(struct platform_device *pdev) | |||
| 232 | return 0; | 326 | return 0; |
| 233 | } | 327 | } |
| 234 | 328 | ||
| 235 | static const struct rcar_du_device_info rcar_du_r8a7779_info = { | ||
| 236 | .features = 0, | ||
| 237 | .num_crtcs = 2, | ||
| 238 | .routes = { | ||
| 239 | /* R8A7779 has two RGB outputs and one (currently unsupported) | ||
| 240 | * TCON output. | ||
| 241 | */ | ||
| 242 | [RCAR_DU_OUTPUT_DPAD0] = { | ||
| 243 | .possible_crtcs = BIT(0), | ||
| 244 | .encoder_type = DRM_MODE_ENCODER_NONE, | ||
| 245 | }, | ||
| 246 | [RCAR_DU_OUTPUT_DPAD1] = { | ||
| 247 | .possible_crtcs = BIT(1) | BIT(0), | ||
| 248 | .encoder_type = DRM_MODE_ENCODER_NONE, | ||
| 249 | }, | ||
| 250 | }, | ||
| 251 | .num_lvds = 0, | ||
| 252 | }; | ||
| 253 | |||
| 254 | static const struct rcar_du_device_info rcar_du_r8a7790_info = { | ||
| 255 | .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_DEFR8, | ||
| 256 | .quirks = RCAR_DU_QUIRK_ALIGN_128B | RCAR_DU_QUIRK_LVDS_LANES, | ||
| 257 | .num_crtcs = 3, | ||
| 258 | .routes = { | ||
| 259 | /* R8A7790 has one RGB output, two LVDS outputs and one | ||
| 260 | * (currently unsupported) TCON output. | ||
| 261 | */ | ||
| 262 | [RCAR_DU_OUTPUT_DPAD0] = { | ||
| 263 | .possible_crtcs = BIT(2) | BIT(1) | BIT(0), | ||
| 264 | .encoder_type = DRM_MODE_ENCODER_NONE, | ||
| 265 | }, | ||
| 266 | [RCAR_DU_OUTPUT_LVDS0] = { | ||
| 267 | .possible_crtcs = BIT(0), | ||
| 268 | .encoder_type = DRM_MODE_ENCODER_LVDS, | ||
