diff options
Diffstat (limited to 'drivers')
24 files changed, 328 insertions, 398 deletions
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 772c62a6e2ac..4752f223e5b2 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
| @@ -1,11 +1,12 @@ | |||
| 1 | config DRM_EXYNOS | 1 | config DRM_EXYNOS |
| 2 | tristate "DRM Support for Samsung SoC EXYNOS Series" | 2 | tristate "DRM Support for Samsung SoC EXYNOS Series" |
| 3 | depends on DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM) | 3 | depends on OF && DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM) |
| 4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
| 5 | select FB_CFB_FILLRECT | 5 | select FB_CFB_FILLRECT |
| 6 | select FB_CFB_COPYAREA | 6 | select FB_CFB_COPYAREA |
| 7 | select FB_CFB_IMAGEBLIT | 7 | select FB_CFB_IMAGEBLIT |
| 8 | select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE | 8 | select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE |
| 9 | select VIDEOMODE_HELPERS | ||
| 9 | help | 10 | help |
| 10 | Choose this option if you have a Samsung SoC EXYNOS chipset. | 11 | Choose this option if you have a Samsung SoC EXYNOS chipset. |
| 11 | If M is selected the module will be called exynosdrm. | 12 | If M is selected the module will be called exynosdrm. |
| @@ -24,9 +25,8 @@ config DRM_EXYNOS_DMABUF | |||
| 24 | 25 | ||
| 25 | config DRM_EXYNOS_FIMD | 26 | config DRM_EXYNOS_FIMD |
| 26 | bool "Exynos DRM FIMD" | 27 | bool "Exynos DRM FIMD" |
| 27 | depends on OF && DRM_EXYNOS && !FB_S3C && !ARCH_MULTIPLATFORM | 28 | depends on DRM_EXYNOS && !FB_S3C && !ARCH_MULTIPLATFORM |
| 28 | select FB_MODE_HELPERS | 29 | select FB_MODE_HELPERS |
| 29 | select VIDEOMODE_HELPERS | ||
| 30 | help | 30 | help |
| 31 | Choose this option if you want to use Exynos FIMD for DRM. | 31 | Choose this option if you want to use Exynos FIMD for DRM. |
| 32 | 32 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_ddc.c b/drivers/gpu/drm/exynos/exynos_ddc.c index 30ef41bcd7b8..6a8c84e7c839 100644 --- a/drivers/gpu/drm/exynos/exynos_ddc.c +++ b/drivers/gpu/drm/exynos/exynos_ddc.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
| 18 | 18 | #include <linux/of.h> | |
| 19 | 19 | ||
| 20 | #include "exynos_drm_drv.h" | 20 | #include "exynos_drm_drv.h" |
| 21 | #include "exynos_hdmi.h" | 21 | #include "exynos_hdmi.h" |
| @@ -41,13 +41,6 @@ static int s5p_ddc_remove(struct i2c_client *client) | |||
| 41 | return 0; | 41 | return 0; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | static struct i2c_device_id ddc_idtable[] = { | ||
| 45 | {"s5p_ddc", 0}, | ||
| 46 | {"exynos5-hdmiddc", 0}, | ||
| 47 | { }, | ||
| 48 | }; | ||
| 49 | |||
| 50 | #ifdef CONFIG_OF | ||
| 51 | static struct of_device_id hdmiddc_match_types[] = { | 44 | static struct of_device_id hdmiddc_match_types[] = { |
| 52 | { | 45 | { |
| 53 | .compatible = "samsung,exynos5-hdmiddc", | 46 | .compatible = "samsung,exynos5-hdmiddc", |
| @@ -57,15 +50,13 @@ static struct of_device_id hdmiddc_match_types[] = { | |||
| 57 | /* end node */ | 50 | /* end node */ |
| 58 | } | 51 | } |
| 59 | }; | 52 | }; |
| 60 | #endif | ||
| 61 | 53 | ||
| 62 | struct i2c_driver ddc_driver = { | 54 | struct i2c_driver ddc_driver = { |
| 63 | .driver = { | 55 | .driver = { |
| 64 | .name = "exynos-hdmiddc", | 56 | .name = "exynos-hdmiddc", |
| 65 | .owner = THIS_MODULE, | 57 | .owner = THIS_MODULE, |
| 66 | .of_match_table = of_match_ptr(hdmiddc_match_types), | 58 | .of_match_table = hdmiddc_match_types, |
| 67 | }, | 59 | }, |
| 68 | .id_table = ddc_idtable, | ||
| 69 | .probe = s5p_ddc_probe, | 60 | .probe = s5p_ddc_probe, |
| 70 | .remove = s5p_ddc_remove, | 61 | .remove = s5p_ddc_remove, |
| 71 | .command = NULL, | 62 | .command = NULL, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index b8ac06d92fbf..3445a0f3a6b2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c | |||
| @@ -149,10 +149,8 @@ struct exynos_drm_gem_buf *exynos_drm_init_buf(struct drm_device *dev, | |||
| 149 | DRM_DEBUG_KMS("desired size = 0x%x\n", size); | 149 | DRM_DEBUG_KMS("desired size = 0x%x\n", size); |
| 150 | 150 | ||
| 151 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); | 151 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); |
| 152 | if (!buffer) { | 152 | if (!buffer) |
| 153 | DRM_ERROR("failed to allocate exynos_drm_gem_buf.\n"); | ||
| 154 | return NULL; | 153 | return NULL; |
| 155 | } | ||
| 156 | 154 | ||
| 157 | buffer->size = size; | 155 | buffer->size = size; |
| 158 | return buffer; | 156 | return buffer; |
| @@ -161,11 +159,6 @@ struct exynos_drm_gem_buf *exynos_drm_init_buf(struct drm_device *dev, | |||
| 161 | void exynos_drm_fini_buf(struct drm_device *dev, | 159 | void exynos_drm_fini_buf(struct drm_device *dev, |
| 162 | struct exynos_drm_gem_buf *buffer) | 160 | struct exynos_drm_gem_buf *buffer) |
| 163 | { | 161 | { |
| 164 | if (!buffer) { | ||
| 165 | DRM_DEBUG_KMS("buffer is null.\n"); | ||
| 166 | return; | ||
| 167 | } | ||
| 168 | |||
| 169 | kfree(buffer); | 162 | kfree(buffer); |
| 170 | buffer = NULL; | 163 | buffer = NULL; |
| 171 | } | 164 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 02a8bc5226ca..e082efb2fece 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <drm/exynos_drm.h> | 17 | #include <drm/exynos_drm.h> |
| 18 | #include "exynos_drm_drv.h" | 18 | #include "exynos_drm_drv.h" |
| 19 | #include "exynos_drm_encoder.h" | 19 | #include "exynos_drm_encoder.h" |
| 20 | #include "exynos_drm_connector.h" | ||
| 20 | 21 | ||
| 21 | #define to_exynos_connector(x) container_of(x, struct exynos_drm_connector,\ | 22 | #define to_exynos_connector(x) container_of(x, struct exynos_drm_connector,\ |
| 22 | drm_connector) | 23 | drm_connector) |
| @@ -28,35 +29,6 @@ struct exynos_drm_connector { | |||
| 28 | uint32_t dpms; | 29 | uint32_t dpms; |
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | /* convert exynos_video_timings to drm_display_mode */ | ||
| 32 | static inline void | ||
| 33 | convert_to_display_mode(struct drm_display_mode *mode, | ||
| 34 | struct exynos_drm_panel_info *panel) | ||
| 35 | { | ||
| 36 | struct fb_videomode *timing = &panel->timing; | ||
| 37 | |||
| 38 | mode->clock = timing->pixclock / 1000; | ||
| 39 | mode->vrefresh = timing->refresh; | ||
| 40 | |||
| 41 | mode->hdisplay = timing->xres; | ||
| 42 | mode->hsync_start = mode->hdisplay + timing->right_margin; | ||
| 43 | mode->hsync_end = mode->hsync_start + timing->hsync_len; | ||
| 44 | mode->htotal = mode->hsync_end + timing->left_margin; | ||
| 45 | |||
| 46 | mode->vdisplay = timing->yres; | ||
| 47 | mode->vsync_start = mode->vdisplay + timing->lower_margin; | ||
| 48 | mode->vsync_end = mode->vsync_start + timing->vsync_len; | ||
| 49 | mode->vtotal = mode->vsync_end + timing->upper_margin; | ||
| 50 | mode->width_mm = panel->width_mm; | ||
| 51 | mode->height_mm = panel->height_mm; | ||
| 52 | |||
| 53 | if (timing->vmode & FB_VMODE_INTERLACED) | ||
| 54 | mode->flags |= DRM_MODE_FLAG_INTERLACE; | ||
| 55 | |||
| 56 | if (timing->vmode & FB_VMODE_DOUBLE) | ||
| 57 | mode->flags |= DRM_MODE_FLAG_DBLSCAN; | ||
| 58 | } | ||
| 59 | |||
| 60 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) | 32 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) |
| 61 | { | 33 | { |
| 62 | struct exynos_drm_connector *exynos_connector = | 34 | struct exynos_drm_connector *exynos_connector = |
| @@ -111,7 +83,9 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
| 111 | return 0; | 83 | return 0; |
| 112 | } | 84 | } |
| 113 | 85 | ||
| 114 | convert_to_display_mode(mode, panel); | 86 | drm_display_mode_from_videomode(&panel->vm, mode); |
| 87 | mode->width_mm = panel->width_mm; | ||
| 88 | mode->height_mm = panel->height_mm; | ||
| 115 | connector->display_info.width_mm = mode->width_mm; | 89 | connector->display_info.width_mm = mode->width_mm; |
| 116 | connector->display_info.height_mm = mode->height_mm; | 90 | connector->display_info.height_mm = mode->height_mm; |
| 117 | 91 | ||
| @@ -278,10 +252,8 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
| 278 | int err; | 252 | int err; |
| 279 | 253 | ||
| 280 | exynos_connector = kzalloc(sizeof(*exynos_connector), GFP_KERNEL); | 254 | exynos_connector = kzalloc(sizeof(*exynos_connector), GFP_KERNEL); |
| 281 | if (!exynos_connector) { | 255 | if (!exynos_connector) |
| 282 | DRM_ERROR("failed to allocate connector\n"); | ||
| 283 | return NULL; | 256 | return NULL; |
| 284 | } | ||
| 285 | 257 | ||
| 286 | connector = &exynos_connector->drm_connector; | 258 | connector = &exynos_connector->drm_connector; |
| 287 | 259 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 14f5c1d34028..ebc01503d50e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <drm/drmP.h> | 15 | #include <drm/drmP.h> |
| 16 | #include <drm/drm_crtc_helper.h> | 16 | #include <drm/drm_crtc_helper.h> |
| 17 | 17 | ||
| 18 | #include "exynos_drm_crtc.h" | ||
| 18 | #include "exynos_drm_drv.h" | 19 | #include "exynos_drm_drv.h" |
| 19 | #include "exynos_drm_encoder.h" | 20 | #include "exynos_drm_encoder.h" |
| 20 | #include "exynos_drm_plane.h" | 21 | #include "exynos_drm_plane.h" |
| @@ -324,10 +325,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) | |||
| 324 | struct drm_crtc *crtc; | 325 | struct drm_crtc *crtc; |
| 325 | 326 | ||
| 326 | exynos_crtc = kzalloc(sizeof(*exynos_crtc), GFP_KERNEL); | 327 | exynos_crtc = kzalloc(sizeof(*exynos_crtc), GFP_KERNEL); |
| 327 | if (!exynos_crtc) { | 328 | if (!exynos_crtc) |
| 328 | DRM_ERROR("failed to allocate exynos crtc\n"); | ||
| 329 | return -ENOMEM; | 329 | return -ENOMEM; |
| 330 | } | ||
| 331 | 330 | ||
| 332 | exynos_crtc->pipe = nr; | 331 | exynos_crtc->pipe = nr; |
| 333 | exynos_crtc->dpms = DRM_MODE_DPMS_OFF; | 332 | exynos_crtc->dpms = DRM_MODE_DPMS_OFF; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c index fd76449cf452..59827cc5e770 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | #include <drm/drmP.h> | 12 | #include <drm/drmP.h> |
| 13 | #include <drm/exynos_drm.h> | 13 | #include <drm/exynos_drm.h> |
| 14 | #include "exynos_drm_dmabuf.h" | ||
| 14 | #include "exynos_drm_drv.h" | 15 | #include "exynos_drm_drv.h" |
| 15 | #include "exynos_drm_gem.h" | 16 | #include "exynos_drm_gem.h" |
| 16 | 17 | ||
| @@ -230,7 +231,6 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, | |||
| 230 | 231 | ||
| 231 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); | 232 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); |
| 232 | if (!buffer) { | 233 | if (!buffer) { |
| 233 | DRM_ERROR("failed to allocate exynos_drm_gem_buf.\n"); | ||
| 234 | ret = -ENOMEM; | 234 | ret = -ENOMEM; |
| 235 | goto err_unmap_attach; | 235 | goto err_unmap_attach; |
| 236 | } | 236 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index df81d3c959b4..bb82ef78ca85 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
| @@ -47,10 +47,8 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) | |||
| 47 | int nr; | 47 | int nr; |
| 48 | 48 | ||
| 49 | private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL); | 49 | private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL); |
| 50 | if (!private) { | 50 | if (!private) |
| 51 | DRM_ERROR("failed to allocate private\n"); | ||
| 52 | return -ENOMEM; | 51 | return -ENOMEM; |
| 53 | } | ||
| 54 | 52 | ||
| 55 | INIT_LIST_HEAD(&private->pageflip_event_list); | 53 | INIT_LIST_HEAD(&private->pageflip_event_list); |
| 56 | dev->dev_private = (void *)private; | 54 | dev->dev_private = (void *)private; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index a99a033793bc..06f1b2a09da7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
| @@ -324,10 +324,8 @@ exynos_drm_encoder_create(struct drm_device *dev, | |||
| 324 | return NULL; | 324 | return NULL; |
| 325 | 325 | ||
| 326 | exynos_encoder = kzalloc(sizeof(*exynos_encoder), GFP_KERNEL); | 326 | exynos_encoder = kzalloc(sizeof(*exynos_encoder), GFP_KERNEL); |
| 327 | if (!exynos_encoder) { | 327 | if (!exynos_encoder) |
| 328 | DRM_ERROR("failed to allocate encoder\n"); | ||
| 329 | return NULL; | 328 | return NULL; |
| 330 | } | ||
| 331 | 329 | ||
| 332 | exynos_encoder->dpms = DRM_MODE_DPMS_OFF; | 330 | exynos_encoder->dpms = DRM_MODE_DPMS_OFF; |
| 333 | exynos_encoder->manager = manager; | 331 | exynos_encoder->manager = manager; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index c2d149f0408a..ea39e0ef2ae4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
| @@ -156,10 +156,8 @@ exynos_drm_framebuffer_init(struct drm_device *dev, | |||
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL); | 158 | exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL); |
| 159 | if (!exynos_fb) { | 159 | if (!exynos_fb) |
| 160 | DRM_ERROR("failed to allocate exynos drm framebuffer\n"); | ||
| 161 | return ERR_PTR(-ENOMEM); | 160 | return ERR_PTR(-ENOMEM); |
| 162 | } | ||
| 163 | 161 | ||
| 164 | drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); | 162 | drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); |
| 165 | exynos_fb->exynos_gem_obj[0] = exynos_gem_obj; | 163 | exynos_fb->exynos_gem_obj[0] = exynos_gem_obj; |
| @@ -220,10 +218,8 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | |||
| 220 | int i, ret; | 218 | int i, ret; |
| 221 | 219 | ||
| 222 | exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL); | 220 | exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL); |
| 223 | if (!exynos_fb) { | 221 | if (!exynos_fb) |
| 224 | DRM_ERROR("failed to allocate exynos drm framebuffer\n"); | ||
| 225 | return ERR_PTR(-ENOMEM); | 222 | return ERR_PTR(-ENOMEM); |
| 226 | } | ||
| 227 | 223 | ||
| 228 | obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); | 224 | obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); |
| 229 | if (!obj) { | 225 | if (!obj) { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 8e60bd61137f..78e868bcf1ec 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
| @@ -16,9 +16,11 @@ | |||
| 16 | #include <drm/drm_crtc.h> | 16 | #include <drm/drm_crtc.h> |
| 17 | #include <drm/drm_fb_helper.h> | 17 | #include <drm/drm_fb_helper.h> |
| 18 | #include <drm/drm_crtc_helper.h> | 18 | #include <drm/drm_crtc_helper.h> |
| 19 | #include <drm/exynos_drm.h> | ||
| 19 | 20 | ||
| 20 | #include "exynos_drm_drv.h" | 21 | #include "exynos_drm_drv.h" |
| 21 | #include "exynos_drm_fb.h" | 22 | #include "exynos_drm_fb.h" |
| 23 | #include "exynos_drm_fbdev.h" | ||
| 22 | #include "exynos_drm_gem.h" | 24 | #include "exynos_drm_gem.h" |
| 23 | #include "exynos_drm_iommu.h" | 25 | #include "exynos_drm_iommu.h" |
| 24 | 26 | ||
| @@ -165,8 +167,18 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, | |||
| 165 | 167 | ||
| 166 | size = mode_cmd.pitches[0] * mode_cmd.height; | 168 | size = mode_cmd.pitches[0] * mode_cmd.height; |
| 167 | 169 | ||
| 168 | /* 0 means to allocate physically continuous memory */ | 170 | exynos_gem_obj = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG, size); |
| 169 | exynos_gem_obj = exynos_drm_gem_create(dev, 0, size); | 171 | /* |
| 172 | * If physically contiguous memory allocation fails and if IOMMU is | ||
| 173 | * supported then try to get buffer from non physically contiguous | ||
| 174 | * memory area. | ||
| 175 | */ | ||
| 176 | if (IS_ERR(exynos_gem_obj) && is_drm_iommu_supported(dev)) { | ||
| 177 | dev_warn(&pdev->dev, "contiguous FB allocation failed, falling back to non-contiguous\n"); | ||
| 178 | exynos_gem_obj = exynos_drm_gem_create(dev, EXYNOS_BO_NONCONTIG, | ||
| 179 | size); | ||
| 180 | } | ||
| 181 | |||
| 170 | if (IS_ERR(exynos_gem_obj)) { | 182 | if (IS_ERR(exynos_gem_obj)) { |
| 171 | ret = PTR_ERR(exynos_gem_obj); | 183 | ret = PTR_ERR(exynos_gem_obj); |
| 172 | goto err_release_framebuffer; | 184 | goto err_release_framebuffer; |
| @@ -236,10 +248,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev) | |||
| 236 | return 0; | 248 | return 0; |
| 237 | 249 | ||
| 238 | fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); | 250 | fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); |
| 239 | if (!fbdev) { | 251 | if (!fbdev) |
| 240 | DRM_ERROR("failed to allocate drm fbdev.\n"); | ||
| 241 | return -ENOMEM; | 252 | return -ENOMEM; |
| 242 | } | ||
| 243 | 253 | ||
| 244 | private->fb_helper = helper = &fbdev->drm_fb_helper; | 254 | private->fb_helper = helper = &fbdev->drm_fb_helper; |
| 245 | helper->funcs = &exynos_drm_fb_helper_funcs; | 255 | helper->funcs = &exynos_drm_fb_helper_funcs; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 6e047bd53e2f..8adfc8f1e08f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
| @@ -17,10 +17,12 @@ | |||
| 17 | #include <linux/regmap.h> | 17 | #include <linux/regmap.h> |
| 18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
| 19 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
| 20 | #include <linux/of.h> | ||
| 20 | 21 | ||
| 21 | #include <drm/drmP.h> | 22 | #include <drm/drmP.h> |
| 22 | #include <drm/exynos_drm.h> | 23 | #include <drm/exynos_drm.h> |
| 23 | #include "regs-fimc.h" | 24 | #include "regs-fimc.h" |
| 25 | #include "exynos_drm_drv.h" | ||
| 24 | #include "exynos_drm_ipp.h" | 26 | #include "exynos_drm_ipp.h" |
| 25 | #include "exynos_drm_fimc.h" | 27 | #include "exynos_drm_fimc.h" |
| 26 | 28 | ||
| @@ -1343,10 +1345,8 @@ static int fimc_init_prop_list(struct exynos_drm_ippdrv *ippdrv) | |||
| 1343 | struct drm_exynos_ipp_prop_list *prop_list; | 1345 | struct drm_exynos_ipp_prop_list *prop_list; |
| 1344 | 1346 | ||
| 1345 | prop_list = devm_kzalloc(ippdrv->dev, sizeof(*prop_list), GFP_KERNEL); | 1347 | prop_list = devm_kzalloc(ippdrv->dev, sizeof(*prop_list), GFP_KERNEL); |
| 1346 | if (!prop_list) { | 1348 | if (!prop_list) |
| 1347 | DRM_ERROR("failed to alloc property list.\n"); | ||
| 1348 | return -ENOMEM; | 1349 | return -ENOMEM; |
| 1349 | } | ||
| 1350 | 1350 | ||
| 1351 | prop_list->version = 1; | 1351 | prop_list->version = 1; |
| 1352 | prop_list->writeback = 1; | 1352 | prop_list->writeback = 1; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 1c263dac3c1c..868a14d52995 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
| @@ -16,10 +16,12 @@ | |||
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
| 19 | #include <linux/of.h> | ||
| 19 | #include <linux/of_device.h> | 20 | #include <linux/of_device.h> |
| 20 | #include <linux/pm_runtime.h> | 21 | #include <linux/pm_runtime.h> |
| 21 | 22 | ||
| 22 | #include <video/of_display_timing.h> | 23 | #include <video/of_display_timing.h> |
| 24 | #include <video/of_videomode.h> | ||
| 23 | #include <video/samsung_fimd.h> | 25 | #include <video/samsung_fimd.h> |
| 24 | #include <drm/exynos_drm.h> | 26 | #include <drm/exynos_drm.h> |
| 25 | 27 | ||
| @@ -35,6 +37,8 @@ | |||
| 35 | * CPU Interface. | 37 | * CPU Interface. |
| 36 | */ | 38 | */ |
| 37 | 39 | ||
| 40 | #define FIMD_DEFAULT_FRAMERATE 60 | ||
| 41 | |||
| 38 | /* position control register for hardware window 0, 2 ~ 4.*/ | 42 | /* position control register for hardware window 0, 2 ~ 4.*/ |
| 39 | #define VIDOSD_A(win) (VIDOSD_BASE + 0x00 + (win) * 16) | 43 | #define VIDOSD_A(win) (VIDOSD_BASE + 0x00 + (win) * 16) |
| 40 | #define VIDOSD_B(win) (VIDOSD_BASE + 0x04 + (win) * 16) | 44 | #define VIDOSD_B(win) (VIDOSD_BASE + 0x04 + (win) * 16) |
| @@ -65,11 +69,13 @@ struct fimd_driver_data { | |||
| 65 | 69 | ||
| 66 | unsigned int has_shadowcon:1; | 70 | unsigned int has_shadowcon:1; |
| 67 | unsigned int has_clksel:1; | 71 | unsigned int has_clksel:1; |
| 72 | unsigned int has_limited_fmt:1; | ||
| 68 | }; | 73 | }; |
| 69 | 74 | ||
| 70 | static struct fimd_driver_data s3c64xx_fimd_driver_data = { | 75 | static struct fimd_driver_data s3c64xx_fimd_driver_data = { |
| 71 | .timing_base = 0x0, | 76 | .timing_base = 0x0, |
| 72 | .has_clksel = 1, | 77 | .has_clksel = 1, |
| 78 | .has_limited_fmt = 1, | ||
| 73 | }; | 79 | }; |
| 74 | 80 | ||
| 75 | static struct fimd_driver_data exynos4_fimd_driver_data = { | 81 | static struct fimd_driver_data exynos4_fimd_driver_data = { |
| @@ -90,6 +96,7 @@ struct fimd_win_data { | |||
| 90 | unsigned int fb_width; | 96 | unsigned int fb_width; |
| 91 | unsigned int fb_height; | 97 | unsigned int fb_height; |
| 92 | unsigned int bpp; | 98 | unsigned int bpp; |
| 99 | unsigned int pixel_format; | ||
| 93 | dma_addr_t dma_addr; | 100 | dma_addr_t dma_addr; |
| 94 | unsigned int buf_offsize; | 101 | unsigned int buf_offsize; |
| 95 | unsigned int line_size; /* bytes */ | 102 | unsigned int line_size; /* bytes */ |
| @@ -115,11 +122,10 @@ struct fimd_context { | |||
| 115 | wait_queue_head_t wait_vsync_queue; | 122 | wait_queue_head_t wait_vsync_queue; |
| 116 | atomic_t wait_vsync_event; | 123 | atomic_t wait_vsync_event; |
| 117 | 124 | ||
| 118 | struct exynos_drm_panel_info *panel; | 125 | struct exynos_drm_panel_info panel; |
| 119 | struct fimd_driver_data *driver_data; | 126 | struct fimd_driver_data *driver_data; |
| 120 | }; | 127 | }; |
| 121 | 128 | ||
| 122 | #ifdef CONFIG_OF | ||
| 123 | static const struct of_device_id fimd_driver_dt_match[] = { | 129 | static const struct of_device_id fimd_driver_dt_match[] = { |
| 124 | { .compatible = "samsung,s3c6400-fimd", | 130 | { .compatible = "samsung,s3c6400-fimd", |
| 125 | .data = &s3c64xx_fimd_driver_data }, | 131 | .data = &s3c64xx_fimd_driver_data }, |
| @@ -129,21 +135,14 @@ static const struct of_device_id fimd_driver_dt_match[] = { | |||
| 129 | .data = &exynos5_fimd_driver_data }, | 135 | .data = &exynos5_fimd_driver_data }, |
| 130 | {}, | 136 | {}, |
| 131 | }; | 137 | }; |
| 132 | #endif | ||
| 133 | 138 | ||
| 134 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( | 139 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( |
| 135 | struct platform_device *pdev) | 140 | struct platform_device *pdev) |
| 136 | { | 141 | { |
| 137 | #ifdef CONFIG_OF | ||
| 138 | const struct of_device_id *of_id = | 142 | const struct of_device_id *of_id = |
| 139 | of_match_device(fimd_driver_dt_match, &pdev->dev); | 143 | of_match_device(fimd_driver_dt_match, &pdev->dev); |
| 140 | 144 | ||
| 141 | if (of_id) | 145 | return (struct fimd_driver_data *)of_id->data; |
| 142 | return (struct fimd_driver_data *)of_id->data; | ||
| 143 | #endif | ||
| 144 | |||
| 145 | return (struct fimd_driver_data *) | ||
| 146 | platform_get_device_id(pdev)->driver_data; | ||
| 147 | } | 146 | } |
| 148 | 147 | ||
| 149 | static bool fimd_display_is_connected(struct device *dev) | 148 | static bool fimd_display_is_connected(struct device *dev) |
| @@ -157,7 +156,7 @@ static void *fimd_get_panel(struct device *dev) | |||
| 157 | { | 156 | { |
| 158 | struct fimd_context *ctx = get_fimd_context(dev); | 157 | struct fimd_context *ctx = get_fimd_context(dev); |
| 159 | 158 | ||
| 160 | return ctx->panel; | 159 | return &ctx->panel; |
| 161 | } | 160 | } |
| 162 | 161 | ||
| 163 | static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode) | 162 | static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode) |
| @@ -237,8 +236,8 @@ static void fimd_apply(struct device *subdrv_dev) | |||
| 237 | static void fimd_commit(struct device *dev) | 236 | static void fimd_commit(struct device *dev) |
| 238 | { | 237 | { |
| 239 | struct fimd_context *ctx = get_fimd_context(dev); | 238 | struct fimd_context *ctx = get_fimd_context(dev); |
| 240 | struct exynos_drm_panel_info *panel = ctx->panel; | 239 | struct exynos_drm_panel_info *panel = &ctx->panel; |
| 241 | struct fb_videomode *timing = &panel->timing; | 240 | struct videomode *vm = &panel->vm; |
| 242 | struct fimd_driver_data *driver_data; | 241 | struct fimd_driver_data *driver_data; |
| 243 | u32 val; | 242 | u32 val; |
| 244 | 243 | ||
| @@ -250,22 +249,22 @@ static void fimd_commit(struct device *dev) | |||
| 250 | writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1); | 249 | writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1); |
| 251 | 250 | ||
| 252 | /* setup vertical timing values. */ | 251 | /* setup vertical timing values. */ |
| 253 | val = VIDTCON0_VBPD(timing->upper_margin - 1) | | 252 | val = VIDTCON0_VBPD(vm->vback_porch - 1) | |
| 254 | VIDTCON0_VFPD(timing->lower_margin - 1) | | 253 | VIDTCON0_VFPD(vm->vfront_porch - 1) | |
| 255 | VIDTCON0_VSPW(timing->vsync_len - 1); | 254 | VIDTCON0_VSPW(vm->vsync_len - 1); |
| 256 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON0); | 255 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON0); |
| 257 | 256 | ||
| 258 | /* setup horizontal timing values. */ | 257 | /* setup horizontal timing values. */ |
| 259 | val = VIDTCON1_HBPD(timing->left_margin - 1) | | 258 | val = VIDTCON1_HBPD(vm->hback_porch - 1) | |
| 260 | VIDTCON1_HFPD(timing->right_margin - 1) | | 259 | VIDTCON1_HFPD(vm->hfront_porch - 1) | |
| 261 | VIDTCON1_HSPW(timing->hsync_len - 1); | 260 | VIDTCON1_HSPW(vm->hsync_len - 1); |
| 262 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON1); | 261 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON1); |
| 263 | 262 | ||
| 264 | /* setup horizontal and vertical display size. */ | 263 | /* setup horizontal and vertical display size. */ |
| 265 | val = VIDTCON2_LINEVAL(timing->yres - 1) | | 264 | val = VIDTCON2_LINEVAL(vm->vactive - 1) | |
| 266 | VIDTCON2_HOZVAL(timing->xres - 1) | | 265 | VIDTCON2_HOZVAL(vm->hactive - 1) | |
| 267 | VIDTCON2_LINEVAL_E(timing->yres - 1) | | 266 | VIDTCON2_LINEVAL_E(vm->vactive - 1) | |
| 268 | VIDTCON2_HOZVAL_E(timing->xres - 1); | 267 | VIDTCON2_HOZVAL_E(vm->hactive - 1); |
| 269 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON2); | 268 | writel(val, ctx->regs + driver_data->timing_base + VIDTCON2); |
| 270 | 269 | ||
| 271 | /* setup clock source, clock divider, enable dma. */ | 270 | /* setup clock source, clock divider, enable dma. */ |
| @@ -396,6 +395,7 @@ static void fimd_win_mode_set(struct device *dev, | |||
| 396 | win_data->fb_height = overlay->fb_height; | 395 | win_data->fb_height = overlay->fb_height; |
| 397 | win_data->dma_addr = overlay->dma_addr[0] + offset; | 396 | win_data->dma_addr = overlay->dma_addr[0] + offset; |
| 398 | win_data->bpp = overlay->bpp; | 397 | win_data->bpp = overlay->bpp; |
| 398 | win_data->pixel_format = overlay->pixel_format; | ||
| 399 | win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * | 399 | win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * |
| 400 | (overlay->bpp >> 3); | 400 | (overlay->bpp >> 3); |
| 401 | win_data->line_size = overlay->crtc_width * (overlay->bpp >> 3); | 401 | win_data->line_size = overlay->crtc_width * (overlay->bpp >> 3); |
| @@ -417,39 +417,38 @@ static void fimd_win_set_pixfmt(struct device *dev, unsigned int win) | |||
| 417 | 417 | ||
| 418 | val = WINCONx_ENWIN; | 418 | val = WINCONx_ENWIN; |
| 419 | 419 | ||
| 420 | switch (win_data->bpp) { | 420 | /* |
| 421 | case 1: | 421 | * In case of s3c64xx, window 0 doesn't support alpha channel. |
| 422 | val |= WINCON0_BPPMODE_1BPP; | 422 | * So the request format is ARGB8888 then change it to XRGB8888. |
| 423 | val |= WINCONx_BITSWP; | 423 | */ |
| 424 | val |= WINCONx_BURSTLEN_4WORD; | 424 | if (ctx->driver_data->has_limited_fmt && !win) { |
| 425 | break; | 425 | if (win_data->pixel_format == DRM_FORMAT_ARGB8888) |
| 426 | case 2: | 426 | win_data->pixel_format = DRM_FORMAT_XRGB8888; |
| 427 | val |= WINCON0_BPPMODE_2BPP; | 427 | } |
| 428 | val |= WINCONx_BITSWP; | 428 | |
| 429 | val |= WINCONx_BURSTLEN_8WORD; | 429 | switch (win_data->pixel_format) { |
| 430 | break; | 430 | case DRM_FORMAT_C8: |
| 431 | case 4: | ||
| 432 | val |= WINCON0_BPPMODE_4BPP; | ||
| 433 | val |= WINCONx_BITSWP; | ||
| 434 | val |= WINCONx_BURSTLEN_8WORD; | ||
| 435 | break; | ||
| 436 | case 8: | ||
| 437 | val |= WINCON0_BPPMODE_8BPP_PALETTE; | 431 | val |= WINCON0_BPPMODE_8BPP_PALETTE; |
| 438 | val |= WINCONx_BURSTLEN_8WORD; | 432 | val |= WINCONx_BURSTLEN_8WORD; |
| 439 | val |= WINCONx_BYTSWP; | 433 | val |= WINCONx_BYTSWP; |
| 440 | break; | 434 | break; |
| 441 | case 16: | 435 | case DRM_FORMAT_XRGB1555: |
| 436 | val |= WINCON0_BPPMODE_16BPP_1555; | ||
| 437 | val |= WINCONx_HAWSWP; | ||
| 438 | val |= WINCONx_BURSTLEN_16WORD; | ||
| 439 | break; | ||
| 440 | case DRM_FORMAT_RGB565: | ||
| 442 | val |= WINCON0_BPPMODE_16BPP_565; | 441 | val |= WINCON0_BPPMODE_16BPP_565; |
| 443 | val |= WINCONx_HAWSWP; | 442 | val |= WINCONx_HAWSWP; |
| 444 | val |= WINCONx_BURSTLEN_16WORD; | 443 | val |= WINCONx_BURSTLEN_16WORD; |
| 445 | break; | 444 | break; |
| 446 | case 24: | 445 | case DRM_FORMAT_XRGB8888: |
| 447 | val |= WINCON0_BPPMODE_24BPP_888; | 446 | val |= WINCON0_BPPMODE_24BPP_888; |
| 448 | val |= WINCONx_WSWP; | 447 | val |= WINCONx_WSWP; |
| 449 | val |= WINCONx_BURSTLEN_16WORD; | 448 | val |= WINCONx_BURSTLEN_16WORD; |
| 450 | break; | 449 | break; |
| 451 | case 32: | 450 | case DRM_FORMAT_ARGB8888: |
| 452 | val |= WINCON1_BPPMODE_28BPP_A4888 | 451 | val |= WINCON1_BPPMODE_25BPP_A1888 |
| 453 | | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL; | 452 | | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL; |
| 454 | val |= WINCONx_WSWP; | 453 | val |= WINCONx_WSWP; |
| 455 | val |= WINCONx_BURSTLEN_16WORD; | 454 | val |= WINCONx_BURSTLEN_16WORD; |
| @@ -746,45 +745,54 @@ static void fimd_subdrv_remove(struct drm_device *drm_dev, struct device *dev) | |||
| 746 | drm_iommu_detach_device(drm_dev, dev); | 745 | drm_iommu_detach_device(drm_dev, dev); |
| 747 | } | 746 | } |
| 748 | 747 | ||
| 749 | static int fimd_calc_clkdiv(struct fimd_context *ctx, | 748 | static int fimd_configure_clocks(struct fimd_context *ctx, struct device *dev) |
| 750 | struct fb_videomode *timing) | ||
| 751 | { | 749 | { |
| 752 | unsigned long clk = clk_get_rate(ctx->lcd_clk); | 750 | struct videomode *vm = &ctx->panel.vm; |
| 753 | u32 retrace; | 751 | unsigned long clk; |
| 754 | u32 clkdiv; | 752 | |
| 755 | u32 best_framerate = 0; | 753 | ctx->bus_clk = devm_clk_get(dev, "fimd"); |
| 756 | u32 framerate; | 754 | if (IS_ERR(ctx->bus_clk)) { |
| 757 | 755 | dev_err(dev, "failed to get bus clock\n"); | |
| 758 | retrace = timing->left_margin + timing->hsync_len + | 756 | return PTR_ERR(ctx->bus_clk); |
| 759 | timing->right_margin + timing->xres; | 757 | } |
| 760 | retrace *= timing->upper_margin + timing->vsync_len + | 758 | |
| 761 | timing->lower_margin + timing->yres; | 759 | ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd"); |
| 762 | 760 | if (IS_ERR(ctx->lcd_clk)) { | |
| 763 | /* default framerate is 60Hz */ | 761 | dev_err(dev, "failed to get lcd clock\n"); |
| 764 | if (!timing->refresh) | 762 | return PTR_ERR(ctx->lcd_clk); |
| 765 | timing->refresh = 60; | 763 | } |
| 766 | 764 | ||
| 767 | clk /= retrace; | 765 | clk = clk_get_rate(ctx->lcd_clk); |
| 768 | 766 | if (clk == 0) { | |
| 769 | for (clkdiv = 1; clkdiv < 0x100; clkdiv++) { | 767 | dev_err(dev, "error getting sclk_fimd clock rate\n"); |
| 770 | int tmp; | 768 | return -EINVAL; |
| 771 | 769 | } | |
| 772 | /* get best framerate */ | 770 | |
| 773 | framerate = clk / clkdiv; | 771 | if (vm->pixelclock == 0) { |
| 774 | tmp = timing->refresh - framerate; | 772 | unsigned long c; |
| 775 | if (tmp < 0) { | 773 | c = vm->hactive + vm->hback_porch + vm->hfront_porch + |
| 776 | best_framerate = framerate; | 774 | vm->hsync_len; |
| 777 | continue; | 775 | c *= vm->vactive + vm->vback_porch + vm->vfront_porch + |
| 778 | } else { | 776 | vm->vsync_len; |
| 779 | if (!best_framerate) | 777 | vm->pixelclock = c * FIMD_DEFAULT_FRAMERATE; |
| 780 | best_framerate = framerate; | 778 | if (vm->pixelclock == 0) { |
| 781 | else if (tmp < (best_framerate - framerate)) | 779 | dev_err(dev, "incorrect display timings\n"); |
| 782 | best_framerate = framerate; | 780 | return -EINVAL; |
| 783 | break; | ||
| 784 | } | 781 | } |
| 782 | dev_warn(dev, "pixel clock recalculated to %luHz (%dHz frame rate)\n", | ||
| 783 | vm->pixelclock, FIMD_DEFAULT_FRAMERATE); | ||
| 785 | } | 784 | } |
| 785 | ctx->clkdiv = DIV_ROUND_UP(clk, vm->pixelclock); | ||
| 786 | if (ctx->clkdiv > 256) { | ||
| 787 | dev_warn(dev, "calculated pixel clock divider too high (%u), lowered to 256\n", | ||
| 788 | ctx->clkdiv); | ||
| 789 | ctx->clkdiv = 256; | ||
| 790 | } | ||
| 791 | vm->pixelclock = clk / ctx->clkdiv; | ||
| 792 | DRM_DEBUG_KMS("pixel clock = %lu, clkdiv = %d\n", vm->pixelclock, | ||
| 793 | ctx->clkdiv); | ||
| 786 | 794 | ||
| 787 | return clkdiv; | 795 | return 0; |
| 788 | } | 796 | } |
| 789 | 797 | ||
| 790 | static void fimd_clear_win(struct fimd_context *ctx, int win) | 798 | static void fimd_clear_win(struct fimd_context *ctx, int win) |
| @@ -876,59 +884,53 @@ static int fimd_activate(struct fimd_context *ctx, bool enable) | |||
| 876 | return 0; | 884 | return 0; |
| 877 | } | 885 | } |
| 878 | 886 | ||
| 887 | static int fimd_get_platform_data(struct fimd_context *ctx, struct device *dev) | ||
| 888 | { | ||
| 889 | struct videomode *vm; | ||
| 890 | int ret; | ||
| 891 | |||
| 892 | vm = &ctx->panel.vm; | ||
| 893 | ret = of_get_videomode(dev->of_node, vm, OF_USE_NATIVE_MODE); | ||
| 894 | if (ret) { | ||
| 895 | DRM_ERROR("failed: of_get_videomode() : %d\n", ret); | ||
| 896 | return ret; | ||
| 897 | } | ||
| 898 | |||
| 899 | if (vm->flags & DISPLAY_FLAGS_VSYNC_LOW) | ||
| 900 | ctx->vidcon1 |= VIDCON1_INV_VSYNC; | ||
| 901 | if (vm->flags & DISPLAY_FLAGS_HSYNC_LOW) | ||
| 902 | ctx->vidcon1 |= VIDCON1_INV_HSYNC; | ||
| 903 | if (vm->flags & DISPLAY_FLAGS_DE_LOW) | ||
| 904 | ctx->vidcon1 |= VIDCON1_INV_VDEN; | ||
| 905 | if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) | ||
| 906 | ctx->vidcon1 |= VIDCON1_INV_VCLK; | ||
| 907 | |||
| 908 | return 0; | ||
| 909 | } | ||
| 910 | |||
| 879 | static int fimd_probe(struct platform_device *pdev) | 911 | static int fimd_probe(struct platform_device *pdev) |
| 880 | { | 912 | { |
| 881 | struct device *dev = &pdev->dev; | 913 | struct device *dev = &pdev->dev; |
| 882 | struct fimd_context *ctx; | 914 | struct fimd_context *ctx; |
| 883 | struct exynos_drm_subdrv *subdrv; | 915 | struct exynos_drm_subdrv *subdrv; |
| 884 | struct exynos_drm_fimd_pdata *pdata; | ||
| 885 | struct exynos_drm_panel_info *panel; | ||
| 886 | struct resource *res; | 916 | struct resource *res; |
| 887 | int win; | 917 | int win; |
| 888 | int ret = -EINVAL; | 918 | int ret = -EINVAL; |
| 889 | 919 | ||
| 890 | if (dev->of_node) { | 920 | if (!dev->of_node) |
| 891 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 921 | return -ENODEV; |
| 892 | if (!pdata) { | ||
| 893 | DRM_ERROR("memory allocation for pdata failed\n"); | ||
| 894 | return -ENOMEM; | ||
| 895 | } | ||
| 896 | |||
| 897 | ret = of_get_fb_videomode(dev->of_node, &pdata->panel.timing, | ||
| 898 | OF_USE_NATIVE_MODE); | ||
| 899 | if (ret) { | ||
| 900 | DRM_ERROR("failed: of_get_fb_videomode() : %d\n", ret); | ||
| 901 | return ret; | ||
| 902 | } | ||
| 903 | } else { | ||
| 904 | pdata = dev->platform_data; | ||
| 905 | if (!pdata) { | ||
| 906 | DRM_ERROR("no platform data specified\n"); | ||
| 907 | return -EINVAL; | ||
| 908 | } | ||
| 909 | } | ||
| 910 | |||
| 911 | panel = &pdata->panel; | ||
| 912 | if (!panel) { | ||
| 913 | dev_err(dev, "panel is null.\n"); | ||
| 914 | return -EINVAL; | ||
| 915 | } | ||
| 916 | 922 | ||
| 917 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); | 923 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
| 918 | if (!ctx) | 924 | if (!ctx) |
| 919 | return -ENOMEM; | 925 | return -ENOMEM; |
| 920 | 926 | ||
| 921 | ctx->bus_clk = devm_clk_get(dev, "fimd"); | 927 | ret = fimd_get_platform_data(ctx, dev); |
| 922 | if (IS_ERR(ctx->bus_clk)) { | 928 | if (ret) |
| 923 | dev_err(dev, "failed to get bus clock\n"); | 929 | return ret; |
| 924 | return PTR_ERR(ctx->bus_clk); | ||
| 925 | } | ||
| 926 | 930 | ||
| 927 | ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd"); | 931 | ret = fimd_configure_clocks(ctx, dev); |
| 928 | if (IS_ERR(ctx->lcd_clk)) { | 932 | if (ret) |
| 929 | dev_err(dev, "failed to get lcd clock\n"); | 933 | return ret; |
| 930 | return PTR_ERR(ctx->lcd_clk); | ||
| 931 | } | ||
| 932 | 934 | ||
| 933 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 935 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 934 | 936 | ||
| @@ -952,10 +954,6 @@ static int fimd_probe(struct platform_device *pdev) | |||
| 952 | } | 954 | } |
| 953 | 955 | ||
| 954 | ctx->driver_data = drm_fimd_get_driver_data(pdev); | 956 | ctx->driver_data = drm_fimd_get_driver_data(pdev); |
| 955 | ctx->vidcon0 = pdata->vidcon0; | ||
| 956 | ctx->vidcon1 = pdata->vidcon1; | ||
| 957 | ctx->default_win = pdata->default_win; | ||
| 958 | ctx->panel = panel; | ||
| 959 | DRM_INIT_WAITQUEUE(&ctx->wait_vsync_queue); | 957 | DRM_INIT_WAITQUEUE(&ctx->wait_vsync_queue); |
| 960 | atomic_set(&ctx->wait_vsync_event, 0); | 958 | atomic_set(&ctx->wait_vsync_event, 0); |
| 961 | 959 | ||
| @@ -973,12 +971,6 @@ static int fimd_probe(struct platform_device *pdev) | |||
| 973 | pm_runtime_enable(dev); | 971 | pm_runtime_enable(dev); |
| 974 | pm_runtime_get_sync(dev); | 972 | pm_runtime_get_sync(dev); |
| 975 | 973 | ||
| 976 | ctx->clkdiv = fimd_calc_clkdiv(ctx, &panel->timing); | ||
| 977 | panel->timing.pixclock = clk_get_rate(ctx->lcd_clk) / ctx->clkdiv; | ||
| 978 | |||
| 979 | DRM_DEBUG_KMS("pixel clock = %d, clkdiv = %d\n", | ||
| 980 | panel->timing.pixclock, ctx->clkdiv); | ||
| 981 | |||
| 982 | for (win = 0; win < WINDOWS_NR; win++) | 974 | for (win = 0; win < WINDOWS_NR; win++) |
| 983 | fimd_clear_win(ctx, win); | 975 | fimd_clear_win(ctx, win); |
| 984 | 976 | ||
| @@ -1067,20 +1059,6 @@ static int fimd_runtime_resume(struct device *dev) | |||
| 1067 | } | 1059 | } |
| 1068 | #endif | 1060 | #endif |
| 1069 | 1061 | ||
| 1070 | static struct platform_device_id fimd_driver_ids[] = { | ||
| 1071 | { | ||
| 1072 | .name = "s3c64xx-fb", | ||
| 1073 | .driver_data = (unsigned long)&s3c64xx_fimd_driver_data, | ||
| 1074 | }, { | ||
| 1075 | .name = "exynos4-fb", | ||
| 1076 | .driver_data = (unsigned long)&exynos4_fimd_driver_data, | ||
| 1077 | }, { | ||
| 1078 | .name = "exynos5-fb", | ||
| 1079 | .driver_data = (unsigned long)&exynos5_fimd_driver_data, | ||
| 1080 | }, | ||
| 1081 | {}, | ||
| 1082 | }; | ||
| 1083 | |||
| 1084 | static const struct dev_pm_ops fimd_pm_ops = { | 1062 | static const struct dev_pm_ops fimd_pm_ops = { |
| 1085 | SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) | 1063 | SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) |
| 1086 | SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL) | 1064 | SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL) |
| @@ -1089,11 +1067,10 @@ static const struct dev_pm_ops fimd_pm_ops = { | |||
| 1089 | struct platform_driver fimd_driver = { | 1067 | struct platform_driver fimd_driver = { |
| 1090 | .probe = fimd_probe, | 1068 | .probe = fimd_probe, |
| 1091 | .remove = fimd_remove, | 1069 | .remove = fimd_remove, |
| 1092 | .id_table = fimd_driver_ids, | ||
| 1093 | .driver = { | 1070 | .driver = { |
| 1094 | .name = "exynos4-fb", | 1071 | .name = "exynos4-fb", |
| 1095 | .owner = THIS_MODULE, | 1072 | .owner = THIS_MODULE, |
| 1096 | .pm = &fimd_pm_ops, | 1073 | .pm = &fimd_pm_ops, |
| 1097 | .of_match_table = of_match_ptr(fimd_driver_dt_match), | 1074 | .of_match_table = fimd_driver_dt_match, |
| 1098 | }, | 1075 | }, |
| 1099 | }; | 1076 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index eddea4941483..3271fd4b1724 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <drm/drmP.h> | 23 | #include <drm/drmP.h> |
| 24 | #include <drm/exynos_drm.h> | 24 | #include <drm/exynos_drm.h> |
| 25 | #include "exynos_drm_drv.h" | 25 | #include "exynos_drm_drv.h" |
| 26 | #include "exynos_drm_g2d.h" | ||
| 26 | #include "exynos_drm_gem.h" | 27 | #include "exynos_drm_gem.h" |
| 27 | #include "exynos_drm_iommu.h" | 28 | #include "exynos_drm_iommu.h" |
| 28 | 29 | ||
| @@ -446,10 +447,8 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
| 446 | } | 447 | } |
| 447 | 448 | ||
| 448 | g2d_userptr = kzalloc(sizeof(*g2d_userptr), GFP_KERNEL); | 449 | g2d_userptr = kzalloc(sizeof(*g2d_userptr), GFP_KERNEL); |
| 449 | if (!g2d_userptr) { | 450 | if (!g2d_userptr) |
| 450 | DRM_ERROR("failed to allocate g2d_userptr.\n"); | ||
| 451 | return ERR_PTR(-ENOMEM); | 451 | return ERR_PTR(-ENOMEM); |
| 452 | } | ||
| 453 | 452 | ||
| 454 | atomic_set(&g2d_userptr->refcount, 1); | 453 | atomic_set(&g2d_userptr->refcount, 1); |
| 455 | 454 | ||
| @@ -499,7 +498,6 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
| 499 | 498 | ||
| 500 | sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); | 499 | sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); |
| 501 | if (!sgt) { | 500 | if (!sgt) { |
| 502 | DRM_ERROR("failed to allocate sg table.\n"); | ||
| 503 | ret = -ENOMEM; | 501 | ret = -ENOMEM; |
| 504 | goto err_free_userptr; | 502 | goto err_free_userptr; |
| 505 | } | 503 | } |
| @@ -808,17 +806,8 @@ static void g2d_dma_start(struct g2d_data *g2d, | |||
| 808 | int ret; | 806 | int ret; |
| 809 | 807 | ||
| 810 | ret = pm_runtime_get_sync(g2d->dev); | 808 | ret = pm_runtime_get_sync(g2d->dev); |
| 811 | if (ret < 0) { | 809 | if (ret < 0) |
| 812 | dev_warn(g2d->dev, "failed pm power on.\n"); | ||
| 813 | return; | ||
| 814 | } | ||
| 815 | |||
| 816 | ret = clk_prepare_enable(g2d->gate_clk); | ||
| 817 | if (ret < 0) { | ||
| 818 | dev_warn(g2d->dev, "failed to enable clock.\n"); | ||
| 819 | pm_runtime_put_sync(g2d->dev); | ||
| 820 | return; | 810 | return; |
| 821 | } | ||
| 822 | 811 | ||
| 823 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); | 812 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); |
| 824 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); | 813 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); |
| @@ -871,7 +860,6 @@ static void g2d_runqueue_worker(struct work_struct *work) | |||
| 871 | runqueue_work); | 860 | runqueue_work); |
| 872 | 861 | ||
| 873 | mutex_lock(&g2d->runqueue_mutex); | 862 | mutex_lock(&g2d->runqueue_mutex); |
| 874 | clk_disable_unprepare(g2d->gate_clk); | ||
| 875 | pm_runtime_put_sync(g2d->dev); | 863 | pm_runtime_put_sync(g2d->dev); |
| 876 | 864 | ||
| 877 | complete(&g2d->runqueue_node->complete); | 865 | complete(&g2d->runqueue_node->complete); |
| @@ -1096,8 +1084,6 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, | |||
| 1096 | 1084 | ||
| 1097 | e = kzalloc(sizeof(*node->event), GFP_KERNEL); | 1085 | e = kzalloc(sizeof(*node->event), GFP_KERNEL); |
| 1098 | if (!e) { | 1086 | if (!e) { |
| 1099 | dev_err(dev, "failed to allocate event\n"); | ||
| 1100 | |||
| 1101 | spin_lock_irqsave(&drm_dev->event_lock, flags); | 1087 | spin_lock_irqsave(&drm_dev->event_lock, flags); |
| 1102 | file->event_space += sizeof(e->event); | 1088 | file->event_space += sizeof(e->event); |
| 1103 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); | 1089 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); |
| @@ -1327,10 +1313,8 @@ static int g2d_open(struct drm_device *drm_dev, struct device *dev, | |||
| 1327 | struct exynos_drm_g2d_private *g2d_priv; | 1313 | struct exynos_drm_g2d_private *g2d_priv; |
| 1328 | 1314 | ||
| 1329 | g2d_priv = kzalloc(sizeof(*g2d_priv), GFP_KERNEL); | 1315 | g2d_priv = kzalloc(sizeof(*g2d_priv), GFP_KERNEL); |
| 1330 | if (!g2d_priv) { | 1316 | if (!g2d_priv) |
| 1331 | dev_err(dev, "failed to allocate g2d private data\n"); | ||
| 1332 | return -ENOMEM; | 1317 | return -ENOMEM; |
| 1333 | } | ||
| 1334 | 1318 | ||
| 1335 | g2d_priv->dev = dev; | 1319 | g2d_priv->dev = dev; |
| 1336 | file_priv->g2d_priv = g2d_priv; | 1320 | file_priv->g2d_priv = g2d_priv; |
| @@ -1386,10 +1370,8 @@ static int g2d_probe(struct platform_device *pdev) | |||
| 1386 | int ret; | 1370 | int ret; |
| 1387 | 1371 | ||
| 1388 | g2d = devm_kzalloc(dev, sizeof(*g2d), GFP_KERNEL); | 1372 | g2d = devm_kzalloc(dev, sizeof(*g2d), GFP_KERNEL); |
| 1389 | if (!g2d) { | 1373 | if (!g2d) |
| 1390 | dev_err(dev, "failed to allocate driver data\n"); | ||
| 1391 | return -ENOMEM; | 1374 | return -ENOMEM; |
| 1392 | } | ||
| 1393 | 1375 | ||
| 1394 | g2d->runqueue_slab = kmem_cache_create("g2d_runqueue_slab", | 1376 | g2d->runqueue_slab = kmem_cache_create("g2d_runqueue_slab", |
| 1395 | sizeof(struct g2d_runqueue_node), 0, 0, NULL); | 1377 | sizeof(struct g2d_runqueue_node), 0, 0, NULL); |
| @@ -1524,14 +1506,38 @@ static int g2d_resume(struct device *dev) | |||
| 1524 | } | 1506 | } |
| 1525 | #endif | 1507 | #endif |
| 1526 | 1508 | ||
| 1527 | static SIMPLE_DEV_PM_OPS(g2d_pm_ops, g2d_suspend, g2d_resume); | 1509 | #ifdef CONFIG_PM_RUNTIME |
| 1510 | static int g2d_runtime_suspend(struct device *dev) | ||
| 1511 | { | ||
| 1512 | struct g2d_data *g2d = dev_get_drvdata(dev); | ||
| 1513 | |||
| 1514 | clk_disable_unprepare(g2d->gate_clk); | ||
| 1515 | |||
| 1516 | return 0; | ||
| 1517 | } | ||
| 1518 | |||
| 1519 | static int g2d_runtime_resume(struct device *dev) | ||
| 1520 | { | ||
| 1521 | struct g2d_data *g2d = dev_get_drvdata(dev); | ||
| 1522 | int ret; | ||
| 1523 | |||
| 1524 | ret = clk_prepare_enable(g2d->gate_clk); | ||
| 1525 | if (ret < 0) | ||
| 1526 | dev_warn(dev, "failed to enable clock.\n"); | ||
| 1527 | |||
| 1528 | return ret; | ||
| 1529 | } | ||
| 1530 | #endif | ||
| 1531 | |||
| 1532 | static const struct dev_pm_ops g2d_pm_ops = { | ||
| 1533 | SET_SYSTEM_SLEEP_PM_OPS(g2d_suspend, g2d_resume) | ||
| 1534 | SET_RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL) | ||
| 1535 | }; | ||
| 1528 | 1536 | ||
| 1529 | #ifdef CONFIG_OF | ||
| 1530 | static const struct of_device_id exynos_g2d_match[] = { | 1537 | static const struct of_device_id exynos_g2d_match[] = { |
| 1531 | { .compatible = "samsung,exynos5250-g2d" }, | 1538 | { .compatible = "samsung,exynos5250-g2d" }, |
| 1532 | {}, | 1539 | {}, |
| 1533 | }; | 1540 | }; |
| 1534 | #endif | ||
| 1535 | 1541 | ||
| 1536 | struct platform_driver g2d_driver = { | 1542 | struct platform_driver g2d_driver = { |
| 1537 | .probe = g2d_probe, | 1543 | .probe = g2d_probe, |
| @@ -1540,6 +1546,6 @@ struct platform_driver g2d_driver = { | |||
| 1540 | .name = "s5p-g2d", | 1546 | .name = "s5p-g2d", |
| 1541 | .owner = THIS_MODULE, | 1547 | .owner = THIS_MODULE, |
| 1542 | .pm = &g2d_pm_ops, | 1548 | .pm = &g2d_pm_ops, |
| 1543 | .of_match_table = of_match_ptr(exynos_g2d_match), | 1549 | .of_match_table = exynos_g2d_match, |
| 1544 | }, | 1550 | }, |
| 1545 | }; | 1551 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index f3c6f40666e1..49f9cd232757 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include "exynos_drm_drv.h" | 18 | #include "exynos_drm_drv.h" |
| 19 | #include "exynos_drm_gem.h" | 19 | #include "exynos_drm_gem.h" |
| 20 | #include "exynos_drm_buf.h" | 20 | #include "exynos_drm_buf.h" |
| 21 | #include "exynos_drm_iommu.h" | ||
| 21 | 22 | ||
| 22 | static unsigned int convert_to_vm_err_msg(int msg) | 23 | static unsigned int convert_to_vm_err_msg(int msg) |
| 23 | { | 24 | { |
| @@ -191,10 +192,8 @@ struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, | |||
| 191 | int ret; | 192 | int ret; |
| 192 | 193 | ||
| 193 | exynos_gem_obj = kzalloc(sizeof(*exynos_gem_obj), GFP_KERNEL); | 194 | exynos_gem_obj = kzalloc(sizeof(*exynos_gem_obj), GFP_KERNEL); |
| 194 | if (!exynos_gem_obj) { | 195 | if (!exynos_gem_obj) |
| 195 | DRM_ERROR("failed to allocate exynos gem object\n"); | ||
| 196 | return NULL; | 196 | return NULL; |
| 197 | } | ||
| 198 | 197 | ||
| 199 | exynos_gem_obj->size = size; | 198 | exynos_gem_obj->size = size; |
| 200 | obj = &exynos_gem_obj->base; | 199 | obj = &exynos_gem_obj->base; |
| @@ -668,6 +667,18 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, | |||
| 668 | 667 | ||
| 669 | exynos_gem_obj = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG | | 668 | exynos_gem_obj = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG | |
| 670 | EXYNOS_BO_WC, args->size); | 669 | EXYNOS_BO_WC, args->size); |
| 670 | /* | ||
| 671 | * If physically contiguous memory allocation fails and if IOMMU is | ||
| 672 | * supported then try to get buffer from non physically contiguous | ||
| 673 | * memory area. | ||
| 674 | */ | ||
| 675 | if (IS_ERR(exynos_gem_obj) && is_drm_iommu_supported(dev)) { | ||
| 676 | dev_warn(dev->dev, "contiguous FB allocation failed, falling back to non-contiguous\n"); | ||
| 677 | exynos_gem_obj = exynos_drm_gem_create(dev, | ||
| 678 | EXYNOS_BO_NONCONTIG | EXYNOS_BO_WC, | ||
| 679 | args->size); | ||
| 680 | } | ||
| 681 | |||
| 671 | if (IS_ERR(exynos_gem_obj)) | 682 | if (IS_ERR(exynos_gem_obj)) |
| 672 | return PTR_ERR(exynos_gem_obj); | 683 | return PTR_ERR(exynos_gem_obj); |
| 673 | 684 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 90b8a1a5344c..cd6aebd53bd0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <drm/drmP.h> | 20 | #include <drm/drmP.h> |
| 21 | #include <drm/exynos_drm.h> | 21 | #include <drm/exynos_drm.h> |
| 22 | #include "regs-gsc.h" | 22 | #include "regs-gsc.h" |
| 23 | #include "exynos_drm_drv.h" | ||
| 23 | #include "exynos_drm_ipp.h" | 24 | #include "exynos_drm_ipp.h" |
| 24 | #include "exynos_drm_gsc.h" | 25 | #include "exynos_drm_gsc.h" |
| 25 | 26 | ||
| @@ -1337,10 +1338,8 @@ static int gsc_init_prop_list(struct exynos_drm_ippdrv *ippdrv) | |||
| 1337 | struct drm_exynos_ipp_prop_list *prop_list; | 1338 | struct drm_exynos_ipp_prop_list *prop_list; |
| 1338 | 1339 | ||
| 1339 | prop_list = devm_kzalloc(ippdrv->dev, sizeof(*prop_list), GFP_KERNEL); | 1340 | prop_list = devm_kzalloc(ippdrv->dev, sizeof(*prop_list), GFP_KERNEL); |
| 1340 | if (!prop_list) { | 1341 | if (!prop_list) |
| 1341 | DRM_ERROR("failed to alloc property list.\n"); | ||
| 1342 | return -ENOMEM; | 1342 | return -ENOMEM; |
| 1343 | } | ||
| 1344 | 1343 | ||
| 1345 | prop_list->version = 1; | 1344 | prop_list->version = 1; |
| 1346 | prop_list->writeback = 1; | 1345 | prop_list->writeback = 1; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 8d3bc01d6834..8548b974bd59 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
| @@ -403,10 +403,8 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev) | |||
| 403 | struct drm_hdmi_context *ctx; | 403 | struct drm_hdmi_context *ctx; |
| 404 | 404 | ||
| 405 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); | 405 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
| 406 | if (!ctx) { | 406 | if (!ctx) |
| 407 | DRM_LOG_KMS("failed to alloc common hdmi context.\n"); | ||
| 408 | return -ENOMEM; | 407 | return -ENOMEM; |
| 409 | } | ||
| 410 | 408 | ||
| 411 | subdrv = &ctx->subdrv; | 409 | subdrv = &ctx->subdrv; |
| 412 | 410 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.c b/drivers/gpu/drm/exynos/exynos_drm_iommu.c index 3799d5c2b5df..fb8db0378274 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.c +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.c | |||
| @@ -47,10 +47,16 @@ int drm_create_iommu_mapping(struct drm_device *drm_dev) | |||
| 47 | 47 | ||
| 48 | dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms), | 48 | dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms), |
| 49 | GFP_KERNEL); | 49 | GFP_KERNEL); |
| 50 | if (!dev->dma_parms) | ||
| 51 | goto error; | ||
| 52 | |||
| 50 | dma_set_max_seg_size(dev, 0xffffffffu); | 53 | dma_set_max_seg_size(dev, 0xffffffffu); |
| 51 | dev->archdata.mapping = mapping; | 54 | dev->archdata.mapping = mapping; |
| 52 | 55 | ||
| 53 | return 0; | 56 | return 0; |
| 57 | error: | ||
| 58 | arm_iommu_release_mapping(mapping); | ||
| 59 | return -ENOMEM; | ||
| 54 | } | 60 | } |
| 55 | 61 | ||
| 56 | /* | 62 | /* |
| @@ -91,6 +97,9 @@ int drm_iommu_attach_device(struct drm_device *drm_dev, | |||
| 91 | subdrv_dev->dma_parms = devm_kzalloc(subdrv_dev, | 97 | subdrv_dev->dma_parms = devm_kzalloc(subdrv_dev, |
| 92 | sizeof(*subdrv_dev->dma_parms), | 98 | sizeof(*subdrv_dev->dma_parms), |
| 93 | GFP_KERNEL); | 99 | GFP_KERNEL); |
| 100 | if (!subdrv_dev->dma_parms) | ||
| 101 | return -ENOMEM; | ||
| 102 | |||
| 94 | dma_set_max_seg_size(subdrv_dev, 0xffffffffu); | 103 | dma_set_max_seg_size(subdrv_dev, 0xffffffffu); |
| 95 | 104 | ||
| 96 | ret = arm_iommu_attach_device(subdrv_dev, dev->archdata.mapping); | 105 | ret = arm_iommu_attach_device(subdrv_dev, dev->archdata.mapping); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index d2b6ab4def93..824e0705c8d3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c | |||
| @@ -408,10 +408,8 @@ static struct drm_exynos_ipp_cmd_work *ipp_create_cmd_work(void) | |||
| 408 | struct drm_exynos_ipp_cmd_work *cmd_work; | 408 | struct drm_exynos_ipp_cmd_work *cmd_work; |
| 409 | 409 | ||
| 410 | cmd_work = kzalloc(sizeof(*cmd_work), GFP_KERNEL); | 410 | cmd_work = kzalloc(sizeof(*cmd_work), GFP_KERNEL); |
| 411 | if (!cmd_work) { | 411 | if (!cmd_work) |
| 412 | DRM_ERROR("failed to alloc cmd_work.\n"); | ||
| 413 | return ERR_PTR(-ENOMEM); | 412 | return ERR_PTR(-ENOMEM); |
| 414 | } | ||
| 415 | 413 | ||
| 416 | INIT_WORK((struct work_struct *)cmd_work, ipp_sched_cmd); | 414 | INIT_WORK((struct work_struct *)cmd_work, ipp_sched_cmd); |
| 417 | 415 | ||
| @@ -423,10 +421,8 @@ static struct drm_exynos_ipp_event_work *ipp_create_event_work(void) | |||
| 423 | struct drm_exynos_ipp_event_work *event_work; | 421 | struct drm_exynos_ipp_event_work *event_work; |
| 424 | 422 | ||
| 425 | event_work = kzalloc(sizeof(*event_work), GFP_KERNEL); | 423 | event_work = kzalloc(sizeof(*event_work), GFP_KERNEL); |
| 426 | if (!event_work) { | 424 | if (!event_work) |
| 427 | DRM_ERROR("failed to alloc event_work.\n"); | ||
| 428 | return ERR_PTR(-ENOMEM); | 425 | return ERR_PTR(-ENOMEM); |
| 429 | } | ||
| 430 | 426 | ||
| 431 | INIT_WORK((struct work_struct *)event_work, ipp_sched_event); | 427 | INIT_WORK((struct work_struct *)event_work, ipp_sched_event); |
| 432 | 428 | ||
| @@ -482,10 +478,8 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, | |||
| 482 | 478 | ||
| 483 | /* allocate command node */ | 479 | /* allocate command node */ |
| 484 | c_node = kzalloc(sizeof(*c_node), GFP_KERNEL); | 480 | c_node = kzalloc(sizeof(*c_node), GFP_KERNEL); |
| 485 | if (!c_node) { | 481 | if (!c_node) |
| 486 | DRM_ERROR("failed to allocate map node.\n"); | ||
| 487 | return -ENOMEM; | 482 | return -ENOMEM; |
| 488 | } | ||
| 489 | 483 | ||
| 490 | /* create property id */ | 484 | /* create property id */ |
| 491 | ret = ipp_create_id(&ctx->prop_idr, &ctx->prop_lock, c_node, | 485 | ret = ipp_create_id(&ctx->prop_idr, &ctx->prop_lock, c_node, |
| @@ -694,10 +688,8 @@ static struct drm_exynos_ipp_mem_node | |||
| 694 | mutex_lock(&c_node->mem_lock); | 688 | mutex_lock(&c_node->mem_lock); |
| 695 | 689 | ||
| 696 | m_node = kzalloc(sizeof(*m_node), GFP_KERNEL); | 690 | m_node = kzalloc(sizeof(*m_node), GFP_KERNEL); |
| 697 | if (!m_node) { | 691 | if (!m_node) |
| 698 | DRM_ERROR("failed to allocate queue node.\n"); | ||
| 699 | goto err_unlock; | 692 | goto err_unlock; |
| 700 | } | ||
| 701 | 693 | ||
| 702 | /* clear base address for error handling */ | 694 | /* clear base address for error handling */ |
| 703 | memset(&buf_info, 0x0, sizeof(buf_info)); | 695 | memset(&buf_info, 0x0, sizeof(buf_info)); |
| @@ -798,9 +790,7 @@ static int ipp_get_event(struct drm_device *drm_dev, | |||
| 798 | DRM_DEBUG_KMS("ops_id[%d]buf_id[%d]\n", qbuf->ops_id, qbuf->buf_id); | 790 | DRM_DEBUG_KMS("ops_id[%d]buf_id[%d]\n", qbuf->ops_id, qbuf->buf_id); |
| 799 | 791 | ||
| 800 | e = kzalloc(sizeof(*e), GFP_KERNEL); | 792 | e = kzalloc(sizeof(*e), GFP_KERNEL); |
| 801 | |||
| 802 | if (!e) { | 793 | if (!e) { |
| 803 | DRM_ERROR("failed to allocate event.\n"); | ||
| 804 | spin_lock_irqsave(&drm_dev->event_lock, flags); | 794 | spin_lock_irqsave(&drm_dev->event_lock, flags); |
| 805 | file->event_space += sizeof(e->event); | 795 | file->event_space += sizeof(e->event); |
| 806 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); | 796 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); |
| @@ -1780,10 +1770,8 @@ static int ipp_subdrv_open(struct drm_device *drm_dev, struct device *dev, | |||
| 1780 | struct exynos_drm_ipp_private *priv; | 1770 | struct exynos_drm_ipp_private *priv; |
| 1781 | 1771 | ||
| 1782 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 1772 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 1783 | if (!priv) { | 1773 | if (!priv) |
| 1784 | DRM_ERROR("failed to allocate priv.\n"); | ||
| 1785 | return -ENOMEM; | 1774 | return -ENOMEM; |
| 1786 | } | ||
| 1787 | priv->dev = dev; | 1775 | priv->dev = dev; |
| 1788 | file_priv->ipp_priv = priv; | 1776 | file_priv->ipp_priv = priv; |
| 1789 | 1777 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 6ee55e68e0a2..fcb0652e77d0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include "exynos_drm_encoder.h" | 16 | #include "exynos_drm_encoder.h" |
| 17 | #include "exynos_drm_fb.h" | 17 | #include "exynos_drm_fb.h" |
| 18 | #include "exynos_drm_gem.h" | 18 | #include "exynos_drm_gem.h" |
| 19 | #include "exynos_drm_plane.h" | ||
| 19 | 20 | ||
| 20 | #define to_exynos_plane(x) container_of(x, struct exynos_plane, base) | 21 | #define to_exynos_plane(x) container_of(x, struct exynos_plane, base) |
| 21 | 22 | ||
| @@ -264,10 +265,8 @@ struct drm_plane *exynos_plane_init(struct drm_device *dev, | |||
| 264 | int err; | 265 | int err; |
| 265 | 266 | ||
| 266 | exynos_plane = kzalloc(sizeof(struct exynos_plane), GFP_KERNEL); | 267 | exynos_plane = kzalloc(sizeof(struct exynos_plane), GFP_KERNEL); |
| 267 | if (!exynos_plane) { | 268 | if (!exynos_plane) |
| 268 | DRM_ERROR("failed to allocate plane\n"); | ||
| 269 | return NULL; | 269 | return NULL; |
| 270 | } | ||
| 271 | 270 | ||
| 272 | err = drm_plane_init(dev, &exynos_plane->base, possible_crtcs, | 271 | err = drm_plane_init(dev, &exynos_plane->base, possible_crtcs, |
| 273 | &exynos_plane_funcs, formats, ARRAY_SIZE(formats), | 272 | &exynos_plane_funcs, formats, ARRAY_SIZE(formats), |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 49669aa24c45..7b901688defa 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <drm/exynos_drm.h> | 21 | #include <drm/exynos_drm.h> |
| 22 | #include "regs-rotator.h" | 22 | #include "regs-rotator.h" |
| 23 | #include "exynos_drm.h" | 23 | #include "exynos_drm.h" |
| 24 | #include "exynos_drm_drv.h" | ||
| 24 | #include "exynos_drm_ipp.h" | 25 | #include "exynos_drm_ipp.h" |
| 25 | 26 | ||
| 26 | /* | 27 | /* |
| @@ -471,10 +472,8 @@ static int rotator_init_prop_list(struct exynos_drm_ippdrv *ippdrv) | |||
| 471 | struct drm_exynos_ipp_prop_list *prop_list; | 472 | struct drm_exynos_ipp_prop_list *prop_list; |
| 472 | 473 | ||
| 473 | prop_list = devm_kzalloc(ippdrv->dev, sizeof(*prop_list), GFP_KERNEL); | 474 | prop_list = devm_kzalloc(ippdrv->dev, sizeof(*prop_list), GFP_KERNEL); |
| 474 | if (!prop_list) { | 475 | if (!prop_list) |
| 475 | DRM_ERROR("failed to alloc property list.\n"); | ||
| 476 | return -ENOMEM; | 476 | return -ENOMEM; |
| 477 | } | ||
| 478 | 477 | ||
| 479 | prop_list->version = 1; | 478 | prop_list->version = 1; |
| 480 | prop_list->flip = (1 << EXYNOS_DRM_FLIP_VERTICAL) | | 479 | prop_list->flip = (1 << EXYNOS_DRM_FLIP_VERTICAL) | |
| @@ -631,21 +630,96 @@ static int rotator_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) | |||
| 631 | return 0; | 630 | return 0; |
| 632 | } | 631 | } |
| 633 | 632 | ||
| 633 | static struct rot_limit_table rot_limit_tbl_4210 = { | ||
| 634 | .ycbcr420_2p = { | ||
| 635 | .min_w = 32, | ||
| 636 | .min_h = 32, | ||
| 637 | .max_w = SZ_64K, | ||
| 638 | .max_h = SZ_64K, | ||
| 639 | .align = 3, | ||
| 640 | }, | ||
| 641 | .rgb888 = { | ||
| 642 | .min_w = 8, | ||
| 643 | .min_h = 8, | ||
| 644 | .max_w = SZ_16K, | ||
| 645 | .max_h = SZ_16K, | ||
| 646 | .align = 2, | ||
| 647 | }, | ||
| 648 | }; | ||
| 649 | |||
| 650 | static struct rot_limit_table rot_limit_tbl_4x12 = { | ||
| 651 | .ycbcr420_2p = { | ||
| 652 | .min_w = 32, | ||
| 653 | .min_h = 32, | ||
| 654 | .max_w = SZ_32K, | ||
| 655 | .max_h = SZ_32K, | ||
| 656 | .align = 3, | ||
| 657 | }, | ||
| 658 | .rgb888 = { | ||
| 659 | .min_w = 8, | ||
| 660 | .min_h = 8, | ||
| 661 | .max_w = SZ_8K, | ||
| 662 | .max_h = SZ_8K, | ||
| 663 | .align = 2, | ||
| 664 | }, | ||
| 665 | }; | ||
| 666 | |||
| 667 | static struct rot_limit_table rot_limit_tbl_5250 = { | ||
| 668 | .ycbcr420_2p = { | ||
| 669 | .min_w = 32, | ||
| 670 | .min_h = 32, | ||
| 671 | .max_w = SZ_32K, | ||
| 672 | .max_h = SZ_32K, | ||
| 673 | .align = 3, | ||
| 674 | }, | ||
| 675 | .rgb888 = { | ||
| 676 | .min_w = 8, | ||
| 677 | .min_h = 8, | ||
| 678 | .max_w = SZ_8K, | ||
| 679 | .max_h = SZ_8K, | ||
| 680 | .align = 1, | ||
| 681 | }, | ||
| 682 | }; | ||
| 683 | |||
| 684 | static const struct of_device_id exynos_rotator_match[] = { | ||
| 685 | { | ||
| 686 | .compatible = "samsung,exynos4210-rotator", | ||
| 687 | .data = &rot_limit_tbl_4210, | ||
| 688 | }, | ||
| 689 | { | ||
| 690 | .compatible = "samsung,exynos4212-rotator", | ||
| 691 | .data = &rot_limit_tbl_4x12, | ||
| 692 | }, | ||
| 693 | { | ||
| 694 | .compatible = "samsung,exynos5250-rotator", | ||
| 695 | .data = &rot_limit_tbl_5250, | ||
| 696 | }, | ||
| 697 | {}, | ||
| 698 | }; | ||
| 699 | |||
| 634 | static int rotator_probe(struct platform_device *pdev) | 700 | static int rotator_probe(struct platform_device *pdev) |
| 635 | { | 701 | { |
| 636 | struct device *dev = &pdev->dev; | 702 | struct device *dev = &pdev->dev; |
| 637 | struct rot_context *rot; | 703 | struct rot_context *rot; |
| 638 | struct exynos_drm_ippdrv *ippdrv; | 704 | struct exynos_drm_ippdrv *ippdrv; |
| 705 | const struct of_device_id *match; | ||
| 639 | int ret; | 706 | int ret; |
| 640 | 707 | ||
| 708 | if (!dev->of_node) { | ||
| 709 | dev_err(dev, "cannot find of_node.\n"); | ||
| 710 | return -ENODEV; | ||
| 711 | } | ||
| 712 | |||
| 641 | rot = devm_kzalloc(dev, sizeof(*rot), GFP_KERNEL); | 713 | rot = devm_kzalloc(dev, sizeof(*rot), GFP_KERNEL); |
| 642 | if (!rot) { | 714 | if (!rot) |
| 643 | dev_err(dev, "failed to allocate rot\n"); | ||
| 644 | return -ENOMEM; | 715 | return -ENOMEM; |
| 645 | } | ||
| 646 | 716 | ||
| 647 | rot->limit_tbl = (struct rot_limit_table *) | 717 | match = of_match_node(exynos_rotator_match, dev->of_node); |
| 648 | platform_get_device_id(pdev)->driver_data; | 718 | if (!match) { |
| 719 | dev_err(dev, "failed to match node\n"); | ||
| 720 | return -ENODEV; | ||
| 721 | } | ||
| 722 | rot->limit_tbl = (struct rot_limit_table *)match->data; | ||
| 649 | 723 | ||
| 650 | rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 724 | rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 651 | rot->regs = devm_ioremap_resource(dev, rot->regs_res); | 725 | rot->regs = devm_ioremap_resource(dev, rot->regs_res); |
| @@ -717,31 +791,6 @@ static int rotator_remove(struct platform_device *pdev) | |||
| 717 | return 0; | 791 | return 0; |
| 718 | } | 792 | } |
| 719 | 793 | ||
| 720 | static struct rot_limit_table rot_limit_tbl = { | ||
| 721 | .ycbcr420_2p = { | ||
| 722 | .min_w = 32, | ||
| 723 | .min_h = 32, | ||
| 724 | .max_w = SZ_32K, | ||
| 725 | .max_h = SZ_32K, | ||
| 726 | .align = 3, | ||
| 727 | }, | ||
| 728 | .rgb888 = { | ||
| 729 | .min_w = 8, | ||
| 730 | .min_h = 8, | ||
| 731 | .max_w = SZ_8K, | ||
| 732 | .max_h = SZ_8K, | ||
| 733 | .align = 2, | ||
| 734 | }, | ||
| 735 | }; | ||
| 736 | |||
| 737 | static struct platform_device_id rotator_driver_ids[] = { | ||
| 738 | { | ||
| 739 | .name = "exynos-rot", | ||
| 740 | .driver_data = (unsigned long)&rot_limit_tbl, | ||
| 741 | }, | ||
| 742 | {}, | ||
| 743 | }; | ||
| 744 | |||
| 745 | static int rotator_clk_crtl(struct rot_context *rot, bool enable) | 794 | static int rotator_clk_crtl(struct rot_context *rot, bool enable) |
| 746 | { | 795 | { |
| 747 | if (enable) { | 796 | if (enable) { |
| @@ -803,10 +852,10 @@ static const struct dev_pm_ops rotator_pm_ops = { | |||
| 803 | struct platform_driver rotator_driver = { | 852 | struct platform_driver rotator_driver = { |
| 804 | .probe = rotator_probe, | 853 | .probe = rotator_probe, |
| 805 | .remove = rotator_remove, | 854 | .remove = rotator_remove, |
| 806 | .id_table = rotator_driver_ids, | ||
| 807 | .driver = { | 855 | .driver = { |
| 808 | .name = "exynos-rot", | 856 | .name = "exynos-rot", |
| 809 | .owner = THIS_MODULE, | 857 | .owner = THIS_MODULE, |
| 810 | .pm = &rotator_pm_ops, | 858 | .pm = &rotator_pm_ops, |
| 859 | .of_match_table = exynos_rotator_match, | ||
| 811 | }, | 860 | }, |
| 812 | }; | 861 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index c57c56519add..4400330e4449 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include "exynos_drm_drv.h" | 23 | #include "exynos_drm_drv.h" |
| 24 | #include "exynos_drm_crtc.h" | 24 | #include "exynos_drm_crtc.h" |
| 25 | #include "exynos_drm_encoder.h" | 25 | #include "exynos_drm_encoder.h" |
| 26 | #include "exynos_drm_vidi.h" | ||
| 26 | 27 | ||
| 27 | /* vidi has totally three virtual windows. */ | 28 | /* vidi has totally three virtual windows. */ |
| 28 | #define WINDOWS_NR 3 | 29 | #define WINDOWS_NR 3 |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 2f5c6942c968..a0e10aeb0e67 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/clk.h> | 32 | #include <linux/clk.h> |
| 33 | #include <linux/regulator/consumer.h> | 33 | #include <linux/regulator/consumer.h> |
| 34 | #include <linux/io.h> | 34 | #include <linux/io.h> |
| 35 | #include <linux/of.h> | ||
| 35 | #include <linux/of_gpio.h> | 36 | #include <linux/of_gpio.h> |
| 36 | 37 | ||
| 37 | #include <drm/exynos_drm.h> | 38 | #include <drm/exynos_drm.h> |
| @@ -1824,10 +1825,8 @@ static int hdmi_resources_init(struct hdmi_context *hdata) | |||
| 1824 | 1825 | ||
| 1825 | res->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) * | 1826 | res->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) * |
| 1826 | sizeof(res->regul_bulk[0]), GFP_KERNEL); | 1827 | sizeof(res->regul_bulk[0]), GFP_KERNEL); |
| 1827 | if (!res->regul_bulk) { | 1828 | if (!res->regul_bulk) |
| 1828 | DRM_ERROR("failed to get memory for regulators\n"); | ||
| 1829 | goto fail; | 1829 | goto fail; |
| 1830 | } | ||
| 1831 | for (i = 0; i < ARRAY_SIZE(supply); ++i) { | 1830 | for (i = 0; i < ARRAY_SIZE(supply); ++i) { |
| 1832 | res->regul_bulk[i].supply = supply[i]; | 1831 | res->regul_bulk[i].supply = supply[i]; |
| 1833 | res->regul_bulk[i].consumer = NULL; | 1832 | res->regul_bulk[i].consumer = NULL; |
| @@ -1859,7 +1858,6 @@ void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy) | |||
| 1859 | hdmi_hdmiphy = hdmiphy; | 1858 | hdmi_hdmiphy = hdmiphy; |
| 1860 | } | 1859 | } |
| 1861 | 1860 | ||
| 1862 | #ifdef CONFIG_OF | ||
| 1863 | static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata | 1861 | static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata |
| 1864 | (struct device *dev) | 1862 | (struct device *dev) |
| 1865 | { | 1863 | { |
| @@ -1868,10 +1866,8 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata | |||
| 1868 | u32 value; | 1866 | u32 value; |
| 1869 | 1867 | ||
| 1870 | pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); | 1868 | pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); |
| 1871 | if (!pd) { | 1869 | if (!pd) |
| 1872 | DRM_ERROR("memory allocation for pdata failed\n"); | ||
| 1873 | goto err_data; | 1870 | goto err_data; |
| 1874 | } | ||
| 1875 | 1871 | ||
| 1876 | if (!of_find_property(np, "hpd-gpio", &value)) { | 1872 | if (!of_find_property(np, "hpd-gpio", &value)) { |
| 1877 | DRM_ERROR("no hpd gpio property found\n"); | 1873 | DRM_ERROR("no hpd gpio property found\n"); |
| @@ -1885,33 +1881,7 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata | |||
| 1885 | err_data: | 1881 | err_data: |
| 1886 | return NULL; | 1882 | return NULL; |
| 1887 | } | 1883 | } |
| 1888 | #else | ||
| 1889 | static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata | ||
| 1890 | (struct device *dev) | ||
| 1891 | { | ||
| 1892 | return NULL; | ||
| 1893 | } | ||
| 1894 | #endif | ||
| 1895 | |||
| 1896 | static struct platform_device_id hdmi_driver_types[] = { | ||
| 1897 | { | ||
| 1898 | .name = "s5pv210-hdmi", | ||
| 1899 | .driver_data = HDMI_TYPE13, | ||
| 1900 | }, { | ||
| 1901 | .name = "exynos4-hdmi", | ||
| 1902 | .driver_data = HDMI_TYPE13, | ||
| 1903 | }, { | ||
| 1904 | .name = "exynos4-hdmi14", | ||
| 1905 | .driver_data = HDMI_TYPE14, | ||
| 1906 | }, { | ||
| 1907 | .name = "exynos5-hdmi", | ||
| 1908 | .driver_data = HDMI_TYPE14, | ||
| 1909 | }, { | ||
| 1910 | /* end node */ | ||
| 1911 | } | ||
| 1912 | }; | ||
| 1913 | 1884 | ||
| 1914 | #ifdef CONFIG_OF | ||
| 1915 | static struct of_device_id hdmi_match_types[] = { | 1885 | static struct of_device_id hdmi_match_types[] = { |
| 1916 | { | 1886 | { |
| 1917 | .compatible = "samsung,exynos5-hdmi", | 1887 | .compatible = "samsung,exynos5-hdmi", |
| @@ -1923,7 +1893,6 @@ static struct of_device_id hdmi_match_types[] = { | |||
| 1923 | /* end node */ | 1893 | /* end node */ |
| 1924 | } | 1894 | } |
| 1925 | }; | 1895 | }; |
| 1926 | #endif | ||
| 1927 | 1896 | ||
| 1928 | static int hdmi_probe(struct platform_device *pdev) | 1897 | static int hdmi_probe(struct platform_device *pdev) |
| 1929 | { | 1898 | { |
| @@ -1932,36 +1901,23 @@ static int hdmi_probe(struct platform_device *pdev) | |||
| 1932 | struct hdmi_context *hdata; | 1901 | struct hdmi_context *hdata; |
| 1933 | struct s5p_hdmi_platform_data *pdata; | 1902 | struct s5p_hdmi_platform_data *pdata; |
| 1934 | struct resource *res; | 1903 | struct resource *res; |
| 1904 | const struct of_device_id *match; | ||
| 1935 | int ret; | 1905 | int ret; |
| 1936 | 1906 | ||
| 1937 | if (dev->of_node) { | 1907 | if (!dev->of_node) |
| 1938 | pdata = drm_hdmi_dt_parse_pdata(dev); | 1908 | return -ENODEV; |
| 1939 | if (IS_ERR(pdata)) { | ||
| 1940 | DRM_ERROR("failed to parse dt\n"); | ||
| 1941 | return PTR_ERR(pdata); | ||
| 1942 | } | ||
| 1943 | } else { | ||
| 1944 | pdata = dev->platform_data; | ||
| 1945 | } | ||
| 1946 | 1909 | ||
| 1947 | if (!pdata) { | 1910 | pdata = drm_hdmi_dt_parse_pdata(dev); |
| 1948 | DRM_ERROR("no platform data specified\n"); | 1911 | if (!pdata) |
| 1949 | return -EINVAL; | 1912 | return -EINVAL; |
| 1950 | } | ||
| 1951 | 1913 | ||
| 1952 | drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx), | 1914 | drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx), GFP_KERNEL); |
| 1953 | GFP_KERNEL); | 1915 | if (!drm_hdmi_ctx) |
| 1954 | if (!drm_hdmi_ctx) { | ||
| 1955 | DRM_ERROR("failed to allocate common hdmi context.\n"); | ||
| 1956 | return -ENOMEM; | 1916 | return -ENOMEM; |
| 1957 | } | ||
| 1958 | 1917 | ||
| 1959 | hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), | 1918 | hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL); |
| 1960 | GFP_KERNEL); | 1919 | if (!hdata) |
| 1961 | if (!hdata) { | ||
| 1962 | DRM_ERROR("out of memory\n"); | ||
| 1963 | return -ENOMEM; | 1920 | return -ENOMEM; |
| 1964 | } | ||
| 1965 | 1921 | ||
| 1966 | mutex_init(&hdata->hdmi_mutex); | 1922 | mutex_init(&hdata->hdmi_mutex); |
| 1967 | 1923 | ||
| @@ -1970,23 +1926,15 @@ static int hdmi_probe(struct platform_device *pdev) | |||
| 1970 | 1926 | ||
| 1971 | platform_set_drvdata(pdev, drm_hdmi_ctx); | 1927 | platform_set_drvdata(pdev, drm_hdmi_ctx); |
| 1972 | 1928 | ||
| 1973 | if (dev->of_node) { | 1929 | match = of_match_node(hdmi_match_types, dev->of_node); |
| 1974 | const struct of_device_id *match; | 1930 | if (!match) |
| 1975 | match = of_match_node(of_match_ptr(hdmi_match_types), | 1931 | return -ENODEV; |
| 1976 | dev->of_node); | 1932 | hdata->type = (enum hdmi_type)match->data; |
| 1977 | if (match == NULL) | ||
| 1978 | return -ENODEV; | ||
| 1979 | hdata->type = (enum hdmi_type)match->data; | ||
| 1980 | } else { | ||
| 1981 | hdata->type = (enum hdmi_type)platform_get_device_id | ||
| 1982 | (pdev)->driver_data; | ||
| 1983 | } | ||
| 1984 | 1933 | ||
| 1985 | hdata->hpd_gpio = pdata->hpd_gpio; | 1934 | hdata->hpd_gpio = pdata->hpd_gpio; |
| 1986 | hdata->dev = dev; | 1935 | hdata->dev = dev; |
| 1987 | 1936 | ||
| 1988 | ret = hdmi_resources_init(hdata); | 1937 | ret = hdmi_resources_init(hdata); |
| 1989 | |||
| 1990 | if (ret) { | 1938 | if (ret) { |
| 1991 | DRM_ERROR("hdmi_resources_init failed\n"); | 1939 | DRM_ERROR("hdmi_resources_init failed\n"); |
| 1992 | return -EINVAL; | 1940 | return -EINVAL; |
| @@ -2141,11 +2089,10 @@ static const struct dev_pm_ops hdmi_pm_ops = { | |||
| 2141 | struct platform_driver hdmi_driver = { | 2089 | struct platform_driver hdmi_driver = { |
| 2142 | .probe = hdmi_probe, | 2090 | .probe = hdmi_probe, |
| 2143 | .remove = hdmi_remove, | 2091 | .remove = hdmi_remove, |
| 2144 | .id_table = hdmi_driver_types, | ||
| 2145 | .driver = { | 2092 | .driver = { |
| 2146 | .name = "exynos-hdmi", | 2093 | .name = "exynos-hdmi", |
| 2147 | .owner = THIS_MODULE, | 2094 | .owner = THIS_MODULE, |
| 2148 | .pm = &hdmi_pm_ops, | 2095 | .pm = &hdmi_pm_ops, |
| 2149 | .of_match_table = of_match_ptr(hdmi_match_types), | 2096 | .of_match_table = hdmi_match_types, |
| 2150 | }, | 2097 | }, |
| 2151 | }; | 2098 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmiphy.c b/drivers/gpu/drm/exynos/exynos_hdmiphy.c index 6e320ae9afed..59abb1494ceb 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmiphy.c +++ b/drivers/gpu/drm/exynos/exynos_hdmiphy.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
| 18 | #include <linux/of.h> | ||
| 18 | 19 | ||
| 19 | #include "exynos_drm_drv.h" | 20 | #include "exynos_drm_drv.h" |
| 20 | #include "exynos_hdmi.h" | 21 | #include "exynos_hdmi.h" |
| @@ -39,13 +40,6 @@ static int hdmiphy_remove(struct i2c_client *client) | |||
| 39 | return 0; | 40 | return 0; |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | static const struct i2c_device_id hdmiphy_id[] = { | ||
| 43 | { "s5p_hdmiphy", 0 }, | ||
| 44 | { "exynos5-hdmiphy", 0 }, | ||
| 45 | { }, | ||
| 46 | }; | ||
| 47 | |||
| 48 | #ifdef CONFIG_OF | ||
| 49 | static struct of_device_id hdmiphy_match_types[] = { | 43 | static struct of_device_id hdmiphy_match_types[] = { |
| 50 | { | 44 | { |
| 51 | .compatible = "samsung,exynos5-hdmiphy", | 45 | .compatible = "samsung,exynos5-hdmiphy", |
| @@ -57,15 +51,13 @@ static struct of_device_id hdmiphy_match_types[] = { | |||
| 57 | /* end node */ | 51 | /* end node */ |
| 58 | } | 52 | } |
| 59 | }; | 53 | }; |
| 60 | #endif | ||
| 61 | 54 | ||
| 62 | struct i2c_driver hdmiphy_driver = { | 55 | struct i2c_driver hdmiphy_driver = { |
| 63 | .driver = { | 56 | .driver = { |
| 64 | .name = "exynos-hdmiphy", | 57 | .name = "exynos-hdmiphy", |
| 65 | .owner = THIS_MODULE, | 58 | .owner = THIS_MODULE, |
| 66 | .of_match_table = of_match_ptr(hdmiphy_match_types), | 59 | .of_match_table = hdmiphy_match_types, |
| 67 | }, | 60 | }, |
| 68 | .id_table = hdmiphy_id, | ||
| 69 | .probe = hdmiphy_probe, | 61 | .probe = hdmiphy_probe, |
| 70 | .remove = hdmiphy_remove, | 62 | .remove = hdmiphy_remove, |
| 71 | .command = NULL, | 63 | .command = NULL, |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index c9a137caea41..63bc5f92fbb3 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
| 31 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
| 32 | #include <linux/regulator/consumer.h> | 32 | #include <linux/regulator/consumer.h> |
| 33 | #include <linux/of.h> | ||
| 33 | 34 | ||
| 34 | #include <drm/exynos_drm.h> | 35 | #include <drm/exynos_drm.h> |
| 35 | 36 | ||
| @@ -1185,16 +1186,12 @@ static int mixer_probe(struct platform_device *pdev) | |||
| 1185 | 1186 | ||
| 1186 | drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx), | 1187 | drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx), |
| 1187 | GFP_KERNEL); | 1188 | GFP_KERNEL); |
| 1188 | if (!drm_hdmi_ctx) { | 1189 | if (!drm_hdmi_ctx) |
| 1189 | DRM_ERROR("failed to allocate common hdmi context.\n"); | ||
| 1190 | return -ENOMEM; | 1190 | return -ENOMEM; |
| 1191 | } | ||
| 1192 | 1191 | ||
| 1193 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); | 1192 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
| 1194 | if (!ctx) { | 1193 | if (!ctx) |
| 1195 | DRM_ERROR("failed to alloc mixer context.\n"); | ||
| 1196 | return -ENOMEM; | 1194 | return -ENOMEM; |
| 1197 | } | ||
| 1198 | 1195 | ||
| 1199 | mutex_init(&ctx->mixer_mutex); | 1196 | mutex_init(&ctx->mixer_mutex); |
| 1200 | 1197 | ||
