2015-08-19 20:19:49 -06:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Freescale Semiconductor, Inc.
|
|
|
|
*
|
|
|
|
* Freescale DCU drm device driver
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <drm/drmP.h>
|
|
|
|
#include <drm/drm_atomic_helper.h>
|
|
|
|
#include <drm/drm_crtc_helper.h>
|
|
|
|
#include <drm/drm_fb_cma_helper.h>
|
|
|
|
|
|
|
|
#include "fsl_dcu_drm_crtc.h"
|
|
|
|
#include "fsl_dcu_drm_drv.h"
|
|
|
|
|
|
|
|
static const struct drm_mode_config_funcs fsl_dcu_drm_mode_config_funcs = {
|
|
|
|
.atomic_check = drm_atomic_helper_check,
|
|
|
|
.atomic_commit = drm_atomic_helper_commit,
|
|
|
|
.fb_create = drm_fb_cma_create,
|
|
|
|
};
|
|
|
|
|
|
|
|
int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev)
|
|
|
|
{
|
2015-11-16 17:25:17 -07:00
|
|
|
int ret;
|
|
|
|
|
2015-08-19 20:19:49 -06:00
|
|
|
drm_mode_config_init(fsl_dev->drm);
|
|
|
|
|
|
|
|
fsl_dev->drm->mode_config.min_width = 0;
|
|
|
|
fsl_dev->drm->mode_config.min_height = 0;
|
|
|
|
fsl_dev->drm->mode_config.max_width = 2031;
|
|
|
|
fsl_dev->drm->mode_config.max_height = 2047;
|
|
|
|
fsl_dev->drm->mode_config.funcs = &fsl_dcu_drm_mode_config_funcs;
|
|
|
|
|
2015-11-16 17:25:17 -07:00
|
|
|
ret = fsl_dcu_drm_crtc_create(fsl_dev);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = fsl_dcu_drm_encoder_create(fsl_dev, &fsl_dev->crtc);
|
|
|
|
if (ret)
|
|
|
|
goto fail_encoder;
|
|
|
|
|
|
|
|
ret = fsl_dcu_drm_connector_create(fsl_dev, &fsl_dev->encoder);
|
|
|
|
if (ret)
|
|
|
|
goto fail_connector;
|
|
|
|
|
2015-08-19 20:19:49 -06:00
|
|
|
drm_mode_config_reset(fsl_dev->drm);
|
2015-11-16 17:25:17 -07:00
|
|
|
drm_kms_helper_poll_init(fsl_dev->drm);
|
2015-08-19 20:19:49 -06:00
|
|
|
|
|
|
|
return 0;
|
2015-11-16 17:25:17 -07:00
|
|
|
fail_encoder:
|
|
|
|
fsl_dev->crtc.funcs->destroy(&fsl_dev->crtc);
|
|
|
|
fail_connector:
|
|
|
|
fsl_dev->encoder.funcs->destroy(&fsl_dev->encoder);
|
|
|
|
return ret;
|
2015-08-19 20:19:49 -06:00
|
|
|
}
|