Skip to content

Commit 86a7e12

Browse files
committed
Merge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next
Summary: - Consider fallback option to gem allocation fail . try to allocate physically non-contiguous memory if iommu is supported when physically contiguous memory allocation failed. - Add runtime pm support to g2d driver - Add device tree support . add device tree support to rotator driver, make fimd driver get signal polarities from device tree. - some fixups . correct pixel format setting to fimd driver, and consider pixel format checking to a particular window layer. - some cleanups . replace fb_videomode with videomode. . remove non-DT support * 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: (21 commits) drm/exynos: Fix build error with exynos_drm_connector.c drm/exynos: Remove non-DT support in exynos_drm_fimd drm/exynos: Remove non-DT support in exynos_hdmi drm/exynos: Remove non-DT support in exynos_drm_g2d drm/exynos: Remove non-DT support in exynos_hdmiphy drm/exynos: Remove non-DT support in exynos_ddc drm/exynos: Make Exynos DRM drivers depend on OF drm/exynos: Consider fallback option to allocation fail drm/exynos: fimd: move platform data parsing to separate function drm/exynos: fimd: get signal polarities from device tree drm/exynos: fimd: replace struct fb_videomode with videomode drm/exynos: check a pixel format to a particular window layer drm/exynos: fix fimd pixel format setting drm/exynos: Add NULL pointer check drm/exynos: Remove redundant error messages drm/exynos: Add missing of.h header include drm/exynos: Remove redundant NULL check in exynos_drm_buf drm/exynos: add device tree support for rotator drm/exynos: Add missing includes drm/exynos: add runtime pm interfaces to g2d driver ...
2 parents 3b28802 + 6914262 commit 86a7e12

26 files changed

+357
-399
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
* Samsung Image Rotator
2+
3+
Required properties:
4+
- compatible : value should be one of the following:
5+
(a) "samsung,exynos4210-rotator" for Rotator IP in Exynos4210
6+
(b) "samsung,exynos4212-rotator" for Rotator IP in Exynos4212/4412
7+
(c) "samsung,exynos5250-rotator" for Rotator IP in Exynos5250
8+
9+
- reg : Physical base address of the IP registers and length of memory
10+
mapped region.
11+
12+
- interrupts : Interrupt specifier for rotator interrupt, according to format
13+
specific to interrupt parent.
14+
15+
- clocks : Clock specifier for rotator clock, according to generic clock
16+
bindings. (See Documentation/devicetree/bindings/clock/exynos*.txt)
17+
18+
- clock-names : Names of clocks. For exynos rotator, it should be "rotator".
19+
20+
Example:
21+
rotator@12810000 {
22+
compatible = "samsung,exynos4210-rotator";
23+
reg = <0x12810000 0x1000>;
24+
interrupts = <0 83 0>;
25+
clocks = <&clock 278>;
26+
clock-names = "rotator";
27+
};

drivers/gpu/drm/exynos/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
config DRM_EXYNOS
22
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)
44
select DRM_KMS_HELPER
55
select FB_CFB_FILLRECT
66
select FB_CFB_COPYAREA
77
select FB_CFB_IMAGEBLIT
88
select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE
9+
select VIDEOMODE_HELPERS
910
help
1011
Choose this option if you have a Samsung SoC EXYNOS chipset.
1112
If M is selected the module will be called exynosdrm.
@@ -24,9 +25,8 @@ config DRM_EXYNOS_DMABUF
2425

2526
config DRM_EXYNOS_FIMD
2627
bool "Exynos DRM FIMD"
27-
depends on OF && DRM_EXYNOS && !FB_S3C && !ARCH_MULTIPLATFORM
28+
depends on DRM_EXYNOS && !FB_S3C && !ARCH_MULTIPLATFORM
2829
select FB_MODE_HELPERS
29-
select VIDEOMODE_HELPERS
3030
help
3131
Choose this option if you want to use Exynos FIMD for DRM.
3232

drivers/gpu/drm/exynos/exynos_ddc.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include <linux/kernel.h>
1717
#include <linux/i2c.h>
18-
18+
#include <linux/of.h>
1919

2020
#include "exynos_drm_drv.h"
2121
#include "exynos_hdmi.h"
@@ -41,13 +41,6 @@ static int s5p_ddc_remove(struct i2c_client *client)
4141
return 0;
4242
}
4343

44-
static struct i2c_device_id ddc_idtable[] = {
45-
{"s5p_ddc", 0},
46-
{"exynos5-hdmiddc", 0},
47-
{ },
48-
};
49-
50-
#ifdef CONFIG_OF
5144
static struct of_device_id hdmiddc_match_types[] = {
5245
{
5346
.compatible = "samsung,exynos5-hdmiddc",
@@ -57,15 +50,13 @@ static struct of_device_id hdmiddc_match_types[] = {
5750
/* end node */
5851
}
5952
};
60-
#endif
6153

6254
struct i2c_driver ddc_driver = {
6355
.driver = {
6456
.name = "exynos-hdmiddc",
6557
.owner = THIS_MODULE,
66-
.of_match_table = of_match_ptr(hdmiddc_match_types),
58+
.of_match_table = hdmiddc_match_types,
6759
},
68-
.id_table = ddc_idtable,
6960
.probe = s5p_ddc_probe,
7061
.remove = s5p_ddc_remove,
7162
.command = NULL,

drivers/gpu/drm/exynos/exynos_drm_buf.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,8 @@ struct exynos_drm_gem_buf *exynos_drm_init_buf(struct drm_device *dev,
149149
DRM_DEBUG_KMS("desired size = 0x%x\n", size);
150150

151151
buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
152-
if (!buffer) {
153-
DRM_ERROR("failed to allocate exynos_drm_gem_buf.\n");
152+
if (!buffer)
154153
return NULL;
155-
}
156154

157155
buffer->size = size;
158156
return buffer;
@@ -161,11 +159,6 @@ struct exynos_drm_gem_buf *exynos_drm_init_buf(struct drm_device *dev,
161159
void exynos_drm_fini_buf(struct drm_device *dev,
162160
struct exynos_drm_gem_buf *buffer)
163161
{
164-
if (!buffer) {
165-
DRM_DEBUG_KMS("buffer is null.\n");
166-
return;
167-
}
168-
169162
kfree(buffer);
170163
buffer = NULL;
171164
}

drivers/gpu/drm/exynos/exynos_drm_connector.c

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <drm/exynos_drm.h>
1818
#include "exynos_drm_drv.h"
1919
#include "exynos_drm_encoder.h"
20+
#include "exynos_drm_connector.h"
2021

2122
#define to_exynos_connector(x) container_of(x, struct exynos_drm_connector,\
2223
drm_connector)
@@ -28,35 +29,6 @@ struct exynos_drm_connector {
2829
uint32_t dpms;
2930
};
3031

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-
6032
static int exynos_drm_connector_get_modes(struct drm_connector *connector)
6133
{
6234
struct exynos_drm_connector *exynos_connector =
@@ -111,7 +83,9 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
11183
return 0;
11284
}
11385

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;
11589
connector->display_info.width_mm = mode->width_mm;
11690
connector->display_info.height_mm = mode->height_mm;
11791

@@ -278,10 +252,8 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
278252
int err;
279253

280254
exynos_connector = kzalloc(sizeof(*exynos_connector), GFP_KERNEL);
281-
if (!exynos_connector) {
282-
DRM_ERROR("failed to allocate connector\n");
255+
if (!exynos_connector)
283256
return NULL;
284-
}
285257

286258
connector = &exynos_connector->drm_connector;
287259

drivers/gpu/drm/exynos/exynos_drm_crtc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <drm/drmP.h>
1616
#include <drm/drm_crtc_helper.h>
1717

18+
#include "exynos_drm_crtc.h"
1819
#include "exynos_drm_drv.h"
1920
#include "exynos_drm_encoder.h"
2021
#include "exynos_drm_plane.h"
@@ -324,10 +325,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)
324325
struct drm_crtc *crtc;
325326

326327
exynos_crtc = kzalloc(sizeof(*exynos_crtc), GFP_KERNEL);
327-
if (!exynos_crtc) {
328-
DRM_ERROR("failed to allocate exynos crtc\n");
328+
if (!exynos_crtc)
329329
return -ENOMEM;
330-
}
331330

332331
exynos_crtc->pipe = nr;
333332
exynos_crtc->dpms = DRM_MODE_DPMS_OFF;

drivers/gpu/drm/exynos/exynos_drm_dmabuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <drm/drmP.h>
1313
#include <drm/exynos_drm.h>
14+
#include "exynos_drm_dmabuf.h"
1415
#include "exynos_drm_drv.h"
1516
#include "exynos_drm_gem.h"
1617

@@ -230,7 +231,6 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
230231

231232
buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
232233
if (!buffer) {
233-
DRM_ERROR("failed to allocate exynos_drm_gem_buf.\n");
234234
ret = -ENOMEM;
235235
goto err_unmap_attach;
236236
}

drivers/gpu/drm/exynos/exynos_drm_drv.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
4747
int nr;
4848

4949
private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL);
50-
if (!private) {
51-
DRM_ERROR("failed to allocate private\n");
50+
if (!private)
5251
return -ENOMEM;
53-
}
5452

5553
INIT_LIST_HEAD(&private->pageflip_event_list);
5654
dev->dev_private = (void *)private;

drivers/gpu/drm/exynos/exynos_drm_encoder.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,8 @@ exynos_drm_encoder_create(struct drm_device *dev,
324324
return NULL;
325325

326326
exynos_encoder = kzalloc(sizeof(*exynos_encoder), GFP_KERNEL);
327-
if (!exynos_encoder) {
328-
DRM_ERROR("failed to allocate encoder\n");
327+
if (!exynos_encoder)
329328
return NULL;
330-
}
331329

332330
exynos_encoder->dpms = DRM_MODE_DPMS_OFF;
333331
exynos_encoder->manager = manager;

drivers/gpu/drm/exynos/exynos_drm_fb.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,8 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
156156
}
157157

158158
exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL);
159-
if (!exynos_fb) {
160-
DRM_ERROR("failed to allocate exynos drm framebuffer\n");
159+
if (!exynos_fb)
161160
return ERR_PTR(-ENOMEM);
162-
}
163161

164162
drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
165163
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,
220218
int i, ret;
221219

222220
exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL);
223-
if (!exynos_fb) {
224-
DRM_ERROR("failed to allocate exynos drm framebuffer\n");
221+
if (!exynos_fb)
225222
return ERR_PTR(-ENOMEM);
226-
}
227223

228224
obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]);
229225
if (!obj) {

drivers/gpu/drm/exynos/exynos_drm_fbdev.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
#include <drm/drm_crtc.h>
1717
#include <drm/drm_fb_helper.h>
1818
#include <drm/drm_crtc_helper.h>
19+
#include <drm/exynos_drm.h>
1920

2021
#include "exynos_drm_drv.h"
2122
#include "exynos_drm_fb.h"
23+
#include "exynos_drm_fbdev.h"
2224
#include "exynos_drm_gem.h"
2325
#include "exynos_drm_iommu.h"
2426

@@ -165,8 +167,18 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
165167

166168
size = mode_cmd.pitches[0] * mode_cmd.height;
167169

168-
/* 0 means to allocate physically continuous memory */
169-
exynos_gem_obj = exynos_drm_gem_create(dev, 0, size);
170+
exynos_gem_obj = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG, 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+
170182
if (IS_ERR(exynos_gem_obj)) {
171183
ret = PTR_ERR(exynos_gem_obj);
172184
goto err_release_framebuffer;
@@ -236,10 +248,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
236248
return 0;
237249

238250
fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
239-
if (!fbdev) {
240-
DRM_ERROR("failed to allocate drm fbdev.\n");
251+
if (!fbdev)
241252
return -ENOMEM;
242-
}
243253

244254
private->fb_helper = helper = &fbdev->drm_fb_helper;
245255
helper->funcs = &exynos_drm_fb_helper_funcs;

drivers/gpu/drm/exynos/exynos_drm_fimc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
#include <linux/regmap.h>
1818
#include <linux/clk.h>
1919
#include <linux/pm_runtime.h>
20+
#include <linux/of.h>
2021

2122
#include <drm/drmP.h>
2223
#include <drm/exynos_drm.h>
2324
#include "regs-fimc.h"
25+
#include "exynos_drm_drv.h"
2426
#include "exynos_drm_ipp.h"
2527
#include "exynos_drm_fimc.h"
2628

@@ -1343,10 +1345,8 @@ static int fimc_init_prop_list(struct exynos_drm_ippdrv *ippdrv)
13431345
struct drm_exynos_ipp_prop_list *prop_list;
13441346

13451347
prop_list = devm_kzalloc(ippdrv->dev, sizeof(*prop_list), GFP_KERNEL);
1346-
if (!prop_list) {
1347-
DRM_ERROR("failed to alloc property list.\n");
1348+
if (!prop_list)
13481349
return -ENOMEM;
1349-
}
13501350

13511351
prop_list->version = 1;
13521352
prop_list->writeback = 1;

0 commit comments

Comments
 (0)