Skip to content

Commit d9bd0fb

Browse files
committed
Merge branch 'at91-4.14-trunk/lcd' into linux-4.14-at91
2 parents cb62975 + 4b8db6a commit d9bd0fb

4 files changed

Lines changed: 70 additions & 1 deletion

File tree

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/pm_runtime.h>
2727

2828
#include "atmel_hlcdc_dc.h"
29+
#include <drm/atmel_drm.h>
2930

3031
#define ATMEL_HLCDC_LAYER_IRQS_OFFSET 8
3132

@@ -740,6 +741,41 @@ static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
740741

741742
DEFINE_DRM_GEM_CMA_FOPS(fops);
742743

744+
/*
745+
ioctl to export the physical address of GEM to user space for
746+
video decoder
747+
*/
748+
int atmel_drm_gem_get_ioctl(struct drm_device *drm, void *data,
749+
struct drm_file *file_priv)
750+
{
751+
struct drm_gem_object *gem_obj;
752+
struct drm_gem_cma_object *cma_obj;
753+
struct drm_mode_map_dumb *args = data;
754+
755+
mutex_lock(&drm->struct_mutex);
756+
757+
gem_obj = drm_gem_object_lookup(file_priv, args->handle);
758+
if (!gem_obj) {
759+
dev_err(drm->dev, "failed to lookup gem object\n");
760+
mutex_unlock(&drm->struct_mutex);
761+
return -EINVAL;
762+
}
763+
764+
cma_obj = to_drm_gem_cma_obj(gem_obj);
765+
args->offset = (__u64)cma_obj->paddr;
766+
767+
drm_gem_object_unreference(gem_obj);
768+
769+
mutex_unlock(&drm->struct_mutex);
770+
771+
return 0;
772+
}
773+
static const struct drm_ioctl_desc atmel_ioctls[] = {
774+
DRM_IOCTL_DEF_DRV(ATMEL_GEM_GET, atmel_drm_gem_get_ioctl,
775+
DRM_CONTROL_ALLOW|DRM_UNLOCKED),
776+
};
777+
778+
743779
static struct drm_driver atmel_hlcdc_dc_driver = {
744780
.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
745781
DRIVER_MODESET | DRIVER_PRIME |
@@ -761,6 +797,8 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
761797
.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
762798
.gem_prime_mmap = drm_gem_cma_prime_mmap,
763799
.dumb_create = drm_gem_cma_dumb_create,
800+
.ioctls = atmel_ioctls,
801+
.num_ioctls= ARRAY_SIZE(atmel_ioctls),
764802
.fops = &fops,
765803
.name = "atmel-hlcdc",
766804
.desc = "Atmel HLCD Controller DRM",
@@ -786,6 +824,7 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
786824
if (ret)
787825
goto err_unload;
788826

827+
dev_info(ddev->dev, "DRM device successfully registered\n");
789828
return 0;
790829

791830
err_unload:

drivers/gpu/drm/drm_edid.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,7 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
14831483
* DDC monitors.
14841484
*/
14851485
ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
1486+
udelay(100);
14861487

14871488
if (ret == -ENXIO) {
14881489
DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",

drivers/gpu/drm/drm_probe_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ enum drm_mode_status drm_connector_mode_valid(struct drm_connector *connector,
206206
return connector_funcs->mode_valid(connector, mode);
207207
}
208208

209-
#define DRM_OUTPUT_POLL_PERIOD (10*HZ)
209+
#define DRM_OUTPUT_POLL_PERIOD (4*HZ)
210210
/**
211211
* drm_kms_helper_poll_enable - re-enable output polling.
212212
* @dev: drm_device

include/uapi/drm/atmel_drm.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (C) 2014 Atmel
3+
*
4+
* Author: Mohamed Jamsheeth <mohamedjamsheeth.hajanajubudeen@atmel.com>
5+
*
6+
* This program is free software; you can redistribute it and/or modify it
7+
* under the terms of the GNU General Public License version 2 as published by
8+
* the Free Software Foundation.
9+
*
10+
* This program is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13+
* more details.
14+
*
15+
* You should have received a copy of the GNU General Public License along with
16+
* this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#ifndef _UAPI_ATMEL_DRM_H_
20+
#define _UAPI_ATMEL_DRM_H_
21+
22+
#include <drm/drm.h>
23+
24+
#define DRM_ATMEL_GEM_GET 0x00
25+
26+
#define DRM_IOCTL_ATMEL_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
27+
DRM_ATMEL_GEM_GET, struct drm_mode_map_dumb)
28+
29+
#endif /* _UAPI_ATMEL_DRM_H_ */

0 commit comments

Comments
 (0)