2018-07-26 10:37:32 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2013-06-19 19:54:11 +08:00
|
|
|
/*
|
|
|
|
* rcar_du_drv.c -- R-Car Display Unit DRM driver
|
|
|
|
*
|
2015-09-07 22:34:26 +08:00
|
|
|
* Copyright (C) 2013-2015 Renesas Electronics Corporation
|
2013-06-19 19:54:11 +08:00
|
|
|
*
|
|
|
|
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/module.h>
|
2014-01-21 22:57:26 +08:00
|
|
|
#include <linux/of_device.h>
|
2013-06-19 19:54:11 +08:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/pm.h>
|
|
|
|
#include <linux/slab.h>
|
2015-02-23 07:02:15 +08:00
|
|
|
#include <linux/wait.h>
|
2013-06-19 19:54:11 +08:00
|
|
|
|
2017-09-16 00:42:06 +08:00
|
|
|
#include <drm/drm_atomic_helper.h>
|
2013-03-15 05:45:22 +08:00
|
|
|
#include <drm/drm_fb_cma_helper.h>
|
2018-11-29 05:27:11 +08:00
|
|
|
#include <drm/drm_fb_helper.h>
|
2019-01-26 20:25:25 +08:00
|
|
|
#include <drm/drm_drv.h>
|
2013-06-19 19:54:11 +08:00
|
|
|
#include <drm/drm_gem_cma_helper.h>
|
2019-01-18 05:03:34 +08:00
|
|
|
#include <drm/drm_probe_helper.h>
|
2013-06-19 19:54:11 +08:00
|
|
|
|
|
|
|
#include "rcar_du_drv.h"
|
|
|
|
#include "rcar_du_kms.h"
|
2018-01-10 11:47:42 +08:00
|
|
|
#include "rcar_du_of.h"
|
2013-06-19 19:54:11 +08:00
|
|
|
#include "rcar_du_regs.h"
|
|
|
|
|
2014-01-21 22:57:26 +08:00
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Device Information
|
|
|
|
*/
|
|
|
|
|
2017-10-13 23:22:20 +08:00
|
|
|
static const struct rcar_du_device_info rzg1_du_r8a7743_info = {
|
|
|
|
.gen = 2,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2017-10-13 23:22:20 +08:00
|
|
|
.routes = {
|
|
|
|
/*
|
2018-09-22 02:08:30 +08:00
|
|
|
* R8A774[34] has one RGB output and one LVDS output
|
2017-10-13 23:22:20 +08:00
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(1) | BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
|
|
|
};
|
|
|
|
|
2017-10-13 23:22:22 +08:00
|
|
|
static const struct rcar_du_device_info rzg1_du_r8a7745_info = {
|
|
|
|
.gen = 2,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2017-10-13 23:22:22 +08:00
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A7745 has two RGB outputs
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-10-17 00:58:59 +08:00
|
|
|
static const struct rcar_du_device_info rzg1_du_r8a77470_info = {
|
|
|
|
.gen = 2,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A77470 has two RGB outputs, one LVDS output, and
|
|
|
|
* one (currently unsupported) analog video output
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0) | BIT(1),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-04-12 20:38:04 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a774a1_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
|
|
|
.channels_mask = BIT(2) | BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A774A1 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
|
|
|
.dpll_mask = BIT(1),
|
|
|
|
};
|
|
|
|
|
2019-09-30 17:15:03 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a774b1_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
|
|
|
.channels_mask = BIT(3) | BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A774B1 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
|
|
|
.dpll_mask = BIT(1),
|
|
|
|
};
|
|
|
|
|
2018-12-14 04:23:27 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a774c0_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE,
|
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A774C0 has one RGB output and two LVDS outputs
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0) | BIT(1),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 2,
|
|
|
|
.lvds_clk_mask = BIT(1) | BIT(0),
|
|
|
|
};
|
|
|
|
|
2020-08-12 22:02:10 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a774e1_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
|
|
|
.channels_mask = BIT(3) | BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A774E1 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
|
|
|
.dpll_mask = BIT(1),
|
|
|
|
};
|
|
|
|
|
2014-01-21 22:57:26 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7779_info = {
|
2018-11-25 01:57:17 +08:00
|
|
|
.gen = 1,
|
2018-08-22 21:21:33 +08:00
|
|
|
.features = RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2014-01-21 22:57:26 +08:00
|
|
|
.routes = {
|
2017-07-11 06:13:20 +08:00
|
|
|
/*
|
|
|
|
* R8A7779 has two RGB outputs and one (currently unsupported)
|
2014-01-21 22:57:26 +08:00
|
|
|
* TCON output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1) | BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7790_info = {
|
2015-09-07 22:34:26 +08:00
|
|
|
.gen = 2,
|
2014-12-09 06:21:12 +08:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-01-10 11:47:42 +08:00
|
|
|
.quirks = RCAR_DU_QUIRK_ALIGN_128B,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(2) | BIT(1) | BIT(0),
|
2014-01-21 22:57:26 +08:00
|
|
|
.routes = {
|
2017-07-11 06:13:20 +08:00
|
|
|
/*
|
2020-08-08 01:49:49 +08:00
|
|
|
* R8A7742 and R8A7790 each have one RGB output and two LVDS
|
|
|
|
* outputs. Additionally R8A7790 supports one TCON output
|
|
|
|
* (currently unsupported by the driver).
|
2014-01-21 22:57:26 +08:00
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2) | BIT(1) | BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS1] = {
|
|
|
|
.possible_crtcs = BIT(2) | BIT(1),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 2,
|
|
|
|
};
|
|
|
|
|
2015-07-17 15:44:33 +08:00
|
|
|
/* M2-W (r8a7791) and M2-N (r8a7793) are identical */
|
2014-01-21 22:57:26 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7791_info = {
|
2015-09-07 22:34:26 +08:00
|
|
|
.gen = 2,
|
2014-12-09 06:21:12 +08:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2014-01-21 22:57:26 +08:00
|
|
|
.routes = {
|
2017-07-11 06:13:20 +08:00
|
|
|
/*
|
|
|
|
* R8A779[13] has one RGB output, one LVDS output and one
|
2014-01-21 22:57:26 +08:00
|
|
|
* (currently unsupported) TCON output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
2015-04-28 20:26:33 +08:00
|
|
|
.possible_crtcs = BIT(1) | BIT(0),
|
2014-01-21 22:57:26 +08:00
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
|
|
|
};
|
|
|
|
|
2016-08-05 06:01:02 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7792_info = {
|
|
|
|
.gen = 2,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2016-08-05 06:01:02 +08:00
|
|
|
.routes = {
|
|
|
|
/* R8A7792 has two RGB outputs. */
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2015-07-17 15:44:33 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7794_info = {
|
2015-09-07 22:34:26 +08:00
|
|
|
.gen = 2,
|
2015-07-17 15:44:33 +08:00
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
2015-07-17 15:44:33 +08:00
|
|
|
.routes = {
|
2017-07-11 06:13:20 +08:00
|
|
|
/*
|
|
|
|
* R8A7794 has two RGB outputs and one (currently unsupported)
|
2015-07-17 15:44:33 +08:00
|
|
|
* TCON output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_DPAD1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2015-09-07 22:34:26 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7795_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-21 00:00:44 +08:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(3) | BIT(2) | BIT(1) | BIT(0),
|
2015-09-07 22:34:26 +08:00
|
|
|
.routes = {
|
2017-07-11 06:13:20 +08:00
|
|
|
/*
|
|
|
|
* R8A7795 has one RGB output, two HDMI outputs and one
|
2016-11-12 01:07:39 +08:00
|
|
|
* LVDS output.
|
2015-09-07 22:34:26 +08:00
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(3),
|
|
|
|
.port = 0,
|
|
|
|
},
|
2016-11-12 01:07:39 +08:00
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI1] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 2,
|
|
|
|
},
|
2015-07-28 19:12:43 +08:00
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 3,
|
|
|
|
},
|
2015-09-07 22:34:26 +08:00
|
|
|
},
|
2015-07-28 19:12:43 +08:00
|
|
|
.num_lvds = 1,
|
2018-08-22 15:21:47 +08:00
|
|
|
.dpll_mask = BIT(2) | BIT(1),
|
2015-09-07 22:34:26 +08:00
|
|
|
};
|
|
|
|
|
2016-09-06 07:11:43 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7796_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-21 00:00:44 +08:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(2) | BIT(1) | BIT(0),
|
2016-09-06 07:11:43 +08:00
|
|
|
.routes = {
|
2017-07-11 06:13:20 +08:00
|
|
|
/*
|
2017-06-20 04:34:40 +08:00
|
|
|
* R8A7796 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
2016-09-06 07:11:43 +08:00
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
2017-06-20 04:34:40 +08:00
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
2016-09-06 07:11:43 +08:00
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2018-08-22 15:21:47 +08:00
|
|
|
.dpll_mask = BIT(1),
|
2016-09-06 07:11:43 +08:00
|
|
|
};
|
|
|
|
|
2018-04-28 06:21:54 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a77965_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-21 00:00:44 +08:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:54 +08:00
|
|
|
.channels_mask = BIT(3) | BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A77965 has one RGB output, one LVDS output and one HDMI
|
|
|
|
* output.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(2),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_HDMI0] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
2018-08-22 15:21:47 +08:00
|
|
|
.dpll_mask = BIT(1),
|
2018-04-28 06:21:54 +08:00
|
|
|
};
|
|
|
|
|
2018-01-19 05:05:59 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a77970_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
2018-08-21 00:00:44 +08:00
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE
|
2018-08-22 21:21:33 +08:00
|
|
|
| RCAR_DU_FEATURE_INTERLACED
|
|
|
|
| RCAR_DU_FEATURE_TVM_SYNC,
|
2018-04-28 06:21:52 +08:00
|
|
|
.channels_mask = BIT(0),
|
2018-01-19 05:05:59 +08:00
|
|
|
.routes = {
|
2019-09-12 03:25:01 +08:00
|
|
|
/*
|
|
|
|
* R8A77970 and R8A77980 have one RGB output and one LVDS
|
|
|
|
* output.
|
|
|
|
*/
|
2018-01-19 05:05:59 +08:00
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 1,
|
|
|
|
};
|
|
|
|
|
2018-08-14 21:49:56 +08:00
|
|
|
static const struct rcar_du_device_info rcar_du_r8a7799x_info = {
|
|
|
|
.gen = 3,
|
|
|
|
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
|
|
|
|
| RCAR_DU_FEATURE_VSP1_SOURCE,
|
|
|
|
.channels_mask = BIT(1) | BIT(0),
|
|
|
|
.routes = {
|
|
|
|
/*
|
|
|
|
* R8A77990 and R8A77995 have one RGB output and two LVDS
|
|
|
|
* outputs.
|
|
|
|
*/
|
|
|
|
[RCAR_DU_OUTPUT_DPAD0] = {
|
|
|
|
.possible_crtcs = BIT(0) | BIT(1),
|
|
|
|
.port = 0,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS0] = {
|
|
|
|
.possible_crtcs = BIT(0),
|
|
|
|
.port = 1,
|
|
|
|
},
|
|
|
|
[RCAR_DU_OUTPUT_LVDS1] = {
|
|
|
|
.possible_crtcs = BIT(1),
|
|
|
|
.port = 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.num_lvds = 2,
|
|
|
|
.lvds_clk_mask = BIT(1) | BIT(0),
|
|
|
|
};
|
|
|
|
|
2014-01-21 22:57:26 +08:00
|
|
|
static const struct of_device_id rcar_du_of_table[] = {
|
2020-08-08 01:49:49 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7742", .data = &rcar_du_r8a7790_info },
|
2017-10-13 23:22:20 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info },
|
2018-09-22 02:08:30 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7744", .data = &rzg1_du_r8a7743_info },
|
2017-10-13 23:22:22 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7745", .data = &rzg1_du_r8a7745_info },
|
2018-10-17 00:58:59 +08:00
|
|
|
{ .compatible = "renesas,du-r8a77470", .data = &rzg1_du_r8a77470_info },
|
2019-04-12 20:38:04 +08:00
|
|
|
{ .compatible = "renesas,du-r8a774a1", .data = &rcar_du_r8a774a1_info },
|
2019-09-30 17:15:03 +08:00
|
|
|
{ .compatible = "renesas,du-r8a774b1", .data = &rcar_du_r8a774b1_info },
|
2018-12-14 04:23:27 +08:00
|
|
|
{ .compatible = "renesas,du-r8a774c0", .data = &rcar_du_r8a774c0_info },
|
2020-08-12 22:02:10 +08:00
|
|
|
{ .compatible = "renesas,du-r8a774e1", .data = &rcar_du_r8a774e1_info },
|
2014-01-21 22:57:26 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7779", .data = &rcar_du_r8a7779_info },
|
|
|
|
{ .compatible = "renesas,du-r8a7790", .data = &rcar_du_r8a7790_info },
|
|
|
|
{ .compatible = "renesas,du-r8a7791", .data = &rcar_du_r8a7791_info },
|
2016-08-05 06:01:02 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7792", .data = &rcar_du_r8a7792_info },
|
2015-07-17 15:44:33 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7793", .data = &rcar_du_r8a7791_info },
|
2015-07-17 15:44:33 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7794", .data = &rcar_du_r8a7794_info },
|
2015-09-07 22:34:26 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7795", .data = &rcar_du_r8a7795_info },
|
2016-09-06 07:11:43 +08:00
|
|
|
{ .compatible = "renesas,du-r8a7796", .data = &rcar_du_r8a7796_info },
|
2020-09-08 08:34:32 +08:00
|
|
|
{ .compatible = "renesas,du-r8a77961", .data = &rcar_du_r8a7796_info },
|
2018-04-28 06:21:54 +08:00
|
|
|
{ .compatible = "renesas,du-r8a77965", .data = &rcar_du_r8a77965_info },
|
2018-01-19 05:05:59 +08:00
|
|
|
{ .compatible = "renesas,du-r8a77970", .data = &rcar_du_r8a77970_info },
|
2019-09-12 03:25:01 +08:00
|
|
|
{ .compatible = "renesas,du-r8a77980", .data = &rcar_du_r8a77970_info },
|
2018-08-14 21:49:56 +08:00
|
|
|
{ .compatible = "renesas,du-r8a77990", .data = &rcar_du_r8a7799x_info },
|
|
|
|
{ .compatible = "renesas,du-r8a77995", .data = &rcar_du_r8a7799x_info },
|
2014-01-21 22:57:26 +08:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(of, rcar_du_of_table);
|
|
|
|
|
2013-06-19 19:54:11 +08:00
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* DRM operations
|
|
|
|
*/
|
|
|
|
|
2017-03-08 22:12:56 +08:00
|
|
|
DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
|
2013-06-19 19:54:11 +08:00
|
|
|
|
2020-11-04 18:04:24 +08:00
|
|
|
static const struct drm_driver rcar_du_driver = {
|
2019-06-17 23:39:24 +08:00
|
|
|
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
|
2020-06-05 15:32:34 +08:00
|
|
|
DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(rcar_du_dumb_create),
|
2013-06-19 19:54:11 +08:00
|
|
|
.fops = &rcar_du_fops,
|
|
|
|
.name = "rcar-du",
|
|
|
|
.desc = "Renesas R-Car Display Unit",
|
|
|
|
.date = "20130110",
|
|
|
|
.major = 1,
|
|
|
|
.minor = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Power management
|
|
|
|
*/
|
|
|
|
|
2014-07-13 19:18:58 +08:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2013-06-19 19:54:11 +08:00
|
|
|
static int rcar_du_pm_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
struct rcar_du_device *rcdu = dev_get_drvdata(dev);
|
|
|
|
|
2018-09-19 00:39:03 +08:00
|
|
|
return drm_mode_config_helper_suspend(rcdu->ddev);
|
2013-06-19 19:54:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int rcar_du_pm_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
struct rcar_du_device *rcdu = dev_get_drvdata(dev);
|
|
|
|
|
2018-09-19 00:39:03 +08:00
|
|
|
return drm_mode_config_helper_resume(rcdu->ddev);
|
2013-06-19 19:54:11 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const struct dev_pm_ops rcar_du_pm_ops = {
|
|
|
|
SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, rcar_du_pm_resume)
|
|
|
|
};
|
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
* Platform driver
|
|
|
|
*/
|
|
|
|
|
2015-09-28 23:39:53 +08:00
|
|
|
static int rcar_du_remove(struct platform_device *pdev)
|
2013-06-19 19:54:11 +08:00
|
|
|
{
|
2015-09-28 23:39:53 +08:00
|
|
|
struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
|
|
|
|
struct drm_device *ddev = rcdu->ddev;
|
|
|
|
|
|
|
|
drm_dev_unregister(ddev);
|
|
|
|
|
|
|
|
drm_kms_helper_poll_fini(ddev);
|
|
|
|
|
2018-09-26 19:53:12 +08:00
|
|
|
drm_dev_put(ddev);
|
2015-09-28 23:39:53 +08:00
|
|
|
|
|
|
|
return 0;
|
2013-06-19 19:54:11 +08:00
|
|
|
}
|
|
|
|
|
2015-09-28 23:39:53 +08:00
|
|
|
static int rcar_du_probe(struct platform_device *pdev)
|
2013-06-19 19:54:11 +08:00
|
|
|
{
|
2015-09-28 23:39:53 +08:00
|
|
|
struct rcar_du_device *rcdu;
|
|
|
|
struct drm_device *ddev;
|
|
|
|
struct resource *mem;
|
|
|
|
int ret;
|
|
|
|
|
2016-10-19 05:51:35 +08:00
|
|
|
/* Allocate and initialize the R-Car device structure. */
|
2015-09-28 23:39:53 +08:00
|
|
|
rcdu = devm_kzalloc(&pdev->dev, sizeof(*rcdu), GFP_KERNEL);
|
|
|
|
if (rcdu == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
rcdu->dev = &pdev->dev;
|
2016-10-16 16:01:47 +08:00
|
|
|
rcdu->info = of_device_get_match_data(rcdu->dev);
|
2015-09-28 23:39:53 +08:00
|
|
|
|
|
|
|
platform_set_drvdata(pdev, rcdu);
|
|
|
|
|
|
|
|
/* I/O resources */
|
|
|
|
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
|
|
rcdu->mmio = devm_ioremap_resource(&pdev->dev, mem);
|
2016-10-19 05:51:35 +08:00
|
|
|
if (IS_ERR(rcdu->mmio))
|
|
|
|
return PTR_ERR(rcdu->mmio);
|
2015-09-28 23:39:53 +08:00
|
|
|
|
|
|
|
/* DRM/KMS objects */
|
2016-10-19 05:51:35 +08:00
|
|
|
ddev = drm_dev_alloc(&rcar_du_driver, &pdev->dev);
|
|
|
|
if (IS_ERR(ddev))
|
|
|
|
return PTR_ERR(ddev);
|
|
|
|
|
|
|
|
rcdu->ddev = ddev;
|
|
|
|
ddev->dev_private = rcdu;
|
|
|
|
|
2015-09-28 23:39:53 +08:00
|
|
|
ret = rcar_du_modeset_init(rcdu);
|
|
|
|
if (ret < 0) {
|
2016-05-25 08:41:18 +08:00
|
|
|
if (ret != -EPROBE_DEFER)
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"failed to initialize DRM/KMS (%d)\n", ret);
|
2015-09-28 23:39:53 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
ddev->irq_enabled = 1;
|
|
|
|
|
2017-07-11 06:13:20 +08:00
|
|
|
/*
|
|
|
|
* Register the DRM device with the core and the connectors with
|
2015-09-28 23:39:53 +08:00
|
|
|
* sysfs.
|
|
|
|
*/
|
|
|
|
ret = drm_dev_register(ddev, 0);
|
|
|
|
if (ret)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
DRM_INFO("Device %s probed\n", dev_name(&pdev->dev));
|
2013-06-19 19:54:11 +08:00
|
|
|
|
2018-11-29 05:27:11 +08:00
|
|
|
drm_fbdev_generic_setup(ddev, 32);
|
|
|
|
|
2013-06-19 19:54:11 +08:00
|
|
|
return 0;
|
2015-09-28 23:39:53 +08:00
|
|
|
|
|
|
|
error:
|
|
|
|
rcar_du_remove(pdev);
|
|
|
|
|
|
|
|
return ret;
|
2013-06-19 19:54:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver rcar_du_platform_driver = {
|
|
|
|
.probe = rcar_du_probe,
|
|
|
|
.remove = rcar_du_remove,
|
|
|
|
.driver = {
|
|
|
|
.name = "rcar-du",
|
|
|
|
.pm = &rcar_du_pm_ops,
|
2014-01-21 22:57:26 +08:00
|
|
|
.of_match_table = rcar_du_of_table,
|
2013-06-19 19:54:11 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-01-10 11:47:42 +08:00
|
|
|
static int __init rcar_du_init(void)
|
|
|
|
{
|
|
|
|
rcar_du_of_init(rcar_du_of_table);
|
|
|
|
|
|
|
|
return platform_driver_register(&rcar_du_platform_driver);
|
|
|
|
}
|
|
|
|
module_init(rcar_du_init);
|
|
|
|
|
|
|
|
static void __exit rcar_du_exit(void)
|
|
|
|
{
|
|
|
|
platform_driver_unregister(&rcar_du_platform_driver);
|
|
|
|
}
|
|
|
|
module_exit(rcar_du_exit);
|
2013-06-19 19:54:11 +08:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
|
|
|
|
MODULE_DESCRIPTION("Renesas R-Car Display Unit DRM Driver");
|
|
|
|
MODULE_LICENSE("GPL");
|